fix formula for logb in n1570.html
[c-standard.git] / n1256.html
blob074474e43769bb791105cbe6fa6623b0f401f0d3
1 <html><head><title>WG14/N1256 Septermber 7, 2007 ISO/IEC 9899:TC3</title></head><body>
2 <pre><!--page 1 -->
3 WG14/N1256 Committee Draft -- Septermber 7, 2007 ISO/IEC 9899:TC3
6 </pre>
8 <p><small><a href="#Contents">Contents</a></small>
9 <h2><a name="Contents" href="#Contents">Contents</a></h2>
10 <ul>
11 <li><a href="#Foreword">Foreword</a>
12 <li><a href="#Introduction">Introduction</a>
13 <li><a href="#1">1. Scope</a>
14 <li><a href="#2">2. Normative references</a>
15 <li><a href="#3">3. Terms, definitions, and symbols</a>
16 <li><a href="#4">4. Conformance</a>
17 <li><a href="#5">5. Environment</a>
18 <ul>
19 <li><a href="#5.1"> 5.1 Conceptual models</a>
20 <ul>
21 <li><a href="#5.1.1"> 5.1.1 Translation environment</a>
22 <li><a href="#5.1.2"> 5.1.2 Execution environments</a>
23 </ul>
24 <li><a href="#5.2"> 5.2 Environmental considerations</a>
25 <ul>
26 <li><a href="#5.2.1"> 5.2.1 Character sets</a>
27 <li><a href="#5.2.2"> 5.2.2 Character display semantics</a>
28 <li><a href="#5.2.3"> 5.2.3 Signals and interrupts</a>
29 <li><a href="#5.2.4"> 5.2.4 Environmental limits</a>
30 </ul>
31 </ul>
32 <li><a href="#6">6. Language</a>
33 <ul>
34 <li><a href="#6.1"> 6.1 Notation</a>
35 <li><a href="#6.2"> 6.2 Concepts</a>
36 <ul>
37 <li><a href="#6.2.1"> 6.2.1 Scopes of identifiers</a>
38 <li><a href="#6.2.2"> 6.2.2 Linkages of identifiers</a>
39 <li><a href="#6.2.3"> 6.2.3 Name spaces of identifiers</a>
40 <li><a href="#6.2.4"> 6.2.4 Storage durations of objects</a>
41 <li><a href="#6.2.5"> 6.2.5 Types</a>
42 <li><a href="#6.2.6"> 6.2.6 Representations of types</a>
43 <li><a href="#6.2.7"> 6.2.7 Compatible type and composite type</a>
44 </ul>
45 <li><a href="#6.3"> 6.3 Conversions</a>
46 <ul>
47 <li><a href="#6.3.1"> 6.3.1 Arithmetic operands</a>
48 <li><a href="#6.3.2"> 6.3.2 Other operands</a>
49 </ul>
50 <li><a href="#6.4"> 6.4 Lexical elements</a>
51 <ul>
52 <li><a href="#6.4.1"> 6.4.1 Keywords</a>
53 <li><a href="#6.4.2"> 6.4.2 Identifiers</a>
54 <li><a href="#6.4.3"> 6.4.3 Universal character names</a>
55 <li><a href="#6.4.4"> 6.4.4 Constants</a>
56 <li><a href="#6.4.5"> 6.4.5 String literals</a>
57 <li><a href="#6.4.6"> 6.4.6 Punctuators</a>
58 <li><a href="#6.4.7"> 6.4.7 Header names</a>
59 <li><a href="#6.4.8"> 6.4.8 Preprocessing numbers</a>
60 <li><a href="#6.4.9"> 6.4.9 Comments</a>
61 </ul>
62 <li><a href="#6.5"> 6.5 Expressions</a>
63 <!--page 2 -->
64 <ul>
65 <li><a href="#6.5.1"> 6.5.1 Primary expressions</a>
66 <li><a href="#6.5.2"> 6.5.2 Postfix operators</a>
67 <li><a href="#6.5.3"> 6.5.3 Unary operators</a>
68 <li><a href="#6.5.4"> 6.5.4 Cast operators</a>
69 <li><a href="#6.5.5"> 6.5.5 Multiplicative operators</a>
70 <li><a href="#6.5.6"> 6.5.6 Additive operators</a>
71 <li><a href="#6.5.7"> 6.5.7 Bitwise shift operators</a>
72 <li><a href="#6.5.8"> 6.5.8 Relational operators</a>
73 <li><a href="#6.5.9"> 6.5.9 Equality operators</a>
74 <li><a href="#6.5.10"> 6.5.10 Bitwise AND operator</a>
75 <li><a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator</a>
76 <li><a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator</a>
77 <li><a href="#6.5.13"> 6.5.13 Logical AND operator</a>
78 <li><a href="#6.5.14"> 6.5.14 Logical OR operator</a>
79 <li><a href="#6.5.15"> 6.5.15 Conditional operator</a>
80 <li><a href="#6.5.16"> 6.5.16 Assignment operators</a>
81 <li><a href="#6.5.17"> 6.5.17 Comma operator</a>
82 </ul>
83 <li><a href="#6.6"> 6.6 Constant expressions</a>
84 <li><a href="#6.7"> 6.7 Declarations</a>
85 <ul>
86 <li><a href="#6.7.1"> 6.7.1 Storage-class specifiers</a>
87 <li><a href="#6.7.2"> 6.7.2 Type specifiers</a>
88 <li><a href="#6.7.3"> 6.7.3 Type qualifiers</a>
89 <li><a href="#6.7.4"> 6.7.4 Function specifiers</a>
90 <li><a href="#6.7.5"> 6.7.5 Declarators</a>
91 <li><a href="#6.7.6"> 6.7.6 Type names</a>
92 <li><a href="#6.7.7"> 6.7.7 Type definitions</a>
93 <li><a href="#6.7.8"> 6.7.8 Initialization</a>
94 </ul>
95 <li><a href="#6.8"> 6.8 Statements and blocks</a>
96 <ul>
97 <li><a href="#6.8.1"> 6.8.1 Labeled statements</a>
98 <li><a href="#6.8.2"> 6.8.2 Compound statement</a>
99 <li><a href="#6.8.3"> 6.8.3 Expression and null statements</a>
100 <li><a href="#6.8.4"> 6.8.4 Selection statements</a>
101 <li><a href="#6.8.5"> 6.8.5 Iteration statements</a>
102 <li><a href="#6.8.6"> 6.8.6 Jump statements</a>
103 </ul>
104 <li><a href="#6.9"> 6.9 External definitions</a>
105 <ul>
106 <li><a href="#6.9.1"> 6.9.1 Function definitions</a>
107 <li><a href="#6.9.2"> 6.9.2 External object definitions</a>
108 </ul>
109 <li><a href="#6.10"> 6.10 Preprocessing directives</a>
110 <ul>
111 <li><a href="#6.10.1"> 6.10.1 Conditional inclusion</a>
112 <li><a href="#6.10.2"> 6.10.2 Source file inclusion</a>
113 <li><a href="#6.10.3"> 6.10.3 Macro replacement</a>
114 <li><a href="#6.10.4"> 6.10.4 Line control</a>
115 <li><a href="#6.10.5"> 6.10.5 Error directive</a>
116 <li><a href="#6.10.6"> 6.10.6 Pragma directive</a>
117 <!--page 3 -->
118 <li><a href="#6.10.7"> 6.10.7 Null directive</a>
119 <li><a href="#6.10.8"> 6.10.8 Predefined macro names</a>
120 <li><a href="#6.10.9"> 6.10.9 Pragma operator</a>
121 </ul>
122 <li><a href="#6.11"> 6.11 Future language directions</a>
123 <ul>
124 <li><a href="#6.11.1"> 6.11.1 Floating types</a>
125 <li><a href="#6.11.2"> 6.11.2 Linkages of identifiers</a>
126 <li><a href="#6.11.3"> 6.11.3 External names</a>
127 <li><a href="#6.11.4"> 6.11.4 Character escape sequences</a>
128 <li><a href="#6.11.5"> 6.11.5 Storage-class specifiers</a>
129 <li><a href="#6.11.6"> 6.11.6 Function declarators</a>
130 <li><a href="#6.11.7"> 6.11.7 Function definitions</a>
131 <li><a href="#6.11.8"> 6.11.8 Pragma directives</a>
132 <li><a href="#6.11.9"> 6.11.9 Predefined macro names</a>
133 </ul>
134 </ul>
135 <li><a href="#7">7. Library</a>
136 <ul>
137 <li><a href="#7.1"> 7.1 Introduction</a>
138 <ul>
139 <li><a href="#7.1.1"> 7.1.1 Definitions of terms</a>
140 <li><a href="#7.1.2"> 7.1.2 Standard headers</a>
141 <li><a href="#7.1.3"> 7.1.3 Reserved identifiers</a>
142 <li><a href="#7.1.4"> 7.1.4 Use of library functions</a>
143 </ul>
144 <li><a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt;</a>
145 <ul>
146 <li><a href="#7.2.1"> 7.2.1 Program diagnostics</a>
147 </ul>
148 <li><a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt;</a>
149 <ul>
150 <li><a href="#7.3.1"> 7.3.1 Introduction</a>
151 <li><a href="#7.3.2"> 7.3.2 Conventions</a>
152 <li><a href="#7.3.3"> 7.3.3 Branch cuts</a>
153 <li><a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma</a>
154 <li><a href="#7.3.5"> 7.3.5 Trigonometric functions</a>
155 <li><a href="#7.3.6"> 7.3.6 Hyperbolic functions</a>
156 <li><a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions</a>
157 <li><a href="#7.3.8"> 7.3.8 Power and absolute-value functions</a>
158 <li><a href="#7.3.9"> 7.3.9 Manipulation functions</a>
159 </ul>
160 <li><a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt;</a>
161 <ul>
162 <li><a href="#7.4.1"> 7.4.1 Character classification functions</a>
163 <li><a href="#7.4.2"> 7.4.2 Character case mapping functions</a>
164 </ul>
165 <li><a href="#7.5"> 7.5 Errors &lt;errno.h&gt;</a>
166 <li><a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt;</a>
167 <ul>
168 <li><a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma</a>
169 <li><a href="#7.6.2"> 7.6.2 Floating-point exceptions</a>
170 <li><a href="#7.6.3"> 7.6.3 Rounding</a>
171 <li><a href="#7.6.4"> 7.6.4 Environment</a>
172 </ul>
173 <li><a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt;</a>
174 <li><a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</a>
175 <ul>
176 <li><a href="#7.8.1"> 7.8.1 Macros for format specifiers</a>
177 <li><a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types</a>
178 <!--page 4 -->
179 </ul>
180 <li><a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt;</a>
181 <li><a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt;</a>
182 <li><a href="#7.11"> 7.11 Localization &lt;locale.h&gt;</a>
183 <ul>
184 <li><a href="#7.11.1"> 7.11.1 Locale control</a>
185 <li><a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry</a>
186 </ul>
187 <li><a href="#7.12"> 7.12 Mathematics &lt;math.h&gt;</a>
188 <ul>
189 <li><a href="#7.12.1"> 7.12.1 Treatment of error conditions</a>
190 <li><a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma</a>
191 <li><a href="#7.12.3"> 7.12.3 Classification macros</a>
192 <li><a href="#7.12.4"> 7.12.4 Trigonometric functions</a>
193 <li><a href="#7.12.5"> 7.12.5 Hyperbolic functions</a>
194 <li><a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions</a>
195 <li><a href="#7.12.7"> 7.12.7 Power and absolute-value functions</a>
196 <li><a href="#7.12.8"> 7.12.8 Error and gamma functions</a>
197 <li><a href="#7.12.9"> 7.12.9 Nearest integer functions</a>
198 <li><a href="#7.12.10"> 7.12.10 Remainder functions</a>
199 <li><a href="#7.12.11"> 7.12.11 Manipulation functions</a>
200 <li><a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions</a>
201 <li><a href="#7.12.13"> 7.12.13 Floating multiply-add</a>
202 <li><a href="#7.12.14"> 7.12.14 Comparison macros</a>
203 </ul>
204 <li><a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</a>
205 <ul>
206 <li><a href="#7.13.1"> 7.13.1 Save calling environment</a>
207 <li><a href="#7.13.2"> 7.13.2 Restore calling environment</a>
208 </ul>
209 <li><a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt;</a>
210 <ul>
211 <li><a href="#7.14.1"> 7.14.1 Specify signal handling</a>
212 <li><a href="#7.14.2"> 7.14.2 Send signal</a>
213 </ul>
214 <li><a href="#7.15"> 7.15 Variable arguments &lt;stdarg.h&gt;</a>
215 <ul>
216 <li><a href="#7.15.1"> 7.15.1 Variable argument list access macros</a>
217 </ul>
218 <li><a href="#7.16"> 7.16 Boolean type and values &lt;stdbool.h&gt;</a>
219 <li><a href="#7.17"> 7.17 Common definitions &lt;stddef.h&gt;</a>
220 <li><a href="#7.18"> 7.18 Integer types &lt;stdint.h&gt;</a>
221 <ul>
222 <li><a href="#7.18.1"> 7.18.1 Integer types</a>
223 <li><a href="#7.18.2"> 7.18.2 Limits of specified-width integer types</a>
224 <li><a href="#7.18.3"> 7.18.3 Limits of other integer types</a>
225 <li><a href="#7.18.4"> 7.18.4 Macros for integer constants</a>
226 </ul>
227 <li><a href="#7.19"> 7.19 Input/output &lt;stdio.h&gt;</a>
228 <ul>
229 <li><a href="#7.19.1"> 7.19.1 Introduction</a>
230 <li><a href="#7.19.2"> 7.19.2 Streams</a>
231 <li><a href="#7.19.3"> 7.19.3 Files</a>
232 <li><a href="#7.19.4"> 7.19.4 Operations on files</a>
233 <li><a href="#7.19.5"> 7.19.5 File access functions</a>
234 <li><a href="#7.19.6"> 7.19.6 Formatted input/output functions</a>
235 <li><a href="#7.19.7"> 7.19.7 Character input/output functions</a>
236 <li><a href="#7.19.8"> 7.19.8 Direct input/output functions</a>
237 <!--page 5 -->
238 <li><a href="#7.19.9"> 7.19.9 File positioning functions</a>
239 <li><a href="#7.19.10"> 7.19.10 Error-handling functions</a>
240 </ul>
241 <li><a href="#7.20"> 7.20 General utilities &lt;stdlib.h&gt;</a>
242 <ul>
243 <li><a href="#7.20.1"> 7.20.1 Numeric conversion functions</a>
244 <li><a href="#7.20.2"> 7.20.2 Pseudo-random sequence generation functions</a>
245 <li><a href="#7.20.3"> 7.20.3 Memory management functions</a>
246 <li><a href="#7.20.4"> 7.20.4 Communication with the environment</a>
247 <li><a href="#7.20.5"> 7.20.5 Searching and sorting utilities</a>
248 <li><a href="#7.20.6"> 7.20.6 Integer arithmetic functions</a>
249 <li><a href="#7.20.7"> 7.20.7 Multibyte/wide character conversion functions</a>
250 <li><a href="#7.20.8"> 7.20.8 Multibyte/wide string conversion functions</a>
251 </ul>
252 <li><a href="#7.21"> 7.21 String handling &lt;string.h&gt;</a>
253 <ul>
254 <li><a href="#7.21.1"> 7.21.1 String function conventions</a>
255 <li><a href="#7.21.2"> 7.21.2 Copying functions</a>
256 <li><a href="#7.21.3"> 7.21.3 Concatenation functions</a>
257 <li><a href="#7.21.4"> 7.21.4 Comparison functions</a>
258 <li><a href="#7.21.5"> 7.21.5 Search functions</a>
259 <li><a href="#7.21.6"> 7.21.6 Miscellaneous functions</a>
260 </ul>
261 <li><a href="#7.22"> 7.22 Type-generic math &lt;tgmath.h&gt;</a>
262 <li><a href="#7.23"> 7.23 Date and time &lt;time.h&gt;</a>
263 <ul>
264 <li><a href="#7.23.1"> 7.23.1 Components of time</a>
265 <li><a href="#7.23.2"> 7.23.2 Time manipulation functions</a>
266 <li><a href="#7.23.3"> 7.23.3 Time conversion functions</a>
267 </ul>
268 <li><a href="#7.24"> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
269 <ul>
270 <li><a href="#7.24.1"> 7.24.1 Introduction</a>
271 <li><a href="#7.24.2"> 7.24.2 Formatted wide character input/output functions</a>
272 <li><a href="#7.24.3"> 7.24.3 Wide character input/output functions</a>
273 <li><a href="#7.24.4"> 7.24.4 General wide string utilities</a>
274 <li><a href="#7.24.5"> 7.24.5 Wide character time conversion functions</a>
275 <li><a href="#7.24.6"> 7.24.6 Extended multibyte/wide character conversion utilities</a>
276 </ul>
277 <li><a href="#7.25"> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
278 <ul>
279 <li><a href="#7.25.1"> 7.25.1 Introduction</a>
280 <li><a href="#7.25.2"> 7.25.2 Wide character classification utilities</a>
281 <li><a href="#7.25.3"> 7.25.3 Wide character case mapping utilities</a>
282 </ul>
283 <li><a href="#7.26"> 7.26 Future library directions</a>
284 <ul>
285 <li><a href="#7.26.1"> 7.26.1 Complex arithmetic &lt;complex.h&gt;</a>
286 <li><a href="#7.26.2"> 7.26.2 Character handling &lt;ctype.h&gt;</a>
287 <li><a href="#7.26.3"> 7.26.3 Errors &lt;errno.h&gt;</a>
288 <li><a href="#7.26.4"> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt;</a>
289 <li><a href="#7.26.5"> 7.26.5 Localization &lt;locale.h&gt;</a>
290 <li><a href="#7.26.6"> 7.26.6 Signal handling &lt;signal.h&gt;</a>
291 <li><a href="#7.26.7"> 7.26.7 Boolean type and values &lt;stdbool.h&gt;</a>
292 <li><a href="#7.26.8"> 7.26.8 Integer types &lt;stdint.h&gt;</a>
293 <li><a href="#7.26.9"> 7.26.9 Input/output &lt;stdio.h&gt;</a>
294 <!--page 6 -->
295 <li><a href="#7.26.10"> 7.26.10 General utilities &lt;stdlib.h&gt;</a>
296 <li><a href="#7.26.11"> 7.26.11 String handling &lt;string.h&gt;</a>
297 <li><a href="#7.26.12"> 7.26.12 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a>
298 <li><a href="#7.26.13"> 7.26.13 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
299 </ul>
300 </ul>
301 <li><a href="#A">Annex A (informative) Language syntax summary</a>
302 <ul>
303 <li><a href="#A.1"> A.1 Lexical grammar</a>
304 <li><a href="#A.2"> A.2 Phrase structure grammar</a>
305 <li><a href="#A.3"> A.3 Preprocessing directives</a>
306 </ul>
307 <li><a href="#B">Annex B (informative) Library summary</a>
308 <ul>
309 <li><a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt;</a>
310 <li><a href="#B.2"> B.2 Complex &lt;complex.h&gt;</a>
311 <li><a href="#B.3"> B.3 Character handling &lt;ctype.h&gt;</a>
312 <li><a href="#B.4"> B.4 Errors &lt;errno.h&gt;</a>
313 <li><a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt;</a>
314 <li><a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt;</a>
315 <li><a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt;</a>
316 <li><a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt;</a>
317 <li><a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt;</a>
318 <li><a href="#B.10"> B.10 Localization &lt;locale.h&gt;</a>
319 <li><a href="#B.11"> B.11 Mathematics &lt;math.h&gt;</a>
320 <li><a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt;</a>
321 <li><a href="#B.13"> B.13 Signal handling &lt;signal.h&gt;</a>
322 <li><a href="#B.14"> B.14 Variable arguments &lt;stdarg.h&gt;</a>
323 <li><a href="#B.15"> B.15 Boolean type and values &lt;stdbool.h&gt;</a>
324 <li><a href="#B.16"> B.16 Common definitions &lt;stddef.h&gt;</a>
325 <li><a href="#B.17"> B.17 Integer types &lt;stdint.h&gt;</a>
326 <li><a href="#B.18"> B.18 Input/output &lt;stdio.h&gt;</a>
327 <li><a href="#B.19"> B.19 General utilities &lt;stdlib.h&gt;</a>
328 <li><a href="#B.20"> B.20 String handling &lt;string.h&gt;</a>
329 <li><a href="#B.21"> B.21 Type-generic math &lt;tgmath.h&gt;</a>
330 <li><a href="#B.22"> B.22 Date and time &lt;time.h&gt;</a>
331 <li><a href="#B.23"> B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a>
332 <li><a href="#B.24"> B.24 Wide character classification and mapping utilities &lt;wctype.h&gt;</a>
333 </ul>
334 <li><a href="#C">Annex C (informative) Sequence points</a>
335 <li><a href="#D">Annex D (normative) Universal character names for identifiers</a>
336 <li><a href="#E">Annex E (informative) Implementation limits</a>
337 <li><a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic</a>
338 <ul>
339 <li><a href="#F.1"> F.1 Introduction</a>
340 <li><a href="#F.2"> F.2 Types</a>
341 <li><a href="#F.3"> F.3 Operators and functions</a>
342 <!--page 7 -->
343 <li><a href="#F.4"> F.4 Floating to integer conversion</a>
344 <li><a href="#F.5"> F.5 Binary-decimal conversion</a>
345 <li><a href="#F.6"> F.6 Contracted expressions</a>
346 <li><a href="#F.7"> F.7 Floating-point environment</a>
347 <li><a href="#F.8"> F.8 Optimization</a>
348 <li><a href="#F.9"> F.9 Mathematics &lt;math.h&gt;</a>
349 </ul>
350 <li><a href="#G">Annex G (informative) IEC 60559-compatible complex arithmetic</a>
351 <ul>
352 <li><a href="#G.1"> G.1 Introduction</a>
353 <li><a href="#G.2"> G.2 Types</a>
354 <li><a href="#G.3"> G.3 Conventions</a>
355 <li><a href="#G.4"> G.4 Conversions</a>
356 <li><a href="#G.5"> G.5 Binary operators</a>
357 <li><a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt;</a>
358 <li><a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt;</a>
359 </ul>
360 <li><a href="#H">Annex H (informative) Language independent arithmetic</a>
361 <ul>
362 <li><a href="#H.1"> H.1 Introduction</a>
363 <li><a href="#H.2"> H.2 Types</a>
364 <li><a href="#H.3"> H.3 Notification</a>
365 </ul>
366 <li><a href="#I">Annex I (informative) Common warnings</a>
367 <li><a href="#J">Annex J (informative) Portability issues</a>
368 <ul>
369 <li><a href="#J.1"> J.1 Unspecified behavior</a>
370 <li><a href="#J.2"> J.2 Undefined behavior</a>
371 <li><a href="#J.3"> J.3 Implementation-defined behavior</a>
372 <li><a href="#J.4"> J.4 Locale-specific behavior</a>
373 <li><a href="#J.5"> J.5 Common extensions</a>
374 </ul>
375 <li><a href="#Bibliography">Bibliography</a>
376 <li><a href="#Index">Index</a>
377 <!--page 8 -->
378 <!--page 9 -->
379 </ul>
381 <p><small><a href="#Contents">Contents</a></small>
382 <h2><a name="Foreword" href="#Foreword">Foreword</a></h2>
383 <p><a name="Forewordp1" href="#Forewordp1"><small>1</small></a>
384 ISO (the International Organization for Standardization) and IEC (the International
385 Electrotechnical Commission) form the specialized system for worldwide
386 standardization. National bodies that are member of ISO or IEC participate in the
387 development of International Standards through technical committees established by the
388 respective organization to deal with particular fields of technical activity. ISO and IEC
389 technical committees collaborate in fields of mutual interest. Other international
390 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
391 take part in the work.
392 <p><a name="Forewordp2" href="#Forewordp2"><small>2</small></a>
393 International Standards are drafted in accordance with the rules given in the ISO/IEC
394 Directives, Part 3.
395 <p><a name="Forewordp3" href="#Forewordp3"><small>3</small></a>
396 In the field of information technology, ISO and IEC have established a joint technical
397 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
398 committee are circulated to national bodies for voting. Publication as an International
399 Standard requires approval by at least 75% of the national bodies casting a vote.
400 <p><a name="Forewordp4" href="#Forewordp4"><small>4</small></a>
401 International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
402 ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,
403 their environments and system software interfaces. The Working Group responsible for
404 this standard (WG 14) maintains a site on the World Wide Web at
405 http://www.open-std.org/JTC1/SC22/WG14/ containing additional
406 information relevant to this standard such as a Rationale for many of the decisions made
407 during its preparation and a log of Defect Reports and Responses.
408 <p><a name="Forewordp5" href="#Forewordp5"><small>5</small></a>
409 This second edition cancels and replaces the first edition, ISO/IEC 9899:1990, as
410 amended and corrected by ISO/IEC 9899/COR1:1994, ISO/IEC 9899/AMD1:1995, and
411 ISO/IEC 9899/COR2:1996. Major changes from the previous edition include:
412 <ul>
413 <li> restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
414 in AMD1)
415 <li> wide character library support in <a href="#7.24">&lt;wchar.h&gt;</a> and <a href="#7.25">&lt;wctype.h&gt;</a> (originally
416 specified in AMD1)
417 <li> more precise aliasing rules via effective type
418 <li> restricted pointers
419 <li> variable length arrays
420 <li> flexible array members
421 <li> static and type qualifiers in parameter array declarators
422 <li> complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
423 <li> type-generic math macros in <a href="#7.22">&lt;tgmath.h&gt;</a>
424 <li> the long long int type and library functions
425 <!--page 10 -->
426 <li> increased minimum translation limits
427 <li> additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
428 <li> remove implicit int
429 <li> reliable integer division
430 <li> universal character names (\u and \U)
431 <li> extended identifiers
432 <li> hexadecimal floating-point constants and %a and %A printf/scanf conversion
433 specifiers
434 <li> compound literals
435 <li> designated initializers
436 <li> // comments
437 <li> extended integer types and library functions in <a href="#7.8">&lt;inttypes.h&gt;</a> and <a href="#7.18">&lt;stdint.h&gt;</a>
438 <li> remove implicit function declaration
439 <li> preprocessor arithmetic done in intmax_t/uintmax_t
440 <li> mixed declarations and code
441 <li> new block scopes for selection and iteration statements
442 <li> integer constant type rules
443 <li> integer promotion rules
444 <li> macros with a variable number of arguments
445 <li> the vscanf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a> and <a href="#7.24">&lt;wchar.h&gt;</a>
446 <li> additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
447 <li> treatment of error conditions by math library functions (math_errhandling)
448 <li> floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
449 <li> IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
450 <li> trailing comma allowed in enum declaration
451 <li> %lf conversion specifier allowed in printf
452 <li> inline functions
453 <li> the snprintf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a>
454 <li> boolean type in <a href="#7.16">&lt;stdbool.h&gt;</a>
455 <li> idempotent type qualifiers
456 <li> empty macro arguments
457 <!--page 11 -->
458 <li> new structure type compatibility rules (tag compatibility)
459 <li> additional predefined macro names
460 <li> _Pragma preprocessing operator
461 <li> standard pragmas
462 <li> __func__ predefined identifier
463 <li> va_copy macro
464 <li> additional strftime conversion specifiers
465 <li> LIA compatibility annex
466 <li> deprecate ungetc at the beginning of a binary file
467 <li> remove deprecation of aliased array parameters
468 <li> conversion of array to pointer not limited to lvalues
469 <li> relaxed constraints on aggregate and union initialization
470 <li> relaxed restrictions on portable header names
471 <li> return without expression not permitted in function that returns a value (and vice
472 versa)
473 </ul>
474 <p><a name="Forewordp6" href="#Forewordp6"><small>6</small></a>
475 Annexes D and F form a normative part of this standard; annexes A, B, C, E, G, H, I, J,
476 the bibliography, and the index are for information only. In accordance with Part 3 of the
477 ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples are
478 also for information only.
479 <!--page 12 -->
481 <p><small><a href="#Contents">Contents</a></small>
482 <h2><a name="Introduction" href="#Introduction">Introduction</a></h2>
483 <p><a name="Introductionp1" href="#Introductionp1"><small>1</small></a>
484 With the introduction of new devices and extended character sets, new features may be
485 added to this International Standard. Subclauses in the language and library clauses warn
486 implementors and programmers of usages which, though valid in themselves, may
487 conflict with future additions.
488 <p><a name="Introductionp2" href="#Introductionp2"><small>2</small></a>
489 Certain features are obsolescent, which means that they may be considered for
490 withdrawal in future revisions of this International Standard. They are retained because
491 of their widespread use, but their use in new implementations (for implementation
492 features) or new programs (for language [<a href="#6.11">6.11</a>] or library features [<a href="#7.26">7.26</a>]) is discouraged.
493 <p><a name="Introductionp3" href="#Introductionp3"><small>3</small></a>
494 This International Standard is divided into four major subdivisions:
495 <ul>
496 <li> preliminary elements (clauses 1-4);
497 <li> the characteristics of environments that translate and execute C programs (clause 5);
498 <li> the language syntax, constraints, and semantics (clause 6);
499 <li> the library facilities (clause 7).
500 </ul>
501 <p><a name="Introductionp4" href="#Introductionp4"><small>4</small></a>
502 Examples are provided to illustrate possible forms of the constructions described.
503 Footnotes are provided to emphasize consequences of the rules described in that
504 subclause or elsewhere in this International Standard. References are used to refer to
505 other related subclauses. Recommendations are provided to give advice or guidance to
506 implementors. Annexes provide additional information and summarize the information
507 contained in this International Standard. A bibliography lists documents that were
508 referred to during the preparation of the standard.
509 <p><a name="Introductionp5" href="#Introductionp5"><small>5</small></a>
510 The language clause (clause 6) is derived from ''The C Reference Manual''.
511 <p><a name="Introductionp6" href="#Introductionp6"><small>6</small></a>
512 The library clause (clause 7) is based on the 1984 /usr/group Standard.
513 <!--page 13 -->
515 <p><small><a href="#Contents">Contents</a></small>
516 <h1>Programming languages -- C</h1>
522 <p><small><a href="#Contents">Contents</a></small>
523 <h2><a name="1" href="#1">1. Scope</a></h2>
524 <p><a name="1p1" href="#1p1"><small>1</small></a>
525 This International Standard specifies the form and establishes the interpretation of
526 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
527 <ul>
528 <li> the representation of C programs;
529 <li> the syntax and constraints of the C language;
530 <li> the semantic rules for interpreting C programs;
531 <li> the representation of input data to be processed by C programs;
532 <li> the representation of output data produced by C programs;
533 <li> the restrictions and limits imposed by a conforming implementation of C.
534 </ul>
535 <p><a name="1p2" href="#1p2"><small>2</small></a>
536 This International Standard does not specify
537 <ul>
538 <li> the mechanism by which C programs are transformed for use by a data-processing
539 system;
540 <li> the mechanism by which C programs are invoked for use by a data-processing
541 system;
542 <li> the mechanism by which input data are transformed for use by a C program;
543 <li> the mechanism by which output data are transformed after being produced by a C
544 program;
545 <li> the size or complexity of a program and its data that will exceed the capacity of any
546 specific data-processing system or the capacity of a particular processor;
549 <!--page 14 -->
550 <li> all minimal requirements of a data-processing system that is capable of supporting a
551 conforming implementation.
553 </ul>
555 <p><b>Footnotes</b>
556 <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
557 data-processing systems. It is intended for use by implementors and programmers.
558 </small>
560 <p><small><a href="#Contents">Contents</a></small>
561 <h2><a name="2" href="#2">2. Normative references</a></h2>
562 <p><a name="2p1" href="#2p1"><small>1</small></a>
563 The following normative documents contain provisions which, through reference in this
564 text, constitute provisions of this International Standard. For dated references,
565 subsequent amendments to, or revisions of, any of these publications do not apply.
566 However, parties to agreements based on this International Standard are encouraged to
567 investigate the possibility of applying the most recent editions of the normative
568 documents indicated below. For undated references, the latest edition of the normative
569 document referred to applies. Members of ISO and IEC maintain registers of currently
570 valid International Standards.
571 <p><a name="2p2" href="#2p2"><small>2</small></a>
572 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
573 use in the physical sciences and technology.
574 <p><a name="2p3" href="#2p3"><small>3</small></a>
575 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
576 interchange.
577 <p><a name="2p4" href="#2p4"><small>4</small></a>
578 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
579 terms.
580 <p><a name="2p5" href="#2p5"><small>5</small></a>
581 ISO 4217, Codes for the representation of currencies and funds.
582 <p><a name="2p6" href="#2p6"><small>6</small></a>
583 ISO 8601, Data elements and interchange formats -- Information interchange --
584 Representation of dates and times.
585 <p><a name="2p7" href="#2p7"><small>7</small></a>
586 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
587 Character Set (UCS).
588 <p><a name="2p8" href="#2p8"><small>8</small></a>
589 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
590 designated IEC 559:1989).
591 <!--page 15 -->
593 <p><small><a href="#Contents">Contents</a></small>
594 <h2><a name="3" href="#3">3. Terms, definitions, and symbols</a></h2>
595 <p><a name="3p1" href="#3p1"><small>1</small></a>
596 For the purposes of this International Standard, the following definitions apply. Other
597 terms are defined where they appear in italic type or on the left side of a syntax rule.
598 Terms explicitly defined in this International Standard are not to be presumed to refer
599 implicitly to similar terms defined elsewhere. Terms not defined in this International
600 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
601 defined in this International Standard are to be interpreted according to ISO 31-11.
603 <p><small><a href="#Contents">Contents</a></small>
604 <h3><a name="3.1" href="#3.1">3.1</a></h3>
605 <p><a name="3.1p1" href="#3.1p1"><small>1</small></a>
606 <b> access</b><br>
607 &lt;execution-time action&gt; to read or modify the value of an object
608 <p><a name="3.1p2" href="#3.1p2"><small>2</small></a>
609 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
611 <p><a name="3.1p3" href="#3.1p3"><small>3</small></a>
612 NOTE 2 "Modify'' includes the case where the new value being stored is the same as the previous value.
614 <p><a name="3.1p4" href="#3.1p4"><small>4</small></a>
615 NOTE 3 Expressions that are not evaluated do not access objects.
618 <p><small><a href="#Contents">Contents</a></small>
619 <h3><a name="3.2" href="#3.2">3.2</a></h3>
620 <p><a name="3.2p1" href="#3.2p1"><small>1</small></a>
621 <b> alignment</b><br>
622 requirement that objects of a particular type be located on storage boundaries with
623 addresses that are particular multiples of a byte address
625 <p><small><a href="#Contents">Contents</a></small>
626 <h3><a name="3.3" href="#3.3">3.3</a></h3>
627 <p><a name="3.3p1" href="#3.3p1"><small>1</small></a>
628 <b> argument</b><br>
629 actual argument<br>
630 actual parameter (deprecated)<br>
631 expression in the comma-separated list bounded by the parentheses in a function call
632 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
633 by the parentheses in a function-like macro invocation
635 <p><small><a href="#Contents">Contents</a></small>
636 <h3><a name="3.4" href="#3.4">3.4</a></h3>
637 <p><a name="3.4p1" href="#3.4p1"><small>1</small></a>
638 <b> behavior</b><br>
639 external appearance or action
641 <p><small><a href="#Contents">Contents</a></small>
642 <h4><a name="3.4.1" href="#3.4.1">3.4.1</a></h4>
643 <p><a name="3.4.1p1" href="#3.4.1p1"><small>1</small></a>
644 <b> implementation-defined behavior</b><br>
645 unspecified behavior where each implementation documents how the choice is made
646 <p><a name="3.4.1p2" href="#3.4.1p2"><small>2</small></a>
647 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
648 when a signed integer is shifted right.
651 <p><small><a href="#Contents">Contents</a></small>
652 <h4><a name="3.4.2" href="#3.4.2">3.4.2</a></h4>
653 <p><a name="3.4.2p1" href="#3.4.2p1"><small>1</small></a>
654 <b> locale-specific behavior</b><br>
655 behavior that depends on local conventions of nationality, culture, and language that each
656 implementation documents
657 <!--page 16 -->
658 <p><a name="3.4.2p2" href="#3.4.2p2"><small>2</small></a>
659 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
660 characters other than the 26 lowercase Latin letters.
663 <p><small><a href="#Contents">Contents</a></small>
664 <h4><a name="3.4.3" href="#3.4.3">3.4.3</a></h4>
665 <p><a name="3.4.3p1" href="#3.4.3p1"><small>1</small></a>
666 <b> undefined behavior</b><br>
667 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
668 for which this International Standard imposes no requirements
669 <p><a name="3.4.3p2" href="#3.4.3p2"><small>2</small></a>
670 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
671 results, to behaving during translation or program execution in a documented manner characteristic of the
672 environment (with or without the issuance of a diagnostic message), to terminating a translation or
673 execution (with the issuance of a diagnostic message).
675 <p><a name="3.4.3p3" href="#3.4.3p3"><small>3</small></a>
676 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
679 <p><small><a href="#Contents">Contents</a></small>
680 <h4><a name="3.4.4" href="#3.4.4">3.4.4</a></h4>
681 <p><a name="3.4.4p1" href="#3.4.4p1"><small>1</small></a>
682 <b> unspecified behavior</b><br>
683 use of an unspecified value, or other behavior where this International Standard provides
684 two or more possibilities and imposes no further requirements on which is chosen in any
685 instance
686 <p><a name="3.4.4p2" href="#3.4.4p2"><small>2</small></a>
687 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
688 evaluated.
691 <p><small><a href="#Contents">Contents</a></small>
692 <h3><a name="3.5" href="#3.5">3.5</a></h3>
693 <p><a name="3.5p1" href="#3.5p1"><small>1</small></a>
694 <b> bit</b><br>
695 unit of data storage in the execution environment large enough to hold an object that may
696 have one of two values
697 <p><a name="3.5p2" href="#3.5p2"><small>2</small></a>
698 NOTE It need not be possible to express the address of each individual bit of an object.
701 <p><small><a href="#Contents">Contents</a></small>
702 <h3><a name="3.6" href="#3.6">3.6</a></h3>
703 <p><a name="3.6p1" href="#3.6p1"><small>1</small></a>
704 <b> byte</b><br>
705 addressable unit of data storage large enough to hold any member of the basic character
706 set of the execution environment
707 <p><a name="3.6p2" href="#3.6p2"><small>2</small></a>
708 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
710 <p><a name="3.6p3" href="#3.6p3"><small>3</small></a>
711 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
712 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
713 bit.
716 <p><small><a href="#Contents">Contents</a></small>
717 <h3><a name="3.7" href="#3.7">3.7</a></h3>
718 <p><a name="3.7p1" href="#3.7p1"><small>1</small></a>
719 <b> character</b><br>
720 &lt;abstract&gt; member of a set of elements used for the organization, control, or
721 representation of data
723 <p><small><a href="#Contents">Contents</a></small>
724 <h4><a name="3.7.1" href="#3.7.1">3.7.1</a></h4>
725 <p><a name="3.7.1p1" href="#3.7.1p1"><small>1</small></a>
726 <b> character</b><br>
727 single-byte character
728 &lt;C&gt; bit representation that fits in a byte
729 <!--page 17 -->
731 <p><small><a href="#Contents">Contents</a></small>
732 <h4><a name="3.7.2" href="#3.7.2">3.7.2</a></h4>
733 <p><a name="3.7.2p1" href="#3.7.2p1"><small>1</small></a>
734 <b> multibyte character</b><br>
735 sequence of one or more bytes representing a member of the extended character set of
736 either the source or the execution environment
737 <p><a name="3.7.2p2" href="#3.7.2p2"><small>2</small></a>
738 NOTE The extended character set is a superset of the basic character set.
741 <p><small><a href="#Contents">Contents</a></small>
742 <h4><a name="3.7.3" href="#3.7.3">3.7.3</a></h4>
743 <p><a name="3.7.3p1" href="#3.7.3p1"><small>1</small></a>
744 <b> wide character</b><br>
745 bit representation that fits in an object of type wchar_t, capable of representing any
746 character in the current locale
748 <p><small><a href="#Contents">Contents</a></small>
749 <h3><a name="3.8" href="#3.8">3.8</a></h3>
750 <p><a name="3.8p1" href="#3.8p1"><small>1</small></a>
751 <b> constraint</b><br>
752 restriction, either syntactic or semantic, by which the exposition of language elements is
753 to be interpreted
755 <p><small><a href="#Contents">Contents</a></small>
756 <h3><a name="3.9" href="#3.9">3.9</a></h3>
757 <p><a name="3.9p1" href="#3.9p1"><small>1</small></a>
758 <b> correctly rounded result</b><br>
759 representation in the result format that is nearest in value, subject to the current rounding
760 mode, to what the result would be given unlimited range and precision
762 <p><small><a href="#Contents">Contents</a></small>
763 <h3><a name="3.10" href="#3.10">3.10</a></h3>
764 <p><a name="3.10p1" href="#3.10p1"><small>1</small></a>
765 <b> diagnostic message</b><br>
766 message belonging to an implementation-defined subset of the implementation's message
767 output
769 <p><small><a href="#Contents">Contents</a></small>
770 <h3><a name="3.11" href="#3.11">3.11</a></h3>
771 <p><a name="3.11p1" href="#3.11p1"><small>1</small></a>
772 <b> forward reference</b><br>
773 reference to a later subclause of this International Standard that contains additional
774 information relevant to this subclause
776 <p><small><a href="#Contents">Contents</a></small>
777 <h3><a name="3.12" href="#3.12">3.12</a></h3>
778 <p><a name="3.12p1" href="#3.12p1"><small>1</small></a>
779 <b> implementation</b><br>
780 particular set of software, running in a particular translation environment under particular
781 control options, that performs translation of programs for, and supports execution of
782 functions in, a particular execution environment
784 <p><small><a href="#Contents">Contents</a></small>
785 <h3><a name="3.13" href="#3.13">3.13</a></h3>
786 <p><a name="3.13p1" href="#3.13p1"><small>1</small></a>
787 <b> implementation limit</b><br>
788 restriction imposed upon programs by the implementation
790 <p><small><a href="#Contents">Contents</a></small>
791 <h3><a name="3.14" href="#3.14">3.14</a></h3>
792 <p><a name="3.14p1" href="#3.14p1"><small>1</small></a>
793 <b> object</b><br>
794 region of data storage in the execution environment, the contents of which can represent
795 values
796 <!--page 18 -->
797 <p><a name="3.14p2" href="#3.14p2"><small>2</small></a>
798 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>.
801 <p><small><a href="#Contents">Contents</a></small>
802 <h3><a name="3.15" href="#3.15">3.15</a></h3>
803 <p><a name="3.15p1" href="#3.15p1"><small>1</small></a>
804 <b> parameter</b><br>
805 formal parameter
806 formal argument (deprecated)
807 object declared as part of a function declaration or definition that acquires a value on
808 entry to the function, or an identifier from the comma-separated list bounded by the
809 parentheses immediately following the macro name in a function-like macro definition
811 <p><small><a href="#Contents">Contents</a></small>
812 <h3><a name="3.16" href="#3.16">3.16</a></h3>
813 <p><a name="3.16p1" href="#3.16p1"><small>1</small></a>
814 <b> recommended practice</b><br>
815 specification that is strongly recommended as being in keeping with the intent of the
816 standard, but that may be impractical for some implementations
818 <p><small><a href="#Contents">Contents</a></small>
819 <h3><a name="3.17" href="#3.17">3.17</a></h3>
820 <p><a name="3.17p1" href="#3.17p1"><small>1</small></a>
821 <b> value</b><br>
822 precise meaning of the contents of an object when interpreted as having a specific type
824 <p><small><a href="#Contents">Contents</a></small>
825 <h4><a name="3.17.1" href="#3.17.1">3.17.1</a></h4>
826 <p><a name="3.17.1p1" href="#3.17.1p1"><small>1</small></a>
827 <b> implementation-defined value</b><br>
828 unspecified value where each implementation documents how the choice is made
830 <p><small><a href="#Contents">Contents</a></small>
831 <h4><a name="3.17.2" href="#3.17.2">3.17.2</a></h4>
832 <p><a name="3.17.2p1" href="#3.17.2p1"><small>1</small></a>
833 <b> indeterminate value</b><br>
834 either an unspecified value or a trap representation
836 <p><small><a href="#Contents">Contents</a></small>
837 <h4><a name="3.17.3" href="#3.17.3">3.17.3</a></h4>
838 <p><a name="3.17.3p1" href="#3.17.3p1"><small>1</small></a>
839 <b> unspecified value</b><br>
840 valid value of the relevant type where this International Standard imposes no
841 requirements on which value is chosen in any instance
842 <p><a name="3.17.3p2" href="#3.17.3p2"><small>2</small></a>
843 NOTE An unspecified value cannot be a trap representation.
846 <p><small><a href="#Contents">Contents</a></small>
847 <h3><a name="3.18" href="#3.18">3.18</a></h3>
848 <p><a name="3.18p1" href="#3.18p1"><small>1</small></a>
849 <b> [^ x ^]</b><br>
850 ceiling of x: the least integer greater than or equal to x
851 <p><a name="3.18p2" href="#3.18p2"><small>2</small></a>
852 EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
855 <p><small><a href="#Contents">Contents</a></small>
856 <h3><a name="3.19" href="#3.19">3.19</a></h3>
857 <p><a name="3.19p1" href="#3.19p1"><small>1</small></a>
858 <b> [_ x _]</b><br>
859 floor of x: the greatest integer less than or equal to x
860 <p><a name="3.19p2" href="#3.19p2"><small>2</small></a>
861 EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
862 <!--page 19 -->
864 <p><small><a href="#Contents">Contents</a></small>
865 <h2><a name="4" href="#4">4. Conformance</a></h2>
866 <p><a name="4p1" href="#4p1"><small>1</small></a>
867 In this International Standard, ''shall'' is to be interpreted as a requirement on an
868 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
869 prohibition.
870 <p><a name="4p2" href="#4p2"><small>2</small></a>
871 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the
872 behavior is undefined. Undefined behavior is otherwise indicated in this International
873 Standard by the words ''undefined behavior'' or by the omission of any explicit definition
874 of behavior. There is no difference in emphasis among these three; they all describe
875 ''behavior that is undefined''.
876 <p><a name="4p3" href="#4p3"><small>3</small></a>
877 A program that is correct in all other aspects, operating on correct data, containing
878 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
879 <p><a name="4p4" href="#4p4"><small>4</small></a>
880 The implementation shall not successfully translate a preprocessing translation unit
881 containing a #error preprocessing directive unless it is part of a group skipped by
882 conditional inclusion.
883 <p><a name="4p5" href="#4p5"><small>5</small></a>
884 A strictly conforming program shall use only those features of the language and library
885 specified in this International Standard.<sup><a href="#note2"><b>2)</b></a></sup> It shall not produce output dependent on any
886 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
887 minimum implementation limit.
888 <p><a name="4p6" href="#4p6"><small>6</small></a>
889 The two forms of conforming implementation are hosted and freestanding. A conforming
890 hosted implementation shall accept any strictly conforming program. A conforming
891 freestanding implementation shall accept any strictly conforming program that does not
892 use complex types and in which the use of the features specified in the library clause
893 (clause 7) is confined to the contents of the standard headers <a href="#7.7">&lt;float.h&gt;</a>,
894 <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#7.15">&lt;stdarg.h&gt;</a>, <a href="#7.16">&lt;stdbool.h&gt;</a>, <a href="#7.17">&lt;stddef.h&gt;</a>, and
895 <a href="#7.18">&lt;stdint.h&gt;</a>. A conforming implementation may have extensions (including additional
896 library functions), provided they do not alter the behavior of any strictly conforming
897 program.<sup><a href="#note3"><b>3)</b></a></sup>
901 <!--page 20 -->
902 <p><a name="4p7" href="#4p7"><small>7</small></a>
903 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note4"><b>4)</b></a></sup>
904 <p><a name="4p8" href="#4p8"><small>8</small></a>
905 An implementation shall be accompanied by a document that defines all implementation-
906 defined and locale-specific characteristics and all extensions.
907 <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>),
908 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>
909 (<a href="#7.9">7.9</a>), sizes of integer types <a href="#7.10">&lt;limits.h&gt;</a> (<a href="#7.10">7.10</a>), variable arguments <a href="#7.15">&lt;stdarg.h&gt;</a>
910 (<a href="#7.15">7.15</a>), boolean type and values <a href="#7.16">&lt;stdbool.h&gt;</a> (<a href="#7.16">7.16</a>), common definitions
911 <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
916 <!--page 21 -->
918 <p><b>Footnotes</b>
919 <p><small><a name="note2" href="#note2">2)</a> A strictly conforming program can use conditional features (such as those in <a href="#F">annex F</a>) provided the
920 use is guarded by a #ifdef directive with the appropriate macro. For example:
922 <pre>
923 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
924 /* ... */
925 fesetround(FE_UPWARD);
926 /* ... */
927 #endif
928 </pre>
930 </small>
931 <p><small><a name="note3" href="#note3">3)</a> This implies that a conforming implementation reserves no identifiers other than those explicitly
932 reserved in this International Standard.
933 </small>
934 <p><small><a name="note4" href="#note4">4)</a> Strictly conforming programs are intended to be maximally portable among conforming
935 implementations. Conforming programs may depend upon nonportable features of a conforming
936 implementation.
937 </small>
939 <p><small><a href="#Contents">Contents</a></small>
940 <h2><a name="5" href="#5">5. Environment</a></h2>
941 <p><a name="5p1" href="#5p1"><small>1</small></a>
942 An implementation translates C source files and executes C programs in two data-
943 processing-system environments, which will be called the translation environment and
944 the execution environment in this International Standard. Their characteristics define and
945 constrain the results of executing conforming C programs constructed according to the
946 syntactic and semantic rules for conforming implementations.
947 <p><b> Forward references</b>: In this clause, only a few of many possible forward references
948 have been noted.
950 <p><small><a href="#Contents">Contents</a></small>
951 <h3><a name="5.1" href="#5.1">5.1 Conceptual models</a></h3>
953 <p><small><a href="#Contents">Contents</a></small>
954 <h4><a name="5.1.1" href="#5.1.1">5.1.1 Translation environment</a></h4>
956 <p><small><a href="#Contents">Contents</a></small>
957 <h5><a name="5.1.1.1" href="#5.1.1.1">5.1.1.1 Program structure</a></h5>
958 <p><a name="5.1.1.1p1" href="#5.1.1.1p1"><small>1</small></a>
959 A C program need not all be translated at the same time. The text of the program is kept
960 in units called source files, (or preprocessing files) in this International Standard. A
961 source file together with all the headers and source files included via the preprocessing
962 directive #include is known as a preprocessing translation unit. After preprocessing, a
963 preprocessing translation unit is called a translation unit. Previously translated translation
964 units may be preserved individually or in libraries. The separate translation units of a
965 program communicate by (for example) calls to functions whose identifiers have external
966 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
967 of data files. Translation units may be separately translated and then later linked to
968 produce an executable program.
969 <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>),
970 preprocessing directives (<a href="#6.10">6.10</a>).
972 <p><small><a href="#Contents">Contents</a></small>
973 <h5><a name="5.1.1.2" href="#5.1.1.2">5.1.1.2 Translation phases</a></h5>
974 <p><a name="5.1.1.2p1" href="#5.1.1.2p1"><small>1</small></a>
975 The precedence among the syntax rules of translation is specified by the following
976 phases.<sup><a href="#note5"><b>5)</b></a></sup>
977 <ol>
978 <li> Physical source file multibyte characters are mapped, in an implementation-
979 defined manner, to the source character set (introducing new-line characters for
980 end-of-line indicators) if necessary. Trigraph sequences are replaced by
981 corresponding single-character internal representations.
985 <!--page 22 -->
986 <li> Each instance of a backslash character (\) immediately followed by a new-line
987 character is deleted, splicing physical source lines to form logical source lines.
988 Only the last backslash on any physical source line shall be eligible for being part
989 of such a splice. A source file that is not empty shall end in a new-line character,
990 which shall not be immediately preceded by a backslash character before any such
991 splicing takes place.
992 <li> The source file is decomposed into preprocessing tokens<sup><a href="#note6"><b>6)</b></a></sup> and sequences of
993 white-space characters (including comments). A source file shall not end in a
994 partial preprocessing token or in a partial comment. Each comment is replaced by
995 one space character. New-line characters are retained. Whether each nonempty
996 sequence of white-space characters other than new-line is retained or replaced by
997 one space character is implementation-defined.
998 <li> Preprocessing directives are executed, macro invocations are expanded, and
999 _Pragma unary operator expressions are executed. If a character sequence that
1000 matches the syntax of a universal character name is produced by token
1001 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
1002 directive causes the named header or source file to be processed from phase 1
1003 through phase 4, recursively. All preprocessing directives are then deleted.
1004 <li> Each source character set member and escape sequence in character constants and
1005 string literals is converted to the corresponding member of the execution character
1006 set; if there is no corresponding member, it is converted to an implementation-
1007 defined member other than the null (wide) character.<sup><a href="#note7"><b>7)</b></a></sup>
1008 <li> Adjacent string literal tokens are concatenated.
1009 <li> White-space characters separating tokens are no longer significant. Each
1010 preprocessing token is converted into a token. The resulting tokens are
1011 syntactically and semantically analyzed and translated as a translation unit.
1012 <li> All external object and function references are resolved. Library components are
1013 linked to satisfy external references to functions and objects not defined in the
1014 current translation. All such translator output is collected into a program image
1015 which contains information needed for execution in its execution environment.
1016 </ol>
1017 <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>),
1018 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>).
1022 <!--page 23 -->
1024 <p><b>Footnotes</b>
1025 <p><small><a name="note5" href="#note5">5)</a> Implementations shall behave as if these separate phases occur, even though many are typically folded
1026 together in practice. Source files, translation units, and translated translation units need not
1027 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
1028 and any external representation. The description is conceptual only, and does not specify any
1029 particular implementation.
1030 </small>
1031 <p><small><a name="note6" href="#note6">6)</a> As described in <a href="#6.4">6.4</a>, the process of dividing a source file's characters into preprocessing tokens is
1032 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
1033 </small>
1034 <p><small><a name="note7" href="#note7">7)</a> An implementation need not convert all non-corresponding source characters to the same execution
1035 character.
1036 </small>
1038 <p><small><a href="#Contents">Contents</a></small>
1039 <h5><a name="5.1.1.3" href="#5.1.1.3">5.1.1.3 Diagnostics</a></h5>
1040 <p><a name="5.1.1.3p1" href="#5.1.1.3p1"><small>1</small></a>
1041 A conforming implementation shall produce at least one diagnostic message (identified in
1042 an implementation-defined manner) if a preprocessing translation unit or translation unit
1043 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
1044 specified as undefined or implementation-defined. Diagnostic messages need not be
1045 produced in other circumstances.<sup><a href="#note8"><b>8)</b></a></sup>
1046 <p><a name="5.1.1.3p2" href="#5.1.1.3p2"><small>2</small></a>
1047 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
1048 <pre>
1049 char i;
1050 int i;
1051 </pre>
1052 because in those cases where wording in this International Standard describes the behavior for a construct
1053 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
1056 <p><b>Footnotes</b>
1057 <p><small><a name="note8" href="#note8">8)</a> The intent is that an implementation should identify the nature of, and where possible localize, each
1058 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
1059 valid program is still correctly translated. It may also successfully translate an invalid program.
1060 </small>
1062 <p><small><a href="#Contents">Contents</a></small>
1063 <h4><a name="5.1.2" href="#5.1.2">5.1.2 Execution environments</a></h4>
1064 <p><a name="5.1.2p1" href="#5.1.2p1"><small>1</small></a>
1065 Two execution environments are defined: freestanding and hosted. In both cases,
1066 program startup occurs when a designated C function is called by the execution
1067 environment. All objects with static storage duration shall be initialized (set to their
1068 initial values) before program startup. The manner and timing of such initialization are
1069 otherwise unspecified. Program termination returns control to the execution
1070 environment.
1071 <p><b> Forward references</b>: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.8">6.7.8</a>).
1073 <p><small><a href="#Contents">Contents</a></small>
1074 <h5><a name="5.1.2.1" href="#5.1.2.1">5.1.2.1 Freestanding environment</a></h5>
1075 <p><a name="5.1.2.1p1" href="#5.1.2.1p1"><small>1</small></a>
1076 In a freestanding environment (in which C program execution may take place without any
1077 benefit of an operating system), the name and type of the function called at program
1078 startup are implementation-defined. Any library facilities available to a freestanding
1079 program, other than the minimal set required by clause 4, are implementation-defined.
1080 <p><a name="5.1.2.1p2" href="#5.1.2.1p2"><small>2</small></a>
1081 The effect of program termination in a freestanding environment is implementation-
1082 defined.
1084 <p><small><a href="#Contents">Contents</a></small>
1085 <h5><a name="5.1.2.2" href="#5.1.2.2">5.1.2.2 Hosted environment</a></h5>
1086 <p><a name="5.1.2.2p1" href="#5.1.2.2p1"><small>1</small></a>
1087 A hosted environment need not be provided, but shall conform to the following
1088 specifications if present.
1093 <!--page 24 -->
1095 <p><small><a href="#Contents">Contents</a></small>
1096 <h5><a name="5.1.2.2.1" href="#5.1.2.2.1">5.1.2.2.1 Program startup</a></h5>
1097 <p><a name="5.1.2.2.1p1" href="#5.1.2.2.1p1"><small>1</small></a>
1098 The function called at program startup is named main. The implementation declares no
1099 prototype for this function. It shall be defined with a return type of int and with no
1100 parameters:
1101 <pre>
1102 int main(void) { /* ... */ }
1103 </pre>
1104 or with two parameters (referred to here as argc and argv, though any names may be
1105 used, as they are local to the function in which they are declared):
1106 <pre>
1107 int main(int argc, char *argv[]) { /* ... */ }
1108 </pre>
1109 or equivalent;<sup><a href="#note9"><b>9)</b></a></sup> or in some other implementation-defined manner.
1110 <p><a name="5.1.2.2.1p2" href="#5.1.2.2.1p2"><small>2</small></a>
1111 If they are declared, the parameters to the main function shall obey the following
1112 constraints:
1113 <ul>
1114 <li> The value of argc shall be nonnegative.
1115 <li> argv[argc] shall be a null pointer.
1116 <li> If the value of argc is greater than zero, the array members argv[0] through
1117 argv[argc-1] inclusive shall contain pointers to strings, which are given
1118 implementation-defined values by the host environment prior to program startup. The
1119 intent is to supply to the program information determined prior to program startup
1120 from elsewhere in the hosted environment. If the host environment is not capable of
1121 supplying strings with letters in both uppercase and lowercase, the implementation
1122 shall ensure that the strings are received in lowercase.
1123 <li> If the value of argc is greater than zero, the string pointed to by argv[0]
1124 represents the program name; argv[0][0] shall be the null character if the
1125 program name is not available from the host environment. If the value of argc is
1126 greater than one, the strings pointed to by argv[1] through argv[argc-1]
1127 represent the program parameters.
1128 <li> The parameters argc and argv and the strings pointed to by the argv array shall
1129 be modifiable by the program, and retain their last-stored values between program
1130 startup and program termination.
1131 </ul>
1133 <p><b>Footnotes</b>
1134 <p><small><a name="note9" href="#note9">9)</a> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
1135 char ** argv, and so on.
1136 </small>
1138 <p><small><a href="#Contents">Contents</a></small>
1139 <h5><a name="5.1.2.2.2" href="#5.1.2.2.2">5.1.2.2.2 Program execution</a></h5>
1140 <p><a name="5.1.2.2.2p1" href="#5.1.2.2.2p1"><small>1</small></a>
1141 In a hosted environment, a program may use all the functions, macros, type definitions,
1142 and objects described in the library clause (clause 7).
1146 <!--page 25 -->
1148 <p><small><a href="#Contents">Contents</a></small>
1149 <h5><a name="5.1.2.2.3" href="#5.1.2.2.3">5.1.2.2.3 Program termination</a></h5>
1150 <p><a name="5.1.2.2.3p1" href="#5.1.2.2.3p1"><small>1</small></a>
1151 If the return type of the main function is a type compatible with int, a return from the
1152 initial call to the main function is equivalent to calling the exit function with the value
1153 returned by the main function as its argument;<sup><a href="#note10"><b>10)</b></a></sup> reaching the } that terminates the
1154 main function returns a value of 0. If the return type is not compatible with int, the
1155 termination status returned to the host environment is unspecified.
1156 <p><b> Forward references</b>: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
1158 <p><b>Footnotes</b>
1159 <p><small><a name="note10" href="#note10">10)</a> In accordance with <a href="#6.2.4">6.2.4</a>, the lifetimes of objects with automatic storage duration declared in main
1160 will have ended in the former case, even where they would not have in the latter.
1161 </small>
1163 <p><small><a href="#Contents">Contents</a></small>
1164 <h5><a name="5.1.2.3" href="#5.1.2.3">5.1.2.3 Program execution</a></h5>
1165 <p><a name="5.1.2.3p1" href="#5.1.2.3p1"><small>1</small></a>
1166 The semantic descriptions in this International Standard describe the behavior of an
1167 abstract machine in which issues of optimization are irrelevant.
1168 <p><a name="5.1.2.3p2" href="#5.1.2.3p2"><small>2</small></a>
1169 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1170 that does any of those operations are all side effects,<sup><a href="#note11"><b>11)</b></a></sup> which are changes in the state of
1171 the execution environment. Evaluation of an expression may produce side effects. At
1172 certain specified points in the execution sequence called sequence points, all side effects
1173 of previous evaluations shall be complete and no side effects of subsequent evaluations
1174 shall have taken place. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1175 <p><a name="5.1.2.3p3" href="#5.1.2.3p3"><small>3</small></a>
1176 In the abstract machine, all expressions are evaluated as specified by the semantics. An
1177 actual implementation need not evaluate part of an expression if it can deduce that its
1178 value is not used and that no needed side effects are produced (including any caused by
1179 calling a function or accessing a volatile object).
1180 <p><a name="5.1.2.3p4" href="#5.1.2.3p4"><small>4</small></a>
1181 When the processing of the abstract machine is interrupted by receipt of a signal, only the
1182 values of objects as of the previous sequence point may be relied on. Objects that may be
1183 modified between the previous sequence point and the next sequence point need not have
1184 received their correct values yet.
1185 <p><a name="5.1.2.3p5" href="#5.1.2.3p5"><small>5</small></a>
1186 The least requirements on a conforming implementation are:
1187 <ul>
1188 <li> At sequence points, volatile objects are stable in the sense that previous accesses are
1189 complete and subsequent accesses have not yet occurred.
1194 <!--page 26 -->
1195 <li> At program termination, all data written into files shall be identical to the result that
1196 execution of the program according to the abstract semantics would have produced.
1197 <li> The input and output dynamics of interactive devices shall take place as specified in
1198 <a href="#7.19.3">7.19.3</a>. The intent of these requirements is that unbuffered or line-buffered output
1199 appear as soon as possible, to ensure that prompting messages actually appear prior to
1200 a program waiting for input.
1201 </ul>
1202 <p><a name="5.1.2.3p6" href="#5.1.2.3p6"><small>6</small></a>
1203 What constitutes an interactive device is implementation-defined.
1204 <p><a name="5.1.2.3p7" href="#5.1.2.3p7"><small>7</small></a>
1205 More stringent correspondences between abstract and actual semantics may be defined by
1206 each implementation.
1207 <p><a name="5.1.2.3p8" href="#5.1.2.3p8"><small>8</small></a>
1208 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1209 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1210 abstract semantics. The keyword volatile would then be redundant.
1211 <p><a name="5.1.2.3p9" href="#5.1.2.3p9"><small>9</small></a>
1212 Alternatively, an implementation might perform various optimizations within each translation unit, such
1213 that the actual semantics would agree with the abstract semantics only when making function calls across
1214 translation unit boundaries. In such an implementation, at the time of each function entry and function
1215 return where the calling function and the called function are in different translation units, the values of all
1216 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1217 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1218 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1219 type of implementation, objects referred to by interrupt service routines activated by the signal function
1220 would require explicit specification of volatile storage, as well as other implementation-defined
1221 restrictions.
1223 <p><a name="5.1.2.3p10" href="#5.1.2.3p10"><small>10</small></a>
1224 EXAMPLE 2 In executing the fragment
1225 <pre>
1226 char c1, c2;
1227 /* ... */
1228 c1 = c1 + c2;
1229 </pre>
1230 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1231 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1232 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1233 produce the same result, possibly omitting the promotions.
1235 <p><a name="5.1.2.3p11" href="#5.1.2.3p11"><small>11</small></a>
1236 EXAMPLE 3 Similarly, in the fragment
1237 <pre>
1238 float f1, f2;
1239 double d;
1240 /* ... */
1241 f1 = f2 * d;
1242 </pre>
1243 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1244 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1245 were replaced by the constant 2.0, which has type double).
1246 <!--page 27 -->
1247 <p><a name="5.1.2.3p12" href="#5.1.2.3p12"><small>12</small></a>
1248 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1249 semantics. Values are independent of whether they are represented in a register or in memory. For
1250 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1251 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1252 perform their specified conversion. For the fragment
1253 <pre>
1254 double d1, d2;
1255 float f;
1256 d1 = f = expression;
1257 d2 = (float) expression;
1258 </pre>
1259 the values assigned to d1 and d2 are required to have been converted to float.
1261 <p><a name="5.1.2.3p13" href="#5.1.2.3p13"><small>13</small></a>
1262 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1263 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1264 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1265 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1266 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1267 numbers are often not valid (see <a href="#F.8">F.8</a>).
1268 <pre>
1269 double x, y, z;
1270 /* ... */
1271 x = (x * y) * z; // not equivalent to x *= y * z;
1272 z = (x - y) + y ; // not equivalent to z = x;
1273 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1274 y = x / 5.0; // not equivalent to y = x * 0.2;
1275 </pre>
1277 <p><a name="5.1.2.3p14" href="#5.1.2.3p14"><small>14</small></a>
1278 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1279 <pre>
1280 int a, b;
1281 /* ... */
1282 a = a + 32760 + b + 5;
1283 </pre>
1284 the expression statement behaves exactly the same as
1285 <pre>
1286 a = (((a + 32760) + b) + 5);
1287 </pre>
1288 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1289 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1290 which overflows produce an explicit trap and in which the range of values representable by an int is
1291 [-32768, +32767], the implementation cannot rewrite this expression as
1292 <pre>
1293 a = ((a + b) + 32765);
1294 </pre>
1295 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1296 while the original expression would not; nor can the expression be rewritten either as
1297 <pre>
1298 a = ((a + 32765) + b);
1299 </pre>
1301 <pre>
1302 a = (a + (b + 32765));
1303 </pre>
1304 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1305 in which overflow silently generates some value and where positive and negative overflows cancel, the
1306 above expression statement can be rewritten by the implementation in any of the above ways because the
1307 same result will occur.
1308 <!--page 28 -->
1309 <p><a name="5.1.2.3p15" href="#5.1.2.3p15"><small>15</small></a>
1310 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1311 following fragment
1312 <pre>
1313 #include <a href="#7.19">&lt;stdio.h&gt;</a>
1314 int sum;
1315 char *p;
1316 /* ... */
1317 sum = sum * 10 - '0' + (*p++ = getchar());
1318 </pre>
1319 the expression statement is grouped as if it were written as
1320 <pre>
1321 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1322 </pre>
1323 but the actual increment of p can occur at any time between the previous sequence point and the next
1324 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1325 value.
1327 <p><b> Forward references</b>: expressions (<a href="#6.5">6.5</a>), type qualifiers (<a href="#6.7.3">6.7.3</a>), statements (<a href="#6.8">6.8</a>), the
1328 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.19.3">7.19.3</a>).
1329 <!--page 29 -->
1331 <p><b>Footnotes</b>
1332 <p><small><a name="note11" href="#note11">11)</a> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1333 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1334 values of floating-point operations. Implementations that support such floating-point state are
1335 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1336 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
1337 effects matter, freeing the implementations in other cases.
1338 </small>
1340 <p><small><a href="#Contents">Contents</a></small>
1341 <h3><a name="5.2" href="#5.2">5.2 Environmental considerations</a></h3>
1343 <p><small><a href="#Contents">Contents</a></small>
1344 <h4><a name="5.2.1" href="#5.2.1">5.2.1 Character sets</a></h4>
1345 <p><a name="5.2.1p1" href="#5.2.1p1"><small>1</small></a>
1346 Two sets of characters and their associated collating sequences shall be defined: the set in
1347 which source files are written (the source character set), and the set interpreted in the
1348 execution environment (the execution character set). Each set is further divided into a
1349 basic character set, whose contents are given by this subclause, and a set of zero or more
1350 locale-specific members (which are not members of the basic character set) called
1351 extended characters. The combined set is also called the extended character set. The
1352 values of the members of the execution character set are implementation-defined.
1353 <p><a name="5.2.1p2" href="#5.2.1p2"><small>2</small></a>
1354 In a character constant or string literal, members of the execution character set shall be
1355 represented by corresponding members of the source character set or by escape
1356 sequences consisting of the backslash \ followed by one or more characters. A byte with
1357 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1358 is used to terminate a character string.
1359 <p><a name="5.2.1p3" href="#5.2.1p3"><small>3</small></a>
1360 Both the basic source and basic execution character sets shall have the following
1361 members: the 26 uppercase letters of the Latin alphabet
1362 <pre>
1363 A B C D E F G H I J K L M
1364 N O P Q R S T U V W X Y Z
1365 </pre>
1366 the 26 lowercase letters of the Latin alphabet
1367 <pre>
1368 a b c d e f g h i j k l m
1369 n o p q r s t u v w x y z
1370 </pre>
1371 the 10 decimal digits
1372 <pre>
1373 0 1 2 3 4 5 6 7 8 9
1374 </pre>
1375 the following 29 graphic characters
1376 <pre>
1377 ! " # % &amp; ' ( ) * + , - . / :
1378 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~
1379 </pre>
1380 the space character, and control characters representing horizontal tab, vertical tab, and
1381 form feed. The representation of each member of the source and execution basic
1382 character sets shall fit in a byte. In both the source and execution basic character sets, the
1383 value of each character after 0 in the above list of decimal digits shall be one greater than
1384 the value of the previous. In source files, there shall be some way of indicating the end of
1385 each line of text; this International Standard treats such an end-of-line indicator as if it
1386 were a single new-line character. In the basic execution character set, there shall be
1387 control characters representing alert, backspace, carriage return, and new line. If any
1388 other characters are encountered in a source file (except in an identifier, a character
1389 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1390 <!--page 30 -->
1391 converted to a token), the behavior is undefined.
1392 <p><a name="5.2.1p4" href="#5.2.1p4"><small>4</small></a>
1393 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1394 Standard the term does not include other characters that are letters in other alphabets.
1395 <p><a name="5.2.1p5" href="#5.2.1p5"><small>5</small></a>
1396 The universal character name construct provides a way to name other characters.
1397 <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>),
1398 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>).
1400 <p><small><a href="#Contents">Contents</a></small>
1401 <h5><a name="5.2.1.1" href="#5.2.1.1">5.2.1.1 Trigraph sequences</a></h5>
1402 <p><a name="5.2.1.1p1" href="#5.2.1.1p1"><small>1</small></a>
1403 Before any other processing takes place, each occurrence of one of the following
1404 sequences of three characters (called trigraph sequences<sup><a href="#note12"><b>12)</b></a></sup>) is replaced with the
1405 corresponding single character.
1406 <pre>
1407 ??= # ??) ] ??! |
1408 ??( [ ??' ^ ??&gt; }
1409 ??/ \ ??&lt; { ??- ~
1410 </pre>
1411 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1412 above is not changed.
1413 <p><a name="5.2.1.1p2" href="#5.2.1.1p2"><small>2</small></a>
1414 EXAMPLE 1
1415 <pre>
1416 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1417 </pre>
1418 becomes
1419 <pre>
1420 #define arraycheck(a, b) a[b] || b[a]
1421 </pre>
1423 <p><a name="5.2.1.1p3" href="#5.2.1.1p3"><small>3</small></a>
1424 EXAMPLE 2 The following source line
1425 <pre>
1426 printf("Eh???/n");
1427 </pre>
1428 becomes (after replacement of the trigraph sequence ??/)
1429 <pre>
1430 printf("Eh?\n");
1431 </pre>
1434 <p><b>Footnotes</b>
1435 <p><small><a name="note12" href="#note12">12)</a> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1436 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1437 </small>
1439 <p><small><a href="#Contents">Contents</a></small>
1440 <h5><a name="5.2.1.2" href="#5.2.1.2">5.2.1.2 Multibyte characters</a></h5>
1441 <p><a name="5.2.1.2p1" href="#5.2.1.2p1"><small>1</small></a>
1442 The source character set may contain multibyte characters, used to represent members of
1443 the extended character set. The execution character set may also contain multibyte
1444 characters, which need not have the same encoding as for the source character set. For
1445 both character sets, the following shall hold:
1446 <ul>
1447 <li> The basic character set shall be present and each character shall be encoded as a
1448 single byte.
1449 <li> The presence, meaning, and representation of any additional members is locale-
1450 specific.
1452 <!--page 31 -->
1453 <li> A multibyte character set may have a state-dependent encoding, wherein each
1454 sequence of multibyte characters begins in an initial shift state and enters other
1455 locale-specific shift states when specific multibyte characters are encountered in the
1456 sequence. While in the initial shift state, all single-byte characters retain their usual
1457 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1458 in the sequence is a function of the current shift state.
1459 <li> A byte with all bits zero shall be interpreted as a null character independent of shift
1460 state. Such a byte shall not occur as part of any other multibyte character.
1461 </ul>
1462 <p><a name="5.2.1.2p2" href="#5.2.1.2p2"><small>2</small></a>
1463 For source files, the following shall hold:
1464 <ul>
1465 <li> An identifier, comment, string literal, character constant, or header name shall begin
1466 and end in the initial shift state.
1467 <li> An identifier, comment, string literal, character constant, or header name shall consist
1468 of a sequence of valid multibyte characters.
1469 </ul>
1471 <p><small><a href="#Contents">Contents</a></small>
1472 <h4><a name="5.2.2" href="#5.2.2">5.2.2 Character display semantics</a></h4>
1473 <p><a name="5.2.2p1" href="#5.2.2p1"><small>1</small></a>
1474 The active position is that location on a display device where the next character output by
1475 the fputc function would appear. The intent of writing a printing character (as defined
1476 by the isprint function) to a display device is to display a graphic representation of
1477 that character at the active position and then advance the active position to the next
1478 position on the current line. The direction of writing is locale-specific. If the active
1479 position is at the final position of a line (if there is one), the behavior of the display device
1480 is unspecified.
1481 <p><a name="5.2.2p2" href="#5.2.2p2"><small>2</small></a>
1482 Alphabetic escape sequences representing nongraphic characters in the execution
1483 character set are intended to produce actions on display devices as follows:
1484 <dl>
1485 <dt> \a <dd>(alert) Produces an audible or visible alert without changing the active position.
1486 <dt> \b <dd>(backspace) Moves the active position to the previous position on the current line. If
1487 the active position is at the initial position of a line, the behavior of the display
1488 device is unspecified.
1489 <dt> \f <dd>( form feed) Moves the active position to the initial position at the start of the next
1490 logical page.
1491 <dt> \n <dd>(new line) Moves the active position to the initial position of the next line.
1492 <dt> \r <dd>(carriage return) Moves the active position to the initial position of the current line.
1493 <dt> \t <dd>(horizontal tab) Moves the active position to the next horizontal tabulation position
1494 on the current line. If the active position is at or past the last defined horizontal
1495 tabulation position, the behavior of the display device is unspecified.
1496 <dt> \v <dd>(vertical tab) Moves the active position to the initial position of the next vertical
1497 <!--page 32 -->
1498 tabulation position. If the active position is at or past the last defined vertical
1499 tabulation position, the behavior of the display device is unspecified.
1500 </dl>
1501 <p><a name="5.2.2p3" href="#5.2.2p3"><small>3</small></a>
1502 Each of these escape sequences shall produce a unique implementation-defined value
1503 which can be stored in a single char object. The external representations in a text file
1504 need not be identical to the internal representations, and are outside the scope of this
1505 International Standard.
1506 <p><b> Forward references</b>: the isprint function (<a href="#7.4.1.8">7.4.1.8</a>), the fputc function (<a href="#7.19.7.3">7.19.7.3</a>).
1508 <p><small><a href="#Contents">Contents</a></small>
1509 <h4><a name="5.2.3" href="#5.2.3">5.2.3 Signals and interrupts</a></h4>
1510 <p><a name="5.2.3p1" href="#5.2.3p1"><small>1</small></a>
1511 Functions shall be implemented such that they may be interrupted at any time by a signal,
1512 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1513 invocations' control flow (after the interruption), function return values, or objects with
1514 automatic storage duration. All such objects shall be maintained outside the function
1515 image (the instructions that compose the executable representation of a function) on a
1516 per-invocation basis.
1518 <p><small><a href="#Contents">Contents</a></small>
1519 <h4><a name="5.2.4" href="#5.2.4">5.2.4 Environmental limits</a></h4>
1520 <p><a name="5.2.4p1" href="#5.2.4p1"><small>1</small></a>
1521 Both the translation and execution environments constrain the implementation of
1522 language translators and libraries. The following summarizes the language-related
1523 environmental limits on a conforming implementation; the library-related limits are
1524 discussed in clause 7.
1526 <p><small><a href="#Contents">Contents</a></small>
1527 <h5><a name="5.2.4.1" href="#5.2.4.1">5.2.4.1 Translation limits</a></h5>
1528 <p><a name="5.2.4.1p1" href="#5.2.4.1p1"><small>1</small></a>
1529 The implementation shall be able to translate and execute at least one program that
1530 contains at least one instance of every one of the following limits:<sup><a href="#note13"><b>13)</b></a></sup>
1531 <ul>
1532 <li> 127 nesting levels of blocks
1533 <li> 63 nesting levels of conditional inclusion
1534 <li> 12 pointer, array, and function declarators (in any combinations) modifying an
1535 arithmetic, structure, union, or incomplete type in a declaration
1536 <li> 63 nesting levels of parenthesized declarators within a full declarator
1537 <li> 63 nesting levels of parenthesized expressions within a full expression
1538 <li> 63 significant initial characters in an internal identifier or a macro name (each
1539 universal character name or extended source character is considered a single
1540 character)
1541 <li> 31 significant initial characters in an external identifier (each universal character name
1542 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1545 <!--page 33 -->
1546 universal character name specifying a short identifier of 00010000 or more is
1547 considered 10 characters, and each extended source character is considered the same
1548 number of characters as the corresponding universal character name, if any)<sup><a href="#note14"><b>14)</b></a></sup>
1549 <li> 4095 external identifiers in one translation unit
1550 <li> 511 identifiers with block scope declared in one block
1551 <li> 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1552 <li> 127 parameters in one function definition
1553 <li> 127 arguments in one function call
1554 <li> 127 parameters in one macro definition
1555 <li> 127 arguments in one macro invocation
1556 <li> 4095 characters in a logical source line
1557 <li> 4095 characters in a character string literal or wide string literal (after concatenation)
1558 <li> 65535 bytes in an object (in a hosted environment only)
1559 <li> 15 nesting levels for #included files
1560 <li> 1023 case labels for a switch statement (excluding those for any nested switch
1561 statements)
1562 <li> 1023 members in a single structure or union
1563 <li> 1023 enumeration constants in a single enumeration
1564 <li> 63 levels of nested structure or union definitions in a single struct-declaration-list
1565 </ul>
1567 <p><b>Footnotes</b>
1568 <p><small><a name="note13" href="#note13">13)</a> Implementations should avoid imposing fixed translation limits whenever possible.
1569 </small>
1570 <p><small><a name="note14" href="#note14">14)</a> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1571 </small>
1573 <p><small><a href="#Contents">Contents</a></small>
1574 <h5><a name="5.2.4.2" href="#5.2.4.2">5.2.4.2 Numerical limits</a></h5>
1575 <p><a name="5.2.4.2p1" href="#5.2.4.2p1"><small>1</small></a>
1576 An implementation is required to document all the limits specified in this subclause,
1577 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
1578 specified in <a href="#7.18">&lt;stdint.h&gt;</a>.
1579 <p><b> Forward references</b>: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
1581 <p><small><a href="#Contents">Contents</a></small>
1582 <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>
1583 <p><a name="5.2.4.2.1p1" href="#5.2.4.2.1p1"><small>1</small></a>
1584 The values given below shall be replaced by constant expressions suitable for use in #if
1585 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1586 following shall be replaced by expressions that have the same type as would an
1587 expression that is an object of the corresponding type converted according to the integer
1588 promotions. Their implementation-defined values shall be equal or greater in magnitude
1591 <!--page 34 -->
1592 (absolute value) to those shown, with the same sign.
1593 <ul>
1594 <li> number of bits for smallest object that is not a bit-field (byte)
1595 <pre>
1596 CHAR_BIT 8
1597 </pre>
1598 <li> minimum value for an object of type signed char
1599 <pre>
1600 SCHAR_MIN -127 // -(2<sup>7</sup> - 1)
1601 </pre>
1602 <li> maximum value for an object of type signed char
1603 <pre>
1604 SCHAR_MAX +127 // 2<sup>7</sup> - 1
1605 </pre>
1606 <li> maximum value for an object of type unsigned char
1607 <pre>
1608 UCHAR_MAX 255 // 2<sup>8</sup> - 1
1609 </pre>
1610 <li> minimum value for an object of type char
1611 <pre>
1612 CHAR_MIN see below
1613 </pre>
1614 <li> maximum value for an object of type char
1615 <pre>
1616 CHAR_MAX see below
1617 </pre>
1618 <li> maximum number of bytes in a multibyte character, for any supported locale
1619 <pre>
1620 MB_LEN_MAX 1
1621 </pre>
1622 <li> minimum value for an object of type short int
1623 <pre>
1624 SHRT_MIN -32767 // -(2<sup>15</sup> - 1)
1625 </pre>
1626 <li> maximum value for an object of type short int
1627 <pre>
1628 SHRT_MAX +32767 // 2<sup>15</sup> - 1
1629 </pre>
1630 <li> maximum value for an object of type unsigned short int
1631 <pre>
1632 USHRT_MAX 65535 // 2<sup>16</sup> - 1
1633 </pre>
1634 <li> minimum value for an object of type int
1635 <pre>
1636 INT_MIN -32767 // -(2<sup>15</sup> - 1)
1637 </pre>
1638 <li> maximum value for an object of type int
1639 <pre>
1640 INT_MAX +32767 // 2<sup>15</sup> - 1
1641 </pre>
1642 <li> maximum value for an object of type unsigned int
1643 <pre>
1644 UINT_MAX 65535 // 2<sup>16</sup> - 1
1645 </pre>
1646 <li> minimum value for an object of type long int
1647 <pre>
1648 LONG_MIN -2147483647 // -(2<sup>31</sup> - 1)
1649 </pre>
1650 <li> maximum value for an object of type long int
1651 <pre>
1652 LONG_MAX +2147483647 // 2<sup>31</sup> - 1
1653 </pre>
1654 <li> maximum value for an object of type unsigned long int
1655 <pre>
1656 ULONG_MAX 4294967295 // 2<sup>32</sup> - 1
1657 </pre>
1658 <!--page 35 -->
1659 <li> minimum value for an object of type long long int
1660 <pre>
1661 LLONG_MIN -9223372036854775807 // -(2<sup>63</sup> - 1)
1662 </pre>
1663 <li> maximum value for an object of type long long int
1664 <pre>
1665 LLONG_MAX +9223372036854775807 // 2<sup>63</sup> - 1
1666 </pre>
1667 <li> maximum value for an object of type unsigned long long int
1668 <pre>
1669 ULLONG_MAX 18446744073709551615 // 2<sup>64</sup> - 1
1670 </pre>
1671 </ul>
1672 <p><a name="5.2.4.2.1p2" href="#5.2.4.2.1p2"><small>2</small></a>
1673 If the value of an object of type char is treated as a signed integer when used in an
1674 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1675 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1676 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1677 UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2<sup>CHAR_BIT</sup> - 1.
1678 <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>).
1680 <p><b>Footnotes</b>
1681 <p><small><a name="note15" href="#note15">15)</a> See <a href="#6.2.5">6.2.5</a>.
1682 </small>
1684 <p><small><a href="#Contents">Contents</a></small>
1685 <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>
1686 <p><a name="5.2.4.2.2p1" href="#5.2.4.2.2p1"><small>1</small></a>
1687 The characteristics of floating types are defined in terms of a model that describes a
1688 representation of floating-point numbers and values that provide information about an
1689 implementation's floating-point arithmetic.<sup><a href="#note16"><b>16)</b></a></sup> The following parameters are used to
1690 define the model for each floating-point type:
1691 <pre>
1692 s sign ((+-)1)
1693 b base or radix of exponent representation (an integer &gt; 1)
1694 e exponent (an integer between a minimum emin and a maximum emax )
1695 p precision (the number of base-b digits in the significand)
1696 f<sub>k</sub> nonnegative integers less than b (the significand digits)
1697 </pre>
1698 <p><a name="5.2.4.2.2p2" href="#5.2.4.2.2p2"><small>2</small></a>
1699 A floating-point number (x) is defined by the following model:
1700 <pre>
1702 x = s b<sup>e</sup> (Sum) f<sub>k</sub> b<sup>-k</sup> , emin &lt;= e &lt;= emax
1704 </pre>
1706 <p><a name="5.2.4.2.2p3" href="#5.2.4.2.2p3"><small>3</small></a>
1707 In addition to normalized floating-point numbers ( f<sub>1</sub> &gt; 0 if x != 0), floating types may be
1708 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1709 numbers (x != 0, e = emin , f<sub>1</sub> = 0) and unnormalized floating-point numbers (x != 0,
1710 e &gt; emin , f<sub>1</sub> = 0), and values that are not floating-point numbers, such as infinities and
1711 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1712 through almost every arithmetic operation without raising a floating-point exception; a
1713 signaling NaN generally raises a floating-point exception when occurring as an
1716 <!--page 36 -->
1717 arithmetic operand.<sup><a href="#note17"><b>17)</b></a></sup>
1718 <p><a name="5.2.4.2.2p4" href="#5.2.4.2.2p4"><small>4</small></a>
1719 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
1720 sign or may leave them unsigned. Wherever such values are unsigned, any requirement
1721 in this International Standard to retrieve the sign shall produce an unspecified sign, and
1722 any requirement to set the sign shall be ignored.
1723 <p><a name="5.2.4.2.2p5" href="#5.2.4.2.2p5"><small>5</small></a>
1724 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1725 <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-
1726 defined, as is the accuracy of the conversion between floating-point internal
1727 representations and string representations performed by the library functions in
1728 <a href="#7.19">&lt;stdio.h&gt;</a>, <a href="#7.20">&lt;stdlib.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a>. The implementation may state that the
1729 accuracy is unknown.
1730 <p><a name="5.2.4.2.2p6" href="#5.2.4.2.2p6"><small>6</small></a>
1731 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
1732 expressions suitable for use in #if preprocessing directives; all floating values shall be
1733 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1734 and FLT_ROUNDS have separate names for all three floating-point types. The floating-point
1735 model representation is provided for all values except FLT_EVAL_METHOD and
1736 FLT_ROUNDS.
1737 <p><a name="5.2.4.2.2p7" href="#5.2.4.2.2p7"><small>7</small></a>
1738 The rounding mode for floating-point addition is characterized by the implementation-
1739 defined value of FLT_ROUNDS:<sup><a href="#note18"><b>18)</b></a></sup>
1740 <pre>
1741 -1 indeterminable
1742 0 toward zero
1743 1 to nearest
1744 2 toward positive infinity
1745 3 toward negative infinity
1746 </pre>
1747 All other values for FLT_ROUNDS characterize implementation-defined rounding
1748 behavior.
1749 <p><a name="5.2.4.2.2p8" href="#5.2.4.2.2p8"><small>8</small></a>
1750 Except for assignment and cast (which remove all extra range and precision), the values
1751 of operations with floating operands and values subject to the usual arithmetic
1752 conversions and of floating constants are evaluated to a format whose range and precision
1753 may be greater than required by the type. The use of evaluation formats is characterized
1754 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note19"><b>19)</b></a></sup>
1758 <!--page 37 -->
1759 <pre>
1760 -1 indeterminable;
1761 0 evaluate all operations and constants just to the range and precision of the
1762 type;
1763 1 evaluate operations and constants of type float and double to the
1764 range and precision of the double type, evaluate long double
1765 operations and constants to the range and precision of the long double
1766 type;
1767 2 evaluate all operations and constants to the range and precision of the
1768 long double type.
1769 </pre>
1770 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1771 behavior.
1772 <p><a name="5.2.4.2.2p9" href="#5.2.4.2.2p9"><small>9</small></a>
1773 The values given in the following list shall be replaced by constant expressions with
1774 implementation-defined values that are greater or equal in magnitude (absolute value) to
1775 those shown, with the same sign:
1776 <ul>
1777 <li> radix of exponent representation, b
1778 <pre>
1779 FLT_RADIX 2
1780 </pre>
1781 <li> number of base-FLT_RADIX digits in the floating-point significand, p
1782 <pre>
1783 FLT_MANT_DIG
1784 DBL_MANT_DIG
1785 LDBL_MANT_DIG
1786 </pre>
1787 <li> number of decimal digits, n, such that any floating-point number in the widest
1788 supported floating type with pmax radix b digits can be rounded to a floating-point
1789 number with n decimal digits and back again without change to the value,
1790 <pre>
1791 { pmax log10 b if b is a power of 10
1793 { [^1 + pmax log10 b^] otherwise
1794 </pre>
1795 <pre>
1796 DECIMAL_DIG 10
1797 </pre>
1798 <li> number of decimal digits, q, such that any floating-point number with q decimal digits
1799 can be rounded into a floating-point number with p radix b digits and back again
1800 without change to the q decimal digits,
1805 <!--page 38 -->
1806 <pre>
1807 { p log10 b if b is a power of 10
1809 { [_( p - 1) log10 b_] otherwise
1810 </pre>
1811 <pre>
1812 FLT_DIG 6
1813 DBL_DIG 10
1814 LDBL_DIG 10
1815 </pre>
1816 <li> minimum negative integer such that FLT_RADIX raised to one less than that power is
1817 a normalized floating-point number, emin
1818 <pre>
1819 FLT_MIN_EXP
1820 DBL_MIN_EXP
1821 LDBL_MIN_EXP
1822 </pre>
1823 <li> minimum negative integer such that 10 raised to that power is in the range of
1824 normalized floating-point numbers, [^log10 b<sup>emin -1</sup>^]
1825 <pre>
1826 FLT_MIN_10_EXP -37
1827 DBL_MIN_10_EXP -37
1828 LDBL_MIN_10_EXP -37
1829 </pre>
1830 <li> maximum integer such that FLT_RADIX raised to one less than that power is a
1831 representable finite floating-point number, emax
1832 <pre>
1833 FLT_MAX_EXP
1834 DBL_MAX_EXP
1835 LDBL_MAX_EXP
1836 </pre>
1837 <li> maximum integer such that 10 raised to that power is in the range of representable
1838 finite floating-point numbers, [_log10 ((1 - b<sup>-p</sup>)b<sup>emax</sup>)_]
1839 <pre>
1840 FLT_MAX_10_EXP +37
1841 DBL_MAX_10_EXP +37
1842 LDBL_MAX_10_EXP +37
1843 </pre>
1844 </ul>
1845 <p><a name="5.2.4.2.2p10" href="#5.2.4.2.2p10"><small>10</small></a>
1846 The values given in the following list shall be replaced by constant expressions with
1847 implementation-defined values that are greater than or equal to those shown:
1848 <ul>
1849 <li> maximum representable finite floating-point number, (1 - b<sup>-p</sup>)b<sup>emax</sup>
1850 <pre>
1851 FLT_MAX 1E+37
1852 DBL_MAX 1E+37
1853 LDBL_MAX 1E+37
1854 </pre>
1855 </ul>
1856 <p><a name="5.2.4.2.2p11" href="#5.2.4.2.2p11"><small>11</small></a>
1857 The values given in the following list shall be replaced by constant expressions with
1858 implementation-defined (positive) values that are less than or equal to those shown:
1859 <ul>
1860 <li> the difference between 1 and the least value greater than 1 that is representable in the
1861 given floating point type, b<sup>1-p</sup>
1862 <!--page 39 -->
1863 <pre>
1864 FLT_EPSILON 1E-5
1865 DBL_EPSILON 1E-9
1866 LDBL_EPSILON 1E-9
1867 </pre>
1868 <li> minimum normalized positive floating-point number, b<sup>emin -1</sup>
1869 <pre>
1870 FLT_MIN 1E-37
1871 DBL_MIN 1E-37
1872 LDBL_MIN 1E-37
1873 </pre>
1874 </ul>
1875 <p><b>Recommended practice</b>
1876 <p><a name="5.2.4.2.2p12" href="#5.2.4.2.2p12"><small>12</small></a>
1877 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1878 should be the identity function.
1879 <p><a name="5.2.4.2.2p13" href="#5.2.4.2.2p13"><small>13</small></a>
1880 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1881 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
1882 float:
1883 <pre>
1885 x = s 16<sup>e</sup> (Sum) f<sub>k</sub> 16<sup>-k</sup> , -31 &lt;= e &lt;= +32
1887 </pre>
1889 <pre>
1890 FLT_RADIX 16
1891 FLT_MANT_DIG 6
1892 FLT_EPSILON 9.53674316E-07F
1893 FLT_DIG 6
1894 FLT_MIN_EXP -31
1895 FLT_MIN 2.93873588E-39F
1896 FLT_MIN_10_EXP -38
1897 FLT_MAX_EXP +32
1898 FLT_MAX 3.40282347E+38F
1899 FLT_MAX_10_EXP +38
1900 </pre>
1902 <p><a name="5.2.4.2.2p14" href="#5.2.4.2.2p14"><small>14</small></a>
1903 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1904 single-precision and double-precision normalized numbers in IEC 60559,<sup><a href="#note20"><b>20)</b></a></sup> and the appropriate values in a
1905 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
1906 <pre>
1908 xf = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -125 &lt;= e &lt;= +128
1910 </pre>
1912 <pre>
1914 xd = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -1021 &lt;= e &lt;= +1024
1916 </pre>
1919 <pre>
1920 FLT_RADIX 2
1921 DECIMAL_DIG 17
1922 FLT_MANT_DIG 24
1923 FLT_EPSILON 1.19209290E-07F // decimal constant
1924 FLT_EPSILON 0X1P-23F // hex constant
1925 </pre>
1928 <!--page 40 -->
1929 <pre>
1930 FLT_DIG 6
1931 FLT_MIN_EXP -125
1932 FLT_MIN 1.17549435E-38F // decimal constant
1933 FLT_MIN 0X1P-126F // hex constant
1934 FLT_MIN_10_EXP -37
1935 FLT_MAX_EXP +128
1936 FLT_MAX 3.40282347E+38F // decimal constant
1937 FLT_MAX 0X1.fffffeP127F // hex constant
1938 FLT_MAX_10_EXP +38
1939 DBL_MANT_DIG 53
1940 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1941 DBL_EPSILON 0X1P-52 // hex constant
1942 DBL_DIG 15
1943 DBL_MIN_EXP -1021
1944 DBL_MIN 2.2250738585072014E-308 // decimal constant
1945 DBL_MIN 0X1P-1022 // hex constant
1946 DBL_MIN_10_EXP -307
1947 DBL_MAX_EXP +1024
1948 DBL_MAX 1.7976931348623157E+308 // decimal constant
1949 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1950 DBL_MAX_10_EXP +308
1951 </pre>
1952 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1953 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1954 precision), then DECIMAL_DIG would be 21.
1956 <p><b> Forward references</b>: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1957 <a href="#7.3">&lt;complex.h&gt;</a> (<a href="#7.3">7.3</a>), extended multibyte and wide character utilities <a href="#7.24">&lt;wchar.h&gt;</a>
1958 (<a href="#7.24">7.24</a>), floating-point environment <a href="#7.6">&lt;fenv.h&gt;</a> (<a href="#7.6">7.6</a>), general utilities <a href="#7.20">&lt;stdlib.h&gt;</a>
1959 (<a href="#7.20">7.20</a>), input/output <a href="#7.19">&lt;stdio.h&gt;</a> (<a href="#7.19">7.19</a>), mathematics <a href="#7.12">&lt;math.h&gt;</a> (<a href="#7.12">7.12</a>).
1960 <!--page 41 -->
1962 <p><b>Footnotes</b>
1963 <p><small><a name="note16" href="#note16">16)</a> The floating-point model is intended to clarify the description of each floating-point characteristic and
1964 does not require the floating-point arithmetic of the implementation to be identical.
1965 </small>
1966 <p><small><a name="note17" href="#note17">17)</a> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1967 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1968 similar behavior.
1969 </small>
1970 <p><small><a name="note18" href="#note18">18)</a> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1971 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
1972 </small>
1973 <p><small><a name="note19" href="#note19">19)</a> The evaluation method determines evaluation formats of expressions involving all floating types, not
1974 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1975 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1976 double.
1977 </small>
1978 <p><small><a name="note20" href="#note20">20)</a> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1979 limits are one less than shown here.
1980 </small>
1982 <p><small><a href="#Contents">Contents</a></small>
1983 <h2><a name="6" href="#6">6. Language</a></h2>
1985 <p><small><a href="#Contents">Contents</a></small>
1986 <h3><a name="6.1" href="#6.1">6.1 Notation</a></h3>
1987 <p><a name="6.1p1" href="#6.1p1"><small>1</small></a>
1988 In the syntax notation used in this clause, syntactic categories (nonterminals) are
1989 indicated by italic type, and literal words and character set members (terminals) by bold
1990 type. A colon (:) following a nonterminal introduces its definition. Alternative
1991 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
1992 optional symbol is indicated by the subscript ''opt'', so that
1993 <pre>
1994 { expression<sub>opt</sub> }
1995 </pre>
1996 indicates an optional expression enclosed in braces.
1997 <p><a name="6.1p2" href="#6.1p2"><small>2</small></a>
1998 When syntactic categories are referred to in the main text, they are not italicized and
1999 words are separated by spaces instead of hyphens.
2000 <p><a name="6.1p3" href="#6.1p3"><small>3</small></a>
2001 A summary of the language syntax is given in <a href="#A">annex A</a>.
2003 <p><small><a href="#Contents">Contents</a></small>
2004 <h3><a name="6.2" href="#6.2">6.2 Concepts</a></h3>
2006 <p><small><a href="#Contents">Contents</a></small>
2007 <h4><a name="6.2.1" href="#6.2.1">6.2.1 Scopes of identifiers</a></h4>
2008 <p><a name="6.2.1p1" href="#6.2.1p1"><small>1</small></a>
2009 An identifier can denote an object; a function; a tag or a member of a structure, union, or
2010 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
2011 same identifier can denote different entities at different points in the program. A member
2012 of an enumeration is called an enumeration constant. Macro names and macro
2013 parameters are not considered further here, because prior to the semantic phase of
2014 program translation any occurrences of macro names in the source file are replaced by the
2015 preprocessing token sequences that constitute their macro definitions.
2016 <p><a name="6.2.1p2" href="#6.2.1p2"><small>2</small></a>
2017 For each different entity that an identifier designates, the identifier is visible (i.e., can be
2018 used) only within a region of program text called its scope. Different entities designated
2019 by the same identifier either have different scopes, or are in different name spaces. There
2020 are four kinds of scopes: function, file, block, and function prototype. (A function
2021 prototype is a declaration of a function that declares the types of its parameters.)
2022 <p><a name="6.2.1p3" href="#6.2.1p3"><small>3</small></a>
2023 A label name is the only kind of identifier that has function scope. It can be used (in a
2024 goto statement) anywhere in the function in which it appears, and is declared implicitly
2025 by its syntactic appearance (followed by a : and a statement).
2026 <p><a name="6.2.1p4" href="#6.2.1p4"><small>4</small></a>
2027 Every other identifier has scope determined by the placement of its declaration (in a
2028 declarator or type specifier). If the declarator or type specifier that declares the identifier
2029 appears outside of any block or list of parameters, the identifier has file scope, which
2030 terminates at the end of the translation unit. If the declarator or type specifier that
2031 declares the identifier appears inside a block or within the list of parameter declarations in
2032 a function definition, the identifier has block scope, which terminates at the end of the
2033 associated block. If the declarator or type specifier that declares the identifier appears
2034 <!--page 42 -->
2035 within the list of parameter declarations in a function prototype (not part of a function
2036 definition), the identifier has function prototype scope, which terminates at the end of the
2037 function declarator. If an identifier designates two different entities in the same name
2038 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will be a
2039 strict subset of the scope of the other entity (the outer scope). Within the inner scope, the
2040 identifier designates the entity declared in the inner scope; the entity declared in the outer
2041 scope is hidden (and not visible) within the inner scope.
2042 <p><a name="6.2.1p5" href="#6.2.1p5"><small>5</small></a>
2043 Unless explicitly stated otherwise, where this International Standard uses the term
2044 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
2045 entity in the relevant name space whose declaration is visible at the point the identifier
2046 occurs.
2047 <p><a name="6.2.1p6" href="#6.2.1p6"><small>6</small></a>
2048 Two identifiers have the same scope if and only if their scopes terminate at the same
2049 point.
2050 <p><a name="6.2.1p7" href="#6.2.1p7"><small>7</small></a>
2051 Structure, union, and enumeration tags have scope that begins just after the appearance of
2052 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
2053 begins just after the appearance of its defining enumerator in an enumerator list. Any
2054 other identifier has scope that begins just after the completion of its declarator.
2055 <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
2056 (<a href="#6.9.1">6.9.1</a>), identifiers (<a href="#6.4.2">6.4.2</a>), name spaces of identifiers (<a href="#6.2.3">6.2.3</a>), macro replacement (<a href="#6.10.3">6.10.3</a>),
2057 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
2059 <p><small><a href="#Contents">Contents</a></small>
2060 <h4><a name="6.2.2" href="#6.2.2">6.2.2 Linkages of identifiers</a></h4>
2061 <p><a name="6.2.2p1" href="#6.2.2p1"><small>1</small></a>
2062 An identifier declared in different scopes or in the same scope more than once can be
2063 made to refer to the same object or function by a process called linkage.<sup><a href="#note21"><b>21)</b></a></sup> There are
2064 three kinds of linkage: external, internal, and none.
2065 <p><a name="6.2.2p2" href="#6.2.2p2"><small>2</small></a>
2066 In the set of translation units and libraries that constitutes an entire program, each
2067 declaration of a particular identifier with external linkage denotes the same object or
2068 function. Within one translation unit, each declaration of an identifier with internal
2069 linkage denotes the same object or function. Each declaration of an identifier with no
2070 linkage denotes a unique entity.
2071 <p><a name="6.2.2p3" href="#6.2.2p3"><small>3</small></a>
2072 If the declaration of a file scope identifier for an object or a function contains the storage-
2073 class specifier static, the identifier has internal linkage.<sup><a href="#note22"><b>22)</b></a></sup>
2074 <p><a name="6.2.2p4" href="#6.2.2p4"><small>4</small></a>
2075 For an identifier declared with the storage-class specifier extern in a scope in which a
2079 <!--page 43 -->
2080 prior declaration of that identifier is visible,<sup><a href="#note23"><b>23)</b></a></sup> if the prior declaration specifies internal or
2081 external linkage, the linkage of the identifier at the later declaration is the same as the
2082 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
2083 declaration specifies no linkage, then the identifier has external linkage.
2084 <p><a name="6.2.2p5" href="#6.2.2p5"><small>5</small></a>
2085 If the declaration of an identifier for a function has no storage-class specifier, its linkage
2086 is determined exactly as if it were declared with the storage-class specifier extern. If
2087 the declaration of an identifier for an object has file scope and no storage-class specifier,
2088 its linkage is external.
2089 <p><a name="6.2.2p6" href="#6.2.2p6"><small>6</small></a>
2090 The following identifiers have no linkage: an identifier declared to be anything other than
2091 an object or a function; an identifier declared to be a function parameter; a block scope
2092 identifier for an object declared without the storage-class specifier extern.
2093 <p><a name="6.2.2p7" href="#6.2.2p7"><small>7</small></a>
2094 If, within a translation unit, the same identifier appears with both internal and external
2095 linkage, the behavior is undefined.
2096 <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>),
2097 statements (<a href="#6.8">6.8</a>).
2099 <p><b>Footnotes</b>
2100 <p><small><a name="note21" href="#note21">21)</a> There is no linkage between different identifiers.
2101 </small>
2102 <p><small><a name="note22" href="#note22">22)</a> A function declaration can contain the storage-class specifier static only if it is at file scope; see
2103 <a href="#6.7.1">6.7.1</a>.
2104 </small>
2105 <p><small><a name="note23" href="#note23">23)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2106 </small>
2108 <p><small><a href="#Contents">Contents</a></small>
2109 <h4><a name="6.2.3" href="#6.2.3">6.2.3 Name spaces of identifiers</a></h4>
2110 <p><a name="6.2.3p1" href="#6.2.3p1"><small>1</small></a>
2111 If more than one declaration of a particular identifier is visible at any point in a
2112 translation unit, the syntactic context disambiguates uses that refer to different entities.
2113 Thus, there are separate name spaces for various categories of identifiers, as follows:
2114 <ul>
2115 <li> label names (disambiguated by the syntax of the label declaration and use);
2116 <li> the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note24"><b>24)</b></a></sup>
2117 of the keywords struct, union, or enum);
2118 <li> the members of structures or unions; each structure or union has a separate name
2119 space for its members (disambiguated by the type of the expression used to access the
2120 member via the . or -&gt; operator);
2121 <li> all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
2122 enumeration constants).
2123 </ul>
2124 <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>),
2125 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
2126 (<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>).
2131 <!--page 44 -->
2133 <p><b>Footnotes</b>
2134 <p><small><a name="note24" href="#note24">24)</a> There is only one name space for tags even though three are possible.
2135 </small>
2137 <p><small><a href="#Contents">Contents</a></small>
2138 <h4><a name="6.2.4" href="#6.2.4">6.2.4 Storage durations of objects</a></h4>
2139 <p><a name="6.2.4p1" href="#6.2.4p1"><small>1</small></a>
2140 An object has a storage duration that determines its lifetime. There are three storage
2141 durations: static, automatic, and allocated. Allocated storage is described in <a href="#7.20.3">7.20.3</a>.
2142 <p><a name="6.2.4p2" href="#6.2.4p2"><small>2</small></a>
2143 The lifetime of an object is the portion of program execution during which storage is
2144 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note25"><b>25)</b></a></sup> and retains
2145 its last-stored value throughout its lifetime.<sup><a href="#note26"><b>26)</b></a></sup> If an object is referred to outside of its
2146 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
2147 the object it points to reaches the end of its lifetime.
2148 <p><a name="6.2.4p3" href="#6.2.4p3"><small>3</small></a>
2149 An object whose identifier is declared with external or internal linkage, or with the
2150 storage-class specifier static has static storage duration. Its lifetime is the entire
2151 execution of the program and its stored value is initialized only once, prior to program
2152 startup.
2153 <p><a name="6.2.4p4" href="#6.2.4p4"><small>4</small></a>
2154 An object whose identifier is declared with no linkage and without the storage-class
2155 specifier static has automatic storage duration.
2156 <p><a name="6.2.4p5" href="#6.2.4p5"><small>5</small></a>
2157 For such an object that does not have a variable length array type, its lifetime extends
2158 from entry into the block with which it is associated until execution of that block ends in
2159 any way. (Entering an enclosed block or calling a function suspends, but does not end,
2160 execution of the current block.) If the block is entered recursively, a new instance of the
2161 object is created each time. The initial value of the object is indeterminate. If an
2162 initialization is specified for the object, it is performed each time the declaration is
2163 reached in the execution of the block; otherwise, the value becomes indeterminate each
2164 time the declaration is reached.
2165 <p><a name="6.2.4p6" href="#6.2.4p6"><small>6</small></a>
2166 For such an object that does have a variable length array type, its lifetime extends from
2167 the declaration of the object until execution of the program leaves the scope of the
2168 declaration.<sup><a href="#note27"><b>27)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
2169 each time. The initial value of the object is indeterminate.
2170 <p><b> Forward references</b>: statements (<a href="#6.8">6.8</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), declarators (<a href="#6.7.5">6.7.5</a>), array
2171 declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
2176 <!--page 45 -->
2178 <p><b>Footnotes</b>
2179 <p><small><a name="note25" href="#note25">25)</a> The term ''constant address'' means that two pointers to the object constructed at possibly different
2180 times will compare equal. The address may be different during two different executions of the same
2181 program.
2182 </small>
2183 <p><small><a name="note26" href="#note26">26)</a> In the case of a volatile object, the last store need not be explicit in the program.
2184 </small>
2185 <p><small><a name="note27" href="#note27">27)</a> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
2186 embedded block prior to the declaration, leaves the scope of the declaration.
2187 </small>
2189 <p><small><a href="#Contents">Contents</a></small>
2190 <h4><a name="6.2.5" href="#6.2.5">6.2.5 Types</a></h4>
2191 <p><a name="6.2.5p1" href="#6.2.5p1"><small>1</small></a>
2192 The meaning of a value stored in an object or returned by a function is determined by the
2193 type of the expression used to access it. (An identifier declared to be an object is the
2194 simplest such expression; the type is specified in the declaration of the identifier.) Types
2195 are partitioned into object types (types that fully describe objects), function types (types
2196 that describe functions), and incomplete types (types that describe objects but lack
2197 information needed to determine their sizes).
2198 <p><a name="6.2.5p2" href="#6.2.5p2"><small>2</small></a>
2199 An object declared as type _Bool is large enough to store the values 0 and 1.
2200 <p><a name="6.2.5p3" href="#6.2.5p3"><small>3</small></a>
2201 An object declared as type char is large enough to store any member of the basic
2202 execution character set. If a member of the basic execution character set is stored in a
2203 char object, its value is guaranteed to be nonnegative. If any other character is stored in
2204 a char object, the resulting value is implementation-defined but shall be within the range
2205 of values that can be represented in that type.
2206 <p><a name="6.2.5p4" href="#6.2.5p4"><small>4</small></a>
2207 There are five standard signed integer types, designated as signed char, short
2208 int, int, long int, and long long int. (These and other types may be
2209 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
2210 implementation-defined extended signed integer types.<sup><a href="#note28"><b>28)</b></a></sup> The standard and extended
2211 signed integer types are collectively called signed integer types.<sup><a href="#note29"><b>29)</b></a></sup>
2212 <p><a name="6.2.5p5" href="#6.2.5p5"><small>5</small></a>
2213 An object declared as type signed char occupies the same amount of storage as a
2214 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
2215 architecture of the execution environment (large enough to contain any value in the range
2216 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
2217 <p><a name="6.2.5p6" href="#6.2.5p6"><small>6</small></a>
2218 For each of the signed integer types, there is a corresponding (but different) unsigned
2219 integer type (designated with the keyword unsigned) that uses the same amount of
2220 storage (including sign information) and has the same alignment requirements. The type
2221 _Bool and the unsigned integer types that correspond to the standard signed integer
2222 types are the standard unsigned integer types. The unsigned integer types that
2223 correspond to the extended signed integer types are the extended unsigned integer types.
2224 The standard and extended unsigned integer types are collectively called unsigned integer
2225 types.<sup><a href="#note30"><b>30)</b></a></sup>
2229 <!--page 46 -->
2230 <p><a name="6.2.5p7" href="#6.2.5p7"><small>7</small></a>
2231 The standard signed integer types and standard unsigned integer types are collectively
2232 called the standard integer types, the extended signed integer types and extended
2233 unsigned integer types are collectively called the extended integer types.
2234 <p><a name="6.2.5p8" href="#6.2.5p8"><small>8</small></a>
2235 For any two integer types with the same signedness and different integer conversion rank
2236 (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
2237 subrange of the values of the other type.
2238 <p><a name="6.2.5p9" href="#6.2.5p9"><small>9</small></a>
2239 The range of nonnegative values of a signed integer type is a subrange of the
2240 corresponding unsigned integer type, and the representation of the same value in each
2241 type is the same.<sup><a href="#note31"><b>31)</b></a></sup> A computation involving unsigned operands can never overflow,
2242 because a result that cannot be represented by the resulting unsigned integer type is
2243 reduced modulo the number that is one greater than the largest value that can be
2244 represented by the resulting type.
2245 <p><a name="6.2.5p10" href="#6.2.5p10"><small>10</small></a>
2246 There are three real floating types, designated as float, double, and long
2247 double.<sup><a href="#note32"><b>32)</b></a></sup> The set of values of the type float is a subset of the set of values of the
2248 type double; the set of values of the type double is a subset of the set of values of the
2249 type long double.
2250 <p><a name="6.2.5p11" href="#6.2.5p11"><small>11</small></a>
2251 There are three complex types, designated as float _Complex, double
2252 _Complex, and long double _Complex.<sup><a href="#note33"><b>33)</b></a></sup> The real floating and complex types
2253 are collectively called the floating types.
2254 <p><a name="6.2.5p12" href="#6.2.5p12"><small>12</small></a>
2255 For each floating type there is a corresponding real type, which is always a real floating
2256 type. For real floating types, it is the same type. For complex types, it is the type given
2257 by deleting the keyword _Complex from the type name.
2258 <p><a name="6.2.5p13" href="#6.2.5p13"><small>13</small></a>
2259 Each complex type has the same representation and alignment requirements as an array
2260 type containing exactly two elements of the corresponding real type; the first element is
2261 equal to the real part, and the second element to the imaginary part, of the complex
2262 number.
2263 <p><a name="6.2.5p14" href="#6.2.5p14"><small>14</small></a>
2264 The type char, the signed and unsigned integer types, and the floating types are
2265 collectively called the basic types. Even if the implementation defines two or more basic
2266 types to have the same representation, they are nevertheless different types.<sup><a href="#note34"><b>34)</b></a></sup>
2268 <!--page 47 -->
2269 <p><a name="6.2.5p15" href="#6.2.5p15"><small>15</small></a>
2270 The three types char, signed char, and unsigned char are collectively called
2271 the character types. The implementation shall define char to have the same range,
2272 representation, and behavior as either signed char or unsigned char.<sup><a href="#note35"><b>35)</b></a></sup>
2273 <p><a name="6.2.5p16" href="#6.2.5p16"><small>16</small></a>
2274 An enumeration comprises a set of named integer constant values. Each distinct
2275 enumeration constitutes a different enumerated type.
2276 <p><a name="6.2.5p17" href="#6.2.5p17"><small>17</small></a>
2277 The type char, the signed and unsigned integer types, and the enumerated types are
2278 collectively called integer types. The integer and real floating types are collectively called
2279 real types.
2280 <p><a name="6.2.5p18" href="#6.2.5p18"><small>18</small></a>
2281 Integer and floating types are collectively called arithmetic types. Each arithmetic type
2282 belongs to one type domain: the real type domain comprises the real types, the complex
2283 type domain comprises the complex types.
2284 <p><a name="6.2.5p19" href="#6.2.5p19"><small>19</small></a>
2285 The void type comprises an empty set of values; it is an incomplete type that cannot be
2286 completed.
2287 <p><a name="6.2.5p20" href="#6.2.5p20"><small>20</small></a>
2288 Any number of derived types can be constructed from the object, function, and
2289 incomplete types, as follows:
2290 <ul>
2291 <li> An array type describes a contiguously allocated nonempty set of objects with a
2292 particular member object type, called the element type.<sup><a href="#note36"><b>36)</b></a></sup> Array types are
2293 characterized by their element type and by the number of elements in the array. An
2294 array type is said to be derived from its element type, and if its element type is T , the
2295 array type is sometimes called ''array of T ''. The construction of an array type from
2296 an element type is called ''array type derivation''.
2297 <li> A structure type describes a sequentially allocated nonempty set of member objects
2298 (and, in certain circumstances, an incomplete array), each of which has an optionally
2299 specified name and possibly distinct type.
2300 <li> A union type describes an overlapping nonempty set of member objects, each of
2301 which has an optionally specified name and possibly distinct type.
2302 <li> A function type describes a function with specified return type. A function type is
2303 characterized by its return type and the number and types of its parameters. A
2304 function type is said to be derived from its return type, and if its return type is T , the
2305 function type is sometimes called ''function returning T ''. The construction of a
2306 function type from a return type is called ''function type derivation''.
2310 <!--page 48 -->
2311 <li> A pointer type may be derived from a function type, an object type, or an incomplete
2312 type, called the referenced type. A pointer type describes an object whose value
2313 provides a reference to an entity of the referenced type. A pointer type derived from
2314 the referenced type T is sometimes called ''pointer to T ''. The construction of a
2315 pointer type from a referenced type is called ''pointer type derivation''.
2316 </ul>
2317 These methods of constructing derived types can be applied recursively.
2318 <p><a name="6.2.5p21" href="#6.2.5p21"><small>21</small></a>
2319 Arithmetic types and pointer types are collectively called scalar types. Array and
2320 structure types are collectively called aggregate types.<sup><a href="#note37"><b>37)</b></a></sup>
2321 <p><a name="6.2.5p22" href="#6.2.5p22"><small>22</small></a>
2322 An array type of unknown size is an incomplete type. It is completed, for an identifier of
2323 that type, by specifying the size in a later declaration (with internal or external linkage).
2324 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
2325 type. It is completed, for all declarations of that type, by declaring the same structure or
2326 union tag with its defining content later in the same scope.
2327 <p><a name="6.2.5p23" href="#6.2.5p23"><small>23</small></a>
2328 A type has known constant size if the type is not incomplete and is not a variable length
2329 array type.
2330 <p><a name="6.2.5p24" href="#6.2.5p24"><small>24</small></a>
2331 Array, function, and pointer types are collectively called derived declarator types. A
2332 declarator type derivation from a type T is the construction of a derived declarator type
2333 from T by the application of an array-type, a function-type, or a pointer-type derivation to
2335 <p><a name="6.2.5p25" href="#6.2.5p25"><small>25</small></a>
2336 A type is characterized by its type category, which is either the outermost derivation of a
2337 derived type (as noted above in the construction of derived types), or the type itself if the
2338 type consists of no derived types.
2339 <p><a name="6.2.5p26" href="#6.2.5p26"><small>26</small></a>
2340 Any type so far mentioned is an unqualified type. Each unqualified type has several
2341 qualified versions of its type,<sup><a href="#note38"><b>38)</b></a></sup> corresponding to the combinations of one, two, or all
2342 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2343 versions of a type are distinct types that belong to the same type category and have the
2344 same representation and alignment requirements.<sup><a href="#note39"><b>39)</b></a></sup> A derived type is not qualified by the
2345 qualifiers (if any) of the type from which it is derived.
2346 <p><a name="6.2.5p27" href="#6.2.5p27"><small>27</small></a>
2347 A pointer to void shall have the same representation and alignment requirements as a
2348 pointer to a character type.<sup><a href="#note39"><b>39)</b></a></sup> Similarly, pointers to qualified or unqualified versions of
2349 compatible types shall have the same representation and alignment requirements. All
2352 <!--page 49 -->
2353 pointers to structure types shall have the same representation and alignment requirements
2354 as each other. All pointers to union types shall have the same representation and
2355 alignment requirements as each other. Pointers to other types need not have the same
2356 representation or alignment requirements.
2357 <p><a name="6.2.5p28" href="#6.2.5p28"><small>28</small></a>
2358 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2359 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2360 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2361 qualified float'' and is a pointer to a qualified type.
2363 <p><a name="6.2.5p29" href="#6.2.5p29"><small>29</small></a>
2364 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2365 function returning struct tag''. The array has length five and the function has a single parameter of type
2366 float. Its type category is array.
2368 <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>).
2370 <p><b>Footnotes</b>
2371 <p><small><a name="note28" href="#note28">28)</a> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2372 described in <a href="#7.1.3">7.1.3</a>.
2373 </small>
2374 <p><small><a name="note29" href="#note29">29)</a> Therefore, any statement in this Standard about signed integer types also applies to the extended
2375 signed integer types.
2376 </small>
2377 <p><small><a name="note30" href="#note30">30)</a> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2378 unsigned integer types.
2379 </small>
2380 <p><small><a name="note31" href="#note31">31)</a> The same representation and alignment requirements are meant to imply interchangeability as
2381 arguments to functions, return values from functions, and members of unions.
2382 </small>
2383 <p><small><a name="note32" href="#note32">32)</a> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2384 </small>
2385 <p><small><a name="note33" href="#note33">33)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
2386 </small>
2387 <p><small><a name="note34" href="#note34">34)</a> An implementation may define new keywords that provide alternative ways to designate a basic (or
2388 any other) type; this does not violate the requirement that all basic types be different.
2389 Implementation-defined keywords shall have the form of an identifier reserved for any use as
2390 described in <a href="#7.1.3">7.1.3</a>.
2391 </small>
2392 <p><small><a name="note35" href="#note35">35)</a> CHAR_MIN, defined in <a href="#7.10">&lt;limits.h&gt;</a>, will have one of the values 0 or SCHAR_MIN, and this can be
2393 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2394 other two and is not compatible with either.
2395 </small>
2396 <p><small><a name="note36" href="#note36">36)</a> Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
2397 </small>
2398 <p><small><a name="note37" href="#note37">37)</a> Note that aggregate type does not include union type because an object with union type can only
2399 contain one member at a time.
2400 </small>
2401 <p><small><a name="note38" href="#note38">38)</a> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
2402 </small>
2403 <p><small><a name="note39" href="#note39">39)</a> The same representation and alignment requirements are meant to imply interchangeability as
2404 arguments to functions, return values from functions, and members of unions.
2405 </small>
2407 <p><small><a href="#Contents">Contents</a></small>
2408 <h4><a name="6.2.6" href="#6.2.6">6.2.6 Representations of types</a></h4>
2410 <p><small><a href="#Contents">Contents</a></small>
2411 <h5><a name="6.2.6.1" href="#6.2.6.1">6.2.6.1 General</a></h5>
2412 <p><a name="6.2.6.1p1" href="#6.2.6.1p1"><small>1</small></a>
2413 The representations of all types are unspecified except as stated in this subclause.
2414 <p><a name="6.2.6.1p2" href="#6.2.6.1p2"><small>2</small></a>
2415 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2416 the number, order, and encoding of which are either explicitly specified or
2417 implementation-defined.
2418 <p><a name="6.2.6.1p3" href="#6.2.6.1p3"><small>3</small></a>
2419 Values stored in unsigned bit-fields and objects of type unsigned char shall be
2420 represented using a pure binary notation.<sup><a href="#note40"><b>40)</b></a></sup>
2421 <p><a name="6.2.6.1p4" href="#6.2.6.1p4"><small>4</small></a>
2422 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2423 bits, where n is the size of an object of that type, in bytes. The value may be copied into
2424 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
2425 called the object representation of the value. Values stored in bit-fields consist of m bits,
2426 where m is the size specified for the bit-field. The object representation is the set of m
2427 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
2428 than NaNs) with the same object representation compare equal, but values that compare
2429 equal may have different object representations.
2430 <p><a name="6.2.6.1p5" href="#6.2.6.1p5"><small>5</small></a>
2431 Certain object representations need not represent a value of the object type. If the stored
2432 value of an object has such a representation and is read by an lvalue expression that does
2433 not have character type, the behavior is undefined. If such a representation is produced
2434 by a side effect that modifies all or any part of the object by an lvalue expression that
2435 does not have character type, the behavior is undefined.<sup><a href="#note41"><b>41)</b></a></sup> Such a representation is called
2437 <!--page 50 -->
2438 a trap representation.
2439 <p><a name="6.2.6.1p6" href="#6.2.6.1p6"><small>6</small></a>
2440 When a value is stored in an object of structure or union type, including in a member
2441 object, the bytes of the object representation that correspond to any padding bytes take
2442 unspecified values.<sup><a href="#note42"><b>42)</b></a></sup> The value of a structure or union object is never a trap
2443 representation, even though the value of a member of the structure or union object may be
2444 a trap representation.
2445 <p><a name="6.2.6.1p7" href="#6.2.6.1p7"><small>7</small></a>
2446 When a value is stored in a member of an object of union type, the bytes of the object
2447 representation that do not correspond to that member but do correspond to other members
2448 take unspecified values.
2449 <p><a name="6.2.6.1p8" href="#6.2.6.1p8"><small>8</small></a>
2450 Where an operator is applied to a value that has more than one object representation,
2451 which object representation is used shall not affect the value of the result.<sup><a href="#note43"><b>43)</b></a></sup> Where a
2452 value is stored in an object using a type that has more than one object representation for
2453 that value, it is unspecified which representation is used, but a trap representation shall
2454 not be generated.
2455 <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
2456 designators (<a href="#6.3.2.1">6.3.2.1</a>).
2458 <p><b>Footnotes</b>
2459 <p><small><a name="note40" href="#note40">40)</a> A positional representation for integers that uses the binary digits 0 and 1, in which the values
2460 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
2461 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
2462 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
2463 type unsigned char range from 0 to 2<sup>CHAR_BIT</sup>- 1.
2464 </small>
2465 <p><small><a name="note41" href="#note41">41)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
2466 behavior, but the value of the variable cannot be used until a proper value is stored in it.
2467 </small>
2468 <p><small><a name="note42" href="#note42">42)</a> Thus, for example, structure assignment need not copy any padding bits.
2469 </small>
2470 <p><small><a name="note43" href="#note43">43)</a> It is possible for objects x and y with the same effective type T to have the same value when they are
2471 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
2472 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
2473 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
2474 on values of type T may distinguish between them.
2475 </small>
2477 <p><small><a href="#Contents">Contents</a></small>
2478 <h5><a name="6.2.6.2" href="#6.2.6.2">6.2.6.2 Integer types</a></h5>
2479 <p><a name="6.2.6.2p1" href="#6.2.6.2p1"><small>1</small></a>
2480 For unsigned integer types other than unsigned char, the bits of the object
2481 representation shall be divided into two groups: value bits and padding bits (there need
2482 not be any of the latter). If there are N value bits, each bit shall represent a different
2483 power of 2 between 1 and 2<sup>N-1</sup> , so that objects of that type shall be capable of
2484 representing values from 0 to 2<sup>N</sup> - 1 using a pure binary representation; this shall be
2485 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note44"><b>44)</b></a></sup>
2486 <p><a name="6.2.6.2p2" href="#6.2.6.2p2"><small>2</small></a>
2487 For signed integer types, the bits of the object representation shall be divided into three
2488 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
2490 <!--page 51 -->
2491 there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
2492 the same bit in the object representation of the corresponding unsigned type (if there are
2493 M value bits in the signed type and N in the unsigned type, then M &lt;= N ). If the sign bit
2494 is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be
2495 modified in one of the following ways:
2496 <ul>
2497 <li> the corresponding value with sign bit 0 is negated (sign and magnitude);
2498 <li> the sign bit has the value -(2<sup>N</sup> ) (two's complement);
2499 <li> the sign bit has the value -(2<sup>N</sup> - 1) (ones' complement ).
2500 </ul>
2501 Which of these applies is implementation-defined, as is whether the value with sign bit 1
2502 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
2503 complement), is a trap representation or a normal value. In the case of sign and
2504 magnitude and ones' complement, if this representation is a normal value it is called a
2505 negative zero.
2506 <p><a name="6.2.6.2p3" href="#6.2.6.2p3"><small>3</small></a>
2507 If the implementation supports negative zeros, they shall be generated only by:
2508 <ul>
2509 <li> the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with arguments that produce such a value;
2510 <li> the +, -, *, /, and % operators where one argument is a negative zero and the result is
2511 zero;
2512 <li> compound assignment operators based on the above cases.
2513 </ul>
2514 It is unspecified whether these cases actually generate a negative zero or a normal zero,
2515 and whether a negative zero becomes a normal zero when stored in an object.
2516 <p><a name="6.2.6.2p4" href="#6.2.6.2p4"><small>4</small></a>
2517 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
2518 and &gt;&gt; operators with arguments that would produce such a value is undefined.
2519 <p><a name="6.2.6.2p5" href="#6.2.6.2p5"><small>5</small></a>
2520 The values of any padding bits are unspecified.<sup><a href="#note45"><b>45)</b></a></sup> A valid (non-trap) object representation
2521 of a signed integer type where the sign bit is zero is a valid object representation of the
2522 corresponding unsigned type, and shall represent the same value. For any integer type,
2523 the object representation where all the bits are zero shall be a representation of the value
2524 zero in that type.
2525 <p><a name="6.2.6.2p6" href="#6.2.6.2p6"><small>6</small></a>
2526 The precision of an integer type is the number of bits it uses to represent values,
2527 excluding any sign and padding bits. The width of an integer type is the same but
2528 including any sign bit; thus for unsigned integer types the two values are the same, while
2531 <!--page 52 -->
2532 for signed integer types the width is one greater than the precision.
2534 <p><b>Footnotes</b>
2535 <p><small><a name="note44" href="#note44">44)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2536 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2537 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
2538 with unsigned types. All other combinations of padding bits are alternative object representations of
2539 the value specified by the value bits.
2540 </small>
2541 <p><small><a name="note45" href="#note45">45)</a> Some combinations of padding bits might generate trap representations, for example, if one padding
2542 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2543 representation other than as part of an exceptional condition such as an overflow. All other
2544 combinations of padding bits are alternative object representations of the value specified by the value
2545 bits.
2546 </small>
2548 <p><small><a href="#Contents">Contents</a></small>
2549 <h4><a name="6.2.7" href="#6.2.7">6.2.7 Compatible type and composite type</a></h4>
2550 <p><a name="6.2.7p1" href="#6.2.7p1"><small>1</small></a>
2551 Two types have compatible type if their types are the same. Additional rules for
2552 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
2553 in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.5">6.7.5</a> for declarators.<sup><a href="#note46"><b>46)</b></a></sup> Moreover, two structure,
2554 union, or enumerated types declared in separate translation units are compatible if their
2555 tags and members satisfy the following requirements: If one is declared with a tag, the
2556 other shall be declared with the same tag. If both are complete types, then the following
2557 additional requirements apply: there shall be a one-to-one correspondence between their
2558 members such that each pair of corresponding members are declared with compatible
2559 types, and such that if one member of a corresponding pair is declared with a name, the
2560 other member is declared with the same name. For two structures, corresponding
2561 members shall be declared in the same order. For two structures or unions, corresponding
2562 bit-fields shall have the same widths. For two enumerations, corresponding members
2563 shall have the same values.
2564 <p><a name="6.2.7p2" href="#6.2.7p2"><small>2</small></a>
2565 All declarations that refer to the same object or function shall have compatible type;
2566 otherwise, the behavior is undefined.
2567 <p><a name="6.2.7p3" href="#6.2.7p3"><small>3</small></a>
2568 A composite type can be constructed from two types that are compatible; it is a type that
2569 is compatible with both of the two types and satisfies the following conditions:
2570 <ul>
2571 <li> If one type is an array of known constant size, the composite type is an array of that
2572 size; otherwise, if one type is a variable length array, the composite type is that type.
2573 <li> If only one type is a function type with a parameter type list (a function prototype),
2574 the composite type is a function prototype with the parameter type list.
2575 <li> If both types are function types with parameter type lists, the type of each parameter
2576 in the composite parameter type list is the composite type of the corresponding
2577 parameters.
2578 </ul>
2579 These rules apply recursively to the types from which the two types are derived.
2580 <p><a name="6.2.7p4" href="#6.2.7p4"><small>4</small></a>
2581 For an identifier with internal or external linkage declared in a scope in which a prior
2582 declaration of that identifier is visible,<sup><a href="#note47"><b>47)</b></a></sup> if the prior declaration specifies internal or
2583 external linkage, the type of the identifier at the later declaration becomes the composite
2584 type.
2589 <!--page 53 -->
2590 <p><a name="6.2.7p5" href="#6.2.7p5"><small>5</small></a>
2591 EXAMPLE Given the following two file scope declarations:
2592 <pre>
2593 int f(int (*)(), double (*)[3]);
2594 int f(int (*)(char *), double (*)[]);
2595 </pre>
2596 The resulting composite type for the function is:
2597 <!--page 54 -->
2598 <pre>
2599 int f(int (*)(char *), double (*)[3]);
2600 </pre>
2602 <p><b>Footnotes</b>
2603 <p><small><a name="note46" href="#note46">46)</a> Two types need not be identical to be compatible.
2604 </small>
2605 <p><small><a name="note47" href="#note47">47)</a> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2606 </small>
2608 <p><small><a href="#Contents">Contents</a></small>
2609 <h3><a name="6.3" href="#6.3">6.3 Conversions</a></h3>
2610 <p><a name="6.3p1" href="#6.3p1"><small>1</small></a>
2611 Several operators convert operand values from one type to another automatically. This
2612 subclause specifies the result required from such an implicit conversion, as well as those
2613 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2614 the conversions performed by most ordinary operators; it is supplemented as required by
2615 the discussion of each operator in <a href="#6.5">6.5</a>.
2616 <p><a name="6.3p2" href="#6.3p2"><small>2</small></a>
2617 Conversion of an operand value to a compatible type causes no change to the value or the
2618 representation.
2619 <p><b> Forward references</b>: cast operators (<a href="#6.5.4">6.5.4</a>).
2621 <p><small><a href="#Contents">Contents</a></small>
2622 <h4><a name="6.3.1" href="#6.3.1">6.3.1 Arithmetic operands</a></h4>
2624 <p><small><a href="#Contents">Contents</a></small>
2625 <h5><a name="6.3.1.1" href="#6.3.1.1">6.3.1.1 Boolean, characters, and integers</a></h5>
2626 <p><a name="6.3.1.1p1" href="#6.3.1.1p1"><small>1</small></a>
2627 Every integer type has an integer conversion rank defined as follows:
2628 <ul>
2629 <li> No two signed integer types shall have the same rank, even if they have the same
2630 representation.
2631 <li> The rank of a signed integer type shall be greater than the rank of any signed integer
2632 type with less precision.
2633 <li> The rank of long long int shall be greater than the rank of long int, which
2634 shall be greater than the rank of int, which shall be greater than the rank of short
2635 int, which shall be greater than the rank of signed char.
2636 <li> The rank of any unsigned integer type shall equal the rank of the corresponding
2637 signed integer type, if any.
2638 <li> The rank of any standard integer type shall be greater than the rank of any extended
2639 integer type with the same width.
2640 <li> The rank of char shall equal the rank of signed char and unsigned char.
2641 <li> The rank of _Bool shall be less than the rank of all other standard integer types.
2642 <li> The rank of any enumerated type shall equal the rank of the compatible integer type
2643 (see <a href="#6.7.2.2">6.7.2.2</a>).
2644 <li> The rank of any extended signed integer type relative to another extended signed
2645 integer type with the same precision is implementation-defined, but still subject to the
2646 other rules for determining the integer conversion rank.
2647 <li> For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2648 greater rank than T3, then T1 has greater rank than T3.
2649 </ul>
2650 <p><a name="6.3.1.1p2" href="#6.3.1.1p2"><small>2</small></a>
2651 The following may be used in an expression wherever an int or unsigned int may
2652 be used:
2653 <!--page 55 -->
2654 <ul>
2655 <li> An object or expression with an integer type whose integer conversion rank is less
2656 than or equal to the rank of int and unsigned int.
2657 <li> A bit-field of type _Bool, int, signed int, or unsigned int.
2658 </ul>
2659 If an int can represent all values of the original type, the value is converted to an int;
2660 otherwise, it is converted to an unsigned int. These are called the integer
2661 promotions.<sup><a href="#note48"><b>48)</b></a></sup> All other types are unchanged by the integer promotions.
2662 <p><a name="6.3.1.1p3" href="#6.3.1.1p3"><small>3</small></a>
2663 The integer promotions preserve value including sign. As discussed earlier, whether a
2664 ''plain'' char is treated as signed is implementation-defined.
2665 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2666 (<a href="#6.7.2.1">6.7.2.1</a>).
2668 <p><b>Footnotes</b>
2669 <p><small><a name="note48" href="#note48">48)</a> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2670 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2671 shift operators, as specified by their respective subclauses.
2672 </small>
2674 <p><small><a href="#Contents">Contents</a></small>
2675 <h5><a name="6.3.1.2" href="#6.3.1.2">6.3.1.2 Boolean type</a></h5>
2676 <p><a name="6.3.1.2p1" href="#6.3.1.2p1"><small>1</small></a>
2677 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2678 to 0; otherwise, the result is 1.
2680 <p><small><a href="#Contents">Contents</a></small>
2681 <h5><a name="6.3.1.3" href="#6.3.1.3">6.3.1.3 Signed and unsigned integers</a></h5>
2682 <p><a name="6.3.1.3p1" href="#6.3.1.3p1"><small>1</small></a>
2683 When a value with integer type is converted to another integer type other than _Bool, if
2684 the value can be represented by the new type, it is unchanged.
2685 <p><a name="6.3.1.3p2" href="#6.3.1.3p2"><small>2</small></a>
2686 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2687 subtracting one more than the maximum value that can be represented in the new type
2688 until the value is in the range of the new type.<sup><a href="#note49"><b>49)</b></a></sup>
2689 <p><a name="6.3.1.3p3" href="#6.3.1.3p3"><small>3</small></a>
2690 Otherwise, the new type is signed and the value cannot be represented in it; either the
2691 result is implementation-defined or an implementation-defined signal is raised.
2693 <p><b>Footnotes</b>
2694 <p><small><a name="note49" href="#note49">49)</a> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2695 </small>
2697 <p><small><a href="#Contents">Contents</a></small>
2698 <h5><a name="6.3.1.4" href="#6.3.1.4">6.3.1.4 Real floating and integer</a></h5>
2699 <p><a name="6.3.1.4p1" href="#6.3.1.4p1"><small>1</small></a>
2700 When a finite value of real floating type is converted to an integer type other than _Bool,
2701 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2702 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup>
2703 <p><a name="6.3.1.4p2" href="#6.3.1.4p2"><small>2</small></a>
2704 When a value of integer type is converted to a real floating type, if the value being
2705 converted can be represented exactly in the new type, it is unchanged. If the value being
2706 converted is in the range of values that can be represented but cannot be represented
2708 <!--page 56 -->
2709 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2710 in an implementation-defined manner. If the value being converted is outside the range of
2711 values that can be represented, the behavior is undefined.
2713 <p><b>Footnotes</b>
2714 <p><small><a name="note50" href="#note50">50)</a> The remaindering operation performed when a value of integer type is converted to unsigned type
2715 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2716 range of portable real floating values is (-1, Utype_MAX+1).
2717 </small>
2719 <p><small><a href="#Contents">Contents</a></small>
2720 <h5><a name="6.3.1.5" href="#6.3.1.5">6.3.1.5 Real floating types</a></h5>
2721 <p><a name="6.3.1.5p1" href="#6.3.1.5p1"><small>1</small></a>
2722 When a float is promoted to double or long double, or a double is promoted
2723 to long double, its value is unchanged (if the source value is represented in the
2724 precision and range of its type).
2725 <p><a name="6.3.1.5p2" href="#6.3.1.5p2"><small>2</small></a>
2726 When a double is demoted to float, a long double is demoted to double or
2727 float, or a value being represented in greater precision and range than required by its
2728 semantic type (see <a href="#6.3.1.8">6.3.1.8</a>) is explicitly converted (including to its own type), if the value
2729 being converted can be represented exactly in the new type, it is unchanged. If the value
2730 being converted is in the range of values that can be represented but cannot be
2731 represented exactly, the result is either the nearest higher or nearest lower representable
2732 value, chosen in an implementation-defined manner. If the value being converted is
2733 outside the range of values that can be represented, the behavior is undefined.
2735 <p><small><a href="#Contents">Contents</a></small>
2736 <h5><a name="6.3.1.6" href="#6.3.1.6">6.3.1.6 Complex types</a></h5>
2737 <p><a name="6.3.1.6p1" href="#6.3.1.6p1"><small>1</small></a>
2738 When a value of complex type is converted to another complex type, both the real and
2739 imaginary parts follow the conversion rules for the corresponding real types.
2741 <p><small><a href="#Contents">Contents</a></small>
2742 <h5><a name="6.3.1.7" href="#6.3.1.7">6.3.1.7 Real and complex</a></h5>
2743 <p><a name="6.3.1.7p1" href="#6.3.1.7p1"><small>1</small></a>
2744 When a value of real type is converted to a complex type, the real part of the complex
2745 result value is determined by the rules of conversion to the corresponding real type and
2746 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2747 <p><a name="6.3.1.7p2" href="#6.3.1.7p2"><small>2</small></a>
2748 When a value of complex type is converted to a real type, the imaginary part of the
2749 complex value is discarded and the value of the real part is converted according to the
2750 conversion rules for the corresponding real type.
2752 <p><small><a href="#Contents">Contents</a></small>
2753 <h5><a name="6.3.1.8" href="#6.3.1.8">6.3.1.8 Usual arithmetic conversions</a></h5>
2754 <p><a name="6.3.1.8p1" href="#6.3.1.8p1"><small>1</small></a>
2755 Many operators that expect operands of arithmetic type cause conversions and yield result
2756 types in a similar way. The purpose is to determine a common real type for the operands
2757 and result. For the specified operands, each operand is converted, without change of type
2758 domain, to a type whose corresponding real type is the common real type. Unless
2759 explicitly stated otherwise, the common real type is also the corresponding real type of
2760 the result, whose type domain is the type domain of the operands if they are the same,
2761 and complex otherwise. This pattern is called the usual arithmetic conversions:
2762 <!--page 57 -->
2763 <ul>
2764 <li> First, if the corresponding real type of either operand is long double, the other
2765 operand is converted, without change of type domain, to a type whose
2766 corresponding real type is long double.
2767 <li> Otherwise, if the corresponding real type of either operand is double, the other
2768 operand is converted, without change of type domain, to a type whose
2769 corresponding real type is double.
2770 <li> Otherwise, if the corresponding real type of either operand is float, the other
2771 operand is converted, without change of type domain, to a type whose
2772 corresponding real type is float.<sup><a href="#note51"><b>51)</b></a></sup>
2773 <li> Otherwise, the integer promotions are performed on both operands. Then the
2774 following rules are applied to the promoted operands:
2775 <ul>
2776 <li> If both operands have the same type, then no further conversion is needed.
2777 <li> Otherwise, if both operands have signed integer types or both have unsigned
2778 integer types, the operand with the type of lesser integer conversion rank is
2779 converted to the type of the operand with greater rank.
2780 <li> Otherwise, if the operand that has unsigned integer type has rank greater or
2781 equal to the rank of the type of the other operand, then the operand with
2782 signed integer type is converted to the type of the operand with unsigned
2783 integer type.
2784 <li> Otherwise, if the type of the operand with signed integer type can represent
2785 all of the values of the type of the operand with unsigned integer type, then
2786 the operand with unsigned integer type is converted to the type of the
2787 operand with signed integer type.
2788 <li> Otherwise, both operands are converted to the unsigned integer type
2789 corresponding to the type of the operand with signed integer type.
2790 </ul>
2791 </ul>
2792 <p><a name="6.3.1.8p2" href="#6.3.1.8p2"><small>2</small></a>
2793 The values of floating operands and of the results of floating expressions may be
2794 represented in greater precision and range than that required by the type; the types are not
2795 changed thereby.<sup><a href="#note52"><b>52)</b></a></sup>
2800 <!--page 58 -->
2802 <p><b>Footnotes</b>
2803 <p><small><a name="note51" href="#note51">51)</a> For example, addition of a double _Complex and a float entails just the conversion of the
2804 float operand to double (and yields a double _Complex result).
2805 </small>
2806 <p><small><a name="note52" href="#note52">52)</a> The cast and assignment operators are still required to perform their specified conversions as
2807 described in <a href="#6.3.1.4">6.3.1.4</a> and <a href="#6.3.1.5">6.3.1.5</a>.
2808 </small>
2810 <p><small><a href="#Contents">Contents</a></small>
2811 <h4><a name="6.3.2" href="#6.3.2">6.3.2 Other operands</a></h4>
2813 <p><small><a href="#Contents">Contents</a></small>
2814 <h5><a name="6.3.2.1" href="#6.3.2.1">6.3.2.1 Lvalues, arrays, and function designators</a></h5>
2815 <p><a name="6.3.2.1p1" href="#6.3.2.1p1"><small>1</small></a>
2816 An lvalue is an expression with an object type or an incomplete type other than void;<sup><a href="#note53"><b>53)</b></a></sup>
2817 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
2818 When an object is said to have a particular type, the type is specified by the lvalue used to
2819 designate the object. A modifiable lvalue is an lvalue that does not have array type, does
2820 not have an incomplete type, does not have a const-qualified type, and if it is a structure
2821 or union, does not have any member (including, recursively, any member or element of
2822 all contained aggregates or unions) with a const-qualified type.
2823 <p><a name="6.3.2.1p2" href="#6.3.2.1p2"><small>2</small></a>
2824 Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++
2825 operator, the -- operator, or the left operand of the . operator or an assignment operator,
2826 an lvalue that does not have array type is converted to the value stored in the designated
2827 object (and is no longer an lvalue). If the lvalue has qualified type, the value has the
2828 unqualified version of the type of the lvalue; otherwise, the value has the type of the
2829 lvalue. If the lvalue has an incomplete type and does not have array type, the behavior is
2830 undefined.
2831 <p><a name="6.3.2.1p3" href="#6.3.2.1p3"><small>3</small></a>
2832 Except when it is the operand of the sizeof operator or the unary &amp; operator, or is a
2833 string literal used to initialize an array, an expression that has type ''array of type'' is
2834 converted to an expression with type ''pointer to type'' that points to the initial element of
2835 the array object and is not an lvalue. If the array object has register storage class, the
2836 behavior is undefined.
2837 <p><a name="6.3.2.1p4" href="#6.3.2.1p4"><small>4</small></a>
2838 A function designator is an expression that has function type. Except when it is the
2839 operand of the sizeof operator<sup><a href="#note54"><b>54)</b></a></sup> or the unary &amp; operator, a function designator with
2840 type ''function returning type'' is converted to an expression that has type ''pointer to
2841 function returning type''.
2842 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2843 (<a href="#6.5.16">6.5.16</a>), common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), initialization (<a href="#6.7.8">6.7.8</a>), postfix
2844 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2845 (<a href="#6.5.3.1">6.5.3.1</a>), the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>), structure and union members (<a href="#6.5.2.3">6.5.2.3</a>).
2848 <!--page 59 -->
2850 <p><b>Footnotes</b>
2851 <p><small><a name="note53" href="#note53">53)</a> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2852 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2853 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2854 as the ''value of an expression''.
2855 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2856 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2857 </small>
2858 <p><small><a name="note54" href="#note54">54)</a> Because this conversion does not occur, the operand of the sizeof operator remains a function
2859 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
2860 </small>
2862 <p><small><a href="#Contents">Contents</a></small>
2863 <h5><a name="6.3.2.2" href="#6.3.2.2">6.3.2.2 void</a></h5>
2864 <p><a name="6.3.2.2p1" href="#6.3.2.2p1"><small>1</small></a>
2865 The (nonexistent) value of a void expression (an expression that has type void) shall not
2866 be used in any way, and implicit or explicit conversions (except to void) shall not be
2867 applied to such an expression. If an expression of any other type is evaluated as a void
2868 expression, its value or designator is discarded. (A void expression is evaluated for its
2869 side effects.)
2871 <p><small><a href="#Contents">Contents</a></small>
2872 <h5><a name="6.3.2.3" href="#6.3.2.3">6.3.2.3 Pointers</a></h5>
2873 <p><a name="6.3.2.3p1" href="#6.3.2.3p1"><small>1</small></a>
2874 A pointer to void may be converted to or from a pointer to any incomplete or object
2875 type. A pointer to any incomplete or object type may be converted to a pointer to void
2876 and back again; the result shall compare equal to the original pointer.
2877 <p><a name="6.3.2.3p2" href="#6.3.2.3p2"><small>2</small></a>
2878 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2879 the q-qualified version of the type; the values stored in the original and converted pointers
2880 shall compare equal.
2881 <p><a name="6.3.2.3p3" href="#6.3.2.3p3"><small>3</small></a>
2882 An integer constant expression with the value 0, or such an expression cast to type
2883 void *, is called a null pointer constant.<sup><a href="#note55"><b>55)</b></a></sup> If a null pointer constant is converted to a
2884 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2885 to a pointer to any object or function.
2886 <p><a name="6.3.2.3p4" href="#6.3.2.3p4"><small>4</small></a>
2887 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2888 Any two null pointers shall compare equal.
2889 <p><a name="6.3.2.3p5" href="#6.3.2.3p5"><small>5</small></a>
2890 An integer may be converted to any pointer type. Except as previously specified, the
2891 result is implementation-defined, might not be correctly aligned, might not point to an
2892 entity of the referenced type, and might be a trap representation.<sup><a href="#note56"><b>56)</b></a></sup>
2893 <p><a name="6.3.2.3p6" href="#6.3.2.3p6"><small>6</small></a>
2894 Any pointer type may be converted to an integer type. Except as previously specified, the
2895 result is implementation-defined. If the result cannot be represented in the integer type,
2896 the behavior is undefined. The result need not be in the range of values of any integer
2897 type.
2898 <p><a name="6.3.2.3p7" href="#6.3.2.3p7"><small>7</small></a>
2899 A pointer to an object or incomplete type may be converted to a pointer to a different
2900 object or incomplete type. If the resulting pointer is not correctly aligned<sup><a href="#note57"><b>57)</b></a></sup> for the
2901 pointed-to type, the behavior is undefined. Otherwise, when converted back again, the
2902 result shall compare equal to the original pointer. When a pointer to an object is
2905 <!--page 60 -->
2906 converted to a pointer to a character type, the result points to the lowest addressed byte of
2907 the object. Successive increments of the result, up to the size of the object, yield pointers
2908 to the remaining bytes of the object.
2909 <p><a name="6.3.2.3p8" href="#6.3.2.3p8"><small>8</small></a>
2910 A pointer to a function of one type may be converted to a pointer to a function of another
2911 type and back again; the result shall compare equal to the original pointer. If a converted
2912 pointer is used to call a function whose type is not compatible with the pointed-to type,
2913 the behavior is undefined.
2914 <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
2915 capable of holding object pointers (<a href="#7.18.1.4">7.18.1.4</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>).
2916 <!--page 61 -->
2918 <p><b>Footnotes</b>
2919 <p><small><a name="note55" href="#note55">55)</a> The macro NULL is defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers) as a null pointer constant; see <a href="#7.17">7.17</a>.
2920 </small>
2921 <p><small><a name="note56" href="#note56">56)</a> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2922 be consistent with the addressing structure of the execution environment.
2923 </small>
2924 <p><small><a name="note57" href="#note57">57)</a> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2925 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2926 correctly aligned for a pointer to type C.
2927 </small>
2929 <p><small><a href="#Contents">Contents</a></small>
2930 <h3><a name="6.4" href="#6.4">6.4 Lexical elements</a></h3>
2931 <p><b>Syntax</b>
2932 <p><a name="6.4p1" href="#6.4p1"><small>1</small></a>
2933 <pre>
2934 token:
2935 keyword
2936 identifier
2937 constant
2938 string-literal
2939 punctuator
2940 preprocessing-token:
2941 header-name
2942 identifier
2943 pp-number
2944 character-constant
2945 string-literal
2946 punctuator
2947 each non-white-space character that cannot be one of the above
2948 </pre>
2949 <p><b>Constraints</b>
2950 <p><a name="6.4p2" href="#6.4p2"><small>2</small></a>
2951 Each preprocessing token that is converted to a token shall have the lexical form of a
2952 keyword, an identifier, a constant, a string literal, or a punctuator.
2953 <p><b>Semantics</b>
2954 <p><a name="6.4p3" href="#6.4p3"><small>3</small></a>
2955 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2956 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2957 A preprocessing token is the minimal lexical element of the language in translation
2958 phases 3 through 6. The categories of preprocessing tokens are: header names,
2959 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2960 single non-white-space characters that do not lexically match the other preprocessing
2961 token categories.<sup><a href="#note58"><b>58)</b></a></sup> If a ' or a " character matches the last category, the behavior is
2962 undefined. Preprocessing tokens can be separated by white space; this consists of
2963 comments (described later), or white-space characters (space, horizontal tab, new-line,
2964 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2965 during translation phase 4, white space (or the absence thereof) serves as more than
2966 preprocessing token separation. White space may appear within a preprocessing token
2967 only as part of a header name or between the quotation characters in a character constant
2968 or string literal.
2972 <!--page 62 -->
2973 <p><a name="6.4p4" href="#6.4p4"><small>4</small></a>
2974 If the input stream has been parsed into preprocessing tokens up to a given character, the
2975 next preprocessing token is the longest sequence of characters that could constitute a
2976 preprocessing token. There is one exception to this rule: header name preprocessing
2977 tokens are recognized only within #include preprocessing directives and in
2978 implementation-defined locations within #pragma directives. In such contexts, a
2979 sequence of characters that could be either a header name or a string literal is recognized
2980 as the former.
2981 <p><a name="6.4p5" href="#6.4p5"><small>5</small></a>
2982 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2983 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2984 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2985 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2986 not E is a macro name.
2988 <p><a name="6.4p6" href="#6.4p6"><small>6</small></a>
2989 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2990 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2992 <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>),
2993 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
2994 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2995 (<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
2996 (<a href="#6.4.5">6.4.5</a>).
2998 <p><b>Footnotes</b>
2999 <p><small><a name="note58" href="#note58">58)</a> An additional category, placemarkers, is used internally in translation phase 4 (see <a href="#6.10.3.3">6.10.3.3</a>); it cannot
3000 occur in source files.
3001 </small>
3003 <p><small><a href="#Contents">Contents</a></small>
3004 <h4><a name="6.4.1" href="#6.4.1">6.4.1 Keywords</a></h4>
3005 <p><b>Syntax</b>
3006 <p><a name="6.4.1p1" href="#6.4.1p1"><small>1</small></a>
3007 <pre>
3008 keyword: one of
3009 auto enum restrict unsigned
3010 break extern return void
3011 case float short volatile
3012 char for signed while
3013 const goto sizeof _Bool
3014 continue if static _Complex
3015 default inline struct _Imaginary
3016 do int switch
3017 double long typedef
3018 else register union
3019 </pre>
3020 <p><b>Semantics</b>
3021 <p><a name="6.4.1p2" href="#6.4.1p2"><small>2</small></a>
3022 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
3023 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
3024 specifying imaginary types.<sup><a href="#note59"><b>59)</b></a></sup>
3028 <!--page 63 -->
3030 <p><b>Footnotes</b>
3031 <p><small><a name="note59" href="#note59">59)</a> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
3032 </small>
3034 <p><small><a href="#Contents">Contents</a></small>
3035 <h4><a name="6.4.2" href="#6.4.2">6.4.2 Identifiers</a></h4>
3037 <p><small><a href="#Contents">Contents</a></small>
3038 <h5><a name="6.4.2.1" href="#6.4.2.1">6.4.2.1 General</a></h5>
3039 <p><b>Syntax</b>
3040 <p><a name="6.4.2.1p1" href="#6.4.2.1p1"><small>1</small></a>
3041 <pre>
3042 identifier:
3043 identifier-nondigit
3044 identifier identifier-nondigit
3045 identifier digit
3046 identifier-nondigit:
3047 nondigit
3048 universal-character-name
3049 other implementation-defined characters
3050 nondigit: one of
3051 _ a b c d e f g h i j k l m
3052 n o p q r s t u v w x y z
3053 A B C D E F G H I J K L M
3054 N O P Q R S T U V W X Y Z
3055 digit: one of
3056 0 1 2 3 4 5 6 7 8 9
3057 </pre>
3058 <p><b>Semantics</b>
3059 <p><a name="6.4.2.1p2" href="#6.4.2.1p2"><small>2</small></a>
3060 An identifier is a sequence of nondigit characters (including the underscore _, the
3061 lowercase and uppercase Latin letters, and other characters) and digits, which designates
3062 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
3063 There is no specific limit on the maximum length of an identifier.
3064 <p><a name="6.4.2.1p3" href="#6.4.2.1p3"><small>3</small></a>
3065 Each universal character name in an identifier shall designate a character whose encoding
3066 in ISO/IEC 10646 falls into one of the ranges specified in <a href="#D">annex D</a>.<sup><a href="#note60"><b>60)</b></a></sup> The initial
3067 character shall not be a universal character name designating a digit. An implementation
3068 may allow multibyte characters that are not part of the basic source character set to
3069 appear in identifiers; which characters and their correspondence to universal character
3070 names is implementation-defined.
3071 <p><a name="6.4.2.1p4" href="#6.4.2.1p4"><small>4</small></a>
3072 When preprocessing tokens are converted to tokens during translation phase 7, if a
3073 preprocessing token could be converted to either a keyword or an identifier, it is converted
3074 to a keyword.
3077 <!--page 64 -->
3078 <p><b>Implementation limits</b>
3079 <p><a name="6.4.2.1p5" href="#6.4.2.1p5"><small>5</small></a>
3080 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
3081 characters in an identifier; the limit for an external name (an identifier that has external
3082 linkage) may be more restrictive than that for an internal name (a macro name or an
3083 identifier that does not have external linkage). The number of significant characters in an
3084 identifier is implementation-defined.
3085 <p><a name="6.4.2.1p6" href="#6.4.2.1p6"><small>6</small></a>
3086 Any identifiers that differ in a significant character are different identifiers. If two
3087 identifiers differ only in nonsignificant characters, the behavior is undefined.
3088 <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>).
3090 <p><b>Footnotes</b>
3091 <p><small><a name="note60" href="#note60">60)</a> On systems in which linkers cannot accept extended characters, an encoding of the universal character
3092 name may be used in forming valid external identifiers. For example, some otherwise unused
3093 character or sequence of characters may be used to encode the \u in a universal character name.
3094 Extended characters may produce a long external identifier.
3095 </small>
3097 <p><small><a href="#Contents">Contents</a></small>
3098 <h5><a name="6.4.2.2" href="#6.4.2.2">6.4.2.2 Predefined identifiers</a></h5>
3099 <p><b>Semantics</b>
3100 <p><a name="6.4.2.2p1" href="#6.4.2.2p1"><small>1</small></a>
3101 The identifier __func__ shall be implicitly declared by the translator as if,
3102 immediately following the opening brace of each function definition, the declaration
3103 <pre>
3104 static const char __func__[] = "function-name";
3105 </pre>
3106 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note61"><b>61)</b></a></sup>
3107 <p><a name="6.4.2.2p2" href="#6.4.2.2p2"><small>2</small></a>
3108 This name is encoded as if the implicit declaration had been written in the source
3109 character set and then translated into the execution character set as indicated in translation
3110 phase 5.
3111 <p><a name="6.4.2.2p3" href="#6.4.2.2p3"><small>3</small></a>
3112 EXAMPLE Consider the code fragment:
3113 <pre>
3114 #include <a href="#7.19">&lt;stdio.h&gt;</a>
3115 void myfunc(void)
3117 printf("%s\n", __func__);
3118 /* ... */
3120 </pre>
3121 Each time the function is called, it will print to the standard output stream:
3122 <pre>
3123 myfunc
3124 </pre>
3126 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
3131 <!--page 65 -->
3133 <p><b>Footnotes</b>
3134 <p><small><a name="note61" href="#note61">61)</a> Since the name __func__ is reserved for any use by the implementation (<a href="#7.1.3">7.1.3</a>), if any other
3135 identifier is explicitly declared using the name __func__, the behavior is undefined.
3136 </small>
3138 <p><small><a href="#Contents">Contents</a></small>
3139 <h4><a name="6.4.3" href="#6.4.3">6.4.3 Universal character names</a></h4>
3140 <p><b>Syntax</b>
3141 <p><a name="6.4.3p1" href="#6.4.3p1"><small>1</small></a>
3142 <pre>
3143 universal-character-name:
3144 \u hex-quad
3145 \U hex-quad hex-quad
3146 hex-quad:
3147 hexadecimal-digit hexadecimal-digit
3148 hexadecimal-digit hexadecimal-digit
3149 </pre>
3150 <p><b>Constraints</b>
3151 <p><a name="6.4.3p2" href="#6.4.3p2"><small>2</small></a>
3152 A universal character name shall not specify a character whose short identifier is less than
3153 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
3154 DFFF inclusive.<sup><a href="#note62"><b>62)</b></a></sup>
3155 <p><b>Description</b>
3156 <p><a name="6.4.3p3" href="#6.4.3p3"><small>3</small></a>
3157 Universal character names may be used in identifiers, character constants, and string
3158 literals to designate characters that are not in the basic character set.
3159 <p><b>Semantics</b>
3160 <p><a name="6.4.3p4" href="#6.4.3p4"><small>4</small></a>
3161 The universal character name \Unnnnnnnn designates the character whose eight-digit
3162 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note63"><b>63)</b></a></sup> Similarly, the universal
3163 character name \unnnn designates the character whose four-digit short identifier is nnnn
3164 (and whose eight-digit short identifier is 0000nnnn).
3169 <!--page 66 -->
3171 <p><b>Footnotes</b>
3172 <p><small><a name="note62" href="#note62">62)</a> The disallowed characters are the characters in the basic character set and the code positions reserved
3173 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
3174 UTF-16).
3175 </small>
3176 <p><small><a name="note63" href="#note63">63)</a> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
3177 </small>
3179 <p><small><a href="#Contents">Contents</a></small>
3180 <h4><a name="6.4.4" href="#6.4.4">6.4.4 Constants</a></h4>
3181 <p><b>Syntax</b>
3182 <p><a name="6.4.4p1" href="#6.4.4p1"><small>1</small></a>
3183 <pre>
3184 constant:
3185 integer-constant
3186 floating-constant
3187 enumeration-constant
3188 character-constant
3189 </pre>
3190 <p><b>Constraints</b>
3191 <p><a name="6.4.4p2" href="#6.4.4p2"><small>2</small></a>
3192 Each constant shall have a type and the value of a constant shall be in the range of
3193 representable values for its type.
3194 <p><b>Semantics</b>
3195 <p><a name="6.4.4p3" href="#6.4.4p3"><small>3</small></a>
3196 Each constant has a type, determined by its form and value, as detailed later.
3198 <p><small><a href="#Contents">Contents</a></small>
3199 <h5><a name="6.4.4.1" href="#6.4.4.1">6.4.4.1 Integer constants</a></h5>
3200 <p><b>Syntax</b>
3201 <p><a name="6.4.4.1p1" href="#6.4.4.1p1"><small>1</small></a>
3202 <!--page 67 -->
3203 <pre>
3204 integer-constant:
3205 decimal-constant integer-suffix<sub>opt</sub>
3206 octal-constant integer-suffix<sub>opt</sub>
3207 hexadecimal-constant integer-suffix<sub>opt</sub>
3208 decimal-constant:
3209 nonzero-digit
3210 decimal-constant digit
3211 octal-constant:
3213 octal-constant octal-digit
3214 hexadecimal-constant:
3215 hexadecimal-prefix hexadecimal-digit
3216 hexadecimal-constant hexadecimal-digit
3217 hexadecimal-prefix: one of
3218 0x 0X
3219 nonzero-digit: one of
3220 1 2 3 4 5 6 7 8 9
3221 octal-digit: one of
3222 0 1 2 3 4 5 6 7
3223 hexadecimal-digit: one of
3224 0 1 2 3 4 5 6 7 8 9
3225 a b c d e f
3226 A B C D E F
3227 integer-suffix:
3228 unsigned-suffix long-suffix<sub>opt</sub>
3229 unsigned-suffix long-long-suffix
3230 long-suffix unsigned-suffix<sub>opt</sub>
3231 long-long-suffix unsigned-suffix<sub>opt</sub>
3232 unsigned-suffix: one of
3234 long-suffix: one of
3236 long-long-suffix: one of
3237 ll LL
3238 </pre>
3239 <p><b>Description</b>
3240 <p><a name="6.4.4.1p2" href="#6.4.4.1p2"><small>2</small></a>
3241 An integer constant begins with a digit, but has no period or exponent part. It may have a
3242 prefix that specifies its base and a suffix that specifies its type.
3243 <p><a name="6.4.4.1p3" href="#6.4.4.1p3"><small>3</small></a>
3244 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
3245 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
3246 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
3247 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
3248 10 through 15 respectively.
3249 <p><b>Semantics</b>
3250 <p><a name="6.4.4.1p4" href="#6.4.4.1p4"><small>4</small></a>
3251 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
3252 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
3253 <p><a name="6.4.4.1p5" href="#6.4.4.1p5"><small>5</small></a>
3254 The type of an integer constant is the first of the corresponding list in which its value can
3255 be represented.
3256 <!--page 68 -->
3257 <table border=1>
3258 <tr><th> Suffix <th>Decimal Constant <th>Octal or Hexadecimal Constant
3259 <tr><td> none
3260 <td><pre>
3262 long int
3263 long long int
3264 </pre>
3265 <td><pre>
3267 unsigned int
3268 long int
3269 unsigned long int
3270 long long int
3271 unsigned long long int
3272 </pre>
3273 <tr><td> u or U
3274 <td><pre>
3275 unsigned int
3276 unsigned long int
3277 unsigned long long int
3278 </pre>
3279 <td><pre>
3280 unsigned int
3281 unsigned long int
3282 unsigned long long int
3283 </pre>
3284 <tr><td> l or L
3285 <td><pre>
3286 long int
3287 long long int
3288 </pre>
3289 <td><pre>
3290 long int
3291 unsigned long int
3292 long long int
3293 unsigned long long int
3294 </pre>
3295 <tr><td> Both u or U and l or L
3296 <td><pre>
3297 unsigned long int
3298 unsigned long long int
3299 </pre>
3300 <td><pre>
3301 unsigned long int
3302 unsigned long long int
3303 </pre>
3304 <tr><td> ll or LL
3305 <td><pre>
3306 long long int
3307 </pre>
3308 <td><pre>
3309 long long int
3310 unsigned long long int
3311 </pre>
3312 <tr><td> Both u or U and ll or LL
3313 <td><pre>
3314 unsigned long long int
3315 </pre>
3316 <td><pre>
3317 unsigned long long int
3318 </pre>
3319 </table>
3320 <p><a name="6.4.4.1p6" href="#6.4.4.1p6"><small>6</small></a>
3321 If an integer constant cannot be represented by any type in its list, it may have an
3322 extended integer type, if the extended integer type can represent its value. If all of the
3323 types in the list for the constant are signed, the extended integer type shall be signed. If
3324 all of the types in the list for the constant are unsigned, the extended integer type shall be
3325 unsigned. If the list contains both signed and unsigned types, the extended integer type
3326 may be signed or unsigned. If an integer constant cannot be represented by any type in
3327 its list and has no extended integer type, then the integer constant has no type.
3328 <!--page 69 -->
3330 <p><small><a href="#Contents">Contents</a></small>
3331 <h5><a name="6.4.4.2" href="#6.4.4.2">6.4.4.2 Floating constants</a></h5>
3332 <p><b>Syntax</b>
3333 <p><a name="6.4.4.2p1" href="#6.4.4.2p1"><small>1</small></a>
3334 <!--page 70 -->
3335 <pre>
3336 floating-constant:
3337 decimal-floating-constant
3338 hexadecimal-floating-constant
3339 decimal-floating-constant:
3340 fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
3341 digit-sequence exponent-part floating-suffix<sub>opt</sub>
3342 hexadecimal-floating-constant:
3343 hexadecimal-prefix hexadecimal-fractional-constant
3344 binary-exponent-part floating-suffix<sub>opt</sub>
3345 hexadecimal-prefix hexadecimal-digit-sequence
3346 binary-exponent-part floating-suffix<sub>opt</sub>
3347 fractional-constant:
3348 digit-sequence<sub>opt</sub> . digit-sequence
3349 digit-sequence .
3350 exponent-part:
3351 e sign<sub>opt</sub> digit-sequence
3352 E sign<sub>opt</sub> digit-sequence
3353 sign: one of
3355 digit-sequence:
3356 digit
3357 digit-sequence digit
3358 hexadecimal-fractional-constant:
3359 hexadecimal-digit-sequence<sub>opt</sub> .
3360 hexadecimal-digit-sequence
3361 hexadecimal-digit-sequence .
3362 binary-exponent-part:
3363 p sign<sub>opt</sub> digit-sequence
3364 P sign<sub>opt</sub> digit-sequence
3365 hexadecimal-digit-sequence:
3366 hexadecimal-digit
3367 hexadecimal-digit-sequence hexadecimal-digit
3368 floating-suffix: one of
3369 f l F L
3370 </pre>
3371 <p><b>Description</b>
3372 <p><a name="6.4.4.2p2" href="#6.4.4.2p2"><small>2</small></a>
3373 A floating constant has a significand part that may be followed by an exponent part and a
3374 suffix that specifies its type. The components of the significand part may include a digit
3375 sequence representing the whole-number part, followed by a period (.), followed by a
3376 digit sequence representing the fraction part. The components of the exponent part are an
3377 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
3378 Either the whole-number part or the fraction part has to be present; for decimal floating
3379 constants, either the period or the exponent part has to be present.
3380 <p><b>Semantics</b>
3381 <p><a name="6.4.4.2p3" href="#6.4.4.2p3"><small>3</small></a>
3382 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
3383 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
3384 floating constants, the exponent indicates the power of 10 by which the significand part is
3385 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
3386 by which the significand part is to be scaled. For decimal floating constants, and also for
3387 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
3388 the nearest representable value, or the larger or smaller representable value immediately
3389 adjacent to the nearest representable value, chosen in an implementation-defined manner.
3390 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
3391 correctly rounded.
3392 <p><a name="6.4.4.2p4" href="#6.4.4.2p4"><small>4</small></a>
3393 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
3394 type float. If suffixed by the letter l or L, it has type long double.
3395 <p><a name="6.4.4.2p5" href="#6.4.4.2p5"><small>5</small></a>
3396 Floating constants are converted to internal format as if at translation-time. The
3397 conversion of a floating constant shall not raise an exceptional condition or a floating-
3398 point exception at execution time.
3399 <p><b>Recommended practice</b>
3400 <p><a name="6.4.4.2p6" href="#6.4.4.2p6"><small>6</small></a>
3401 The implementation should produce a diagnostic message if a hexadecimal constant
3402 cannot be represented exactly in its evaluation format; the implementation should then
3403 proceed with the translation of the program.
3404 <p><a name="6.4.4.2p7" href="#6.4.4.2p7"><small>7</small></a>
3405 The translation-time conversion of floating constants should match the execution-time
3406 conversion of character strings by library functions, such as strtod, given matching
3407 inputs suitable for both conversions, the same result format, and default execution-time
3408 rounding.<sup><a href="#note64"><b>64)</b></a></sup>
3413 <!--page 71 -->
3415 <p><b>Footnotes</b>
3416 <p><small><a name="note64" href="#note64">64)</a> The specification for the library functions recommends more accurate conversion than required for
3417 floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
3418 </small>
3420 <p><small><a href="#Contents">Contents</a></small>
3421 <h5><a name="6.4.4.3" href="#6.4.4.3">6.4.4.3 Enumeration constants</a></h5>
3422 <p><b>Syntax</b>
3423 <p><a name="6.4.4.3p1" href="#6.4.4.3p1"><small>1</small></a>
3424 <pre>
3425 enumeration-constant:
3426 identifier
3427 </pre>
3428 <p><b>Semantics</b>
3429 <p><a name="6.4.4.3p2" href="#6.4.4.3p2"><small>2</small></a>
3430 An identifier declared as an enumeration constant has type int.
3431 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
3433 <p><small><a href="#Contents">Contents</a></small>
3434 <h5><a name="6.4.4.4" href="#6.4.4.4">6.4.4.4 Character constants</a></h5>
3435 <p><b>Syntax</b>
3436 <p><a name="6.4.4.4p1" href="#6.4.4.4p1"><small>1</small></a>
3437 <!--page 72 -->
3438 <pre>
3439 character-constant:
3440 ' c-char-sequence '
3441 L' c-char-sequence '
3442 c-char-sequence:
3443 c-char
3444 c-char-sequence c-char
3445 c-char:
3446 any member of the source character set except
3447 the single-quote ', backslash \, or new-line character
3448 escape-sequence
3449 escape-sequence:
3450 simple-escape-sequence
3451 octal-escape-sequence
3452 hexadecimal-escape-sequence
3453 universal-character-name
3454 simple-escape-sequence: one of
3455 \' \" \? \\
3456 \a \b \f \n \r \t \v
3457 octal-escape-sequence:
3458 \ octal-digit
3459 \ octal-digit octal-digit
3460 \ octal-digit octal-digit octal-digit
3461 hexadecimal-escape-sequence:
3462 \x hexadecimal-digit
3463 hexadecimal-escape-sequence hexadecimal-digit
3464 </pre>
3465 <p><b>Description</b>
3466 <p><a name="6.4.4.4p2" href="#6.4.4.4p2"><small>2</small></a>
3467 An integer character constant is a sequence of one or more multibyte characters enclosed
3468 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
3469 letter L. With a few exceptions detailed later, the elements of the sequence are any
3470 members of the source character set; they are mapped in an implementation-defined
3471 manner to members of the execution character set.
3472 <p><a name="6.4.4.4p3" href="#6.4.4.4p3"><small>3</small></a>
3473 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
3474 arbitrary integer values are representable according to the following table of escape
3475 sequences:
3476 <pre>
3477 single quote ' \'
3478 double quote " \"
3479 question mark ? \?
3480 backslash \ \\
3481 octal character \octal digits
3482 hexadecimal character \x hexadecimal digits
3483 </pre>
3484 <p><a name="6.4.4.4p4" href="#6.4.4.4p4"><small>4</small></a>
3485 The double-quote " and question-mark ? are representable either by themselves or by the
3486 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
3487 shall be represented, respectively, by the escape sequences \' and \\.
3488 <p><a name="6.4.4.4p5" href="#6.4.4.4p5"><small>5</small></a>
3489 The octal digits that follow the backslash in an octal escape sequence are taken to be part
3490 of the construction of a single character for an integer character constant or of a single
3491 wide character for a wide character constant. The numerical value of the octal integer so
3492 formed specifies the value of the desired character or wide character.
3493 <p><a name="6.4.4.4p6" href="#6.4.4.4p6"><small>6</small></a>
3494 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
3495 sequence are taken to be part of the construction of a single character for an integer
3496 character constant or of a single wide character for a wide character constant. The
3497 numerical value of the hexadecimal integer so formed specifies the value of the desired
3498 character or wide character.
3499 <p><a name="6.4.4.4p7" href="#6.4.4.4p7"><small>7</small></a>
3500 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
3501 constitute the escape sequence.
3502 <p><a name="6.4.4.4p8" href="#6.4.4.4p8"><small>8</small></a>
3503 In addition, characters not in the basic character set are representable by universal
3504 character names and certain nongraphic characters are representable by escape sequences
3505 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
3506 and \v.<sup><a href="#note65"><b>65)</b></a></sup>
3511 <!--page 73 -->
3512 <p><b>Constraints</b>
3513 <p><a name="6.4.4.4p9" href="#6.4.4.4p9"><small>9</small></a>
3514 The value of an octal or hexadecimal escape sequence shall be in the range of
3515 representable values for the type unsigned char for an integer character constant, or
3516 the unsigned type corresponding to wchar_t for a wide character constant.
3517 <p><b>Semantics</b>
3518 <p><a name="6.4.4.4p10" href="#6.4.4.4p10"><small>10</small></a>
3519 An integer character constant has type int. The value of an integer character constant
3520 containing a single character that maps to a single-byte execution character is the
3521 numerical value of the representation of the mapped character interpreted as an integer.
3522 The value of an integer character constant containing more than one character (e.g.,
3523 'ab'), or containing a character or escape sequence that does not map to a single-byte
3524 execution character, is implementation-defined. If an integer character constant contains
3525 a single character or escape sequence, its value is the one that results when an object with
3526 type char whose value is that of the single character or escape sequence is converted to
3527 type int.
3528 <p><a name="6.4.4.4p11" href="#6.4.4.4p11"><small>11</small></a>
3529 A wide character constant has type wchar_t, an integer type defined in the
3530 <a href="#7.17">&lt;stddef.h&gt;</a> header. The value of a wide character constant containing a single
3531 multibyte character that maps to a member of the extended execution character set is the
3532 wide character corresponding to that multibyte character, as defined by the mbtowc
3533 function, with an implementation-defined current locale. The value of a wide character
3534 constant containing more than one multibyte character, or containing a multibyte
3535 character or escape sequence not represented in the extended execution character set, is
3536 implementation-defined.
3537 <p><a name="6.4.4.4p12" href="#6.4.4.4p12"><small>12</small></a>
3538 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
3540 <p><a name="6.4.4.4p13" href="#6.4.4.4p13"><small>13</small></a>
3541 EXAMPLE 2 Consider implementations that use two's-complement representation for integers and eight
3542 bits for objects that have type char. In an implementation in which type char has the same range of
3543 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
3544 same range of values as unsigned char, the character constant '\xFF' has the value +255.
3546 <p><a name="6.4.4.4p14" href="#6.4.4.4p14"><small>14</small></a>
3547 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
3548 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
3549 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
3550 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
3551 escape sequence is terminated after three octal digits. (The value of this two-character integer character
3552 constant is implementation-defined.)
3554 <p><a name="6.4.4.4p15" href="#6.4.4.4p15"><small>15</small></a>
3555 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
3556 L'\1234' specifies the implementation-defined value that results from the combination of the values
3557 0123 and '4'.
3559 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbtowc function
3560 (<a href="#7.20.7.2">7.20.7.2</a>).
3561 <!--page 74 -->
3563 <p><b>Footnotes</b>
3564 <p><small><a name="note65" href="#note65">65)</a> The semantics of these characters were discussed in <a href="#5.2.2">5.2.2</a>. If any other character follows a backslash,
3565 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
3566 </small>
3568 <p><small><a href="#Contents">Contents</a></small>
3569 <h4><a name="6.4.5" href="#6.4.5">6.4.5 String literals</a></h4>
3570 <p><b>Syntax</b>
3571 <p><a name="6.4.5p1" href="#6.4.5p1"><small>1</small></a>
3572 <pre>
3573 string-literal:
3574 " s-char-sequence<sub>opt</sub> "
3575 L" s-char-sequence<sub>opt</sub> "
3576 s-char-sequence:
3577 s-char
3578 s-char-sequence s-char
3579 s-char:
3580 any member of the source character set except
3581 the double-quote ", backslash \, or new-line character
3582 escape-sequence
3583 </pre>
3584 <p><b>Description</b>
3585 <p><a name="6.4.5p2" href="#6.4.5p2"><small>2</small></a>
3586 A character string literal is a sequence of zero or more multibyte characters enclosed in
3587 double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
3588 letter L.
3589 <p><a name="6.4.5p3" href="#6.4.5p3"><small>3</small></a>
3590 The same considerations apply to each element of the sequence in a character string
3591 literal or a wide string literal as if it were in an integer character constant or a wide
3592 character constant, except that the single-quote ' is representable either by itself or by the
3593 escape sequence \', but the double-quote " shall be represented by the escape sequence
3595 <p><b>Semantics</b>
3596 <p><a name="6.4.5p4" href="#6.4.5p4"><small>4</small></a>
3597 In translation phase 6, the multibyte character sequences specified by any sequence of
3598 adjacent character and wide string literal tokens are concatenated into a single multibyte
3599 character sequence. If any of the tokens are wide string literal tokens, the resulting
3600 multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a
3601 character string literal.
3602 <p><a name="6.4.5p5" href="#6.4.5p5"><small>5</small></a>
3603 In translation phase 7, a byte or code of value zero is appended to each multibyte
3604 character sequence that results from a string literal or literals.<sup><a href="#note66"><b>66)</b></a></sup> The multibyte character
3605 sequence is then used to initialize an array of static storage duration and length just
3606 sufficient to contain the sequence. For character string literals, the array elements have
3607 type char, and are initialized with the individual bytes of the multibyte character
3608 sequence; for wide string literals, the array elements have type wchar_t, and are
3609 initialized with the sequence of wide characters corresponding to the multibyte character
3611 <!--page 75 -->
3612 sequence, as defined by the mbstowcs function with an implementation-defined current
3613 locale. The value of a string literal containing a multibyte character or escape sequence
3614 not represented in the execution character set is implementation-defined.
3615 <p><a name="6.4.5p6" href="#6.4.5p6"><small>6</small></a>
3616 It is unspecified whether these arrays are distinct provided their elements have the
3617 appropriate values. If the program attempts to modify such an array, the behavior is
3618 undefined.
3619 <p><a name="6.4.5p7" href="#6.4.5p7"><small>7</small></a>
3620 EXAMPLE This pair of adjacent character string literals
3621 <pre>
3622 "\x12" "3"
3623 </pre>
3624 produces a single character string literal containing the two characters whose values are '\x12' and '3',
3625 because escape sequences are converted into single members of the execution character set just prior to
3626 adjacent string literal concatenation.
3628 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbstowcs
3629 function (<a href="#7.20.8.1">7.20.8.1</a>).
3631 <p><b>Footnotes</b>
3632 <p><small><a name="note66" href="#note66">66)</a> A character string literal need not be a string (see <a href="#7.1.1">7.1.1</a>), because a null character may be embedded in
3633 it by a \0 escape sequence.
3634 </small>
3636 <p><small><a href="#Contents">Contents</a></small>
3637 <h4><a name="6.4.6" href="#6.4.6">6.4.6 Punctuators</a></h4>
3638 <p><b>Syntax</b>
3639 <p><a name="6.4.6p1" href="#6.4.6p1"><small>1</small></a>
3640 <pre>
3641 punctuator: one of
3642 [ ] ( ) { } . -&gt;
3643 ++ -- &amp; * + - ~ !
3644 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
3645 ? : ; ...
3646 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
3647 , # ##
3648 &lt;: :&gt; &lt;% %&gt; %: %:%:
3649 </pre>
3650 <p><b>Semantics</b>
3651 <p><a name="6.4.6p2" href="#6.4.6p2"><small>2</small></a>
3652 A punctuator is a symbol that has independent syntactic and semantic significance.
3653 Depending on context, it may specify an operation to be performed (which in turn may
3654 yield a value or a function designator, produce a side effect, or some combination thereof)
3655 in which case it is known as an operator (other forms of operator also exist in some
3656 contexts). An operand is an entity on which an operator acts.
3657 <!--page 76 -->
3658 <p><a name="6.4.6p3" href="#6.4.6p3"><small>3</small></a>
3659 In all aspects of the language, the six tokens<sup><a href="#note67"><b>67)</b></a></sup>
3660 <pre>
3661 &lt;: :&gt; &lt;% %&gt; %: %:%:
3662 </pre>
3663 behave, respectively, the same as the six tokens
3664 <pre>
3665 [ ] { } # ##
3666 </pre>
3667 except for their spelling.<sup><a href="#note68"><b>68)</b></a></sup>
3668 <p><b> Forward references</b>: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
3669 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
3671 <p><b>Footnotes</b>
3672 <p><small><a name="note67" href="#note67">67)</a> These tokens are sometimes called ''digraphs''.
3673 </small>
3674 <p><small><a name="note68" href="#note68">68)</a> Thus [ and &lt;: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
3675 interchanged.
3676 </small>
3678 <p><small><a href="#Contents">Contents</a></small>
3679 <h4><a name="6.4.7" href="#6.4.7">6.4.7 Header names</a></h4>
3680 <p><b>Syntax</b>
3681 <p><a name="6.4.7p1" href="#6.4.7p1"><small>1</small></a>
3682 <pre>
3683 header-name:
3684 &lt; h-char-sequence &gt;
3685 " q-char-sequence "
3686 h-char-sequence:
3687 h-char
3688 h-char-sequence h-char
3689 h-char:
3690 any member of the source character set except
3691 the new-line character and &gt;
3692 q-char-sequence:
3693 q-char
3694 q-char-sequence q-char
3695 q-char:
3696 any member of the source character set except
3697 the new-line character and "
3698 </pre>
3699 <p><b>Semantics</b>
3700 <p><a name="6.4.7p2" href="#6.4.7p2"><small>2</small></a>
3701 The sequences in both forms of header names are mapped in an implementation-defined
3702 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
3703 <p><a name="6.4.7p3" href="#6.4.7p3"><small>3</small></a>
3704 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
3705 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
3710 <!--page 77 -->
3711 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note69"><b>69)</b></a></sup> Header name
3712 preprocessing tokens are recognized only within #include preprocessing directives and
3713 in implementation-defined locations within #pragma directives.<sup><a href="#note70"><b>70)</b></a></sup>
3714 <p><a name="6.4.7p4" href="#6.4.7p4"><small>4</small></a>
3715 EXAMPLE The following sequence of characters:
3716 <pre>
3717 0x3&lt;1/a.h&gt;1e2
3718 #include &lt;1/a.h&gt;
3719 #define const.member@$
3720 </pre>
3721 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
3722 by a { on the left and a } on the right).
3723 <pre>
3724 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
3725 {#}{include} {&lt;1/a.h&gt;}
3726 {#}{define} {const}{.}{member}{@}{$}
3727 </pre>
3729 <p><b> Forward references</b>: source file inclusion (<a href="#6.10.2">6.10.2</a>).
3731 <p><b>Footnotes</b>
3732 <p><small><a name="note69" href="#note69">69)</a> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
3733 </small>
3734 <p><small><a name="note70" href="#note70">70)</a> For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
3735 </small>
3737 <p><small><a href="#Contents">Contents</a></small>
3738 <h4><a name="6.4.8" href="#6.4.8">6.4.8 Preprocessing numbers</a></h4>
3739 <p><b>Syntax</b>
3740 <p><a name="6.4.8p1" href="#6.4.8p1"><small>1</small></a>
3741 <pre>
3742 pp-number:
3743 digit
3744 . digit
3745 pp-number digit
3746 pp-number identifier-nondigit
3747 pp-number e sign
3748 pp-number E sign
3749 pp-number p sign
3750 pp-number P sign
3751 pp-number .
3752 </pre>
3753 <p><b>Description</b>
3754 <p><a name="6.4.8p2" href="#6.4.8p2"><small>2</small></a>
3755 A preprocessing number begins with a digit optionally preceded by a period (.) and may
3756 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
3757 p+, p-, P+, or P-.
3758 <p><a name="6.4.8p3" href="#6.4.8p3"><small>3</small></a>
3759 Preprocessing number tokens lexically include all floating and integer constant tokens.
3760 <p><b>Semantics</b>
3761 <p><a name="6.4.8p4" href="#6.4.8p4"><small>4</small></a>
3762 A preprocessing number does not have type or a value; it acquires both after a successful
3763 conversion (as part of translation phase 7) to a floating constant token or an integer
3764 constant token.
3767 <!--page 78 -->
3769 <p><small><a href="#Contents">Contents</a></small>
3770 <h4><a name="6.4.9" href="#6.4.9">6.4.9 Comments</a></h4>
3771 <p><a name="6.4.9p1" href="#6.4.9p1"><small>1</small></a>
3772 Except within a character constant, a string literal, or a comment, the characters /*
3773 introduce a comment. The contents of such a comment are examined only to identify
3774 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note71"><b>71)</b></a></sup>
3775 <p><a name="6.4.9p2" href="#6.4.9p2"><small>2</small></a>
3776 Except within a character constant, a string literal, or a comment, the characters //
3777 introduce a comment that includes all multibyte characters up to, but not including, the
3778 next new-line character. The contents of such a comment are examined only to identify
3779 multibyte characters and to find the terminating new-line character.
3780 <p><a name="6.4.9p3" href="#6.4.9p3"><small>3</small></a>
3781 EXAMPLE
3782 <pre>
3783 "a//b" // four-character string literal
3784 #include "//e" // undefined behavior
3785 // */ // comment, not syntax error
3786 f = g/**//h; // equivalent to f = g / h;
3788 i(); // part of a two-line comment
3790 / j(); // part of a two-line comment
3791 #define glue(x,y) x##y
3792 glue(/,/) k(); // syntax error, not comment
3793 /*//*/ l(); // equivalent to l();
3794 m = n//**/o
3795 + p; // equivalent to m = n + p;
3796 </pre>
3801 <!--page 79 -->
3803 <p><b>Footnotes</b>
3804 <p><small><a name="note71" href="#note71">71)</a> Thus, /* ... */ comments do not nest.
3805 </small>
3807 <p><small><a href="#Contents">Contents</a></small>
3808 <h3><a name="6.5" href="#6.5">6.5 Expressions</a></h3>
3809 <p><a name="6.5p1" href="#6.5p1"><small>1</small></a>
3810 An expression is a sequence of operators and operands that specifies computation of a
3811 value, or that designates an object or a function, or that generates side effects, or that
3812 performs a combination thereof.
3813 <p><a name="6.5p2" href="#6.5p2"><small>2</small></a>
3814 Between the previous and next sequence point an object shall have its stored value
3815 modified at most once by the evaluation of an expression.<sup><a href="#note72"><b>72)</b></a></sup> Furthermore, the prior value
3816 shall be read only to determine the value to be stored.<sup><a href="#note73"><b>73)</b></a></sup>
3817 <p><a name="6.5p3" href="#6.5p3"><small>3</small></a>
3818 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note74"><b>74)</b></a></sup> Except as specified
3819 later (for the function-call (), &amp;&amp;, ||, ?:, and comma operators), the order of evaluation
3820 of subexpressions and the order in which side effects take place are both unspecified.
3821 <p><a name="6.5p4" href="#6.5p4"><small>4</small></a>
3822 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
3823 collectively described as bitwise operators) are required to have operands that have
3824 integer type. These operators yield values that depend on the internal representations of
3825 integers, and have implementation-defined and undefined aspects for signed types.
3826 <p><a name="6.5p5" href="#6.5p5"><small>5</small></a>
3827 If an exceptional condition occurs during the evaluation of an expression (that is, if the
3828 result is not mathematically defined or not in the range of representable values for its
3829 type), the behavior is undefined.
3830 <p><a name="6.5p6" href="#6.5p6"><small>6</small></a>
3831 The effective type of an object for an access to its stored value is the declared type of the
3832 object, if any.<sup><a href="#note75"><b>75)</b></a></sup> If a value is stored into an object having no declared type through an
3833 lvalue having a type that is not a character type, then the type of the lvalue becomes the
3836 <!--page 80 -->
3837 effective type of the object for that access and for subsequent accesses that do not modify
3838 the stored value. If a value is copied into an object having no declared type using
3839 memcpy or memmove, or is copied as an array of character type, then the effective type
3840 of the modified object for that access and for subsequent accesses that do not modify the
3841 value is the effective type of the object from which the value is copied, if it has one. For
3842 all other accesses to an object having no declared type, the effective type of the object is
3843 simply the type of the lvalue used for the access.
3844 <p><a name="6.5p7" href="#6.5p7"><small>7</small></a>
3845 An object shall have its stored value accessed only by an lvalue expression that has one of
3846 the following types:<sup><a href="#note76"><b>76)</b></a></sup>
3847 <ul>
3848 <li> a type compatible with the effective type of the object,
3849 <li> a qualified version of a type compatible with the effective type of the object,
3850 <li> a type that is the signed or unsigned type corresponding to the effective type of the
3851 object,
3852 <li> a type that is the signed or unsigned type corresponding to a qualified version of the
3853 effective type of the object,
3854 <li> an aggregate or union type that includes one of the aforementioned types among its
3855 members (including, recursively, a member of a subaggregate or contained union), or
3856 <li> a character type.
3857 </ul>
3858 <p><a name="6.5p8" href="#6.5p8"><small>8</small></a>
3859 A floating expression may be contracted, that is, evaluated as though it were an atomic
3860 operation, thereby omitting rounding errors implied by the source code and the
3861 expression evaluation method.<sup><a href="#note77"><b>77)</b></a></sup> The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
3862 way to disallow contracted expressions. Otherwise, whether and how expressions are
3863 contracted is implementation-defined.<sup><a href="#note78"><b>78)</b></a></sup>
3864 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.21.2">7.21.2</a>).
3869 <!--page 81 -->
3871 <p><b>Footnotes</b>
3872 <p><small><a name="note72" href="#note72">72)</a> A floating-point status flag is not an object and can be set more than once within an expression.
3873 </small>
3874 <p><small><a name="note73" href="#note73">73)</a> This paragraph renders undefined statement expressions such as
3876 <pre>
3877 i = ++i + 1;
3878 a[i++] = i;
3879 </pre>
3880 while allowing
3881 <pre>
3882 i = i + 1;
3883 a[i] = i;
3884 </pre>
3886 </small>
3887 <p><small><a name="note74" href="#note74">74)</a> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
3888 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
3889 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
3890 <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
3891 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
3892 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
3893 the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
3895 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3896 indicated in each subclause by the syntax for the expressions discussed therein.
3897 </small>
3898 <p><small><a name="note75" href="#note75">75)</a> Allocated objects have no declared type.
3899 </small>
3900 <p><small><a name="note76" href="#note76">76)</a> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3901 </small>
3902 <p><small><a name="note77" href="#note77">77)</a> A contracted expression might also omit the raising of floating-point exceptions.
3903 </small>
3904 <p><small><a name="note78" href="#note78">78)</a> This license is specifically intended to allow implementations to exploit fast machine instructions that
3905 combine multiple C operators. As contractions potentially undermine predictability, and can even
3906 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3907 documented.
3908 </small>
3910 <p><small><a href="#Contents">Contents</a></small>
3911 <h4><a name="6.5.1" href="#6.5.1">6.5.1 Primary expressions</a></h4>
3912 <p><b>Syntax</b>
3913 <p><a name="6.5.1p1" href="#6.5.1p1"><small>1</small></a>
3914 <pre>
3915 primary-expression:
3916 identifier
3917 constant
3918 string-literal
3919 ( expression )
3920 </pre>
3921 <p><b>Semantics</b>
3922 <p><a name="6.5.1p2" href="#6.5.1p2"><small>2</small></a>
3923 An identifier is a primary expression, provided it has been declared as designating an
3924 object (in which case it is an lvalue) or a function (in which case it is a function
3925 designator).<sup><a href="#note79"><b>79)</b></a></sup>
3926 <p><a name="6.5.1p3" href="#6.5.1p3"><small>3</small></a>
3927 A constant is a primary expression. Its type depends on its form and value, as detailed in
3928 <a href="#6.4.4">6.4.4</a>.
3929 <p><a name="6.5.1p4" href="#6.5.1p4"><small>4</small></a>
3930 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>.
3931 <p><a name="6.5.1p5" href="#6.5.1p5"><small>5</small></a>
3932 A parenthesized expression is a primary expression. Its type and value are identical to
3933 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3934 expression if the unparenthesized expression is, respectively, an lvalue, a function
3935 designator, or a void expression.
3936 <p><b> Forward references</b>: declarations (<a href="#6.7">6.7</a>).
3938 <p><b>Footnotes</b>
3939 <p><small><a name="note79" href="#note79">79)</a> Thus, an undeclared identifier is a violation of the syntax.
3940 </small>
3942 <p><small><a href="#Contents">Contents</a></small>
3943 <h4><a name="6.5.2" href="#6.5.2">6.5.2 Postfix operators</a></h4>
3944 <p><b>Syntax</b>
3945 <p><a name="6.5.2p1" href="#6.5.2p1"><small>1</small></a>
3946 <pre>
3947 postfix-expression:
3948 primary-expression
3949 postfix-expression [ expression ]
3950 postfix-expression ( argument-expression-list<sub>opt</sub> )
3951 postfix-expression . identifier
3952 postfix-expression -&gt; identifier
3953 postfix-expression ++
3954 postfix-expression --
3955 ( type-name ) { initializer-list }
3956 ( type-name ) { initializer-list , }
3957 </pre>
3962 <!--page 82 -->
3963 <pre>
3964 argument-expression-list:
3965 assignment-expression
3966 argument-expression-list , assignment-expression
3967 </pre>
3969 <p><small><a href="#Contents">Contents</a></small>
3970 <h5><a name="6.5.2.1" href="#6.5.2.1">6.5.2.1 Array subscripting</a></h5>
3971 <p><b>Constraints</b>
3972 <p><a name="6.5.2.1p1" href="#6.5.2.1p1"><small>1</small></a>
3973 One of the expressions shall have type ''pointer to object type'', the other expression shall
3974 have integer type, and the result has type ''type''.
3975 <p><b>Semantics</b>
3976 <p><a name="6.5.2.1p2" href="#6.5.2.1p2"><small>2</small></a>
3977 A postfix expression followed by an expression in square brackets [] is a subscripted
3978 designation of an element of an array object. The definition of the subscript operator []
3979 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3980 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3981 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3982 element of E1 (counting from zero).
3983 <p><a name="6.5.2.1p3" href="#6.5.2.1p3"><small>3</small></a>
3984 Successive subscript operators designate an element of a multidimensional array object.
3985 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
3986 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3987 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3988 implicitly as a result of subscripting, the result is the pointed-to (n - 1)-dimensional array,
3989 which itself is converted into a pointer if used as other than an lvalue. It follows from this
3990 that arrays are stored in row-major order (last subscript varies fastest).
3991 <p><a name="6.5.2.1p4" href="#6.5.2.1p4"><small>4</small></a>
3992 EXAMPLE Consider the array object defined by the declaration
3993 <pre>
3994 int x[3][5];
3995 </pre>
3996 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
3997 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3998 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3999 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
4000 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
4001 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
4002 yields an int.
4004 <p><b> Forward references</b>: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
4005 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
4006 <!--page 83 -->
4008 <p><small><a href="#Contents">Contents</a></small>
4009 <h5><a name="6.5.2.2" href="#6.5.2.2">6.5.2.2 Function calls</a></h5>
4010 <p><b>Constraints</b>
4011 <p><a name="6.5.2.2p1" href="#6.5.2.2p1"><small>1</small></a>
4012 The expression that denotes the called function<sup><a href="#note80"><b>80)</b></a></sup> shall have type pointer to function
4013 returning void or returning an object type other than an array type.
4014 <p><a name="6.5.2.2p2" href="#6.5.2.2p2"><small>2</small></a>
4015 If the expression that denotes the called function has a type that includes a prototype, the
4016 number of arguments shall agree with the number of parameters. Each argument shall
4017 have a type such that its value may be assigned to an object with the unqualified version
4018 of the type of its corresponding parameter.
4019 <p><b>Semantics</b>
4020 <p><a name="6.5.2.2p3" href="#6.5.2.2p3"><small>3</small></a>
4021 A postfix expression followed by parentheses () containing a possibly empty, comma-
4022 separated list of expressions is a function call. The postfix expression denotes the called
4023 function. The list of expressions specifies the arguments to the function.
4024 <p><a name="6.5.2.2p4" href="#6.5.2.2p4"><small>4</small></a>
4025 An argument may be an expression of any object type. In preparing for the call to a
4026 function, the arguments are evaluated, and each parameter is assigned the value of the
4027 corresponding argument.<sup><a href="#note81"><b>81)</b></a></sup>
4028 <p><a name="6.5.2.2p5" href="#6.5.2.2p5"><small>5</small></a>
4029 If the expression that denotes the called function has type pointer to function returning an
4030 object type, the function call expression has the same type as that object type, and has the
4031 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. If
4032 an attempt is made to modify the result of a function call or to access it after the next
4033 sequence point, the behavior is undefined.
4034 <p><a name="6.5.2.2p6" href="#6.5.2.2p6"><small>6</small></a>
4035 If the expression that denotes the called function has a type that does not include a
4036 prototype, the integer promotions are performed on each argument, and arguments that
4037 have type float are promoted to double. These are called the default argument
4038 promotions. If the number of arguments does not equal the number of parameters, the
4039 behavior is undefined. If the function is defined with a type that includes a prototype, and
4040 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
4041 promotion are not compatible with the types of the parameters, the behavior is undefined.
4042 If the function is defined with a type that does not include a prototype, and the types of
4043 the arguments after promotion are not compatible with those of the parameters after
4044 promotion, the behavior is undefined, except for the following cases:
4049 <!--page 84 -->
4050 <ul>
4051 <li> one promoted type is a signed integer type, the other promoted type is the
4052 corresponding unsigned integer type, and the value is representable in both types;
4053 <li> both types are pointers to qualified or unqualified versions of a character type or
4054 void.
4055 </ul>
4056 <p><a name="6.5.2.2p7" href="#6.5.2.2p7"><small>7</small></a>
4057 If the expression that denotes the called function has a type that does include a prototype,
4058 the arguments are implicitly converted, as if by assignment, to the types of the
4059 corresponding parameters, taking the type of each parameter to be the unqualified version
4060 of its declared type. The ellipsis notation in a function prototype declarator causes
4061 argument type conversion to stop after the last declared parameter. The default argument
4062 promotions are performed on trailing arguments.
4063 <p><a name="6.5.2.2p8" href="#6.5.2.2p8"><small>8</small></a>
4064 No other conversions are performed implicitly; in particular, the number and types of
4065 arguments are not compared with those of the parameters in a function definition that
4066 does not include a function prototype declarator.
4067 <p><a name="6.5.2.2p9" href="#6.5.2.2p9"><small>9</small></a>
4068 If the function is defined with a type that is not compatible with the type (of the
4069 expression) pointed to by the expression that denotes the called function, the behavior is
4070 undefined.
4071 <p><a name="6.5.2.2p10" href="#6.5.2.2p10"><small>10</small></a>
4072 The order of evaluation of the function designator, the actual arguments, and
4073 subexpressions within the actual arguments is unspecified, but there is a sequence point
4074 before the actual call.
4075 <p><a name="6.5.2.2p11" href="#6.5.2.2p11"><small>11</small></a>
4076 Recursive function calls shall be permitted, both directly and indirectly through any chain
4077 of other functions.
4078 <p><a name="6.5.2.2p12" href="#6.5.2.2p12"><small>12</small></a>
4079 EXAMPLE In the function call
4080 <pre>
4081 (*pf[f1()]) (f2(), f3() + f4())
4082 </pre>
4083 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
4084 the function pointed to by pf[f1()] is called.
4086 <p><b> Forward references</b>: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
4087 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>).
4089 <p><b>Footnotes</b>
4090 <p><small><a name="note80" href="#note80">80)</a> Most often, this is the result of converting an identifier that is a function designator.
4091 </small>
4092 <p><small><a name="note81" href="#note81">81)</a> A function may change the values of its parameters, but these changes cannot affect the values of the
4093 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
4094 change the value of the object pointed to. A parameter declared to have array or function type is
4095 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
4096 </small>
4098 <p><small><a href="#Contents">Contents</a></small>
4099 <h5><a name="6.5.2.3" href="#6.5.2.3">6.5.2.3 Structure and union members</a></h5>
4100 <p><b>Constraints</b>
4101 <p><a name="6.5.2.3p1" href="#6.5.2.3p1"><small>1</small></a>
4102 The first operand of the . operator shall have a qualified or unqualified structure or union
4103 type, and the second operand shall name a member of that type.
4104 <p><a name="6.5.2.3p2" href="#6.5.2.3p2"><small>2</small></a>
4105 The first operand of the -&gt; operator shall have type ''pointer to qualified or unqualified
4106 structure'' or ''pointer to qualified or unqualified union'', and the second operand shall
4107 name a member of the type pointed to.
4108 <!--page 85 -->
4109 <p><b>Semantics</b>
4110 <p><a name="6.5.2.3p3" href="#6.5.2.3p3"><small>3</small></a>
4111 A postfix expression followed by the . operator and an identifier designates a member of
4112 a structure or union object. The value is that of the named member,<sup><a href="#note82"><b>82)</b></a></sup> and is an lvalue if
4113 the first expression is an lvalue. If the first expression has qualified type, the result has
4114 the so-qualified version of the type of the designated member.
4115 <p><a name="6.5.2.3p4" href="#6.5.2.3p4"><small>4</small></a>
4116 A postfix expression followed by the -&gt; operator and an identifier designates a member
4117 of a structure or union object. The value is that of the named member of the object to
4118 which the first expression points, and is an lvalue.<sup><a href="#note83"><b>83)</b></a></sup> If the first expression is a pointer to
4119 a qualified type, the result has the so-qualified version of the type of the designated
4120 member.
4121 <p><a name="6.5.2.3p5" href="#6.5.2.3p5"><small>5</small></a>
4122 One special guarantee is made in order to simplify the use of unions: if a union contains
4123 several structures that share a common initial sequence (see below), and if the union
4124 object currently contains one of these structures, it is permitted to inspect the common
4125 initial part of any of them anywhere that a declaration of the complete type of the union is
4126 visible. Two structures share a common initial sequence if corresponding members have
4127 compatible types (and, for bit-fields, the same widths) for a sequence of one or more
4128 initial members.
4129 <p><a name="6.5.2.3p6" href="#6.5.2.3p6"><small>6</small></a>
4130 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
4131 union, f().x is a valid postfix expression but is not an lvalue.
4133 <p><a name="6.5.2.3p7" href="#6.5.2.3p7"><small>7</small></a>
4134 EXAMPLE 2 In:
4135 <pre>
4136 struct s { int i; const int ci; };
4137 struct s s;
4138 const struct s cs;
4139 volatile struct s vs;
4140 </pre>
4141 the various members have the types:
4142 <pre>
4143 s.i int
4144 s.ci const int
4145 cs.i const int
4146 cs.ci const int
4147 vs.i volatile int
4148 vs.ci volatile const int
4149 </pre>
4154 <!--page 86 -->
4155 <p><a name="6.5.2.3p8" href="#6.5.2.3p8"><small>8</small></a>
4156 EXAMPLE 3 The following is a valid fragment:
4157 <pre>
4158 union {
4159 struct {
4160 int alltypes;
4161 } n;
4162 struct {
4163 int type;
4164 int intnode;
4165 } ni;
4166 struct {
4167 int type;
4168 double doublenode;
4169 } nf;
4170 } u;
4171 u.nf.type = 1;
4172 u.nf.doublenode = <a href="#3.14">3.14</a>;
4173 /* ... */
4174 if (u.n.alltypes == 1)
4175 if (sin(u.nf.doublenode) == 0.0)
4176 /* ... */
4177 </pre>
4178 The following is not a valid fragment (because the union type is not visible within function f):
4179 <pre>
4180 struct t1 { int m; };
4181 struct t2 { int m; };
4182 int f(struct t1 *p1, struct t2 *p2)
4184 if (p1-&gt;m &lt; 0)
4185 p2-&gt;m = -p2-&gt;m;
4186 return p1-&gt;m;
4188 int g()
4190 union {
4191 struct t1 s1;
4192 struct t2 s2;
4193 } u;
4194 /* ... */
4195 return f(&amp;u.s1, &amp;u.s2);
4197 </pre>
4199 <p><b> Forward references</b>: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
4200 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
4201 <!--page 87 -->
4203 <p><b>Footnotes</b>
4204 <p><small><a name="note82" href="#note82">82)</a> If the member used to access the contents of a union object is not the same as the member last used to
4205 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
4206 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
4207 punning"). This might be a trap representation.
4208 </small>
4209 <p><small><a name="note83" href="#note83">83)</a> If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
4210 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
4211 </small>
4213 <p><small><a href="#Contents">Contents</a></small>
4214 <h5><a name="6.5.2.4" href="#6.5.2.4">6.5.2.4 Postfix increment and decrement operators</a></h5>
4215 <p><b>Constraints</b>
4216 <p><a name="6.5.2.4p1" href="#6.5.2.4p1"><small>1</small></a>
4217 The operand of the postfix increment or decrement operator shall have qualified or
4218 unqualified real or pointer type and shall be a modifiable lvalue.
4219 <p><b>Semantics</b>
4220 <p><a name="6.5.2.4p2" href="#6.5.2.4p2"><small>2</small></a>
4221 The result of the postfix ++ operator is the value of the operand. After the result is
4222 obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
4223 type is added to it.) See the discussions of additive operators and compound assignment
4224 for information on constraints, types, and conversions and the effects of operations on
4225 pointers. The side effect of updating the stored value of the operand shall occur between
4226 the previous and the next sequence point.
4227 <p><a name="6.5.2.4p3" href="#6.5.2.4p3"><small>3</small></a>
4228 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
4229 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
4230 it).
4231 <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>).
4233 <p><small><a href="#Contents">Contents</a></small>
4234 <h5><a name="6.5.2.5" href="#6.5.2.5">6.5.2.5 Compound literals</a></h5>
4235 <p><b>Constraints</b>
4236 <p><a name="6.5.2.5p1" href="#6.5.2.5p1"><small>1</small></a>
4237 The type name shall specify an object type or an array of unknown size, but not a variable
4238 length array type.
4239 <p><a name="6.5.2.5p2" href="#6.5.2.5p2"><small>2</small></a>
4240 No initializer shall attempt to provide a value for an object not contained within the entire
4241 unnamed object specified by the compound literal.
4242 <p><a name="6.5.2.5p3" href="#6.5.2.5p3"><small>3</small></a>
4243 If the compound literal occurs outside the body of a function, the initializer list shall
4244 consist of constant expressions.
4245 <p><b>Semantics</b>
4246 <p><a name="6.5.2.5p4" href="#6.5.2.5p4"><small>4</small></a>
4247 A postfix expression that consists of a parenthesized type name followed by a brace-
4248 enclosed list of initializers is a compound literal. It provides an unnamed object whose
4249 value is given by the initializer list.<sup><a href="#note84"><b>84)</b></a></sup>
4250 <p><a name="6.5.2.5p5" href="#6.5.2.5p5"><small>5</small></a>
4251 If the type name specifies an array of unknown size, the size is determined by the
4252 initializer list as specified in <a href="#6.7.8">6.7.8</a>, and the type of the compound literal is that of the
4253 completed array type. Otherwise (when the type name specifies an object type), the type
4254 of the compound literal is that specified by the type name. In either case, the result is an
4255 lvalue.
4258 <!--page 88 -->
4259 <p><a name="6.5.2.5p6" href="#6.5.2.5p6"><small>6</small></a>
4260 The value of the compound literal is that of an unnamed object initialized by the
4261 initializer list. If the compound literal occurs outside the body of a function, the object
4262 has static storage duration; otherwise, it has automatic storage duration associated with
4263 the enclosing block.
4264 <p><a name="6.5.2.5p7" href="#6.5.2.5p7"><small>7</small></a>
4265 All the semantic rules and constraints for initializer lists in <a href="#6.7.8">6.7.8</a> are applicable to
4266 compound literals.<sup><a href="#note85"><b>85)</b></a></sup>
4267 <p><a name="6.5.2.5p8" href="#6.5.2.5p8"><small>8</small></a>
4268 String literals, and compound literals with const-qualified types, need not designate
4269 distinct objects.<sup><a href="#note86"><b>86)</b></a></sup>
4270 <p><a name="6.5.2.5p9" href="#6.5.2.5p9"><small>9</small></a>
4271 EXAMPLE 1 The file scope definition
4272 <pre>
4273 int *p = (int []){2, 4};
4274 </pre>
4275 initializes p to point to the first element of an array of two ints, the first having the value two and the
4276 second, four. The expressions in this compound literal are required to be constant. The unnamed object
4277 has static storage duration.
4279 <p><a name="6.5.2.5p10" href="#6.5.2.5p10"><small>10</small></a>
4280 EXAMPLE 2 In contrast, in
4281 <pre>
4282 void f(void)
4284 int *p;
4285 /*...*/
4286 p = (int [2]){*p};
4287 /*...*/
4289 </pre>
4290 p is assigned the address of the first element of an array of two ints, the first having the value previously
4291 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
4292 unnamed object has automatic storage duration.
4294 <p><a name="6.5.2.5p11" href="#6.5.2.5p11"><small>11</small></a>
4295 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
4296 created using compound literals can be passed to functions without depending on member order:
4297 <pre>
4298 drawline((struct point){.x=1, .y=1},
4299 (struct point){.x=3, .y=4});
4300 </pre>
4301 Or, if drawline instead expected pointers to struct point:
4302 <pre>
4303 drawline(&amp;(struct point){.x=1, .y=1},
4304 &amp;(struct point){.x=3, .y=4});
4305 </pre>
4307 <p><a name="6.5.2.5p12" href="#6.5.2.5p12"><small>12</small></a>
4308 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
4309 <pre>
4310 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
4311 </pre>
4316 <!--page 89 -->
4317 <p><a name="6.5.2.5p13" href="#6.5.2.5p13"><small>13</small></a>
4318 EXAMPLE 5 The following three expressions have different meanings:
4319 <pre>
4320 "/tmp/fileXXXXXX"
4321 (char []){"/tmp/fileXXXXXX"}
4322 (const char []){"/tmp/fileXXXXXX"}
4323 </pre>
4324 The first always has static storage duration and has type array of char, but need not be modifiable; the last
4325 two have automatic storage duration when they occur within the body of a function, and the first of these
4326 two is modifiable.
4328 <p><a name="6.5.2.5p14" href="#6.5.2.5p14"><small>14</small></a>
4329 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
4330 and can even be shared. For example,
4331 <pre>
4332 (const char []){"abc"} == "abc"
4333 </pre>
4334 might yield 1 if the literals' storage is shared.
4336 <p><a name="6.5.2.5p15" href="#6.5.2.5p15"><small>15</small></a>
4337 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
4338 linked object. For example, there is no way to write a self-referential compound literal that could be used
4339 as the function argument in place of the named object endless_zeros below:
4340 <pre>
4341 struct int_list { int car; struct int_list *cdr; };
4342 struct int_list endless_zeros = {0, &amp;endless_zeros};
4343 eval(endless_zeros);
4344 </pre>
4346 <p><a name="6.5.2.5p16" href="#6.5.2.5p16"><small>16</small></a>
4347 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
4348 <pre>
4349 struct s { int i; };
4350 int f (void)
4352 struct s *p = 0, *q;
4353 int j = 0;
4354 again:
4355 q = p, p = &amp;((struct s){ j++ });
4356 if (j &lt; 2) goto again;
4357 return p == q &amp;&amp; q-&gt;i == 1;
4359 </pre>
4360 The function f() always returns the value 1.
4361 <p><a name="6.5.2.5p17" href="#6.5.2.5p17"><small>17</small></a>
4362 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
4363 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
4364 have an indeterminate value, which would result in undefined behavior.
4366 <p><b> Forward references</b>: type names (<a href="#6.7.6">6.7.6</a>), initialization (<a href="#6.7.8">6.7.8</a>).
4367 <!--page 90 -->
4369 <p><b>Footnotes</b>
4370 <p><small><a name="note84" href="#note84">84)</a> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
4371 or void only, and the result of a cast expression is not an lvalue.
4372 </small>
4373 <p><small><a name="note85" href="#note85">85)</a> For example, subobjects without explicit initializers are initialized to zero.
4374 </small>
4375 <p><small><a name="note86" href="#note86">86)</a> This allows implementations to share storage for string literals and constant compound literals with
4376 the same or overlapping representations.
4377 </small>
4379 <p><small><a href="#Contents">Contents</a></small>
4380 <h4><a name="6.5.3" href="#6.5.3">6.5.3 Unary operators</a></h4>
4381 <p><b>Syntax</b>
4382 <p><a name="6.5.3p1" href="#6.5.3p1"><small>1</small></a>
4383 <pre>
4384 unary-expression:
4385 postfix-expression
4386 ++ unary-expression
4387 -- unary-expression
4388 unary-operator cast-expression
4389 sizeof unary-expression
4390 sizeof ( type-name )
4391 unary-operator: one of
4392 &amp; * + - ~ !
4393 </pre>
4395 <p><small><a href="#Contents">Contents</a></small>
4396 <h5><a name="6.5.3.1" href="#6.5.3.1">6.5.3.1 Prefix increment and decrement operators</a></h5>
4397 <p><b>Constraints</b>
4398 <p><a name="6.5.3.1p1" href="#6.5.3.1p1"><small>1</small></a>
4399 The operand of the prefix increment or decrement operator shall have qualified or
4400 unqualified real or pointer type and shall be a modifiable lvalue.
4401 <p><b>Semantics</b>
4402 <p><a name="6.5.3.1p2" href="#6.5.3.1p2"><small>2</small></a>
4403 The value of the operand of the prefix ++ operator is incremented. The result is the new
4404 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
4405 See the discussions of additive operators and compound assignment for information on
4406 constraints, types, side effects, and conversions and the effects of operations on pointers.
4407 <p><a name="6.5.3.1p3" href="#6.5.3.1p3"><small>3</small></a>
4408 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
4409 operand is decremented.
4410 <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>).
4412 <p><small><a href="#Contents">Contents</a></small>
4413 <h5><a name="6.5.3.2" href="#6.5.3.2">6.5.3.2 Address and indirection operators</a></h5>
4414 <p><b>Constraints</b>
4415 <p><a name="6.5.3.2p1" href="#6.5.3.2p1"><small>1</small></a>
4416 The operand of the unary &amp; operator shall be either a function designator, the result of a
4417 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
4418 not declared with the register storage-class specifier.
4419 <p><a name="6.5.3.2p2" href="#6.5.3.2p2"><small>2</small></a>
4420 The operand of the unary * operator shall have pointer type.
4421 <p><b>Semantics</b>
4422 <p><a name="6.5.3.2p3" href="#6.5.3.2p3"><small>3</small></a>
4423 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
4424 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
4425 neither that operator nor the &amp; operator is evaluated and the result is as if both were
4426 omitted, except that the constraints on the operators still apply and the result is not an
4427 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
4428 <!--page 91 -->
4429 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
4430 were removed and the [] operator were changed to a + operator. Otherwise, the result is
4431 a pointer to the object or function designated by its operand.
4432 <p><a name="6.5.3.2p4" href="#6.5.3.2p4"><small>4</small></a>
4433 The unary * operator denotes indirection. If the operand points to a function, the result is
4434 a function designator; if it points to an object, the result is an lvalue designating the
4435 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
4436 invalid value has been assigned to the pointer, the behavior of the unary * operator is
4437 undefined.<sup><a href="#note87"><b>87)</b></a></sup>
4438 <p><b> Forward references</b>: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
4439 (<a href="#6.7.2.1">6.7.2.1</a>).
4441 <p><b>Footnotes</b>
4442 <p><small><a name="note87" href="#note87">87)</a> Thus, &amp;*E is equivalent to E (even if E is a null pointer), and &amp;(E1[E2]) to ((E1)+(E2)). It is
4443 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
4444 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
4445 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
4446 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
4447 address inappropriately aligned for the type of object pointed to, and the address of an object after the
4448 end of its lifetime.
4449 </small>
4451 <p><small><a href="#Contents">Contents</a></small>
4452 <h5><a name="6.5.3.3" href="#6.5.3.3">6.5.3.3 Unary arithmetic operators</a></h5>
4453 <p><b>Constraints</b>
4454 <p><a name="6.5.3.3p1" href="#6.5.3.3p1"><small>1</small></a>
4455 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
4456 integer type; of the ! operator, scalar type.
4457 <p><b>Semantics</b>
4458 <p><a name="6.5.3.3p2" href="#6.5.3.3p2"><small>2</small></a>
4459 The result of the unary + operator is the value of its (promoted) operand. The integer
4460 promotions are performed on the operand, and the result has the promoted type.
4461 <p><a name="6.5.3.3p3" href="#6.5.3.3p3"><small>3</small></a>
4462 The result of the unary - operator is the negative of its (promoted) operand. The integer
4463 promotions are performed on the operand, and the result has the promoted type.
4464 <p><a name="6.5.3.3p4" href="#6.5.3.3p4"><small>4</small></a>
4465 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
4466 each bit in the result is set if and only if the corresponding bit in the converted operand is
4467 not set). The integer promotions are performed on the operand, and the result has the
4468 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
4469 to the maximum value representable in that type minus E.
4470 <p><a name="6.5.3.3p5" href="#6.5.3.3p5"><small>5</small></a>
4471 The result of the logical negation operator ! is 0 if the value of its operand compares
4472 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
4473 The expression !E is equivalent to (0==E).
4478 <!--page 92 -->
4480 <p><small><a href="#Contents">Contents</a></small>
4481 <h5><a name="6.5.3.4" href="#6.5.3.4">6.5.3.4 The sizeof operator</a></h5>
4482 <p><b>Constraints</b>
4483 <p><a name="6.5.3.4p1" href="#6.5.3.4p1"><small>1</small></a>
4484 The sizeof operator shall not be applied to an expression that has function type or an
4485 incomplete type, to the parenthesized name of such a type, or to an expression that
4486 designates a bit-field member.
4487 <p><b>Semantics</b>
4488 <p><a name="6.5.3.4p2" href="#6.5.3.4p2"><small>2</small></a>
4489 The sizeof operator yields the size (in bytes) of its operand, which may be an
4490 expression or the parenthesized name of a type. The size is determined from the type of
4491 the operand. The result is an integer. If the type of the operand is a variable length array
4492 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
4493 integer constant.
4494 <p><a name="6.5.3.4p3" href="#6.5.3.4p3"><small>3</small></a>
4495 When applied to an operand that has type char, unsigned char, or signed char,
4496 (or a qualified version thereof) the result is 1. When applied to an operand that has array
4497 type, the result is the total number of bytes in the array.<sup><a href="#note88"><b>88)</b></a></sup> When applied to an operand
4498 that has structure or union type, the result is the total number of bytes in such an object,
4499 including internal and trailing padding.
4500 <p><a name="6.5.3.4p4" href="#6.5.3.4p4"><small>4</small></a>
4501 The value of the result is implementation-defined, and its type (an unsigned integer type)
4502 is size_t, defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers).
4503 <p><a name="6.5.3.4p5" href="#6.5.3.4p5"><small>5</small></a>
4504 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
4505 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
4506 allocate and return a pointer to void. For example:
4507 <pre>
4508 extern void *alloc(size_t);
4509 double *dp = alloc(sizeof *dp);
4510 </pre>
4511 The implementation of the alloc function should ensure that its return value is aligned suitably for
4512 conversion to a pointer to double.
4514 <p><a name="6.5.3.4p6" href="#6.5.3.4p6"><small>6</small></a>
4515 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
4516 <pre>
4517 sizeof array / sizeof array[0]
4518 </pre>
4520 <p><a name="6.5.3.4p7" href="#6.5.3.4p7"><small>7</small></a>
4521 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
4522 function:
4523 <pre>
4524 #include <a href="#7.17">&lt;stddef.h&gt;</a>
4525 size_t fsize3(int n)
4527 char b[n+3]; // variable length array
4528 return sizeof b; // execution time sizeof
4530 </pre>
4534 <!--page 93 -->
4535 <pre>
4536 int main()
4538 size_t size;
4539 size = fsize3(10); // fsize3 returns 13
4540 return 0;
4542 </pre>
4544 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), declarations (<a href="#6.7">6.7</a>),
4545 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), type names (<a href="#6.7.6">6.7.6</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
4547 <p><b>Footnotes</b>
4548 <p><small><a name="note88" href="#note88">88)</a> When applied to a parameter declared to have array or function type, the sizeof operator yields the
4549 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
4550 </small>
4552 <p><small><a href="#Contents">Contents</a></small>
4553 <h4><a name="6.5.4" href="#6.5.4">6.5.4 Cast operators</a></h4>
4554 <p><b>Syntax</b>
4555 <p><a name="6.5.4p1" href="#6.5.4p1"><small>1</small></a>
4556 <pre>
4557 cast-expression:
4558 unary-expression
4559 ( type-name ) cast-expression
4560 </pre>
4561 <p><b>Constraints</b>
4562 <p><a name="6.5.4p2" href="#6.5.4p2"><small>2</small></a>
4563 Unless the type name specifies a void type, the type name shall specify qualified or
4564 unqualified scalar type and the operand shall have scalar type.
4565 <p><a name="6.5.4p3" href="#6.5.4p3"><small>3</small></a>
4566 Conversions that involve pointers, other than where permitted by the constraints of
4567 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
4568 <p><b>Semantics</b>
4569 <p><a name="6.5.4p4" href="#6.5.4p4"><small>4</small></a>
4570 Preceding an expression by a parenthesized type name converts the value of the
4571 expression to the named type. This construction is called a cast.<sup><a href="#note89"><b>89)</b></a></sup> A cast that specifies
4572 no conversion has no effect on the type or value of an expression.
4573 <p><a name="6.5.4p5" href="#6.5.4p5"><small>5</small></a>
4574 If the value of the expression is represented with greater precision or range than required
4575 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
4576 type of the expression is the same as the named type.
4577 <p><b> Forward references</b>: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
4578 prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
4583 <!--page 94 -->
4585 <p><b>Footnotes</b>
4586 <p><small><a name="note89" href="#note89">89)</a> A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
4587 unqualified version of the type.
4588 </small>
4590 <p><small><a href="#Contents">Contents</a></small>
4591 <h4><a name="6.5.5" href="#6.5.5">6.5.5 Multiplicative operators</a></h4>
4592 <p><b>Syntax</b>
4593 <p><a name="6.5.5p1" href="#6.5.5p1"><small>1</small></a>
4594 <pre>
4595 multiplicative-expression:
4596 cast-expression
4597 multiplicative-expression * cast-expression
4598 multiplicative-expression / cast-expression
4599 multiplicative-expression % cast-expression
4600 </pre>
4601 <p><b>Constraints</b>
4602 <p><a name="6.5.5p2" href="#6.5.5p2"><small>2</small></a>
4603 Each of the operands shall have arithmetic type. The operands of the % operator shall
4604 have integer type.
4605 <p><b>Semantics</b>
4606 <p><a name="6.5.5p3" href="#6.5.5p3"><small>3</small></a>
4607 The usual arithmetic conversions are performed on the operands.
4608 <p><a name="6.5.5p4" href="#6.5.5p4"><small>4</small></a>
4609 The result of the binary * operator is the product of the operands.
4610 <p><a name="6.5.5p5" href="#6.5.5p5"><small>5</small></a>
4611 The result of the / operator is the quotient from the division of the first operand by the
4612 second; the result of the % operator is the remainder. In both operations, if the value of
4613 the second operand is zero, the behavior is undefined.
4614 <p><a name="6.5.5p6" href="#6.5.5p6"><small>6</small></a>
4615 When integers are divided, the result of the / operator is the algebraic quotient with any
4616 fractional part discarded.<sup><a href="#note90"><b>90)</b></a></sup> If the quotient a/b is representable, the expression
4617 (a/b)*b + a%b shall equal a.
4619 <p><b>Footnotes</b>
4620 <p><small><a name="note90" href="#note90">90)</a> This is often called ''truncation toward zero''.
4621 </small>
4623 <p><small><a href="#Contents">Contents</a></small>
4624 <h4><a name="6.5.6" href="#6.5.6">6.5.6 Additive operators</a></h4>
4625 <p><b>Syntax</b>
4626 <p><a name="6.5.6p1" href="#6.5.6p1"><small>1</small></a>
4627 <pre>
4628 additive-expression:
4629 multiplicative-expression
4630 additive-expression + multiplicative-expression
4631 additive-expression - multiplicative-expression
4632 </pre>
4633 <p><b>Constraints</b>
4634 <p><a name="6.5.6p2" href="#6.5.6p2"><small>2</small></a>
4635 For addition, either both operands shall have arithmetic type, or one operand shall be a
4636 pointer to an object type and the other shall have integer type. (Incrementing is
4637 equivalent to adding 1.)
4638 <p><a name="6.5.6p3" href="#6.5.6p3"><small>3</small></a>
4639 For subtraction, one of the following shall hold:
4640 <ul>
4641 <li> both operands have arithmetic type;
4645 <!--page 95 -->
4646 <li> both operands are pointers to qualified or unqualified versions of compatible object
4647 types; or
4648 <li> the left operand is a pointer to an object type and the right operand has integer type.
4649 </ul>
4650 (Decrementing is equivalent to subtracting 1.)
4651 <p><b>Semantics</b>
4652 <p><a name="6.5.6p4" href="#6.5.6p4"><small>4</small></a>
4653 If both operands have arithmetic type, the usual arithmetic conversions are performed on
4654 them.
4655 <p><a name="6.5.6p5" href="#6.5.6p5"><small>5</small></a>
4656 The result of the binary + operator is the sum of the operands.
4657 <p><a name="6.5.6p6" href="#6.5.6p6"><small>6</small></a>
4658 The result of the binary - operator is the difference resulting from the subtraction of the
4659 second operand from the first.
4660 <p><a name="6.5.6p7" href="#6.5.6p7"><small>7</small></a>
4661 For the purposes of these operators, a pointer to an object that is not an element of an
4662 array behaves the same as a pointer to the first element of an array of length one with the
4663 type of the object as its element type.
4664 <p><a name="6.5.6p8" href="#6.5.6p8"><small>8</small></a>
4665 When an expression that has integer type is added to or subtracted from a pointer, the
4666 result has the type of the pointer operand. If the pointer operand points to an element of
4667 an array object, and the array is large enough, the result points to an element offset from
4668 the original element such that the difference of the subscripts of the resulting and original
4669 array elements equals the integer expression. In other words, if the expression P points to
4670 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
4671 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
4672 the array object, provided they exist. Moreover, if the expression P points to the last
4673 element of an array object, the expression (P)+1 points one past the last element of the
4674 array object, and if the expression Q points one past the last element of an array object,
4675 the expression (Q)-1 points to the last element of the array object. If both the pointer
4676 operand and the result point to elements of the same array object, or one past the last
4677 element of the array object, the evaluation shall not produce an overflow; otherwise, the
4678 behavior is undefined. If the result points one past the last element of the array object, it
4679 shall not be used as the operand of a unary * operator that is evaluated.
4680 <p><a name="6.5.6p9" href="#6.5.6p9"><small>9</small></a>
4681 When two pointers are subtracted, both shall point to elements of the same array object,
4682 or one past the last element of the array object; the result is the difference of the
4683 subscripts of the two array elements. The size of the result is implementation-defined,
4684 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.17">&lt;stddef.h&gt;</a> header.
4685 If the result is not representable in an object of that type, the behavior is undefined. In
4686 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
4687 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
4688 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
4689 an array object or one past the last element of an array object, and the expression Q points
4690 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
4691 <!--page 96 -->
4692 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
4693 expression P points one past the last element of the array object, even though the
4694 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note91"><b>91)</b></a></sup>
4695 <p><a name="6.5.6p10" href="#6.5.6p10"><small>10</small></a>
4696 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
4697 <pre>
4699 int n = 4, m = 3;
4700 int a[n][m];
4701 int (*p)[m] = a; // p == &amp;a[0]
4702 p += 1; // p == &amp;a[1]
4703 (*p)[2] = 99; // a[1][2] == 99
4704 n = p - a; // n == 1
4706 </pre>
4707 <p><a name="6.5.6p11" href="#6.5.6p11"><small>11</small></a>
4708 If array a in the above example were declared to be an array of known constant size, and pointer p were
4709 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
4710 the same.
4712 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), common definitions <a href="#7.17">&lt;stddef.h&gt;</a>
4713 (<a href="#7.17">7.17</a>).
4715 <p><b>Footnotes</b>
4716 <p><small><a name="note91" href="#note91">91)</a> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
4717 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
4718 by the size of the object originally pointed to, and the resulting pointer is converted back to the
4719 original type. For pointer subtraction, the result of the difference between the character pointers is
4720 similarly divided by the size of the object originally pointed to.
4721 When viewed in this way, an implementation need only provide one extra byte (which may overlap
4722 another object in the program) just after the end of the object in order to satisfy the ''one past the last
4723 element'' requirements.
4724 </small>
4726 <p><small><a href="#Contents">Contents</a></small>
4727 <h4><a name="6.5.7" href="#6.5.7">6.5.7 Bitwise shift operators</a></h4>
4728 <p><b>Syntax</b>
4729 <p><a name="6.5.7p1" href="#6.5.7p1"><small>1</small></a>
4730 <pre>
4731 shift-expression:
4732 additive-expression
4733 shift-expression &lt;&lt; additive-expression
4734 shift-expression &gt;&gt; additive-expression
4735 </pre>
4736 <p><b>Constraints</b>
4737 <p><a name="6.5.7p2" href="#6.5.7p2"><small>2</small></a>
4738 Each of the operands shall have integer type.
4739 <p><b>Semantics</b>
4740 <p><a name="6.5.7p3" href="#6.5.7p3"><small>3</small></a>
4741 The integer promotions are performed on each of the operands. The type of the result is
4742 that of the promoted left operand. If the value of the right operand is negative or is
4743 greater than or equal to the width of the promoted left operand, the behavior is undefined.
4748 <!--page 97 -->
4749 <p><a name="6.5.7p4" href="#6.5.7p4"><small>4</small></a>
4750 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
4751 zeros. If E1 has an unsigned type, the value of the result is E1 x 2<sup>E2</sup> , reduced modulo
4752 one more than the maximum value representable in the result type. If E1 has a signed
4753 type and nonnegative value, and E1 x 2<sup>E2</sup> is representable in the result type, then that is
4754 the resulting value; otherwise, the behavior is undefined.
4755 <p><a name="6.5.7p5" href="#6.5.7p5"><small>5</small></a>
4756 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
4757 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
4758 part of the quotient of E1 / 2<sup>E2</sup> . If E1 has a signed type and a negative value, the
4759 resulting value is implementation-defined.
4761 <p><small><a href="#Contents">Contents</a></small>
4762 <h4><a name="6.5.8" href="#6.5.8">6.5.8 Relational operators</a></h4>
4763 <p><b>Syntax</b>
4764 <p><a name="6.5.8p1" href="#6.5.8p1"><small>1</small></a>
4765 <pre>
4766 relational-expression:
4767 shift-expression
4768 relational-expression &lt; shift-expression
4769 relational-expression &gt; shift-expression
4770 relational-expression &lt;= shift-expression
4771 relational-expression &gt;= shift-expression
4772 </pre>
4773 <p><b>Constraints</b>
4774 <p><a name="6.5.8p2" href="#6.5.8p2"><small>2</small></a>
4775 One of the following shall hold:
4776 <ul>
4777 <li> both operands have real type;
4778 <li> both operands are pointers to qualified or unqualified versions of compatible object
4779 types; or
4780 <li> both operands are pointers to qualified or unqualified versions of compatible
4781 incomplete types.
4782 </ul>
4783 <p><b>Semantics</b>
4784 <p><a name="6.5.8p3" href="#6.5.8p3"><small>3</small></a>
4785 If both of the operands have arithmetic type, the usual arithmetic conversions are
4786 performed.
4787 <p><a name="6.5.8p4" href="#6.5.8p4"><small>4</small></a>
4788 For the purposes of these operators, a pointer to an object that is not an element of an
4789 array behaves the same as a pointer to the first element of an array of length one with the
4790 type of the object as its element type.
4791 <p><a name="6.5.8p5" href="#6.5.8p5"><small>5</small></a>
4792 When two pointers are compared, the result depends on the relative locations in the
4793 address space of the objects pointed to. If two pointers to object or incomplete types both
4794 point to the same object, or both point one past the last element of the same array object,
4795 they compare equal. If the objects pointed to are members of the same aggregate object,
4796 pointers to structure members declared later compare greater than pointers to members
4797 declared earlier in the structure, and pointers to array elements with larger subscript
4798 <!--page 98 -->
4799 values compare greater than pointers to elements of the same array with lower subscript
4800 values. All pointers to members of the same union object compare equal. If the
4801 expression P points to an element of an array object and the expression Q points to the
4802 last element of the same array object, the pointer expression Q+1 compares greater than
4803 P. In all other cases, the behavior is undefined.
4804 <p><a name="6.5.8p6" href="#6.5.8p6"><small>6</small></a>
4805 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
4806 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.<sup><a href="#note92"><b>92)</b></a></sup>
4807 The result has type int.
4809 <p><b>Footnotes</b>
4810 <p><small><a name="note92" href="#note92">92)</a> The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
4811 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
4812 </small>
4814 <p><small><a href="#Contents">Contents</a></small>
4815 <h4><a name="6.5.9" href="#6.5.9">6.5.9 Equality operators</a></h4>
4816 <p><b>Syntax</b>
4817 <p><a name="6.5.9p1" href="#6.5.9p1"><small>1</small></a>
4818 <pre>
4819 equality-expression:
4820 relational-expression
4821 equality-expression == relational-expression
4822 equality-expression != relational-expression
4823 </pre>
4824 <p><b>Constraints</b>
4825 <p><a name="6.5.9p2" href="#6.5.9p2"><small>2</small></a>
4826 One of the following shall hold:
4827 <ul>
4828 <li> both operands have arithmetic type;
4829 <li> both operands are pointers to qualified or unqualified versions of compatible types;
4830 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
4831 qualified or unqualified version of void; or
4832 <li> one operand is a pointer and the other is a null pointer constant.
4833 </ul>
4834 <p><b>Semantics</b>
4835 <p><a name="6.5.9p3" href="#6.5.9p3"><small>3</small></a>
4836 The == (equal to) and != (not equal to) operators are analogous to the relational
4837 operators except for their lower precedence.<sup><a href="#note93"><b>93)</b></a></sup> Each of the operators yields 1 if the
4838 specified relation is true and 0 if it is false. The result has type int. For any pair of
4839 operands, exactly one of the relations is true.
4840 <p><a name="6.5.9p4" href="#6.5.9p4"><small>4</small></a>
4841 If both of the operands have arithmetic type, the usual arithmetic conversions are
4842 performed. Values of complex types are equal if and only if both their real parts are equal
4843 and also their imaginary parts are equal. Any two values of arithmetic types from
4844 different type domains are equal if and only if the results of their conversions to the
4845 (complex) result type determined by the usual arithmetic conversions are equal.
4848 <!--page 99 -->
4849 <p><a name="6.5.9p5" href="#6.5.9p5"><small>5</small></a>
4850 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
4851 null pointer constant, the null pointer constant is converted to the type of the pointer. If
4852 one operand is a pointer to an object or incomplete type and the other is a pointer to a
4853 qualified or unqualified version of void, the former is converted to the type of the latter.
4854 <p><a name="6.5.9p6" href="#6.5.9p6"><small>6</small></a>
4855 Two pointers compare equal if and only if both are null pointers, both are pointers to the
4856 same object (including a pointer to an object and a subobject at its beginning) or function,
4857 both are pointers to one past the last element of the same array object, or one is a pointer
4858 to one past the end of one array object and the other is a pointer to the start of a different
4859 array object that happens to immediately follow the first array object in the address
4860 space.<sup><a href="#note94"><b>94)</b></a></sup>
4861 <p><a name="6.5.9p7" href="#6.5.9p7"><small>7</small></a>
4862 For the purposes of these operators, a pointer to an object that is not an element of an
4863 array behaves the same as a pointer to the first element of an array of length one with the
4864 type of the object as its element type.
4866 <p><b>Footnotes</b>
4867 <p><small><a name="note93" href="#note93">93)</a> Because of the precedences, a&lt;b == c&lt;d is 1 whenever a&lt;b and c&lt;d have the same truth-value.
4868 </small>
4869 <p><small><a name="note94" href="#note94">94)</a> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
4870 adjacent members of a structure with no padding between them, or because the implementation chose
4871 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
4872 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
4873 behavior.
4874 </small>
4876 <p><small><a href="#Contents">Contents</a></small>
4877 <h4><a name="6.5.10" href="#6.5.10">6.5.10 Bitwise AND operator</a></h4>
4878 <p><b>Syntax</b>
4879 <p><a name="6.5.10p1" href="#6.5.10p1"><small>1</small></a>
4880 <pre>
4881 AND-expression:
4882 equality-expression
4883 AND-expression &amp; equality-expression
4884 </pre>
4885 <p><b>Constraints</b>
4886 <p><a name="6.5.10p2" href="#6.5.10p2"><small>2</small></a>
4887 Each of the operands shall have integer type.
4888 <p><b>Semantics</b>
4889 <p><a name="6.5.10p3" href="#6.5.10p3"><small>3</small></a>
4890 The usual arithmetic conversions are performed on the operands.
4891 <p><a name="6.5.10p4" href="#6.5.10p4"><small>4</small></a>
4892 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
4893 the result is set if and only if each of the corresponding bits in the converted operands is
4894 set).
4899 <!--page 100 -->
4901 <p><small><a href="#Contents">Contents</a></small>
4902 <h4><a name="6.5.11" href="#6.5.11">6.5.11 Bitwise exclusive OR operator</a></h4>
4903 <p><b>Syntax</b>
4904 <p><a name="6.5.11p1" href="#6.5.11p1"><small>1</small></a>
4905 <pre>
4906 exclusive-OR-expression:
4907 AND-expression
4908 exclusive-OR-expression ^ AND-expression
4909 </pre>
4910 <p><b>Constraints</b>
4911 <p><a name="6.5.11p2" href="#6.5.11p2"><small>2</small></a>
4912 Each of the operands shall have integer type.
4913 <p><b>Semantics</b>
4914 <p><a name="6.5.11p3" href="#6.5.11p3"><small>3</small></a>
4915 The usual arithmetic conversions are performed on the operands.
4916 <p><a name="6.5.11p4" href="#6.5.11p4"><small>4</small></a>
4917 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
4918 in the result is set if and only if exactly one of the corresponding bits in the converted
4919 operands is set).
4921 <p><small><a href="#Contents">Contents</a></small>
4922 <h4><a name="6.5.12" href="#6.5.12">6.5.12 Bitwise inclusive OR operator</a></h4>
4923 <p><b>Syntax</b>
4924 <p><a name="6.5.12p1" href="#6.5.12p1"><small>1</small></a>
4925 <pre>
4926 inclusive-OR-expression:
4927 exclusive-OR-expression
4928 inclusive-OR-expression | exclusive-OR-expression
4929 </pre>
4930 <p><b>Constraints</b>
4931 <p><a name="6.5.12p2" href="#6.5.12p2"><small>2</small></a>
4932 Each of the operands shall have integer type.
4933 <p><b>Semantics</b>
4934 <p><a name="6.5.12p3" href="#6.5.12p3"><small>3</small></a>
4935 The usual arithmetic conversions are performed on the operands.
4936 <p><a name="6.5.12p4" href="#6.5.12p4"><small>4</small></a>
4937 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
4938 the result is set if and only if at least one of the corresponding bits in the converted
4939 operands is set).
4940 <!--page 101 -->
4942 <p><small><a href="#Contents">Contents</a></small>
4943 <h4><a name="6.5.13" href="#6.5.13">6.5.13 Logical AND operator</a></h4>
4944 <p><b>Syntax</b>
4945 <p><a name="6.5.13p1" href="#6.5.13p1"><small>1</small></a>
4946 <pre>
4947 logical-AND-expression:
4948 inclusive-OR-expression
4949 logical-AND-expression &amp;&amp; inclusive-OR-expression
4950 </pre>
4951 <p><b>Constraints</b>
4952 <p><a name="6.5.13p2" href="#6.5.13p2"><small>2</small></a>
4953 Each of the operands shall have scalar type.
4954 <p><b>Semantics</b>
4955 <p><a name="6.5.13p3" href="#6.5.13p3"><small>3</small></a>
4956 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
4957 yields 0. The result has type int.
4958 <p><a name="6.5.13p4" href="#6.5.13p4"><small>4</small></a>
4959 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
4960 there is a sequence point after the evaluation of the first operand. If the first operand
4961 compares equal to 0, the second operand is not evaluated.
4963 <p><small><a href="#Contents">Contents</a></small>
4964 <h4><a name="6.5.14" href="#6.5.14">6.5.14 Logical OR operator</a></h4>
4965 <p><b>Syntax</b>
4966 <p><a name="6.5.14p1" href="#6.5.14p1"><small>1</small></a>
4967 <pre>
4968 logical-OR-expression:
4969 logical-AND-expression
4970 logical-OR-expression || logical-AND-expression
4971 </pre>
4972 <p><b>Constraints</b>
4973 <p><a name="6.5.14p2" href="#6.5.14p2"><small>2</small></a>
4974 Each of the operands shall have scalar type.
4975 <p><b>Semantics</b>
4976 <p><a name="6.5.14p3" href="#6.5.14p3"><small>3</small></a>
4977 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
4978 yields 0. The result has type int.
4979 <p><a name="6.5.14p4" href="#6.5.14p4"><small>4</small></a>
4980 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
4981 a sequence point after the evaluation of the first operand. If the first operand compares
4982 unequal to 0, the second operand is not evaluated.
4983 <!--page 102 -->
4985 <p><small><a href="#Contents">Contents</a></small>
4986 <h4><a name="6.5.15" href="#6.5.15">6.5.15 Conditional operator</a></h4>
4987 <p><b>Syntax</b>
4988 <p><a name="6.5.15p1" href="#6.5.15p1"><small>1</small></a>
4989 <pre>
4990 conditional-expression:
4991 logical-OR-expression
4992 logical-OR-expression ? expression : conditional-expression
4993 </pre>
4994 <p><b>Constraints</b>
4995 <p><a name="6.5.15p2" href="#6.5.15p2"><small>2</small></a>
4996 The first operand shall have scalar type.
4997 <p><a name="6.5.15p3" href="#6.5.15p3"><small>3</small></a>
4998 One of the following shall hold for the second and third operands:
4999 <ul>
5000 <li> both operands have arithmetic type;
5001 <li> both operands have the same structure or union type;
5002 <li> both operands have void type;
5003 <li> both operands are pointers to qualified or unqualified versions of compatible types;
5004 <li> one operand is a pointer and the other is a null pointer constant; or
5005 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
5006 qualified or unqualified version of void.
5007 </ul>
5008 <p><b>Semantics</b>
5009 <p><a name="6.5.15p4" href="#6.5.15p4"><small>4</small></a>
5010 The first operand is evaluated; there is a sequence point after its evaluation. The second
5011 operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
5012 only if the first compares equal to 0; the result is the value of the second or third operand
5013 (whichever is evaluated), converted to the type described below.<sup><a href="#note95"><b>95)</b></a></sup> If an attempt is made
5014 to modify the result of a conditional operator or to access it after the next sequence point,
5015 the behavior is undefined.
5016 <p><a name="6.5.15p5" href="#6.5.15p5"><small>5</small></a>
5017 If both the second and third operands have arithmetic type, the result type that would be
5018 determined by the usual arithmetic conversions, were they applied to those two operands,
5019 is the type of the result. If both the operands have structure or union type, the result has
5020 that type. If both operands have void type, the result has void type.
5021 <p><a name="6.5.15p6" href="#6.5.15p6"><small>6</small></a>
5022 If both the second and third operands are pointers or one is a null pointer constant and the
5023 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
5024 of the types pointed-to by both operands. Furthermore, if both operands are pointers to
5025 compatible types or to differently qualified versions of compatible types, the result type is
5026 a pointer to an appropriately qualified version of the composite type; if one operand is a
5027 null pointer constant, the result has the type of the other operand; otherwise, one operand
5028 is a pointer to void or a qualified version of void, in which case the result type is a
5030 <!--page 103 -->
5031 pointer to an appropriately qualified version of void.
5032 <p><a name="6.5.15p7" href="#6.5.15p7"><small>7</small></a>
5033 EXAMPLE The common type that results when the second and third operands are pointers is determined
5034 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
5035 pointers have compatible types.
5036 <p><a name="6.5.15p8" href="#6.5.15p8"><small>8</small></a>
5037 Given the declarations
5038 <pre>
5039 const void *c_vp;
5040 void *vp;
5041 const int *c_ip;
5042 volatile int *v_ip;
5043 int *ip;
5044 const char *c_cp;
5045 </pre>
5046 the third column in the following table is the common type that is the result of a conditional expression in
5047 which the first two columns are the second and third operands (in either order):
5048 <pre>
5049 c_vp c_ip const void *
5050 v_ip 0 volatile int *
5051 c_ip v_ip const volatile int *
5052 vp c_cp const void *
5053 ip c_ip const int *
5054 vp ip void *
5055 </pre>
5058 <p><b>Footnotes</b>
5059 <p><small><a name="note95" href="#note95">95)</a> A conditional expression does not yield an lvalue.
5060 </small>
5062 <p><small><a href="#Contents">Contents</a></small>
5063 <h4><a name="6.5.16" href="#6.5.16">6.5.16 Assignment operators</a></h4>
5064 <p><b>Syntax</b>
5065 <p><a name="6.5.16p1" href="#6.5.16p1"><small>1</small></a>
5066 <pre>
5067 assignment-expression:
5068 conditional-expression
5069 unary-expression assignment-operator assignment-expression
5070 assignment-operator: one of
5071 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
5072 </pre>
5073 <p><b>Constraints</b>
5074 <p><a name="6.5.16p2" href="#6.5.16p2"><small>2</small></a>
5075 An assignment operator shall have a modifiable lvalue as its left operand.
5076 <p><b>Semantics</b>
5077 <p><a name="6.5.16p3" href="#6.5.16p3"><small>3</small></a>
5078 An assignment operator stores a value in the object designated by the left operand. An
5079 assignment expression has the value of the left operand after the assignment, but is not an
5080 lvalue. The type of an assignment expression is the type of the left operand unless the
5081 left operand has qualified type, in which case it is the unqualified version of the type of
5082 the left operand. The side effect of updating the stored value of the left operand shall
5083 occur between the previous and the next sequence point.
5084 <p><a name="6.5.16p4" href="#6.5.16p4"><small>4</small></a>
5085 The order of evaluation of the operands is unspecified. If an attempt is made to modify
5086 the result of an assignment operator or to access it after the next sequence point, the
5087 behavior is undefined.
5088 <!--page 104 -->
5090 <p><small><a href="#Contents">Contents</a></small>
5091 <h5><a name="6.5.16.1" href="#6.5.16.1">6.5.16.1 Simple assignment</a></h5>
5092 <p><b>Constraints</b>
5093 <p><a name="6.5.16.1p1" href="#6.5.16.1p1"><small>1</small></a>
5094 One of the following shall hold:<sup><a href="#note96"><b>96)</b></a></sup>
5095 <ul>
5096 <li> the left operand has qualified or unqualified arithmetic type and the right has
5097 arithmetic type;
5098 <li> the left operand has a qualified or unqualified version of a structure or union type
5099 compatible with the type of the right;
5100 <li> both operands are pointers to qualified or unqualified versions of compatible types,
5101 and the type pointed to by the left has all the qualifiers of the type pointed to by the
5102 right;
5103 <li> one operand is a pointer to an object or incomplete type and the other is a pointer to a
5104 qualified or unqualified version of void, and the type pointed to by the left has all
5105 the qualifiers of the type pointed to by the right;
5106 <li> the left operand is a pointer and the right is a null pointer constant; or
5107 <li> the left operand has type _Bool and the right is a pointer.
5108 </ul>
5109 <p><b>Semantics</b>
5110 <p><a name="6.5.16.1p2" href="#6.5.16.1p2"><small>2</small></a>
5111 In simple assignment (=), the value of the right operand is converted to the type of the
5112 assignment expression and replaces the value stored in the object designated by the left
5113 operand.
5114 <p><a name="6.5.16.1p3" href="#6.5.16.1p3"><small>3</small></a>
5115 If the value being stored in an object is read from another object that overlaps in any way
5116 the storage of the first object, then the overlap shall be exact and the two objects shall
5117 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
5118 undefined.
5119 <p><a name="6.5.16.1p4" href="#6.5.16.1p4"><small>4</small></a>
5120 EXAMPLE 1 In the program fragment
5121 <pre>
5122 int f(void);
5123 char c;
5124 /* ... */
5125 if ((c = f()) == -1)
5126 /* ... */
5127 </pre>
5128 the int value returned by the function may be truncated when stored in the char, and then converted back
5129 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
5130 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
5134 <!--page 105 -->
5135 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
5136 variable c should be declared as int.
5138 <p><a name="6.5.16.1p5" href="#6.5.16.1p5"><small>5</small></a>
5139 EXAMPLE 2 In the fragment:
5140 <pre>
5141 char c;
5142 int i;
5143 long l;
5144 l = (c = i);
5145 </pre>
5146 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
5147 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
5148 that is, long int type.
5150 <p><a name="6.5.16.1p6" href="#6.5.16.1p6"><small>6</small></a>
5151 EXAMPLE 3 Consider the fragment:
5152 <pre>
5153 const char **cpp;
5154 char *p;
5155 const char c = 'A';
5156 cpp = &amp;p; // constraint violation
5157 *cpp = &amp;c; // valid
5158 *p = 0; // valid
5159 </pre>
5160 The first assignment is unsafe because it would allow the following valid code to attempt to change the
5161 value of the const object c.
5164 <p><b>Footnotes</b>
5165 <p><small><a name="note96" href="#note96">96)</a> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
5166 (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
5167 qualifiers that were applied to the type category of the expression (for example, it removes const but
5168 not volatile from the type int volatile * const).
5169 </small>
5171 <p><small><a href="#Contents">Contents</a></small>
5172 <h5><a name="6.5.16.2" href="#6.5.16.2">6.5.16.2 Compound assignment</a></h5>
5173 <p><b>Constraints</b>
5174 <p><a name="6.5.16.2p1" href="#6.5.16.2p1"><small>1</small></a>
5175 For the operators += and -= only, either the left operand shall be a pointer to an object
5176 type and the right shall have integer type, or the left operand shall have qualified or
5177 unqualified arithmetic type and the right shall have arithmetic type.
5178 <p><a name="6.5.16.2p2" href="#6.5.16.2p2"><small>2</small></a>
5179 For the other operators, each operand shall have arithmetic type consistent with those
5180 allowed by the corresponding binary operator.
5181 <p><b>Semantics</b>
5182 <p><a name="6.5.16.2p3" href="#6.5.16.2p3"><small>3</small></a>
5183 A compound assignment of the form E1 op = E2 differs from the simple assignment
5184 expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
5185 <!--page 106 -->
5187 <p><small><a href="#Contents">Contents</a></small>
5188 <h4><a name="6.5.17" href="#6.5.17">6.5.17 Comma operator</a></h4>
5189 <p><b>Syntax</b>
5190 <p><a name="6.5.17p1" href="#6.5.17p1"><small>1</small></a>
5191 <pre>
5192 expression:
5193 assignment-expression
5194 expression , assignment-expression
5195 </pre>
5196 <p><b>Semantics</b>
5197 <p><a name="6.5.17p2" href="#6.5.17p2"><small>2</small></a>
5198 The left operand of a comma operator is evaluated as a void expression; there is a
5199 sequence point after its evaluation. Then the right operand is evaluated; the result has its
5200 type and value.<sup><a href="#note97"><b>97)</b></a></sup> If an attempt is made to modify the result of a comma operator or to
5201 access it after the next sequence point, the behavior is undefined.
5202 <p><a name="6.5.17p3" href="#6.5.17p3"><small>3</small></a>
5203 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
5204 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
5205 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
5206 expression of a conditional operator in such contexts. In the function call
5207 <pre>
5208 f(a, (t=3, t+2), c)
5209 </pre>
5210 the function has three arguments, the second of which has the value 5.
5212 <p><b> Forward references</b>: initialization (<a href="#6.7.8">6.7.8</a>).
5217 <!--page 107 -->
5219 <p><b>Footnotes</b>
5220 <p><small><a name="note97" href="#note97">97)</a> A comma operator does not yield an lvalue.
5221 </small>
5223 <p><small><a href="#Contents">Contents</a></small>
5224 <h3><a name="6.6" href="#6.6">6.6 Constant expressions</a></h3>
5225 <p><b>Syntax</b>
5226 <p><a name="6.6p1" href="#6.6p1"><small>1</small></a>
5227 <pre>
5228 constant-expression:
5229 conditional-expression
5230 </pre>
5231 <p><b>Description</b>
5232 <p><a name="6.6p2" href="#6.6p2"><small>2</small></a>
5233 A constant expression can be evaluated during translation rather than runtime, and
5234 accordingly may be used in any place that a constant may be.
5235 <p><b>Constraints</b>
5236 <p><a name="6.6p3" href="#6.6p3"><small>3</small></a>
5237 Constant expressions shall not contain assignment, increment, decrement, function-call,
5238 or comma operators, except when they are contained within a subexpression that is not
5239 evaluated.<sup><a href="#note98"><b>98)</b></a></sup>
5240 <p><a name="6.6p4" href="#6.6p4"><small>4</small></a>
5241 Each constant expression shall evaluate to a constant that is in the range of representable
5242 values for its type.
5243 <p><b>Semantics</b>
5244 <p><a name="6.6p5" href="#6.6p5"><small>5</small></a>
5245 An expression that evaluates to a constant is required in several contexts. If a floating
5246 expression is evaluated in the translation environment, the arithmetic precision and range
5247 shall be at least as great as if the expression were being evaluated in the execution
5248 environment.
5249 <p><a name="6.6p6" href="#6.6p6"><small>6</small></a>
5250 An integer constant expression<sup><a href="#note99"><b>99)</b></a></sup> shall have integer type and shall only have operands
5251 that are integer constants, enumeration constants, character constants, sizeof
5252 expressions whose results are integer constants, and floating constants that are the
5253 immediate operands of casts. Cast operators in an integer constant expression shall only
5254 convert arithmetic types to integer types, except as part of an operand to the sizeof
5255 operator.
5256 <p><a name="6.6p7" href="#6.6p7"><small>7</small></a>
5257 More latitude is permitted for constant expressions in initializers. Such a constant
5258 expression shall be, or evaluate to, one of the following:
5259 <ul>
5260 <li> an arithmetic constant expression,
5261 <li> a null pointer constant,
5266 <!--page 108 -->
5267 <li> an address constant, or
5268 <li> an address constant for an object type plus or minus an integer constant expression.
5269 </ul>
5270 <p><a name="6.6p8" href="#6.6p8"><small>8</small></a>
5271 An arithmetic constant expression shall have arithmetic type and shall only have
5272 operands that are integer constants, floating constants, enumeration constants, character
5273 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
5274 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
5275 sizeof operator whose result is an integer constant.
5276 <p><a name="6.6p9" href="#6.6p9"><small>9</small></a>
5277 An address constant is a null pointer, a pointer to an lvalue designating an object of static
5278 storage duration, or a pointer to a function designator; it shall be created explicitly using
5279 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
5280 an expression of array or function type. The array-subscript [] and member-access .
5281 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
5282 be used in the creation of an address constant, but the value of an object shall not be
5283 accessed by use of these operators.
5284 <p><a name="6.6p10" href="#6.6p10"><small>10</small></a>
5285 An implementation may accept other forms of constant expressions.
5286 <p><a name="6.6p11" href="#6.6p11"><small>11</small></a>
5287 The semantic rules for the evaluation of a constant expression are the same as for
5288 nonconstant expressions.<sup><a href="#note100"><b>100)</b></a></sup>
5289 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
5294 <!--page 109 -->
5296 <p><b>Footnotes</b>
5297 <p><small><a name="note98" href="#note98">98)</a> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
5298 </small>
5299 <p><small><a name="note99" href="#note99">99)</a> An integer constant expression is used to specify the size of a bit-field member of a structure, the
5300 value of an enumeration constant, the size of an array, or the value of a case constant. Further
5301 constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
5302 directives are discussed in <a href="#6.10.1">6.10.1</a>.
5303 </small>
5304 <p><small><a name="note100" href="#note100">100)</a> Thus, in the following initialization,
5306 <pre>
5307 static int i = 2 || 1 / 0;
5308 </pre>
5309 the expression is a valid integer constant expression with value one.
5310 </small>
5312 <p><small><a href="#Contents">Contents</a></small>
5313 <h3><a name="6.7" href="#6.7">6.7 Declarations</a></h3>
5314 <p><b>Syntax</b>
5315 <p><a name="6.7p1" href="#6.7p1"><small>1</small></a>
5316 <pre>
5317 declaration:
5318 declaration-specifiers init-declarator-list<sub>opt</sub> ;
5319 declaration-specifiers:
5320 storage-class-specifier declaration-specifiers<sub>opt</sub>
5321 type-specifier declaration-specifiers<sub>opt</sub>
5322 type-qualifier declaration-specifiers<sub>opt</sub>
5323 function-specifier declaration-specifiers<sub>opt</sub>
5324 init-declarator-list:
5325 init-declarator
5326 init-declarator-list , init-declarator
5327 init-declarator:
5328 declarator
5329 declarator = initializer
5330 </pre>
5331 <p><b>Constraints</b>
5332 <p><a name="6.7p2" href="#6.7p2"><small>2</small></a>
5333 A declaration shall declare at least a declarator (other than the parameters of a function or
5334 the members of a structure or union), a tag, or the members of an enumeration.
5335 <p><a name="6.7p3" href="#6.7p3"><small>3</small></a>
5336 If an identifier has no linkage, there shall be no more than one declaration of the identifier
5337 (in a declarator or type specifier) with the same scope and in the same name space, except
5338 for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
5339 <p><a name="6.7p4" href="#6.7p4"><small>4</small></a>
5340 All declarations in the same scope that refer to the same object or function shall specify
5341 compatible types.
5342 <p><b>Semantics</b>
5343 <p><a name="6.7p5" href="#6.7p5"><small>5</small></a>
5344 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
5345 of an identifier is a declaration for that identifier that:
5346 <ul>
5347 <li> for an object, causes storage to be reserved for that object;
5348 <li> for a function, includes the function body;<sup><a href="#note101"><b>101)</b></a></sup>
5349 <li> for an enumeration constant or typedef name, is the (only) declaration of the
5350 identifier.
5351 </ul>
5352 <p><a name="6.7p6" href="#6.7p6"><small>6</small></a>
5353 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
5354 storage duration, and part of the type of the entities that the declarators denote. The init-
5355 declarator-list is a comma-separated sequence of declarators, each of which may have
5357 <!--page 110 -->
5358 additional type information, or an initializer, or both. The declarators contain the
5359 identifiers (if any) being declared.
5360 <p><a name="6.7p7" href="#6.7p7"><small>7</small></a>
5361 If an identifier for an object is declared with no linkage, the type for the object shall be
5362 complete by the end of its declarator, or by the end of its init-declarator if it has an
5363 initializer; in the case of function parameters (including in prototypes), it is the adjusted
5364 type (see <a href="#6.7.5.3">6.7.5.3</a>) that is required to be complete.
5365 <p><b> Forward references</b>: declarators (<a href="#6.7.5">6.7.5</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
5366 (<a href="#6.7.8">6.7.8</a>).
5368 <p><b>Footnotes</b>
5369 <p><small><a name="note101" href="#note101">101)</a> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
5370 </small>
5372 <p><small><a href="#Contents">Contents</a></small>
5373 <h4><a name="6.7.1" href="#6.7.1">6.7.1 Storage-class specifiers</a></h4>
5374 <p><b>Syntax</b>
5375 <p><a name="6.7.1p1" href="#6.7.1p1"><small>1</small></a>
5376 <pre>
5377 storage-class-specifier:
5378 typedef
5379 extern
5380 static
5381 auto
5382 register
5383 </pre>
5384 <p><b>Constraints</b>
5385 <p><a name="6.7.1p2" href="#6.7.1p2"><small>2</small></a>
5386 At most, one storage-class specifier may be given in the declaration specifiers in a
5387 declaration.<sup><a href="#note102"><b>102)</b></a></sup>
5388 <p><b>Semantics</b>
5389 <p><a name="6.7.1p3" href="#6.7.1p3"><small>3</small></a>
5390 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
5391 only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
5392 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
5393 <p><a name="6.7.1p4" href="#6.7.1p4"><small>4</small></a>
5394 A declaration of an identifier for an object with storage-class specifier register
5395 suggests that access to the object be as fast as possible. The extent to which such
5396 suggestions are effective is implementation-defined.<sup><a href="#note103"><b>103)</b></a></sup>
5397 <p><a name="6.7.1p5" href="#6.7.1p5"><small>5</small></a>
5398 The declaration of an identifier for a function that has block scope shall have no explicit
5399 storage-class specifier other than extern.
5403 <!--page 111 -->
5404 <p><a name="6.7.1p6" href="#6.7.1p6"><small>6</small></a>
5405 If an aggregate or union object is declared with a storage-class specifier other than
5406 typedef, the properties resulting from the storage-class specifier, except with respect to
5407 linkage, also apply to the members of the object, and so on recursively for any aggregate
5408 or union member objects.
5409 <p><b> Forward references</b>: type definitions (<a href="#6.7.7">6.7.7</a>).
5411 <p><b>Footnotes</b>
5412 <p><small><a name="note102" href="#note102">102)</a> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
5413 </small>
5414 <p><small><a name="note103" href="#note103">103)</a> The implementation may treat any register declaration simply as an auto declaration. However,
5415 whether or not addressable storage is actually used, the address of any part of an object declared with
5416 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
5417 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
5418 <a href="#6.3.2.1">6.3.2.1</a>). Thus, the only operator that can be applied to an array declared with storage-class specifier
5419 register is sizeof.
5420 </small>
5422 <p><small><a href="#Contents">Contents</a></small>
5423 <h4><a name="6.7.2" href="#6.7.2">6.7.2 Type specifiers</a></h4>
5424 <p><b>Syntax</b>
5425 <p><a name="6.7.2p1" href="#6.7.2p1"><small>1</small></a>
5426 <pre>
5427 type-specifier:
5428 void
5429 char
5430 short
5432 long
5433 float
5434 double
5435 signed
5436 unsigned
5437 _Bool
5438 _Complex
5439 struct-or-union-specifier *
5440 enum-specifier
5441 typedef-name
5442 </pre>
5443 <p><b>Constraints</b>
5444 <p><a name="6.7.2p2" href="#6.7.2p2"><small>2</small></a>
5445 At least one type specifier shall be given in the declaration specifiers in each declaration,
5446 and in the specifier-qualifier list in each struct declaration and type name. Each list of
5447 type specifiers shall be one of the following sets (delimited by commas, when there is
5448 more than one set on a line); the type specifiers may occur in any order, possibly
5449 intermixed with the other declaration specifiers.
5450 <ul>
5451 <li> void
5452 <li> char
5453 <li> signed char
5454 <li> unsigned char
5455 <li> short, signed short, short int, or signed short int
5456 <li> unsigned short, or unsigned short int
5457 <li> int, signed, or signed int
5458 <!--page 112 -->
5459 <li> unsigned, or unsigned int
5460 <li> long, signed long, long int, or signed long int
5461 <li> unsigned long, or unsigned long int
5462 <li> long long, signed long long, long long int, or
5463 signed long long int
5464 <li> unsigned long long, or unsigned long long int
5465 <li> float
5466 <li> double
5467 <li> long double
5468 <li> _Bool
5469 <li> float _Complex
5470 <li> double _Complex
5471 <li> long double _Complex
5472 <li> struct or union specifier *
5473 <li> enum specifier
5474 <li> typedef name
5475 </ul>
5476 <p><a name="6.7.2p3" href="#6.7.2p3"><small>3</small></a>
5477 The type specifier _Complex shall not be used if the implementation does not provide
5478 complex types.<sup><a href="#note104"><b>104)</b></a></sup>
5479 <p><b>Semantics</b>
5480 <p><a name="6.7.2p4" href="#6.7.2p4"><small>4</small></a>
5481 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
5482 <a href="#6.7.2.3">6.7.2.3</a>. Declarations of typedef names are discussed in <a href="#6.7.7">6.7.7</a>. The characteristics of the
5483 other types are discussed in <a href="#6.2.5">6.2.5</a>.
5484 <p><a name="6.7.2p5" href="#6.7.2p5"><small>5</small></a>
5485 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
5486 implementation-defined whether the specifier int designates the same type as signed
5487 int or the same type as unsigned int.
5488 <p><b> Forward references</b>: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
5489 (<a href="#6.7.2.1">6.7.2.1</a>), tags (<a href="#6.7.2.3">6.7.2.3</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
5494 <!--page 113 -->
5496 <p><b>Footnotes</b>
5497 <p><small><a name="note104" href="#note104">104)</a> Freestanding implementations are not required to provide complex types. *
5498 </small>
5500 <p><small><a href="#Contents">Contents</a></small>
5501 <h5><a name="6.7.2.1" href="#6.7.2.1">6.7.2.1 Structure and union specifiers</a></h5>
5502 <p><b>Syntax</b>
5503 <p><a name="6.7.2.1p1" href="#6.7.2.1p1"><small>1</small></a>
5504 <pre>
5505 struct-or-union-specifier:
5506 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
5507 struct-or-union identifier
5508 struct-or-union:
5509 struct
5510 union
5511 struct-declaration-list:
5512 struct-declaration
5513 struct-declaration-list struct-declaration
5514 struct-declaration:
5515 specifier-qualifier-list struct-declarator-list ;
5516 specifier-qualifier-list:
5517 type-specifier specifier-qualifier-list<sub>opt</sub>
5518 type-qualifier specifier-qualifier-list<sub>opt</sub>
5519 struct-declarator-list:
5520 struct-declarator
5521 struct-declarator-list , struct-declarator
5522 struct-declarator:
5523 declarator
5524 declarator<sub>opt</sub> : constant-expression
5525 </pre>
5526 <p><b>Constraints</b>
5527 <p><a name="6.7.2.1p2" href="#6.7.2.1p2"><small>2</small></a>
5528 A structure or union shall not contain a member with incomplete or function type (hence,
5529 a structure shall not contain an instance of itself, but may contain a pointer to an instance
5530 of itself), except that the last member of a structure with more than one named member
5531 may have incomplete array type; such a structure (and any union containing, possibly
5532 recursively, a member that is such a structure) shall not be a member of a structure or an
5533 element of an array.
5534 <p><a name="6.7.2.1p3" href="#6.7.2.1p3"><small>3</small></a>
5535 The expression that specifies the width of a bit-field shall be an integer constant
5536 expression with a nonnegative value that does not exceed the width of an object of the
5537 type that would be specified were the colon and expression omitted. If the value is zero,
5538 the declaration shall have no declarator.
5539 <p><a name="6.7.2.1p4" href="#6.7.2.1p4"><small>4</small></a>
5540 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
5541 int, unsigned int, or some other implementation-defined type.
5542 <!--page 114 -->
5543 <p><b>Semantics</b>
5544 <p><a name="6.7.2.1p5" href="#6.7.2.1p5"><small>5</small></a>
5545 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
5546 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
5547 of members whose storage overlap.
5548 <p><a name="6.7.2.1p6" href="#6.7.2.1p6"><small>6</small></a>
5549 Structure and union specifiers have the same form. The keywords struct and union
5550 indicate that the type being specified is, respectively, a structure type or a union type.
5551 <p><a name="6.7.2.1p7" href="#6.7.2.1p7"><small>7</small></a>
5552 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
5553 within a translation unit. The struct-declaration-list is a sequence of declarations for the
5554 members of the structure or union. If the struct-declaration-list contains no named
5555 members, the behavior is undefined. The type is incomplete until after the } that
5556 terminates the list.
5557 <p><a name="6.7.2.1p8" href="#6.7.2.1p8"><small>8</small></a>
5558 A member of a structure or union may have any object type other than a variably
5559 modified type.<sup><a href="#note105"><b>105)</b></a></sup> In addition, a member may be declared to consist of a specified
5560 number of bits (including a sign bit, if any). Such a member is called a bit-field;<sup><a href="#note106"><b>106)</b></a></sup> its
5561 width is preceded by a colon.
5562 <p><a name="6.7.2.1p9" href="#6.7.2.1p9"><small>9</small></a>
5563 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified
5564 number of bits.<sup><a href="#note107"><b>107)</b></a></sup> If the value 0 or 1 is stored into a nonzero-width bit-field of type
5565 _Bool, the value of the bit-field shall compare equal to the value stored.
5566 <p><a name="6.7.2.1p10" href="#6.7.2.1p10"><small>10</small></a>
5567 An implementation may allocate any addressable storage unit large enough to hold a bit-
5568 field. If enough space remains, a bit-field that immediately follows another bit-field in a
5569 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
5570 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
5571 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
5572 low-order or low-order to high-order) is implementation-defined. The alignment of the
5573 addressable storage unit is unspecified.
5574 <p><a name="6.7.2.1p11" href="#6.7.2.1p11"><small>11</small></a>
5575 A bit-field declaration with no declarator, but only a colon and a width, indicates an
5576 unnamed bit-field.<sup><a href="#note108"><b>108)</b></a></sup> As a special case, a bit-field structure member with a width of 0
5577 indicates that no further bit-field is to be packed into the unit in which the previous bit-
5578 field, if any, was placed.
5581 <!--page 115 -->
5582 <p><a name="6.7.2.1p12" href="#6.7.2.1p12"><small>12</small></a>
5583 Each non-bit-field member of a structure or union object is aligned in an implementation-
5584 defined manner appropriate to its type.
5585 <p><a name="6.7.2.1p13" href="#6.7.2.1p13"><small>13</small></a>
5586 Within a structure object, the non-bit-field members and the units in which bit-fields
5587 reside have addresses that increase in the order in which they are declared. A pointer to a
5588 structure object, suitably converted, points to its initial member (or if that member is a
5589 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
5590 padding within a structure object, but not at its beginning.
5591 <p><a name="6.7.2.1p14" href="#6.7.2.1p14"><small>14</small></a>
5592 The size of a union is sufficient to contain the largest of its members. The value of at
5593 most one of the members can be stored in a union object at any time. A pointer to a
5594 union object, suitably converted, points to each of its members (or if a member is a bit-
5595 field, then to the unit in which it resides), and vice versa.
5596 <p><a name="6.7.2.1p15" href="#6.7.2.1p15"><small>15</small></a>
5597 There may be unnamed padding at the end of a structure or union.
5598 <p><a name="6.7.2.1p16" href="#6.7.2.1p16"><small>16</small></a>
5599 As a special case, the last element of a structure with more than one named member may
5600 have an incomplete array type; this is called a flexible array member. In most situations,
5601 the flexible array member is ignored. In particular, the size of the structure is as if the
5602 flexible array member were omitted except that it may have more trailing padding than
5603 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
5604 (a pointer to) a structure with a flexible array member and the right operand names that
5605 member, it behaves as if that member were replaced with the longest array (with the same
5606 element type) that would not make the structure larger than the object being accessed; the
5607 offset of the array shall remain that of the flexible array member, even if this would differ
5608 from that of the replacement array. If this array would have no elements, it behaves as if
5609 it had one element but the behavior is undefined if any attempt is made to access that
5610 element or to generate a pointer one past it.
5611 <p><a name="6.7.2.1p17" href="#6.7.2.1p17"><small>17</small></a>
5612 EXAMPLE After the declaration:
5613 <pre>
5614 struct s { int n; double d[]; };
5615 </pre>
5616 the structure struct s has a flexible array member d. A typical way to use this is:
5617 <pre>
5618 int m = /* some value */;
5619 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
5620 </pre>
5621 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
5622 p had been declared as:
5623 <pre>
5624 struct { int n; double d[m]; } *p;
5625 </pre>
5626 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
5627 not be the same).
5628 <p><a name="6.7.2.1p18" href="#6.7.2.1p18"><small>18</small></a>
5629 Following the above declaration:
5630 <!--page 116 -->
5631 <pre>
5632 struct s t1 = { 0 }; // valid
5633 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
5634 t1.n = 4; // valid
5635 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
5636 </pre>
5637 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
5638 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
5639 <pre>
5640 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
5641 </pre>
5642 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
5643 code.
5644 <p><a name="6.7.2.1p19" href="#6.7.2.1p19"><small>19</small></a>
5645 After the further declaration:
5646 <pre>
5647 struct ss { int n; };
5648 </pre>
5649 the expressions:
5650 <pre>
5651 sizeof (struct s) &gt;= sizeof (struct ss)
5652 sizeof (struct s) &gt;= offsetof(struct s, d)
5653 </pre>
5654 are always equal to 1.
5655 <p><a name="6.7.2.1p20" href="#6.7.2.1p20"><small>20</small></a>
5656 If sizeof (double) is 8, then after the following code is executed:
5657 <pre>
5658 struct s *s1;
5659 struct s *s2;
5660 s1 = malloc(sizeof (struct s) + 64);
5661 s2 = malloc(sizeof (struct s) + 46);
5662 </pre>
5663 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
5664 purposes, as if the identifiers had been declared as:
5665 <pre>
5666 struct { int n; double d[8]; } *s1;
5667 struct { int n; double d[5]; } *s2;
5668 </pre>
5669 <p><a name="6.7.2.1p21" href="#6.7.2.1p21"><small>21</small></a>
5670 Following the further successful assignments:
5671 <pre>
5672 s1 = malloc(sizeof (struct s) + 10);
5673 s2 = malloc(sizeof (struct s) + 6);
5674 </pre>
5675 they then behave as if the declarations were:
5676 <pre>
5677 struct { int n; double d[1]; } *s1, *s2;
5678 </pre>
5679 and:
5680 <pre>
5681 double *dp;
5682 dp = &amp;(s1-&gt;d[0]); // valid
5683 *dp = 42; // valid
5684 dp = &amp;(s2-&gt;d[0]); // valid
5685 *dp = 42; // undefined behavior
5686 </pre>
5687 <p><a name="6.7.2.1p22" href="#6.7.2.1p22"><small>22</small></a>
5688 The assignment:
5689 <pre>
5690 *s1 = *s2;
5691 </pre>
5692 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
5693 of the structure, they might be copied or simply overwritten with indeterminate values.
5695 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5696 <!--page 117 -->
5698 <p><b>Footnotes</b>
5699 <p><small><a name="note105" href="#note105">105)</a> A structure or union can not contain a member with a variably modified type because member names
5700 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
5701 </small>
5702 <p><small><a name="note106" href="#note106">106)</a> The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
5703 or arrays of bit-field objects.
5704 </small>
5705 <p><small><a name="note107" href="#note107">107)</a> As specified in <a href="#6.7.2">6.7.2</a> above, if the actual type specifier used is int or a typedef-name defined as int,
5706 then it is implementation-defined whether the bit-field is signed or unsigned.
5707 </small>
5708 <p><small><a name="note108" href="#note108">108)</a> An unnamed bit-field structure member is useful for padding to conform to externally imposed
5709 layouts.
5710 </small>
5712 <p><small><a href="#Contents">Contents</a></small>
5713 <h5><a name="6.7.2.2" href="#6.7.2.2">6.7.2.2 Enumeration specifiers</a></h5>
5714 <p><b>Syntax</b>
5715 <p><a name="6.7.2.2p1" href="#6.7.2.2p1"><small>1</small></a>
5716 <pre>
5717 enum-specifier:
5718 enum identifier<sub>opt</sub> { enumerator-list }
5719 enum identifier<sub>opt</sub> { enumerator-list , }
5720 enum identifier
5721 enumerator-list:
5722 enumerator
5723 enumerator-list , enumerator
5724 enumerator:
5725 enumeration-constant
5726 enumeration-constant = constant-expression
5727 </pre>
5728 <p><b>Constraints</b>
5729 <p><a name="6.7.2.2p2" href="#6.7.2.2p2"><small>2</small></a>
5730 The expression that defines the value of an enumeration constant shall be an integer
5731 constant expression that has a value representable as an int.
5732 <p><b>Semantics</b>
5733 <p><a name="6.7.2.2p3" href="#6.7.2.2p3"><small>3</small></a>
5734 The identifiers in an enumerator list are declared as constants that have type int and
5735 may appear wherever such are permitted.<sup><a href="#note109"><b>109)</b></a></sup> An enumerator with = defines its
5736 enumeration constant as the value of the constant expression. If the first enumerator has
5737 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
5738 defines its enumeration constant as the value of the constant expression obtained by
5739 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
5740 = may produce enumeration constants with values that duplicate other values in the same
5741 enumeration.) The enumerators of an enumeration are also known as its members.
5742 <p><a name="6.7.2.2p4" href="#6.7.2.2p4"><small>4</small></a>
5743 Each enumerated type shall be compatible with char, a signed integer type, or an
5744 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note110"><b>110)</b></a></sup> but shall be
5745 capable of representing the values of all the members of the enumeration. The
5746 enumerated type is incomplete until after the } that terminates the list of enumerator
5747 declarations.
5752 <!--page 118 -->
5753 <p><a name="6.7.2.2p5" href="#6.7.2.2p5"><small>5</small></a>
5754 EXAMPLE The following fragment:
5755 <pre>
5756 enum hue { chartreuse, burgundy, claret=20, winedark };
5757 enum hue col, *cp;
5758 col = claret;
5759 cp = &amp;col;
5760 if (*cp != burgundy)
5761 /* ... */
5762 </pre>
5763 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
5764 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
5766 <p><b> Forward references</b>: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5768 <p><b>Footnotes</b>
5769 <p><small><a name="note109" href="#note109">109)</a> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
5770 each other and from other identifiers declared in ordinary declarators.
5771 </small>
5772 <p><small><a name="note110" href="#note110">110)</a> An implementation may delay the choice of which integer type until all enumeration constants have
5773 been seen.
5774 </small>
5776 <p><small><a href="#Contents">Contents</a></small>
5777 <h5><a name="6.7.2.3" href="#6.7.2.3">6.7.2.3 Tags</a></h5>
5778 <p><b>Constraints</b>
5779 <p><a name="6.7.2.3p1" href="#6.7.2.3p1"><small>1</small></a>
5780 A specific type shall have its content defined at most once.
5781 <p><a name="6.7.2.3p2" href="#6.7.2.3p2"><small>2</small></a>
5782 Where two declarations that use the same tag declare the same type, they shall both use
5783 the same choice of struct, union, or enum.
5784 <p><a name="6.7.2.3p3" href="#6.7.2.3p3"><small>3</small></a>
5785 A type specifier of the form
5786 <pre>
5787 enum identifier
5788 </pre>
5789 without an enumerator list shall only appear after the type it specifies is complete.
5790 <p><b>Semantics</b>
5791 <p><a name="6.7.2.3p4" href="#6.7.2.3p4"><small>4</small></a>
5792 All declarations of structure, union, or enumerated types that have the same scope and
5793 use the same tag declare the same type. The type is incomplete<sup><a href="#note111"><b>111)</b></a></sup> until the closing brace
5794 of the list defining the content, and complete thereafter.
5795 <p><a name="6.7.2.3p5" href="#6.7.2.3p5"><small>5</small></a>
5796 Two declarations of structure, union, or enumerated types which are in different scopes or
5797 use different tags declare distinct types. Each declaration of a structure, union, or
5798 enumerated type which does not include a tag declares a distinct type.
5799 <p><a name="6.7.2.3p6" href="#6.7.2.3p6"><small>6</small></a>
5800 A type specifier of the form
5801 <pre>
5802 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
5803 </pre>
5805 <pre>
5806 enum identifier { enumerator-list }
5807 </pre>
5809 <pre>
5810 enum identifier { enumerator-list , }
5811 </pre>
5812 declares a structure, union, or enumerated type. The list defines the structure content,
5814 <!--page 119 -->
5815 union content, or enumeration content. If an identifier is provided,<sup><a href="#note112"><b>112)</b></a></sup> the type specifier
5816 also declares the identifier to be the tag of that type.
5817 <p><a name="6.7.2.3p7" href="#6.7.2.3p7"><small>7</small></a>
5818 A declaration of the form
5819 <pre>
5820 struct-or-union identifier ;
5821 </pre>
5822 specifies a structure or union type and declares the identifier as a tag of that type.<sup><a href="#note113"><b>113)</b></a></sup>
5823 <p><a name="6.7.2.3p8" href="#6.7.2.3p8"><small>8</small></a>
5824 If a type specifier of the form
5825 <pre>
5826 struct-or-union identifier
5827 </pre>
5828 occurs other than as part of one of the above forms, and no other declaration of the
5829 identifier as a tag is visible, then it declares an incomplete structure or union type, and
5830 declares the identifier as the tag of that type.<sup><a href="#note113"><b>113)</b></a></sup>
5831 <p><a name="6.7.2.3p9" href="#6.7.2.3p9"><small>9</small></a>
5832 If a type specifier of the form
5833 <pre>
5834 struct-or-union identifier
5835 </pre>
5837 <pre>
5838 enum identifier
5839 </pre>
5840 occurs other than as part of one of the above forms, and a declaration of the identifier as a
5841 tag is visible, then it specifies the same type as that other declaration, and does not
5842 redeclare the tag.
5843 <p><a name="6.7.2.3p10" href="#6.7.2.3p10"><small>10</small></a>
5844 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
5845 <pre>
5846 struct tnode {
5847 int count;
5848 struct tnode *left, *right;
5850 </pre>
5851 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
5852 declaration has been given, the declaration
5853 <pre>
5854 struct tnode s, *sp;
5855 </pre>
5856 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
5857 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
5858 which sp points; the expression s.right-&gt;count designates the count member of the right struct
5859 tnode pointed to from s.
5860 <p><a name="6.7.2.3p11" href="#6.7.2.3p11"><small>11</small></a>
5861 The following alternative formulation uses the typedef mechanism:
5866 <!--page 120 -->
5867 <pre>
5868 typedef struct tnode TNODE;
5869 struct tnode {
5870 int count;
5871 TNODE *left, *right;
5873 TNODE s, *sp;
5874 </pre>
5876 <p><a name="6.7.2.3p12" href="#6.7.2.3p12"><small>12</small></a>
5877 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
5878 structures, the declarations
5879 <pre>
5880 struct s1 { struct s2 *s2p; /* ... */ }; // D1
5881 struct s2 { struct s1 *s1p; /* ... */ }; // D2
5882 </pre>
5883 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
5884 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
5885 D2. To eliminate this context sensitivity, the declaration
5886 <pre>
5887 struct s2;
5888 </pre>
5889 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
5890 completes the specification of the new type.
5892 <p><b> Forward references</b>: declarators (<a href="#6.7.5">6.7.5</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions
5893 (<a href="#6.7.7">6.7.7</a>).
5895 <p><b>Footnotes</b>
5896 <p><small><a name="note111" href="#note111">111)</a> An incomplete type may only by used when the size of an object of that type is not needed. It is not
5897 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
5898 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
5899 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
5900 </small>
5901 <p><small><a name="note112" href="#note112">112)</a> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
5902 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
5903 can make use of that typedef name to declare objects having the specified structure, union, or
5904 enumerated type.
5905 </small>
5906 <p><small><a name="note113" href="#note113">113)</a> A similar construction with enum does not exist.
5907 </small>
5909 <p><small><a href="#Contents">Contents</a></small>
5910 <h4><a name="6.7.3" href="#6.7.3">6.7.3 Type qualifiers</a></h4>
5911 <p><b>Syntax</b>
5912 <p><a name="6.7.3p1" href="#6.7.3p1"><small>1</small></a>
5913 <pre>
5914 type-qualifier:
5915 const
5916 restrict
5917 volatile
5918 </pre>
5919 <p><b>Constraints</b>
5920 <p><a name="6.7.3p2" href="#6.7.3p2"><small>2</small></a>
5921 Types other than pointer types derived from object or incomplete types shall not be
5922 restrict-qualified.
5923 <p><b>Semantics</b>
5924 <p><a name="6.7.3p3" href="#6.7.3p3"><small>3</small></a>
5925 The properties associated with qualified types are meaningful only for expressions that
5926 are lvalues.<sup><a href="#note114"><b>114)</b></a></sup>
5927 <p><a name="6.7.3p4" href="#6.7.3p4"><small>4</small></a>
5928 If the same qualifier appears more than once in the same specifier-qualifier-list, either
5929 directly or via one or more typedefs, the behavior is the same as if it appeared only
5930 once.
5935 <!--page 121 -->
5936 <p><a name="6.7.3p5" href="#6.7.3p5"><small>5</small></a>
5937 If an attempt is made to modify an object defined with a const-qualified type through use
5938 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
5939 made to refer to an object defined with a volatile-qualified type through use of an lvalue
5940 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note115"><b>115)</b></a></sup>
5941 <p><a name="6.7.3p6" href="#6.7.3p6"><small>6</small></a>
5942 An object that has volatile-qualified type may be modified in ways unknown to the
5943 implementation or have other unknown side effects. Therefore any expression referring
5944 to such an object shall be evaluated strictly according to the rules of the abstract machine,
5945 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
5946 object shall agree with that prescribed by the abstract machine, except as modified by the
5947 unknown factors mentioned previously.<sup><a href="#note116"><b>116)</b></a></sup> What constitutes an access to an object that
5948 has volatile-qualified type is implementation-defined.
5949 <p><a name="6.7.3p7" href="#6.7.3p7"><small>7</small></a>
5950 An object that is accessed through a restrict-qualified pointer has a special association
5951 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
5952 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note117"><b>117)</b></a></sup> The intended
5953 use of the restrict qualifier (like the register storage class) is to promote
5954 optimization, and deleting all instances of the qualifier from all preprocessing translation
5955 units composing a conforming program does not change its meaning (i.e., observable
5956 behavior).
5957 <p><a name="6.7.3p8" href="#6.7.3p8"><small>8</small></a>
5958 If the specification of an array type includes any type qualifiers, the element type is so-
5959 qualified, not the array type. If the specification of a function type includes any type
5960 qualifiers, the behavior is undefined.<sup><a href="#note118"><b>118)</b></a></sup>
5961 <p><a name="6.7.3p9" href="#6.7.3p9"><small>9</small></a>
5962 For two qualified types to be compatible, both shall have the identically qualified version
5963 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
5964 does not affect the specified type.
5965 <p><a name="6.7.3p10" href="#6.7.3p10"><small>10</small></a>
5966 EXAMPLE 1 An object declared
5967 <pre>
5968 extern const volatile int real_time_clock;
5969 </pre>
5970 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
5975 <!--page 122 -->
5976 <p><a name="6.7.3p11" href="#6.7.3p11"><small>11</small></a>
5977 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
5978 modify an aggregate type:
5979 <pre>
5980 const struct s { int mem; } cs = { 1 };
5981 struct s ncs; // the object ncs is modifiable
5982 typedef int A[2][3];
5983 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
5984 int *pi;
5985 const int *pci;
5986 ncs = cs; // valid
5987 cs = ncs; // violates modifiable lvalue constraint for =
5988 pi = &amp;ncs.mem; // valid
5989 pi = &amp;cs.mem; // violates type constraints for =
5990 pci = &amp;cs.mem; // valid
5991 pi = a[0]; // invalid: a[0] has type ''const int *''
5992 </pre>
5995 <p><b>Footnotes</b>
5996 <p><small><a name="note114" href="#note114">114)</a> The implementation may place a const object that is not volatile in a read-only region of
5997 storage. Moreover, the implementation need not allocate storage for such an object if its address is
5998 never used.
5999 </small>
6000 <p><small><a name="note115" href="#note115">115)</a> This applies to those objects that behave as if they were defined with qualified types, even if they are
6001 never actually defined as objects in the program (such as an object at a memory-mapped input/output
6002 address).
6003 </small>
6004 <p><small><a name="note116" href="#note116">116)</a> A volatile declaration may be used to describe an object corresponding to a memory-mapped
6005 input/output port or an object accessed by an asynchronously interrupting function. Actions on
6006 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
6007 permitted by the rules for evaluating expressions.
6008 </small>
6009 <p><small><a name="note117" href="#note117">117)</a> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
6010 association between the allocated object and the pointer.
6011 </small>
6012 <p><small><a name="note118" href="#note118">118)</a> Both of these can occur through the use of typedefs.
6013 </small>
6015 <p><small><a href="#Contents">Contents</a></small>
6016 <h5><a name="6.7.3.1" href="#6.7.3.1">6.7.3.1 Formal definition of restrict</a></h5>
6017 <p><a name="6.7.3.1p1" href="#6.7.3.1p1"><small>1</small></a>
6018 Let D be a declaration of an ordinary identifier that provides a means of designating an
6019 object P as a restrict-qualified pointer to type T.
6020 <p><a name="6.7.3.1p2" href="#6.7.3.1p2"><small>2</small></a>
6021 If D appears inside a block and does not have storage class extern, let B denote the
6022 block. If D appears in the list of parameter declarations of a function definition, let B
6023 denote the associated block. Otherwise, let B denote the block of main (or the block of
6024 whatever function is called at program startup in a freestanding environment).
6025 <p><a name="6.7.3.1p3" href="#6.7.3.1p3"><small>3</small></a>
6026 In what follows, a pointer expression E is said to be based on object P if (at some
6027 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
6028 a copy of the array object into which it formerly pointed would change the value of E.<sup><a href="#note119"><b>119)</b></a></sup>
6029 Note that ''based'' is defined only for expressions with pointer types.
6030 <p><a name="6.7.3.1p4" href="#6.7.3.1p4"><small>4</small></a>
6031 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
6032 access the value of the object X that it designates, and X is also modified (by any means),
6033 then the following requirements apply: T shall not be const-qualified. Every other lvalue
6034 used to access the value of X shall also have its address based on P. Every access that
6035 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
6036 is assigned the value of a pointer expression E that is based on another restricted pointer
6037 object P2, associated with block B2, then either the execution of B2 shall begin before
6038 the execution of B, or the execution of B2 shall end prior to the assignment. If these
6039 requirements are not met, then the behavior is undefined.
6040 <p><a name="6.7.3.1p5" href="#6.7.3.1p5"><small>5</small></a>
6041 Here an execution of B means that portion of the execution of the program that would
6042 correspond to the lifetime of an object with scalar type and automatic storage duration
6044 <!--page 123 -->
6045 associated with B.
6046 <p><a name="6.7.3.1p6" href="#6.7.3.1p6"><small>6</small></a>
6047 A translator is free to ignore any or all aliasing implications of uses of restrict.
6048 <p><a name="6.7.3.1p7" href="#6.7.3.1p7"><small>7</small></a>
6049 EXAMPLE 1 The file scope declarations
6050 <pre>
6051 int * restrict a;
6052 int * restrict b;
6053 extern int c[];
6054 </pre>
6055 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
6056 program, then it is never accessed using either of the other two.
6058 <p><a name="6.7.3.1p8" href="#6.7.3.1p8"><small>8</small></a>
6059 EXAMPLE 2 The function parameter declarations in the following example
6060 <pre>
6061 void f(int n, int * restrict p, int * restrict q)
6063 while (n-- &gt; 0)
6064 *p++ = *q++;
6066 </pre>
6067 assert that, during each execution of the function, if an object is accessed through one of the pointer
6068 parameters, then it is not also accessed through the other.
6069 <p><a name="6.7.3.1p9" href="#6.7.3.1p9"><small>9</small></a>
6070 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
6071 analysis of function f without examining any of the calls of f in the program. The cost is that the
6072 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
6073 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
6074 both p and q.
6075 <pre>
6076 void g(void)
6078 extern int d[100];
6079 f(50, d + 50, d); // valid
6080 f(50, d + 1, d); // undefined behavior
6082 </pre>
6084 <p><a name="6.7.3.1p10" href="#6.7.3.1p10"><small>10</small></a>
6085 EXAMPLE 3 The function parameter declarations
6086 <pre>
6087 void h(int n, int * restrict p, int * restrict q, int * restrict r)
6089 int i;
6090 for (i = 0; i &lt; n; i++)
6091 p[i] = q[i] + r[i];
6093 </pre>
6094 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
6095 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
6096 modified within function h.
6098 <p><a name="6.7.3.1p11" href="#6.7.3.1p11"><small>11</small></a>
6099 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
6100 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
6101 between restricted pointers declared in nested blocks have defined behavior.
6102 <!--page 124 -->
6103 <pre>
6105 int * restrict p1;
6106 int * restrict q1;
6107 p1 = q1; // undefined behavior
6109 int * restrict p2 = p1; // valid
6110 int * restrict q2 = q1; // valid
6111 p1 = q2; // undefined behavior
6112 p2 = q2; // undefined behavior
6115 </pre>
6116 <p><a name="6.7.3.1p12" href="#6.7.3.1p12"><small>12</small></a>
6117 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
6118 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
6119 example, this permits new_vector to return a vector.
6120 <pre>
6121 typedef struct { int n; float * restrict v; } vector;
6122 vector new_vector(int n)
6124 vector t;
6125 t.n = n;
6126 t.v = malloc(n * sizeof (float));
6127 return t;
6129 </pre>
6132 <p><b>Footnotes</b>
6133 <p><small><a name="note119" href="#note119">119)</a> In other words, E depends on the value of P itself rather than on the value of an object referenced
6134 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
6135 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
6136 expressions *p and p[1] are not.
6137 </small>
6139 <p><small><a href="#Contents">Contents</a></small>
6140 <h4><a name="6.7.4" href="#6.7.4">6.7.4 Function specifiers</a></h4>
6141 <p><b>Syntax</b>
6142 <p><a name="6.7.4p1" href="#6.7.4p1"><small>1</small></a>
6143 <pre>
6144 function-specifier:
6145 inline
6146 </pre>
6147 <p><b>Constraints</b>
6148 <p><a name="6.7.4p2" href="#6.7.4p2"><small>2</small></a>
6149 Function specifiers shall be used only in the declaration of an identifier for a function.
6150 <p><a name="6.7.4p3" href="#6.7.4p3"><small>3</small></a>
6151 An inline definition of a function with external linkage shall not contain a definition of a
6152 modifiable object with static storage duration, and shall not contain a reference to an
6153 identifier with internal linkage.
6154 <p><a name="6.7.4p4" href="#6.7.4p4"><small>4</small></a>
6155 In a hosted environment, the inline function specifier shall not appear in a declaration
6156 of main.
6157 <p><b>Semantics</b>
6158 <p><a name="6.7.4p5" href="#6.7.4p5"><small>5</small></a>
6159 A function declared with an inline function specifier is an inline function. The
6160 function specifier may appear more than once; the behavior is the same as if it appeared
6161 only once. Making a function an inline function suggests that calls to the function be as
6162 fast as possible.<sup><a href="#note120"><b>120)</b></a></sup> The extent to which such suggestions are effective is
6163 implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
6164 <p><a name="6.7.4p6" href="#6.7.4p6"><small>6</small></a>
6165 Any function with internal linkage can be an inline function. For a function with external
6166 linkage, the following restrictions apply: If a function is declared with an inline
6167 <!--page 125 -->
6168 function specifier, then it shall also be defined in the same translation unit. If all of the
6169 file scope declarations for a function in a translation unit include the inline function
6170 specifier without extern, then the definition in that translation unit is an inline
6171 definition. An inline definition does not provide an external definition for the function,
6172 and does not forbid an external definition in another translation unit. An inline definition
6173 provides an alternative to an external definition, which a translator may use to implement
6174 any call to the function in the same translation unit. It is unspecified whether a call to the
6175 function uses the inline definition or the external definition.<sup><a href="#note122"><b>122)</b></a></sup>
6176 <p><a name="6.7.4p7" href="#6.7.4p7"><small>7</small></a>
6177 EXAMPLE The declaration of an inline function with external linkage can result in either an external
6178 definition, or a definition available for use only within the translation unit. A file scope declaration with
6179 extern creates an external definition. The following example shows an entire translation unit.
6180 <pre>
6181 inline double fahr(double t)
6183 return (9.0 * t) / 5.0 + 32.0;
6185 inline double cels(double t)
6187 return (5.0 * (t - 32.0)) / 9.0;
6189 extern double fahr(double); // creates an external definition
6190 double convert(int is_fahr, double temp)
6192 /* A translator may perform inline substitutions */
6193 return is_fahr ? cels(temp) : fahr(temp);
6195 </pre>
6196 <p><a name="6.7.4p8" href="#6.7.4p8"><small>8</small></a>
6197 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
6198 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
6199 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
6200 definition are distinct and either may be used for the call.
6202 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>).
6205 <!--page 126 -->
6207 <p><b>Footnotes</b>
6208 <p><small><a name="note120" href="#note120">120)</a> By using, for example, an alternative to the usual function call mechanism, such as ''inline
6209 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
6210 Therefore, for example, the expansion of a macro used within the body of the function uses the
6211 definition it had at the point the function body appears, and not where the function is called; and
6212 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
6213 single address, regardless of the number of inline definitions that occur in addition to the external
6214 definition.
6215 </small>
6216 <p><small><a name="note121" href="#note121">121)</a> For example, an implementation might never perform inline substitution, or might only perform inline
6217 substitutions to calls in the scope of an inline declaration.
6218 </small>
6219 <p><small><a name="note122" href="#note122">122)</a> Since an inline definition is distinct from the corresponding external definition and from any other
6220 corresponding inline definitions in other translation units, all corresponding objects with static storage
6221 duration are also distinct in each of the definitions.
6222 </small>
6224 <p><small><a href="#Contents">Contents</a></small>
6225 <h4><a name="6.7.5" href="#6.7.5">6.7.5 Declarators</a></h4>
6226 <p><b>Syntax</b>
6227 <p><a name="6.7.5p1" href="#6.7.5p1"><small>1</small></a>
6228 <pre>
6229 declarator:
6230 pointer<sub>opt</sub> direct-declarator
6231 direct-declarator:
6232 identifier
6233 ( declarator )
6234 direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
6235 direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
6236 direct-declarator [ type-qualifier-list static assignment-expression ]
6237 direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
6238 direct-declarator ( parameter-type-list )
6239 direct-declarator ( identifier-list<sub>opt</sub> )
6240 pointer:
6241 * type-qualifier-list<sub>opt</sub>
6242 * type-qualifier-list<sub>opt</sub> pointer
6243 type-qualifier-list:
6244 type-qualifier
6245 type-qualifier-list type-qualifier
6246 parameter-type-list:
6247 parameter-list
6248 parameter-list , ...
6249 parameter-list:
6250 parameter-declaration
6251 parameter-list , parameter-declaration
6252 parameter-declaration:
6253 declaration-specifiers declarator
6254 declaration-specifiers abstract-declarator<sub>opt</sub>
6255 identifier-list:
6256 identifier
6257 identifier-list , identifier
6258 </pre>
6259 <p><b>Semantics</b>
6260 <p><a name="6.7.5p2" href="#6.7.5p2"><small>2</small></a>
6261 Each declarator declares one identifier, and asserts that when an operand of the same
6262 form as the declarator appears in an expression, it designates a function or object with the
6263 scope, storage duration, and type indicated by the declaration specifiers.
6264 <p><a name="6.7.5p3" href="#6.7.5p3"><small>3</small></a>
6265 A full declarator is a declarator that is not part of another declarator. The end of a full
6266 declarator is a sequence point. If, in the nested sequence of declarators in a full
6267 <!--page 127 -->
6268 declarator, there is a declarator specifying a variable length array type, the type specified
6269 by the full declarator is said to be variably modified. Furthermore, any type derived by
6270 declarator type derivation from a variably modified type is itself variably modified.
6271 <p><a name="6.7.5p4" href="#6.7.5p4"><small>4</small></a>
6272 In the following subclauses, consider a declaration
6273 <pre>
6274 T D1
6275 </pre>
6276 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
6277 a declarator that contains an identifier ident. The type specified for the identifier ident in
6278 the various forms of declarator is described inductively using this notation.
6279 <p><a name="6.7.5p5" href="#6.7.5p5"><small>5</small></a>
6280 If, in the declaration ''T D1'', D1 has the form
6281 <pre>
6282 identifier
6283 </pre>
6284 then the type specified for ident is T .
6285 <p><a name="6.7.5p6" href="#6.7.5p6"><small>6</small></a>
6286 If, in the declaration ''T D1'', D1 has the form
6287 <pre>
6288 ( D )
6289 </pre>
6290 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
6291 parentheses is identical to the unparenthesized declarator, but the binding of complicated
6292 declarators may be altered by parentheses.
6293 <p><b>Implementation limits</b>
6294 <p><a name="6.7.5p7" href="#6.7.5p7"><small>7</small></a>
6295 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
6296 function declarators that modify an arithmetic, structure, union, or incomplete type, either
6297 directly or via one or more typedefs.
6298 <p><b> Forward references</b>: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
6300 <p><small><a href="#Contents">Contents</a></small>
6301 <h5><a name="6.7.5.1" href="#6.7.5.1">6.7.5.1 Pointer declarators</a></h5>
6302 <p><b>Semantics</b>
6303 <p><a name="6.7.5.1p1" href="#6.7.5.1p1"><small>1</small></a>
6304 If, in the declaration ''T D1'', D1 has the form
6305 <pre>
6306 * type-qualifier-list<sub>opt</sub> D
6307 </pre>
6308 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6309 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
6310 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
6311 <p><a name="6.7.5.1p2" href="#6.7.5.1p2"><small>2</small></a>
6312 For two pointer types to be compatible, both shall be identically qualified and both shall
6313 be pointers to compatible types.
6314 <p><a name="6.7.5.1p3" href="#6.7.5.1p3"><small>3</small></a>
6315 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
6316 to a constant value'' and a ''constant pointer to a variable value''.
6317 <!--page 128 -->
6318 <pre>
6319 const int *ptr_to_constant;
6320 int *const constant_ptr;
6321 </pre>
6322 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
6323 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
6324 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
6325 same location.
6326 <p><a name="6.7.5.1p4" href="#6.7.5.1p4"><small>4</small></a>
6327 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
6328 type ''pointer to int''.
6329 <pre>
6330 typedef int *int_ptr;
6331 const int_ptr constant_ptr;
6332 </pre>
6333 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
6336 <p><small><a href="#Contents">Contents</a></small>
6337 <h5><a name="6.7.5.2" href="#6.7.5.2">6.7.5.2 Array declarators</a></h5>
6338 <p><b>Constraints</b>
6339 <p><a name="6.7.5.2p1" href="#6.7.5.2p1"><small>1</small></a>
6340 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
6341 an expression or *. If they delimit an expression (which specifies the size of an array), the
6342 expression shall have an integer type. If the expression is a constant expression, it shall
6343 have a value greater than zero. The element type shall not be an incomplete or function
6344 type. The optional type qualifiers and the keyword static shall appear only in a
6345 declaration of a function parameter with an array type, and then only in the outermost
6346 array type derivation.
6347 <p><a name="6.7.5.2p2" href="#6.7.5.2p2"><small>2</small></a>
6348 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
6349 either block scope and no linkage or function prototype scope. If an identifier is declared
6350 to be an object with static storage duration, it shall not have a variable length array type.
6351 <p><b>Semantics</b>
6352 <p><a name="6.7.5.2p3" href="#6.7.5.2p3"><small>3</small></a>
6353 If, in the declaration ''T D1'', D1 has one of the forms:
6354 <pre>
6355 D[ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
6356 D[ static type-qualifier-list<sub>opt</sub> assignment-expression ]
6357 D[ type-qualifier-list static assignment-expression ]
6358 D[ type-qualifier-list<sub>opt</sub> * ]
6359 </pre>
6360 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6361 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note123"><b>123)</b></a></sup>
6362 (See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
6363 <p><a name="6.7.5.2p4" href="#6.7.5.2p4"><small>4</small></a>
6364 If the size is not present, the array type is an incomplete type. If the size is * instead of
6365 being an expression, the array type is a variable length array type of unspecified size,
6366 which can only be used in declarations with function prototype scope;<sup><a href="#note124"><b>124)</b></a></sup> such arrays are
6367 nonetheless complete types. If the size is an integer constant expression and the element
6369 <!--page 129 -->
6370 type has a known constant size, the array type is not a variable length array type;
6371 otherwise, the array type is a variable length array type.
6372 <p><a name="6.7.5.2p5" href="#6.7.5.2p5"><small>5</small></a>
6373 If the size is an expression that is not an integer constant expression: if it occurs in a
6374 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
6375 each time it is evaluated it shall have a value greater than zero. The size of each instance
6376 of a variable length array type does not change during its lifetime. Where a size
6377 expression is part of the operand of a sizeof operator and changing the value of the
6378 size expression would not affect the result of the operator, it is unspecified whether or not
6379 the size expression is evaluated.
6380 <p><a name="6.7.5.2p6" href="#6.7.5.2p6"><small>6</small></a>
6381 For two array types to be compatible, both shall have compatible element types, and if
6382 both size specifiers are present, and are integer constant expressions, then both size
6383 specifiers shall have the same constant value. If the two array types are used in a context
6384 which requires them to be compatible, it is undefined behavior if the two size specifiers
6385 evaluate to unequal values.
6386 <p><a name="6.7.5.2p7" href="#6.7.5.2p7"><small>7</small></a>
6387 EXAMPLE 1
6388 <pre>
6389 float fa[11], *afp[17];
6390 </pre>
6391 declares an array of float numbers and an array of pointers to float numbers.
6393 <p><a name="6.7.5.2p8" href="#6.7.5.2p8"><small>8</small></a>
6394 EXAMPLE 2 Note the distinction between the declarations
6395 <pre>
6396 extern int *x;
6397 extern int y[];
6398 </pre>
6399 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
6400 (an incomplete type), the storage for which is defined elsewhere.
6402 <p><a name="6.7.5.2p9" href="#6.7.5.2p9"><small>9</small></a>
6403 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
6404 <pre>
6405 extern int n;
6406 extern int m;
6407 void fcompat(void)
6409 int a[n][6][m];
6410 int (*p)[4][n+1];
6411 int c[n][n][6][m];
6412 int (*r)[n][n][n+1];
6413 p = a; // invalid: not compatible because 4 != 6
6414 r = c; // compatible, but defined behavior only if
6415 // n == 6 and m == n+1
6417 </pre>
6422 <!--page 130 -->
6423 <p><a name="6.7.5.2p10" href="#6.7.5.2p10"><small>10</small></a>
6424 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
6425 function prototype scope. Array objects declared with the static or extern storage-class specifier
6426 cannot have a variable length array (VLA) type. However, an object declared with the static storage-
6427 class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all identifiers declared with a
6428 VM type have to be ordinary identifiers and cannot, therefore, be members of structures or unions.
6429 <pre>
6430 extern int n;
6431 int A[n]; // invalid: file scope VLA
6432 extern int (*p2)[n]; // invalid: file scope VM
6433 int B[100]; // valid: file scope but not VM
6434 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
6435 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
6437 typedef int VLA[m][m]; // valid: block scope typedef VLA
6438 struct tag {
6439 int (*y)[n]; // invalid: y not ordinary identifier
6440 int z[n]; // invalid: z not ordinary identifier
6442 int D[m]; // valid: auto VLA
6443 static int E[m]; // invalid: static block scope VLA
6444 extern int F[m]; // invalid: F has linkage and is VLA
6445 int (*s)[m]; // valid: auto pointer to VLA
6446 extern int (*r)[m]; // invalid: r has linkage and points to VLA
6447 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
6449 </pre>
6451 <p><b> Forward references</b>: function declarators (<a href="#6.7.5.3">6.7.5.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
6452 initialization (<a href="#6.7.8">6.7.8</a>).
6454 <p><b>Footnotes</b>
6455 <p><small><a name="note123" href="#note123">123)</a> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
6456 </small>
6457 <p><small><a name="note124" href="#note124">124)</a> Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.5.3">6.7.5.3</a>).
6458 </small>
6460 <p><small><a href="#Contents">Contents</a></small>
6461 <h5><a name="6.7.5.3" href="#6.7.5.3">6.7.5.3 Function declarators (including prototypes)</a></h5>
6462 <p><b>Constraints</b>
6463 <p><a name="6.7.5.3p1" href="#6.7.5.3p1"><small>1</small></a>
6464 A function declarator shall not specify a return type that is a function type or an array
6465 type.
6466 <p><a name="6.7.5.3p2" href="#6.7.5.3p2"><small>2</small></a>
6467 The only storage-class specifier that shall occur in a parameter declaration is register.
6468 <p><a name="6.7.5.3p3" href="#6.7.5.3p3"><small>3</small></a>
6469 An identifier list in a function declarator that is not part of a definition of that function
6470 shall be empty.
6471 <p><a name="6.7.5.3p4" href="#6.7.5.3p4"><small>4</small></a>
6472 After adjustment, the parameters in a parameter type list in a function declarator that is
6473 part of a definition of that function shall not have incomplete type.
6474 <p><b>Semantics</b>
6475 <p><a name="6.7.5.3p5" href="#6.7.5.3p5"><small>5</small></a>
6476 If, in the declaration ''T D1'', D1 has the form
6477 <pre>
6478 D( parameter-type-list )
6479 </pre>
6481 <!--page 131 -->
6482 <pre>
6483 D( identifier-list<sub>opt</sub> )
6484 </pre>
6485 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
6486 T '', then the type specified for ident is ''derived-declarator-type-list function returning
6487 T ''.
6488 <p><a name="6.7.5.3p6" href="#6.7.5.3p6"><small>6</small></a>
6489 A parameter type list specifies the types of, and may declare identifiers for, the
6490 parameters of the function.
6491 <p><a name="6.7.5.3p7" href="#6.7.5.3p7"><small>7</small></a>
6492 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
6493 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
6494 array type derivation. If the keyword static also appears within the [ and ] of the
6495 array type derivation, then for each call to the function, the value of the corresponding
6496 actual argument shall provide access to the first element of an array with at least as many
6497 elements as specified by the size expression.
6498 <p><a name="6.7.5.3p8" href="#6.7.5.3p8"><small>8</small></a>
6499 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
6500 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
6501 <p><a name="6.7.5.3p9" href="#6.7.5.3p9"><small>9</small></a>
6502 If the list terminates with an ellipsis (, ...), no information about the number or types
6503 of the parameters after the comma is supplied.<sup><a href="#note125"><b>125)</b></a></sup>
6504 <p><a name="6.7.5.3p10" href="#6.7.5.3p10"><small>10</small></a>
6505 The special case of an unnamed parameter of type void as the only item in the list
6506 specifies that the function has no parameters.
6507 <p><a name="6.7.5.3p11" href="#6.7.5.3p11"><small>11</small></a>
6508 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
6509 parameter name, it shall be taken as a typedef name.
6510 <p><a name="6.7.5.3p12" href="#6.7.5.3p12"><small>12</small></a>
6511 If the function declarator is not part of a definition of that function, parameters may have
6512 incomplete type and may use the [*] notation in their sequences of declarator specifiers
6513 to specify variable length array types.
6514 <p><a name="6.7.5.3p13" href="#6.7.5.3p13"><small>13</small></a>
6515 The storage-class specifier in the declaration specifiers for a parameter declaration, if
6516 present, is ignored unless the declared parameter is one of the members of the parameter
6517 type list for a function definition.
6518 <p><a name="6.7.5.3p14" href="#6.7.5.3p14"><small>14</small></a>
6519 An identifier list declares only the identifiers of the parameters of the function. An empty
6520 list in a function declarator that is part of a definition of that function specifies that the
6521 function has no parameters. The empty list in a function declarator that is not part of a
6522 definition of that function specifies that no information about the number or types of the
6523 parameters is supplied.<sup><a href="#note126"><b>126)</b></a></sup>
6524 <p><a name="6.7.5.3p15" href="#6.7.5.3p15"><small>15</small></a>
6525 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note127"><b>127)</b></a></sup>
6528 <!--page 132 -->
6529 Moreover, the parameter type lists, if both are present, shall agree in the number of
6530 parameters and in use of the ellipsis terminator; corresponding parameters shall have
6531 compatible types. If one type has a parameter type list and the other type is specified by a
6532 function declarator that is not part of a function definition and that contains an empty
6533 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
6534 parameter shall be compatible with the type that results from the application of the
6535 default argument promotions. If one type has a parameter type list and the other type is
6536 specified by a function definition that contains a (possibly empty) identifier list, both shall
6537 agree in the number of parameters, and the type of each prototype parameter shall be
6538 compatible with the type that results from the application of the default argument
6539 promotions to the type of the corresponding identifier. (In the determination of type
6540 compatibility and of a composite type, each parameter declared with function or array
6541 type is taken as having the adjusted type and each parameter declared with qualified type
6542 is taken as having the unqualified version of its declared type.)
6543 <p><a name="6.7.5.3p16" href="#6.7.5.3p16"><small>16</small></a>
6544 EXAMPLE 1 The declaration
6545 <pre>
6546 int f(void), *fip(), (*pfi)();
6547 </pre>
6548 declares a function f with no parameters returning an int, a function fip with no parameter specification
6549 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
6550 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
6551 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
6552 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
6553 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
6554 designator, which is then used to call the function; it returns an int.
6555 <p><a name="6.7.5.3p17" href="#6.7.5.3p17"><small>17</small></a>
6556 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
6557 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
6558 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
6559 the identifier of the pointer pfi has block scope and no linkage.
6561 <p><a name="6.7.5.3p18" href="#6.7.5.3p18"><small>18</small></a>
6562 EXAMPLE 2 The declaration
6563 <pre>
6564 int (*apfi[3])(int *x, int *y);
6565 </pre>
6566 declares an array apfi of three pointers to functions returning int. Each of these functions has two
6567 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
6568 go out of scope at the end of the declaration of apfi.
6570 <p><a name="6.7.5.3p19" href="#6.7.5.3p19"><small>19</small></a>
6571 EXAMPLE 3 The declaration
6572 <pre>
6573 int (*fpfi(int (*)(long), int))(int, ...);
6574 </pre>
6575 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
6576 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
6577 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
6578 additional arguments of any type.
6579 <!--page 133 -->
6580 <p><a name="6.7.5.3p20" href="#6.7.5.3p20"><small>20</small></a>
6581 EXAMPLE 4 The following prototype has a variably modified parameter.
6582 <pre>
6583 void addscalar(int n, int m,
6584 double a[n][n*m+300], double x);
6585 int main()
6587 double b[4][308];
6588 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
6589 return 0;
6591 void addscalar(int n, int m,
6592 double a[n][n*m+300], double x)
6594 for (int i = 0; i &lt; n; i++)
6595 for (int j = 0, k = n*m+300; j &lt; k; j++)
6596 // a is a pointer to a VLA with n*m+300 elements
6597 a[i][j] += x;
6599 </pre>
6601 <p><a name="6.7.5.3p21" href="#6.7.5.3p21"><small>21</small></a>
6602 EXAMPLE 5 The following are all compatible function prototype declarators.
6603 <pre>
6604 double maximum(int n, int m, double a[n][m]);
6605 double maximum(int n, int m, double a[*][*]);
6606 double maximum(int n, int m, double a[ ][*]);
6607 double maximum(int n, int m, double a[ ][m]);
6608 </pre>
6609 as are:
6610 <pre>
6611 void f(double (* restrict a)[5]);
6612 void f(double a[restrict][5]);
6613 void f(double a[restrict 3][5]);
6614 void f(double a[restrict static 3][5]);
6615 </pre>
6616 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
6617 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
6619 <p><b> Forward references</b>: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
6620 <!--page 134 -->
6622 <p><b>Footnotes</b>
6623 <p><small><a name="note125" href="#note125">125)</a> The macros defined in the <a href="#7.15">&lt;stdarg.h&gt;</a> header (<a href="#7.15">7.15</a>) may be used to access arguments that
6624 correspond to the ellipsis.
6625 </small>
6626 <p><small><a name="note126" href="#note126">126)</a> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
6627 </small>
6628 <p><small><a name="note127" href="#note127">127)</a> If both function types are ''old style'', parameter types are not compared.
6629 </small>
6631 <p><small><a href="#Contents">Contents</a></small>
6632 <h4><a name="6.7.6" href="#6.7.6">6.7.6 Type names</a></h4>
6633 <p><b>Syntax</b>
6634 <p><a name="6.7.6p1" href="#6.7.6p1"><small>1</small></a>
6635 <pre>
6636 type-name:
6637 specifier-qualifier-list abstract-declarator<sub>opt</sub>
6638 abstract-declarator:
6639 pointer
6640 pointer<sub>opt</sub> direct-abstract-declarator
6641 direct-abstract-declarator:
6642 ( abstract-declarator )
6643 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
6644 assignment-expression<sub>opt</sub> ]
6645 direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
6646 assignment-expression ]
6647 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
6648 assignment-expression ]
6649 direct-abstract-declarator<sub>opt</sub> [ * ]
6650 direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )
6651 </pre>
6652 <p><b>Semantics</b>
6653 <p><a name="6.7.6p2" href="#6.7.6p2"><small>2</small></a>
6654 In several contexts, it is necessary to specify a type. This is accomplished using a type
6655 name, which is syntactically a declaration for a function or an object of that type that
6656 omits the identifier.<sup><a href="#note128"><b>128)</b></a></sup>
6657 <p><a name="6.7.6p3" href="#6.7.6p3"><small>3</small></a>
6658 EXAMPLE The constructions
6659 <pre>
6660 (a) int
6661 (b) int *
6662 (c) int *[3]
6663 (d) int (*)[3]
6664 (e) int (*)[*]
6665 (f) int *()
6666 (g) int (*)(void)
6667 (h) int (*const [])(unsigned int, ...)
6668 </pre>
6669 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
6670 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
6671 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
6672 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
6673 parameter that has type unsigned int and an unspecified number of other parameters, returning an
6674 int.
6679 <!--page 135 -->
6681 <p><b>Footnotes</b>
6682 <p><small><a name="note128" href="#note128">128)</a> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
6683 parameter specification'', rather than redundant parentheses around the omitted identifier.
6684 </small>
6686 <p><small><a href="#Contents">Contents</a></small>
6687 <h4><a name="6.7.7" href="#6.7.7">6.7.7 Type definitions</a></h4>
6688 <p><b>Syntax</b>
6689 <p><a name="6.7.7p1" href="#6.7.7p1"><small>1</small></a>
6690 <pre>
6691 typedef-name:
6692 identifier
6693 </pre>
6694 <p><b>Constraints</b>
6695 <p><a name="6.7.7p2" href="#6.7.7p2"><small>2</small></a>
6696 If a typedef name specifies a variably modified type then it shall have block scope.
6697 <p><b>Semantics</b>
6698 <p><a name="6.7.7p3" href="#6.7.7p3"><small>3</small></a>
6699 In a declaration whose storage-class specifier is typedef, each declarator defines an
6700 identifier to be a typedef name that denotes the type specified for the identifier in the way
6701 described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
6702 declarators are evaluated each time the declaration of the typedef name is reached in the
6703 order of execution. A typedef declaration does not introduce a new type, only a
6704 synonym for the type so specified. That is, in the following declarations:
6705 <pre>
6706 typedef T type_ident;
6707 type_ident D;
6708 </pre>
6709 type_ident is defined as a typedef name with the type specified by the declaration
6710 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
6711 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
6712 typedef name shares the same name space as other identifiers declared in ordinary
6713 declarators.
6714 <p><a name="6.7.7p4" href="#6.7.7p4"><small>4</small></a>
6715 EXAMPLE 1 After
6716 <pre>
6717 typedef int MILES, KLICKSP();
6718 typedef struct { double hi, lo; } range;
6719 </pre>
6720 the constructions
6721 <pre>
6722 MILES distance;
6723 extern KLICKSP *metricp;
6724 range x;
6725 range z, *zp;
6726 </pre>
6727 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
6728 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
6729 such a structure. The object distance has a type compatible with any other int object.
6731 <p><a name="6.7.7p5" href="#6.7.7p5"><small>5</small></a>
6732 EXAMPLE 2 After the declarations
6733 <pre>
6734 typedef struct s1 { int x; } t1, *tp1;
6735 typedef struct s2 { int x; } t2, *tp2;
6736 </pre>
6737 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
6738 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
6739 <!--page 136 -->
6740 <p><a name="6.7.7p6" href="#6.7.7p6"><small>6</small></a>
6741 EXAMPLE 3 The following obscure constructions
6742 <pre>
6743 typedef signed int t;
6744 typedef int plain;
6745 struct tag {
6746 unsigned t:4;
6747 const t:5;
6748 plain r:5;
6750 </pre>
6751 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
6752 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
6753 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
6754 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
6755 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
6756 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
6757 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
6758 in an inner scope by
6759 <pre>
6760 t f(t (t));
6761 long t;
6762 </pre>
6763 then a function f is declared with type ''function returning signed int with one unnamed parameter
6764 with type pointer to function returning signed int with one unnamed parameter with type signed
6765 int'', and an identifier t with type long int.
6767 <p><a name="6.7.7p7" href="#6.7.7p7"><small>7</small></a>
6768 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
6769 following declarations of the signal function specify exactly the same type, the first without making use
6770 of any typedef names.
6771 <pre>
6772 typedef void fv(int), (*pfv)(int);
6773 void (*signal(int, void (*)(int)))(int);
6774 fv *signal(int, fv *);
6775 pfv signal(int, pfv);
6776 </pre>
6778 <p><a name="6.7.7p8" href="#6.7.7p8"><small>8</small></a>
6779 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
6780 time the typedef name is defined, not each time it is used:
6781 <!--page 137 -->
6782 <pre>
6783 void copyt(int n)
6785 typedef int B[n]; // B is n ints, n evaluated now
6786 n += 1;
6787 B a; // a is n ints, n without += 1
6788 int b[n]; // a and b are different sizes
6789 for (int i = 1; i &lt; n; i++)
6790 a[i-1] = b[i];
6792 </pre>
6794 <p><small><a href="#Contents">Contents</a></small>
6795 <h4><a name="6.7.8" href="#6.7.8">6.7.8 Initialization</a></h4>
6796 <p><b>Syntax</b>
6797 <p><a name="6.7.8p1" href="#6.7.8p1"><small>1</small></a>
6798 <pre>
6799 initializer:
6800 assignment-expression
6801 { initializer-list }
6802 { initializer-list , }
6803 initializer-list:
6804 designation<sub>opt</sub> initializer
6805 initializer-list , designation<sub>opt</sub> initializer
6806 designation:
6807 designator-list =
6808 designator-list:
6809 designator
6810 designator-list designator
6811 designator:
6812 [ constant-expression ]
6813 . identifier
6814 </pre>
6815 <p><b>Constraints</b>
6816 <p><a name="6.7.8p2" href="#6.7.8p2"><small>2</small></a>
6817 No initializer shall attempt to provide a value for an object not contained within the entity
6818 being initialized.
6819 <p><a name="6.7.8p3" href="#6.7.8p3"><small>3</small></a>
6820 The type of the entity to be initialized shall be an array of unknown size or an object type
6821 that is not a variable length array type.
6822 <p><a name="6.7.8p4" href="#6.7.8p4"><small>4</small></a>
6823 All the expressions in an initializer for an object that has static storage duration shall be
6824 constant expressions or string literals.
6825 <p><a name="6.7.8p5" href="#6.7.8p5"><small>5</small></a>
6826 If the declaration of an identifier has block scope, and the identifier has external or
6827 internal linkage, the declaration shall have no initializer for the identifier.
6828 <p><a name="6.7.8p6" href="#6.7.8p6"><small>6</small></a>
6829 If a designator has the form
6830 <pre>
6831 [ constant-expression ]
6832 </pre>
6833 then the current object (defined below) shall have array type and the expression shall be
6834 an integer constant expression. If the array is of unknown size, any nonnegative value is
6835 valid.
6836 <p><a name="6.7.8p7" href="#6.7.8p7"><small>7</small></a>
6837 If a designator has the form
6838 <pre>
6839 . identifier
6840 </pre>
6841 then the current object (defined below) shall have structure or union type and the
6842 identifier shall be the name of a member of that type.
6843 <!--page 138 -->
6844 <p><b>Semantics</b>
6845 <p><a name="6.7.8p8" href="#6.7.8p8"><small>8</small></a>
6846 An initializer specifies the initial value stored in an object.
6847 <p><a name="6.7.8p9" href="#6.7.8p9"><small>9</small></a>
6848 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
6849 members of objects of structure and union type do not participate in initialization.
6850 Unnamed members of structure objects have indeterminate value even after initialization.
6851 <p><a name="6.7.8p10" href="#6.7.8p10"><small>10</small></a>
6852 If an object that has automatic storage duration is not initialized explicitly, its value is
6853 indeterminate. If an object that has static storage duration is not initialized explicitly,
6854 then:
6855 <ul>
6856 <li> if it has pointer type, it is initialized to a null pointer;
6857 <li> if it has arithmetic type, it is initialized to (positive or unsigned) zero;
6858 <li> if it is an aggregate, every member is initialized (recursively) according to these rules;
6859 <li> if it is a union, the first named member is initialized (recursively) according to these
6860 rules.
6861 </ul>
6862 <p><a name="6.7.8p11" href="#6.7.8p11"><small>11</small></a>
6863 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
6864 initial value of the object is that of the expression (after conversion); the same type
6865 constraints and conversions as for simple assignment apply, taking the type of the scalar
6866 to be the unqualified version of its declared type.
6867 <p><a name="6.7.8p12" href="#6.7.8p12"><small>12</small></a>
6868 The rest of this subclause deals with initializers for objects that have aggregate or union
6869 type.
6870 <p><a name="6.7.8p13" href="#6.7.8p13"><small>13</small></a>
6871 The initializer for a structure or union object that has automatic storage duration shall be
6872 either an initializer list as described below, or a single expression that has compatible
6873 structure or union type. In the latter case, the initial value of the object, including
6874 unnamed members, is that of the expression.
6875 <p><a name="6.7.8p14" href="#6.7.8p14"><small>14</small></a>
6876 An array of character type may be initialized by a character string literal, optionally
6877 enclosed in braces. Successive characters of the character string literal (including the
6878 terminating null character if there is room or if the array is of unknown size) initialize the
6879 elements of the array.
6880 <p><a name="6.7.8p15" href="#6.7.8p15"><small>15</small></a>
6881 An array with element type compatible with wchar_t may be initialized by a wide
6882 string literal, optionally enclosed in braces. Successive wide characters of the wide string
6883 literal (including the terminating null wide character if there is room or if the array is of
6884 unknown size) initialize the elements of the array.
6885 <p><a name="6.7.8p16" href="#6.7.8p16"><small>16</small></a>
6886 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
6887 enclosed list of initializers for the elements or named members.
6888 <p><a name="6.7.8p17" href="#6.7.8p17"><small>17</small></a>
6889 Each brace-enclosed initializer list has an associated current object. When no
6890 designations are present, subobjects of the current object are initialized in order according
6891 to the type of the current object: array elements in increasing subscript order, structure
6892 <!--page 139 -->
6893 members in declaration order, and the first named member of a union.<sup><a href="#note129"><b>129)</b></a></sup> In contrast, a
6894 designation causes the following initializer to begin initialization of the subobject
6895 described by the designator. Initialization then continues forward in order, beginning
6896 with the next subobject after that described by the designator.<sup><a href="#note130"><b>130)</b></a></sup>
6897 <p><a name="6.7.8p18" href="#6.7.8p18"><small>18</small></a>
6898 Each designator list begins its description with the current object associated with the
6899 closest surrounding brace pair. Each item in the designator list (in order) specifies a
6900 particular member of its current object and changes the current object for the next
6901 designator (if any) to be that member.<sup><a href="#note131"><b>131)</b></a></sup> The current object that results at the end of the
6902 designator list is the subobject to be initialized by the following initializer.
6903 <p><a name="6.7.8p19" href="#6.7.8p19"><small>19</small></a>
6904 The initialization shall occur in initializer list order, each initializer provided for a
6905 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note132"><b>132)</b></a></sup>
6906 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
6907 objects that have static storage duration.
6908 <p><a name="6.7.8p20" href="#6.7.8p20"><small>20</small></a>
6909 If the aggregate or union contains elements or members that are aggregates or unions,
6910 these rules apply recursively to the subaggregates or contained unions. If the initializer of
6911 a subaggregate or contained union begins with a left brace, the initializers enclosed by
6912 that brace and its matching right brace initialize the elements or members of the
6913 subaggregate or the contained union. Otherwise, only enough initializers from the list are
6914 taken to account for the elements or members of the subaggregate or the first member of
6915 the contained union; any remaining initializers are left to initialize the next element or
6916 member of the aggregate of which the current subaggregate or contained union is a part.
6917 <p><a name="6.7.8p21" href="#6.7.8p21"><small>21</small></a>
6918 If there are fewer initializers in a brace-enclosed list than there are elements or members
6919 of an aggregate, or fewer characters in a string literal used to initialize an array of known
6920 size than there are elements in the array, the remainder of the aggregate shall be
6921 initialized implicitly the same as objects that have static storage duration.
6922 <p><a name="6.7.8p22" href="#6.7.8p22"><small>22</small></a>
6923 If an array of unknown size is initialized, its size is determined by the largest indexed
6924 element with an explicit initializer. At the end of its initializer list, the array no longer
6925 has incomplete type.
6929 <!--page 140 -->
6930 <p><a name="6.7.8p23" href="#6.7.8p23"><small>23</small></a>
6931 The order in which any side effects occur among the initialization list expressions is
6932 unspecified.<sup><a href="#note133"><b>133)</b></a></sup>
6933 <p><a name="6.7.8p24" href="#6.7.8p24"><small>24</small></a>
6934 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
6935 <pre>
6936 int i = <a href="#3.5">3.5</a>;
6937 double complex c = 5 + 3 * I;
6938 </pre>
6939 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
6941 <p><a name="6.7.8p25" href="#6.7.8p25"><small>25</small></a>
6942 EXAMPLE 2 The declaration
6943 <pre>
6944 int x[] = { 1, 3, 5 };
6945 </pre>
6946 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
6947 and there are three initializers.
6949 <p><a name="6.7.8p26" href="#6.7.8p26"><small>26</small></a>
6950 EXAMPLE 3 The declaration
6951 <pre>
6952 int y[4][3] = {
6953 { 1, 3, 5 },
6954 { 2, 4, 6 },
6955 { 3, 5, 7 },
6957 </pre>
6958 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
6959 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
6960 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
6961 been achieved by
6962 <pre>
6963 int y[4][3] = {
6964 1, 3, 5, 2, 4, 6, 3, 5, 7
6966 </pre>
6967 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
6968 next three are taken successively for y[1] and y[2].
6970 <p><a name="6.7.8p27" href="#6.7.8p27"><small>27</small></a>
6971 EXAMPLE 4 The declaration
6972 <pre>
6973 int z[4][3] = {
6974 { 1 }, { 2 }, { 3 }, { 4 }
6976 </pre>
6977 initializes the first column of z as specified and initializes the rest with zeros.
6979 <p><a name="6.7.8p28" href="#6.7.8p28"><small>28</small></a>
6980 EXAMPLE 5 The declaration
6981 <pre>
6982 struct { int a[3], b; } w[] = { { 1 }, 2 };
6983 </pre>
6984 is a definition with an inconsistently bracketed initialization. It defines an array with two element
6985 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
6990 <!--page 141 -->
6991 <p><a name="6.7.8p29" href="#6.7.8p29"><small>29</small></a>
6992 EXAMPLE 6 The declaration
6993 <pre>
6994 short q[4][3][2] = {
6995 { 1 },
6996 { 2, 3 },
6997 { 4, 5, 6 }
6999 </pre>
7000 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
7001 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
7002 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
7003 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
7004 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
7005 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
7006 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
7007 diagnostic message would have been issued. The same initialization result could have been achieved by:
7008 <pre>
7009 short q[4][3][2] = {
7010 1, 0, 0, 0, 0, 0,
7011 2, 3, 0, 0, 0, 0,
7012 4, 5, 6
7014 </pre>
7015 or by:
7016 <pre>
7017 short q[4][3][2] = {
7019 { 1 },
7022 { 2, 3 },
7025 { 4, 5 },
7026 { 6 },
7029 </pre>
7030 in a fully bracketed form.
7031 <p><a name="6.7.8p30" href="#6.7.8p30"><small>30</small></a>
7032 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
7033 cause confusion.
7035 <p><a name="6.7.8p31" href="#6.7.8p31"><small>31</small></a>
7036 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
7037 declaration
7038 <pre>
7039 typedef int A[]; // OK - declared with block scope
7040 </pre>
7041 the declaration
7042 <pre>
7043 A a = { 1, 2 }, b = { 3, 4, 5 };
7044 </pre>
7045 is identical to
7046 <pre>
7047 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
7048 </pre>
7049 due to the rules for incomplete types.
7050 <!--page 142 -->
7051 <p><a name="6.7.8p32" href="#6.7.8p32"><small>32</small></a>
7052 EXAMPLE 8 The declaration
7053 <pre>
7054 char s[] = "abc", t[3] = "abc";
7055 </pre>
7056 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
7057 This declaration is identical to
7058 <pre>
7059 char s[] = { 'a', 'b', 'c', '\0' },
7060 t[] = { 'a', 'b', 'c' };
7061 </pre>
7062 The contents of the arrays are modifiable. On the other hand, the declaration
7063 <pre>
7064 char *p = "abc";
7065 </pre>
7066 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
7067 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
7068 modify the contents of the array, the behavior is undefined.
7070 <p><a name="6.7.8p33" href="#6.7.8p33"><small>33</small></a>
7071 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
7072 designators:
7073 <pre>
7074 enum { member_one, member_two };
7075 const char *nm[] = {
7076 [member_two] = "member two",
7077 [member_one] = "member one",
7079 </pre>
7081 <p><a name="6.7.8p34" href="#6.7.8p34"><small>34</small></a>
7082 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
7083 <pre>
7084 div_t answer = { .quot = 2, .rem = -1 };
7085 </pre>
7087 <p><a name="6.7.8p35" href="#6.7.8p35"><small>35</small></a>
7088 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
7089 might be misunderstood:
7090 <pre>
7091 struct { int a[3], b; } w[] =
7092 { [0].a = {1}, [1].a[0] = 2 };
7093 </pre>
7095 <p><a name="6.7.8p36" href="#6.7.8p36"><small>36</small></a>
7096 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
7097 <pre>
7098 int a[MAX] = {
7099 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
7101 </pre>
7102 <p><a name="6.7.8p37" href="#6.7.8p37"><small>37</small></a>
7103 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
7104 than ten, some of the values provided by the first five initializers will be overridden by the second five.
7106 <p><a name="6.7.8p38" href="#6.7.8p38"><small>38</small></a>
7107 EXAMPLE 13 Any member of a union can be initialized:
7108 <pre>
7109 union { /* ... */ } u = { .any_member = 42 };
7110 </pre>
7112 <p><b> Forward references</b>: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>).
7113 <!--page 143 -->
7115 <p><b>Footnotes</b>
7116 <p><small><a name="note129" href="#note129">129)</a> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
7117 subobjects are initialized as usual, but the subaggregate or contained union does not become the
7118 current object: current objects are associated only with brace-enclosed initializer lists.
7119 </small>
7120 <p><small><a name="note130" href="#note130">130)</a> After a union member is initialized, the next object is not the next member of the union; instead, it is
7121 the next subobject of an object containing the union.
7122 </small>
7123 <p><small><a name="note131" href="#note131">131)</a> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
7124 the surrounding brace pair. Note, too, that each separate designator list is independent.
7125 </small>
7126 <p><small><a name="note132" href="#note132">132)</a> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
7127 not be evaluated at all.
7128 </small>
7129 <p><small><a name="note133" href="#note133">133)</a> In particular, the evaluation order need not be the same as the order of subobject initialization.
7130 </small>
7132 <p><small><a href="#Contents">Contents</a></small>
7133 <h3><a name="6.8" href="#6.8">6.8 Statements and blocks</a></h3>
7134 <p><b>Syntax</b>
7135 <p><a name="6.8p1" href="#6.8p1"><small>1</small></a>
7136 <pre>
7137 statement:
7138 labeled-statement
7139 compound-statement
7140 expression-statement
7141 selection-statement
7142 iteration-statement
7143 jump-statement
7144 </pre>
7145 <p><b>Semantics</b>
7146 <p><a name="6.8p2" href="#6.8p2"><small>2</small></a>
7147 A statement specifies an action to be performed. Except as indicated, statements are
7148 executed in sequence.
7149 <p><a name="6.8p3" href="#6.8p3"><small>3</small></a>
7150 A block allows a set of declarations and statements to be grouped into one syntactic unit.
7151 The initializers of objects that have automatic storage duration, and the variable length
7152 array declarators of ordinary identifiers with block scope, are evaluated and the values are
7153 stored in the objects (including storing an indeterminate value in objects without an
7154 initializer) each time the declaration is reached in the order of execution, as if it were a
7155 statement, and within each declaration in the order that declarators appear.
7156 <p><a name="6.8p4" href="#6.8p4"><small>4</small></a>
7157 A full expression is an expression that is not part of another expression or of a declarator.
7158 Each of the following is a full expression: an initializer; the expression in an expression
7159 statement; the controlling expression of a selection statement (if or switch); the
7160 controlling expression of a while or do statement; each of the (optional) expressions of
7161 a for statement; the (optional) expression in a return statement. The end of a full
7162 expression is a sequence point.
7163 <p><b> Forward references</b>: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
7164 (<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>).
7166 <p><small><a href="#Contents">Contents</a></small>
7167 <h4><a name="6.8.1" href="#6.8.1">6.8.1 Labeled statements</a></h4>
7168 <p><b>Syntax</b>
7169 <p><a name="6.8.1p1" href="#6.8.1p1"><small>1</small></a>
7170 <pre>
7171 labeled-statement:
7172 identifier : statement
7173 case constant-expression : statement
7174 default : statement
7175 </pre>
7176 <p><b>Constraints</b>
7177 <p><a name="6.8.1p2" href="#6.8.1p2"><small>2</small></a>
7178 A case or default label shall appear only in a switch statement. Further
7179 constraints on such labels are discussed under the switch statement.
7180 <!--page 144 -->
7181 <p><a name="6.8.1p3" href="#6.8.1p3"><small>3</small></a>
7182 Label names shall be unique within a function.
7183 <p><b>Semantics</b>
7184 <p><a name="6.8.1p4" href="#6.8.1p4"><small>4</small></a>
7185 Any statement may be preceded by a prefix that declares an identifier as a label name.
7186 Labels in themselves do not alter the flow of control, which continues unimpeded across
7187 them.
7188 <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>).
7190 <p><small><a href="#Contents">Contents</a></small>
7191 <h4><a name="6.8.2" href="#6.8.2">6.8.2 Compound statement</a></h4>
7192 <p><b>Syntax</b>
7193 <p><a name="6.8.2p1" href="#6.8.2p1"><small>1</small></a>
7194 <pre>
7195 compound-statement:
7196 { block-item-list<sub>opt</sub> }
7197 block-item-list:
7198 block-item
7199 block-item-list block-item
7200 block-item:
7201 declaration
7202 statement
7203 </pre>
7204 <p><b>Semantics</b>
7205 <p><a name="6.8.2p2" href="#6.8.2p2"><small>2</small></a>
7206 A compound statement is a block.
7208 <p><small><a href="#Contents">Contents</a></small>
7209 <h4><a name="6.8.3" href="#6.8.3">6.8.3 Expression and null statements</a></h4>
7210 <p><b>Syntax</b>
7211 <p><a name="6.8.3p1" href="#6.8.3p1"><small>1</small></a>
7212 <pre>
7213 expression-statement:
7214 expression<sub>opt</sub> ;
7215 </pre>
7216 <p><b>Semantics</b>
7217 <p><a name="6.8.3p2" href="#6.8.3p2"><small>2</small></a>
7218 The expression in an expression statement is evaluated as a void expression for its side
7219 effects.<sup><a href="#note134"><b>134)</b></a></sup>
7220 <p><a name="6.8.3p3" href="#6.8.3p3"><small>3</small></a>
7221 A null statement (consisting of just a semicolon) performs no operations.
7222 <p><a name="6.8.3p4" href="#6.8.3p4"><small>4</small></a>
7223 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
7224 discarding of its value may be made explicit by converting the expression to a void expression by means of
7225 a cast:
7226 <pre>
7227 int p(int);
7228 /* ... */
7229 (void)p(0);
7230 </pre>
7234 <!--page 145 -->
7235 <p><a name="6.8.3p5" href="#6.8.3p5"><small>5</small></a>
7236 EXAMPLE 2 In the program fragment
7237 <pre>
7238 char *s;
7239 /* ... */
7240 while (*s++ != '\0')
7242 </pre>
7243 a null statement is used to supply an empty loop body to the iteration statement.
7245 <p><a name="6.8.3p6" href="#6.8.3p6"><small>6</small></a>
7246 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
7247 statement.
7248 <pre>
7249 while (loop1) {
7250 /* ... */
7251 while (loop2) {
7252 /* ... */
7253 if (want_out)
7254 goto end_loop1;
7255 /* ... */
7257 /* ... */
7258 end_loop1: ;
7260 </pre>
7262 <p><b> Forward references</b>: iteration statements (<a href="#6.8.5">6.8.5</a>).
7264 <p><b>Footnotes</b>
7265 <p><small><a name="note134" href="#note134">134)</a> Such as assignments, and function calls which have side effects.
7266 </small>
7268 <p><small><a href="#Contents">Contents</a></small>
7269 <h4><a name="6.8.4" href="#6.8.4">6.8.4 Selection statements</a></h4>
7270 <p><b>Syntax</b>
7271 <p><a name="6.8.4p1" href="#6.8.4p1"><small>1</small></a>
7272 <pre>
7273 selection-statement:
7274 if ( expression ) statement
7275 if ( expression ) statement else statement
7276 switch ( expression ) statement
7277 </pre>
7278 <p><b>Semantics</b>
7279 <p><a name="6.8.4p2" href="#6.8.4p2"><small>2</small></a>
7280 A selection statement selects among a set of statements depending on the value of a
7281 controlling expression.
7282 <p><a name="6.8.4p3" href="#6.8.4p3"><small>3</small></a>
7283 A selection statement is a block whose scope is a strict subset of the scope of its
7284 enclosing block. Each associated substatement is also a block whose scope is a strict
7285 subset of the scope of the selection statement.
7287 <p><small><a href="#Contents">Contents</a></small>
7288 <h5><a name="6.8.4.1" href="#6.8.4.1">6.8.4.1 The if statement</a></h5>
7289 <p><b>Constraints</b>
7290 <p><a name="6.8.4.1p1" href="#6.8.4.1p1"><small>1</small></a>
7291 The controlling expression of an if statement shall have scalar type.
7292 <p><b>Semantics</b>
7293 <p><a name="6.8.4.1p2" href="#6.8.4.1p2"><small>2</small></a>
7294 In both forms, the first substatement is executed if the expression compares unequal to 0.
7295 In the else form, the second substatement is executed if the expression compares equal
7296 <!--page 146 -->
7297 to 0. If the first substatement is reached via a label, the second substatement is not
7298 executed.
7299 <p><a name="6.8.4.1p3" href="#6.8.4.1p3"><small>3</small></a>
7300 An else is associated with the lexically nearest preceding if that is allowed by the
7301 syntax.
7303 <p><small><a href="#Contents">Contents</a></small>
7304 <h5><a name="6.8.4.2" href="#6.8.4.2">6.8.4.2 The switch statement</a></h5>
7305 <p><b>Constraints</b>
7306 <p><a name="6.8.4.2p1" href="#6.8.4.2p1"><small>1</small></a>
7307 The controlling expression of a switch statement shall have integer type.
7308 <p><a name="6.8.4.2p2" href="#6.8.4.2p2"><small>2</small></a>
7309 If a switch statement has an associated case or default label within the scope of an
7310 identifier with a variably modified type, the entire switch statement shall be within the
7311 scope of that identifier.<sup><a href="#note135"><b>135)</b></a></sup>
7312 <p><a name="6.8.4.2p3" href="#6.8.4.2p3"><small>3</small></a>
7313 The expression of each case label shall be an integer constant expression and no two of
7314 the case constant expressions in the same switch statement shall have the same value
7315 after conversion. There may be at most one default label in a switch statement.
7316 (Any enclosed switch statement may have a default label or case constant
7317 expressions with values that duplicate case constant expressions in the enclosing
7318 switch statement.)
7319 <p><b>Semantics</b>
7320 <p><a name="6.8.4.2p4" href="#6.8.4.2p4"><small>4</small></a>
7321 A switch statement causes control to jump to, into, or past the statement that is the
7322 switch body, depending on the value of a controlling expression, and on the presence of a
7323 default label and the values of any case labels on or in the switch body. A case or
7324 default label is accessible only within the closest enclosing switch statement.
7325 <p><a name="6.8.4.2p5" href="#6.8.4.2p5"><small>5</small></a>
7326 The integer promotions are performed on the controlling expression. The constant
7327 expression in each case label is converted to the promoted type of the controlling
7328 expression. If a converted value matches that of the promoted controlling expression,
7329 control jumps to the statement following the matched case label. Otherwise, if there is
7330 a default label, control jumps to the labeled statement. If no converted case constant
7331 expression matches and there is no default label, no part of the switch body is
7332 executed.
7333 <p><b>Implementation limits</b>
7334 <p><a name="6.8.4.2p6" href="#6.8.4.2p6"><small>6</small></a>
7335 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
7336 switch statement.
7341 <!--page 147 -->
7342 <p><a name="6.8.4.2p7" href="#6.8.4.2p7"><small>7</small></a>
7343 EXAMPLE In the artificial program fragment
7344 <pre>
7345 switch (expr)
7347 int i = 4;
7348 f(i);
7349 case 0:
7350 i = 17;
7351 /* falls through into default code */
7352 default:
7353 printf("%d\n", i);
7355 </pre>
7356 the object whose identifier is i exists with automatic storage duration (within the block) but is never
7357 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
7358 access an indeterminate value. Similarly, the call to the function f cannot be reached.
7361 <p><b>Footnotes</b>
7362 <p><small><a name="note135" href="#note135">135)</a> That is, the declaration either precedes the switch statement, or it follows the last case or
7363 default label associated with the switch that is in the block containing the declaration.
7364 </small>
7366 <p><small><a href="#Contents">Contents</a></small>
7367 <h4><a name="6.8.5" href="#6.8.5">6.8.5 Iteration statements</a></h4>
7368 <p><b>Syntax</b>
7369 <p><a name="6.8.5p1" href="#6.8.5p1"><small>1</small></a>
7370 <pre>
7371 iteration-statement:
7372 while ( expression ) statement
7373 do statement while ( expression ) ;
7374 for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
7375 for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
7376 </pre>
7377 <p><b>Constraints</b>
7378 <p><a name="6.8.5p2" href="#6.8.5p2"><small>2</small></a>
7379 The controlling expression of an iteration statement shall have scalar type.
7380 <p><a name="6.8.5p3" href="#6.8.5p3"><small>3</small></a>
7381 The declaration part of a for statement shall only declare identifiers for objects having
7382 storage class auto or register.
7383 <p><b>Semantics</b>
7384 <p><a name="6.8.5p4" href="#6.8.5p4"><small>4</small></a>
7385 An iteration statement causes a statement called the loop body to be executed repeatedly
7386 until the controlling expression compares equal to 0. The repetition occurs regardless of
7387 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note136"><b>136)</b></a></sup>
7388 <p><a name="6.8.5p5" href="#6.8.5p5"><small>5</small></a>
7389 An iteration statement is a block whose scope is a strict subset of the scope of its
7390 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
7391 of the iteration statement.
7396 <!--page 148 -->
7398 <p><b>Footnotes</b>
7399 <p><small><a name="note136" href="#note136">136)</a> Code jumped over is not executed. In particular, the controlling expression of a for or while
7400 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
7401 </small>
7403 <p><small><a href="#Contents">Contents</a></small>
7404 <h5><a name="6.8.5.1" href="#6.8.5.1">6.8.5.1 The while statement</a></h5>
7405 <p><a name="6.8.5.1p1" href="#6.8.5.1p1"><small>1</small></a>
7406 The evaluation of the controlling expression takes place before each execution of the loop
7407 body.
7409 <p><small><a href="#Contents">Contents</a></small>
7410 <h5><a name="6.8.5.2" href="#6.8.5.2">6.8.5.2 The do statement</a></h5>
7411 <p><a name="6.8.5.2p1" href="#6.8.5.2p1"><small>1</small></a>
7412 The evaluation of the controlling expression takes place after each execution of the loop
7413 body.
7415 <p><small><a href="#Contents">Contents</a></small>
7416 <h5><a name="6.8.5.3" href="#6.8.5.3">6.8.5.3 The for statement</a></h5>
7417 <p><a name="6.8.5.3p1" href="#6.8.5.3p1"><small>1</small></a>
7418 The statement
7419 <pre>
7420 for ( clause-1 ; expression-2 ; expression-3 ) statement
7421 </pre>
7422 behaves as follows: The expression expression-2 is the controlling expression that is
7423 evaluated before each execution of the loop body. The expression expression-3 is
7424 evaluated as a void expression after each execution of the loop body. If clause-1 is a
7425 declaration, the scope of any identifiers it declares is the remainder of the declaration and
7426 the entire loop, including the other two expressions; it is reached in the order of execution
7427 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
7428 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note137"><b>137)</b></a></sup>
7429 <p><a name="6.8.5.3p2" href="#6.8.5.3p2"><small>2</small></a>
7430 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
7431 nonzero constant.
7433 <p><b>Footnotes</b>
7434 <p><small><a name="note137" href="#note137">137)</a> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
7435 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
7436 such that execution of the loop continues until the expression compares equal to 0; and expression-3
7437 specifies an operation (such as incrementing) that is performed after each iteration.
7438 </small>
7440 <p><small><a href="#Contents">Contents</a></small>
7441 <h4><a name="6.8.6" href="#6.8.6">6.8.6 Jump statements</a></h4>
7442 <p><b>Syntax</b>
7443 <p><a name="6.8.6p1" href="#6.8.6p1"><small>1</small></a>
7444 <pre>
7445 jump-statement:
7446 goto identifier ;
7447 continue ;
7448 break ;
7449 return expression<sub>opt</sub> ;
7450 </pre>
7451 <p><b>Semantics</b>
7452 <p><a name="6.8.6p2" href="#6.8.6p2"><small>2</small></a>
7453 A jump statement causes an unconditional jump to another place.
7458 <!--page 149 -->
7460 <p><small><a href="#Contents">Contents</a></small>
7461 <h5><a name="6.8.6.1" href="#6.8.6.1">6.8.6.1 The goto statement</a></h5>
7462 <p><b>Constraints</b>
7463 <p><a name="6.8.6.1p1" href="#6.8.6.1p1"><small>1</small></a>
7464 The identifier in a goto statement shall name a label located somewhere in the enclosing
7465 function. A goto statement shall not jump from outside the scope of an identifier having
7466 a variably modified type to inside the scope of that identifier.
7467 <p><b>Semantics</b>
7468 <p><a name="6.8.6.1p2" href="#6.8.6.1p2"><small>2</small></a>
7469 A goto statement causes an unconditional jump to the statement prefixed by the named
7470 label in the enclosing function.
7471 <p><a name="6.8.6.1p3" href="#6.8.6.1p3"><small>3</small></a>
7472 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
7473 following outline presents one possible approach to a problem based on these three assumptions:
7474 <ol>
7475 <li> The general initialization code accesses objects only visible to the current function.
7476 <li> The general initialization code is too large to warrant duplication.
7477 <li> The code to determine the next operation is at the head of the loop. (To allow it to be reached by
7478 continue statements, for example.)
7479 <pre>
7480 /* ... */
7481 goto first_time;
7482 for (;;) {
7483 // determine next operation
7484 /* ... */
7485 if (need to reinitialize) {
7486 // reinitialize-only code
7487 /* ... */
7488 first_time:
7489 // general initialization code
7490 /* ... */
7491 continue;
7493 // handle other operations
7494 /* ... */
7496 </pre>
7497 <!--page 150 -->
7498 </ol>
7499 <p><a name="6.8.6.1p4" href="#6.8.6.1p4"><small>4</small></a>
7500 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
7501 modified types. A jump within the scope, however, is permitted.
7502 <pre>
7503 goto lab3; // invalid: going INTO scope of VLA.
7505 double a[n];
7506 a[j] = <a href="#4.4">4.4</a>;
7507 lab3:
7508 a[j] = <a href="#3.3">3.3</a>;
7509 goto lab4; // valid: going WITHIN scope of VLA.
7510 a[j] = <a href="#5.5">5.5</a>;
7511 lab4:
7512 a[j] = <a href="#6.6">6.6</a>;
7514 goto lab4; // invalid: going INTO scope of VLA.
7515 </pre>
7518 <p><small><a href="#Contents">Contents</a></small>
7519 <h5><a name="6.8.6.2" href="#6.8.6.2">6.8.6.2 The continue statement</a></h5>
7520 <p><b>Constraints</b>
7521 <p><a name="6.8.6.2p1" href="#6.8.6.2p1"><small>1</small></a>
7522 A continue statement shall appear only in or as a loop body.
7523 <p><b>Semantics</b>
7524 <p><a name="6.8.6.2p2" href="#6.8.6.2p2"><small>2</small></a>
7525 A continue statement causes a jump to the loop-continuation portion of the smallest
7526 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
7527 of the statements
7528 <pre>
7529 while (/* ... */) { do { for (/* ... */) {
7530 /* ... */ /* ... */ /* ... */
7531 continue; continue; continue;
7532 /* ... */ /* ... */ /* ... */
7533 contin: ; contin: ; contin: ;
7534 } } while (/* ... */); }
7535 </pre>
7536 unless the continue statement shown is in an enclosed iteration statement (in which
7537 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note138"><b>138)</b></a></sup>
7539 <p><b>Footnotes</b>
7540 <p><small><a name="note138" href="#note138">138)</a> Following the contin: label is a null statement.
7541 </small>
7543 <p><small><a href="#Contents">Contents</a></small>
7544 <h5><a name="6.8.6.3" href="#6.8.6.3">6.8.6.3 The break statement</a></h5>
7545 <p><b>Constraints</b>
7546 <p><a name="6.8.6.3p1" href="#6.8.6.3p1"><small>1</small></a>
7547 A break statement shall appear only in or as a switch body or loop body.
7548 <p><b>Semantics</b>
7549 <p><a name="6.8.6.3p2" href="#6.8.6.3p2"><small>2</small></a>
7550 A break statement terminates execution of the smallest enclosing switch or iteration
7551 statement.
7555 <!--page 151 -->
7557 <p><small><a href="#Contents">Contents</a></small>
7558 <h5><a name="6.8.6.4" href="#6.8.6.4">6.8.6.4 The return statement</a></h5>
7559 <p><b>Constraints</b>
7560 <p><a name="6.8.6.4p1" href="#6.8.6.4p1"><small>1</small></a>
7561 A return statement with an expression shall not appear in a function whose return type
7562 is void. A return statement without an expression shall only appear in a function
7563 whose return type is void.
7564 <p><b>Semantics</b>
7565 <p><a name="6.8.6.4p2" href="#6.8.6.4p2"><small>2</small></a>
7566 A return statement terminates execution of the current function and returns control to
7567 its caller. A function may have any number of return statements.
7568 <p><a name="6.8.6.4p3" href="#6.8.6.4p3"><small>3</small></a>
7569 If a return statement with an expression is executed, the value of the expression is
7570 returned to the caller as the value of the function call expression. If the expression has a
7571 type different from the return type of the function in which it appears, the value is
7572 converted as if by assignment to an object having the return type of the function.<sup><a href="#note139"><b>139)</b></a></sup>
7573 <p><a name="6.8.6.4p4" href="#6.8.6.4p4"><small>4</small></a>
7574 EXAMPLE In:
7575 <pre>
7576 struct s { double i; } f(void);
7577 union {
7578 struct {
7579 int f1;
7580 struct s f2;
7581 } u1;
7582 struct {
7583 struct s f3;
7584 int f4;
7585 } u2;
7586 } g;
7587 struct s f(void)
7589 return g.u1.f2;
7591 /* ... */
7592 g.u2.f3 = f();
7593 </pre>
7594 there is no undefined behavior, although there would be if the assignment were done directly (without using
7595 a function call to fetch the value).
7600 <!--page 152 -->
7602 <p><b>Footnotes</b>
7603 <p><small><a name="note139" href="#note139">139)</a> The return statement is not an assignment. The overlap restriction of subclause <a href="#6.5.16.1">6.5.16.1</a> does not
7604 apply to the case of function return. The representation of floating-point values may have wider range
7605 or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
7606 range and precision.
7607 </small>
7609 <p><small><a href="#Contents">Contents</a></small>
7610 <h3><a name="6.9" href="#6.9">6.9 External definitions</a></h3>
7611 <p><b>Syntax</b>
7612 <p><a name="6.9p1" href="#6.9p1"><small>1</small></a>
7613 <pre>
7614 translation-unit:
7615 external-declaration
7616 translation-unit external-declaration
7617 external-declaration:
7618 function-definition
7619 declaration
7620 </pre>
7621 <p><b>Constraints</b>
7622 <p><a name="6.9p2" href="#6.9p2"><small>2</small></a>
7623 The storage-class specifiers auto and register shall not appear in the declaration
7624 specifiers in an external declaration.
7625 <p><a name="6.9p3" href="#6.9p3"><small>3</small></a>
7626 There shall be no more than one external definition for each identifier declared with
7627 internal linkage in a translation unit. Moreover, if an identifier declared with internal
7628 linkage is used in an expression (other than as a part of the operand of a sizeof
7629 operator whose result is an integer constant), there shall be exactly one external definition
7630 for the identifier in the translation unit.
7631 <p><b>Semantics</b>
7632 <p><a name="6.9p4" href="#6.9p4"><small>4</small></a>
7633 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,
7634 which consists of a sequence of external declarations. These are described as ''external''
7635 because they appear outside any function (and hence have file scope). As discussed in
7636 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
7637 by the identifier is a definition.
7638 <p><a name="6.9p5" href="#6.9p5"><small>5</small></a>
7639 An external definition is an external declaration that is also a definition of a function
7640 (other than an inline definition) or an object. If an identifier declared with external
7641 linkage is used in an expression (other than as part of the operand of a sizeof operator
7642 whose result is an integer constant), somewhere in the entire program there shall be
7643 exactly one external definition for the identifier; otherwise, there shall be no more than
7644 one.<sup><a href="#note140"><b>140)</b></a></sup>
7649 <!--page 153 -->
7651 <p><b>Footnotes</b>
7652 <p><small><a name="note140" href="#note140">140)</a> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
7653 external definition for it.
7654 </small>
7656 <p><small><a href="#Contents">Contents</a></small>
7657 <h4><a name="6.9.1" href="#6.9.1">6.9.1 Function definitions</a></h4>
7658 <p><b>Syntax</b>
7659 <p><a name="6.9.1p1" href="#6.9.1p1"><small>1</small></a>
7660 <pre>
7661 function-definition:
7662 declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
7663 declaration-list:
7664 declaration
7665 declaration-list declaration
7666 </pre>
7667 <p><b>Constraints</b>
7668 <p><a name="6.9.1p2" href="#6.9.1p2"><small>2</small></a>
7669 The identifier declared in a function definition (which is the name of the function) shall
7670 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note141"><b>141)</b></a></sup>
7671 <p><a name="6.9.1p3" href="#6.9.1p3"><small>3</small></a>
7672 The return type of a function shall be void or an object type other than array type.
7673 <p><a name="6.9.1p4" href="#6.9.1p4"><small>4</small></a>
7674 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
7675 static.
7676 <p><a name="6.9.1p5" href="#6.9.1p5"><small>5</small></a>
7677 If the declarator includes a parameter type list, the declaration of each parameter shall
7678 include an identifier, except for the special case of a parameter list consisting of a single
7679 parameter of type void, in which case there shall not be an identifier. No declaration list
7680 shall follow.
7681 <p><a name="6.9.1p6" href="#6.9.1p6"><small>6</small></a>
7682 If the declarator includes an identifier list, each declaration in the declaration list shall
7683 have at least one declarator, those declarators shall declare only identifiers from the
7684 identifier list, and every identifier in the identifier list shall be declared. An identifier
7685 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
7686 declaration list shall contain no storage-class specifier other than register and no
7687 initializations.
7692 <!--page 154 -->
7693 <p><b>Semantics</b>
7694 <p><a name="6.9.1p7" href="#6.9.1p7"><small>7</small></a>
7695 The declarator in a function definition specifies the name of the function being defined
7696 and the identifiers of its parameters. If the declarator includes a parameter type list, the
7697 list also specifies the types of all the parameters; such a declarator also serves as a
7698 function prototype for later calls to the same function in the same translation unit. If the
7699 declarator includes an identifier list,<sup><a href="#note142"><b>142)</b></a></sup> the types of the parameters shall be declared in a
7700 following declaration list. In either case, the type of each parameter is adjusted as
7701 described in <a href="#6.7.5.3">6.7.5.3</a> for a parameter type list; the resulting type shall be an object type.
7702 <p><a name="6.9.1p8" href="#6.9.1p8"><small>8</small></a>
7703 If a function that accepts a variable number of arguments is defined without a parameter
7704 type list that ends with the ellipsis notation, the behavior is undefined.
7705 <p><a name="6.9.1p9" href="#6.9.1p9"><small>9</small></a>
7706 Each parameter has automatic storage duration. Its identifier is an lvalue, which is in
7707 effect declared at the head of the compound statement that constitutes the function body
7708 (and therefore cannot be redeclared in the function body except in an enclosed block).
7709 The layout of the storage for parameters is unspecified.
7710 <p><a name="6.9.1p10" href="#6.9.1p10"><small>10</small></a>
7711 On entry to the function, the size expressions of each variably modified parameter are
7712 evaluated and the value of each argument expression is converted to the type of the
7713 corresponding parameter as if by assignment. (Array expressions and function
7714 designators as arguments were converted to pointers before the call.)
7715 <p><a name="6.9.1p11" href="#6.9.1p11"><small>11</small></a>
7716 After all parameters have been assigned, the compound statement that constitutes the
7717 body of the function definition is executed.
7718 <p><a name="6.9.1p12" href="#6.9.1p12"><small>12</small></a>
7719 If the } that terminates a function is reached, and the value of the function call is used by
7720 the caller, the behavior is undefined.
7721 <p><a name="6.9.1p13" href="#6.9.1p13"><small>13</small></a>
7722 EXAMPLE 1 In the following:
7723 <pre>
7724 extern int max(int a, int b)
7726 return a &gt; b ? a : b;
7728 </pre>
7729 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
7730 function declarator; and
7731 <pre>
7732 { return a &gt; b ? a : b; }
7733 </pre>
7734 is the function body. The following similar definition uses the identifier-list form for the parameter
7735 declarations:
7740 <!--page 155 -->
7741 <pre>
7742 extern int max(a, b)
7743 int a, b;
7745 return a &gt; b ? a : b;
7747 </pre>
7748 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
7749 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
7750 to the function, whereas the second form does not.
7752 <p><a name="6.9.1p14" href="#6.9.1p14"><small>14</small></a>
7753 EXAMPLE 2 To pass one function to another, one might say
7754 <pre>
7755 int f(void);
7756 /* ... */
7757 g(f);
7758 </pre>
7759 Then the definition of g might read
7760 <pre>
7761 void g(int (*funcp)(void))
7763 /* ... */
7764 (*funcp)(); /* or funcp(); ... */
7766 </pre>
7767 or, equivalently,
7768 <pre>
7769 void g(int func(void))
7771 /* ... */
7772 func(); /* or (*func)(); ... */
7774 </pre>
7777 <p><b>Footnotes</b>
7778 <p><small><a name="note141" href="#note141">141)</a> The intent is that the type category in a function definition cannot be inherited from a typedef:
7780 <pre>
7781 typedef int F(void); // type F is ''function with no parameters
7782 // returning int''
7783 F f, g; // f and g both have type compatible with F
7784 F f { /* ... */ } // WRONG: syntax/constraint error
7785 F g() { /* ... */ } // WRONG: declares that g returns a function
7786 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
7787 int g() { /* ... */ } // RIGHT: g has type compatible with F
7788 F *e(void) { /* ... */ } // e returns a pointer to a function
7789 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
7790 int (*fp)(void); // fp points to a function that has type F
7791 F *Fp; // Fp points to a function that has type F
7792 </pre>
7793 </small>
7794 <p><small><a name="note142" href="#note142">142)</a> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
7795 </small>
7797 <p><small><a href="#Contents">Contents</a></small>
7798 <h4><a name="6.9.2" href="#6.9.2">6.9.2 External object definitions</a></h4>
7799 <p><b>Semantics</b>
7800 <p><a name="6.9.2p1" href="#6.9.2p1"><small>1</small></a>
7801 If the declaration of an identifier for an object has file scope and an initializer, the
7802 declaration is an external definition for the identifier.
7803 <p><a name="6.9.2p2" href="#6.9.2p2"><small>2</small></a>
7804 A declaration of an identifier for an object that has file scope without an initializer, and
7805 without a storage-class specifier or with the storage-class specifier static, constitutes a
7806 tentative definition. If a translation unit contains one or more tentative definitions for an
7807 identifier, and the translation unit contains no external definition for that identifier, then
7808 the behavior is exactly as if the translation unit contains a file scope declaration of that
7809 identifier, with the composite type as of the end of the translation unit, with an initializer
7810 equal to 0.
7811 <p><a name="6.9.2p3" href="#6.9.2p3"><small>3</small></a>
7812 If the declaration of an identifier for an object is a tentative definition and has internal
7813 linkage, the declared type shall not be an incomplete type.
7814 <!--page 156 -->
7815 <p><a name="6.9.2p4" href="#6.9.2p4"><small>4</small></a>
7816 EXAMPLE 1
7817 <pre>
7818 int i1 = 1; // definition, external linkage
7819 static int i2 = 2; // definition, internal linkage
7820 extern int i3 = 3; // definition, external linkage
7821 int i4; // tentative definition, external linkage
7822 static int i5; // tentative definition, internal linkage
7823 int i1; // valid tentative definition, refers to previous
7824 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7825 int i3; // valid tentative definition, refers to previous
7826 int i4; // valid tentative definition, refers to previous
7827 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
7828 extern int i1; // refers to previous, whose linkage is external
7829 extern int i2; // refers to previous, whose linkage is internal
7830 extern int i3; // refers to previous, whose linkage is external
7831 extern int i4; // refers to previous, whose linkage is external
7832 extern int i5; // refers to previous, whose linkage is internal
7833 </pre>
7835 <p><a name="6.9.2p5" href="#6.9.2p5"><small>5</small></a>
7836 EXAMPLE 2 If at the end of the translation unit containing
7837 <pre>
7838 int i[];
7839 </pre>
7840 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
7841 zero on program startup.
7842 <!--page 157 -->
7844 <p><small><a href="#Contents">Contents</a></small>
7845 <h3><a name="6.10" href="#6.10">6.10 Preprocessing directives</a></h3>
7846 <p><b>Syntax</b>
7847 <p><a name="6.10p1" href="#6.10p1"><small>1</small></a>
7848 <!--page 158 -->
7849 <pre>
7850 preprocessing-file:
7851 group<sub>opt</sub>
7852 group:
7853 group-part
7854 group group-part
7855 group-part:
7856 if-section
7857 control-line
7858 text-line
7859 # non-directive
7860 if-section:
7861 if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
7862 if-group:
7863 # if constant-expression new-line group<sub>opt</sub>
7864 # ifdef identifier new-line group<sub>opt</sub>
7865 # ifndef identifier new-line group<sub>opt</sub>
7866 elif-groups:
7867 elif-group
7868 elif-groups elif-group
7869 elif-group:
7870 # elif constant-expression new-line group<sub>opt</sub>
7871 else-group:
7872 # else new-line group<sub>opt</sub>
7873 endif-line:
7874 # endif new-line
7875 control-line:
7876 # include pp-tokens new-line
7877 # define identifier replacement-list new-line
7878 # define identifier lparen identifier-list<sub>opt</sub> )
7879 replacement-list new-line
7880 # define identifier lparen ... ) replacement-list new-line
7881 # define identifier lparen identifier-list , ... )
7882 replacement-list new-line
7883 # undef identifier new-line
7884 # line pp-tokens new-line
7885 # error pp-tokens<sub>opt</sub> new-line
7886 # pragma pp-tokens<sub>opt</sub> new-line
7887 # new-line
7888 text-line:
7889 pp-tokens<sub>opt</sub> new-line
7890 non-directive:
7891 pp-tokens new-line
7892 lparen:
7893 a ( character not immediately preceded by white-space
7894 replacement-list:
7895 pp-tokens<sub>opt</sub>
7896 pp-tokens:
7897 preprocessing-token
7898 pp-tokens preprocessing-token
7899 new-line:
7900 the new-line character
7901 </pre>
7902 <p><b>Description</b>
7903 <p><a name="6.10p2" href="#6.10p2"><small>2</small></a>
7904 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
7905 following constraints: The first token in the sequence is a # preprocessing token that (at
7906 the start of translation phase 4) is either the first character in the source file (optionally
7907 after white space containing no new-line characters) or that follows white space
7908 containing at least one new-line character. The last token in the sequence is the first new-
7909 line character that follows the first token in the sequence.<sup><a href="#note143"><b>143)</b></a></sup> A new-line character ends
7910 the preprocessing directive even if it occurs within what would otherwise be an
7912 <!--page 159 -->
7913 invocation of a function-like macro.
7914 <p><a name="6.10p3" href="#6.10p3"><small>3</small></a>
7915 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
7916 with any of the directive names appearing in the syntax.
7917 <p><a name="6.10p4" href="#6.10p4"><small>4</small></a>
7918 When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
7919 sequence of preprocessing tokens to occur between the directive name and the following
7920 new-line character.
7921 <p><b>Constraints</b>
7922 <p><a name="6.10p5" href="#6.10p5"><small>5</small></a>
7923 The only white-space characters that shall appear between preprocessing tokens within a
7924 preprocessing directive (from just after the introducing # preprocessing token through
7925 just before the terminating new-line character) are space and horizontal-tab (including
7926 spaces that have replaced comments or possibly other white-space characters in
7927 translation phase 3).
7928 <p><b>Semantics</b>
7929 <p><a name="6.10p6" href="#6.10p6"><small>6</small></a>
7930 The implementation can process and skip sections of source files conditionally, include
7931 other source files, and replace macros. These capabilities are called preprocessing,
7932 because conceptually they occur before translation of the resulting translation unit.
7933 <p><a name="6.10p7" href="#6.10p7"><small>7</small></a>
7934 The preprocessing tokens within a preprocessing directive are not subject to macro
7935 expansion unless otherwise stated.
7936 <p><a name="6.10p8" href="#6.10p8"><small>8</small></a>
7937 EXAMPLE In:
7938 <pre>
7939 #define EMPTY
7940 EMPTY # include &lt;file.h&gt;
7941 </pre>
7942 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
7943 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
7944 replaced.
7947 <p><b>Footnotes</b>
7948 <p><small><a name="note143" href="#note143">143)</a> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
7949 significance, as all white space is equivalent except in certain situations during preprocessing (see the
7950 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
7951 </small>
7953 <p><small><a href="#Contents">Contents</a></small>
7954 <h4><a name="6.10.1" href="#6.10.1">6.10.1 Conditional inclusion</a></h4>
7955 <p><b>Constraints</b>
7956 <p><a name="6.10.1p1" href="#6.10.1p1"><small>1</small></a>
7957 The expression that controls conditional inclusion shall be an integer constant expression
7958 except that: it shall not contain a cast; identifiers (including those lexically identical to
7959 keywords) are interpreted as described below;<sup><a href="#note144"><b>144)</b></a></sup> and it may contain unary operator
7960 expressions of the form
7965 <!--page 160 -->
7966 <pre>
7967 defined identifier
7968 </pre>
7970 <pre>
7971 defined ( identifier )
7972 </pre>
7973 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
7974 predefined or if it has been the subject of a #define preprocessing directive without an
7975 intervening #undef directive with the same subject identifier), 0 if it is not.
7976 <p><a name="6.10.1p2" href="#6.10.1p2"><small>2</small></a>
7977 Each preprocessing token that remains (in the list of preprocessing tokens that will
7978 become the controlling expression) after all macro replacements have occurred shall be in
7979 the lexical form of a token (<a href="#6.4">6.4</a>).
7980 <p><b>Semantics</b>
7981 <p><a name="6.10.1p3" href="#6.10.1p3"><small>3</small></a>
7982 Preprocessing directives of the forms
7983 <pre>
7984 # if constant-expression new-line group<sub>opt</sub>
7985 # elif constant-expression new-line group<sub>opt</sub>
7986 </pre>
7987 check whether the controlling constant expression evaluates to nonzero.
7988 <p><a name="6.10.1p4" href="#6.10.1p4"><small>4</small></a>
7989 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
7990 the controlling constant expression are replaced (except for those macro names modified
7991 by the defined unary operator), just as in normal text. If the token defined is
7992 generated as a result of this replacement process or use of the defined unary operator
7993 does not match one of the two specified forms prior to macro replacement, the behavior is
7994 undefined. After all replacements due to macro expansion and the defined unary
7995 operator have been performed, all remaining identifiers (including those lexically
7996 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
7997 token is converted into a token. The resulting tokens compose the controlling constant
7998 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
7999 token conversion and evaluation, all signed integer types and all unsigned integer types
8000 act as if they have the same representation as, respectively, the types intmax_t and
8001 uintmax_t defined in the header <a href="#7.18">&lt;stdint.h&gt;</a>.<sup><a href="#note145"><b>145)</b></a></sup> This includes interpreting
8002 character constants, which may involve converting escape sequences into execution
8003 character set members. Whether the numeric value for these character constants matches
8004 the value obtained when an identical character constant occurs in an expression (other
8005 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note146"><b>146)</b></a></sup> Also, whether a
8006 single-character character constant may have a negative value is implementation-defined.
8007 <p><a name="6.10.1p5" href="#6.10.1p5"><small>5</small></a>
8008 Preprocessing directives of the forms
8012 <!--page 161 -->
8013 <pre>
8014 # ifdef identifier new-line group<sub>opt</sub>
8015 # ifndef identifier new-line group<sub>opt</sub>
8016 </pre>
8017 check whether the identifier is or is not currently defined as a macro name. Their
8018 conditions are equivalent to #if defined identifier and #if !defined identifier
8019 respectively.
8020 <p><a name="6.10.1p6" href="#6.10.1p6"><small>6</small></a>
8021 Each directive's condition is checked in order. If it evaluates to false (zero), the group
8022 that it controls is skipped: directives are processed only through the name that determines
8023 the directive in order to keep track of the level of nested conditionals; the rest of the
8024 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
8025 group. Only the first group whose control condition evaluates to true (nonzero) is
8026 processed. If none of the conditions evaluates to true, and there is a #else directive, the
8027 group controlled by the #else is processed; lacking a #else directive, all the groups
8028 until the #endif are skipped.<sup><a href="#note147"><b>147)</b></a></sup>
8029 <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
8030 integer types (<a href="#7.18.1.5">7.18.1.5</a>).
8032 <p><b>Footnotes</b>
8033 <p><small><a name="note144" href="#note144">144)</a> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
8034 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
8035 </small>
8036 <p><small><a name="note145" href="#note145">145)</a> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
8037 0x8000 is signed and positive within a #if expression even though it would be unsigned in
8038 translation phase 7.
8039 </small>
8040 <p><small><a name="note146" href="#note146">146)</a> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
8041 evaluate to the same value in these two contexts.
8042 <pre>
8043 #if 'z' - 'a' == 25
8044 if ('z' - 'a' == 25)
8045 </pre>
8047 </small>
8048 <p><small><a name="note147" href="#note147">147)</a> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
8049 before the terminating new-line character. However, comments may appear anywhere in a source file,
8050 including within a preprocessing directive.
8051 </small>
8053 <p><small><a href="#Contents">Contents</a></small>
8054 <h4><a name="6.10.2" href="#6.10.2">6.10.2 Source file inclusion</a></h4>
8055 <p><b>Constraints</b>
8056 <p><a name="6.10.2p1" href="#6.10.2p1"><small>1</small></a>
8057 A #include directive shall identify a header or source file that can be processed by the
8058 implementation.
8059 <p><b>Semantics</b>
8060 <p><a name="6.10.2p2" href="#6.10.2p2"><small>2</small></a>
8061 A preprocessing directive of the form
8062 <pre>
8063 # include &lt;h-char-sequence&gt; new-line
8064 </pre>
8065 searches a sequence of implementation-defined places for a header identified uniquely by
8066 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
8067 directive by the entire contents of the header. How the places are specified or the header
8068 identified is implementation-defined.
8069 <p><a name="6.10.2p3" href="#6.10.2p3"><small>3</small></a>
8070 A preprocessing directive of the form
8074 <!--page 162 -->
8075 <pre>
8076 # include "q-char-sequence" new-line
8077 </pre>
8078 causes the replacement of that directive by the entire contents of the source file identified
8079 by the specified sequence between the " delimiters. The named source file is searched
8080 for in an implementation-defined manner. If this search is not supported, or if the search
8081 fails, the directive is reprocessed as if it read
8082 <pre>
8083 # include &lt;h-char-sequence&gt; new-line
8084 </pre>
8085 with the identical contained sequence (including &gt; characters, if any) from the original
8086 directive.
8087 <p><a name="6.10.2p4" href="#6.10.2p4"><small>4</small></a>
8088 A preprocessing directive of the form
8089 <pre>
8090 # include pp-tokens new-line
8091 </pre>
8092 (that does not match one of the two previous forms) is permitted. The preprocessing
8093 tokens after include in the directive are processed just as in normal text. (Each
8094 identifier currently defined as a macro name is replaced by its replacement list of
8095 preprocessing tokens.) The directive resulting after all replacements shall match one of
8096 the two previous forms.<sup><a href="#note148"><b>148)</b></a></sup> The method by which a sequence of preprocessing tokens
8097 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
8098 single header name preprocessing token is implementation-defined.
8099 <p><a name="6.10.2p5" href="#6.10.2p5"><small>5</small></a>
8100 The implementation shall provide unique mappings for sequences consisting of one or
8101 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
8102 first character shall not be a digit. The implementation may ignore distinctions of
8103 alphabetical case and restrict the mapping to eight significant characters before the
8104 period.
8105 <p><a name="6.10.2p6" href="#6.10.2p6"><small>6</small></a>
8106 A #include preprocessing directive may appear in a source file that has been read
8107 because of a #include directive in another file, up to an implementation-defined
8108 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
8109 <p><a name="6.10.2p7" href="#6.10.2p7"><small>7</small></a>
8110 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
8111 <pre>
8112 #include <a href="#7.19">&lt;stdio.h&gt;</a>
8113 #include "myprog.h"
8114 </pre>
8116 <p><a name="6.10.2p8" href="#6.10.2p8"><small>8</small></a>
8117 EXAMPLE 2 This illustrates macro-replaced #include directives:
8122 <!--page 163 -->
8123 <pre>
8124 #if VERSION == 1
8125 #define INCFILE "vers1.h"
8126 #elif VERSION == 2
8127 #define INCFILE "vers2.h" // and so on
8128 #else
8129 #define INCFILE "versN.h"
8130 #endif
8131 #include INCFILE
8132 </pre>
8134 <p><b> Forward references</b>: macro replacement (<a href="#6.10.3">6.10.3</a>).
8136 <p><b>Footnotes</b>
8137 <p><small><a name="note148" href="#note148">148)</a> Note that adjacent string literals are not concatenated into a single string literal (see the translation
8138 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.
8139 </small>
8141 <p><small><a href="#Contents">Contents</a></small>
8142 <h4><a name="6.10.3" href="#6.10.3">6.10.3 Macro replacement</a></h4>
8143 <p><b>Constraints</b>
8144 <p><a name="6.10.3p1" href="#6.10.3p1"><small>1</small></a>
8145 Two replacement lists are identical if and only if the preprocessing tokens in both have
8146 the same number, ordering, spelling, and white-space separation, where all white-space
8147 separations are considered identical.
8148 <p><a name="6.10.3p2" href="#6.10.3p2"><small>2</small></a>
8149 An identifier currently defined as an object-like macro shall not be redefined by another
8150 #define preprocessing directive unless the second definition is an object-like macro
8151 definition and the two replacement lists are identical. Likewise, an identifier currently
8152 defined as a function-like macro shall not be redefined by another #define
8153 preprocessing directive unless the second definition is a function-like macro definition
8154 that has the same number and spelling of parameters, and the two replacement lists are
8155 identical.
8156 <p><a name="6.10.3p3" href="#6.10.3p3"><small>3</small></a>
8157 There shall be white-space between the identifier and the replacement list in the definition
8158 of an object-like macro.
8159 <p><a name="6.10.3p4" href="#6.10.3p4"><small>4</small></a>
8160 If the identifier-list in the macro definition does not end with an ellipsis, the number of
8161 arguments (including those arguments consisting of no preprocessing tokens) in an
8162 invocation of a function-like macro shall equal the number of parameters in the macro
8163 definition. Otherwise, there shall be more arguments in the invocation than there are
8164 parameters in the macro definition (excluding the ...). There shall exist a )
8165 preprocessing token that terminates the invocation.
8166 <p><a name="6.10.3p5" href="#6.10.3p5"><small>5</small></a>
8167 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
8168 macro that uses the ellipsis notation in the parameters.
8169 <p><a name="6.10.3p6" href="#6.10.3p6"><small>6</small></a>
8170 A parameter identifier in a function-like macro shall be uniquely declared within its
8171 scope.
8172 <p><b>Semantics</b>
8173 <p><a name="6.10.3p7" href="#6.10.3p7"><small>7</small></a>
8174 The identifier immediately following the define is called the macro name. There is one
8175 name space for macro names. Any white-space characters preceding or following the
8176 replacement list of preprocessing tokens are not considered part of the replacement list
8177 for either form of macro.
8178 <!--page 164 -->
8179 <p><a name="6.10.3p8" href="#6.10.3p8"><small>8</small></a>
8180 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
8181 a preprocessing directive could begin, the identifier is not subject to macro replacement.
8182 <p><a name="6.10.3p9" href="#6.10.3p9"><small>9</small></a>
8183 A preprocessing directive of the form
8184 <pre>
8185 # define identifier replacement-list new-line
8186 </pre>
8187 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note149"><b>149)</b></a></sup>
8188 to be replaced by the replacement list of preprocessing tokens that constitute the
8189 remainder of the directive. The replacement list is then rescanned for more macro names
8190 as specified below.
8191 <p><a name="6.10.3p10" href="#6.10.3p10"><small>10</small></a>
8192 A preprocessing directive of the form
8193 <pre>
8194 # define identifier lparen identifier-list<sub>opt</sub> ) replacement-list new-line
8195 # define identifier lparen ... ) replacement-list new-line
8196 # define identifier lparen identifier-list , ... ) replacement-list new-line
8197 </pre>
8198 defines a function-like macro with parameters, whose use is similar syntactically to a
8199 function call. The parameters are specified by the optional list of identifiers, whose scope
8200 extends from their declaration in the identifier list until the new-line character that
8201 terminates the #define preprocessing directive. Each subsequent instance of the
8202 function-like macro name followed by a ( as the next preprocessing token introduces the
8203 sequence of preprocessing tokens that is replaced by the replacement list in the definition
8204 (an invocation of the macro). The replaced sequence of preprocessing tokens is
8205 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
8206 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
8207 tokens making up an invocation of a function-like macro, new-line is considered a normal
8208 white-space character.
8209 <p><a name="6.10.3p11" href="#6.10.3p11"><small>11</small></a>
8210 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
8211 forms the list of arguments for the function-like macro. The individual arguments within
8212 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
8213 between matching inner parentheses do not separate arguments. If there are sequences of
8214 preprocessing tokens within the list of arguments that would otherwise act as
8215 preprocessing directives,<sup><a href="#note150"><b>150)</b></a></sup> the behavior is undefined.
8216 <p><a name="6.10.3p12" href="#6.10.3p12"><small>12</small></a>
8217 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
8218 including any separating comma preprocessing tokens, are merged to form a single item:
8219 the variable arguments. The number of arguments so combined is such that, following
8222 <!--page 165 -->
8223 merger, the number of arguments is one more than the number of parameters in the macro
8224 definition (excluding the ...).
8226 <p><b>Footnotes</b>
8227 <p><small><a name="note149" href="#note149">149)</a> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
8228 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
8229 are never scanned for macro names or parameters.
8230 </small>
8231 <p><small><a name="note150" href="#note150">150)</a> Despite the name, a non-directive is a preprocessing directive.
8232 </small>
8234 <p><small><a href="#Contents">Contents</a></small>
8235 <h5><a name="6.10.3.1" href="#6.10.3.1">6.10.3.1 Argument substitution</a></h5>
8236 <p><a name="6.10.3.1p1" href="#6.10.3.1p1"><small>1</small></a>
8237 After the arguments for the invocation of a function-like macro have been identified,
8238 argument substitution takes place. A parameter in the replacement list, unless preceded
8239 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
8240 replaced by the corresponding argument after all macros contained therein have been
8241 expanded. Before being substituted, each argument's preprocessing tokens are
8242 completely macro replaced as if they formed the rest of the preprocessing file; no other
8243 preprocessing tokens are available.
8244 <p><a name="6.10.3.1p2" href="#6.10.3.1p2"><small>2</small></a>
8245 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
8246 were a parameter, and the variable arguments shall form the preprocessing tokens used to
8247 replace it.
8249 <p><small><a href="#Contents">Contents</a></small>
8250 <h5><a name="6.10.3.2" href="#6.10.3.2">6.10.3.2 The # operator</a></h5>
8251 <p><b>Constraints</b>
8252 <p><a name="6.10.3.2p1" href="#6.10.3.2p1"><small>1</small></a>
8253 Each # preprocessing token in the replacement list for a function-like macro shall be
8254 followed by a parameter as the next preprocessing token in the replacement list.
8255 <p><b>Semantics</b>
8256 <p><a name="6.10.3.2p2" href="#6.10.3.2p2"><small>2</small></a>
8257 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
8258 token, both are replaced by a single character string literal preprocessing token that
8259 contains the spelling of the preprocessing token sequence for the corresponding
8260 argument. Each occurrence of white space between the argument's preprocessing tokens
8261 becomes a single space character in the character string literal. White space before the
8262 first preprocessing token and after the last preprocessing token composing the argument
8263 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
8264 is retained in the character string literal, except for special handling for producing the
8265 spelling of string literals and character constants: a \ character is inserted before each "
8266 and \ character of a character constant or string literal (including the delimiting "
8267 characters), except that it is implementation-defined whether a \ character is inserted
8268 before the \ character beginning a universal character name. If the replacement that
8269 results is not a valid character string literal, the behavior is undefined. The character
8270 string literal corresponding to an empty argument is "". The order of evaluation of # and
8271 ## operators is unspecified.
8272 <!--page 166 -->
8274 <p><small><a href="#Contents">Contents</a></small>
8275 <h5><a name="6.10.3.3" href="#6.10.3.3">6.10.3.3 The ## operator</a></h5>
8276 <p><b>Constraints</b>
8277 <p><a name="6.10.3.3p1" href="#6.10.3.3p1"><small>1</small></a>
8278 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
8279 list for either form of macro definition.
8280 <p><b>Semantics</b>
8281 <p><a name="6.10.3.3p2" href="#6.10.3.3p2"><small>2</small></a>
8282 If, in the replacement list of a function-like macro, a parameter is immediately preceded
8283 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
8284 argument's preprocessing token sequence; however, if an argument consists of no
8285 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
8286 instead.<sup><a href="#note151"><b>151)</b></a></sup>
8287 <p><a name="6.10.3.3p3" href="#6.10.3.3p3"><small>3</small></a>
8288 For both object-like and function-like macro invocations, before the replacement list is
8289 reexamined for more macro names to replace, each instance of a ## preprocessing token
8290 in the replacement list (not from an argument) is deleted and the preceding preprocessing
8291 token is concatenated with the following preprocessing token. Placemarker
8292 preprocessing tokens are handled specially: concatenation of two placemarkers results in
8293 a single placemarker preprocessing token, and concatenation of a placemarker with a
8294 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
8295 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
8296 token is available for further macro replacement. The order of evaluation of ## operators
8297 is unspecified.
8298 <p><a name="6.10.3.3p4" href="#6.10.3.3p4"><small>4</small></a>
8299 EXAMPLE In the following fragment:
8300 <pre>
8301 #define hash_hash # ## #
8302 #define mkstr(a) # a
8303 #define in_between(a) mkstr(a)
8304 #define join(c, d) in_between(c hash_hash d)
8305 char p[] = join(x, y); // equivalent to
8306 // char p[] = "x ## y";
8307 </pre>
8308 The expansion produces, at various stages:
8309 <pre>
8310 join(x, y)
8311 in_between(x hash_hash y)
8312 in_between(x ## y)
8313 mkstr(x ## y)
8314 "x ## y"
8315 </pre>
8316 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
8317 this new token is not the ## operator.
8320 <!--page 167 -->
8322 <p><b>Footnotes</b>
8323 <p><small><a name="note151" href="#note151">151)</a> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
8324 exist only within translation phase 4.
8325 </small>
8327 <p><small><a href="#Contents">Contents</a></small>
8328 <h5><a name="6.10.3.4" href="#6.10.3.4">6.10.3.4 Rescanning and further replacement</a></h5>
8329 <p><a name="6.10.3.4p1" href="#6.10.3.4p1"><small>1</small></a>
8330 After all parameters in the replacement list have been substituted and # and ##
8331 processing has taken place, all placemarker preprocessing tokens are removed. Then, the
8332 resulting preprocessing token sequence is rescanned, along with all subsequent
8333 preprocessing tokens of the source file, for more macro names to replace.
8334 <p><a name="6.10.3.4p2" href="#6.10.3.4p2"><small>2</small></a>
8335 If the name of the macro being replaced is found during this scan of the replacement list
8336 (not including the rest of the source file's preprocessing tokens), it is not replaced.
8337 Furthermore, if any nested replacements encounter the name of the macro being replaced,
8338 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
8339 available for further replacement even if they are later (re)examined in contexts in which
8340 that macro name preprocessing token would otherwise have been replaced.
8341 <p><a name="6.10.3.4p3" href="#6.10.3.4p3"><small>3</small></a>
8342 The resulting completely macro-replaced preprocessing token sequence is not processed
8343 as a preprocessing directive even if it resembles one, but all pragma unary operator
8344 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
8346 <p><small><a href="#Contents">Contents</a></small>
8347 <h5><a name="6.10.3.5" href="#6.10.3.5">6.10.3.5 Scope of macro definitions</a></h5>
8348 <p><a name="6.10.3.5p1" href="#6.10.3.5p1"><small>1</small></a>
8349 A macro definition lasts (independent of block structure) until a corresponding #undef
8350 directive is encountered or (if none is encountered) until the end of the preprocessing
8351 translation unit. Macro definitions have no significance after translation phase 4.
8352 <p><a name="6.10.3.5p2" href="#6.10.3.5p2"><small>2</small></a>
8353 A preprocessing directive of the form
8354 <pre>
8355 # undef identifier new-line
8356 </pre>
8357 causes the specified identifier no longer to be defined as a macro name. It is ignored if
8358 the specified identifier is not currently defined as a macro name.
8359 <p><a name="6.10.3.5p3" href="#6.10.3.5p3"><small>3</small></a>
8360 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
8361 <pre>
8362 #define TABSIZE 100
8363 int table[TABSIZE];
8364 </pre>
8366 <p><a name="6.10.3.5p4" href="#6.10.3.5p4"><small>4</small></a>
8367 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
8368 It has the advantages of working for any compatible types of the arguments and of generating in-line code
8369 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
8370 arguments a second time (including side effects) and generating more code than a function if invoked
8371 several times. It also cannot have its address taken, as it has none.
8372 <pre>
8373 #define max(a, b) ((a) &gt; (b) ? (a) : (b))
8374 </pre>
8375 The parentheses ensure that the arguments and the resulting expression are bound properly.
8376 <!--page 168 -->
8377 <p><a name="6.10.3.5p5" href="#6.10.3.5p5"><small>5</small></a>
8378 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
8379 <pre>
8380 #define x 3
8381 #define f(a) f(x * (a))
8382 #undef x
8383 #define x 2
8384 #define g f
8385 #define z z[0]
8386 #define h g(~
8387 #define m(a) a(w)
8388 #define w 0,1
8389 #define t(a) a
8390 #define p() int
8391 #define q(x) x
8392 #define r(x,y) x ## y
8393 #define str(x) # x
8394 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
8395 g(x+(3,4)-w) | h 5) &amp; m
8396 (f)^m(m);
8397 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
8398 char c[2][6] = { str(hello), str() };
8399 </pre>
8400 results in
8401 <pre>
8402 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
8403 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
8404 int i[] = { 1, 23, 4, 5, };
8405 char c[2][6] = { "hello", "" };
8406 </pre>
8408 <p><a name="6.10.3.5p6" href="#6.10.3.5p6"><small>6</small></a>
8409 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
8410 sequence
8411 <pre>
8412 #define str(s) # s
8413 #define xstr(s) str(s)
8414 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
8415 x ## s, x ## t)
8416 #define INCFILE(n) vers ## n
8417 #define glue(a, b) a ## b
8418 #define xglue(a, b) glue(a, b)
8419 #define HIGHLOW "hello"
8420 #define LOW LOW ", world"
8421 debug(1, 2);
8422 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
8423 == 0) str(: @\n), s);
8424 #include xstr(INCFILE(2).h)
8425 glue(HIGH, LOW);
8426 xglue(HIGH, LOW)
8427 </pre>
8428 results in
8429 <!--page 169 -->
8430 <pre>
8431 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
8432 fputs(
8433 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
8435 #include "vers2.h" (after macro replacement, before file access)
8436 "hello";
8437 "hello" ", world"
8438 </pre>
8439 or, after concatenation of the character string literals,
8440 <pre>
8441 printf("x1= %d, x2= %s", x1, x2);
8442 fputs(
8443 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
8445 #include "vers2.h" (after macro replacement, before file access)
8446 "hello";
8447 "hello, world"
8448 </pre>
8449 Space around the # and ## tokens in the macro definition is optional.
8451 <p><a name="6.10.3.5p7" href="#6.10.3.5p7"><small>7</small></a>
8452 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
8453 <pre>
8454 #define t(x,y,z) x ## y ## z
8455 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
8456 t(10,,), t(,11,), t(,,12), t(,,) };
8457 </pre>
8458 results in
8459 <pre>
8460 int j[] = { 123, 45, 67, 89,
8461 10, 11, 12, };
8462 </pre>
8464 <p><a name="6.10.3.5p8" href="#6.10.3.5p8"><small>8</small></a>
8465 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
8466 <pre>
8467 #define OBJ_LIKE (1-1)
8468 #define OBJ_LIKE /* white space */ (1-1) /* other */
8469 #define FUNC_LIKE(a) ( a )
8470 #define FUNC_LIKE( a )( /* note the white space */ \
8471 a /* other stuff on this line
8472 */ )
8473 </pre>
8474 But the following redefinitions are invalid:
8475 <pre>
8476 #define OBJ_LIKE (0) // different token sequence
8477 #define OBJ_LIKE (1 - 1) // different white space
8478 #define FUNC_LIKE(b) ( a ) // different parameter usage
8479 #define FUNC_LIKE(b) ( b ) // different parameter spelling
8480 </pre>
8482 <p><a name="6.10.3.5p9" href="#6.10.3.5p9"><small>9</small></a>
8483 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
8484 <!--page 170 -->
8485 <pre>
8486 #define debug(...) fprintf(stderr, __VA_ARGS__)
8487 #define showlist(...) puts(#__VA_ARGS__)
8488 #define report(test, ...) ((test)?puts(#test):\
8489 printf(__VA_ARGS__))
8490 debug("Flag");
8491 debug("X = %d\n", x);
8492 showlist(The first, second, and third items.);
8493 report(x&gt;y, "x is %d but y is %d", x, y);
8494 </pre>
8495 results in
8496 <pre>
8497 fprintf(stderr, "Flag" );
8498 fprintf(stderr, "X = %d\n", x );
8499 puts( "The first, second, and third items." );
8500 ((x&gt;y)?puts("x&gt;y"):
8501 printf("x is %d but y is %d", x, y));
8502 </pre>
8505 <p><small><a href="#Contents">Contents</a></small>
8506 <h4><a name="6.10.4" href="#6.10.4">6.10.4 Line control</a></h4>
8507 <p><b>Constraints</b>
8508 <p><a name="6.10.4p1" href="#6.10.4p1"><small>1</small></a>
8509 The string literal of a #line directive, if present, shall be a character string literal.
8510 <p><b>Semantics</b>
8511 <p><a name="6.10.4p2" href="#6.10.4p2"><small>2</small></a>
8512 The line number of the current source line is one greater than the number of new-line
8513 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
8514 file to the current token.
8515 <p><a name="6.10.4p3" href="#6.10.4p3"><small>3</small></a>
8516 A preprocessing directive of the form
8517 <pre>
8518 # line digit-sequence new-line
8519 </pre>
8520 causes the implementation to behave as if the following sequence of source lines begins
8521 with a source line that has a line number as specified by the digit sequence (interpreted as
8522 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
8523 2147483647.
8524 <p><a name="6.10.4p4" href="#6.10.4p4"><small>4</small></a>
8525 A preprocessing directive of the form
8526 <pre>
8527 # line digit-sequence "s-char-sequence<sub>opt</sub>" new-line
8528 </pre>
8529 sets the presumed line number similarly and changes the presumed name of the source
8530 file to be the contents of the character string literal.
8531 <p><a name="6.10.4p5" href="#6.10.4p5"><small>5</small></a>
8532 A preprocessing directive of the form
8533 <pre>
8534 # line pp-tokens new-line
8535 </pre>
8536 (that does not match one of the two previous forms) is permitted. The preprocessing
8537 tokens after line on the directive are processed just as in normal text (each identifier
8538 currently defined as a macro name is replaced by its replacement list of preprocessing
8539 tokens). The directive resulting after all replacements shall match one of the two
8540 previous forms and is then processed as appropriate.
8541 <!--page 171 -->
8543 <p><small><a href="#Contents">Contents</a></small>
8544 <h4><a name="6.10.5" href="#6.10.5">6.10.5 Error directive</a></h4>
8545 <p><b>Semantics</b>
8546 <p><a name="6.10.5p1" href="#6.10.5p1"><small>1</small></a>
8547 A preprocessing directive of the form
8548 <pre>
8549 # error pp-tokens<sub>opt</sub> new-line
8550 </pre>
8551 causes the implementation to produce a diagnostic message that includes the specified
8552 sequence of preprocessing tokens.
8554 <p><small><a href="#Contents">Contents</a></small>
8555 <h4><a name="6.10.6" href="#6.10.6">6.10.6 Pragma directive</a></h4>
8556 <p><b>Semantics</b>
8557 <p><a name="6.10.6p1" href="#6.10.6p1"><small>1</small></a>
8558 A preprocessing directive of the form
8559 <pre>
8560 # pragma pp-tokens<sub>opt</sub> new-line
8561 </pre>
8562 where the preprocessing token STDC does not immediately follow pragma in the
8563 directive (prior to any macro replacement)<sup><a href="#note152"><b>152)</b></a></sup> causes the implementation to behave in an
8564 implementation-defined manner. The behavior might cause translation to fail or cause the
8565 translator or the resulting program to behave in a non-conforming manner. Any such
8566 pragma that is not recognized by the implementation is ignored.
8567 <p><a name="6.10.6p2" href="#6.10.6p2"><small>2</small></a>
8568 If the preprocessing token STDC does immediately follow pragma in the directive (prior
8569 to any macro replacement), then no macro replacement is performed on the directive, and
8570 the directive shall have one of the following forms<sup><a href="#note153"><b>153)</b></a></sup> whose meanings are described
8571 elsewhere:
8572 <pre>
8573 #pragma STDC FP_CONTRACT on-off-switch
8574 #pragma STDC FENV_ACCESS on-off-switch
8575 #pragma STDC CX_LIMITED_RANGE on-off-switch
8576 on-off-switch: one of
8577 ON OFF DEFAULT
8578 </pre>
8579 <p><b> Forward references</b>: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
8580 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
8585 <!--page 172 -->
8587 <p><b>Footnotes</b>
8588 <p><small><a name="note152" href="#note152">152)</a> An implementation is not required to perform macro replacement in pragmas, but it is permitted
8589 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
8590 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
8591 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
8592 but is not required to.
8593 </small>
8594 <p><small><a name="note153" href="#note153">153)</a> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
8595 </small>
8597 <p><small><a href="#Contents">Contents</a></small>
8598 <h4><a name="6.10.7" href="#6.10.7">6.10.7 Null directive</a></h4>
8599 <p><b>Semantics</b>
8600 <p><a name="6.10.7p1" href="#6.10.7p1"><small>1</small></a>
8601 A preprocessing directive of the form
8602 <pre>
8603 # new-line
8604 </pre>
8605 has no effect.
8607 <p><small><a href="#Contents">Contents</a></small>
8608 <h4><a name="6.10.8" href="#6.10.8">6.10.8 Predefined macro names</a></h4>
8609 <p><a name="6.10.8p1" href="#6.10.8p1"><small>1</small></a>
8610 The following macro names<sup><a href="#note154"><b>154)</b></a></sup> shall be defined by the implementation:
8611 <dl>
8612 <dt> __DATE__ <dd>The date of translation of the preprocessing translation unit: a character
8613 string literal of the form "Mmm dd yyyy", where the names of the
8614 months are the same as those generated by the asctime function, and the
8615 first character of dd is a space character if the value is less than 10. If the
8616 date of translation is not available, an implementation-defined valid date
8617 shall be supplied.
8618 <dt> __FILE__ <dd>The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
8619 <dt> __LINE__ <dd>The presumed line number (within the current source file) of the current
8620 source line (an integer constant).<sup><a href="#note155"><b>155)</b></a></sup>
8621 <dt> __STDC__ <dd>The integer constant 1, intended to indicate a conforming implementation.
8622 <dt> __STDC_HOSTED__ <dd>The integer constant 1 if the implementation is a hosted
8623 implementation or the integer constant 0 if it is not.
8624 <dt> __STDC_MB_MIGHT_NEQ_WC__ <dd>The integer constant 1, intended to indicate that, in
8625 the encoding for wchar_t, a member of the basic character set need not
8626 have a code value equal to its value when used as the lone character in an
8627 integer character constant.
8628 <dt> __STDC_VERSION__ <dd>The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
8629 <dt> __TIME__ <dd>The time of translation of the preprocessing translation unit: a character
8630 string literal of the form "hh:mm:ss" as in the time generated by the
8631 asctime function. If the time of translation is not available, an
8632 implementation-defined valid time shall be supplied.
8633 </dl>
8636 <!--page 173 -->
8637 <p><a name="6.10.8p2" href="#6.10.8p2"><small>2</small></a>
8638 The following macro names are conditionally defined by the implementation:
8639 <dl>
8640 <dt> __STDC_IEC_559__ <dd>The integer constant 1, intended to indicate conformance to the
8641 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
8642 <dt> __STDC_IEC_559_COMPLEX__ <dd>The integer constant 1, intended to indicate
8643 adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
8644 compatible complex arithmetic).
8645 <dt> __STDC_ISO_10646__ <dd>An integer constant of the form yyyymmL (for example,
8646 199712L). If this symbol is defined, then every character in the Unicode
8647 required set, when stored in an object of type wchar_t, has the same
8648 value as the short identifier of that character. The Unicode required set
8649 consists of all the characters that are defined by ISO/IEC 10646, along with
8650 all amendments and technical corrigenda, as of the specified year and
8651 month.
8652 </dl>
8653 <p><a name="6.10.8p3" href="#6.10.8p3"><small>3</small></a>
8654 The values of the predefined macros (except for __FILE__ and __LINE__) remain
8655 constant throughout the translation unit.
8656 <p><a name="6.10.8p4" href="#6.10.8p4"><small>4</small></a>
8657 None of these macro names, nor the identifier defined, shall be the subject of a
8658 #define or a #undef preprocessing directive. Any other predefined macro names
8659 shall begin with a leading underscore followed by an uppercase letter or a second
8660 underscore.
8661 <p><a name="6.10.8p5" href="#6.10.8p5"><small>5</small></a>
8662 The implementation shall not predefine the macro __cplusplus, nor shall it define it
8663 in any standard header.
8664 <p><b> Forward references</b>: the asctime function (<a href="#7.23.3.1">7.23.3.1</a>), standard headers (<a href="#7.1.2">7.1.2</a>).
8666 <p><b>Footnotes</b>
8667 <p><small><a name="note154" href="#note154">154)</a> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
8668 </small>
8669 <p><small><a name="note155" href="#note155">155)</a> The presumed source file name and line number can be changed by the #line directive.
8670 </small>
8671 <p><small><a name="note156" href="#note156">156)</a> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
8672 ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
8673 int that is increased with each revision of this International Standard.
8674 </small>
8676 <p><small><a href="#Contents">Contents</a></small>
8677 <h4><a name="6.10.9" href="#6.10.9">6.10.9 Pragma operator</a></h4>
8678 <p><b>Semantics</b>
8679 <p><a name="6.10.9p1" href="#6.10.9p1"><small>1</small></a>
8680 A unary operator expression of the form:
8681 <pre>
8682 _Pragma ( string-literal )
8683 </pre>
8684 is processed as follows: The string literal is destringized by deleting the L prefix, if
8685 present, deleting the leading and trailing double-quotes, replacing each escape sequence
8686 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
8687 resulting sequence of characters is processed through translation phase 3 to produce
8688 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
8689 directive. The original four preprocessing tokens in the unary operator expression are
8690 removed.
8691 <p><a name="6.10.9p2" href="#6.10.9p2"><small>2</small></a>
8692 EXAMPLE A directive of the form:
8693 <pre>
8694 #pragma listing on "..\listing.dir"
8695 </pre>
8696 can also be expressed as:
8697 <!--page 174 -->
8698 <pre>
8699 _Pragma ( "listing on \"..\\listing.dir\"" )
8700 </pre>
8701 The latter form is processed in the same way whether it appears literally as shown, or results from macro
8702 replacement, as in:
8703 <!--page 175 -->
8704 <pre>
8705 #define LISTING(x) PRAGMA(listing on #x)
8706 #define PRAGMA(x) _Pragma(#x)
8707 LISTING ( ..\listing.dir )
8708 </pre>
8710 <p><small><a href="#Contents">Contents</a></small>
8711 <h3><a name="6.11" href="#6.11">6.11 Future language directions</a></h3>
8713 <p><small><a href="#Contents">Contents</a></small>
8714 <h4><a name="6.11.1" href="#6.11.1">6.11.1 Floating types</a></h4>
8715 <p><a name="6.11.1p1" href="#6.11.1p1"><small>1</small></a>
8716 Future standardization may include additional floating-point types, including those with
8717 greater range, precision, or both than long double.
8719 <p><small><a href="#Contents">Contents</a></small>
8720 <h4><a name="6.11.2" href="#6.11.2">6.11.2 Linkages of identifiers</a></h4>
8721 <p><a name="6.11.2p1" href="#6.11.2p1"><small>1</small></a>
8722 Declaring an identifier with internal linkage at file scope without the static storage-
8723 class specifier is an obsolescent feature.
8725 <p><small><a href="#Contents">Contents</a></small>
8726 <h4><a name="6.11.3" href="#6.11.3">6.11.3 External names</a></h4>
8727 <p><a name="6.11.3p1" href="#6.11.3p1"><small>1</small></a>
8728 Restriction of the significance of an external name to fewer than 255 characters
8729 (considering each universal character name or extended source character as a single
8730 character) is an obsolescent feature that is a concession to existing implementations.
8732 <p><small><a href="#Contents">Contents</a></small>
8733 <h4><a name="6.11.4" href="#6.11.4">6.11.4 Character escape sequences</a></h4>
8734 <p><a name="6.11.4p1" href="#6.11.4p1"><small>1</small></a>
8735 Lowercase letters as escape sequences are reserved for future standardization. Other
8736 characters may be used in extensions.
8738 <p><small><a href="#Contents">Contents</a></small>
8739 <h4><a name="6.11.5" href="#6.11.5">6.11.5 Storage-class specifiers</a></h4>
8740 <p><a name="6.11.5p1" href="#6.11.5p1"><small>1</small></a>
8741 The placement of a storage-class specifier other than at the beginning of the declaration
8742 specifiers in a declaration is an obsolescent feature.
8744 <p><small><a href="#Contents">Contents</a></small>
8745 <h4><a name="6.11.6" href="#6.11.6">6.11.6 Function declarators</a></h4>
8746 <p><a name="6.11.6p1" href="#6.11.6p1"><small>1</small></a>
8747 The use of function declarators with empty parentheses (not prototype-format parameter
8748 type declarators) is an obsolescent feature.
8750 <p><small><a href="#Contents">Contents</a></small>
8751 <h4><a name="6.11.7" href="#6.11.7">6.11.7 Function definitions</a></h4>
8752 <p><a name="6.11.7p1" href="#6.11.7p1"><small>1</small></a>
8753 The use of function definitions with separate parameter identifier and declaration lists
8754 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
8756 <p><small><a href="#Contents">Contents</a></small>
8757 <h4><a name="6.11.8" href="#6.11.8">6.11.8 Pragma directives</a></h4>
8758 <p><a name="6.11.8p1" href="#6.11.8p1"><small>1</small></a>
8759 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
8761 <p><small><a href="#Contents">Contents</a></small>
8762 <h4><a name="6.11.9" href="#6.11.9">6.11.9 Predefined macro names</a></h4>
8763 <p><a name="6.11.9p1" href="#6.11.9p1"><small>1</small></a>
8764 Macro names beginning with __STDC_ are reserved for future standardization.
8765 <!--page 176 -->
8767 <p><small><a href="#Contents">Contents</a></small>
8768 <h2><a name="7" href="#7">7. Library</a></h2>
8771 <p><small><a href="#Contents">Contents</a></small>
8772 <h3><a name="7.1" href="#7.1">7.1 Introduction</a></h3>
8774 <p><small><a href="#Contents">Contents</a></small>
8775 <h4><a name="7.1.1" href="#7.1.1">7.1.1 Definitions of terms</a></h4>
8776 <p><a name="7.1.1p1" href="#7.1.1p1"><small>1</small></a>
8777 A string is a contiguous sequence of characters terminated by and including the first null
8778 character. The term multibyte string is sometimes used instead to emphasize special
8779 processing given to multibyte characters contained in the string or to avoid confusion
8780 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
8781 character. The length of a string is the number of bytes preceding the null character and
8782 the value of a string is the sequence of the values of the contained characters, in order.
8783 <p><a name="7.1.1p2" href="#7.1.1p2"><small>2</small></a>
8784 The decimal-point character is the character used by functions that convert floating-point
8785 numbers to or from character sequences to denote the beginning of the fractional part of
8786 such character sequences.<sup><a href="#note157"><b>157)</b></a></sup> It is represented in the text and examples by a period, but
8787 may be changed by the setlocale function.
8788 <p><a name="7.1.1p3" href="#7.1.1p3"><small>3</small></a>
8789 A null wide character is a wide character with code value zero.
8790 <p><a name="7.1.1p4" href="#7.1.1p4"><small>4</small></a>
8791 A wide string is a contiguous sequence of wide characters terminated by and including
8792 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
8793 addressed) wide character. The length of a wide string is the number of wide characters
8794 preceding the null wide character and the value of a wide string is the sequence of code
8795 values of the contained wide characters, in order.
8796 <p><a name="7.1.1p5" href="#7.1.1p5"><small>5</small></a>
8797 A shift sequence is a contiguous sequence of bytes within a multibyte string that
8798 (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
8799 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
8800 character.<sup><a href="#note158"><b>158)</b></a></sup>
8801 <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>).
8806 <!--page 177 -->
8808 <p><b>Footnotes</b>
8809 <p><small><a name="note157" href="#note157">157)</a> The functions that make use of the decimal-point character are the numeric conversion functions
8810 (<a href="#7.20.1">7.20.1</a>, <a href="#7.24.4.1">7.24.4.1</a>) and the formatted input/output functions (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
8811 </small>
8812 <p><small><a name="note158" href="#note158">158)</a> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
8813 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
8814 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
8815 implementation's choice.
8816 </small>
8818 <p><small><a href="#Contents">Contents</a></small>
8819 <h4><a name="7.1.2" href="#7.1.2">7.1.2 Standard headers</a></h4>
8820 <p><a name="7.1.2p1" href="#7.1.2p1"><small>1</small></a>
8821 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note159"><b>159)</b></a></sup>
8822 whose contents are made available by the #include preprocessing directive. The
8823 header declares a set of related functions, plus any necessary types and additional macros
8824 needed to facilitate their use. Declarations of types described in this clause shall not
8825 include type qualifiers, unless explicitly stated otherwise.
8826 <p><a name="7.1.2p2" href="#7.1.2p2"><small>2</small></a>
8827 The standard headers are
8828 <pre>
8829 <a href="#7.2">&lt;assert.h&gt;</a> <a href="#7.8">&lt;inttypes.h&gt;</a> <a href="#7.14">&lt;signal.h&gt;</a> <a href="#7.20">&lt;stdlib.h&gt;</a>
8830 <a href="#7.3">&lt;complex.h&gt;</a> <a href="#7.9">&lt;iso646.h&gt;</a> <a href="#7.15">&lt;stdarg.h&gt;</a> <a href="#7.21">&lt;string.h&gt;</a>
8831 <a href="#7.4">&lt;ctype.h&gt;</a> <a href="#7.10">&lt;limits.h&gt;</a> <a href="#7.16">&lt;stdbool.h&gt;</a> <a href="#7.22">&lt;tgmath.h&gt;</a>
8832 <a href="#7.5">&lt;errno.h&gt;</a> <a href="#7.11">&lt;locale.h&gt;</a> <a href="#7.17">&lt;stddef.h&gt;</a> <a href="#7.23">&lt;time.h&gt;</a>
8833 <a href="#7.6">&lt;fenv.h&gt;</a> <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.18">&lt;stdint.h&gt;</a> <a href="#7.24">&lt;wchar.h&gt;</a>
8834 <a href="#7.7">&lt;float.h&gt;</a> <a href="#7.13">&lt;setjmp.h&gt;</a> <a href="#7.19">&lt;stdio.h&gt;</a> <a href="#7.25">&lt;wctype.h&gt;</a>
8835 </pre>
8836 <p><a name="7.1.2p3" href="#7.1.2p3"><small>3</small></a>
8837 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
8838 provided as part of the implementation, is placed in any of the standard places that are
8839 searched for included source files, the behavior is undefined.
8840 <p><a name="7.1.2p4" href="#7.1.2p4"><small>4</small></a>
8841 Standard headers may be included in any order; each may be included more than once in
8842 a given scope, with no effect different from being included only once, except that the
8843 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
8844 used, a header shall be included outside of any external declaration or definition, and it
8845 shall first be included before the first reference to any of the functions or objects it
8846 declares, or to any of the types or macros it defines. However, if an identifier is declared
8847 or defined in more than one header, the second and subsequent associated headers may be
8848 included after the initial reference to the identifier. The program shall not have any
8849 macros with names lexically identical to keywords currently defined prior to the
8850 inclusion.
8851 <p><a name="7.1.2p5" href="#7.1.2p5"><small>5</small></a>
8852 Any definition of an object-like macro described in this clause shall expand to code that is
8853 fully protected by parentheses where necessary, so that it groups in an arbitrary
8854 expression as if it were a single identifier.
8855 <p><a name="7.1.2p6" href="#7.1.2p6"><small>6</small></a>
8856 Any declaration of a library function shall have external linkage.
8857 <p><a name="7.1.2p7" href="#7.1.2p7"><small>7</small></a>
8858 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
8859 <p><b> Forward references</b>: diagnostics (<a href="#7.2">7.2</a>).
8864 <!--page 178 -->
8866 <p><b>Footnotes</b>
8867 <p><small><a name="note159" href="#note159">159)</a> A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
8868 necessarily valid source file names.
8869 </small>
8871 <p><small><a href="#Contents">Contents</a></small>
8872 <h4><a name="7.1.3" href="#7.1.3">7.1.3 Reserved identifiers</a></h4>
8873 <p><a name="7.1.3p1" href="#7.1.3p1"><small>1</small></a>
8874 Each header declares or defines all identifiers listed in its associated subclause, and
8875 optionally declares or defines identifiers listed in its associated future library directions
8876 subclause and identifiers which are always reserved either for any use or for use as file
8877 scope identifiers.
8878 <ul>
8879 <li> All identifiers that begin with an underscore and either an uppercase letter or another
8880 underscore are always reserved for any use.
8881 <li> All identifiers that begin with an underscore are always reserved for use as identifiers
8882 with file scope in both the ordinary and tag name spaces.
8883 <li> Each macro name in any of the following subclauses (including the future library
8884 directions) is reserved for use as specified if any of its associated headers is included;
8885 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
8886 <li> All identifiers with external linkage in any of the following subclauses (including the
8887 future library directions) are always reserved for use as identifiers with external
8888 linkage.<sup><a href="#note160"><b>160)</b></a></sup>
8889 <li> Each identifier with file scope listed in any of the following subclauses (including the
8890 future library directions) is reserved for use as a macro name and as an identifier with
8891 file scope in the same name space if any of its associated headers is included.
8892 </ul>
8893 <p><a name="7.1.3p2" href="#7.1.3p2"><small>2</small></a>
8894 No other identifiers are reserved. If the program declares or defines an identifier in a
8895 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
8896 identifier as a macro name, the behavior is undefined.
8897 <p><a name="7.1.3p3" href="#7.1.3p3"><small>3</small></a>
8898 If the program removes (with #undef) any macro definition of an identifier in the first
8899 group listed above, the behavior is undefined.
8901 <p><b>Footnotes</b>
8902 <p><small><a name="note160" href="#note160">160)</a> The list of reserved identifiers with external linkage includes errno, math_errhandling,
8903 setjmp, and va_end.
8904 </small>
8906 <p><small><a href="#Contents">Contents</a></small>
8907 <h4><a name="7.1.4" href="#7.1.4">7.1.4 Use of library functions</a></h4>
8908 <p><a name="7.1.4p1" href="#7.1.4p1"><small>1</small></a>
8909 Each of the following statements applies unless explicitly stated otherwise in the detailed
8910 descriptions that follow: If an argument to a function has an invalid value (such as a value
8911 outside the domain of the function, or a pointer outside the address space of the program,
8912 or a null pointer, or a pointer to non-modifiable storage when the corresponding
8913 parameter is not const-qualified) or a type (after promotion) not expected by a function
8914 with variable number of arguments, the behavior is undefined. If a function argument is
8915 described as being an array, the pointer actually passed to the function shall have a value
8916 such that all address computations and accesses to objects (that would be valid if the
8917 pointer did point to the first element of such an array) are in fact valid. Any function
8918 declared in a header may be additionally implemented as a function-like macro defined in
8920 <!--page 179 -->
8921 the header, so if a library function is declared explicitly when its header is included, one
8922 of the techniques shown below can be used to ensure the declaration is not affected by
8923 such a macro. Any macro definition of a function can be suppressed locally by enclosing
8924 the name of the function in parentheses, because the name is then not followed by the left
8925 parenthesis that indicates expansion of a macro function name. For the same syntactic
8926 reason, it is permitted to take the address of a library function even if it is also defined as
8927 a macro.<sup><a href="#note161"><b>161)</b></a></sup> The use of #undef to remove any macro definition will also ensure that an
8928 actual function is referred to. Any invocation of a library function that is implemented as
8929 a macro shall expand to code that evaluates each of its arguments exactly once, fully
8930 protected by parentheses where necessary, so it is generally safe to use arbitrary
8931 expressions as arguments.<sup><a href="#note162"><b>162)</b></a></sup> Likewise, those function-like macros described in the
8932 following subclauses may be invoked in an expression anywhere a function with a
8933 compatible return type could be called.<sup><a href="#note163"><b>163)</b></a></sup> All object-like macros listed as expanding to
8934 integer constant expressions shall additionally be suitable for use in #if preprocessing
8935 directives.
8936 <p><a name="7.1.4p2" href="#7.1.4p2"><small>2</small></a>
8937 Provided that a library function can be declared without reference to any type defined in a
8938 header, it is also permissible to declare the function and use it without including its
8939 associated header.
8940 <p><a name="7.1.4p3" href="#7.1.4p3"><small>3</small></a>
8941 There is a sequence point immediately before a library function returns.
8942 <p><a name="7.1.4p4" href="#7.1.4p4"><small>4</small></a>
8943 The functions in the standard library are not guaranteed to be reentrant and may modify
8944 objects with static storage duration.<sup><a href="#note164"><b>164)</b></a></sup>
8948 <!--page 180 -->
8949 <p><a name="7.1.4p5" href="#7.1.4p5"><small>5</small></a>
8950 EXAMPLE The function atoi may be used in any of several ways:
8951 <ul>
8952 <li> by use of its associated header (possibly generating a macro expansion)
8953 <pre>
8954 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8955 const char *str;
8956 /* ... */
8957 i = atoi(str);
8958 </pre>
8959 <li> by use of its associated header (assuredly generating a true function reference)
8960 <pre>
8961 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8962 #undef atoi
8963 const char *str;
8964 /* ... */
8965 i = atoi(str);
8966 </pre>
8968 <pre>
8969 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
8970 const char *str;
8971 /* ... */
8972 i = (atoi)(str);
8973 </pre>
8974 <li> by explicit declaration
8975 <!--page 181 -->
8976 <pre>
8977 extern int atoi(const char *);
8978 const char *str;
8979 /* ... */
8980 i = atoi(str);
8981 </pre>
8982 </ul>
8984 <p><b>Footnotes</b>
8985 <p><small><a name="note161" href="#note161">161)</a> This means that an implementation shall provide an actual function for each library function, even if it
8986 also provides a macro for that function.
8987 </small>
8988 <p><small><a name="note162" href="#note162">162)</a> Such macros might not contain the sequence points that the corresponding function calls do.
8989 </small>
8990 <p><small><a name="note163" href="#note163">163)</a> Because external identifiers and some macro names beginning with an underscore are reserved,
8991 implementations may provide special semantics for such names. For example, the identifier
8992 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
8993 appropriate header could specify
8995 <pre>
8996 #define abs(x) _BUILTIN_abs(x)
8997 </pre>
8998 for a compiler whose code generator will accept it.
8999 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
9000 function may write
9002 <pre>
9003 #undef abs
9004 </pre>
9005 whether the implementation's header provides a macro implementation of abs or a built-in
9006 implementation. The prototype for the function, which precedes and is hidden by any macro
9007 definition, is thereby revealed also.
9008 </small>
9009 <p><small><a name="note164" href="#note164">164)</a> Thus, a signal handler cannot, in general, call standard library functions.
9010 </small>
9012 <p><small><a href="#Contents">Contents</a></small>
9013 <h3><a name="7.2" href="#7.2">7.2 Diagnostics &lt;assert.h&gt;</a></h3>
9014 <p><a name="7.2p1" href="#7.2p1"><small>1</small></a>
9015 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert macro and refers to another macro,
9016 <pre>
9017 NDEBUG
9018 </pre>
9019 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
9020 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
9021 simply as
9022 <pre>
9023 #define assert(ignore) ((void)0)
9024 </pre>
9025 The assert macro is redefined according to the current state of NDEBUG each time that
9026 <a href="#7.2">&lt;assert.h&gt;</a> is included.
9027 <p><a name="7.2p2" href="#7.2p2"><small>2</small></a>
9028 The assert macro shall be implemented as a macro, not as an actual function. If the
9029 macro definition is suppressed in order to access an actual function, the behavior is
9030 undefined.
9032 <p><small><a href="#Contents">Contents</a></small>
9033 <h4><a name="7.2.1" href="#7.2.1">7.2.1 Program diagnostics</a></h4>
9035 <p><small><a href="#Contents">Contents</a></small>
9036 <h5><a name="7.2.1.1" href="#7.2.1.1">7.2.1.1 The assert macro</a></h5>
9037 <p><b>Synopsis</b>
9038 <p><a name="7.2.1.1p1" href="#7.2.1.1p1"><small>1</small></a>
9039 <pre>
9040 #include <a href="#7.2">&lt;assert.h&gt;</a>
9041 void assert(scalar expression);
9042 </pre>
9043 <p><b>Description</b>
9044 <p><a name="7.2.1.1p2" href="#7.2.1.1p2"><small>2</small></a>
9045 The assert macro puts diagnostic tests into programs; it expands to a void expression.
9046 When it is executed, if expression (which shall have a scalar type) is false (that is,
9047 compares equal to 0), the assert macro writes information about the particular call that
9048 failed (including the text of the argument, the name of the source file, the source line
9049 number, and the name of the enclosing function -- the latter are respectively the values of
9050 the preprocessing macros __FILE__ and __LINE__ and of the identifier
9051 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note165"><b>165)</b></a></sup> It
9052 then calls the abort function.
9053 <p><b>Returns</b>
9054 <p><a name="7.2.1.1p3" href="#7.2.1.1p3"><small>3</small></a>
9055 The assert macro returns no value.
9056 <p><b> Forward references</b>: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
9061 <!--page 182 -->
9063 <p><b>Footnotes</b>
9064 <p><small><a name="note165" href="#note165">165)</a> The message written might be of the form:
9065 Assertion failed: expression, function abc, file xyz, line nnn.
9066 </small>
9068 <p><small><a href="#Contents">Contents</a></small>
9069 <h3><a name="7.3" href="#7.3">7.3 Complex arithmetic &lt;complex.h&gt;</a></h3>
9071 <p><small><a href="#Contents">Contents</a></small>
9072 <h4><a name="7.3.1" href="#7.3.1">7.3.1 Introduction</a></h4>
9073 <p><a name="7.3.1p1" href="#7.3.1p1"><small>1</small></a>
9074 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
9075 arithmetic.<sup><a href="#note166"><b>166)</b></a></sup> Each synopsis specifies a family of functions consisting of a principal
9076 function with one or more double complex parameters and a double complex or
9077 double return value; and other functions with the same name but with f and l suffixes
9078 which are corresponding functions with float and long double parameters and
9079 return values.
9080 <p><a name="7.3.1p2" href="#7.3.1p2"><small>2</small></a>
9081 The macro
9082 <pre>
9083 complex
9084 </pre>
9085 expands to _Complex; the macro
9086 <pre>
9087 _Complex_I
9088 </pre>
9089 expands to a constant expression of type const float _Complex, with the value of
9090 the imaginary unit.<sup><a href="#note167"><b>167)</b></a></sup>
9091 <p><a name="7.3.1p3" href="#7.3.1p3"><small>3</small></a>
9092 The macros
9093 <pre>
9094 imaginary
9095 </pre>
9097 <pre>
9098 _Imaginary_I
9099 </pre>
9100 are defined if and only if the implementation supports imaginary types;<sup><a href="#note168"><b>168)</b></a></sup> if defined,
9101 they expand to _Imaginary and a constant expression of type const float
9102 _Imaginary with the value of the imaginary unit.
9103 <p><a name="7.3.1p4" href="#7.3.1p4"><small>4</small></a>
9104 The macro
9105 <pre>
9107 </pre>
9108 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
9109 defined, I shall expand to _Complex_I.
9110 <p><a name="7.3.1p5" href="#7.3.1p5"><small>5</small></a>
9111 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
9112 redefine the macros complex, imaginary, and I.
9113 <p><b> Forward references</b>: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
9117 <!--page 183 -->
9119 <p><b>Footnotes</b>
9120 <p><small><a name="note166" href="#note166">166)</a> See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
9121 </small>
9122 <p><small><a name="note167" href="#note167">167)</a> The imaginary unit is a number i such that i<sup>2</sup> = -1.
9123 </small>
9124 <p><small><a name="note168" href="#note168">168)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
9125 </small>
9127 <p><small><a href="#Contents">Contents</a></small>
9128 <h4><a name="7.3.2" href="#7.3.2">7.3.2 Conventions</a></h4>
9129 <p><a name="7.3.2p1" href="#7.3.2p1"><small>1</small></a>
9130 Values are interpreted as radians, not degrees. An implementation may set errno but is
9131 not required to.
9133 <p><small><a href="#Contents">Contents</a></small>
9134 <h4><a name="7.3.3" href="#7.3.3">7.3.3 Branch cuts</a></h4>
9135 <p><a name="7.3.3p1" href="#7.3.3p1"><small>1</small></a>
9136 Some of the functions below have branch cuts, across which the function is
9137 discontinuous. For implementations with a signed zero (including all IEC 60559
9138 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
9139 one side of a cut from another so the function is continuous (except for format
9140 limitations) as the cut is approached from either side. For example, for the square root
9141 function, which has a branch cut along the negative real axis, the top of the cut, with
9142 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
9143 imaginary part -0, maps to the negative imaginary axis.
9144 <p><a name="7.3.3p2" href="#7.3.3p2"><small>2</small></a>
9145 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
9146 sides of branch cuts. These implementations shall map a cut so the function is continuous
9147 as the cut is approached coming around the finite endpoint of the cut in a counter
9148 clockwise direction. (Branch cuts for the functions specified here have just one finite
9149 endpoint.) For example, for the square root function, coming counter clockwise around
9150 the finite endpoint of the cut along the negative real axis approaches the cut from above,
9151 so the cut maps to the positive imaginary axis.
9153 <p><small><a href="#Contents">Contents</a></small>
9154 <h4><a name="7.3.4" href="#7.3.4">7.3.4 The CX_LIMITED_RANGE pragma</a></h4>
9155 <p><b>Synopsis</b>
9156 <p><a name="7.3.4p1" href="#7.3.4p1"><small>1</small></a>
9157 <pre>
9158 #include <a href="#7.3">&lt;complex.h&gt;</a>
9159 #pragma STDC CX_LIMITED_RANGE on-off-switch
9160 </pre>
9161 <p><b>Description</b>
9162 <p><a name="7.3.4p2" href="#7.3.4p2"><small>2</small></a>
9163 The usual mathematical formulas for complex multiply, divide, and absolute value are
9164 problematic because of their treatment of infinities and because of undue overflow and
9165 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
9166 implementation that (where the state is ''on'') the usual mathematical formulas are
9167 acceptable.<sup><a href="#note169"><b>169)</b></a></sup> The pragma can occur either outside external declarations or preceding all
9168 explicit declarations and statements inside a compound statement. When outside external
9170 <!--page 184 -->
9171 declarations, the pragma takes effect from its occurrence until another
9172 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
9173 When inside a compound statement, the pragma takes effect from its occurrence until
9174 another CX_LIMITED_RANGE pragma is encountered (including within a nested
9175 compound statement), or until the end of the compound statement; at the end of a
9176 compound statement the state for the pragma is restored to its condition just before the
9177 compound statement. If this pragma is used in any other context, the behavior is
9178 undefined. The default state for the pragma is ''off''.
9180 <p><b>Footnotes</b>
9181 <p><small><a name="note169" href="#note169">169)</a> The purpose of the pragma is to allow the implementation to use the formulas:
9183 <pre>
9184 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
9185 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u<sup>2</sup> + v<sup>2</sup>)
9186 | x + iy | = (sqrt)(x<sup>2</sup> + y<sup>2</sup>)
9187 </pre>
9188 where the programmer can determine they are safe.
9189 </small>
9191 <p><small><a href="#Contents">Contents</a></small>
9192 <h4><a name="7.3.5" href="#7.3.5">7.3.5 Trigonometric functions</a></h4>
9194 <p><small><a href="#Contents">Contents</a></small>
9195 <h5><a name="7.3.5.1" href="#7.3.5.1">7.3.5.1 The cacos functions</a></h5>
9196 <p><b>Synopsis</b>
9197 <p><a name="7.3.5.1p1" href="#7.3.5.1p1"><small>1</small></a>
9198 <pre>
9199 #include <a href="#7.3">&lt;complex.h&gt;</a>
9200 double complex cacos(double complex z);
9201 float complex cacosf(float complex z);
9202 long double complex cacosl(long double complex z);
9203 </pre>
9204 <p><b>Description</b>
9205 <p><a name="7.3.5.1p2" href="#7.3.5.1p2"><small>2</small></a>
9206 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
9207 interval [-1, +1] along the real axis.
9208 <p><b>Returns</b>
9209 <p><a name="7.3.5.1p3" href="#7.3.5.1p3"><small>3</small></a>
9210 The cacos functions return the complex arc cosine value, in the range of a strip
9211 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
9212 real axis.
9214 <p><small><a href="#Contents">Contents</a></small>
9215 <h5><a name="7.3.5.2" href="#7.3.5.2">7.3.5.2 The casin functions</a></h5>
9216 <p><b>Synopsis</b>
9217 <p><a name="7.3.5.2p1" href="#7.3.5.2p1"><small>1</small></a>
9218 <pre>
9219 #include <a href="#7.3">&lt;complex.h&gt;</a>
9220 double complex casin(double complex z);
9221 float complex casinf(float complex z);
9222 long double complex casinl(long double complex z);
9223 </pre>
9224 <p><b>Description</b>
9225 <p><a name="7.3.5.2p2" href="#7.3.5.2p2"><small>2</small></a>
9226 The casin functions compute the complex arc sine of z, with branch cuts outside the
9227 interval [-1, +1] along the real axis.
9228 <p><b>Returns</b>
9229 <p><a name="7.3.5.2p3" href="#7.3.5.2p3"><small>3</small></a>
9230 The casin functions return the complex arc sine value, in the range of a strip
9231 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9232 along the real axis.
9233 <!--page 185 -->
9235 <p><small><a href="#Contents">Contents</a></small>
9236 <h5><a name="7.3.5.3" href="#7.3.5.3">7.3.5.3 The catan functions</a></h5>
9237 <p><b>Synopsis</b>
9238 <p><a name="7.3.5.3p1" href="#7.3.5.3p1"><small>1</small></a>
9239 <pre>
9240 #include <a href="#7.3">&lt;complex.h&gt;</a>
9241 double complex catan(double complex z);
9242 float complex catanf(float complex z);
9243 long double complex catanl(long double complex z);
9244 </pre>
9245 <p><b>Description</b>
9246 <p><a name="7.3.5.3p2" href="#7.3.5.3p2"><small>2</small></a>
9247 The catan functions compute the complex arc tangent of z, with branch cuts outside the
9248 interval [-i, +i] along the imaginary axis.
9249 <p><b>Returns</b>
9250 <p><a name="7.3.5.3p3" href="#7.3.5.3p3"><small>3</small></a>
9251 The catan functions return the complex arc tangent value, in the range of a strip
9252 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
9253 along the real axis.
9255 <p><small><a href="#Contents">Contents</a></small>
9256 <h5><a name="7.3.5.4" href="#7.3.5.4">7.3.5.4 The ccos functions</a></h5>
9257 <p><b>Synopsis</b>
9258 <p><a name="7.3.5.4p1" href="#7.3.5.4p1"><small>1</small></a>
9259 <pre>
9260 #include <a href="#7.3">&lt;complex.h&gt;</a>
9261 double complex ccos(double complex z);
9262 float complex ccosf(float complex z);
9263 long double complex ccosl(long double complex z);
9264 </pre>
9265 <p><b>Description</b>
9266 <p><a name="7.3.5.4p2" href="#7.3.5.4p2"><small>2</small></a>
9267 The ccos functions compute the complex cosine of z.
9268 <p><b>Returns</b>
9269 <p><a name="7.3.5.4p3" href="#7.3.5.4p3"><small>3</small></a>
9270 The ccos functions return the complex cosine value.
9272 <p><small><a href="#Contents">Contents</a></small>
9273 <h5><a name="7.3.5.5" href="#7.3.5.5">7.3.5.5 The csin functions</a></h5>
9274 <p><b>Synopsis</b>
9275 <p><a name="7.3.5.5p1" href="#7.3.5.5p1"><small>1</small></a>
9276 <pre>
9277 #include <a href="#7.3">&lt;complex.h&gt;</a>
9278 double complex csin(double complex z);
9279 float complex csinf(float complex z);
9280 long double complex csinl(long double complex z);
9281 </pre>
9282 <p><b>Description</b>
9283 <p><a name="7.3.5.5p2" href="#7.3.5.5p2"><small>2</small></a>
9284 The csin functions compute the complex sine of z.
9285 <p><b>Returns</b>
9286 <p><a name="7.3.5.5p3" href="#7.3.5.5p3"><small>3</small></a>
9287 The csin functions return the complex sine value.
9288 <!--page 186 -->
9290 <p><small><a href="#Contents">Contents</a></small>
9291 <h5><a name="7.3.5.6" href="#7.3.5.6">7.3.5.6 The ctan functions</a></h5>
9292 <p><b>Synopsis</b>
9293 <p><a name="7.3.5.6p1" href="#7.3.5.6p1"><small>1</small></a>
9294 <pre>
9295 #include <a href="#7.3">&lt;complex.h&gt;</a>
9296 double complex ctan(double complex z);
9297 float complex ctanf(float complex z);
9298 long double complex ctanl(long double complex z);
9299 </pre>
9300 <p><b>Description</b>
9301 <p><a name="7.3.5.6p2" href="#7.3.5.6p2"><small>2</small></a>
9302 The ctan functions compute the complex tangent of z.
9303 <p><b>Returns</b>
9304 <p><a name="7.3.5.6p3" href="#7.3.5.6p3"><small>3</small></a>
9305 The ctan functions return the complex tangent value.
9307 <p><small><a href="#Contents">Contents</a></small>
9308 <h4><a name="7.3.6" href="#7.3.6">7.3.6 Hyperbolic functions</a></h4>
9310 <p><small><a href="#Contents">Contents</a></small>
9311 <h5><a name="7.3.6.1" href="#7.3.6.1">7.3.6.1 The cacosh functions</a></h5>
9312 <p><b>Synopsis</b>
9313 <p><a name="7.3.6.1p1" href="#7.3.6.1p1"><small>1</small></a>
9314 <pre>
9315 #include <a href="#7.3">&lt;complex.h&gt;</a>
9316 double complex cacosh(double complex z);
9317 float complex cacoshf(float complex z);
9318 long double complex cacoshl(long double complex z);
9319 </pre>
9320 <p><b>Description</b>
9321 <p><a name="7.3.6.1p2" href="#7.3.6.1p2"><small>2</small></a>
9322 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
9323 cut at values less than 1 along the real axis.
9324 <p><b>Returns</b>
9325 <p><a name="7.3.6.1p3" href="#7.3.6.1p3"><small>3</small></a>
9326 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
9327 half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
9328 the imaginary axis.
9330 <p><small><a href="#Contents">Contents</a></small>
9331 <h5><a name="7.3.6.2" href="#7.3.6.2">7.3.6.2 The casinh functions</a></h5>
9332 <p><b>Synopsis</b>
9333 <p><a name="7.3.6.2p1" href="#7.3.6.2p1"><small>1</small></a>
9334 <pre>
9335 #include <a href="#7.3">&lt;complex.h&gt;</a>
9336 double complex casinh(double complex z);
9337 float complex casinhf(float complex z);
9338 long double complex casinhl(long double complex z);
9339 </pre>
9340 <p><b>Description</b>
9341 <p><a name="7.3.6.2p2" href="#7.3.6.2p2"><small>2</small></a>
9342 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
9343 outside the interval [-i, +i] along the imaginary axis.
9344 <!--page 187 -->
9345 <p><b>Returns</b>
9346 <p><a name="7.3.6.2p3" href="#7.3.6.2p3"><small>3</small></a>
9347 The casinh functions return the complex arc hyperbolic sine value, in the range of a
9348 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9349 along the imaginary axis.
9351 <p><small><a href="#Contents">Contents</a></small>
9352 <h5><a name="7.3.6.3" href="#7.3.6.3">7.3.6.3 The catanh functions</a></h5>
9353 <p><b>Synopsis</b>
9354 <p><a name="7.3.6.3p1" href="#7.3.6.3p1"><small>1</small></a>
9355 <pre>
9356 #include <a href="#7.3">&lt;complex.h&gt;</a>
9357 double complex catanh(double complex z);
9358 float complex catanhf(float complex z);
9359 long double complex catanhl(long double complex z);
9360 </pre>
9361 <p><b>Description</b>
9362 <p><a name="7.3.6.3p2" href="#7.3.6.3p2"><small>2</small></a>
9363 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
9364 cuts outside the interval [-1, +1] along the real axis.
9365 <p><b>Returns</b>
9366 <p><a name="7.3.6.3p3" href="#7.3.6.3p3"><small>3</small></a>
9367 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
9368 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
9369 along the imaginary axis.
9371 <p><small><a href="#Contents">Contents</a></small>
9372 <h5><a name="7.3.6.4" href="#7.3.6.4">7.3.6.4 The ccosh functions</a></h5>
9373 <p><b>Synopsis</b>
9374 <p><a name="7.3.6.4p1" href="#7.3.6.4p1"><small>1</small></a>
9375 <pre>
9376 #include <a href="#7.3">&lt;complex.h&gt;</a>
9377 double complex ccosh(double complex z);
9378 float complex ccoshf(float complex z);
9379 long double complex ccoshl(long double complex z);
9380 </pre>
9381 <p><b>Description</b>
9382 <p><a name="7.3.6.4p2" href="#7.3.6.4p2"><small>2</small></a>
9383 The ccosh functions compute the complex hyperbolic cosine of z.
9384 <p><b>Returns</b>
9385 <p><a name="7.3.6.4p3" href="#7.3.6.4p3"><small>3</small></a>
9386 The ccosh functions return the complex hyperbolic cosine value.
9388 <p><small><a href="#Contents">Contents</a></small>
9389 <h5><a name="7.3.6.5" href="#7.3.6.5">7.3.6.5 The csinh functions</a></h5>
9390 <p><b>Synopsis</b>
9391 <p><a name="7.3.6.5p1" href="#7.3.6.5p1"><small>1</small></a>
9392 <!--page 188 -->
9393 <pre>
9394 #include <a href="#7.3">&lt;complex.h&gt;</a>
9395 double complex csinh(double complex z);
9396 float complex csinhf(float complex z);
9397 long double complex csinhl(long double complex z);
9398 </pre>
9399 <p><b>Description</b>
9400 <p><a name="7.3.6.5p2" href="#7.3.6.5p2"><small>2</small></a>
9401 The csinh functions compute the complex hyperbolic sine of z.
9402 <p><b>Returns</b>
9403 <p><a name="7.3.6.5p3" href="#7.3.6.5p3"><small>3</small></a>
9404 The csinh functions return the complex hyperbolic sine value.
9406 <p><small><a href="#Contents">Contents</a></small>
9407 <h5><a name="7.3.6.6" href="#7.3.6.6">7.3.6.6 The ctanh functions</a></h5>
9408 <p><b>Synopsis</b>
9409 <p><a name="7.3.6.6p1" href="#7.3.6.6p1"><small>1</small></a>
9410 <pre>
9411 #include <a href="#7.3">&lt;complex.h&gt;</a>
9412 double complex ctanh(double complex z);
9413 float complex ctanhf(float complex z);
9414 long double complex ctanhl(long double complex z);
9415 </pre>
9416 <p><b>Description</b>
9417 <p><a name="7.3.6.6p2" href="#7.3.6.6p2"><small>2</small></a>
9418 The ctanh functions compute the complex hyperbolic tangent of z.
9419 <p><b>Returns</b>
9420 <p><a name="7.3.6.6p3" href="#7.3.6.6p3"><small>3</small></a>
9421 The ctanh functions return the complex hyperbolic tangent value.
9423 <p><small><a href="#Contents">Contents</a></small>
9424 <h4><a name="7.3.7" href="#7.3.7">7.3.7 Exponential and logarithmic functions</a></h4>
9426 <p><small><a href="#Contents">Contents</a></small>
9427 <h5><a name="7.3.7.1" href="#7.3.7.1">7.3.7.1 The cexp functions</a></h5>
9428 <p><b>Synopsis</b>
9429 <p><a name="7.3.7.1p1" href="#7.3.7.1p1"><small>1</small></a>
9430 <pre>
9431 #include <a href="#7.3">&lt;complex.h&gt;</a>
9432 double complex cexp(double complex z);
9433 float complex cexpf(float complex z);
9434 long double complex cexpl(long double complex z);
9435 </pre>
9436 <p><b>Description</b>
9437 <p><a name="7.3.7.1p2" href="#7.3.7.1p2"><small>2</small></a>
9438 The cexp functions compute the complex base-e exponential of z.
9439 <p><b>Returns</b>
9440 <p><a name="7.3.7.1p3" href="#7.3.7.1p3"><small>3</small></a>
9441 The cexp functions return the complex base-e exponential value.
9443 <p><small><a href="#Contents">Contents</a></small>
9444 <h5><a name="7.3.7.2" href="#7.3.7.2">7.3.7.2 The clog functions</a></h5>
9445 <p><b>Synopsis</b>
9446 <p><a name="7.3.7.2p1" href="#7.3.7.2p1"><small>1</small></a>
9447 <!--page 189 -->
9448 <pre>
9449 #include <a href="#7.3">&lt;complex.h&gt;</a>
9450 double complex clog(double complex z);
9451 float complex clogf(float complex z);
9452 long double complex clogl(long double complex z);
9453 </pre>
9454 <p><b>Description</b>
9455 <p><a name="7.3.7.2p2" href="#7.3.7.2p2"><small>2</small></a>
9456 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
9457 cut along the negative real axis.
9458 <p><b>Returns</b>
9459 <p><a name="7.3.7.2p3" href="#7.3.7.2p3"><small>3</small></a>
9460 The clog functions return the complex natural logarithm value, in the range of a strip
9461 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
9462 imaginary axis.
9464 <p><small><a href="#Contents">Contents</a></small>
9465 <h4><a name="7.3.8" href="#7.3.8">7.3.8 Power and absolute-value functions</a></h4>
9467 <p><small><a href="#Contents">Contents</a></small>
9468 <h5><a name="7.3.8.1" href="#7.3.8.1">7.3.8.1 The cabs functions</a></h5>
9469 <p><b>Synopsis</b>
9470 <p><a name="7.3.8.1p1" href="#7.3.8.1p1"><small>1</small></a>
9471 <pre>
9472 #include <a href="#7.3">&lt;complex.h&gt;</a>
9473 double cabs(double complex z);
9474 float cabsf(float complex z);
9475 long double cabsl(long double complex z);
9476 </pre>
9477 <p><b>Description</b>
9478 <p><a name="7.3.8.1p2" href="#7.3.8.1p2"><small>2</small></a>
9479 The cabs functions compute the complex absolute value (also called norm, modulus, or
9480 magnitude) of z.
9481 <p><b>Returns</b>
9482 <p><a name="7.3.8.1p3" href="#7.3.8.1p3"><small>3</small></a>
9483 The cabs functions return the complex absolute value.
9485 <p><small><a href="#Contents">Contents</a></small>
9486 <h5><a name="7.3.8.2" href="#7.3.8.2">7.3.8.2 The cpow functions</a></h5>
9487 <p><b>Synopsis</b>
9488 <p><a name="7.3.8.2p1" href="#7.3.8.2p1"><small>1</small></a>
9489 <pre>
9490 #include <a href="#7.3">&lt;complex.h&gt;</a>
9491 double complex cpow(double complex x, double complex y);
9492 float complex cpowf(float complex x, float complex y);
9493 long double complex cpowl(long double complex x,
9494 long double complex y);
9495 </pre>
9496 <p><b>Description</b>
9497 <p><a name="7.3.8.2p2" href="#7.3.8.2p2"><small>2</small></a>
9498 The cpow functions compute the complex power function x<sup>y</sup> , with a branch cut for the
9499 first parameter along the negative real axis.
9500 <p><b>Returns</b>
9501 <p><a name="7.3.8.2p3" href="#7.3.8.2p3"><small>3</small></a>
9502 The cpow functions return the complex power function value.
9503 <!--page 190 -->
9505 <p><small><a href="#Contents">Contents</a></small>
9506 <h5><a name="7.3.8.3" href="#7.3.8.3">7.3.8.3 The csqrt functions</a></h5>
9507 <p><b>Synopsis</b>
9508 <p><a name="7.3.8.3p1" href="#7.3.8.3p1"><small>1</small></a>
9509 <pre>
9510 #include <a href="#7.3">&lt;complex.h&gt;</a>
9511 double complex csqrt(double complex z);
9512 float complex csqrtf(float complex z);
9513 long double complex csqrtl(long double complex z);
9514 </pre>
9515 <p><b>Description</b>
9516 <p><a name="7.3.8.3p2" href="#7.3.8.3p2"><small>2</small></a>
9517 The csqrt functions compute the complex square root of z, with a branch cut along the
9518 negative real axis.
9519 <p><b>Returns</b>
9520 <p><a name="7.3.8.3p3" href="#7.3.8.3p3"><small>3</small></a>
9521 The csqrt functions return the complex square root value, in the range of the right half-
9522 plane (including the imaginary axis).
9524 <p><small><a href="#Contents">Contents</a></small>
9525 <h4><a name="7.3.9" href="#7.3.9">7.3.9 Manipulation functions</a></h4>
9527 <p><small><a href="#Contents">Contents</a></small>
9528 <h5><a name="7.3.9.1" href="#7.3.9.1">7.3.9.1 The carg functions</a></h5>
9529 <p><b>Synopsis</b>
9530 <p><a name="7.3.9.1p1" href="#7.3.9.1p1"><small>1</small></a>
9531 <pre>
9532 #include <a href="#7.3">&lt;complex.h&gt;</a>
9533 double carg(double complex z);
9534 float cargf(float complex z);
9535 long double cargl(long double complex z);
9536 </pre>
9537 <p><b>Description</b>
9538 <p><a name="7.3.9.1p2" href="#7.3.9.1p2"><small>2</small></a>
9539 The carg functions compute the argument (also called phase angle) of z, with a branch
9540 cut along the negative real axis.
9541 <p><b>Returns</b>
9542 <p><a name="7.3.9.1p3" href="#7.3.9.1p3"><small>3</small></a>
9543 The carg functions return the value of the argument in the interval [-pi , +pi ].
9545 <p><small><a href="#Contents">Contents</a></small>
9546 <h5><a name="7.3.9.2" href="#7.3.9.2">7.3.9.2 The cimag functions</a></h5>
9547 <p><b>Synopsis</b>
9548 <p><a name="7.3.9.2p1" href="#7.3.9.2p1"><small>1</small></a>
9549 <!--page 191 -->
9550 <pre>
9551 #include <a href="#7.3">&lt;complex.h&gt;</a>
9552 double cimag(double complex z);
9553 float cimagf(float complex z);
9554 long double cimagl(long double complex z);
9555 </pre>
9556 <p><b>Description</b>
9557 <p><a name="7.3.9.2p2" href="#7.3.9.2p2"><small>2</small></a>
9558 The cimag functions compute the imaginary part of z.<sup><a href="#note170"><b>170)</b></a></sup>
9559 <p><b>Returns</b>
9560 <p><a name="7.3.9.2p3" href="#7.3.9.2p3"><small>3</small></a>
9561 The cimag functions return the imaginary part value (as a real).
9563 <p><b>Footnotes</b>
9564 <p><small><a name="note170" href="#note170">170)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
9565 </small>
9567 <p><small><a href="#Contents">Contents</a></small>
9568 <h5><a name="7.3.9.3" href="#7.3.9.3">7.3.9.3 The conj functions</a></h5>
9569 <p><b>Synopsis</b>
9570 <p><a name="7.3.9.3p1" href="#7.3.9.3p1"><small>1</small></a>
9571 <pre>
9572 #include <a href="#7.3">&lt;complex.h&gt;</a>
9573 double complex conj(double complex z);
9574 float complex conjf(float complex z);
9575 long double complex conjl(long double complex z);
9576 </pre>
9577 <p><b>Description</b>
9578 <p><a name="7.3.9.3p2" href="#7.3.9.3p2"><small>2</small></a>
9579 The conj functions compute the complex conjugate of z, by reversing the sign of its
9580 imaginary part.
9581 <p><b>Returns</b>
9582 <p><a name="7.3.9.3p3" href="#7.3.9.3p3"><small>3</small></a>
9583 The conj functions return the complex conjugate value.
9585 <p><small><a href="#Contents">Contents</a></small>
9586 <h5><a name="7.3.9.4" href="#7.3.9.4">7.3.9.4 The cproj functions</a></h5>
9587 <p><b>Synopsis</b>
9588 <p><a name="7.3.9.4p1" href="#7.3.9.4p1"><small>1</small></a>
9589 <pre>
9590 #include <a href="#7.3">&lt;complex.h&gt;</a>
9591 double complex cproj(double complex z);
9592 float complex cprojf(float complex z);
9593 long double complex cprojl(long double complex z);
9594 </pre>
9595 <p><b>Description</b>
9596 <p><a name="7.3.9.4p2" href="#7.3.9.4p2"><small>2</small></a>
9597 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
9598 z except that all complex infinities (even those with one infinite part and one NaN part)
9599 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
9600 equivalent to
9601 <pre>
9602 INFINITY + I * copysign(0.0, cimag(z))
9603 </pre>
9604 <p><b>Returns</b>
9605 <p><a name="7.3.9.4p3" href="#7.3.9.4p3"><small>3</small></a>
9606 The cproj functions return the value of the projection onto the Riemann sphere.
9611 <!--page 192 -->
9613 <p><small><a href="#Contents">Contents</a></small>
9614 <h5><a name="7.3.9.5" href="#7.3.9.5">7.3.9.5 The creal functions</a></h5>
9615 <p><b>Synopsis</b>
9616 <p><a name="7.3.9.5p1" href="#7.3.9.5p1"><small>1</small></a>
9617 <pre>
9618 #include <a href="#7.3">&lt;complex.h&gt;</a>
9619 double creal(double complex z);
9620 float crealf(float complex z);
9621 long double creall(long double complex z);
9622 </pre>
9623 <p><b>Description</b>
9624 <p><a name="7.3.9.5p2" href="#7.3.9.5p2"><small>2</small></a>
9625 The creal functions compute the real part of z.<sup><a href="#note171"><b>171)</b></a></sup>
9626 <p><b>Returns</b>
9627 <p><a name="7.3.9.5p3" href="#7.3.9.5p3"><small>3</small></a>
9628 The creal functions return the real part value.
9633 <!--page 193 -->
9635 <p><b>Footnotes</b>
9636 <p><small><a name="note171" href="#note171">171)</a> For a variable z of complex type, z == creal(z) + cimag(z)*I.
9637 </small>
9639 <p><small><a href="#Contents">Contents</a></small>
9640 <h3><a name="7.4" href="#7.4">7.4 Character handling &lt;ctype.h&gt;</a></h3>
9641 <p><a name="7.4p1" href="#7.4p1"><small>1</small></a>
9642 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
9643 characters.<sup><a href="#note172"><b>172)</b></a></sup> In all cases the argument is an int, the value of which shall be
9644 representable as an unsigned char or shall equal the value of the macro EOF. If the
9645 argument has any other value, the behavior is undefined.
9646 <p><a name="7.4p2" href="#7.4p2"><small>2</small></a>
9647 The behavior of these functions is affected by the current locale. Those functions that
9648 have locale-specific aspects only when not in the "C" locale are noted below.
9649 <p><a name="7.4p3" href="#7.4p3"><small>3</small></a>
9650 The term printing character refers to a member of a locale-specific set of characters, each
9651 of which occupies one printing position on a display device; the term control character
9652 refers to a member of a locale-specific set of characters that are not printing
9653 characters.<sup><a href="#note173"><b>173)</b></a></sup> All letters and digits are printing characters.
9654 <p><b> Forward references</b>: EOF (<a href="#7.19.1">7.19.1</a>), localization (<a href="#7.11">7.11</a>).
9656 <p><b>Footnotes</b>
9657 <p><small><a name="note172" href="#note172">172)</a> See ''future library directions'' (<a href="#7.26.2">7.26.2</a>).
9658 </small>
9659 <p><small><a name="note173" href="#note173">173)</a> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
9660 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
9661 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
9662 </small>
9664 <p><small><a href="#Contents">Contents</a></small>
9665 <h4><a name="7.4.1" href="#7.4.1">7.4.1 Character classification functions</a></h4>
9666 <p><a name="7.4.1p1" href="#7.4.1p1"><small>1</small></a>
9667 The functions in this subclause return nonzero (true) if and only if the value of the
9668 argument c conforms to that in the description of the function.
9670 <p><small><a href="#Contents">Contents</a></small>
9671 <h5><a name="7.4.1.1" href="#7.4.1.1">7.4.1.1 The isalnum function</a></h5>
9672 <p><b>Synopsis</b>
9673 <p><a name="7.4.1.1p1" href="#7.4.1.1p1"><small>1</small></a>
9674 <pre>
9675 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9676 int isalnum(int c);
9677 </pre>
9678 <p><b>Description</b>
9679 <p><a name="7.4.1.1p2" href="#7.4.1.1p2"><small>2</small></a>
9680 The isalnum function tests for any character for which isalpha or isdigit is true.
9682 <p><small><a href="#Contents">Contents</a></small>
9683 <h5><a name="7.4.1.2" href="#7.4.1.2">7.4.1.2 The isalpha function</a></h5>
9684 <p><b>Synopsis</b>
9685 <p><a name="7.4.1.2p1" href="#7.4.1.2p1"><small>1</small></a>
9686 <pre>
9687 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9688 int isalpha(int c);
9689 </pre>
9690 <p><b>Description</b>
9691 <p><a name="7.4.1.2p2" href="#7.4.1.2p2"><small>2</small></a>
9692 The isalpha function tests for any character for which isupper or islower is true,
9693 or any character that is one of a locale-specific set of alphabetic characters for which
9697 <!--page 194 -->
9698 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note174"><b>174)</b></a></sup> In the "C" locale,
9699 isalpha returns true only for the characters for which isupper or islower is true.
9701 <p><b>Footnotes</b>
9702 <p><small><a name="note174" href="#note174">174)</a> The functions islower and isupper test true or false separately for each of these additional
9703 characters; all four combinations are possible.
9704 </small>
9706 <p><small><a href="#Contents">Contents</a></small>
9707 <h5><a name="7.4.1.3" href="#7.4.1.3">7.4.1.3 The isblank function</a></h5>
9708 <p><b>Synopsis</b>
9709 <p><a name="7.4.1.3p1" href="#7.4.1.3p1"><small>1</small></a>
9710 <pre>
9711 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9712 int isblank(int c);
9713 </pre>
9714 <p><b>Description</b>
9715 <p><a name="7.4.1.3p2" href="#7.4.1.3p2"><small>2</small></a>
9716 The isblank function tests for any character that is a standard blank character or is one
9717 of a locale-specific set of characters for which isspace is true and that is used to
9718 separate words within a line of text. The standard blank characters are the following:
9719 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
9720 for the standard blank characters.
9722 <p><small><a href="#Contents">Contents</a></small>
9723 <h5><a name="7.4.1.4" href="#7.4.1.4">7.4.1.4 The iscntrl function</a></h5>
9724 <p><b>Synopsis</b>
9725 <p><a name="7.4.1.4p1" href="#7.4.1.4p1"><small>1</small></a>
9726 <pre>
9727 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9728 int iscntrl(int c);
9729 </pre>
9730 <p><b>Description</b>
9731 <p><a name="7.4.1.4p2" href="#7.4.1.4p2"><small>2</small></a>
9732 The iscntrl function tests for any control character.
9734 <p><small><a href="#Contents">Contents</a></small>
9735 <h5><a name="7.4.1.5" href="#7.4.1.5">7.4.1.5 The isdigit function</a></h5>
9736 <p><b>Synopsis</b>
9737 <p><a name="7.4.1.5p1" href="#7.4.1.5p1"><small>1</small></a>
9738 <pre>
9739 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9740 int isdigit(int c);
9741 </pre>
9742 <p><b>Description</b>
9743 <p><a name="7.4.1.5p2" href="#7.4.1.5p2"><small>2</small></a>
9744 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
9746 <p><small><a href="#Contents">Contents</a></small>
9747 <h5><a name="7.4.1.6" href="#7.4.1.6">7.4.1.6 The isgraph function</a></h5>
9748 <p><b>Synopsis</b>
9749 <p><a name="7.4.1.6p1" href="#7.4.1.6p1"><small>1</small></a>
9750 <pre>
9751 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9752 int isgraph(int c);
9753 </pre>
9758 <!--page 195 -->
9759 <p><b>Description</b>
9760 <p><a name="7.4.1.6p2" href="#7.4.1.6p2"><small>2</small></a>
9761 The isgraph function tests for any printing character except space (' ').
9763 <p><small><a href="#Contents">Contents</a></small>
9764 <h5><a name="7.4.1.7" href="#7.4.1.7">7.4.1.7 The islower function</a></h5>
9765 <p><b>Synopsis</b>
9766 <p><a name="7.4.1.7p1" href="#7.4.1.7p1"><small>1</small></a>
9767 <pre>
9768 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9769 int islower(int c);
9770 </pre>
9771 <p><b>Description</b>
9772 <p><a name="7.4.1.7p2" href="#7.4.1.7p2"><small>2</small></a>
9773 The islower function tests for any character that is a lowercase letter or is one of a
9774 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9775 isspace is true. In the "C" locale, islower returns true only for the lowercase
9776 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9778 <p><small><a href="#Contents">Contents</a></small>
9779 <h5><a name="7.4.1.8" href="#7.4.1.8">7.4.1.8 The isprint function</a></h5>
9780 <p><b>Synopsis</b>
9781 <p><a name="7.4.1.8p1" href="#7.4.1.8p1"><small>1</small></a>
9782 <pre>
9783 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9784 int isprint(int c);
9785 </pre>
9786 <p><b>Description</b>
9787 <p><a name="7.4.1.8p2" href="#7.4.1.8p2"><small>2</small></a>
9788 The isprint function tests for any printing character including space (' ').
9790 <p><small><a href="#Contents">Contents</a></small>
9791 <h5><a name="7.4.1.9" href="#7.4.1.9">7.4.1.9 The ispunct function</a></h5>
9792 <p><b>Synopsis</b>
9793 <p><a name="7.4.1.9p1" href="#7.4.1.9p1"><small>1</small></a>
9794 <pre>
9795 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9796 int ispunct(int c);
9797 </pre>
9798 <p><b>Description</b>
9799 <p><a name="7.4.1.9p2" href="#7.4.1.9p2"><small>2</small></a>
9800 The ispunct function tests for any printing character that is one of a locale-specific set
9801 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
9802 locale, ispunct returns true for every printing character for which neither isspace
9803 nor isalnum is true.
9805 <p><small><a href="#Contents">Contents</a></small>
9806 <h5><a name="7.4.1.10" href="#7.4.1.10">7.4.1.10 The isspace function</a></h5>
9807 <p><b>Synopsis</b>
9808 <p><a name="7.4.1.10p1" href="#7.4.1.10p1"><small>1</small></a>
9809 <pre>
9810 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9811 int isspace(int c);
9812 </pre>
9813 <p><b>Description</b>
9814 <p><a name="7.4.1.10p2" href="#7.4.1.10p2"><small>2</small></a>
9815 The isspace function tests for any character that is a standard white-space character or
9816 is one of a locale-specific set of characters for which isalnum is false. The standard
9817 <!--page 196 -->
9818 white-space characters are the following: space (' '), form feed ('\f'), new-line
9819 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
9820 "C" locale, isspace returns true only for the standard white-space characters.
9822 <p><small><a href="#Contents">Contents</a></small>
9823 <h5><a name="7.4.1.11" href="#7.4.1.11">7.4.1.11 The isupper function</a></h5>
9824 <p><b>Synopsis</b>
9825 <p><a name="7.4.1.11p1" href="#7.4.1.11p1"><small>1</small></a>
9826 <pre>
9827 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9828 int isupper(int c);
9829 </pre>
9830 <p><b>Description</b>
9831 <p><a name="7.4.1.11p2" href="#7.4.1.11p2"><small>2</small></a>
9832 The isupper function tests for any character that is an uppercase letter or is one of a
9833 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
9834 isspace is true. In the "C" locale, isupper returns true only for the uppercase
9835 letters (as defined in <a href="#5.2.1">5.2.1</a>).
9837 <p><small><a href="#Contents">Contents</a></small>
9838 <h5><a name="7.4.1.12" href="#7.4.1.12">7.4.1.12 The isxdigit function</a></h5>
9839 <p><b>Synopsis</b>
9840 <p><a name="7.4.1.12p1" href="#7.4.1.12p1"><small>1</small></a>
9841 <pre>
9842 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9843 int isxdigit(int c);
9844 </pre>
9845 <p><b>Description</b>
9846 <p><a name="7.4.1.12p2" href="#7.4.1.12p2"><small>2</small></a>
9847 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
9849 <p><small><a href="#Contents">Contents</a></small>
9850 <h4><a name="7.4.2" href="#7.4.2">7.4.2 Character case mapping functions</a></h4>
9852 <p><small><a href="#Contents">Contents</a></small>
9853 <h5><a name="7.4.2.1" href="#7.4.2.1">7.4.2.1 The tolower function</a></h5>
9854 <p><b>Synopsis</b>
9855 <p><a name="7.4.2.1p1" href="#7.4.2.1p1"><small>1</small></a>
9856 <pre>
9857 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9858 int tolower(int c);
9859 </pre>
9860 <p><b>Description</b>
9861 <p><a name="7.4.2.1p2" href="#7.4.2.1p2"><small>2</small></a>
9862 The tolower function converts an uppercase letter to a corresponding lowercase letter.
9863 <p><b>Returns</b>
9864 <p><a name="7.4.2.1p3" href="#7.4.2.1p3"><small>3</small></a>
9865 If the argument is a character for which isupper is true and there are one or more
9866 corresponding characters, as specified by the current locale, for which islower is true,
9867 the tolower function returns one of the corresponding characters (always the same one
9868 for any given locale); otherwise, the argument is returned unchanged.
9869 <!--page 197 -->
9871 <p><small><a href="#Contents">Contents</a></small>
9872 <h5><a name="7.4.2.2" href="#7.4.2.2">7.4.2.2 The toupper function</a></h5>
9873 <p><b>Synopsis</b>
9874 <p><a name="7.4.2.2p1" href="#7.4.2.2p1"><small>1</small></a>
9875 <pre>
9876 #include <a href="#7.4">&lt;ctype.h&gt;</a>
9877 int toupper(int c);
9878 </pre>
9879 <p><b>Description</b>
9880 <p><a name="7.4.2.2p2" href="#7.4.2.2p2"><small>2</small></a>
9881 The toupper function converts a lowercase letter to a corresponding uppercase letter.
9882 <p><b>Returns</b>
9883 <p><a name="7.4.2.2p3" href="#7.4.2.2p3"><small>3</small></a>
9884 If the argument is a character for which islower is true and there are one or more
9885 corresponding characters, as specified by the current locale, for which isupper is true,
9886 the toupper function returns one of the corresponding characters (always the same one
9887 for any given locale); otherwise, the argument is returned unchanged.
9888 <!--page 198 -->
9890 <p><small><a href="#Contents">Contents</a></small>
9891 <h3><a name="7.5" href="#7.5">7.5 Errors &lt;errno.h&gt;</a></h3>
9892 <p><a name="7.5p1" href="#7.5p1"><small>1</small></a>
9893 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
9894 conditions.
9895 <p><a name="7.5p2" href="#7.5p2"><small>2</small></a>
9896 The macros are
9897 <pre>
9898 EDOM
9899 EILSEQ
9900 ERANGE
9901 </pre>
9902 which expand to integer constant expressions with type int, distinct positive values, and
9903 which are suitable for use in #if preprocessing directives; and
9904 <pre>
9905 errno
9906 </pre>
9907 which expands to a modifiable lvalue<sup><a href="#note175"><b>175)</b></a></sup> that has type int, the value of which is set to a
9908 positive error number by several library functions. It is unspecified whether errno is a
9909 macro or an identifier declared with external linkage. If a macro definition is suppressed
9910 in order to access an actual object, or a program defines an identifier with the name
9911 errno, the behavior is undefined.
9912 <p><a name="7.5p3" href="#7.5p3"><small>3</small></a>
9913 The value of errno is zero at program startup, but is never set to zero by any library
9914 function.<sup><a href="#note176"><b>176)</b></a></sup> The value of errno may be set to nonzero by a library function call
9915 whether or not there is an error, provided the use of errno is not documented in the
9916 description of the function in this International Standard.
9917 <p><a name="7.5p4" href="#7.5p4"><small>4</small></a>
9918 Additional macro definitions, beginning with E and a digit or E and an uppercase
9919 letter,<sup><a href="#note177"><b>177)</b></a></sup> may also be specified by the implementation.
9924 <!--page 199 -->
9926 <p><b>Footnotes</b>
9927 <p><small><a name="note175" href="#note175">175)</a> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
9928 resulting from a function call (for example, *errno()).
9929 </small>
9930 <p><small><a name="note176" href="#note176">176)</a> Thus, a program that uses errno for error checking should set it to zero before a library function call,
9931 then inspect it before a subsequent library function call. Of course, a library function can save the
9932 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
9933 value is still zero just before the return.
9934 </small>
9935 <p><small><a name="note177" href="#note177">177)</a> See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
9936 </small>
9938 <p><small><a href="#Contents">Contents</a></small>
9939 <h3><a name="7.6" href="#7.6">7.6 Floating-point environment &lt;fenv.h&gt;</a></h3>
9940 <p><a name="7.6p1" href="#7.6p1"><small>1</small></a>
9941 The header <a href="#7.6">&lt;fenv.h&gt;</a> declares two types and several macros and functions to provide
9942 access to the floating-point environment. The floating-point environment refers
9943 collectively to any floating-point status flags and control modes supported by the
9944 implementation.<sup><a href="#note178"><b>178)</b></a></sup> A floating-point status flag is a system variable whose value is set
9945 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
9946 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note179"><b>179)</b></a></sup> A floating-
9947 point control mode is a system variable whose value may be set by the user to affect the
9948 subsequent behavior of floating-point arithmetic.
9949 <p><a name="7.6p2" href="#7.6p2"><small>2</small></a>
9950 Certain programming conventions support the intended model of use for the floating-
9951 point environment:<sup><a href="#note180"><b>180)</b></a></sup>
9952 <ul>
9953 <li> a function call does not alter its caller's floating-point control modes, clear its caller's
9954 floating-point status flags, nor depend on the state of its caller's floating-point status
9955 flags unless the function is so documented;
9956 <li> a function call is assumed to require default floating-point control modes, unless its
9957 documentation promises otherwise;
9958 <li> a function call is assumed to have the potential for raising floating-point exceptions,
9959 unless its documentation promises otherwise.
9960 </ul>
9961 <p><a name="7.6p3" href="#7.6p3"><small>3</small></a>
9962 The type
9963 <pre>
9964 fenv_t
9965 </pre>
9966 represents the entire floating-point environment.
9967 <p><a name="7.6p4" href="#7.6p4"><small>4</small></a>
9968 The type
9969 <pre>
9970 fexcept_t
9971 </pre>
9972 represents the floating-point status flags collectively, including any status the
9973 implementation associates with the flags.
9978 <!--page 200 -->
9979 <p><a name="7.6p5" href="#7.6p5"><small>5</small></a>
9980 Each of the macros
9981 <pre>
9982 FE_DIVBYZERO
9983 FE_INEXACT
9984 FE_INVALID
9985 FE_OVERFLOW
9986 FE_UNDERFLOW
9987 </pre>
9988 is defined if and only if the implementation supports the floating-point exception by
9989 means of the functions in 7.6.2.<sup><a href="#note181"><b>181)</b></a></sup> Additional implementation-defined floating-point
9990 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
9991 be specified by the implementation. The defined macros expand to integer constant
9992 expressions with values such that bitwise ORs of all combinations of the macros result in
9993 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
9994 zero.<sup><a href="#note182"><b>182)</b></a></sup>
9995 <p><a name="7.6p6" href="#7.6p6"><small>6</small></a>
9996 The macro
9997 <pre>
9998 FE_ALL_EXCEPT
9999 </pre>
10000 is simply the bitwise OR of all floating-point exception macros defined by the
10001 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
10002 <p><a name="7.6p7" href="#7.6p7"><small>7</small></a>
10003 Each of the macros
10004 <pre>
10005 FE_DOWNWARD
10006 FE_TONEAREST
10007 FE_TOWARDZERO
10008 FE_UPWARD
10009 </pre>
10010 is defined if and only if the implementation supports getting and setting the represented
10011 rounding direction by means of the fegetround and fesetround functions.
10012 Additional implementation-defined rounding directions, with macro definitions beginning
10013 with FE_ and an uppercase letter, may also be specified by the implementation. The
10014 defined macros expand to integer constant expressions whose values are distinct
10015 nonnegative values.<sup><a href="#note183"><b>183)</b></a></sup>
10016 <p><a name="7.6p8" href="#7.6p8"><small>8</small></a>
10017 The macro
10021 <!--page 201 -->
10022 <pre>
10023 FE_DFL_ENV
10024 </pre>
10025 represents the default floating-point environment -- the one installed at program startup
10026 -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
10027 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
10028 <p><a name="7.6p9" href="#7.6p9"><small>9</small></a>
10029 Additional implementation-defined environments, with macro definitions beginning with
10030 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
10031 also be specified by the implementation.
10033 <p><b>Footnotes</b>
10034 <p><small><a name="note178" href="#note178">178)</a> This header is designed to support the floating-point exception status flags and directed-rounding
10035 control modes required by IEC 60559, and other similar floating-point state information. Also it is
10036 designed to facilitate code portability among all systems.
10037 </small>
10038 <p><small><a name="note179" href="#note179">179)</a> A floating-point status flag is not an object and can be set more than once within an expression.
10039 </small>
10040 <p><small><a name="note180" href="#note180">180)</a> With these conventions, a programmer can safely assume default floating-point control modes (or be
10041 unaware of them). The responsibilities associated with accessing the floating-point environment fall
10042 on the programmer or program that does so explicitly.
10043 </small>
10044 <p><small><a name="note181" href="#note181">181)</a> The implementation supports an exception if there are circumstances where a call to at least one of the
10045 functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not necessary for
10046 all the functions to succeed all the time.
10047 </small>
10048 <p><small><a name="note182" href="#note182">182)</a> The macros should be distinct powers of two.
10049 </small>
10050 <p><small><a name="note183" href="#note183">183)</a> Even though the rounding direction macros may expand to constants corresponding to the values of
10051 FLT_ROUNDS, they are not required to do so.
10052 </small>
10054 <p><small><a href="#Contents">Contents</a></small>
10055 <h4><a name="7.6.1" href="#7.6.1">7.6.1 The FENV_ACCESS pragma</a></h4>
10056 <p><b>Synopsis</b>
10057 <p><a name="7.6.1p1" href="#7.6.1p1"><small>1</small></a>
10058 <pre>
10059 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10060 #pragma STDC FENV_ACCESS on-off-switch
10061 </pre>
10062 <p><b>Description</b>
10063 <p><a name="7.6.1p2" href="#7.6.1p2"><small>2</small></a>
10064 The FENV_ACCESS pragma provides a means to inform the implementation when a
10065 program might access the floating-point environment to test floating-point status flags or
10066 run under non-default floating-point control modes.<sup><a href="#note184"><b>184)</b></a></sup> The pragma shall occur either
10067 outside external declarations or preceding all explicit declarations and statements inside a
10068 compound statement. When outside external declarations, the pragma takes effect from
10069 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
10070 the translation unit. When inside a compound statement, the pragma takes effect from its
10071 occurrence until another FENV_ACCESS pragma is encountered (including within a
10072 nested compound statement), or until the end of the compound statement; at the end of a
10073 compound statement the state for the pragma is restored to its condition just before the
10074 compound statement. If this pragma is used in any other context, the behavior is
10075 undefined. If part of a program tests floating-point status flags, sets floating-point control
10076 modes, or runs under non-default mode settings, but was translated with the state for the
10077 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
10078 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
10079 the program translated with FENV_ACCESS ''off'' to a part translated with
10080 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
10081 floating-point control modes have their default settings.)
10086 <!--page 202 -->
10087 <p><a name="7.6.1p3" href="#7.6.1p3"><small>3</small></a>
10088 EXAMPLE
10089 <pre>
10090 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10091 void f(double x)
10093 #pragma STDC FENV_ACCESS ON
10094 void g(double);
10095 void h(double);
10096 /* ... */
10097 g(x + 1);
10098 h(x + 1);
10099 /* ... */
10101 </pre>
10102 <p><a name="7.6.1p4" href="#7.6.1p4"><small>4</small></a>
10103 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
10104 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
10105 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note185"><b>185)</b></a></sup>
10108 <p><b>Footnotes</b>
10109 <p><small><a name="note184" href="#note184">184)</a> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
10110 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
10111 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
10112 modes are in effect and the flags are not tested.
10113 </small>
10114 <p><small><a name="note185" href="#note185">185)</a> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
10115 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
10116 ''off'', just one evaluation of x + 1 would suffice.
10117 </small>
10119 <p><small><a href="#Contents">Contents</a></small>
10120 <h4><a name="7.6.2" href="#7.6.2">7.6.2 Floating-point exceptions</a></h4>
10121 <p><a name="7.6.2p1" href="#7.6.2p1"><small>1</small></a>
10122 The following functions provide access to the floating-point status flags.<sup><a href="#note186"><b>186)</b></a></sup> The int
10123 input argument for the functions represents a subset of floating-point exceptions, and can
10124 be zero or the bitwise OR of one or more floating-point exception macros, for example
10125 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
10126 functions is undefined.
10128 <p><b>Footnotes</b>
10129 <p><small><a name="note186" href="#note186">186)</a> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
10130 abstraction of flags that are either set or clear. An implementation may endow floating-point status
10131 flags with more information -- for example, the address of the code which first raised the floating-
10132 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
10133 content of flags.
10134 </small>
10136 <p><small><a href="#Contents">Contents</a></small>
10137 <h5><a name="7.6.2.1" href="#7.6.2.1">7.6.2.1 The feclearexcept function</a></h5>
10138 <p><b>Synopsis</b>
10139 <p><a name="7.6.2.1p1" href="#7.6.2.1p1"><small>1</small></a>
10140 <pre>
10141 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10142 int feclearexcept(int excepts);
10143 </pre>
10144 <p><b>Description</b>
10145 <p><a name="7.6.2.1p2" href="#7.6.2.1p2"><small>2</small></a>
10146 The feclearexcept function attempts to clear the supported floating-point exceptions
10147 represented by its argument.
10148 <p><b>Returns</b>
10149 <p><a name="7.6.2.1p3" href="#7.6.2.1p3"><small>3</small></a>
10150 The feclearexcept function returns zero if the excepts argument is zero or if all
10151 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
10154 <!--page 203 -->
10156 <p><small><a href="#Contents">Contents</a></small>
10157 <h5><a name="7.6.2.2" href="#7.6.2.2">7.6.2.2 The fegetexceptflag function</a></h5>
10158 <p><b>Synopsis</b>
10159 <p><a name="7.6.2.2p1" href="#7.6.2.2p1"><small>1</small></a>
10160 <pre>
10161 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10162 int fegetexceptflag(fexcept_t *flagp,
10163 int excepts);
10164 </pre>
10165 <p><b>Description</b>
10166 <p><a name="7.6.2.2p2" href="#7.6.2.2p2"><small>2</small></a>
10167 The fegetexceptflag function attempts to store an implementation-defined
10168 representation of the states of the floating-point status flags indicated by the argument
10169 excepts in the object pointed to by the argument flagp.
10170 <p><b>Returns</b>
10171 <p><a name="7.6.2.2p3" href="#7.6.2.2p3"><small>3</small></a>
10172 The fegetexceptflag function returns zero if the representation was successfully
10173 stored. Otherwise, it returns a nonzero value.
10175 <p><small><a href="#Contents">Contents</a></small>
10176 <h5><a name="7.6.2.3" href="#7.6.2.3">7.6.2.3 The feraiseexcept function</a></h5>
10177 <p><b>Synopsis</b>
10178 <p><a name="7.6.2.3p1" href="#7.6.2.3p1"><small>1</small></a>
10179 <pre>
10180 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10181 int feraiseexcept(int excepts);
10182 </pre>
10183 <p><b>Description</b>
10184 <p><a name="7.6.2.3p2" href="#7.6.2.3p2"><small>2</small></a>
10185 The feraiseexcept function attempts to raise the supported floating-point exceptions
10186 represented by its argument.<sup><a href="#note187"><b>187)</b></a></sup> The order in which these floating-point exceptions are
10187 raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
10188 additionally raises the ''inexact'' floating-point exception whenever it raises the
10189 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
10190 <p><b>Returns</b>
10191 <p><a name="7.6.2.3p3" href="#7.6.2.3p3"><small>3</small></a>
10192 The feraiseexcept function returns zero if the excepts argument is zero or if all
10193 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
10198 <!--page 204 -->
10200 <p><b>Footnotes</b>
10201 <p><small><a name="note187" href="#note187">187)</a> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
10202 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
10203 in <a href="#F.7.6">F.7.6</a> is in the same spirit.
10204 </small>
10206 <p><small><a href="#Contents">Contents</a></small>
10207 <h5><a name="7.6.2.4" href="#7.6.2.4">7.6.2.4 The fesetexceptflag function</a></h5>
10208 <p><b>Synopsis</b>
10209 <p><a name="7.6.2.4p1" href="#7.6.2.4p1"><small>1</small></a>
10210 <pre>
10211 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10212 int fesetexceptflag(const fexcept_t *flagp,
10213 int excepts);
10214 </pre>
10215 <p><b>Description</b>
10216 <p><a name="7.6.2.4p2" href="#7.6.2.4p2"><small>2</small></a>
10217 The fesetexceptflag function attempts to set the floating-point status flags
10218 indicated by the argument excepts to the states stored in the object pointed to by
10219 flagp. The value of *flagp shall have been set by a previous call to
10220 fegetexceptflag whose second argument represented at least those floating-point
10221 exceptions represented by the argument excepts. This function does not raise floating-
10222 point exceptions, but only sets the state of the flags.
10223 <p><b>Returns</b>
10224 <p><a name="7.6.2.4p3" href="#7.6.2.4p3"><small>3</small></a>
10225 The fesetexceptflag function returns zero if the excepts argument is zero or if
10226 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
10227 a nonzero value.
10229 <p><small><a href="#Contents">Contents</a></small>
10230 <h5><a name="7.6.2.5" href="#7.6.2.5">7.6.2.5 The fetestexcept function</a></h5>
10231 <p><b>Synopsis</b>
10232 <p><a name="7.6.2.5p1" href="#7.6.2.5p1"><small>1</small></a>
10233 <pre>
10234 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10235 int fetestexcept(int excepts);
10236 </pre>
10237 <p><b>Description</b>
10238 <p><a name="7.6.2.5p2" href="#7.6.2.5p2"><small>2</small></a>
10239 The fetestexcept function determines which of a specified subset of the floating-
10240 point exception flags are currently set. The excepts argument specifies the floating-
10241 point status flags to be queried.<sup><a href="#note188"><b>188)</b></a></sup>
10242 <p><b>Returns</b>
10243 <p><a name="7.6.2.5p3" href="#7.6.2.5p3"><small>3</small></a>
10244 The fetestexcept function returns the value of the bitwise OR of the floating-point
10245 exception macros corresponding to the currently set floating-point exceptions included in
10246 excepts.
10247 <p><a name="7.6.2.5p4" href="#7.6.2.5p4"><small>4</small></a>
10248 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
10253 <!--page 205 -->
10254 <pre>
10255 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10256 /* ... */
10258 #pragma STDC FENV_ACCESS ON
10259 int set_excepts;
10260 feclearexcept(FE_INVALID | FE_OVERFLOW);
10261 // maybe raise exceptions
10262 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
10263 if (set_excepts &amp; FE_INVALID) f();
10264 if (set_excepts &amp; FE_OVERFLOW) g();
10265 /* ... */
10267 </pre>
10270 <p><b>Footnotes</b>
10271 <p><small><a name="note188" href="#note188">188)</a> This mechanism allows testing several floating-point exceptions with just one function call.
10272 </small>
10274 <p><small><a href="#Contents">Contents</a></small>
10275 <h4><a name="7.6.3" href="#7.6.3">7.6.3 Rounding</a></h4>
10276 <p><a name="7.6.3p1" href="#7.6.3p1"><small>1</small></a>
10277 The fegetround and fesetround functions provide control of rounding direction
10278 modes.
10280 <p><small><a href="#Contents">Contents</a></small>
10281 <h5><a name="7.6.3.1" href="#7.6.3.1">7.6.3.1 The fegetround function</a></h5>
10282 <p><b>Synopsis</b>
10283 <p><a name="7.6.3.1p1" href="#7.6.3.1p1"><small>1</small></a>
10284 <pre>
10285 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10286 int fegetround(void);
10287 </pre>
10288 <p><b>Description</b>
10289 <p><a name="7.6.3.1p2" href="#7.6.3.1p2"><small>2</small></a>
10290 The fegetround function gets the current rounding direction.
10291 <p><b>Returns</b>
10292 <p><a name="7.6.3.1p3" href="#7.6.3.1p3"><small>3</small></a>
10293 The fegetround function returns the value of the rounding direction macro
10294 representing the current rounding direction or a negative value if there is no such
10295 rounding direction macro or the current rounding direction is not determinable.
10297 <p><small><a href="#Contents">Contents</a></small>
10298 <h5><a name="7.6.3.2" href="#7.6.3.2">7.6.3.2 The fesetround function</a></h5>
10299 <p><b>Synopsis</b>
10300 <p><a name="7.6.3.2p1" href="#7.6.3.2p1"><small>1</small></a>
10301 <pre>
10302 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10303 int fesetround(int round);
10304 </pre>
10305 <p><b>Description</b>
10306 <p><a name="7.6.3.2p2" href="#7.6.3.2p2"><small>2</small></a>
10307 The fesetround function establishes the rounding direction represented by its
10308 argument round. If the argument is not equal to the value of a rounding direction macro,
10309 the rounding direction is not changed.
10310 <p><b>Returns</b>
10311 <p><a name="7.6.3.2p3" href="#7.6.3.2p3"><small>3</small></a>
10312 The fesetround function returns zero if and only if the requested rounding direction
10313 was established.
10314 <!--page 206 -->
10315 <p><a name="7.6.3.2p4" href="#7.6.3.2p4"><small>4</small></a>
10316 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
10317 rounding direction fails.
10318 <pre>
10319 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10320 #include <a href="#7.2">&lt;assert.h&gt;</a>
10321 void f(int round_dir)
10323 #pragma STDC FENV_ACCESS ON
10324 int save_round;
10325 int setround_ok;
10326 save_round = fegetround();
10327 setround_ok = fesetround(round_dir);
10328 assert(setround_ok == 0);
10329 /* ... */
10330 fesetround(save_round);
10331 /* ... */
10333 </pre>
10336 <p><small><a href="#Contents">Contents</a></small>
10337 <h4><a name="7.6.4" href="#7.6.4">7.6.4 Environment</a></h4>
10338 <p><a name="7.6.4p1" href="#7.6.4p1"><small>1</small></a>
10339 The functions in this section manage the floating-point environment -- status flags and
10340 control modes -- as one entity.
10342 <p><small><a href="#Contents">Contents</a></small>
10343 <h5><a name="7.6.4.1" href="#7.6.4.1">7.6.4.1 The fegetenv function</a></h5>
10344 <p><b>Synopsis</b>
10345 <p><a name="7.6.4.1p1" href="#7.6.4.1p1"><small>1</small></a>
10346 <pre>
10347 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10348 int fegetenv(fenv_t *envp);
10349 </pre>
10350 <p><b>Description</b>
10351 <p><a name="7.6.4.1p2" href="#7.6.4.1p2"><small>2</small></a>
10352 The fegetenv function attempts to store the current floating-point environment in the
10353 object pointed to by envp.
10354 <p><b>Returns</b>
10355 <p><a name="7.6.4.1p3" href="#7.6.4.1p3"><small>3</small></a>
10356 The fegetenv function returns zero if the environment was successfully stored.
10357 Otherwise, it returns a nonzero value.
10359 <p><small><a href="#Contents">Contents</a></small>
10360 <h5><a name="7.6.4.2" href="#7.6.4.2">7.6.4.2 The feholdexcept function</a></h5>
10361 <p><b>Synopsis</b>
10362 <p><a name="7.6.4.2p1" href="#7.6.4.2p1"><small>1</small></a>
10363 <pre>
10364 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10365 int feholdexcept(fenv_t *envp);
10366 </pre>
10367 <p><b>Description</b>
10368 <p><a name="7.6.4.2p2" href="#7.6.4.2p2"><small>2</small></a>
10369 The feholdexcept function saves the current floating-point environment in the object
10370 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
10371 (continue on floating-point exceptions) mode, if available, for all floating-point
10372 exceptions.<sup><a href="#note189"><b>189)</b></a></sup>
10373 <!--page 207 -->
10374 <p><b>Returns</b>
10375 <p><a name="7.6.4.2p3" href="#7.6.4.2p3"><small>3</small></a>
10376 The feholdexcept function returns zero if and only if non-stop floating-point
10377 exception handling was successfully installed.
10379 <p><b>Footnotes</b>
10380 <p><small><a name="note189" href="#note189">189)</a> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
10381 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
10382 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
10383 function to write routines that hide spurious floating-point exceptions from their callers.
10384 </small>
10386 <p><small><a href="#Contents">Contents</a></small>
10387 <h5><a name="7.6.4.3" href="#7.6.4.3">7.6.4.3 The fesetenv function</a></h5>
10388 <p><b>Synopsis</b>
10389 <p><a name="7.6.4.3p1" href="#7.6.4.3p1"><small>1</small></a>
10390 <pre>
10391 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10392 int fesetenv(const fenv_t *envp);
10393 </pre>
10394 <p><b>Description</b>
10395 <p><a name="7.6.4.3p2" href="#7.6.4.3p2"><small>2</small></a>
10396 The fesetenv function attempts to establish the floating-point environment represented
10397 by the object pointed to by envp. The argument envp shall point to an object set by a
10398 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
10399 Note that fesetenv merely installs the state of the floating-point status flags
10400 represented through its argument, and does not raise these floating-point exceptions.
10401 <p><b>Returns</b>
10402 <p><a name="7.6.4.3p3" href="#7.6.4.3p3"><small>3</small></a>
10403 The fesetenv function returns zero if the environment was successfully established.
10404 Otherwise, it returns a nonzero value.
10406 <p><small><a href="#Contents">Contents</a></small>
10407 <h5><a name="7.6.4.4" href="#7.6.4.4">7.6.4.4 The feupdateenv function</a></h5>
10408 <p><b>Synopsis</b>
10409 <p><a name="7.6.4.4p1" href="#7.6.4.4p1"><small>1</small></a>
10410 <pre>
10411 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10412 int feupdateenv(const fenv_t *envp);
10413 </pre>
10414 <p><b>Description</b>
10415 <p><a name="7.6.4.4p2" href="#7.6.4.4p2"><small>2</small></a>
10416 The feupdateenv function attempts to save the currently raised floating-point
10417 exceptions in its automatic storage, install the floating-point environment represented by
10418 the object pointed to by envp, and then raise the saved floating-point exceptions. The
10419 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
10420 or equal a floating-point environment macro.
10421 <p><b>Returns</b>
10422 <p><a name="7.6.4.4p3" href="#7.6.4.4p3"><small>3</small></a>
10423 The feupdateenv function returns zero if all the actions were successfully carried out.
10424 Otherwise, it returns a nonzero value.
10429 <!--page 208 -->
10430 <p><a name="7.6.4.4p4" href="#7.6.4.4p4"><small>4</small></a>
10431 EXAMPLE Hide spurious underflow floating-point exceptions:
10432 <!--page 209 -->
10433 <pre>
10434 #include <a href="#7.6">&lt;fenv.h&gt;</a>
10435 double f(double x)
10437 #pragma STDC FENV_ACCESS ON
10438 double result;
10439 fenv_t save_env;
10440 if (feholdexcept(&amp;save_env))
10441 return /* indication of an environmental problem */;
10442 // compute result
10443 if (/* test spurious underflow */)
10444 if (feclearexcept(FE_UNDERFLOW))
10445 return /* indication of an environmental problem */;
10446 if (feupdateenv(&amp;save_env))
10447 return /* indication of an environmental problem */;
10448 return result;
10450 </pre>
10452 <p><small><a href="#Contents">Contents</a></small>
10453 <h3><a name="7.7" href="#7.7">7.7 Characteristics of floating types &lt;float.h&gt;</a></h3>
10454 <p><a name="7.7p1" href="#7.7p1"><small>1</small></a>
10455 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
10456 parameters of the standard floating-point types.
10457 <p><a name="7.7p2" href="#7.7p2"><small>2</small></a>
10458 The macros, their meanings, and the constraints (or restrictions) on their values are listed
10459 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
10460 <!--page 210 -->
10462 <p><small><a href="#Contents">Contents</a></small>
10463 <h3><a name="7.8" href="#7.8">7.8 Format conversion of integer types &lt;inttypes.h&gt;</a></h3>
10464 <p><a name="7.8p1" href="#7.8p1"><small>1</small></a>
10465 The header <a href="#7.8">&lt;inttypes.h&gt;</a> includes the header <a href="#7.18">&lt;stdint.h&gt;</a> and extends it with
10466 additional facilities provided by hosted implementations.
10467 <p><a name="7.8p2" href="#7.8p2"><small>2</small></a>
10468 It declares functions for manipulating greatest-width integers and converting numeric
10469 character strings to greatest-width integers, and it declares the type
10470 <pre>
10471 imaxdiv_t
10472 </pre>
10473 which is a structure type that is the type of the value returned by the imaxdiv function.
10474 For each type declared in <a href="#7.18">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
10475 specifiers for use with the formatted input/output functions.<sup><a href="#note190"><b>190)</b></a></sup>
10476 <p><b> Forward references</b>: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>), formatted input/output
10477 functions (<a href="#7.19.6">7.19.6</a>), formatted wide character input/output functions (<a href="#7.24.2">7.24.2</a>).
10479 <p><b>Footnotes</b>
10480 <p><small><a name="note190" href="#note190">190)</a> See ''future library directions'' (<a href="#7.26.4">7.26.4</a>).
10481 </small>
10483 <p><small><a href="#Contents">Contents</a></small>
10484 <h4><a name="7.8.1" href="#7.8.1">7.8.1 Macros for format specifiers</a></h4>
10485 <p><a name="7.8.1p1" href="#7.8.1p1"><small>1</small></a>
10486 Each of the following object-like macros<sup><a href="#note191"><b>191)</b></a></sup> expands to a character string literal
10487 containing a conversion specifier, possibly modified by a length modifier, suitable for use
10488 within the format argument of a formatted input/output function when converting the
10489 corresponding integer type. These macro names have the general form of PRI (character
10490 string literals for the fprintf and fwprintf family) or SCN (character string literals
10491 for the fscanf and fwscanf family),<sup><a href="#note192"><b>192)</b></a></sup> followed by the conversion specifier,
10492 followed by a name corresponding to a similar type name in <a href="#7.18.1">7.18.1</a>. In these names, N
10493 represents the width of the type as described in <a href="#7.18.1">7.18.1</a>. For example, PRIdFAST32 can
10494 be used in a format string to print the value of an integer of type int_fast32_t.
10495 <p><a name="7.8.1p2" href="#7.8.1p2"><small>2</small></a>
10496 The fprintf macros for signed integers are:
10497 <pre>
10498 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
10499 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
10500 </pre>
10505 <!--page 211 -->
10506 <p><a name="7.8.1p3" href="#7.8.1p3"><small>3</small></a>
10507 The fprintf macros for unsigned integers are:
10508 <pre>
10509 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
10510 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
10511 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
10512 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
10513 </pre>
10514 <p><a name="7.8.1p4" href="#7.8.1p4"><small>4</small></a>
10515 The fscanf macros for signed integers are:
10516 <pre>
10517 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
10518 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
10519 </pre>
10520 <p><a name="7.8.1p5" href="#7.8.1p5"><small>5</small></a>
10521 The fscanf macros for unsigned integers are:
10522 <pre>
10523 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
10524 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
10525 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
10526 </pre>
10527 <p><a name="7.8.1p6" href="#7.8.1p6"><small>6</small></a>
10528 For each type that the implementation provides in <a href="#7.18">&lt;stdint.h&gt;</a>, the corresponding
10529 fprintf macros shall be defined and the corresponding fscanf macros shall be
10530 defined unless the implementation does not have a suitable fscanf length modifier for
10531 the type.
10532 <p><a name="7.8.1p7" href="#7.8.1p7"><small>7</small></a>
10533 EXAMPLE
10534 <pre>
10535 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10536 #include <a href="#7.24">&lt;wchar.h&gt;</a>
10537 int main(void)
10539 uintmax_t i = UINTMAX_MAX; // this type always exists
10540 wprintf(L"The largest integer value is %020"
10541 PRIxMAX "\n", i);
10542 return 0;
10544 </pre>
10547 <p><b>Footnotes</b>
10548 <p><small><a name="note191" href="#note191">191)</a> C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined
10549 before <a href="#7.8">&lt;inttypes.h&gt;</a> is included.
10550 </small>
10551 <p><small><a name="note192" href="#note192">192)</a> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
10552 different format specifiers may be required for fprintf and fscanf, even when the type is the
10553 same.
10554 </small>
10556 <p><small><a href="#Contents">Contents</a></small>
10557 <h4><a name="7.8.2" href="#7.8.2">7.8.2 Functions for greatest-width integer types</a></h4>
10559 <p><small><a href="#Contents">Contents</a></small>
10560 <h5><a name="7.8.2.1" href="#7.8.2.1">7.8.2.1 The imaxabs function</a></h5>
10561 <p><b>Synopsis</b>
10562 <p><a name="7.8.2.1p1" href="#7.8.2.1p1"><small>1</small></a>
10563 <pre>
10564 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10565 intmax_t imaxabs(intmax_t j);
10566 </pre>
10567 <p><b>Description</b>
10568 <p><a name="7.8.2.1p2" href="#7.8.2.1p2"><small>2</small></a>
10569 The imaxabs function computes the absolute value of an integer j. If the result cannot
10570 be represented, the behavior is undefined.<sup><a href="#note193"><b>193)</b></a></sup>
10574 <!--page 212 -->
10575 <p><b>Returns</b>
10576 <p><a name="7.8.2.1p3" href="#7.8.2.1p3"><small>3</small></a>
10577 The imaxabs function returns the absolute value.
10579 <p><b>Footnotes</b>
10580 <p><small><a name="note193" href="#note193">193)</a> The absolute value of the most negative number cannot be represented in two's complement.
10581 </small>
10583 <p><small><a href="#Contents">Contents</a></small>
10584 <h5><a name="7.8.2.2" href="#7.8.2.2">7.8.2.2 The imaxdiv function</a></h5>
10585 <p><b>Synopsis</b>
10586 <p><a name="7.8.2.2p1" href="#7.8.2.2p1"><small>1</small></a>
10587 <pre>
10588 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10589 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
10590 </pre>
10591 <p><b>Description</b>
10592 <p><a name="7.8.2.2p2" href="#7.8.2.2p2"><small>2</small></a>
10593 The imaxdiv function computes numer / denom and numer % denom in a single
10594 operation.
10595 <p><b>Returns</b>
10596 <p><a name="7.8.2.2p3" href="#7.8.2.2p3"><small>3</small></a>
10597 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
10598 quotient and the remainder. The structure shall contain (in either order) the members
10599 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
10600 either part of the result cannot be represented, the behavior is undefined.
10602 <p><small><a href="#Contents">Contents</a></small>
10603 <h5><a name="7.8.2.3" href="#7.8.2.3">7.8.2.3 The strtoimax and strtoumax functions</a></h5>
10604 <p><b>Synopsis</b>
10605 <p><a name="7.8.2.3p1" href="#7.8.2.3p1"><small>1</small></a>
10606 <pre>
10607 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10608 intmax_t strtoimax(const char * restrict nptr,
10609 char ** restrict endptr, int base);
10610 uintmax_t strtoumax(const char * restrict nptr,
10611 char ** restrict endptr, int base);
10612 </pre>
10613 <p><b>Description</b>
10614 <p><a name="7.8.2.3p2" href="#7.8.2.3p2"><small>2</small></a>
10615 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
10616 strtoul, and strtoull functions, except that the initial portion of the string is
10617 converted to intmax_t and uintmax_t representation, respectively.
10618 <p><b>Returns</b>
10619 <p><a name="7.8.2.3p3" href="#7.8.2.3p3"><small>3</small></a>
10620 The strtoimax and strtoumax functions return the converted value, if any. If no
10621 conversion could be performed, zero is returned. If the correct value is outside the range
10622 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
10623 (according to the return type and sign of the value, if any), and the value of the macro
10624 ERANGE is stored in errno.
10625 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
10626 (<a href="#7.20.1.4">7.20.1.4</a>).
10627 <!--page 213 -->
10629 <p><small><a href="#Contents">Contents</a></small>
10630 <h5><a name="7.8.2.4" href="#7.8.2.4">7.8.2.4 The wcstoimax and wcstoumax functions</a></h5>
10631 <p><b>Synopsis</b>
10632 <p><a name="7.8.2.4p1" href="#7.8.2.4p1"><small>1</small></a>
10633 <pre>
10634 #include <a href="#7.17">&lt;stddef.h&gt;</a> // for wchar_t
10635 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
10636 intmax_t wcstoimax(const wchar_t * restrict nptr,
10637 wchar_t ** restrict endptr, int base);
10638 uintmax_t wcstoumax(const wchar_t * restrict nptr,
10639 wchar_t ** restrict endptr, int base);
10640 </pre>
10641 <p><b>Description</b>
10642 <p><a name="7.8.2.4p2" href="#7.8.2.4p2"><small>2</small></a>
10643 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
10644 wcstoul, and wcstoull functions except that the initial portion of the wide string is
10645 converted to intmax_t and uintmax_t representation, respectively.
10646 <p><b>Returns</b>
10647 <p><a name="7.8.2.4p3" href="#7.8.2.4p3"><small>3</small></a>
10648 The wcstoimax function returns the converted value, if any. If no conversion could be
10649 performed, zero is returned. If the correct value is outside the range of representable
10650 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
10651 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
10652 errno.
10653 <p><b> Forward references</b>: the wcstol, wcstoll, wcstoul, and wcstoull functions
10654 (<a href="#7.24.4.1.2">7.24.4.1.2</a>).
10655 <!--page 214 -->
10657 <p><small><a href="#Contents">Contents</a></small>
10658 <h3><a name="7.9" href="#7.9">7.9 Alternative spellings &lt;iso646.h&gt;</a></h3>
10659 <p><a name="7.9p1" href="#7.9p1"><small>1</small></a>
10660 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
10661 to the corresponding tokens (on the right):
10662 <!--page 215 -->
10663 <pre>
10664 and &amp;&amp;
10665 and_eq &amp;=
10666 bitand &amp;
10667 bitor |
10668 compl ~
10669 not !
10670 not_eq !=
10671 or ||
10672 or_eq |=
10673 xor ^
10674 xor_eq ^=
10675 </pre>
10677 <p><small><a href="#Contents">Contents</a></small>
10678 <h3><a name="7.10" href="#7.10">7.10 Sizes of integer types &lt;limits.h&gt;</a></h3>
10679 <p><a name="7.10p1" href="#7.10p1"><small>1</small></a>
10680 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
10681 parameters of the standard integer types.
10682 <p><a name="7.10p2" href="#7.10p2"><small>2</small></a>
10683 The macros, their meanings, and the constraints (or restrictions) on their values are listed
10684 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
10685 <!--page 216 -->
10687 <p><small><a href="#Contents">Contents</a></small>
10688 <h3><a name="7.11" href="#7.11">7.11 Localization &lt;locale.h&gt;</a></h3>
10689 <p><a name="7.11p1" href="#7.11p1"><small>1</small></a>
10690 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
10691 <p><a name="7.11p2" href="#7.11p2"><small>2</small></a>
10692 The type is
10693 <pre>
10694 struct lconv
10695 </pre>
10696 which contains members related to the formatting of numeric values. The structure shall
10697 contain at least the following members, in any order. The semantics of the members and
10698 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
10699 the values specified in the comments.
10700 <!--page 217 -->
10701 <pre>
10702 char *decimal_point; // "."
10703 char *thousands_sep; // ""
10704 char *grouping; // ""
10705 char *mon_decimal_point; // ""
10706 char *mon_thousands_sep; // ""
10707 char *mon_grouping; // ""
10708 char *positive_sign; // ""
10709 char *negative_sign; // ""
10710 char *currency_symbol; // ""
10711 char frac_digits; // CHAR_MAX
10712 char p_cs_precedes; // CHAR_MAX
10713 char n_cs_precedes; // CHAR_MAX
10714 char p_sep_by_space; // CHAR_MAX
10715 char n_sep_by_space; // CHAR_MAX
10716 char p_sign_posn; // CHAR_MAX
10717 char n_sign_posn; // CHAR_MAX
10718 char *int_curr_symbol; // ""
10719 char int_frac_digits; // CHAR_MAX
10720 char int_p_cs_precedes; // CHAR_MAX
10721 char int_n_cs_precedes; // CHAR_MAX
10722 char int_p_sep_by_space; // CHAR_MAX
10723 char int_n_sep_by_space; // CHAR_MAX
10724 char int_p_sign_posn; // CHAR_MAX
10725 char int_n_sign_posn; // CHAR_MAX
10726 </pre>
10727 <p><a name="7.11p3" href="#7.11p3"><small>3</small></a>
10728 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
10729 <pre>
10730 LC_ALL
10731 LC_COLLATE
10732 LC_CTYPE
10733 LC_MONETARY
10734 LC_NUMERIC
10735 LC_TIME
10736 </pre>
10737 which expand to integer constant expressions with distinct values, suitable for use as the
10738 first argument to the setlocale function.<sup><a href="#note194"><b>194)</b></a></sup> Additional macro definitions, beginning
10739 with the characters LC_ and an uppercase letter,<sup><a href="#note195"><b>195)</b></a></sup> may also be specified by the
10740 implementation.
10742 <p><b>Footnotes</b>
10743 <p><small><a name="note194" href="#note194">194)</a> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
10744 </small>
10745 <p><small><a name="note195" href="#note195">195)</a> See ''future library directions'' (<a href="#7.26.5">7.26.5</a>).
10746 </small>
10748 <p><small><a href="#Contents">Contents</a></small>
10749 <h4><a name="7.11.1" href="#7.11.1">7.11.1 Locale control</a></h4>
10751 <p><small><a href="#Contents">Contents</a></small>
10752 <h5><a name="7.11.1.1" href="#7.11.1.1">7.11.1.1 The setlocale function</a></h5>
10753 <p><b>Synopsis</b>
10754 <p><a name="7.11.1.1p1" href="#7.11.1.1p1"><small>1</small></a>
10755 <pre>
10756 #include <a href="#7.11">&lt;locale.h&gt;</a>
10757 char *setlocale(int category, const char *locale);
10758 </pre>
10759 <p><b>Description</b>
10760 <p><a name="7.11.1.1p2" href="#7.11.1.1p2"><small>2</small></a>
10761 The setlocale function selects the appropriate portion of the program's locale as
10762 specified by the category and locale arguments. The setlocale function may be
10763 used to change or query the program's entire current locale or portions thereof. The value
10764 LC_ALL for category names the program's entire locale; the other values for
10765 category name only a portion of the program's locale. LC_COLLATE affects the
10766 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
10767 the character handling functions<sup><a href="#note196"><b>196)</b></a></sup> and the multibyte and wide character functions.
10768 LC_MONETARY affects the monetary formatting information returned by the
10769 localeconv function. LC_NUMERIC affects the decimal-point character for the
10770 formatted input/output functions and the string conversion functions, as well as the
10771 nonmonetary formatting information returned by the localeconv function. LC_TIME
10772 affects the behavior of the strftime and wcsftime functions.
10773 <p><a name="7.11.1.1p3" href="#7.11.1.1p3"><small>3</small></a>
10774 A value of "C" for locale specifies the minimal environment for C translation; a value
10775 of "" for locale specifies the locale-specific native environment. Other
10776 implementation-defined strings may be passed as the second argument to setlocale.
10778 <!--page 218 -->
10779 <p><a name="7.11.1.1p4" href="#7.11.1.1p4"><small>4</small></a>
10780 At program startup, the equivalent of
10781 <pre>
10782 setlocale(LC_ALL, "C");
10783 </pre>
10784 is executed.
10785 <p><a name="7.11.1.1p5" href="#7.11.1.1p5"><small>5</small></a>
10786 The implementation shall behave as if no library function calls the setlocale function.
10787 <p><b>Returns</b>
10788 <p><a name="7.11.1.1p6" href="#7.11.1.1p6"><small>6</small></a>
10789 If a pointer to a string is given for locale and the selection can be honored, the
10790 setlocale function returns a pointer to the string associated with the specified
10791 category for the new locale. If the selection cannot be honored, the setlocale
10792 function returns a null pointer and the program's locale is not changed.
10793 <p><a name="7.11.1.1p7" href="#7.11.1.1p7"><small>7</small></a>
10794 A null pointer for locale causes the setlocale function to return a pointer to the
10795 string associated with the category for the program's current locale; the program's
10796 locale is not changed.<sup><a href="#note197"><b>197)</b></a></sup>
10797 <p><a name="7.11.1.1p8" href="#7.11.1.1p8"><small>8</small></a>
10798 The pointer to string returned by the setlocale function is such that a subsequent call
10799 with that string value and its associated category will restore that part of the program's
10800 locale. The string pointed to shall not be modified by the program, but may be
10801 overwritten by a subsequent call to the setlocale function.
10802 <p><b> Forward references</b>: formatted input/output functions (<a href="#7.19.6">7.19.6</a>), multibyte/wide
10803 character conversion functions (<a href="#7.20.7">7.20.7</a>), multibyte/wide string conversion functions
10804 (<a href="#7.20.8">7.20.8</a>), numeric conversion functions (<a href="#7.20.1">7.20.1</a>), the strcoll function (<a href="#7.21.4.3">7.21.4.3</a>), the
10805 strftime function (<a href="#7.23.3.5">7.23.3.5</a>), the strxfrm function (<a href="#7.21.4.5">7.21.4.5</a>).
10807 <p><b>Footnotes</b>
10808 <p><small><a name="note196" href="#note196">196)</a> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
10809 isxdigit.
10810 </small>
10811 <p><small><a name="note197" href="#note197">197)</a> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
10812 locale when category has the value LC_ALL.
10813 </small>
10815 <p><small><a href="#Contents">Contents</a></small>
10816 <h4><a name="7.11.2" href="#7.11.2">7.11.2 Numeric formatting convention inquiry</a></h4>
10818 <p><small><a href="#Contents">Contents</a></small>
10819 <h5><a name="7.11.2.1" href="#7.11.2.1">7.11.2.1 The localeconv function</a></h5>
10820 <p><b>Synopsis</b>
10821 <p><a name="7.11.2.1p1" href="#7.11.2.1p1"><small>1</small></a>
10822 <pre>
10823 #include <a href="#7.11">&lt;locale.h&gt;</a>
10824 struct lconv *localeconv(void);
10825 </pre>
10826 <p><b>Description</b>
10827 <p><a name="7.11.2.1p2" href="#7.11.2.1p2"><small>2</small></a>
10828 The localeconv function sets the components of an object with type struct lconv
10829 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
10830 according to the rules of the current locale.
10831 <p><a name="7.11.2.1p3" href="#7.11.2.1p3"><small>3</small></a>
10832 The members of the structure with type char * are pointers to strings, any of which
10833 (except decimal_point) can point to "", to indicate that the value is not available in
10834 the current locale or is of zero length. Apart from grouping and mon_grouping, the
10836 <!--page 219 -->
10837 strings shall start and end in the initial shift state. The members with type char are
10838 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
10839 available in the current locale. The members include the following:
10840 <dl>
10841 <dt> char *decimal_point
10842 <dd>
10843 The decimal-point character used to format nonmonetary quantities.
10844 <dt> char *thousands_sep
10845 <dd>
10846 The character used to separate groups of digits before the decimal-point
10847 character in formatted nonmonetary quantities.
10848 <dt> char *grouping
10849 <dd>
10850 A string whose elements indicate the size of each group of digits in
10851 formatted nonmonetary quantities.
10852 <dt> char *mon_decimal_point
10853 <dd>
10854 The decimal-point used to format monetary quantities.
10855 <dt> char *mon_thousands_sep
10856 <dd>
10857 The separator for groups of digits before the decimal-point in formatted
10858 monetary quantities.
10859 <dt> char *mon_grouping
10860 <dd>
10861 A string whose elements indicate the size of each group of digits in
10862 formatted monetary quantities.
10863 <dt> char *positive_sign
10864 <dd>
10865 The string used to indicate a nonnegative-valued formatted monetary
10866 quantity.
10867 <dt> char *negative_sign
10868 <dd>
10869 The string used to indicate a negative-valued formatted monetary quantity.
10870 <dt> char *currency_symbol
10871 <dd>
10872 The local currency symbol applicable to the current locale.
10873 <dt> char frac_digits
10874 <dd>
10875 The number of fractional digits (those after the decimal-point) to be
10876 displayed in a locally formatted monetary quantity.
10877 <dt> char p_cs_precedes
10878 <dd>
10879 Set to 1 or 0 if the currency_symbol respectively precedes or
10880 succeeds the value for a nonnegative locally formatted monetary quantity.
10881 <dt> char n_cs_precedes
10882 <!--page 220 -->
10883 <dd>
10884 Set to 1 or 0 if the currency_symbol respectively precedes or
10885 succeeds the value for a negative locally formatted monetary quantity.
10886 <dt> char p_sep_by_space
10887 <dd>
10888 Set to a value indicating the separation of the currency_symbol, the
10889 sign string, and the value for a nonnegative locally formatted monetary
10890 quantity.
10891 <dt> char n_sep_by_space
10892 <dd>
10893 Set to a value indicating the separation of the currency_symbol, the
10894 sign string, and the value for a negative locally formatted monetary
10895 quantity.
10896 <dt> char p_sign_posn
10897 <dd>
10898 Set to a value indicating the positioning of the positive_sign for a
10899 nonnegative locally formatted monetary quantity.
10900 <dt> char n_sign_posn
10901 <dd>
10902 Set to a value indicating the positioning of the negative_sign for a
10903 negative locally formatted monetary quantity.
10904 <dt> char *int_curr_symbol
10905 <dd>
10906 The international currency symbol applicable to the current locale. The
10907 first three characters contain the alphabetic international currency symbol
10908 in accordance with those specified in ISO 4217. The fourth character
10909 (immediately preceding the null character) is the character used to separate
10910 the international currency symbol from the monetary quantity.
10911 <dt> char int_frac_digits
10912 <dd>
10913 The number of fractional digits (those after the decimal-point) to be
10914 displayed in an internationally formatted monetary quantity.
10915 <dt> char int_p_cs_precedes
10916 <dd>
10917 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10918 succeeds the value for a nonnegative internationally formatted monetary
10919 quantity.
10920 <dt> char int_n_cs_precedes
10921 <dd>
10922 Set to 1 or 0 if the int_curr_symbol respectively precedes or
10923 succeeds the value for a negative internationally formatted monetary
10924 quantity.
10925 <dt> char int_p_sep_by_space
10926 <!--page 221 -->
10927 <dd>
10928 Set to a value indicating the separation of the int_curr_symbol, the
10929 sign string, and the value for a nonnegative internationally formatted
10930 monetary quantity.
10931 <dt> char int_n_sep_by_space
10932 <dd>
10933 Set to a value indicating the separation of the int_curr_symbol, the
10934 sign string, and the value for a negative internationally formatted monetary
10935 quantity.
10936 <dt> char int_p_sign_posn
10937 <dd>
10938 Set to a value indicating the positioning of the positive_sign for a
10939 nonnegative internationally formatted monetary quantity.
10940 <dt> char int_n_sign_posn
10941 <dd>
10942 Set to a value indicating the positioning of the negative_sign for a
10943 negative internationally formatted monetary quantity.
10944 </dl>
10945 <p><a name="7.11.2.1p4" href="#7.11.2.1p4"><small>4</small></a>
10946 The elements of grouping and mon_grouping are interpreted according to the
10947 following:
10948 <dl>
10949 <dt> CHAR_MAX <dd>No further grouping is to be performed.
10950 <dt> 0 <dd>The previous element is to be repeatedly used for the remainder of the
10951 digits.
10952 <dt> other <dd>The integer value is the number of digits that compose the current group.
10953 The next element is examined to determine the size of the next group of
10954 digits before the current group.
10955 </dl>
10956 <p><a name="7.11.2.1p5" href="#7.11.2.1p5"><small>5</small></a>
10957 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
10958 and int_n_sep_by_space are interpreted according to the following:
10959 <dl>
10960 <dt> 0 <dd>No space separates the currency symbol and value.
10961 <dt> 1 <dd>If the currency symbol and sign string are adjacent, a space separates them from the
10962 value; otherwise, a space separates the currency symbol from the value.
10963 <dt> 2 <dd>If the currency symbol and sign string are adjacent, a space separates them;
10964 otherwise, a space separates the sign string from the value.
10965 </dl>
10966 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
10967 int_curr_symbol is used instead of a space.
10968 <p><a name="7.11.2.1p6" href="#7.11.2.1p6"><small>6</small></a>
10969 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
10970 int_n_sign_posn are interpreted according to the following:
10971 <dl>
10972 <dt> 0 <dd>Parentheses surround the quantity and currency symbol.
10973 <dt> 1 <dd>The sign string precedes the quantity and currency symbol.
10974 <dt> 2 <dd>The sign string succeeds the quantity and currency symbol.
10975 <dt> 3 <dd>The sign string immediately precedes the currency symbol.
10976 <dt> 4 <dd>The sign string immediately succeeds the currency symbol.
10977 </dl>
10978 <!--page 222 -->
10979 <p><a name="7.11.2.1p7" href="#7.11.2.1p7"><small>7</small></a>
10980 The implementation shall behave as if no library function calls the localeconv
10981 function.
10982 <p><b>Returns</b>
10983 <p><a name="7.11.2.1p8" href="#7.11.2.1p8"><small>8</small></a>
10984 The localeconv function returns a pointer to the filled-in object. The structure
10985 pointed to by the return value shall not be modified by the program, but may be
10986 overwritten by a subsequent call to the localeconv function. In addition, calls to the
10987 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
10988 overwrite the contents of the structure.
10989 <p><a name="7.11.2.1p9" href="#7.11.2.1p9"><small>9</small></a>
10990 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
10991 monetary quantities.
10992 <pre>
10993 Local format International format
10995 Country Positive Negative Positive Negative
10997 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
10998 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
10999 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
11000 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
11001 </pre>
11002 <p><a name="7.11.2.1p10" href="#7.11.2.1p10"><small>10</small></a>
11003 For these four countries, the respective values for the monetary members of the structure returned by
11004 localeconv could be:
11005 <pre>
11006 Country1 Country2 Country3 Country4
11008 mon_decimal_point "," "" "," "."
11009 mon_thousands_sep "." "." "." ","
11010 mon_grouping "\3" "\3" "\3" "\3"
11011 positive_sign "" "" "" ""
11012 negative_sign "-" "-" "-" "C"
11013 currency_symbol "mk" "L." "\u0192" "SFrs."
11014 frac_digits 2 0 2 2
11015 p_cs_precedes 0 1 1 1
11016 n_cs_precedes 0 1 1 1
11017 p_sep_by_space 1 0 1 0
11018 n_sep_by_space 1 0 2 0
11019 p_sign_posn 1 1 1 1
11020 n_sign_posn 1 1 4 2
11021 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
11022 int_frac_digits 2 0 2 2
11023 int_p_cs_precedes 1 1 1 1
11024 int_n_cs_precedes 1 1 1 1
11025 int_p_sep_by_space 1 1 1 1
11026 int_n_sep_by_space 2 1 2 1
11027 int_p_sign_posn 1 1 1 1
11028 int_n_sign_posn 4 1 4 2
11029 </pre>
11030 <!--page 223 -->
11031 <p><a name="7.11.2.1p11" href="#7.11.2.1p11"><small>11</small></a>
11032 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
11033 affect the formatted value.
11034 <pre>
11035 p_sep_by_space
11036 p_cs_precedes p_sign_posn 0 1 2
11038 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
11039 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
11040 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
11041 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
11042 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
11044 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
11045 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
11046 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
11047 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
11048 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25
11049 </pre>
11051 <!--page 224 -->
11052 <p><small><a href="#Contents">Contents</a></small>
11053 <h3><a name="7.12" href="#7.12">7.12 Mathematics &lt;math.h&gt;</a></h3>
11054 <p><a name="7.12p1" href="#7.12p1"><small>1</small></a>
11055 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
11056 several macros. Most synopses specify a family of functions consisting of a principal
11057 function with one or more double parameters, a double return value, or both; and
11058 other functions with the same name but with f and l suffixes, which are corresponding
11059 functions with float and long double parameters, return values, or both.<sup><a href="#note198"><b>198)</b></a></sup>
11060 Integer arithmetic functions and conversion functions are discussed later.
11061 <p><a name="7.12p2" href="#7.12p2"><small>2</small></a>
11062 The types
11063 <pre>
11064 float_t
11065 double_t
11066 </pre>
11067 are floating types at least as wide as float and double, respectively, and such that
11068 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
11069 float_t and double_t are float and double, respectively; if
11070 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
11071 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
11072 otherwise implementation-defined.<sup><a href="#note199"><b>199)</b></a></sup>
11073 <p><a name="7.12p3" href="#7.12p3"><small>3</small></a>
11074 The macro
11075 <pre>
11076 HUGE_VAL
11077 </pre>
11078 expands to a positive double constant expression, not necessarily representable as a
11079 float. The macros
11080 <pre>
11081 HUGE_VALF
11082 HUGE_VALL
11083 </pre>
11084 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note200"><b>200)</b></a></sup>
11085 <p><a name="7.12p4" href="#7.12p4"><small>4</small></a>
11086 The macro
11087 <pre>
11088 INFINITY
11089 </pre>
11090 expands to a constant expression of type float representing positive or unsigned
11091 infinity, if available; else to a positive constant of type float that overflows at
11095 <!--page 225 -->
11096 translation time.<sup><a href="#note201"><b>201)</b></a></sup>
11097 <p><a name="7.12p5" href="#7.12p5"><small>5</small></a>
11098 The macro
11099 <pre>
11101 </pre>
11102 is defined if and only if the implementation supports quiet NaNs for the float type. It
11103 expands to a constant expression of type float representing a quiet NaN.
11104 <p><a name="7.12p6" href="#7.12p6"><small>6</small></a>
11105 The number classification macros
11106 <pre>
11107 FP_INFINITE
11108 FP_NAN
11109 FP_NORMAL
11110 FP_SUBNORMAL
11111 FP_ZERO
11112 </pre>
11113 represent the mutually exclusive kinds of floating-point values. They expand to integer
11114 constant expressions with distinct values. Additional implementation-defined floating-
11115 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
11116 may also be specified by the implementation.
11117 <p><a name="7.12p7" href="#7.12p7"><small>7</small></a>
11118 The macro
11119 <pre>
11120 FP_FAST_FMA
11121 </pre>
11122 is optionally defined. If defined, it indicates that the fma function generally executes
11123 about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note202"><b>202)</b></a></sup> The
11124 macros
11125 <pre>
11126 FP_FAST_FMAF
11127 FP_FAST_FMAL
11128 </pre>
11129 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
11130 these macros expand to the integer constant 1.
11131 <p><a name="7.12p8" href="#7.12p8"><small>8</small></a>
11132 The macros
11133 <pre>
11134 FP_ILOGB0
11135 FP_ILOGBNAN
11136 </pre>
11137 expand to integer constant expressions whose values are returned by ilogb(x) if x is
11138 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
11139 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
11142 <!--page 226 -->
11143 <p><a name="7.12p9" href="#7.12p9"><small>9</small></a>
11144 The macros
11145 <pre>
11146 MATH_ERRNO
11147 MATH_ERREXCEPT
11148 </pre>
11149 expand to the integer constants 1 and 2, respectively; the macro
11150 <pre>
11151 math_errhandling
11152 </pre>
11153 expands to an expression that has type int and the value MATH_ERRNO,
11154 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
11155 constant for the duration of the program. It is unspecified whether
11156 math_errhandling is a macro or an identifier with external linkage. If a macro
11157 definition is suppressed or a program defines an identifier with the name
11158 math_errhandling, the behavior is undefined. If the expression
11159 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
11160 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
11161 <a href="#7.6">&lt;fenv.h&gt;</a>.
11163 <p><b>Footnotes</b>
11164 <p><small><a name="note198" href="#note198">198)</a> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
11165 and return values in wider format than the synopsis prototype indicates.
11166 </small>
11167 <p><small><a name="note199" href="#note199">199)</a> The types float_t and double_t are intended to be the implementation's most efficient types at
11168 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
11169 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
11170 </small>
11171 <p><small><a name="note200" href="#note200">200)</a> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
11172 supports infinities.
11173 </small>
11174 <p><small><a name="note201" href="#note201">201)</a> In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
11175 </small>
11176 <p><small><a name="note202" href="#note202">202)</a> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
11177 directly with a hardware multiply-add instruction. Software implementations are expected to be
11178 substantially slower.
11179 </small>
11181 <p><small><a href="#Contents">Contents</a></small>
11182 <h4><a name="7.12.1" href="#7.12.1">7.12.1 Treatment of error conditions</a></h4>
11183 <p><a name="7.12.1p1" href="#7.12.1p1"><small>1</small></a>
11184 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
11185 values of its input arguments, except where stated otherwise. Each function shall execute
11186 as if it were a single operation without generating any externally visible exceptional
11187 conditions.
11188 <p><a name="7.12.1p2" href="#7.12.1p2"><small>2</small></a>
11189 For all functions, a domain error occurs if an input argument is outside the domain over
11190 which the mathematical function is defined. The description of each function lists any
11191 required domain errors; an implementation may define additional domain errors, provided
11192 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note203"><b>203)</b></a></sup> On a
11193 domain error, the function returns an implementation-defined value; if the integer
11194 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
11195 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
11196 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
11197 <p><a name="7.12.1p3" href="#7.12.1p3"><small>3</small></a>
11198 Similarly, a range error occurs if the mathematical result of the function cannot be
11199 represented in an object of the specified type, due to extreme magnitude.
11200 <p><a name="7.12.1p4" href="#7.12.1p4"><small>4</small></a>
11201 A floating result overflows if the magnitude of the mathematical result is finite but so
11202 large that the mathematical result cannot be represented without extraordinary roundoff
11203 error in an object of the specified type. If a floating result overflows and default rounding
11204 is in effect, or if the mathematical result is an exact infinity from finite arguments (for
11205 example log(0.0)), then the function returns the value of the macro HUGE_VAL,
11208 <!--page 227 -->
11209 HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
11210 correct value of the function; if the integer expression math_errhandling &amp;
11211 MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if
11212 the integer expression math_errhandling &amp; MATH_ERREXCEPT is nonzero, the
11213 ''divide-by-zero'' floating-point exception is raised if the mathematical result is an exact
11214 infinity and the ''overflow'' floating-point exception is raised otherwise.
11215 <p><a name="7.12.1p5" href="#7.12.1p5"><small>5</small></a>
11216 The result underflows if the magnitude of the mathematical result is so small that the
11217 mathematical result cannot be represented, without extraordinary roundoff error, in an
11218 object of the specified type.<sup><a href="#note204"><b>204)</b></a></sup> If the result underflows, the function returns an
11219 implementation-defined value whose magnitude is no greater than the smallest
11220 normalized positive number in the specified type; if the integer expression
11221 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
11222 value ERANGE is implementation-defined; if the integer expression
11223 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
11224 floating-point exception is raised is implementation-defined.
11226 <p><b>Footnotes</b>
11227 <p><small><a name="note203" href="#note203">203)</a> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
11228 error if the mathematical domain of the function does not include the infinity.
11229 </small>
11230 <p><small><a name="note204" href="#note204">204)</a> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
11231 also ''flush-to-zero'' underflow.
11232 </small>
11234 <p><small><a href="#Contents">Contents</a></small>
11235 <h4><a name="7.12.2" href="#7.12.2">7.12.2 The FP_CONTRACT pragma</a></h4>
11236 <p><b>Synopsis</b>
11237 <p><a name="7.12.2p1" href="#7.12.2p1"><small>1</small></a>
11238 <pre>
11239 #include <a href="#7.12">&lt;math.h&gt;</a>
11240 #pragma STDC FP_CONTRACT on-off-switch
11241 </pre>
11242 <p><b>Description</b>
11243 <p><a name="7.12.2p2" href="#7.12.2p2"><small>2</small></a>
11244 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
11245 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
11246 either outside external declarations or preceding all explicit declarations and statements
11247 inside a compound statement. When outside external declarations, the pragma takes
11248 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
11249 the end of the translation unit. When inside a compound statement, the pragma takes
11250 effect from its occurrence until another FP_CONTRACT pragma is encountered
11251 (including within a nested compound statement), or until the end of the compound
11252 statement; at the end of a compound statement the state for the pragma is restored to its
11253 condition just before the compound statement. If this pragma is used in any other
11254 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
11255 implementation-defined.
11260 <!--page 228 -->
11262 <p><small><a href="#Contents">Contents</a></small>
11263 <h4><a name="7.12.3" href="#7.12.3">7.12.3 Classification macros</a></h4>
11264 <p><a name="7.12.3p1" href="#7.12.3p1"><small>1</small></a>
11265 In the synopses in this subclause, real-floating indicates that the argument shall be an
11266 expression of real floating type.
11268 <p><small><a href="#Contents">Contents</a></small>
11269 <h5><a name="7.12.3.1" href="#7.12.3.1">7.12.3.1 The fpclassify macro</a></h5>
11270 <p><b>Synopsis</b>
11271 <p><a name="7.12.3.1p1" href="#7.12.3.1p1"><small>1</small></a>
11272 <pre>
11273 #include <a href="#7.12">&lt;math.h&gt;</a>
11274 int fpclassify(real-floating x);
11275 </pre>
11276 <p><b>Description</b>
11277 <p><a name="7.12.3.1p2" href="#7.12.3.1p2"><small>2</small></a>
11278 The fpclassify macro classifies its argument value as NaN, infinite, normal,
11279 subnormal, zero, or into another implementation-defined category. First, an argument
11280 represented in a format wider than its semantic type is converted to its semantic type.
11281 Then classification is based on the type of the argument.<sup><a href="#note205"><b>205)</b></a></sup>
11282 <p><b>Returns</b>
11283 <p><a name="7.12.3.1p3" href="#7.12.3.1p3"><small>3</small></a>
11284 The fpclassify macro returns the value of the number classification macro
11285 appropriate to the value of its argument.
11286 <p><a name="7.12.3.1p4" href="#7.12.3.1p4"><small>4</small></a>
11287 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
11288 <pre>
11289 #define fpclassify(x) \
11290 ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : \
11291 (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) : \
11292 __fpclassifyl(x))
11293 </pre>
11296 <p><b>Footnotes</b>
11297 <p><small><a name="note205" href="#note205">205)</a> Since an expression can be evaluated with more range and precision than its type has, it is important to
11298 know the type that classification is based on. For example, a normal long double value might
11299 become subnormal when converted to double, and zero when converted to float.
11300 </small>
11302 <p><small><a href="#Contents">Contents</a></small>
11303 <h5><a name="7.12.3.2" href="#7.12.3.2">7.12.3.2 The isfinite macro</a></h5>
11304 <p><b>Synopsis</b>
11305 <p><a name="7.12.3.2p1" href="#7.12.3.2p1"><small>1</small></a>
11306 <pre>
11307 #include <a href="#7.12">&lt;math.h&gt;</a>
11308 int isfinite(real-floating x);
11309 </pre>
11310 <p><b>Description</b>
11311 <p><a name="7.12.3.2p2" href="#7.12.3.2p2"><small>2</small></a>
11312 The isfinite macro determines whether its argument has a finite value (zero,
11313 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
11314 format wider than its semantic type is converted to its semantic type. Then determination
11315 is based on the type of the argument.
11320 <!--page 229 -->
11321 <p><b>Returns</b>
11322 <p><a name="7.12.3.2p3" href="#7.12.3.2p3"><small>3</small></a>
11323 The isfinite macro returns a nonzero value if and only if its argument has a finite
11324 value.
11326 <p><small><a href="#Contents">Contents</a></small>
11327 <h5><a name="7.12.3.3" href="#7.12.3.3">7.12.3.3 The isinf macro</a></h5>
11328 <p><b>Synopsis</b>
11329 <p><a name="7.12.3.3p1" href="#7.12.3.3p1"><small>1</small></a>
11330 <pre>
11331 #include <a href="#7.12">&lt;math.h&gt;</a>
11332 int isinf(real-floating x);
11333 </pre>
11334 <p><b>Description</b>
11335 <p><a name="7.12.3.3p2" href="#7.12.3.3p2"><small>2</small></a>
11336 The isinf macro determines whether its argument value is an infinity (positive or
11337 negative). First, an argument represented in a format wider than its semantic type is
11338 converted to its semantic type. Then determination is based on the type of the argument.
11339 <p><b>Returns</b>
11340 <p><a name="7.12.3.3p3" href="#7.12.3.3p3"><small>3</small></a>
11341 The isinf macro returns a nonzero value if and only if its argument has an infinite
11342 value.
11344 <p><small><a href="#Contents">Contents</a></small>
11345 <h5><a name="7.12.3.4" href="#7.12.3.4">7.12.3.4 The isnan macro</a></h5>
11346 <p><b>Synopsis</b>
11347 <p><a name="7.12.3.4p1" href="#7.12.3.4p1"><small>1</small></a>
11348 <pre>
11349 #include <a href="#7.12">&lt;math.h&gt;</a>
11350 int isnan(real-floating x);
11351 </pre>
11352 <p><b>Description</b>
11353 <p><a name="7.12.3.4p2" href="#7.12.3.4p2"><small>2</small></a>
11354 The isnan macro determines whether its argument value is a NaN. First, an argument
11355 represented in a format wider than its semantic type is converted to its semantic type.
11356 Then determination is based on the type of the argument.<sup><a href="#note206"><b>206)</b></a></sup>
11357 <p><b>Returns</b>
11358 <p><a name="7.12.3.4p3" href="#7.12.3.4p3"><small>3</small></a>
11359 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
11361 <p><b>Footnotes</b>
11362 <p><small><a name="note206" href="#note206">206)</a> For the isnan macro, the type for determination does not matter unless the implementation supports
11363 NaNs in the evaluation type but not in the semantic type.
11364 </small>
11366 <p><small><a href="#Contents">Contents</a></small>
11367 <h5><a name="7.12.3.5" href="#7.12.3.5">7.12.3.5 The isnormal macro</a></h5>
11368 <p><b>Synopsis</b>
11369 <p><a name="7.12.3.5p1" href="#7.12.3.5p1"><small>1</small></a>
11370 <pre>
11371 #include <a href="#7.12">&lt;math.h&gt;</a>
11372 int isnormal(real-floating x);
11373 </pre>
11378 <!--page 230 -->
11379 <p><b>Description</b>
11380 <p><a name="7.12.3.5p2" href="#7.12.3.5p2"><small>2</small></a>
11381 The isnormal macro determines whether its argument value is normal (neither zero,
11382 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
11383 semantic type is converted to its semantic type. Then determination is based on the type
11384 of the argument.
11385 <p><b>Returns</b>
11386 <p><a name="7.12.3.5p3" href="#7.12.3.5p3"><small>3</small></a>
11387 The isnormal macro returns a nonzero value if and only if its argument has a normal
11388 value.
11390 <p><small><a href="#Contents">Contents</a></small>
11391 <h5><a name="7.12.3.6" href="#7.12.3.6">7.12.3.6 The signbit macro</a></h5>
11392 <p><b>Synopsis</b>
11393 <p><a name="7.12.3.6p1" href="#7.12.3.6p1"><small>1</small></a>
11394 <pre>
11395 #include <a href="#7.12">&lt;math.h&gt;</a>
11396 int signbit(real-floating x);
11397 </pre>
11398 <p><b>Description</b>
11399 <p><a name="7.12.3.6p2" href="#7.12.3.6p2"><small>2</small></a>
11400 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note207"><b>207)</b></a></sup>
11401 <p><b>Returns</b>
11402 <p><a name="7.12.3.6p3" href="#7.12.3.6p3"><small>3</small></a>
11403 The signbit macro returns a nonzero value if and only if the sign of its argument value
11404 is negative.
11406 <p><b>Footnotes</b>
11407 <p><small><a name="note207" href="#note207">207)</a> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
11408 unsigned, it is treated as positive.
11409 </small>
11411 <p><small><a href="#Contents">Contents</a></small>
11412 <h4><a name="7.12.4" href="#7.12.4">7.12.4 Trigonometric functions</a></h4>
11414 <p><small><a href="#Contents">Contents</a></small>
11415 <h5><a name="7.12.4.1" href="#7.12.4.1">7.12.4.1 The acos functions</a></h5>
11416 <p><b>Synopsis</b>
11417 <p><a name="7.12.4.1p1" href="#7.12.4.1p1"><small>1</small></a>
11418 <pre>
11419 #include <a href="#7.12">&lt;math.h&gt;</a>
11420 double acos(double x);
11421 float acosf(float x);
11422 long double acosl(long double x);
11423 </pre>
11424 <p><b>Description</b>
11425 <p><a name="7.12.4.1p2" href="#7.12.4.1p2"><small>2</small></a>
11426 The acos functions compute the principal value of the arc cosine of x. A domain error
11427 occurs for arguments not in the interval [-1, +1].
11428 <p><b>Returns</b>
11429 <p><a name="7.12.4.1p3" href="#7.12.4.1p3"><small>3</small></a>
11430 The acos functions return arccos x in the interval [0, pi ] radians.
11435 <!--page 231 -->
11437 <p><small><a href="#Contents">Contents</a></small>
11438 <h5><a name="7.12.4.2" href="#7.12.4.2">7.12.4.2 The asin functions</a></h5>
11439 <p><b>Synopsis</b>
11440 <p><a name="7.12.4.2p1" href="#7.12.4.2p1"><small>1</small></a>
11441 <pre>
11442 #include <a href="#7.12">&lt;math.h&gt;</a>
11443 double asin(double x);
11444 float asinf(float x);
11445 long double asinl(long double x);
11446 </pre>
11447 <p><b>Description</b>
11448 <p><a name="7.12.4.2p2" href="#7.12.4.2p2"><small>2</small></a>
11449 The asin functions compute the principal value of the arc sine of x. A domain error
11450 occurs for arguments not in the interval [-1, +1].
11451 <p><b>Returns</b>
11452 <p><a name="7.12.4.2p3" href="#7.12.4.2p3"><small>3</small></a>
11453 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
11455 <p><small><a href="#Contents">Contents</a></small>
11456 <h5><a name="7.12.4.3" href="#7.12.4.3">7.12.4.3 The atan functions</a></h5>
11457 <p><b>Synopsis</b>
11458 <p><a name="7.12.4.3p1" href="#7.12.4.3p1"><small>1</small></a>
11459 <pre>
11460 #include <a href="#7.12">&lt;math.h&gt;</a>
11461 double atan(double x);
11462 float atanf(float x);
11463 long double atanl(long double x);
11464 </pre>
11465 <p><b>Description</b>
11466 <p><a name="7.12.4.3p2" href="#7.12.4.3p2"><small>2</small></a>
11467 The atan functions compute the principal value of the arc tangent of x.
11468 <p><b>Returns</b>
11469 <p><a name="7.12.4.3p3" href="#7.12.4.3p3"><small>3</small></a>
11470 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
11472 <p><small><a href="#Contents">Contents</a></small>
11473 <h5><a name="7.12.4.4" href="#7.12.4.4">7.12.4.4 The atan2 functions</a></h5>
11474 <p><b>Synopsis</b>
11475 <p><a name="7.12.4.4p1" href="#7.12.4.4p1"><small>1</small></a>
11476 <pre>
11477 #include <a href="#7.12">&lt;math.h&gt;</a>
11478 double atan2(double y, double x);
11479 float atan2f(float y, float x);
11480 long double atan2l(long double y, long double x);
11481 </pre>
11482 <p><b>Description</b>
11483 <p><a name="7.12.4.4p2" href="#7.12.4.4p2"><small>2</small></a>
11484 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
11485 arguments to determine the quadrant of the return value. A domain error may occur if
11486 both arguments are zero.
11487 <p><b>Returns</b>
11488 <p><a name="7.12.4.4p3" href="#7.12.4.4p3"><small>3</small></a>
11489 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
11490 <!--page 232 -->
11492 <p><small><a href="#Contents">Contents</a></small>
11493 <h5><a name="7.12.4.5" href="#7.12.4.5">7.12.4.5 The cos functions</a></h5>
11494 <p><b>Synopsis</b>
11495 <p><a name="7.12.4.5p1" href="#7.12.4.5p1"><small>1</small></a>
11496 <pre>
11497 #include <a href="#7.12">&lt;math.h&gt;</a>
11498 double cos(double x);
11499 float cosf(float x);
11500 long double cosl(long double x);
11501 </pre>
11502 <p><b>Description</b>
11503 <p><a name="7.12.4.5p2" href="#7.12.4.5p2"><small>2</small></a>
11504 The cos functions compute the cosine of x (measured in radians).
11505 <p><b>Returns</b>
11506 <p><a name="7.12.4.5p3" href="#7.12.4.5p3"><small>3</small></a>
11507 The cos functions return cos x.
11509 <p><small><a href="#Contents">Contents</a></small>
11510 <h5><a name="7.12.4.6" href="#7.12.4.6">7.12.4.6 The sin functions</a></h5>
11511 <p><b>Synopsis</b>
11512 <p><a name="7.12.4.6p1" href="#7.12.4.6p1"><small>1</small></a>
11513 <pre>
11514 #include <a href="#7.12">&lt;math.h&gt;</a>
11515 double sin(double x);
11516 float sinf(float x);
11517 long double sinl(long double x);
11518 </pre>
11519 <p><b>Description</b>
11520 <p><a name="7.12.4.6p2" href="#7.12.4.6p2"><small>2</small></a>
11521 The sin functions compute the sine of x (measured in radians).
11522 <p><b>Returns</b>
11523 <p><a name="7.12.4.6p3" href="#7.12.4.6p3"><small>3</small></a>
11524 The sin functions return sin x.
11526 <p><small><a href="#Contents">Contents</a></small>
11527 <h5><a name="7.12.4.7" href="#7.12.4.7">7.12.4.7 The tan functions</a></h5>
11528 <p><b>Synopsis</b>
11529 <p><a name="7.12.4.7p1" href="#7.12.4.7p1"><small>1</small></a>
11530 <pre>
11531 #include <a href="#7.12">&lt;math.h&gt;</a>
11532 double tan(double x);
11533 float tanf(float x);
11534 long double tanl(long double x);
11535 </pre>
11536 <p><b>Description</b>
11537 <p><a name="7.12.4.7p2" href="#7.12.4.7p2"><small>2</small></a>
11538 The tan functions return the tangent of x (measured in radians).
11539 <p><b>Returns</b>
11540 <p><a name="7.12.4.7p3" href="#7.12.4.7p3"><small>3</small></a>
11541 The tan functions return tan x.
11542 <!--page 233 -->
11544 <p><small><a href="#Contents">Contents</a></small>
11545 <h4><a name="7.12.5" href="#7.12.5">7.12.5 Hyperbolic functions</a></h4>
11547 <p><small><a href="#Contents">Contents</a></small>
11548 <h5><a name="7.12.5.1" href="#7.12.5.1">7.12.5.1 The acosh functions</a></h5>
11549 <p><b>Synopsis</b>
11550 <p><a name="7.12.5.1p1" href="#7.12.5.1p1"><small>1</small></a>
11551 <pre>
11552 #include <a href="#7.12">&lt;math.h&gt;</a>
11553 double acosh(double x);
11554 float acoshf(float x);
11555 long double acoshl(long double x);
11556 </pre>
11557 <p><b>Description</b>
11558 <p><a name="7.12.5.1p2" href="#7.12.5.1p2"><small>2</small></a>
11559 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
11560 error occurs for arguments less than 1.
11561 <p><b>Returns</b>
11562 <p><a name="7.12.5.1p3" href="#7.12.5.1p3"><small>3</small></a>
11563 The acosh functions return arcosh x in the interval [0, +(inf)].
11565 <p><small><a href="#Contents">Contents</a></small>
11566 <h5><a name="7.12.5.2" href="#7.12.5.2">7.12.5.2 The asinh functions</a></h5>
11567 <p><b>Synopsis</b>
11568 <p><a name="7.12.5.2p1" href="#7.12.5.2p1"><small>1</small></a>
11569 <pre>
11570 #include <a href="#7.12">&lt;math.h&gt;</a>
11571 double asinh(double x);
11572 float asinhf(float x);
11573 long double asinhl(long double x);
11574 </pre>
11575 <p><b>Description</b>
11576 <p><a name="7.12.5.2p2" href="#7.12.5.2p2"><small>2</small></a>
11577 The asinh functions compute the arc hyperbolic sine of x.
11578 <p><b>Returns</b>
11579 <p><a name="7.12.5.2p3" href="#7.12.5.2p3"><small>3</small></a>
11580 The asinh functions return arsinh x.
11582 <p><small><a href="#Contents">Contents</a></small>
11583 <h5><a name="7.12.5.3" href="#7.12.5.3">7.12.5.3 The atanh functions</a></h5>
11584 <p><b>Synopsis</b>
11585 <p><a name="7.12.5.3p1" href="#7.12.5.3p1"><small>1</small></a>
11586 <pre>
11587 #include <a href="#7.12">&lt;math.h&gt;</a>
11588 double atanh(double x);
11589 float atanhf(float x);
11590 long double atanhl(long double x);
11591 </pre>
11592 <p><b>Description</b>
11593 <p><a name="7.12.5.3p2" href="#7.12.5.3p2"><small>2</small></a>
11594 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
11595 for arguments not in the interval [-1, +1]. A range error may occur if the argument
11596 equals -1 or +1.
11597 <!--page 234 -->
11598 <p><b>Returns</b>
11599 <p><a name="7.12.5.3p3" href="#7.12.5.3p3"><small>3</small></a>
11600 The atanh functions return artanh x.
11602 <p><small><a href="#Contents">Contents</a></small>
11603 <h5><a name="7.12.5.4" href="#7.12.5.4">7.12.5.4 The cosh functions</a></h5>
11604 <p><b>Synopsis</b>
11605 <p><a name="7.12.5.4p1" href="#7.12.5.4p1"><small>1</small></a>
11606 <pre>
11607 #include <a href="#7.12">&lt;math.h&gt;</a>
11608 double cosh(double x);
11609 float coshf(float x);
11610 long double coshl(long double x);
11611 </pre>
11612 <p><b>Description</b>
11613 <p><a name="7.12.5.4p2" href="#7.12.5.4p2"><small>2</small></a>
11614 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
11615 magnitude of x is too large.
11616 <p><b>Returns</b>
11617 <p><a name="7.12.5.4p3" href="#7.12.5.4p3"><small>3</small></a>
11618 The cosh functions return cosh x.
11620 <p><small><a href="#Contents">Contents</a></small>
11621 <h5><a name="7.12.5.5" href="#7.12.5.5">7.12.5.5 The sinh functions</a></h5>
11622 <p><b>Synopsis</b>
11623 <p><a name="7.12.5.5p1" href="#7.12.5.5p1"><small>1</small></a>
11624 <pre>
11625 #include <a href="#7.12">&lt;math.h&gt;</a>
11626 double sinh(double x);
11627 float sinhf(float x);
11628 long double sinhl(long double x);
11629 </pre>
11630 <p><b>Description</b>
11631 <p><a name="7.12.5.5p2" href="#7.12.5.5p2"><small>2</small></a>
11632 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
11633 magnitude of x is too large.
11634 <p><b>Returns</b>
11635 <p><a name="7.12.5.5p3" href="#7.12.5.5p3"><small>3</small></a>
11636 The sinh functions return sinh x.
11638 <p><small><a href="#Contents">Contents</a></small>
11639 <h5><a name="7.12.5.6" href="#7.12.5.6">7.12.5.6 The tanh functions</a></h5>
11640 <p><b>Synopsis</b>
11641 <p><a name="7.12.5.6p1" href="#7.12.5.6p1"><small>1</small></a>
11642 <pre>
11643 #include <a href="#7.12">&lt;math.h&gt;</a>
11644 double tanh(double x);
11645 float tanhf(float x);
11646 long double tanhl(long double x);
11647 </pre>
11648 <p><b>Description</b>
11649 <p><a name="7.12.5.6p2" href="#7.12.5.6p2"><small>2</small></a>
11650 The tanh functions compute the hyperbolic tangent of x.
11651 <!--page 235 -->
11652 <p><b>Returns</b>
11653 <p><a name="7.12.5.6p3" href="#7.12.5.6p3"><small>3</small></a>
11654 The tanh functions return tanh x.
11656 <p><small><a href="#Contents">Contents</a></small>
11657 <h4><a name="7.12.6" href="#7.12.6">7.12.6 Exponential and logarithmic functions</a></h4>
11659 <p><small><a href="#Contents">Contents</a></small>
11660 <h5><a name="7.12.6.1" href="#7.12.6.1">7.12.6.1 The exp functions</a></h5>
11661 <p><b>Synopsis</b>
11662 <p><a name="7.12.6.1p1" href="#7.12.6.1p1"><small>1</small></a>
11663 <pre>
11664 #include <a href="#7.12">&lt;math.h&gt;</a>
11665 double exp(double x);
11666 float expf(float x);
11667 long double expl(long double x);
11668 </pre>
11669 <p><b>Description</b>
11670 <p><a name="7.12.6.1p2" href="#7.12.6.1p2"><small>2</small></a>
11671 The exp functions compute the base-e exponential of x. A range error occurs if the
11672 magnitude of x is too large.
11673 <p><b>Returns</b>
11674 <p><a name="7.12.6.1p3" href="#7.12.6.1p3"><small>3</small></a>
11675 The exp functions return e<sup>x</sup>.
11677 <p><small><a href="#Contents">Contents</a></small>
11678 <h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
11679 <p><b>Synopsis</b>
11680 <p><a name="7.12.6.2p1" href="#7.12.6.2p1"><small>1</small></a>
11681 <pre>
11682 #include <a href="#7.12">&lt;math.h&gt;</a>
11683 double exp2(double x);
11684 float exp2f(float x);
11685 long double exp2l(long double x);
11686 </pre>
11687 <p><b>Description</b>
11688 <p><a name="7.12.6.2p2" href="#7.12.6.2p2"><small>2</small></a>
11689 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
11690 magnitude of x is too large.
11691 <p><b>Returns</b>
11692 <p><a name="7.12.6.2p3" href="#7.12.6.2p3"><small>3</small></a>
11693 The exp2 functions return 2<sup>x</sup>.
11695 <p><small><a href="#Contents">Contents</a></small>
11696 <h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 functions</a></h5>
11697 <p><b>Synopsis</b>
11698 <p><a name="7.12.6.3p1" href="#7.12.6.3p1"><small>1</small></a>
11699 <!--page 236 -->
11700 <pre>
11701 #include <a href="#7.12">&lt;math.h&gt;</a>
11702 double expm1(double x);
11703 float expm1f(float x);
11704 long double expm1l(long double x);
11705 </pre>
11706 <p><b>Description</b>
11707 <p><a name="7.12.6.3p2" href="#7.12.6.3p2"><small>2</small></a>
11708 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
11709 error occurs if x is too large.<sup><a href="#note208"><b>208)</b></a></sup>
11710 <p><b>Returns</b>
11711 <p><a name="7.12.6.3p3" href="#7.12.6.3p3"><small>3</small></a>
11712 The expm1 functions return e<sup>x</sup> - 1.
11714 <p><b>Footnotes</b>
11715 <p><small><a name="note208" href="#note208">208)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
11716 </small>
11718 <p><small><a href="#Contents">Contents</a></small>
11719 <h5><a name="7.12.6.4" href="#7.12.6.4">7.12.6.4 The frexp functions</a></h5>
11720 <p><b>Synopsis</b>
11721 <p><a name="7.12.6.4p1" href="#7.12.6.4p1"><small>1</small></a>
11722 <pre>
11723 #include <a href="#7.12">&lt;math.h&gt;</a>
11724 double frexp(double value, int *exp);
11725 float frexpf(float value, int *exp);
11726 long double frexpl(long double value, int *exp);
11727 </pre>
11728 <p><b>Description</b>
11729 <p><a name="7.12.6.4p2" href="#7.12.6.4p2"><small>2</small></a>
11730 The frexp functions break a floating-point number into a normalized fraction and an
11731 integral power of 2. They store the integer in the int object pointed to by exp.
11732 <p><b>Returns</b>
11733 <p><a name="7.12.6.4p3" href="#7.12.6.4p3"><small>3</small></a>
11734 If value is not a floating-point number, the results are unspecified. Otherwise, the
11735 frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
11736 zero, and value equals x 2<sup>*exp</sup> . If value is zero, both parts of the result are zero.
11738 <p><small><a href="#Contents">Contents</a></small>
11739 <h5><a name="7.12.6.5" href="#7.12.6.5">7.12.6.5 The ilogb functions</a></h5>
11740 <p><b>Synopsis</b>
11741 <p><a name="7.12.6.5p1" href="#7.12.6.5p1"><small>1</small></a>
11742 <pre>
11743 #include <a href="#7.12">&lt;math.h&gt;</a>
11744 int ilogb(double x);
11745 int ilogbf(float x);
11746 int ilogbl(long double x);
11747 </pre>
11748 <p><b>Description</b>
11749 <p><a name="7.12.6.5p2" href="#7.12.6.5p2"><small>2</small></a>
11750 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
11751 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
11752 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
11753 the corresponding logb function and casting the returned value to type int. A domain
11754 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
11755 the range of the return type, the numeric result is unspecified.
11760 <!--page 237 -->
11761 <p><b>Returns</b>
11762 <p><a name="7.12.6.5p3" href="#7.12.6.5p3"><small>3</small></a>
11763 The ilogb functions return the exponent of x as a signed int value.
11764 <p><b> Forward references</b>: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
11766 <p><small><a href="#Contents">Contents</a></small>
11767 <h5><a name="7.12.6.6" href="#7.12.6.6">7.12.6.6 The ldexp functions</a></h5>
11768 <p><b>Synopsis</b>
11769 <p><a name="7.12.6.6p1" href="#7.12.6.6p1"><small>1</small></a>
11770 <pre>
11771 #include <a href="#7.12">&lt;math.h&gt;</a>
11772 double ldexp(double x, int exp);
11773 float ldexpf(float x, int exp);
11774 long double ldexpl(long double x, int exp);
11775 </pre>
11776 <p><b>Description</b>
11777 <p><a name="7.12.6.6p2" href="#7.12.6.6p2"><small>2</small></a>
11778 The ldexp functions multiply a floating-point number by an integral power of 2. A
11779 range error may occur.
11780 <p><b>Returns</b>
11781 <p><a name="7.12.6.6p3" href="#7.12.6.6p3"><small>3</small></a>
11782 The ldexp functions return x 2<sup>exp</sup> .
11784 <p><small><a href="#Contents">Contents</a></small>
11785 <h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
11786 <p><b>Synopsis</b>
11787 <p><a name="7.12.6.7p1" href="#7.12.6.7p1"><small>1</small></a>
11788 <pre>
11789 #include <a href="#7.12">&lt;math.h&gt;</a>
11790 double log(double x);
11791 float logf(float x);
11792 long double logl(long double x);
11793 </pre>
11794 <p><b>Description</b>
11795 <p><a name="7.12.6.7p2" href="#7.12.6.7p2"><small>2</small></a>
11796 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
11797 the argument is negative. A range error may occur if the argument is zero.
11798 <p><b>Returns</b>
11799 <p><a name="7.12.6.7p3" href="#7.12.6.7p3"><small>3</small></a>
11800 The log functions return loge x.
11802 <p><small><a href="#Contents">Contents</a></small>
11803 <h5><a name="7.12.6.8" href="#7.12.6.8">7.12.6.8 The log10 functions</a></h5>
11804 <p><b>Synopsis</b>
11805 <p><a name="7.12.6.8p1" href="#7.12.6.8p1"><small>1</small></a>
11806 <!--page 238 -->
11807 <pre>
11808 #include <a href="#7.12">&lt;math.h&gt;</a>
11809 double log10(double x);
11810 float log10f(float x);
11811 long double log10l(long double x);
11812 </pre>
11813 <p><b>Description</b>
11814 <p><a name="7.12.6.8p2" href="#7.12.6.8p2"><small>2</small></a>
11815 The log10 functions compute the base-10 (common) logarithm of x. A domain error
11816 occurs if the argument is negative. A range error may occur if the argument is zero.
11817 <p><b>Returns</b>
11818 <p><a name="7.12.6.8p3" href="#7.12.6.8p3"><small>3</small></a>
11819 The log10 functions return log10 x.
11821 <p><small><a href="#Contents">Contents</a></small>
11822 <h5><a name="7.12.6.9" href="#7.12.6.9">7.12.6.9 The log1p functions</a></h5>
11823 <p><b>Synopsis</b>
11824 <p><a name="7.12.6.9p1" href="#7.12.6.9p1"><small>1</small></a>
11825 <pre>
11826 #include <a href="#7.12">&lt;math.h&gt;</a>
11827 double log1p(double x);
11828 float log1pf(float x);
11829 long double log1pl(long double x);
11830 </pre>
11831 <p><b>Description</b>
11832 <p><a name="7.12.6.9p2" href="#7.12.6.9p2"><small>2</small></a>
11833 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note209"><b>209)</b></a></sup>
11834 A domain error occurs if the argument is less than -1. A range error may occur if the
11835 argument equals -1.
11836 <p><b>Returns</b>
11837 <p><a name="7.12.6.9p3" href="#7.12.6.9p3"><small>3</small></a>
11838 The log1p functions return loge (1 + x).
11840 <p><b>Footnotes</b>
11841 <p><small><a name="note209" href="#note209">209)</a> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
11842 </small>
11844 <p><small><a href="#Contents">Contents</a></small>
11845 <h5><a name="7.12.6.10" href="#7.12.6.10">7.12.6.10 The log2 functions</a></h5>
11846 <p><b>Synopsis</b>
11847 <p><a name="7.12.6.10p1" href="#7.12.6.10p1"><small>1</small></a>
11848 <pre>
11849 #include <a href="#7.12">&lt;math.h&gt;</a>
11850 double log2(double x);
11851 float log2f(float x);
11852 long double log2l(long double x);
11853 </pre>
11854 <p><b>Description</b>
11855 <p><a name="7.12.6.10p2" href="#7.12.6.10p2"><small>2</small></a>
11856 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
11857 argument is less than zero. A range error may occur if the argument is zero.
11858 <p><b>Returns</b>
11859 <p><a name="7.12.6.10p3" href="#7.12.6.10p3"><small>3</small></a>
11860 The log2 functions return log2 x.
11865 <!--page 239 -->
11867 <p><small><a href="#Contents">Contents</a></small>
11868 <h5><a name="7.12.6.11" href="#7.12.6.11">7.12.6.11 The logb functions</a></h5>
11869 <p><b>Synopsis</b>
11870 <p><a name="7.12.6.11p1" href="#7.12.6.11p1"><small>1</small></a>
11871 <pre>
11872 #include <a href="#7.12">&lt;math.h&gt;</a>
11873 double logb(double x);
11874 float logbf(float x);
11875 long double logbl(long double x);
11876 </pre>
11877 <p><b>Description</b>
11878 <p><a name="7.12.6.11p2" href="#7.12.6.11p2"><small>2</small></a>
11879 The logb functions extract the exponent of x, as a signed integer value in floating-point
11880 format. If x is subnormal it is treated as though it were normalized; thus, for positive
11881 finite x,
11882 <pre>
11883 1 &lt;= x FLT_RADIX<sup>-logb(x)</sup> &lt; FLT_RADIX
11884 </pre>
11885 A domain error or range error may occur if the argument is zero.
11886 <p><b>Returns</b>
11887 <p><a name="7.12.6.11p3" href="#7.12.6.11p3"><small>3</small></a>
11888 The logb functions return the signed exponent of x.
11890 <p><small><a href="#Contents">Contents</a></small>
11891 <h5><a name="7.12.6.12" href="#7.12.6.12">7.12.6.12 The modf functions</a></h5>
11892 <p><b>Synopsis</b>
11893 <p><a name="7.12.6.12p1" href="#7.12.6.12p1"><small>1</small></a>
11894 <pre>
11895 #include <a href="#7.12">&lt;math.h&gt;</a>
11896 double modf(double value, double *iptr);
11897 float modff(float value, float *iptr);
11898 long double modfl(long double value, long double *iptr);
11899 </pre>
11900 <p><b>Description</b>
11901 <p><a name="7.12.6.12p2" href="#7.12.6.12p2"><small>2</small></a>
11902 The modf functions break the argument value into integral and fractional parts, each of
11903 which has the same type and sign as the argument. They store the integral part (in
11904 floating-point format) in the object pointed to by iptr.
11905 <p><b>Returns</b>
11906 <p><a name="7.12.6.12p3" href="#7.12.6.12p3"><small>3</small></a>
11907 The modf functions return the signed fractional part of value.
11908 <!--page 240 -->
11910 <p><small><a href="#Contents">Contents</a></small>
11911 <h5><a name="7.12.6.13" href="#7.12.6.13">7.12.6.13 The scalbn and scalbln functions</a></h5>
11912 <p><b>Synopsis</b>
11913 <p><a name="7.12.6.13p1" href="#7.12.6.13p1"><small>1</small></a>
11914 <pre>
11915 #include <a href="#7.12">&lt;math.h&gt;</a>
11916 double scalbn(double x, int n);
11917 float scalbnf(float x, int n);
11918 long double scalbnl(long double x, int n);
11919 double scalbln(double x, long int n);
11920 float scalblnf(float x, long int n);
11921 long double scalblnl(long double x, long int n);
11922 </pre>
11923 <p><b>Description</b>
11924 <p><a name="7.12.6.13p2" href="#7.12.6.13p2"><small>2</small></a>
11925 The scalbn and scalbln functions compute x FLT_RADIX<sup>n</sup> efficiently, not
11926 normally by computing FLT_RADIX<sup>n</sup> explicitly. A range error may occur.
11927 <p><b>Returns</b>
11928 <p><a name="7.12.6.13p3" href="#7.12.6.13p3"><small>3</small></a>
11929 The scalbn and scalbln functions return x FLT_RADIX<sup>n</sup> .
11931 <p><small><a href="#Contents">Contents</a></small>
11932 <h4><a name="7.12.7" href="#7.12.7">7.12.7 Power and absolute-value functions</a></h4>
11934 <p><small><a href="#Contents">Contents</a></small>
11935 <h5><a name="7.12.7.1" href="#7.12.7.1">7.12.7.1 The cbrt functions</a></h5>
11936 <p><b>Synopsis</b>
11937 <p><a name="7.12.7.1p1" href="#7.12.7.1p1"><small>1</small></a>
11938 <pre>
11939 #include <a href="#7.12">&lt;math.h&gt;</a>
11940 double cbrt(double x);
11941 float cbrtf(float x);
11942 long double cbrtl(long double x);
11943 </pre>
11944 <p><b>Description</b>
11945 <p><a name="7.12.7.1p2" href="#7.12.7.1p2"><small>2</small></a>
11946 The cbrt functions compute the real cube root of x.
11947 <p><b>Returns</b>
11948 <p><a name="7.12.7.1p3" href="#7.12.7.1p3"><small>3</small></a>
11949 The cbrt functions return x<sup>1/3</sup>.
11951 <p><small><a href="#Contents">Contents</a></small>
11952 <h5><a name="7.12.7.2" href="#7.12.7.2">7.12.7.2 The fabs functions</a></h5>
11953 <p><b>Synopsis</b>
11954 <p><a name="7.12.7.2p1" href="#7.12.7.2p1"><small>1</small></a>
11955 <pre>
11956 #include <a href="#7.12">&lt;math.h&gt;</a>
11957 double fabs(double x);
11958 float fabsf(float x);
11959 long double fabsl(long double x);
11960 </pre>
11961 <p><b>Description</b>
11962 <p><a name="7.12.7.2p2" href="#7.12.7.2p2"><small>2</small></a>
11963 The fabs functions compute the absolute value of a floating-point number x.
11964 <!--page 241 -->
11965 <p><b>Returns</b>
11966 <p><a name="7.12.7.2p3" href="#7.12.7.2p3"><small>3</small></a>
11967 The fabs functions return | x |.
11969 <p><small><a href="#Contents">Contents</a></small>
11970 <h5><a name="7.12.7.3" href="#7.12.7.3">7.12.7.3 The hypot functions</a></h5>
11971 <p><b>Synopsis</b>
11972 <p><a name="7.12.7.3p1" href="#7.12.7.3p1"><small>1</small></a>
11973 <pre>
11974 #include <a href="#7.12">&lt;math.h&gt;</a>
11975 double hypot(double x, double y);
11976 float hypotf(float x, float y);
11977 long double hypotl(long double x, long double y);
11978 </pre>
11979 <p><b>Description</b>
11980 <p><a name="7.12.7.3p2" href="#7.12.7.3p2"><small>2</small></a>
11981 The hypot functions compute the square root of the sum of the squares of x and y,
11982 without undue overflow or underflow. A range error may occur.
11983 <p><a name="7.12.7.3p3" href="#7.12.7.3p3"><small>3</small></a>
11984 <p><b>Returns</b>
11985 <p><a name="7.12.7.3p4" href="#7.12.7.3p4"><small>4</small></a>
11986 The hypot functions return (sqrt)(x<sup>2</sup> + y<sup>2</sup>).
11988 <p><small><a href="#Contents">Contents</a></small>
11989 <h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
11990 <p><b>Synopsis</b>
11991 <p><a name="7.12.7.4p1" href="#7.12.7.4p1"><small>1</small></a>
11992 <pre>
11993 #include <a href="#7.12">&lt;math.h&gt;</a>
11994 double pow(double x, double y);
11995 float powf(float x, float y);
11996 long double powl(long double x, long double y);
11997 </pre>
11998 <p><b>Description</b>
11999 <p><a name="7.12.7.4p2" href="#7.12.7.4p2"><small>2</small></a>
12000 The pow functions compute x raised to the power y. A domain error occurs if x is finite
12001 and negative and y is finite and not an integer value. A range error may occur. A domain
12002 error may occur if x is zero and y is zero. A domain error or range error may occur if x
12003 is zero and y is less than zero.
12004 <p><b>Returns</b>
12005 <p><a name="7.12.7.4p3" href="#7.12.7.4p3"><small>3</small></a>
12006 The pow functions return x<sup>y</sup>.
12008 <p><small><a href="#Contents">Contents</a></small>
12009 <h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
12010 <p><b>Synopsis</b>
12011 <p><a name="7.12.7.5p1" href="#7.12.7.5p1"><small>1</small></a>
12012 <!--page 242 -->
12013 <pre>
12014 #include <a href="#7.12">&lt;math.h&gt;</a>
12015 double sqrt(double x);
12016 float sqrtf(float x);
12017 long double sqrtl(long double x);
12018 </pre>
12019 <p><b>Description</b>
12020 <p><a name="7.12.7.5p2" href="#7.12.7.5p2"><small>2</small></a>
12021 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
12022 the argument is less than zero.
12023 <p><b>Returns</b>
12024 <p><a name="7.12.7.5p3" href="#7.12.7.5p3"><small>3</small></a>
12025 The sqrt functions return (sqrt)(x).
12027 <p><small><a href="#Contents">Contents</a></small>
12028 <h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
12030 <p><small><a href="#Contents">Contents</a></small>
12031 <h5><a name="7.12.8.1" href="#7.12.8.1">7.12.8.1 The erf functions</a></h5>
12032 <p><b>Synopsis</b>
12033 <p><a name="7.12.8.1p1" href="#7.12.8.1p1"><small>1</small></a>
12034 <pre>
12035 #include <a href="#7.12">&lt;math.h&gt;</a>
12036 double erf(double x);
12037 float erff(float x);
12038 long double erfl(long double x);
12039 </pre>
12040 <p><b>Description</b>
12041 <p><a name="7.12.8.1p2" href="#7.12.8.1p2"><small>2</small></a>
12042 The erf functions compute the error function of x.
12043 <p><b>Returns</b>
12044 <p><a name="7.12.8.1p3" href="#7.12.8.1p3"><small>3</small></a>
12045 The erf functions return
12046 <pre>
12048 erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
12049 (sqrt)(pi) 0
12050 </pre>
12052 <p><small><a href="#Contents">Contents</a></small>
12053 <h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
12054 <p><b>Synopsis</b>
12055 <p><a name="7.12.8.2p1" href="#7.12.8.2p1"><small>1</small></a>
12056 <pre>
12057 #include <a href="#7.12">&lt;math.h&gt;</a>
12058 double erfc(double x);
12059 float erfcf(float x);
12060 long double erfcl(long double x);
12061 </pre>
12062 <p><b>Description</b>
12063 <p><a name="7.12.8.2p2" href="#7.12.8.2p2"><small>2</small></a>
12064 The erfc functions compute the complementary error function of x. A range error
12065 occurs if x is too large.
12066 <p><b>Returns</b>
12067 <p><a name="7.12.8.2p3" href="#7.12.8.2p3"><small>3</small></a>
12068 The erfc functions return
12069 <pre>
12070 2 (inf)
12071 erfc x = 1 - erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
12072 (sqrt)(pi) x
12073 </pre>
12075 <!--page 243 -->
12076 <p><small><a href="#Contents">Contents</a></small>
12077 <h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
12078 <p><b>Synopsis</b>
12079 <p><a name="7.12.8.3p1" href="#7.12.8.3p1"><small>1</small></a>
12080 <pre>
12081 #include <a href="#7.12">&lt;math.h&gt;</a>
12082 double lgamma(double x);
12083 float lgammaf(float x);
12084 long double lgammal(long double x);
12085 </pre>
12086 <p><b>Description</b>
12087 <p><a name="7.12.8.3p2" href="#7.12.8.3p2"><small>2</small></a>
12088 The lgamma functions compute the natural logarithm of the absolute value of gamma of
12089 x. A range error occurs if x is too large. A range error may occur if x is a negative
12090 integer or zero.
12091 <p><b>Returns</b>
12092 <p><a name="7.12.8.3p3" href="#7.12.8.3p3"><small>3</small></a>
12093 The lgamma functions return loge | (Gamma)(x) |.
12095 <p><small><a href="#Contents">Contents</a></small>
12096 <h5><a name="7.12.8.4" href="#7.12.8.4">7.12.8.4 The tgamma functions</a></h5>
12097 <p><b>Synopsis</b>
12098 <p><a name="7.12.8.4p1" href="#7.12.8.4p1"><small>1</small></a>
12099 <pre>
12100 #include <a href="#7.12">&lt;math.h&gt;</a>
12101 double tgamma(double x);
12102 float tgammaf(float x);
12103 long double tgammal(long double x);
12104 </pre>
12105 <p><b>Description</b>
12106 <p><a name="7.12.8.4p2" href="#7.12.8.4p2"><small>2</small></a>
12107 The tgamma functions compute the gamma function of x. A domain error or range error
12108 may occur if x is a negative integer or zero. A range error may occur if the magnitude of
12109 x is too large or too small.
12110 <p><b>Returns</b>
12111 <p><a name="7.12.8.4p3" href="#7.12.8.4p3"><small>3</small></a>
12112 The tgamma functions return (Gamma)(x).
12114 <p><small><a href="#Contents">Contents</a></small>
12115 <h4><a name="7.12.9" href="#7.12.9">7.12.9 Nearest integer functions</a></h4>
12117 <p><small><a href="#Contents">Contents</a></small>
12118 <h5><a name="7.12.9.1" href="#7.12.9.1">7.12.9.1 The ceil functions</a></h5>
12119 <p><b>Synopsis</b>
12120 <p><a name="7.12.9.1p1" href="#7.12.9.1p1"><small>1</small></a>
12121 <pre>
12122 #include <a href="#7.12">&lt;math.h&gt;</a>
12123 double ceil(double x);
12124 float ceilf(float x);
12125 long double ceill(long double x);
12126 </pre>
12127 <p><b>Description</b>
12128 <p><a name="7.12.9.1p2" href="#7.12.9.1p2"><small>2</small></a>
12129 The ceil functions compute the smallest integer value not less than x.
12130 <!--page 244 -->
12131 <p><b>Returns</b>
12132 <p><a name="7.12.9.1p3" href="#7.12.9.1p3"><small>3</small></a>
12133 The ceil functions return [^x^], expressed as a floating-point number.
12135 <p><small><a href="#Contents">Contents</a></small>
12136 <h5><a name="7.12.9.2" href="#7.12.9.2">7.12.9.2 The floor functions</a></h5>
12137 <p><b>Synopsis</b>
12138 <p><a name="7.12.9.2p1" href="#7.12.9.2p1"><small>1</small></a>
12139 <pre>
12140 #include <a href="#7.12">&lt;math.h&gt;</a>
12141 double floor(double x);
12142 float floorf(float x);
12143 long double floorl(long double x);
12144 </pre>
12145 <p><b>Description</b>
12146 <p><a name="7.12.9.2p2" href="#7.12.9.2p2"><small>2</small></a>
12147 The floor functions compute the largest integer value not greater than x.
12148 <p><b>Returns</b>
12149 <p><a name="7.12.9.2p3" href="#7.12.9.2p3"><small>3</small></a>
12150 The floor functions return [_x_], expressed as a floating-point number.
12152 <p><small><a href="#Contents">Contents</a></small>
12153 <h5><a name="7.12.9.3" href="#7.12.9.3">7.12.9.3 The nearbyint functions</a></h5>
12154 <p><b>Synopsis</b>
12155 <p><a name="7.12.9.3p1" href="#7.12.9.3p1"><small>1</small></a>
12156 <pre>
12157 #include <a href="#7.12">&lt;math.h&gt;</a>
12158 double nearbyint(double x);
12159 float nearbyintf(float x);
12160 long double nearbyintl(long double x);
12161 </pre>
12162 <p><b>Description</b>
12163 <p><a name="7.12.9.3p2" href="#7.12.9.3p2"><small>2</small></a>
12164 The nearbyint functions round their argument to an integer value in floating-point
12165 format, using the current rounding direction and without raising the ''inexact'' floating-
12166 point exception.
12167 <p><b>Returns</b>
12168 <p><a name="7.12.9.3p3" href="#7.12.9.3p3"><small>3</small></a>
12169 The nearbyint functions return the rounded integer value.
12171 <p><small><a href="#Contents">Contents</a></small>
12172 <h5><a name="7.12.9.4" href="#7.12.9.4">7.12.9.4 The rint functions</a></h5>
12173 <p><b>Synopsis</b>
12174 <p><a name="7.12.9.4p1" href="#7.12.9.4p1"><small>1</small></a>
12175 <pre>
12176 #include <a href="#7.12">&lt;math.h&gt;</a>
12177 double rint(double x);
12178 float rintf(float x);
12179 long double rintl(long double x);
12180 </pre>
12181 <p><b>Description</b>
12182 <p><a name="7.12.9.4p2" href="#7.12.9.4p2"><small>2</small></a>
12183 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
12184 rint functions may raise the ''inexact'' floating-point exception if the result differs in
12185 value from the argument.
12186 <!--page 245 -->
12187 <p><b>Returns</b>
12188 <p><a name="7.12.9.4p3" href="#7.12.9.4p3"><small>3</small></a>
12189 The rint functions return the rounded integer value.
12191 <p><small><a href="#Contents">Contents</a></small>
12192 <h5><a name="7.12.9.5" href="#7.12.9.5">7.12.9.5 The lrint and llrint functions</a></h5>
12193 <p><b>Synopsis</b>
12194 <p><a name="7.12.9.5p1" href="#7.12.9.5p1"><small>1</small></a>
12195 <pre>
12196 #include <a href="#7.12">&lt;math.h&gt;</a>
12197 long int lrint(double x);
12198 long int lrintf(float x);
12199 long int lrintl(long double x);
12200 long long int llrint(double x);
12201 long long int llrintf(float x);
12202 long long int llrintl(long double x);
12203 </pre>
12204 <p><b>Description</b>
12205 <p><a name="7.12.9.5p2" href="#7.12.9.5p2"><small>2</small></a>
12206 The lrint and llrint functions round their argument to the nearest integer value,
12207 rounding according to the current rounding direction. If the rounded value is outside the
12208 range of the return type, the numeric result is unspecified and a domain error or range
12209 error may occur. *
12210 <p><b>Returns</b>
12211 <p><a name="7.12.9.5p3" href="#7.12.9.5p3"><small>3</small></a>
12212 The lrint and llrint functions return the rounded integer value.
12214 <p><small><a href="#Contents">Contents</a></small>
12215 <h5><a name="7.12.9.6" href="#7.12.9.6">7.12.9.6 The round functions</a></h5>
12216 <p><b>Synopsis</b>
12217 <p><a name="7.12.9.6p1" href="#7.12.9.6p1"><small>1</small></a>
12218 <pre>
12219 #include <a href="#7.12">&lt;math.h&gt;</a>
12220 double round(double x);
12221 float roundf(float x);
12222 long double roundl(long double x);
12223 </pre>
12224 <p><b>Description</b>
12225 <p><a name="7.12.9.6p2" href="#7.12.9.6p2"><small>2</small></a>
12226 The round functions round their argument to the nearest integer value in floating-point
12227 format, rounding halfway cases away from zero, regardless of the current rounding
12228 direction.
12229 <p><b>Returns</b>
12230 <p><a name="7.12.9.6p3" href="#7.12.9.6p3"><small>3</small></a>
12231 The round functions return the rounded integer value.
12232 <!--page 246 -->
12234 <p><small><a href="#Contents">Contents</a></small>
12235 <h5><a name="7.12.9.7" href="#7.12.9.7">7.12.9.7 The lround and llround functions</a></h5>
12236 <p><b>Synopsis</b>
12237 <p><a name="7.12.9.7p1" href="#7.12.9.7p1"><small>1</small></a>
12238 <pre>
12239 #include <a href="#7.12">&lt;math.h&gt;</a>
12240 long int lround(double x);
12241 long int lroundf(float x);
12242 long int lroundl(long double x);
12243 long long int llround(double x);
12244 long long int llroundf(float x);
12245 long long int llroundl(long double x);
12246 </pre>
12247 <p><b>Description</b>
12248 <p><a name="7.12.9.7p2" href="#7.12.9.7p2"><small>2</small></a>
12249 The lround and llround functions round their argument to the nearest integer value,
12250 rounding halfway cases away from zero, regardless of the current rounding direction. If
12251 the rounded value is outside the range of the return type, the numeric result is unspecified
12252 and a domain error or range error may occur.
12253 <p><b>Returns</b>
12254 <p><a name="7.12.9.7p3" href="#7.12.9.7p3"><small>3</small></a>
12255 The lround and llround functions return the rounded integer value.
12257 <p><small><a href="#Contents">Contents</a></small>
12258 <h5><a name="7.12.9.8" href="#7.12.9.8">7.12.9.8 The trunc functions</a></h5>
12259 <p><b>Synopsis</b>
12260 <p><a name="7.12.9.8p1" href="#7.12.9.8p1"><small>1</small></a>
12261 <pre>
12262 #include <a href="#7.12">&lt;math.h&gt;</a>
12263 double trunc(double x);
12264 float truncf(float x);
12265 long double truncl(long double x);
12266 </pre>
12267 <p><b>Description</b>
12268 <p><a name="7.12.9.8p2" href="#7.12.9.8p2"><small>2</small></a>
12269 The trunc functions round their argument to the integer value, in floating format,
12270 nearest to but no larger in magnitude than the argument.
12271 <p><b>Returns</b>
12272 <p><a name="7.12.9.8p3" href="#7.12.9.8p3"><small>3</small></a>
12273 The trunc functions return the truncated integer value.
12274 <!--page 247 -->
12276 <p><small><a href="#Contents">Contents</a></small>
12277 <h4><a name="7.12.10" href="#7.12.10">7.12.10 Remainder functions</a></h4>
12279 <p><small><a href="#Contents">Contents</a></small>
12280 <h5><a name="7.12.10.1" href="#7.12.10.1">7.12.10.1 The fmod functions</a></h5>
12281 <p><b>Synopsis</b>
12282 <p><a name="7.12.10.1p1" href="#7.12.10.1p1"><small>1</small></a>
12283 <pre>
12284 #include <a href="#7.12">&lt;math.h&gt;</a>
12285 double fmod(double x, double y);
12286 float fmodf(float x, float y);
12287 long double fmodl(long double x, long double y);
12288 </pre>
12289 <p><b>Description</b>
12290 <p><a name="7.12.10.1p2" href="#7.12.10.1p2"><small>2</small></a>
12291 The fmod functions compute the floating-point remainder of x/y.
12292 <p><b>Returns</b>
12293 <p><a name="7.12.10.1p3" href="#7.12.10.1p3"><small>3</small></a>
12294 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
12295 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
12296 whether a domain error occurs or the fmod functions return zero is implementation-
12297 defined.
12299 <p><small><a href="#Contents">Contents</a></small>
12300 <h5><a name="7.12.10.2" href="#7.12.10.2">7.12.10.2 The remainder functions</a></h5>
12301 <p><b>Synopsis</b>
12302 <p><a name="7.12.10.2p1" href="#7.12.10.2p1"><small>1</small></a>
12303 <pre>
12304 #include <a href="#7.12">&lt;math.h&gt;</a>
12305 double remainder(double x, double y);
12306 float remainderf(float x, float y);
12307 long double remainderl(long double x, long double y);
12308 </pre>
12309 <p><b>Description</b>
12310 <p><a name="7.12.10.2p2" href="#7.12.10.2p2"><small>2</small></a>
12311 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note210"><b>210)</b></a></sup>
12312 <p><b>Returns</b>
12313 <p><a name="7.12.10.2p3" href="#7.12.10.2p3"><small>3</small></a>
12314 The remainder functions return x REM y. If y is zero, whether a domain error occurs
12315 or the functions return zero is implementation defined.
12320 <!--page 248 -->
12322 <p><b>Footnotes</b>
12323 <p><small><a name="note210" href="#note210">210)</a> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
12324 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
12325 | n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
12326 x.'' This definition is applicable for all implementations.
12327 </small>
12329 <p><small><a href="#Contents">Contents</a></small>
12330 <h5><a name="7.12.10.3" href="#7.12.10.3">7.12.10.3 The remquo functions</a></h5>
12331 <p><b>Synopsis</b>
12332 <p><a name="7.12.10.3p1" href="#7.12.10.3p1"><small>1</small></a>
12333 <pre>
12334 #include <a href="#7.12">&lt;math.h&gt;</a>
12335 double remquo(double x, double y, int *quo);
12336 float remquof(float x, float y, int *quo);
12337 long double remquol(long double x, long double y,
12338 int *quo);
12339 </pre>
12340 <p><b>Description</b>
12341 <p><a name="7.12.10.3p2" href="#7.12.10.3p2"><small>2</small></a>
12342 The remquo functions compute the same remainder as the remainder functions. In
12343 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
12344 magnitude is congruent modulo 2<sup>n</sup> to the magnitude of the integral quotient of x/y, where
12345 n is an implementation-defined integer greater than or equal to 3.
12346 <p><b>Returns</b>
12347 <p><a name="7.12.10.3p3" href="#7.12.10.3p3"><small>3</small></a>
12348 The remquo functions return x REM y. If y is zero, the value stored in the object
12349 pointed to by quo is unspecified and whether a domain error occurs or the functions
12350 return zero is implementation defined.
12352 <p><small><a href="#Contents">Contents</a></small>
12353 <h4><a name="7.12.11" href="#7.12.11">7.12.11 Manipulation functions</a></h4>
12355 <p><small><a href="#Contents">Contents</a></small>
12356 <h5><a name="7.12.11.1" href="#7.12.11.1">7.12.11.1 The copysign functions</a></h5>
12357 <p><b>Synopsis</b>
12358 <p><a name="7.12.11.1p1" href="#7.12.11.1p1"><small>1</small></a>
12359 <pre>
12360 #include <a href="#7.12">&lt;math.h&gt;</a>
12361 double copysign(double x, double y);
12362 float copysignf(float x, float y);
12363 long double copysignl(long double x, long double y);
12364 </pre>
12365 <p><b>Description</b>
12366 <p><a name="7.12.11.1p2" href="#7.12.11.1p2"><small>2</small></a>
12367 The copysign functions produce a value with the magnitude of x and the sign of y.
12368 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
12369 represent a signed zero but do not treat negative zero consistently in arithmetic
12370 operations, the copysign functions regard the sign of zero as positive.
12371 <p><b>Returns</b>
12372 <p><a name="7.12.11.1p3" href="#7.12.11.1p3"><small>3</small></a>
12373 The copysign functions return a value with the magnitude of x and the sign of y.
12374 <!--page 249 -->
12376 <p><small><a href="#Contents">Contents</a></small>
12377 <h5><a name="7.12.11.2" href="#7.12.11.2">7.12.11.2 The nan functions</a></h5>
12378 <p><b>Synopsis</b>
12379 <p><a name="7.12.11.2p1" href="#7.12.11.2p1"><small>1</small></a>
12380 <pre>
12381 #include <a href="#7.12">&lt;math.h&gt;</a>
12382 double nan(const char *tagp);
12383 float nanf(const char *tagp);
12384 long double nanl(const char *tagp);
12385 </pre>
12386 <p><b>Description</b>
12387 <p><a name="7.12.11.2p2" href="#7.12.11.2p2"><small>2</small></a>
12388 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
12389 sequence)", (char**) NULL); the call nan("") is equivalent to
12390 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
12391 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
12392 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
12393 and strtold.
12394 <p><b>Returns</b>
12395 <p><a name="7.12.11.2p3" href="#7.12.11.2p3"><small>3</small></a>
12396 The nan functions return a quiet NaN, if available, with content indicated through tagp.
12397 If the implementation does not support quiet NaNs, the functions return zero.
12398 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
12400 <p><small><a href="#Contents">Contents</a></small>
12401 <h5><a name="7.12.11.3" href="#7.12.11.3">7.12.11.3 The nextafter functions</a></h5>
12402 <p><b>Synopsis</b>
12403 <p><a name="7.12.11.3p1" href="#7.12.11.3p1"><small>1</small></a>
12404 <pre>
12405 #include <a href="#7.12">&lt;math.h&gt;</a>
12406 double nextafter(double x, double y);
12407 float nextafterf(float x, float y);
12408 long double nextafterl(long double x, long double y);
12409 </pre>
12410 <p><b>Description</b>
12411 <p><a name="7.12.11.3p2" href="#7.12.11.3p2"><small>2</small></a>
12412 The nextafter functions determine the next representable value, in the type of the
12413 function, after x in the direction of y, where x and y are first converted to the type of the
12414 function.<sup><a href="#note211"><b>211)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
12415 if the magnitude of x is the largest finite value representable in the type and the result is
12416 infinite or not representable in the type.
12417 <p><b>Returns</b>
12418 <p><a name="7.12.11.3p3" href="#7.12.11.3p3"><small>3</small></a>
12419 The nextafter functions return the next representable value in the specified format
12420 after x in the direction of y.
12423 <!--page 250 -->
12425 <p><b>Footnotes</b>
12426 <p><small><a name="note211" href="#note211">211)</a> The argument values are converted to the type of the function, even by a macro implementation of the
12427 function.
12428 </small>
12430 <p><small><a href="#Contents">Contents</a></small>
12431 <h5><a name="7.12.11.4" href="#7.12.11.4">7.12.11.4 The nexttoward functions</a></h5>
12432 <p><b>Synopsis</b>
12433 <p><a name="7.12.11.4p1" href="#7.12.11.4p1"><small>1</small></a>
12434 <pre>
12435 #include <a href="#7.12">&lt;math.h&gt;</a>
12436 double nexttoward(double x, long double y);
12437 float nexttowardf(float x, long double y);
12438 long double nexttowardl(long double x, long double y);
12439 </pre>
12440 <p><b>Description</b>
12441 <p><a name="7.12.11.4p2" href="#7.12.11.4p2"><small>2</small></a>
12442 The nexttoward functions are equivalent to the nextafter functions except that the
12443 second parameter has type long double and the functions return y converted to the
12444 type of the function if x equals y.<sup><a href="#note212"><b>212)</b></a></sup>
12446 <p><b>Footnotes</b>
12447 <p><small><a name="note212" href="#note212">212)</a> The result of the nexttoward functions is determined in the type of the function, without loss of
12448 range or precision in a floating second argument.
12449 </small>
12451 <p><small><a href="#Contents">Contents</a></small>
12452 <h4><a name="7.12.12" href="#7.12.12">7.12.12 Maximum, minimum, and positive difference functions</a></h4>
12454 <p><small><a href="#Contents">Contents</a></small>
12455 <h5><a name="7.12.12.1" href="#7.12.12.1">7.12.12.1 The fdim functions</a></h5>
12456 <p><b>Synopsis</b>
12457 <p><a name="7.12.12.1p1" href="#7.12.12.1p1"><small>1</small></a>
12458 <pre>
12459 #include <a href="#7.12">&lt;math.h&gt;</a>
12460 double fdim(double x, double y);
12461 float fdimf(float x, float y);
12462 long double fdiml(long double x, long double y);
12463 </pre>
12464 <p><b>Description</b>
12465 <p><a name="7.12.12.1p2" href="#7.12.12.1p2"><small>2</small></a>
12466 The fdim functions determine the positive difference between their arguments:
12467 <pre>
12468 {x - y if x &gt; y
12470 {+0 if x &lt;= y
12471 </pre>
12472 A range error may occur.
12473 <p><b>Returns</b>
12474 <p><a name="7.12.12.1p3" href="#7.12.12.1p3"><small>3</small></a>
12475 The fdim functions return the positive difference value.
12477 <p><small><a href="#Contents">Contents</a></small>
12478 <h5><a name="7.12.12.2" href="#7.12.12.2">7.12.12.2 The fmax functions</a></h5>
12479 <p><b>Synopsis</b>
12480 <p><a name="7.12.12.2p1" href="#7.12.12.2p1"><small>1</small></a>
12481 <pre>
12482 #include <a href="#7.12">&lt;math.h&gt;</a>
12483 double fmax(double x, double y);
12484 float fmaxf(float x, float y);
12485 long double fmaxl(long double x, long double y);
12486 </pre>
12490 <!--page 251 -->
12491 <p><b>Description</b>
12492 <p><a name="7.12.12.2p2" href="#7.12.12.2p2"><small>2</small></a>
12493 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note213"><b>213)</b></a></sup>
12494 <p><b>Returns</b>
12495 <p><a name="7.12.12.2p3" href="#7.12.12.2p3"><small>3</small></a>
12496 The fmax functions return the maximum numeric value of their arguments.
12498 <p><b>Footnotes</b>
12499 <p><small><a name="note213" href="#note213">213)</a> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
12500 fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
12501 </small>
12503 <p><small><a href="#Contents">Contents</a></small>
12504 <h5><a name="7.12.12.3" href="#7.12.12.3">7.12.12.3 The fmin functions</a></h5>
12505 <p><b>Synopsis</b>
12506 <p><a name="7.12.12.3p1" href="#7.12.12.3p1"><small>1</small></a>
12507 <pre>
12508 #include <a href="#7.12">&lt;math.h&gt;</a>
12509 double fmin(double x, double y);
12510 float fminf(float x, float y);
12511 long double fminl(long double x, long double y);
12512 </pre>
12513 <p><b>Description</b>
12514 <p><a name="7.12.12.3p2" href="#7.12.12.3p2"><small>2</small></a>
12515 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note214"><b>214)</b></a></sup>
12516 <p><b>Returns</b>
12517 <p><a name="7.12.12.3p3" href="#7.12.12.3p3"><small>3</small></a>
12518 The fmin functions return the minimum numeric value of their arguments.
12520 <p><b>Footnotes</b>
12521 <p><small><a name="note214" href="#note214">214)</a> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
12522 </small>
12524 <p><small><a href="#Contents">Contents</a></small>
12525 <h4><a name="7.12.13" href="#7.12.13">7.12.13 Floating multiply-add</a></h4>
12527 <p><small><a href="#Contents">Contents</a></small>
12528 <h5><a name="7.12.13.1" href="#7.12.13.1">7.12.13.1 The fma functions</a></h5>
12529 <p><b>Synopsis</b>
12530 <p><a name="7.12.13.1p1" href="#7.12.13.1p1"><small>1</small></a>
12531 <pre>
12532 #include <a href="#7.12">&lt;math.h&gt;</a>
12533 double fma(double x, double y, double z);
12534 float fmaf(float x, float y, float z);
12535 long double fmal(long double x, long double y,
12536 long double z);
12537 </pre>
12538 <p><b>Description</b>
12539 <p><a name="7.12.13.1p2" href="#7.12.13.1p2"><small>2</small></a>
12540 The fma functions compute (x y) + z, rounded as one ternary operation: they compute
12541 the value (as if) to infinite precision and round once to the result format, according to the
12542 current rounding mode. A range error may occur.
12543 <p><b>Returns</b>
12544 <p><a name="7.12.13.1p3" href="#7.12.13.1p3"><small>3</small></a>
12545 The fma functions return (x y) + z, rounded as one ternary operation.
12550 <!--page 252 -->
12552 <p><small><a href="#Contents">Contents</a></small>
12553 <h4><a name="7.12.14" href="#7.12.14">7.12.14 Comparison macros</a></h4>
12554 <p><a name="7.12.14p1" href="#7.12.14p1"><small>1</small></a>
12555 The relational and equality operators support the usual mathematical relationships
12556 between numeric values. For any ordered pair of numeric values exactly one of the
12557 relationships -- less, greater, and equal -- is true. Relational operators may raise the
12558 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
12559 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note215"><b>215)</b></a></sup> The following
12560 subclauses provide macros that are quiet (non floating-point exception raising) versions
12561 of the relational operators, and other comparison macros that facilitate writing efficient
12562 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
12563 the synopses in this subclause, real-floating indicates that the argument shall be an
12564 expression of real floating type.
12566 <p><b>Footnotes</b>
12567 <p><small><a name="note215" href="#note215">215)</a> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
12568 the operands compare unordered, as an error indicator for programs written without consideration of
12569 NaNs; the result in these cases is false.
12570 </small>
12572 <p><small><a href="#Contents">Contents</a></small>
12573 <h5><a name="7.12.14.1" href="#7.12.14.1">7.12.14.1 The isgreater macro</a></h5>
12574 <p><b>Synopsis</b>
12575 <p><a name="7.12.14.1p1" href="#7.12.14.1p1"><small>1</small></a>
12576 <pre>
12577 #include <a href="#7.12">&lt;math.h&gt;</a>
12578 int isgreater(real-floating x, real-floating y);
12579 </pre>
12580 <p><b>Description</b>
12581 <p><a name="7.12.14.1p2" href="#7.12.14.1p2"><small>2</small></a>
12582 The isgreater macro determines whether its first argument is greater than its second
12583 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
12584 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
12585 exception when x and y are unordered.
12586 <p><b>Returns</b>
12587 <p><a name="7.12.14.1p3" href="#7.12.14.1p3"><small>3</small></a>
12588 The isgreater macro returns the value of (x) &gt; (y).
12590 <p><small><a href="#Contents">Contents</a></small>
12591 <h5><a name="7.12.14.2" href="#7.12.14.2">7.12.14.2 The isgreaterequal macro</a></h5>
12592 <p><b>Synopsis</b>
12593 <p><a name="7.12.14.2p1" href="#7.12.14.2p1"><small>1</small></a>
12594 <pre>
12595 #include <a href="#7.12">&lt;math.h&gt;</a>
12596 int isgreaterequal(real-floating x, real-floating y);
12597 </pre>
12598 <p><b>Description</b>
12599 <p><a name="7.12.14.2p2" href="#7.12.14.2p2"><small>2</small></a>
12600 The isgreaterequal macro determines whether its first argument is greater than or
12601 equal to its second argument. The value of isgreaterequal(x, y) is always equal
12602 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
12603 not raise the ''invalid'' floating-point exception when x and y are unordered.
12607 <!--page 253 -->
12608 <p><b>Returns</b>
12609 <p><a name="7.12.14.2p3" href="#7.12.14.2p3"><small>3</small></a>
12610 The isgreaterequal macro returns the value of (x) &gt;= (y).
12612 <p><small><a href="#Contents">Contents</a></small>
12613 <h5><a name="7.12.14.3" href="#7.12.14.3">7.12.14.3 The isless macro</a></h5>
12614 <p><b>Synopsis</b>
12615 <p><a name="7.12.14.3p1" href="#7.12.14.3p1"><small>1</small></a>
12616 <pre>
12617 #include <a href="#7.12">&lt;math.h&gt;</a>
12618 int isless(real-floating x, real-floating y);
12619 </pre>
12620 <p><b>Description</b>
12621 <p><a name="7.12.14.3p2" href="#7.12.14.3p2"><small>2</small></a>
12622 The isless macro determines whether its first argument is less than its second
12623 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
12624 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
12625 exception when x and y are unordered.
12626 <p><b>Returns</b>
12627 <p><a name="7.12.14.3p3" href="#7.12.14.3p3"><small>3</small></a>
12628 The isless macro returns the value of (x) &lt; (y).
12630 <p><small><a href="#Contents">Contents</a></small>
12631 <h5><a name="7.12.14.4" href="#7.12.14.4">7.12.14.4 The islessequal macro</a></h5>
12632 <p><b>Synopsis</b>
12633 <p><a name="7.12.14.4p1" href="#7.12.14.4p1"><small>1</small></a>
12634 <pre>
12635 #include <a href="#7.12">&lt;math.h&gt;</a>
12636 int islessequal(real-floating x, real-floating y);
12637 </pre>
12638 <p><b>Description</b>
12639 <p><a name="7.12.14.4p2" href="#7.12.14.4p2"><small>2</small></a>
12640 The islessequal macro determines whether its first argument is less than or equal to
12641 its second argument. The value of islessequal(x, y) is always equal to
12642 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
12643 the ''invalid'' floating-point exception when x and y are unordered.
12644 <p><b>Returns</b>
12645 <p><a name="7.12.14.4p3" href="#7.12.14.4p3"><small>3</small></a>
12646 The islessequal macro returns the value of (x) &lt;= (y).
12648 <p><small><a href="#Contents">Contents</a></small>
12649 <h5><a name="7.12.14.5" href="#7.12.14.5">7.12.14.5 The islessgreater macro</a></h5>
12650 <p><b>Synopsis</b>
12651 <p><a name="7.12.14.5p1" href="#7.12.14.5p1"><small>1</small></a>
12652 <pre>
12653 #include <a href="#7.12">&lt;math.h&gt;</a>
12654 int islessgreater(real-floating x, real-floating y);
12655 </pre>
12656 <p><b>Description</b>
12657 <p><a name="7.12.14.5p2" href="#7.12.14.5p2"><small>2</small></a>
12658 The islessgreater macro determines whether its first argument is less than or
12659 greater than its second argument. The islessgreater(x, y) macro is similar to
12660 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
12661 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
12662 and y twice).
12663 <!--page 254 -->
12664 <p><b>Returns</b>
12665 <p><a name="7.12.14.5p3" href="#7.12.14.5p3"><small>3</small></a>
12666 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
12668 <p><small><a href="#Contents">Contents</a></small>
12669 <h5><a name="7.12.14.6" href="#7.12.14.6">7.12.14.6 The isunordered macro</a></h5>
12670 <p><b>Synopsis</b>
12671 <p><a name="7.12.14.6p1" href="#7.12.14.6p1"><small>1</small></a>
12672 <pre>
12673 #include <a href="#7.12">&lt;math.h&gt;</a>
12674 int isunordered(real-floating x, real-floating y);
12675 </pre>
12676 <p><b>Description</b>
12677 <p><a name="7.12.14.6p2" href="#7.12.14.6p2"><small>2</small></a>
12678 The isunordered macro determines whether its arguments are unordered.
12679 <p><b>Returns</b>
12680 <p><a name="7.12.14.6p3" href="#7.12.14.6p3"><small>3</small></a>
12681 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
12682 <!--page 255 -->
12684 <p><small><a href="#Contents">Contents</a></small>
12685 <h3><a name="7.13" href="#7.13">7.13 Nonlocal jumps &lt;setjmp.h&gt;</a></h3>
12686 <p><a name="7.13p1" href="#7.13p1"><small>1</small></a>
12687 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
12688 one type, for bypassing the normal function call and return discipline.<sup><a href="#note216"><b>216)</b></a></sup>
12689 <p><a name="7.13p2" href="#7.13p2"><small>2</small></a>
12690 The type declared is
12691 <pre>
12692 jmp_buf
12693 </pre>
12694 which is an array type suitable for holding the information needed to restore a calling
12695 environment. The environment of a call to the setjmp macro consists of information
12696 sufficient for a call to the longjmp function to return execution to the correct block and
12697 invocation of that block, were it called recursively. It does not include the state of the
12698 floating-point status flags, of open files, or of any other component of the abstract
12699 machine.
12700 <p><a name="7.13p3" href="#7.13p3"><small>3</small></a>
12701 It is unspecified whether setjmp is a macro or an identifier declared with external
12702 linkage. If a macro definition is suppressed in order to access an actual function, or a
12703 program defines an external identifier with the name setjmp, the behavior is undefined.
12705 <p><b>Footnotes</b>
12706 <p><small><a name="note216" href="#note216">216)</a> These functions are useful for dealing with unusual conditions encountered in a low-level function of
12707 a program.
12708 </small>
12710 <p><small><a href="#Contents">Contents</a></small>
12711 <h4><a name="7.13.1" href="#7.13.1">7.13.1 Save calling environment</a></h4>
12713 <p><small><a href="#Contents">Contents</a></small>
12714 <h5><a name="7.13.1.1" href="#7.13.1.1">7.13.1.1 The setjmp macro</a></h5>
12715 <p><b>Synopsis</b>
12716 <p><a name="7.13.1.1p1" href="#7.13.1.1p1"><small>1</small></a>
12717 <pre>
12718 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12719 int setjmp(jmp_buf env);
12720 </pre>
12721 <p><b>Description</b>
12722 <p><a name="7.13.1.1p2" href="#7.13.1.1p2"><small>2</small></a>
12723 The setjmp macro saves its calling environment in its jmp_buf argument for later use
12724 by the longjmp function.
12725 <p><b>Returns</b>
12726 <p><a name="7.13.1.1p3" href="#7.13.1.1p3"><small>3</small></a>
12727 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
12728 return is from a call to the longjmp function, the setjmp macro returns a nonzero
12729 value.
12730 <p><b>Environmental limits</b>
12731 <p><a name="7.13.1.1p4" href="#7.13.1.1p4"><small>4</small></a>
12732 An invocation of the setjmp macro shall appear only in one of the following contexts:
12733 <ul>
12734 <li> the entire controlling expression of a selection or iteration statement;
12735 <li> one operand of a relational or equality operator with the other operand an integer
12736 constant expression, with the resulting expression being the entire controlling
12739 <!--page 256 -->
12740 expression of a selection or iteration statement;
12741 <li> the operand of a unary ! operator with the resulting expression being the entire
12742 controlling expression of a selection or iteration statement; or
12743 <li> the entire expression of an expression statement (possibly cast to void).
12744 </ul>
12745 <p><a name="7.13.1.1p5" href="#7.13.1.1p5"><small>5</small></a>
12746 If the invocation appears in any other context, the behavior is undefined.
12748 <p><small><a href="#Contents">Contents</a></small>
12749 <h4><a name="7.13.2" href="#7.13.2">7.13.2 Restore calling environment</a></h4>
12751 <p><small><a href="#Contents">Contents</a></small>
12752 <h5><a name="7.13.2.1" href="#7.13.2.1">7.13.2.1 The longjmp function</a></h5>
12753 <p><b>Synopsis</b>
12754 <p><a name="7.13.2.1p1" href="#7.13.2.1p1"><small>1</small></a>
12755 <pre>
12756 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12757 void longjmp(jmp_buf env, int val);
12758 </pre>
12759 <p><b>Description</b>
12760 <p><a name="7.13.2.1p2" href="#7.13.2.1p2"><small>2</small></a>
12761 The longjmp function restores the environment saved by the most recent invocation of
12762 the setjmp macro in the same invocation of the program with the corresponding
12763 jmp_buf argument. If there has been no such invocation, or if the function containing
12764 the invocation of the setjmp macro has terminated execution<sup><a href="#note217"><b>217)</b></a></sup> in the interim, or if the
12765 invocation of the setjmp macro was within the scope of an identifier with variably
12766 modified type and execution has left that scope in the interim, the behavior is undefined.
12767 <p><a name="7.13.2.1p3" href="#7.13.2.1p3"><small>3</small></a>
12768 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note218"><b>218)</b></a></sup>
12769 have state, as of the time the longjmp function was called, except that the values of
12770 objects of automatic storage duration that are local to the function containing the
12771 invocation of the corresponding setjmp macro that do not have volatile-qualified type
12772 and have been changed between the setjmp invocation and longjmp call are
12773 indeterminate.
12774 <p><b>Returns</b>
12775 <p><a name="7.13.2.1p4" href="#7.13.2.1p4"><small>4</small></a>
12776 After longjmp is completed, program execution continues as if the corresponding
12777 invocation of the setjmp macro had just returned the value specified by val. The
12778 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
12779 the setjmp macro returns the value 1.
12780 <p><a name="7.13.2.1p5" href="#7.13.2.1p5"><small>5</small></a>
12781 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
12782 might cause memory associated with a variable length array object to be squandered.
12787 <!--page 257 -->
12788 <!--page 258 -->
12789 <pre>
12790 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
12791 jmp_buf buf;
12792 void g(int n);
12793 void h(int n);
12794 int n = 6;
12795 void f(void)
12797 int x[n]; // valid: f is not terminated
12798 setjmp(buf);
12799 g(n);
12801 void g(int n)
12803 int a[n]; // a may remain allocated
12804 h(n);
12806 void h(int n)
12808 int b[n]; // b may remain allocated
12809 longjmp(buf, 2); // might cause memory loss
12811 </pre>
12813 <p><b>Footnotes</b>
12814 <p><small><a name="note217" href="#note217">217)</a> For example, by executing a return statement or because another longjmp call has caused a
12815 transfer to a setjmp invocation in a function earlier in the set of nested calls.
12816 </small>
12817 <p><small><a name="note218" href="#note218">218)</a> This includes, but is not limited to, the floating-point status flags and the state of open files.
12818 </small>
12820 <p><small><a href="#Contents">Contents</a></small>
12821 <h3><a name="7.14" href="#7.14">7.14 Signal handling &lt;signal.h&gt;</a></h3>
12822 <p><a name="7.14p1" href="#7.14p1"><small>1</small></a>
12823 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
12824 for handling various signals (conditions that may be reported during program execution).
12825 <p><a name="7.14p2" href="#7.14p2"><small>2</small></a>
12826 The type defined is
12827 <pre>
12828 sig_atomic_t
12829 </pre>
12830 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
12831 an atomic entity, even in the presence of asynchronous interrupts.
12832 <p><a name="7.14p3" href="#7.14p3"><small>3</small></a>
12833 The macros defined are
12834 <pre>
12835 SIG_DFL
12836 SIG_ERR
12837 SIG_IGN
12838 </pre>
12839 which expand to constant expressions with distinct values that have type compatible with
12840 the second argument to, and the return value of, the signal function, and whose values
12841 compare unequal to the address of any declarable function; and the following, which
12842 expand to positive integer constant expressions with type int and distinct values that are
12843 the signal numbers, each corresponding to the specified condition:
12844 <pre>
12845 SIGABRT abnormal termination, such as is initiated by the abort function
12846 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
12847 resulting in overflow
12848 SIGILL detection of an invalid function image, such as an invalid instruction
12849 SIGINT receipt of an interactive attention signal
12850 SIGSEGV an invalid access to storage
12851 SIGTERM a termination request sent to the program
12852 </pre>
12853 <p><a name="7.14p4" href="#7.14p4"><small>4</small></a>
12854 An implementation need not generate any of these signals, except as a result of explicit
12855 calls to the raise function. Additional signals and pointers to undeclarable functions,
12856 with macro definitions beginning, respectively, with the letters SIG and an uppercase
12857 letter or with SIG_ and an uppercase letter,<sup><a href="#note219"><b>219)</b></a></sup> may also be specified by the
12858 implementation. The complete set of signals, their semantics, and their default handling
12859 is implementation-defined; all signal numbers shall be positive.
12864 <!--page 259 -->
12866 <p><b>Footnotes</b>
12867 <p><small><a name="note219" href="#note219">219)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>). The names of the signal numbers reflect the following terms
12868 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
12869 and termination.
12870 </small>
12872 <p><small><a href="#Contents">Contents</a></small>
12873 <h4><a name="7.14.1" href="#7.14.1">7.14.1 Specify signal handling</a></h4>
12875 <p><small><a href="#Contents">Contents</a></small>
12876 <h5><a name="7.14.1.1" href="#7.14.1.1">7.14.1.1 The signal function</a></h5>
12877 <p><b>Synopsis</b>
12878 <p><a name="7.14.1.1p1" href="#7.14.1.1p1"><small>1</small></a>
12879 <pre>
12880 #include <a href="#7.14">&lt;signal.h&gt;</a>
12881 void (*signal(int sig, void (*func)(int)))(int);
12882 </pre>
12883 <p><b>Description</b>
12884 <p><a name="7.14.1.1p2" href="#7.14.1.1p2"><small>2</small></a>
12885 The signal function chooses one of three ways in which receipt of the signal number
12886 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
12887 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
12888 Otherwise, func shall point to a function to be called when that signal occurs. An
12889 invocation of such a function because of a signal, or (recursively) of any further functions
12890 called by that invocation (other than functions in the standard library), is called a signal
12891 handler.
12892 <p><a name="7.14.1.1p3" href="#7.14.1.1p3"><small>3</small></a>
12893 When a signal occurs and func points to a function, it is implementation-defined
12894 whether the equivalent of signal(sig, SIG_DFL); is executed or the
12895 implementation prevents some implementation-defined set of signals (at least including
12896 sig) from occurring until the current signal handling has completed; in the case of
12897 SIGILL, the implementation may alternatively define that no action is taken. Then the
12898 equivalent of (*func)(sig); is executed. If and when the function returns, if the
12899 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
12900 value corresponding to a computational exception, the behavior is undefined; otherwise
12901 the program will resume execution at the point it was interrupted.
12902 <p><a name="7.14.1.1p4" href="#7.14.1.1p4"><small>4</small></a>
12903 If the signal occurs as the result of calling the abort or raise function, the signal
12904 handler shall not call the raise function.
12905 <p><a name="7.14.1.1p5" href="#7.14.1.1p5"><small>5</small></a>
12906 If the signal occurs other than as the result of calling the abort or raise function, the
12907 behavior is undefined if the signal handler refers to any object with static storage duration
12908 other than by assigning a value to an object declared as volatile sig_atomic_t, or
12909 the signal handler calls any function in the standard library other than the abort
12910 function, the _Exit function, or the signal function with the first argument equal to
12911 the signal number corresponding to the signal that caused the invocation of the handler.
12912 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
12913 value of errno is indeterminate.<sup><a href="#note220"><b>220)</b></a></sup>
12914 <p><a name="7.14.1.1p6" href="#7.14.1.1p6"><small>6</small></a>
12915 At program startup, the equivalent of
12916 <pre>
12917 signal(sig, SIG_IGN);
12918 </pre>
12921 <!--page 260 -->
12922 may be executed for some signals selected in an implementation-defined manner; the
12923 equivalent of
12924 <pre>
12925 signal(sig, SIG_DFL);
12926 </pre>
12927 is executed for all other signals defined by the implementation.
12928 <p><a name="7.14.1.1p7" href="#7.14.1.1p7"><small>7</small></a>
12929 The implementation shall behave as if no library function calls the signal function.
12930 <p><b>Returns</b>
12931 <p><a name="7.14.1.1p8" href="#7.14.1.1p8"><small>8</small></a>
12932 If the request can be honored, the signal function returns the value of func for the
12933 most recent successful call to signal for the specified signal sig. Otherwise, a value of
12934 SIG_ERR is returned and a positive value is stored in errno.
12935 <p><b> Forward references</b>: the abort function (<a href="#7.20.4.1">7.20.4.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the
12936 _Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
12938 <p><b>Footnotes</b>
12939 <p><small><a name="note220" href="#note220">220)</a> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
12940 </small>
12942 <p><small><a href="#Contents">Contents</a></small>
12943 <h4><a name="7.14.2" href="#7.14.2">7.14.2 Send signal</a></h4>
12945 <p><small><a href="#Contents">Contents</a></small>
12946 <h5><a name="7.14.2.1" href="#7.14.2.1">7.14.2.1 The raise function</a></h5>
12947 <p><b>Synopsis</b>
12948 <p><a name="7.14.2.1p1" href="#7.14.2.1p1"><small>1</small></a>
12949 <pre>
12950 #include <a href="#7.14">&lt;signal.h&gt;</a>
12951 int raise(int sig);
12952 </pre>
12953 <p><b>Description</b>
12954 <p><a name="7.14.2.1p2" href="#7.14.2.1p2"><small>2</small></a>
12955 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
12956 signal handler is called, the raise function shall not return until after the signal handler
12957 does.
12958 <p><b>Returns</b>
12959 <p><a name="7.14.2.1p3" href="#7.14.2.1p3"><small>3</small></a>
12960 The raise function returns zero if successful, nonzero if unsuccessful.
12961 <!--page 261 -->
12963 <p><small><a href="#Contents">Contents</a></small>
12964 <h3><a name="7.15" href="#7.15">7.15 Variable arguments &lt;stdarg.h&gt;</a></h3>
12965 <p><a name="7.15p1" href="#7.15p1"><small>1</small></a>
12966 The header <a href="#7.15">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
12967 through a list of arguments whose number and types are not known to the called function
12968 when it is translated.
12969 <p><a name="7.15p2" href="#7.15p2"><small>2</small></a>
12970 A function may be called with a variable number of arguments of varying types. As
12971 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
12972 parameter plays a special role in the access mechanism, and will be designated parmN in
12973 this description.
12974 <p><a name="7.15p3" href="#7.15p3"><small>3</small></a>
12975 The type declared is
12976 <pre>
12977 va_list
12978 </pre>
12979 which is an object type suitable for holding information needed by the macros
12980 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
12981 desired, the called function shall declare an object (generally referred to as ap in this
12982 subclause) having type va_list. The object ap may be passed as an argument to
12983 another function; if that function invokes the va_arg macro with parameter ap, the
12984 value of ap in the calling function is indeterminate and shall be passed to the va_end
12985 macro prior to any further reference to ap.<sup><a href="#note221"><b>221)</b></a></sup>
12987 <p><b>Footnotes</b>
12988 <p><small><a name="note221" href="#note221">221)</a> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
12989 case the original function may make further use of the original list after the other function returns.
12990 </small>
12992 <p><small><a href="#Contents">Contents</a></small>
12993 <h4><a name="7.15.1" href="#7.15.1">7.15.1 Variable argument list access macros</a></h4>
12994 <p><a name="7.15.1p1" href="#7.15.1p1"><small>1</small></a>
12995 The va_start and va_arg macros described in this subclause shall be implemented
12996 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
12997 identifiers declared with external linkage. If a macro definition is suppressed in order to
12998 access an actual function, or a program defines an external identifier with the same name,
12999 the behavior is undefined. Each invocation of the va_start and va_copy macros
13000 shall be matched by a corresponding invocation of the va_end macro in the same
13001 function.
13003 <p><small><a href="#Contents">Contents</a></small>
13004 <h5><a name="7.15.1.1" href="#7.15.1.1">7.15.1.1 The va_arg macro</a></h5>
13005 <p><b>Synopsis</b>
13006 <p><a name="7.15.1.1p1" href="#7.15.1.1p1"><small>1</small></a>
13007 <pre>
13008 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13009 type va_arg(va_list ap, type);
13010 </pre>
13011 <p><b>Description</b>
13012 <p><a name="7.15.1.1p2" href="#7.15.1.1p2"><small>2</small></a>
13013 The va_arg macro expands to an expression that has the specified type and the value of
13014 the next argument in the call. The parameter ap shall have been initialized by the
13015 va_start or va_copy macro (without an intervening invocation of the va_end
13017 <!--page 262 -->
13018 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
13019 values of successive arguments are returned in turn. The parameter type shall be a type
13020 name specified such that the type of a pointer to an object that has the specified type can
13021 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
13022 type is not compatible with the type of the actual next argument (as promoted according
13023 to the default argument promotions), the behavior is undefined, except for the following
13024 cases:
13025 <ul>
13026 <li> one type is a signed integer type, the other type is the corresponding unsigned integer
13027 type, and the value is representable in both types;
13028 <li> one type is pointer to void and the other is a pointer to a character type.
13029 </ul>
13030 <p><b>Returns</b>
13031 <p><a name="7.15.1.1p3" href="#7.15.1.1p3"><small>3</small></a>
13032 The first invocation of the va_arg macro after that of the va_start macro returns the
13033 value of the argument after that specified by parmN . Successive invocations return the
13034 values of the remaining arguments in succession.
13036 <p><small><a href="#Contents">Contents</a></small>
13037 <h5><a name="7.15.1.2" href="#7.15.1.2">7.15.1.2 The va_copy macro</a></h5>
13038 <p><b>Synopsis</b>
13039 <p><a name="7.15.1.2p1" href="#7.15.1.2p1"><small>1</small></a>
13040 <pre>
13041 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13042 void va_copy(va_list dest, va_list src);
13043 </pre>
13044 <p><b>Description</b>
13045 <p><a name="7.15.1.2p2" href="#7.15.1.2p2"><small>2</small></a>
13046 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
13047 been applied to dest followed by the same sequence of uses of the va_arg macro as
13048 had previously been used to reach the present state of src. Neither the va_copy nor
13049 va_start macro shall be invoked to reinitialize dest without an intervening
13050 invocation of the va_end macro for the same dest.
13051 <p><b>Returns</b>
13052 <p><a name="7.15.1.2p3" href="#7.15.1.2p3"><small>3</small></a>
13053 The va_copy macro returns no value.
13055 <p><small><a href="#Contents">Contents</a></small>
13056 <h5><a name="7.15.1.3" href="#7.15.1.3">7.15.1.3 The va_end macro</a></h5>
13057 <p><b>Synopsis</b>
13058 <p><a name="7.15.1.3p1" href="#7.15.1.3p1"><small>1</small></a>
13059 <pre>
13060 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13061 void va_end(va_list ap);
13062 </pre>
13063 <p><b>Description</b>
13064 <p><a name="7.15.1.3p2" href="#7.15.1.3p2"><small>2</small></a>
13065 The va_end macro facilitates a normal return from the function whose variable
13066 argument list was referred to by the expansion of the va_start macro, or the function
13067 containing the expansion of the va_copy macro, that initialized the va_list ap. The
13068 va_end macro may modify ap so that it is no longer usable (without being reinitialized
13069 <!--page 263 -->
13070 by the va_start or va_copy macro). If there is no corresponding invocation of the
13071 va_start or va_copy macro, or if the va_end macro is not invoked before the
13072 return, the behavior is undefined.
13073 <p><b>Returns</b>
13074 <p><a name="7.15.1.3p3" href="#7.15.1.3p3"><small>3</small></a>
13075 The va_end macro returns no value.
13077 <p><small><a href="#Contents">Contents</a></small>
13078 <h5><a name="7.15.1.4" href="#7.15.1.4">7.15.1.4 The va_start macro</a></h5>
13079 <p><b>Synopsis</b>
13080 <p><a name="7.15.1.4p1" href="#7.15.1.4p1"><small>1</small></a>
13081 <pre>
13082 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13083 void va_start(va_list ap, parmN);
13084 </pre>
13085 <p><b>Description</b>
13086 <p><a name="7.15.1.4p2" href="#7.15.1.4p2"><small>2</small></a>
13087 The va_start macro shall be invoked before any access to the unnamed arguments.
13088 <p><a name="7.15.1.4p3" href="#7.15.1.4p3"><small>3</small></a>
13089 The va_start macro initializes ap for subsequent use by the va_arg and va_end
13090 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
13091 without an intervening invocation of the va_end macro for the same ap.
13092 <p><a name="7.15.1.4p4" href="#7.15.1.4p4"><small>4</small></a>
13093 The parameter parmN is the identifier of the rightmost parameter in the variable
13094 parameter list in the function definition (the one just before the , ...). If the parameter
13095 parmN is declared with the register storage class, with a function or array type, or
13096 with a type that is not compatible with the type that results after application of the default
13097 argument promotions, the behavior is undefined.
13098 <p><b>Returns</b>
13099 <p><a name="7.15.1.4p5" href="#7.15.1.4p5"><small>5</small></a>
13100 The va_start macro returns no value.
13101 <p><a name="7.15.1.4p6" href="#7.15.1.4p6"><small>6</small></a>
13102 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
13103 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
13104 pointers is specified by the first argument to f1.
13105 <!--page 264 -->
13106 <pre>
13107 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13108 #define MAXARGS 31
13109 void f1(int n_ptrs, ...)
13111 va_list ap;
13112 char *array[MAXARGS];
13113 int ptr_no = 0;
13114 if (n_ptrs &gt; MAXARGS)
13115 n_ptrs = MAXARGS;
13116 va_start(ap, n_ptrs);
13117 while (ptr_no &lt; n_ptrs)
13118 array[ptr_no++] = va_arg(ap, char *);
13119 va_end(ap);
13120 f2(n_ptrs, array);
13122 </pre>
13123 Each call to f1 is required to have visible the definition of the function or a declaration such as
13124 <pre>
13125 void f1(int, ...);
13126 </pre>
13128 <p><a name="7.15.1.4p7" href="#7.15.1.4p7"><small>7</small></a>
13129 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
13130 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
13131 is gathered again and passed to function f4.
13132 <!--page 265 -->
13133 <pre>
13134 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
13135 #define MAXARGS 31
13136 void f3(int n_ptrs, int f4_after, ...)
13138 va_list ap, ap_save;
13139 char *array[MAXARGS];
13140 int ptr_no = 0;
13141 if (n_ptrs &gt; MAXARGS)
13142 n_ptrs = MAXARGS;
13143 va_start(ap, f4_after);
13144 while (ptr_no &lt; n_ptrs) {
13145 array[ptr_no++] = va_arg(ap, char *);
13146 if (ptr_no == f4_after)
13147 va_copy(ap_save, ap);
13149 va_end(ap);
13150 f2(n_ptrs, array);
13151 // Now process the saved copy.
13152 n_ptrs -= f4_after;
13153 ptr_no = 0;
13154 while (ptr_no &lt; n_ptrs)
13155 array[ptr_no++] = va_arg(ap_save, char *);
13156 va_end(ap_save);
13157 f4(n_ptrs, array);
13159 </pre>
13161 <p><small><a href="#Contents">Contents</a></small>
13162 <h3><a name="7.16" href="#7.16">7.16 Boolean type and values &lt;stdbool.h&gt;</a></h3>
13163 <p><a name="7.16p1" href="#7.16p1"><small>1</small></a>
13164 The header <a href="#7.16">&lt;stdbool.h&gt;</a> defines four macros.
13165 <p><a name="7.16p2" href="#7.16p2"><small>2</small></a>
13166 The macro
13167 <pre>
13168 bool
13169 </pre>
13170 expands to _Bool.
13171 <p><a name="7.16p3" href="#7.16p3"><small>3</small></a>
13172 The remaining three macros are suitable for use in #if preprocessing directives. They
13174 <pre>
13175 true
13176 </pre>
13177 which expands to the integer constant 1,
13178 <pre>
13179 false
13180 </pre>
13181 which expands to the integer constant 0, and
13182 <pre>
13183 __bool_true_false_are_defined
13184 </pre>
13185 which expands to the integer constant 1.
13186 <p><a name="7.16p4" href="#7.16p4"><small>4</small></a>
13187 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
13188 redefine the macros bool, true, and false.<sup><a href="#note222"><b>222)</b></a></sup>
13193 <!--page 266 -->
13195 <p><b>Footnotes</b>
13196 <p><small><a name="note222" href="#note222">222)</a> See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
13197 </small>
13199 <p><small><a href="#Contents">Contents</a></small>
13200 <h3><a name="7.17" href="#7.17">7.17 Common definitions &lt;stddef.h&gt;</a></h3>
13201 <p><a name="7.17p1" href="#7.17p1"><small>1</small></a>
13202 The following types and macros are defined in the standard header <a href="#7.17">&lt;stddef.h&gt;</a>. Some
13203 are also defined in other headers, as noted in their respective subclauses.
13204 <p><a name="7.17p2" href="#7.17p2"><small>2</small></a>
13205 The types are
13206 <pre>
13207 ptrdiff_t
13208 </pre>
13209 which is the signed integer type of the result of subtracting two pointers;
13210 <pre>
13211 size_t
13212 </pre>
13213 which is the unsigned integer type of the result of the sizeof operator; and
13214 <pre>
13215 wchar_t
13216 </pre>
13217 which is an integer type whose range of values can represent distinct codes for all
13218 members of the largest extended character set specified among the supported locales; the
13219 null character shall have the code value zero. Each member of the basic character set
13220 shall have a code value equal to its value when used as the lone character in an integer
13221 character constant if an implementation does not define
13222 __STDC_MB_MIGHT_NEQ_WC__.
13223 <p><a name="7.17p3" href="#7.17p3"><small>3</small></a>
13224 The macros are
13225 <pre>
13226 NULL
13227 </pre>
13228 which expands to an implementation-defined null pointer constant; and
13229 <pre>
13230 offsetof(type, member-designator)
13231 </pre>
13232 which expands to an integer constant expression that has type size_t, the value of
13233 which is the offset in bytes, to the structure member (designated by member-designator),
13234 from the beginning of its structure (designated by type). The type and member designator
13235 shall be such that given
13236 <pre>
13237 static type t;
13238 </pre>
13239 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
13240 specified member is a bit-field, the behavior is undefined.)
13241 <p><b>Recommended practice</b>
13242 <p><a name="7.17p4" href="#7.17p4"><small>4</small></a>
13243 The types used for size_t and ptrdiff_t should not have an integer conversion rank
13244 greater than that of signed long int unless the implementation supports objects
13245 large enough to make this necessary.
13246 <p><b> Forward references</b>: localization (<a href="#7.11">7.11</a>).
13247 <!--page 267 -->
13249 <p><small><a href="#Contents">Contents</a></small>
13250 <h3><a name="7.18" href="#7.18">7.18 Integer types &lt;stdint.h&gt;</a></h3>
13251 <p><a name="7.18p1" href="#7.18p1"><small>1</small></a>
13252 The header <a href="#7.18">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
13253 defines corresponding sets of macros.<sup><a href="#note223"><b>223)</b></a></sup> It also defines macros that specify limits of
13254 integer types corresponding to types defined in other standard headers.
13255 <p><a name="7.18p2" href="#7.18p2"><small>2</small></a>
13256 Types are defined in the following categories:
13257 <ul>
13258 <li> integer types having certain exact widths;
13259 <li> integer types having at least certain specified widths;
13260 <li> fastest integer types having at least certain specified widths;
13261 <li> integer types wide enough to hold pointers to objects;
13262 <li> integer types having greatest width.
13263 </ul>
13264 (Some of these types may denote the same type.)
13265 <p><a name="7.18p3" href="#7.18p3"><small>3</small></a>
13266 Corresponding macros specify limits of the declared types and construct suitable
13267 constants.
13268 <p><a name="7.18p4" href="#7.18p4"><small>4</small></a>
13269 For each type described herein that the implementation provides,<sup><a href="#note224"><b>224)</b></a></sup> <a href="#7.18">&lt;stdint.h&gt;</a> shall
13270 declare that typedef name and define the associated macros. Conversely, for each type
13271 described herein that the implementation does not provide, <a href="#7.18">&lt;stdint.h&gt;</a> shall not
13272 declare that typedef name nor shall it define the associated macros. An implementation
13273 shall provide those types described as ''required'', but need not provide any of the others
13274 (described as ''optional'').
13276 <p><b>Footnotes</b>
13277 <p><small><a name="note223" href="#note223">223)</a> See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
13278 </small>
13279 <p><small><a name="note224" href="#note224">224)</a> Some of these types may denote implementation-defined extended integer types.
13280 </small>
13282 <p><small><a href="#Contents">Contents</a></small>
13283 <h4><a name="7.18.1" href="#7.18.1">7.18.1 Integer types</a></h4>
13284 <p><a name="7.18.1p1" href="#7.18.1p1"><small>1</small></a>
13285 When typedef names differing only in the absence or presence of the initial u are defined,
13286 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
13287 implementation providing one of these corresponding types shall also provide the other.
13288 <p><a name="7.18.1p2" href="#7.18.1p2"><small>2</small></a>
13289 In the following descriptions, the symbol N represents an unsigned decimal integer with
13290 no leading zeros (e.g., 8 or 24, but not 04 or 048).
13295 <!--page 268 -->
13297 <p><small><a href="#Contents">Contents</a></small>
13298 <h5><a name="7.18.1.1" href="#7.18.1.1">7.18.1.1 Exact-width integer types</a></h5>
13299 <p><a name="7.18.1.1p1" href="#7.18.1.1p1"><small>1</small></a>
13300 The typedef name intN_t designates a signed integer type with width N , no padding
13301 bits, and a two's complement representation. Thus, int8_t denotes a signed integer
13302 type with a width of exactly 8 bits.
13303 <p><a name="7.18.1.1p2" href="#7.18.1.1p2"><small>2</small></a>
13304 The typedef name uintN_t designates an unsigned integer type with width N . Thus,
13305 uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
13306 <p><a name="7.18.1.1p3" href="#7.18.1.1p3"><small>3</small></a>
13307 These types are optional. However, if an implementation provides integer types with
13308 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
13309 two's complement representation, it shall define the corresponding typedef names.
13311 <p><small><a href="#Contents">Contents</a></small>
13312 <h5><a name="7.18.1.2" href="#7.18.1.2">7.18.1.2 Minimum-width integer types</a></h5>
13313 <p><a name="7.18.1.2p1" href="#7.18.1.2p1"><small>1</small></a>
13314 The typedef name int_leastN_t designates a signed integer type with a width of at
13315 least N , such that no signed integer type with lesser size has at least the specified width.
13316 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
13317 <p><a name="7.18.1.2p2" href="#7.18.1.2p2"><small>2</small></a>
13318 The typedef name uint_leastN_t designates an unsigned integer type with a width
13319 of at least N , such that no unsigned integer type with lesser size has at least the specified
13320 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
13321 least 16 bits.
13322 <p><a name="7.18.1.2p3" href="#7.18.1.2p3"><small>3</small></a>
13323 The following types are required:
13324 <pre>
13325 int_least8_t uint_least8_t
13326 int_least16_t uint_least16_t
13327 int_least32_t uint_least32_t
13328 int_least64_t uint_least64_t
13329 </pre>
13330 All other types of this form are optional.
13332 <p><small><a href="#Contents">Contents</a></small>
13333 <h5><a name="7.18.1.3" href="#7.18.1.3">7.18.1.3 Fastest minimum-width integer types</a></h5>
13334 <p><a name="7.18.1.3p1" href="#7.18.1.3p1"><small>1</small></a>
13335 Each of the following types designates an integer type that is usually fastest<sup><a href="#note225"><b>225)</b></a></sup> to operate
13336 with among all integer types that have at least the specified width.
13337 <p><a name="7.18.1.3p2" href="#7.18.1.3p2"><small>2</small></a>
13338 The typedef name int_fastN_t designates the fastest signed integer type with a width
13339 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
13340 type with a width of at least N .
13345 <!--page 269 -->
13346 <p><a name="7.18.1.3p3" href="#7.18.1.3p3"><small>3</small></a>
13347 The following types are required:
13348 <pre>
13349 int_fast8_t uint_fast8_t
13350 int_fast16_t uint_fast16_t
13351 int_fast32_t uint_fast32_t
13352 int_fast64_t uint_fast64_t
13353 </pre>
13354 All other types of this form are optional.
13356 <p><b>Footnotes</b>
13357 <p><small><a name="note225" href="#note225">225)</a> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
13358 grounds for choosing one type over another, it will simply pick some integer type satisfying the
13359 signedness and width requirements.
13360 </small>
13362 <p><small><a href="#Contents">Contents</a></small>
13363 <h5><a name="7.18.1.4" href="#7.18.1.4">7.18.1.4 Integer types capable of holding object pointers</a></h5>
13364 <p><a name="7.18.1.4p1" href="#7.18.1.4p1"><small>1</small></a>
13365 The following type designates a signed integer type with the property that any valid
13366 pointer to void can be converted to this type, then converted back to pointer to void,
13367 and the result will compare equal to the original pointer:
13368 <pre>
13369 intptr_t
13370 </pre>
13371 The following type designates an unsigned integer type with the property that any valid
13372 pointer to void can be converted to this type, then converted back to pointer to void,
13373 and the result will compare equal to the original pointer:
13374 <pre>
13375 uintptr_t
13376 </pre>
13377 These types are optional.
13379 <p><small><a href="#Contents">Contents</a></small>
13380 <h5><a name="7.18.1.5" href="#7.18.1.5">7.18.1.5 Greatest-width integer types</a></h5>
13381 <p><a name="7.18.1.5p1" href="#7.18.1.5p1"><small>1</small></a>
13382 The following type designates a signed integer type capable of representing any value of
13383 any signed integer type:
13384 <pre>
13385 intmax_t
13386 </pre>
13387 The following type designates an unsigned integer type capable of representing any value
13388 of any unsigned integer type:
13389 <pre>
13390 uintmax_t
13391 </pre>
13392 These types are required.
13394 <p><small><a href="#Contents">Contents</a></small>
13395 <h4><a name="7.18.2" href="#7.18.2">7.18.2 Limits of specified-width integer types</a></h4>
13396 <p><a name="7.18.2p1" href="#7.18.2p1"><small>1</small></a>
13397 The following object-like macros<sup><a href="#note226"><b>226)</b></a></sup> specify the minimum and maximum limits of the
13398 types declared in <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
13399 <a href="#7.18.1">7.18.1</a>.
13400 <p><a name="7.18.2p2" href="#7.18.2p2"><small>2</small></a>
13401 Each instance of any defined macro shall be replaced by a constant expression suitable
13402 for use in #if preprocessing directives, and this expression shall have the same type as
13403 would an expression that is an object of the corresponding type converted according to
13405 <!--page 270 -->
13406 the integer promotions. Its implementation-defined value shall be equal to or greater in
13407 magnitude (absolute value) than the corresponding value given below, with the same sign,
13408 except where stated to be exactly the given value.
13410 <p><b>Footnotes</b>
13411 <p><small><a name="note226" href="#note226">226)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
13412 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13413 </small>
13415 <p><small><a href="#Contents">Contents</a></small>
13416 <h5><a name="7.18.2.1" href="#7.18.2.1">7.18.2.1 Limits of exact-width integer types</a></h5>
13417 <p><a name="7.18.2.1p1" href="#7.18.2.1p1"><small>1</small></a>
13418 <ul>
13419 <li> minimum values of exact-width signed integer types
13420 <pre>
13421 INTN_MIN exactly -(2<sup>N-1</sup>)
13422 </pre>
13423 <li> maximum values of exact-width signed integer types
13424 <pre>
13425 INTN_MAX exactly 2<sup>N-1</sup> - 1
13426 </pre>
13427 <li> maximum values of exact-width unsigned integer types
13428 <pre>
13429 UINTN_MAX exactly 2<sup>N</sup> - 1
13430 </pre>
13431 </ul>
13433 <p><small><a href="#Contents">Contents</a></small>
13434 <h5><a name="7.18.2.2" href="#7.18.2.2">7.18.2.2 Limits of minimum-width integer types</a></h5>
13435 <p><a name="7.18.2.2p1" href="#7.18.2.2p1"><small>1</small></a>
13436 <ul>
13437 <li> minimum values of minimum-width signed integer types
13438 <pre>
13439 INT_LEASTN_MIN -(2<sup>N-1</sup> - 1)
13440 </pre>
13441 <li> maximum values of minimum-width signed integer types
13442 <pre>
13443 INT_LEASTN_MAX 2<sup>N-1</sup> - 1
13444 </pre>
13445 <li> maximum values of minimum-width unsigned integer types
13446 <pre>
13447 UINT_LEASTN_MAX 2<sup>N</sup> - 1
13448 </pre>
13449 </ul>
13451 <p><small><a href="#Contents">Contents</a></small>
13452 <h5><a name="7.18.2.3" href="#7.18.2.3">7.18.2.3 Limits of fastest minimum-width integer types</a></h5>
13453 <p><a name="7.18.2.3p1" href="#7.18.2.3p1"><small>1</small></a>
13454 <ul>
13455 <li> minimum values of fastest minimum-width signed integer types
13456 <pre>
13457 INT_FASTN_MIN -(2<sup>N-1</sup> - 1)
13458 </pre>
13459 <li> maximum values of fastest minimum-width signed integer types
13460 <pre>
13461 INT_FASTN_MAX 2<sup>N-1</sup> - 1
13462 </pre>
13463 <li> maximum values of fastest minimum-width unsigned integer types
13464 <pre>
13465 UINT_FASTN_MAX 2<sup>N</sup> - 1
13466 </pre>
13467 </ul>
13469 <p><small><a href="#Contents">Contents</a></small>
13470 <h5><a name="7.18.2.4" href="#7.18.2.4">7.18.2.4 Limits of integer types capable of holding object pointers</a></h5>
13471 <p><a name="7.18.2.4p1" href="#7.18.2.4p1"><small>1</small></a>
13472 <ul>
13473 <li> minimum value of pointer-holding signed integer type
13474 <pre>
13475 INTPTR_MIN -(2<sup>15</sup> - 1)
13476 </pre>
13477 <li> maximum value of pointer-holding signed integer type
13478 <!--page 271 -->
13479 <pre>
13480 INTPTR_MAX 2<sup>15</sup> - 1
13481 </pre>
13482 <li> maximum value of pointer-holding unsigned integer type
13483 <pre>
13484 UINTPTR_MAX 2<sup>16</sup> - 1
13485 </pre>
13486 </ul>
13488 <p><small><a href="#Contents">Contents</a></small>
13489 <h5><a name="7.18.2.5" href="#7.18.2.5">7.18.2.5 Limits of greatest-width integer types</a></h5>
13490 <p><a name="7.18.2.5p1" href="#7.18.2.5p1"><small>1</small></a>
13491 <ul>
13492 <li> minimum value of greatest-width signed integer type
13493 <pre>
13494 INTMAX_MIN -(2<sup>63</sup> - 1)
13495 </pre>
13496 <li> maximum value of greatest-width signed integer type
13497 <pre>
13498 INTMAX_MAX 2<sup>63</sup> - 1
13499 </pre>
13500 <li> maximum value of greatest-width unsigned integer type
13501 <pre>
13502 UINTMAX_MAX 2<sup>64</sup> - 1
13503 </pre>
13504 </ul>
13506 <p><small><a href="#Contents">Contents</a></small>
13507 <h4><a name="7.18.3" href="#7.18.3">7.18.3 Limits of other integer types</a></h4>
13508 <p><a name="7.18.3p1" href="#7.18.3p1"><small>1</small></a>
13509 The following object-like macros<sup><a href="#note227"><b>227)</b></a></sup> specify the minimum and maximum limits of
13510 integer types corresponding to types defined in other standard headers.
13511 <p><a name="7.18.3p2" href="#7.18.3p2"><small>2</small></a>
13512 Each instance of these macros shall be replaced by a constant expression suitable for use
13513 in #if preprocessing directives, and this expression shall have the same type as would an
13514 expression that is an object of the corresponding type converted according to the integer
13515 promotions. Its implementation-defined value shall be equal to or greater in magnitude
13516 (absolute value) than the corresponding value given below, with the same sign. An
13517 implementation shall define only the macros corresponding to those typedef names it
13518 actually provides.<sup><a href="#note228"><b>228)</b></a></sup>
13519 <ul>
13520 <li> limits of ptrdiff_t
13521 <pre>
13522 PTRDIFF_MIN -65535
13523 PTRDIFF_MAX +65535
13524 </pre>
13525 <li> limits of sig_atomic_t
13526 <pre>
13527 SIG_ATOMIC_MIN see below
13528 SIG_ATOMIC_MAX see below
13529 </pre>
13530 <li> limit of size_t
13531 <pre>
13532 SIZE_MAX 65535
13533 </pre>
13534 <li> limits of wchar_t
13536 <!--page 272 -->
13537 <pre>
13538 WCHAR_MIN see below
13539 WCHAR_MAX see below
13540 </pre>
13541 <li> limits of wint_t
13542 <pre>
13543 WINT_MIN see below
13544 WINT_MAX see below
13545 </pre>
13546 </ul>
13547 <p><a name="7.18.3p3" href="#7.18.3p3"><small>3</small></a>
13548 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
13549 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
13550 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
13551 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
13552 SIG_ATOMIC_MAX shall be no less than 255.
13553 <p><a name="7.18.3p4" href="#7.18.3p4"><small>4</small></a>
13554 If wchar_t (see <a href="#7.17">7.17</a>) is defined as a signed integer type, the value of WCHAR_MIN
13555 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
13556 otherwise, wchar_t is defined as an unsigned integer type, and the value of
13557 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note229"><b>229)</b></a></sup>
13558 <p><a name="7.18.3p5" href="#7.18.3p5"><small>5</small></a>
13559 If wint_t (see <a href="#7.24">7.24</a>) is defined as a signed integer type, the value of WINT_MIN shall
13560 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
13561 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
13562 shall be 0 and the value of WINT_MAX shall be no less than 65535.
13564 <p><b>Footnotes</b>
13565 <p><small><a name="note227" href="#note227">227)</a> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
13566 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13567 </small>
13568 <p><small><a name="note228" href="#note228">228)</a> A freestanding implementation need not provide all of these types.
13569 </small>
13570 <p><small><a name="note229" href="#note229">229)</a> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
13571 character set.
13572 </small>
13574 <p><small><a href="#Contents">Contents</a></small>
13575 <h4><a name="7.18.4" href="#7.18.4">7.18.4 Macros for integer constants</a></h4>
13576 <p><a name="7.18.4p1" href="#7.18.4p1"><small>1</small></a>
13577 The following function-like macros<sup><a href="#note230"><b>230)</b></a></sup> expand to integer constants suitable for
13578 initializing objects that have integer types corresponding to types defined in
13579 <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in <a href="#7.18.1.2">7.18.1.2</a> or
13580 <a href="#7.18.1.5">7.18.1.5</a>.
13581 <p><a name="7.18.4p2" href="#7.18.4p2"><small>2</small></a>
13582 The argument in any instance of these macros shall be an unsuffixed integer constant (as
13583 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.
13584 <p><a name="7.18.4p3" href="#7.18.4p3"><small>3</small></a>
13585 Each invocation of one of these macros shall expand to an integer constant expression
13586 suitable for use in #if preprocessing directives. The type of the expression shall have
13587 the same type as would an expression of the corresponding type converted according to
13588 the integer promotions. The value of the expression shall be that of the argument.
13593 <!--page 273 -->
13595 <p><b>Footnotes</b>
13596 <p><small><a name="note230" href="#note230">230)</a> C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
13597 defined before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
13598 </small>
13600 <p><small><a href="#Contents">Contents</a></small>
13601 <h5><a name="7.18.4.1" href="#7.18.4.1">7.18.4.1 Macros for minimum-width integer constants</a></h5>
13602 <p><a name="7.18.4.1p1" href="#7.18.4.1p1"><small>1</small></a>
13603 The macro INTN_C(value) shall expand to an integer constant expression
13604 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
13605 to an integer constant expression corresponding to the type uint_leastN_t. For
13606 example, if uint_least64_t is a name for the type unsigned long long int,
13607 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
13609 <p><small><a href="#Contents">Contents</a></small>
13610 <h5><a name="7.18.4.2" href="#7.18.4.2">7.18.4.2 Macros for greatest-width integer constants</a></h5>
13611 <p><a name="7.18.4.2p1" href="#7.18.4.2p1"><small>1</small></a>
13612 The following macro expands to an integer constant expression having the value specified
13613 by its argument and the type intmax_t:
13614 <pre>
13615 INTMAX_C(value)
13616 </pre>
13617 The following macro expands to an integer constant expression having the value specified
13618 by its argument and the type uintmax_t:
13619 <!--page 274 -->
13620 <pre>
13621 UINTMAX_C(value)
13622 </pre>
13624 <p><small><a href="#Contents">Contents</a></small>
13625 <h3><a name="7.19" href="#7.19">7.19 Input/output &lt;stdio.h&gt;</a></h3>
13627 <p><small><a href="#Contents">Contents</a></small>
13628 <h4><a name="7.19.1" href="#7.19.1">7.19.1 Introduction</a></h4>
13629 <p><a name="7.19.1p1" href="#7.19.1p1"><small>1</small></a>
13630 The header <a href="#7.19">&lt;stdio.h&gt;</a> declares three types, several macros, and many functions for
13631 performing input and output.
13632 <p><a name="7.19.1p2" href="#7.19.1p2"><small>2</small></a>
13633 The types declared are size_t (described in <a href="#7.17">7.17</a>);
13634 <pre>
13635 FILE
13636 </pre>
13637 which is an object type capable of recording all the information needed to control a
13638 stream, including its file position indicator, a pointer to its associated buffer (if any), an
13639 error indicator that records whether a read/write error has occurred, and an end-of-file
13640 indicator that records whether the end of the file has been reached; and
13641 <pre>
13642 fpos_t
13643 </pre>
13644 which is an object type other than an array type capable of recording all the information
13645 needed to specify uniquely every position within a file.
13646 <p><a name="7.19.1p3" href="#7.19.1p3"><small>3</small></a>
13647 The macros are NULL (described in <a href="#7.17">7.17</a>);
13648 <pre>
13649 _IOFBF
13650 _IOLBF
13651 _IONBF
13652 </pre>
13653 which expand to integer constant expressions with distinct values, suitable for use as the
13654 third argument to the setvbuf function;
13655 <pre>
13656 BUFSIZ
13657 </pre>
13658 which expands to an integer constant expression that is the size of the buffer used by the
13659 setbuf function;
13660 <pre>
13662 </pre>
13663 which expands to an integer constant expression, with type int and a negative value, that
13664 is returned by several functions to indicate end-of-file, that is, no more input from a
13665 stream;
13666 <pre>
13667 FOPEN_MAX
13668 </pre>
13669 which expands to an integer constant expression that is the minimum number of files that
13670 the implementation guarantees can be open simultaneously;
13671 <pre>
13672 FILENAME_MAX
13673 </pre>
13674 which expands to an integer constant expression that is the size needed for an array of
13675 char large enough to hold the longest file name string that the implementation
13676 <!--page 275 -->
13677 guarantees can be opened;<sup><a href="#note231"><b>231)</b></a></sup>
13678 <pre>
13679 L_tmpnam
13680 </pre>
13681 which expands to an integer constant expression that is the size needed for an array of
13682 char large enough to hold a temporary file name string generated by the tmpnam
13683 function;
13684 <pre>
13685 SEEK_CUR
13686 SEEK_END
13687 SEEK_SET
13688 </pre>
13689 which expand to integer constant expressions with distinct values, suitable for use as the
13690 third argument to the fseek function;
13691 <pre>
13692 TMP_MAX
13693 </pre>
13694 which expands to an integer constant expression that is the maximum number of unique
13695 file names that can be generated by the tmpnam function;
13696 <pre>
13697 stderr
13698 stdin
13699 stdout
13700 </pre>
13701 which are expressions of type ''pointer to FILE'' that point to the FILE objects
13702 associated, respectively, with the standard error, input, and output streams.
13703 <p><a name="7.19.1p4" href="#7.19.1p4"><small>4</small></a>
13704 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
13705 and output. The wide character input/output functions described in that subclause
13706 provide operations analogous to most of those described here, except that the
13707 fundamental units internal to the program are wide characters. The external
13708 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
13709 described further in <a href="#7.19.3">7.19.3</a>.
13710 <p><a name="7.19.1p5" href="#7.19.1p5"><small>5</small></a>
13711 The input/output functions are given the following collective terms:
13712 <ul>
13713 <li> The wide character input functions -- those functions described in <a href="#7.24">7.24</a> that perform
13714 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
13715 fwscanf, wscanf, vfwscanf, and vwscanf.
13716 <li> The wide character output functions -- those functions described in <a href="#7.24">7.24</a> that perform
13717 output from wide characters and wide strings: fputwc, fputws, putwc,
13718 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
13721 <!--page 276 -->
13722 <li> The wide character input/output functions -- the union of the ungetwc function, the
13723 wide character input functions, and the wide character output functions.
13724 <li> The byte input/output functions -- those functions described in this subclause that
13725 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
13726 fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts,
13727 scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
13728 </ul>
13729 <p><b> Forward references</b>: files (<a href="#7.19.3">7.19.3</a>), the fseek function (<a href="#7.19.9.2">7.19.9.2</a>), streams (<a href="#7.19.2">7.19.2</a>), the
13730 tmpnam function (<a href="#7.19.4.4">7.19.4.4</a>), <a href="#7.24">&lt;wchar.h&gt;</a> (<a href="#7.24">7.24</a>).
13732 <p><b>Footnotes</b>
13733 <p><small><a name="note231" href="#note231">231)</a> If the implementation imposes no practical limit on the length of file name strings, the value of
13734 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
13735 string. Of course, file name string contents are subject to other system-specific constraints; therefore
13736 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
13737 </small>
13739 <p><small><a href="#Contents">Contents</a></small>
13740 <h4><a name="7.19.2" href="#7.19.2">7.19.2 Streams</a></h4>
13741 <p><a name="7.19.2p1" href="#7.19.2p1"><small>1</small></a>
13742 Input and output, whether to or from physical devices such as terminals and tape drives,
13743 or whether to or from files supported on structured storage devices, are mapped into
13744 logical data streams, whose properties are more uniform than their various inputs and
13745 outputs. Two forms of mapping are supported, for text streams and for binary
13746 streams.<sup><a href="#note232"><b>232)</b></a></sup>
13747 <p><a name="7.19.2p2" href="#7.19.2p2"><small>2</small></a>
13748 A text stream is an ordered sequence of characters composed into lines, each line
13749 consisting of zero or more characters plus a terminating new-line character. Whether the
13750 last line requires a terminating new-line character is implementation-defined. Characters
13751 may have to be added, altered, or deleted on input and output to conform to differing
13752 conventions for representing text in the host environment. Thus, there need not be a one-
13753 to-one correspondence between the characters in a stream and those in the external
13754 representation. Data read in from a text stream will necessarily compare equal to the data
13755 that were earlier written out to that stream only if: the data consist only of printing
13756 characters and the control characters horizontal tab and new-line; no new-line character is
13757 immediately preceded by space characters; and the last character is a new-line character.
13758 Whether space characters that are written out immediately before a new-line character
13759 appear when read in is implementation-defined.
13760 <p><a name="7.19.2p3" href="#7.19.2p3"><small>3</small></a>
13761 A binary stream is an ordered sequence of characters that can transparently record
13762 internal data. Data read in from a binary stream shall compare equal to the data that were
13763 earlier written out to that stream, under the same implementation. Such a stream may,
13764 however, have an implementation-defined number of null characters appended to the end
13765 of the stream.
13766 <p><a name="7.19.2p4" href="#7.19.2p4"><small>4</small></a>
13767 Each stream has an orientation. After a stream is associated with an external file, but
13768 before any operations are performed on it, the stream is without orientation. Once a wide
13769 character input/output function has been applied to a stream without orientation, the
13772 <!--page 277 -->
13773 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
13774 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
13775 Only a call to the freopen function or the fwide function can otherwise alter the
13776 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note233"><b>233)</b></a></sup>
13777 <p><a name="7.19.2p5" href="#7.19.2p5"><small>5</small></a>
13778 Byte input/output functions shall not be applied to a wide-oriented stream and wide
13779 character input/output functions shall not be applied to a byte-oriented stream. The
13780 remaining stream operations do not affect, and are not affected by, a stream's orientation,
13781 except for the following additional restrictions:
13782 <ul>
13783 <li> Binary wide-oriented streams have the file-positioning restrictions ascribed to both
13784 text and binary streams.
13785 <li> For wide-oriented streams, after a successful call to a file-positioning function that
13786 leaves the file position indicator prior to the end-of-file, a wide character output
13787 function can overwrite a partial multibyte character; any file contents beyond the
13788 byte(s) written are henceforth indeterminate.
13789 </ul>
13790 <p><a name="7.19.2p6" href="#7.19.2p6"><small>6</small></a>
13791 Each wide-oriented stream has an associated mbstate_t object that stores the current
13792 parse state of the stream. A successful call to fgetpos stores a representation of the
13793 value of this mbstate_t object as part of the value of the fpos_t object. A later
13794 successful call to fsetpos using the same stored fpos_t value restores the value of
13795 the associated mbstate_t object as well as the position within the controlled stream.
13796 <p><b>Environmental limits</b>
13797 <p><a name="7.19.2p7" href="#7.19.2p7"><small>7</small></a>
13798 An implementation shall support text files with lines containing at least 254 characters,
13799 including the terminating new-line character. The value of the macro BUFSIZ shall be at
13800 least 256.
13801 <p><b> Forward references</b>: the freopen function (<a href="#7.19.5.4">7.19.5.4</a>), the fwide function (<a href="#7.24.3.5">7.24.3.5</a>),
13802 mbstate_t (<a href="#7.25.1">7.25.1</a>), the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>), the fsetpos function
13803 (<a href="#7.19.9.3">7.19.9.3</a>).
13808 <!--page 278 -->
13810 <p><b>Footnotes</b>
13811 <p><small><a name="note232" href="#note232">232)</a> An implementation need not distinguish between text streams and binary streams. In such an
13812 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
13813 line.
13814 </small>
13815 <p><small><a name="note233" href="#note233">233)</a> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
13816 </small>
13818 <p><small><a href="#Contents">Contents</a></small>
13819 <h4><a name="7.19.3" href="#7.19.3">7.19.3 Files</a></h4>
13820 <p><a name="7.19.3p1" href="#7.19.3p1"><small>1</small></a>
13821 A stream is associated with an external file (which may be a physical device) by opening
13822 a file, which may involve creating a new file. Creating an existing file causes its former
13823 contents to be discarded, if necessary. If a file can support positioning requests (such as a
13824 disk file, as opposed to a terminal), then a file position indicator associated with the
13825 stream is positioned at the start (character number zero) of the file, unless the file is
13826 opened with append mode in which case it is implementation-defined whether the file
13827 position indicator is initially positioned at the beginning or the end of the file. The file
13828 position indicator is maintained by subsequent reads, writes, and positioning requests, to
13829 facilitate an orderly progression through the file.
13830 <p><a name="7.19.3p2" href="#7.19.3p2"><small>2</small></a>
13831 Binary files are not truncated, except as defined in <a href="#7.19.5.3">7.19.5.3</a>. Whether a write on a text
13832 stream causes the associated file to be truncated beyond that point is implementation-
13833 defined.
13834 <p><a name="7.19.3p3" href="#7.19.3p3"><small>3</small></a>
13835 When a stream is unbuffered, characters are intended to appear from the source or at the
13836 destination as soon as possible. Otherwise characters may be accumulated and
13837 transmitted to or from the host environment as a block. When a stream is fully buffered,
13838 characters are intended to be transmitted to or from the host environment as a block when
13839 a buffer is filled. When a stream is line buffered, characters are intended to be
13840 transmitted to or from the host environment as a block when a new-line character is
13841 encountered. Furthermore, characters are intended to be transmitted as a block to the host
13842 environment when a buffer is filled, when input is requested on an unbuffered stream, or
13843 when input is requested on a line buffered stream that requires the transmission of
13844 characters from the host environment. Support for these characteristics is
13845 implementation-defined, and may be affected via the setbuf and setvbuf functions.
13846 <p><a name="7.19.3p4" href="#7.19.3p4"><small>4</small></a>
13847 A file may be disassociated from a controlling stream by closing the file. Output streams
13848 are flushed (any unwritten buffer contents are transmitted to the host environment) before
13849 the stream is disassociated from the file. The value of a pointer to a FILE object is
13850 indeterminate after the associated file is closed (including the standard text streams).
13851 Whether a file of zero length (on which no characters have been written by an output
13852 stream) actually exists is implementation-defined.
13853 <p><a name="7.19.3p5" href="#7.19.3p5"><small>5</small></a>
13854 The file may be subsequently reopened, by the same or another program execution, and
13855 its contents reclaimed or modified (if it can be repositioned at its start). If the main
13856 function returns to its original caller, or if the exit function is called, all open files are
13857 closed (hence all output streams are flushed) before program termination. Other paths to
13858 program termination, such as calling the abort function, need not close all files
13859 properly.
13860 <p><a name="7.19.3p6" href="#7.19.3p6"><small>6</small></a>
13861 The address of the FILE object used to control a stream may be significant; a copy of a
13862 FILE object need not serve in place of the original.
13863 <!--page 279 -->
13864 <p><a name="7.19.3p7" href="#7.19.3p7"><small>7</small></a>
13865 At program startup, three text streams are predefined and need not be opened explicitly
13866 -- standard input (for reading conventional input), standard output (for writing
13867 conventional output), and standard error (for writing diagnostic output). As initially
13868 opened, the standard error stream is not fully buffered; the standard input and standard
13869 output streams are fully buffered if and only if the stream can be determined not to refer
13870 to an interactive device.
13871 <p><a name="7.19.3p8" href="#7.19.3p8"><small>8</small></a>
13872 Functions that open additional (nontemporary) files require a file name, which is a string.
13873 The rules for composing valid file names are implementation-defined. Whether the same
13874 file can be simultaneously open multiple times is also implementation-defined.
13875 <p><a name="7.19.3p9" href="#7.19.3p9"><small>9</small></a>
13876 Although both text and binary wide-oriented streams are conceptually sequences of wide
13877 characters, the external file associated with a wide-oriented stream is a sequence of
13878 multibyte characters, generalized as follows:
13879 <ul>
13880 <li> Multibyte encodings within files may contain embedded null bytes (unlike multibyte
13881 encodings valid for use internal to the program).
13882 <li> A file need not begin nor end in the initial shift state.<sup><a href="#note234"><b>234)</b></a></sup>
13883 </ul>
13884 <p><a name="7.19.3p10" href="#7.19.3p10"><small>10</small></a>
13885 Moreover, the encodings used for multibyte characters may differ among files. Both the
13886 nature and choice of such encodings are implementation-defined.
13887 <p><a name="7.19.3p11" href="#7.19.3p11"><small>11</small></a>
13888 The wide character input functions read multibyte characters from the stream and convert
13889 them to wide characters as if they were read by successive calls to the fgetwc function.
13890 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
13891 described by the stream's own mbstate_t object. The byte input functions read
13892 characters from the stream as if by successive calls to the fgetc function.
13893 <p><a name="7.19.3p12" href="#7.19.3p12"><small>12</small></a>
13894 The wide character output functions convert wide characters to multibyte characters and
13895 write them to the stream as if they were written by successive calls to the fputwc
13896 function. Each conversion occurs as if by a call to the wcrtomb function, with the
13897 conversion state described by the stream's own mbstate_t object. The byte output
13898 functions write characters to the stream as if by successive calls to the fputc function.
13899 <p><a name="7.19.3p13" href="#7.19.3p13"><small>13</small></a>
13900 In some cases, some of the byte input/output functions also perform conversions between
13901 multibyte characters and wide characters. These conversions also occur as if by calls to
13902 the mbrtowc and wcrtomb functions.
13903 <p><a name="7.19.3p14" href="#7.19.3p14"><small>14</small></a>
13904 An encoding error occurs if the character sequence presented to the underlying
13905 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
13906 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
13909 <!--page 280 -->
13910 multibyte character. The wide character input/output functions and the byte input/output
13911 functions store the value of the macro EILSEQ in errno if and only if an encoding error
13912 occurs.
13913 <p><b>Environmental limits</b>
13914 <p><a name="7.19.3p15" href="#7.19.3p15"><small>15</small></a>
13915 The value of FOPEN_MAX shall be at least eight, including the three standard text
13916 streams.
13917 <p><b> Forward references</b>: the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the fgetc function (<a href="#7.19.7.1">7.19.7.1</a>), the
13918 fopen function (<a href="#7.19.5.3">7.19.5.3</a>), the fputc function (<a href="#7.19.7.3">7.19.7.3</a>), the setbuf function
13919 (<a href="#7.19.5.5">7.19.5.5</a>), the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>), the fgetwc function (<a href="#7.24.3.1">7.24.3.1</a>), the
13920 fputwc function (<a href="#7.24.3.3">7.24.3.3</a>), conversion state (<a href="#7.24.6">7.24.6</a>), the mbrtowc function
13921 (<a href="#7.24.6.3.2">7.24.6.3.2</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
13923 <p><b>Footnotes</b>
13924 <p><small><a name="note234" href="#note234">234)</a> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
13925 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
13926 with state-dependent encoding that does not assuredly end in the initial shift state.
13927 </small>
13929 <p><small><a href="#Contents">Contents</a></small>
13930 <h4><a name="7.19.4" href="#7.19.4">7.19.4 Operations on files</a></h4>
13932 <p><small><a href="#Contents">Contents</a></small>
13933 <h5><a name="7.19.4.1" href="#7.19.4.1">7.19.4.1 The remove function</a></h5>
13934 <p><b>Synopsis</b>
13935 <p><a name="7.19.4.1p1" href="#7.19.4.1p1"><small>1</small></a>
13936 <pre>
13937 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13938 int remove(const char *filename);
13939 </pre>
13940 <p><b>Description</b>
13941 <p><a name="7.19.4.1p2" href="#7.19.4.1p2"><small>2</small></a>
13942 The remove function causes the file whose name is the string pointed to by filename
13943 to be no longer accessible by that name. A subsequent attempt to open that file using that
13944 name will fail, unless it is created anew. If the file is open, the behavior of the remove
13945 function is implementation-defined.
13946 <p><b>Returns</b>
13947 <p><a name="7.19.4.1p3" href="#7.19.4.1p3"><small>3</small></a>
13948 The remove function returns zero if the operation succeeds, nonzero if it fails.
13950 <p><small><a href="#Contents">Contents</a></small>
13951 <h5><a name="7.19.4.2" href="#7.19.4.2">7.19.4.2 The rename function</a></h5>
13952 <p><b>Synopsis</b>
13953 <p><a name="7.19.4.2p1" href="#7.19.4.2p1"><small>1</small></a>
13954 <pre>
13955 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13956 int rename(const char *old, const char *new);
13957 </pre>
13958 <p><b>Description</b>
13959 <p><a name="7.19.4.2p2" href="#7.19.4.2p2"><small>2</small></a>
13960 The rename function causes the file whose name is the string pointed to by old to be
13961 henceforth known by the name given by the string pointed to by new. The file named
13962 old is no longer accessible by that name. If a file named by the string pointed to by new
13963 exists prior to the call to the rename function, the behavior is implementation-defined.
13964 <!--page 281 -->
13965 <p><b>Returns</b>
13966 <p><a name="7.19.4.2p3" href="#7.19.4.2p3"><small>3</small></a>
13967 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note235"><b>235)</b></a></sup> in
13968 which case if the file existed previously it is still known by its original name.
13970 <p><b>Footnotes</b>
13971 <p><small><a name="note235" href="#note235">235)</a> Among the reasons the implementation may cause the rename function to fail are that the file is open
13972 or that it is necessary to copy its contents to effectuate its renaming.
13973 </small>
13975 <p><small><a href="#Contents">Contents</a></small>
13976 <h5><a name="7.19.4.3" href="#7.19.4.3">7.19.4.3 The tmpfile function</a></h5>
13977 <p><b>Synopsis</b>
13978 <p><a name="7.19.4.3p1" href="#7.19.4.3p1"><small>1</small></a>
13979 <pre>
13980 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13981 FILE *tmpfile(void);
13982 </pre>
13983 <p><b>Description</b>
13984 <p><a name="7.19.4.3p2" href="#7.19.4.3p2"><small>2</small></a>
13985 The tmpfile function creates a temporary binary file that is different from any other
13986 existing file and that will automatically be removed when it is closed or at program
13987 termination. If the program terminates abnormally, whether an open temporary file is
13988 removed is implementation-defined. The file is opened for update with "wb+" mode.
13989 <p><b>Recommended practice</b>
13990 <p><a name="7.19.4.3p3" href="#7.19.4.3p3"><small>3</small></a>
13991 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
13992 program (this limit may be shared with tmpnam) and there should be no limit on the
13993 number simultaneously open other than this limit and any limit on the number of open
13994 files (FOPEN_MAX).
13995 <p><b>Returns</b>
13996 <p><a name="7.19.4.3p4" href="#7.19.4.3p4"><small>4</small></a>
13997 The tmpfile function returns a pointer to the stream of the file that it created. If the file
13998 cannot be created, the tmpfile function returns a null pointer.
13999 <p><b> Forward references</b>: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
14001 <p><small><a href="#Contents">Contents</a></small>
14002 <h5><a name="7.19.4.4" href="#7.19.4.4">7.19.4.4 The tmpnam function</a></h5>
14003 <p><b>Synopsis</b>
14004 <p><a name="7.19.4.4p1" href="#7.19.4.4p1"><small>1</small></a>
14005 <pre>
14006 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14007 char *tmpnam(char *s);
14008 </pre>
14009 <p><b>Description</b>
14010 <p><a name="7.19.4.4p2" href="#7.19.4.4p2"><small>2</small></a>
14011 The tmpnam function generates a string that is a valid file name and that is not the same
14012 as the name of an existing file.<sup><a href="#note236"><b>236)</b></a></sup> The function is potentially capable of generating
14015 <!--page 282 -->
14016 TMP_MAX different strings, but any or all of them may already be in use by existing files
14017 and thus not be suitable return values.
14018 <p><a name="7.19.4.4p3" href="#7.19.4.4p3"><small>3</small></a>
14019 The tmpnam function generates a different string each time it is called.
14020 <p><a name="7.19.4.4p4" href="#7.19.4.4p4"><small>4</small></a>
14021 The implementation shall behave as if no library function calls the tmpnam function.
14022 <p><b>Returns</b>
14023 <p><a name="7.19.4.4p5" href="#7.19.4.4p5"><small>5</small></a>
14024 If no suitable string can be generated, the tmpnam function returns a null pointer.
14025 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
14026 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
14027 function may modify the same object). If the argument is not a null pointer, it is assumed
14028 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
14029 in that array and returns the argument as its value.
14030 <p><b>Environmental limits</b>
14031 <p><a name="7.19.4.4p6" href="#7.19.4.4p6"><small>6</small></a>
14032 The value of the macro TMP_MAX shall be at least 25.
14034 <p><b>Footnotes</b>
14035 <p><small><a name="note236" href="#note236">236)</a> Files created using strings generated by the tmpnam function are temporary only in the sense that
14036 their names should not collide with those generated by conventional naming rules for the
14037 implementation. It is still necessary to use the remove function to remove such files when their use
14038 is ended, and before program termination.
14039 </small>
14041 <p><small><a href="#Contents">Contents</a></small>
14042 <h4><a name="7.19.5" href="#7.19.5">7.19.5 File access functions</a></h4>
14044 <p><small><a href="#Contents">Contents</a></small>
14045 <h5><a name="7.19.5.1" href="#7.19.5.1">7.19.5.1 The fclose function</a></h5>
14046 <p><b>Synopsis</b>
14047 <p><a name="7.19.5.1p1" href="#7.19.5.1p1"><small>1</small></a>
14048 <pre>
14049 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14050 int fclose(FILE *stream);
14051 </pre>
14052 <p><b>Description</b>
14053 <p><a name="7.19.5.1p2" href="#7.19.5.1p2"><small>2</small></a>
14054 A successful call to the fclose function causes the stream pointed to by stream to be
14055 flushed and the associated file to be closed. Any unwritten buffered data for the stream
14056 are delivered to the host environment to be written to the file; any unread buffered data
14057 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
14058 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
14059 (and deallocated if it was automatically allocated).
14060 <p><b>Returns</b>
14061 <p><a name="7.19.5.1p3" href="#7.19.5.1p3"><small>3</small></a>
14062 The fclose function returns zero if the stream was successfully closed, or EOF if any
14063 errors were detected.
14065 <p><small><a href="#Contents">Contents</a></small>
14066 <h5><a name="7.19.5.2" href="#7.19.5.2">7.19.5.2 The fflush function</a></h5>
14067 <p><b>Synopsis</b>
14068 <p><a name="7.19.5.2p1" href="#7.19.5.2p1"><small>1</small></a>
14069 <!--page 283 -->
14070 <pre>
14071 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14072 int fflush(FILE *stream);
14073 </pre>
14074 <p><b>Description</b>
14075 <p><a name="7.19.5.2p2" href="#7.19.5.2p2"><small>2</small></a>
14076 If stream points to an output stream or an update stream in which the most recent
14077 operation was not input, the fflush function causes any unwritten data for that stream
14078 to be delivered to the host environment to be written to the file; otherwise, the behavior is
14079 undefined.
14080 <p><a name="7.19.5.2p3" href="#7.19.5.2p3"><small>3</small></a>
14081 If stream is a null pointer, the fflush function performs this flushing action on all
14082 streams for which the behavior is defined above.
14083 <p><b>Returns</b>
14084 <p><a name="7.19.5.2p4" href="#7.19.5.2p4"><small>4</small></a>
14085 The fflush function sets the error indicator for the stream and returns EOF if a write
14086 error occurs, otherwise it returns zero.
14087 <p><b> Forward references</b>: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
14089 <p><small><a href="#Contents">Contents</a></small>
14090 <h5><a name="7.19.5.3" href="#7.19.5.3">7.19.5.3 The fopen function</a></h5>
14091 <p><b>Synopsis</b>
14092 <p><a name="7.19.5.3p1" href="#7.19.5.3p1"><small>1</small></a>
14093 <pre>
14094 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14095 FILE *fopen(const char * restrict filename,
14096 const char * restrict mode);
14097 </pre>
14098 <p><b>Description</b>
14099 <p><a name="7.19.5.3p2" href="#7.19.5.3p2"><small>2</small></a>
14100 The fopen function opens the file whose name is the string pointed to by filename,
14101 and associates a stream with it.
14102 <p><a name="7.19.5.3p3" href="#7.19.5.3p3"><small>3</small></a>
14103 The argument mode points to a string. If the string is one of the following, the file is
14104 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note237"><b>237)</b></a></sup>
14105 <dl>
14106 <dt> r <dd>open text file for reading
14107 <dt> w <dd>truncate to zero length or create text file for writing
14108 <dt> a <dd>append; open or create text file for writing at end-of-file
14109 <dt> rb <dd>open binary file for reading
14110 <dt> wb <dd>truncate to zero length or create binary file for writing
14111 <dt> ab <dd><dd>append; open or create binary file for writing at end-of-file
14112 <dt> r+ <dd>open text file for update (reading and writing)
14113 <dt> w+ <dd>truncate to zero length or create text file for update
14114 <dt> a+ <dd>append; open or create text file for update, writing at end-of-file
14116 <!--page 284 -->
14117 <dt> r+b or rb+ <dd>open binary file for update (reading and writing)
14118 <dt> w+b or wb+ <dd>truncate to zero length or create binary file for update
14119 <dt> a+b or ab+ <dd>append; open or create binary file for update, writing at end-of-file
14120 </dl>
14121 <p><a name="7.19.5.3p4" href="#7.19.5.3p4"><small>4</small></a>
14122 Opening a file with read mode ('r' as the first character in the mode argument) fails if
14123 the file does not exist or cannot be read.
14124 <p><a name="7.19.5.3p5" href="#7.19.5.3p5"><small>5</small></a>
14125 Opening a file with append mode ('a' as the first character in the mode argument)
14126 causes all subsequent writes to the file to be forced to the then current end-of-file,
14127 regardless of intervening calls to the fseek function. In some implementations, opening
14128 a binary file with append mode ('b' as the second or third character in the above list of
14129 mode argument values) may initially position the file position indicator for the stream
14130 beyond the last data written, because of null character padding.
14131 <p><a name="7.19.5.3p6" href="#7.19.5.3p6"><small>6</small></a>
14132 When a file is opened with update mode ('+' as the second or third character in the
14133 above list of mode argument values), both input and output may be performed on the
14134 associated stream. However, output shall not be directly followed by input without an
14135 intervening call to the fflush function or to a file positioning function (fseek,
14136 fsetpos, or rewind), and input shall not be directly followed by output without an
14137 intervening call to a file positioning function, unless the input operation encounters end-
14138 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
14139 binary stream in some implementations.
14140 <p><a name="7.19.5.3p7" href="#7.19.5.3p7"><small>7</small></a>
14141 When opened, a stream is fully buffered if and only if it can be determined not to refer to
14142 an interactive device. The error and end-of-file indicators for the stream are cleared.
14143 <p><b>Returns</b>
14144 <p><a name="7.19.5.3p8" href="#7.19.5.3p8"><small>8</small></a>
14145 The fopen function returns a pointer to the object controlling the stream. If the open
14146 operation fails, fopen returns a null pointer.
14147 <p><b> Forward references</b>: file positioning functions (<a href="#7.19.9">7.19.9</a>).
14149 <p><b>Footnotes</b>
14150 <p><small><a name="note237" href="#note237">237)</a> If the string begins with one of the above sequences, the implementation might choose to ignore the
14151 remaining characters, or it might use them to select different kinds of a file (some of which might not
14152 conform to the properties in <a href="#7.19.2">7.19.2</a>).
14153 </small>
14155 <p><small><a href="#Contents">Contents</a></small>
14156 <h5><a name="7.19.5.4" href="#7.19.5.4">7.19.5.4 The freopen function</a></h5>
14157 <p><b>Synopsis</b>
14158 <p><a name="7.19.5.4p1" href="#7.19.5.4p1"><small>1</small></a>
14159 <pre>
14160 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14161 FILE *freopen(const char * restrict filename,
14162 const char * restrict mode,
14163 FILE * restrict stream);
14164 </pre>
14165 <p><b>Description</b>
14166 <p><a name="7.19.5.4p2" href="#7.19.5.4p2"><small>2</small></a>
14167 The freopen function opens the file whose name is the string pointed to by filename
14168 and associates the stream pointed to by stream with it. The mode argument is used just
14169 <!--page 285 -->
14170 as in the fopen function.<sup><a href="#note238"><b>238)</b></a></sup>
14171 <p><a name="7.19.5.4p3" href="#7.19.5.4p3"><small>3</small></a>
14172 If filename is a null pointer, the freopen function attempts to change the mode of
14173 the stream to that specified by mode, as if the name of the file currently associated with
14174 the stream had been used. It is implementation-defined which changes of mode are
14175 permitted (if any), and under what circumstances.
14176 <p><a name="7.19.5.4p4" href="#7.19.5.4p4"><small>4</small></a>
14177 The freopen function first attempts to close any file that is associated with the specified
14178 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
14179 stream are cleared.
14180 <p><b>Returns</b>
14181 <p><a name="7.19.5.4p5" href="#7.19.5.4p5"><small>5</small></a>
14182 The freopen function returns a null pointer if the open operation fails. Otherwise,
14183 freopen returns the value of stream.
14185 <p><b>Footnotes</b>
14186 <p><small><a name="note238" href="#note238">238)</a> The primary use of the freopen function is to change the file associated with a standard text stream
14187 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
14188 returned by the fopen function may be assigned.
14189 </small>
14191 <p><small><a href="#Contents">Contents</a></small>
14192 <h5><a name="7.19.5.5" href="#7.19.5.5">7.19.5.5 The setbuf function</a></h5>
14193 <p><b>Synopsis</b>
14194 <p><a name="7.19.5.5p1" href="#7.19.5.5p1"><small>1</small></a>
14195 <pre>
14196 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14197 void setbuf(FILE * restrict stream,
14198 char * restrict buf);
14199 </pre>
14200 <p><b>Description</b>
14201 <p><a name="7.19.5.5p2" href="#7.19.5.5p2"><small>2</small></a>
14202 Except that it returns no value, the setbuf function is equivalent to the setvbuf
14203 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
14204 is a null pointer), with the value _IONBF for mode.
14205 <p><b>Returns</b>
14206 <p><a name="7.19.5.5p3" href="#7.19.5.5p3"><small>3</small></a>
14207 The setbuf function returns no value.
14208 <p><b> Forward references</b>: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
14210 <p><small><a href="#Contents">Contents</a></small>
14211 <h5><a name="7.19.5.6" href="#7.19.5.6">7.19.5.6 The setvbuf function</a></h5>
14212 <p><b>Synopsis</b>
14213 <p><a name="7.19.5.6p1" href="#7.19.5.6p1"><small>1</small></a>
14214 <pre>
14215 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14216 int setvbuf(FILE * restrict stream,
14217 char * restrict buf,
14218 int mode, size_t size);
14219 </pre>
14224 <!--page 286 -->
14225 <p><b>Description</b>
14226 <p><a name="7.19.5.6p2" href="#7.19.5.6p2"><small>2</small></a>
14227 The setvbuf function may be used only after the stream pointed to by stream has
14228 been associated with an open file and before any other operation (other than an
14229 unsuccessful call to setvbuf) is performed on the stream. The argument mode
14230 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
14231 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
14232 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
14233 used instead of a buffer allocated by the setvbuf function<sup><a href="#note239"><b>239)</b></a></sup> and the argument size
14234 specifies the size of the array; otherwise, size may determine the size of a buffer
14235 allocated by the setvbuf function. The contents of the array at any time are
14236 indeterminate.
14237 <p><b>Returns</b>
14238 <p><a name="7.19.5.6p3" href="#7.19.5.6p3"><small>3</small></a>
14239 The setvbuf function returns zero on success, or nonzero if an invalid value is given
14240 for mode or if the request cannot be honored.
14242 <p><b>Footnotes</b>
14243 <p><small><a name="note239" href="#note239">239)</a> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
14244 before a buffer that has automatic storage duration is deallocated upon block exit.
14245 </small>
14247 <p><small><a href="#Contents">Contents</a></small>
14248 <h4><a name="7.19.6" href="#7.19.6">7.19.6 Formatted input/output functions</a></h4>
14249 <p><a name="7.19.6p1" href="#7.19.6p1"><small>1</small></a>
14250 The formatted input/output functions shall behave as if there is a sequence point after the
14251 actions associated with each specifier.<sup><a href="#note240"><b>240)</b></a></sup>
14253 <p><b>Footnotes</b>
14254 <p><small><a name="note240" href="#note240">240)</a> The fprintf functions perform writes to memory for the %n specifier.
14255 </small>
14257 <p><small><a href="#Contents">Contents</a></small>
14258 <h5><a name="7.19.6.1" href="#7.19.6.1">7.19.6.1 The fprintf function</a></h5>
14259 <p><b>Synopsis</b>
14260 <p><a name="7.19.6.1p1" href="#7.19.6.1p1"><small>1</small></a>
14261 <pre>
14262 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14263 int fprintf(FILE * restrict stream,
14264 const char * restrict format, ...);
14265 </pre>
14266 <p><b>Description</b>
14267 <p><a name="7.19.6.1p2" href="#7.19.6.1p2"><small>2</small></a>
14268 The fprintf function writes output to the stream pointed to by stream, under control
14269 of the string pointed to by format that specifies how subsequent arguments are
14270 converted for output. If there are insufficient arguments for the format, the behavior is
14271 undefined. If the format is exhausted while arguments remain, the excess arguments are
14272 evaluated (as always) but are otherwise ignored. The fprintf function returns when
14273 the end of the format string is encountered.
14274 <p><a name="7.19.6.1p3" href="#7.19.6.1p3"><small>3</small></a>
14275 The format shall be a multibyte character sequence, beginning and ending in its initial
14276 shift state. The format is composed of zero or more directives: ordinary multibyte
14277 characters (not %), which are copied unchanged to the output stream; and conversion
14280 <!--page 287 -->
14281 specifications, each of which results in fetching zero or more subsequent arguments,
14282 converting them, if applicable, according to the corresponding conversion specifier, and
14283 then writing the result to the output stream.
14284 <p><a name="7.19.6.1p4" href="#7.19.6.1p4"><small>4</small></a>
14285 Each conversion specification is introduced by the character %. After the %, the following
14286 appear in sequence:
14287 <ul>
14288 <li> Zero or more flags (in any order) that modify the meaning of the conversion
14289 specification.
14290 <li> An optional minimum field width. If the converted value has fewer characters than the
14291 field width, it is padded with spaces (by default) on the left (or right, if the left
14292 adjustment flag, described later, has been given) to the field width. The field width
14293 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note241"><b>241)</b></a></sup>
14294 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
14295 o, u, x, and X conversions, the number of digits to appear after the decimal-point
14296 character for a, A, e, E, f, and F conversions, the maximum number of significant
14297 digits for the g and G conversions, or the maximum number of bytes to be written for
14298 s conversions. The precision takes the form of a period (.) followed either by an
14299 asterisk * (described later) or by an optional decimal integer; if only the period is
14300 specified, the precision is taken as zero. If a precision appears with any other
14301 conversion specifier, the behavior is undefined.
14302 <li> An optional length modifier that specifies the size of the argument.
14303 <li> A conversion specifier character that specifies the type of conversion to be applied.
14304 </ul>
14305 <p><a name="7.19.6.1p5" href="#7.19.6.1p5"><small>5</small></a>
14306 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
14307 this case, an int argument supplies the field width or precision. The arguments
14308 specifying field width, or precision, or both, shall appear (in that order) before the
14309 argument (if any) to be converted. A negative field width argument is taken as a - flag
14310 followed by a positive field width. A negative precision argument is taken as if the
14311 precision were omitted.
14312 <p><a name="7.19.6.1p6" href="#7.19.6.1p6"><small>6</small></a>
14313 The flag characters and their meanings are:
14314 <dl>
14315 <dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
14316 this flag is not specified.)
14317 <dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
14318 begins with a sign only when a negative value is converted if this flag is not
14320 <!--page 288 -->
14321 specified.)<sup><a href="#note242"><b>242)</b></a></sup>
14322 <dt> space<dd> If the first character of a signed conversion is not a sign, or if a signed conversion
14323 results in no characters, a space is prefixed to the result. If the space and + flags
14324 both appear, the space flag is ignored.
14325 <dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
14326 the precision, if and only if necessary, to force the first digit of the result to be a
14327 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
14328 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
14329 and G conversions, the result of converting a floating-point number always
14330 contains a decimal-point character, even if no digits follow it. (Normally, a
14331 decimal-point character appears in the result of these conversions only if a digit
14332 follows it.) For g and G conversions, trailing zeros are not removed from the
14333 result. For other conversions, the behavior is undefined.
14334 <dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
14335 (following any indication of sign or base) are used to pad to the field width rather
14336 than performing space padding, except when converting an infinity or NaN. If the
14337 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
14338 conversions, if a precision is specified, the 0 flag is ignored. For other
14339 conversions, the behavior is undefined.
14340 </dl>
14341 <p><a name="7.19.6.1p7" href="#7.19.6.1p7"><small>7</small></a>
14342 The length modifiers and their meanings are:
14343 <dl>
14344 <dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14345 signed char or unsigned char argument (the argument will have
14346 been promoted according to the integer promotions, but its value shall be
14347 converted to signed char or unsigned char before printing); or that
14348 a following n conversion specifier applies to a pointer to a signed char
14349 argument.
14350 <dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14351 short int or unsigned short int argument (the argument will
14352 have been promoted according to the integer promotions, but its value shall
14353 be converted to short int or unsigned short int before printing);
14354 or that a following n conversion specifier applies to a pointer to a short
14355 int argument.
14356 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14357 long int or unsigned long int argument; that a following n
14358 conversion specifier applies to a pointer to a long int argument; that a
14359 <!--page 289 -->
14360 following c conversion specifier applies to a wint_t argument; that a
14361 following s conversion specifier applies to a pointer to a wchar_t
14362 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
14363 specifier.
14364 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14365 long long int or unsigned long long int argument; or that a
14366 following n conversion specifier applies to a pointer to a long long int
14367 argument.
14368 <dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
14369 an intmax_t or uintmax_t argument; or that a following n conversion
14370 specifier applies to a pointer to an intmax_t argument.
14371 <dt> z <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14372 size_t or the corresponding signed integer type argument; or that a
14373 following n conversion specifier applies to a pointer to a signed integer type
14374 corresponding to size_t argument.
14375 <dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
14376 ptrdiff_t or the corresponding unsigned integer type argument; or that a
14377 following n conversion specifier applies to a pointer to a ptrdiff_t
14378 argument.
14379 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
14380 applies to a long double argument.
14381 </dl>
14382 If a length modifier appears with any conversion specifier other than as specified above,
14383 the behavior is undefined.
14384 <p><a name="7.19.6.1p8" href="#7.19.6.1p8"><small>8</small></a>
14385 The conversion specifiers and their meanings are:
14386 <dl>
14387 <dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
14388 precision specifies the minimum number of digits to appear; if the value
14389 being converted can be represented in fewer digits, it is expanded with
14390 leading zeros. The default precision is 1. The result of converting a zero
14391 value with a precision of zero is no characters.
14392 <dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
14393 <!--page 290 -->
14394 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
14395 letters abcdef are used for x conversion and the letters ABCDEF for X
14396 conversion. The precision specifies the minimum number of digits to appear;
14397 if the value being converted can be represented in fewer digits, it is expanded
14398 with leading zeros. The default precision is 1. The result of converting a
14399 zero value with a precision of zero is no characters.
14400 <dt> f,F <dd> A double argument representing a floating-point number is converted to
14401 decimal notation in the style [-]ddd.ddd, where the number of digits after
14402 the decimal-point character is equal to the precision specification. If the
14403 precision is missing, it is taken as 6; if the precision is zero and the # flag is
14404 not specified, no decimal-point character appears. If a decimal-point
14405 character appears, at least one digit appears before it. The value is rounded to
14406 the appropriate number of digits.
14407 A double argument representing an infinity is converted in one of the styles
14408 [-]inf or [-]infinity -- which style is implementation-defined. A
14409 double argument representing a NaN is converted in one of the styles
14410 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
14411 any n-char-sequence, is implementation-defined. The F conversion specifier
14412 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
14413 respectively.<sup><a href="#note243"><b>243)</b></a></sup>
14414 <dt> e,E <dd> A double argument representing a floating-point number is converted in the
14415 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
14416 argument is nonzero) before the decimal-point character and the number of
14417 digits after it is equal to the precision; if the precision is missing, it is taken as
14418 6; if the precision is zero and the # flag is not specified, no decimal-point
14419 character appears. The value is rounded to the appropriate number of digits.
14420 The E conversion specifier produces a number with E instead of e
14421 introducing the exponent. The exponent always contains at least two digits,
14422 and only as many more digits as necessary to represent the exponent. If the
14423 value is zero, the exponent is zero.
14424 A double argument representing an infinity or NaN is converted in the style
14425 of an f or F conversion specifier.
14426 <dt> g,G <dd> A double argument representing a floating-point number is converted in
14427 style f or e (or in style F or E in the case of a G conversion specifier),
14428 depending on the value converted and the precision. Let P equal the
14429 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
14430 Then, if a conversion with style E would have an exponent of X :
14431 <ul>
14432 <li> if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
14433 P - (X + 1).
14434 <li> otherwise, the conversion is with style e (or E) and precision P - 1.
14435 </ul>
14436 Finally, unless the # flag is used, any trailing zeros are removed from the
14437 <!--page 291 -->
14438 fractional portion of the result and the decimal-point character is removed if
14439 there is no fractional portion remaining.
14440 A double argument representing an infinity or NaN is converted in the style
14441 of an f or F conversion specifier.
14442 <dt> a,A <dd> A double argument representing a floating-point number is converted in the
14443 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
14444 nonzero if the argument is a normalized floating-point number and is
14445 otherwise unspecified) before the decimal-point character<sup><a href="#note244"><b>244)</b></a></sup> and the number
14446 of hexadecimal digits after it is equal to the precision; if the precision is
14447 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
14448 an exact representation of the value; if the precision is missing and
14449 FLT_RADIX is not a power of 2, then the precision is sufficient to
14450 distinguish<sup><a href="#note245"><b>245)</b></a></sup> values of type double, except that trailing zeros may be
14451 omitted; if the precision is zero and the # flag is not specified, no decimal-
14452 point character appears. The letters abcdef are used for a conversion and
14453 the letters ABCDEF for A conversion. The A conversion specifier produces a
14454 number with X and P instead of x and p. The exponent always contains at
14455 least one digit, and only as many more digits as necessary to represent the
14456 decimal exponent of 2. If the value is zero, the exponent is zero.
14457 A double argument representing an infinity or NaN is converted in the style
14458 of an f or F conversion specifier.
14459 <dt> c <dd> If no l length modifier is present, the int argument is converted to an
14460 unsigned char, and the resulting character is written.
14461 If an l length modifier is present, the wint_t argument is converted as if by
14462 an ls conversion specification with no precision and an argument that points
14463 to the initial element of a two-element array of wchar_t, the first element
14464 containing the wint_t argument to the lc conversion specification and the
14465 second a null wide character.
14466 <dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
14467 element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are
14468 <!--page 292 -->
14469 written up to (but not including) the terminating null character. If the
14470 precision is specified, no more than that many bytes are written. If the
14471 precision is not specified or is greater than the size of the array, the array shall
14472 contain a null character.
14473 If an l length modifier is present, the argument shall be a pointer to the initial
14474 element of an array of wchar_t type. Wide characters from the array are
14475 converted to multibyte characters (each as if by a call to the wcrtomb
14476 function, with the conversion state described by an mbstate_t object
14477 initialized to zero before the first wide character is converted) up to and
14478 including a terminating null wide character. The resulting multibyte
14479 characters are written up to (but not including) the terminating null character
14480 (byte). If no precision is specified, the array shall contain a null wide
14481 character. If a precision is specified, no more than that many bytes are
14482 written (including shift sequences, if any), and the array shall contain a null
14483 wide character if, to equal the multibyte character sequence length given by
14484 the precision, the function would need to access a wide character one past the
14485 end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup>
14486 <dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
14487 converted to a sequence of printing characters, in an implementation-defined
14488 manner.
14489 <dt> n <dd> The argument shall be a pointer to signed integer into which is written the
14490 number of characters written to the output stream so far by this call to
14491 fprintf. No argument is converted, but one is consumed. If the conversion
14492 specification includes any flags, a field width, or a precision, the behavior is
14493 undefined.
14494 <dt> % <dd> A % character is written. No argument is converted. The complete
14495 conversion specification shall be %%.
14496 </dl>
14497 <p><a name="7.19.6.1p9" href="#7.19.6.1p9"><small>9</small></a>
14498 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note248"><b>248)</b></a></sup> If any argument is
14499 not the correct type for the corresponding conversion specification, the behavior is
14500 undefined.
14501 <p><a name="7.19.6.1p10" href="#7.19.6.1p10"><small>10</small></a>
14502 In no case does a nonexistent or small field width cause truncation of a field; if the result
14503 of a conversion is wider than the field width, the field is expanded to contain the
14504 conversion result.
14509 <!--page 293 -->
14510 <p><a name="7.19.6.1p11" href="#7.19.6.1p11"><small>11</small></a>
14511 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
14512 to a hexadecimal floating number with the given precision.
14513 <p><b>Recommended practice</b>
14514 <p><a name="7.19.6.1p12" href="#7.19.6.1p12"><small>12</small></a>
14515 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
14516 representable in the given precision, the result should be one of the two adjacent numbers
14517 in hexadecimal floating style with the given precision, with the extra stipulation that the
14518 error should have a correct sign for the current rounding direction.
14519 <p><a name="7.19.6.1p13" href="#7.19.6.1p13"><small>13</small></a>
14520 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
14521 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note249"><b>249)</b></a></sup> If the number of
14522 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
14523 representable with DECIMAL_DIG digits, then the result should be an exact
14524 representation with trailing zeros. Otherwise, the source value is bounded by two
14525 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
14526 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
14527 the error should have a correct sign for the current rounding direction.
14528 <p><b>Returns</b>
14529 <p><a name="7.19.6.1p14" href="#7.19.6.1p14"><small>14</small></a>
14530 The fprintf function returns the number of characters transmitted, or a negative value
14531 if an output or encoding error occurred.
14532 <p><b>Environmental limits</b>
14533 <p><a name="7.19.6.1p15" href="#7.19.6.1p15"><small>15</small></a>
14534 The number of characters that can be produced by any single conversion shall be at least
14535 4095.
14536 <p><a name="7.19.6.1p16" href="#7.19.6.1p16"><small>16</small></a>
14537 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
14538 places:
14539 <pre>
14540 #include <a href="#7.12">&lt;math.h&gt;</a>
14541 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14542 /* ... */
14543 char *weekday, *month; // pointers to strings
14544 int day, hour, min;
14545 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
14546 weekday, month, day, hour, min);
14547 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
14548 </pre>
14550 <p><a name="7.19.6.1p17" href="#7.19.6.1p17"><small>17</small></a>
14551 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
14552 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
14553 the first of which is denoted here by a and the second by an uppercase letter.
14558 <!--page 294 -->
14559 <p><a name="7.19.6.1p18" href="#7.19.6.1p18"><small>18</small></a>
14560 Given the following wide string with length seven,
14561 <pre>
14562 static wchar_t wstr[] = L" X Yabc Z W";
14563 </pre>
14564 the seven calls
14565 <pre>
14566 fprintf(stdout, "|1234567890123|\n");
14567 fprintf(stdout, "|%13ls|\n", wstr);
14568 fprintf(stdout, "|%-13.9ls|\n", wstr);
14569 fprintf(stdout, "|%13.10ls|\n", wstr);
14570 fprintf(stdout, "|%13.11ls|\n", wstr);
14571 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
14572 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
14573 </pre>
14574 will print the following seven lines:
14575 <pre>
14576 |1234567890123|
14577 | X Yabc Z W|
14578 | X Yabc Z |
14579 | X Yabc Z|
14580 | X Yabc Z W|
14581 | abc Z W|
14582 | Z|
14583 </pre>
14585 <p><b> Forward references</b>: conversion state (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
14587 <p><b>Footnotes</b>
14588 <p><small><a name="note241" href="#note241">241)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
14589 </small>
14590 <p><small><a name="note242" href="#note242">242)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
14591 include a minus sign.
14592 </small>
14593 <p><small><a name="note243" href="#note243">243)</a> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
14594 the # and 0 flag characters have no effect.
14595 </small>
14596 <p><small><a name="note244" href="#note244">244)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
14597 that subsequent digits align to nibble (4-bit) boundaries.
14598 </small>
14599 <p><small><a name="note245" href="#note245">245)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> &gt; b n where b is
14600 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
14601 might suffice depending on the implementation's scheme for determining the digit to the left of the
14602 decimal-point character.
14603 </small>
14604 <p><small><a name="note246" href="#note246">246)</a> No special provisions are made for multibyte characters.
14605 </small>
14606 <p><small><a name="note247" href="#note247">247)</a> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
14607 </small>
14608 <p><small><a name="note248" href="#note248">248)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
14609 </small>
14610 <p><small><a name="note249" href="#note249">249)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
14611 given format specifier. The number of significant digits is determined by the format specifier, and in
14612 the case of fixed-point conversion by the source value as well.
14613 </small>
14615 <p><small><a href="#Contents">Contents</a></small>
14616 <h5><a name="7.19.6.2" href="#7.19.6.2">7.19.6.2 The fscanf function</a></h5>
14617 <p><b>Synopsis</b>
14618 <p><a name="7.19.6.2p1" href="#7.19.6.2p1"><small>1</small></a>
14619 <pre>
14620 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14621 int fscanf(FILE * restrict stream,
14622 const char * restrict format, ...);
14623 </pre>
14624 <p><b>Description</b>
14625 <p><a name="7.19.6.2p2" href="#7.19.6.2p2"><small>2</small></a>
14626 The fscanf function reads input from the stream pointed to by stream, under control
14627 of the string pointed to by format that specifies the admissible input sequences and how
14628 they are to be converted for assignment, using subsequent arguments as pointers to the
14629 objects to receive the converted input. If there are insufficient arguments for the format,
14630 the behavior is undefined. If the format is exhausted while arguments remain, the excess
14631 arguments are evaluated (as always) but are otherwise ignored.
14632 <p><a name="7.19.6.2p3" href="#7.19.6.2p3"><small>3</small></a>
14633 The format shall be a multibyte character sequence, beginning and ending in its initial
14634 shift state. The format is composed of zero or more directives: one or more white-space
14635 characters, an ordinary multibyte character (neither % nor a white-space character), or a
14636 conversion specification. Each conversion specification is introduced by the character %.
14637 After the %, the following appear in sequence:
14638 <ul>
14639 <li> An optional assignment-suppressing character *.
14640 <li> An optional decimal integer greater than zero that specifies the maximum field width
14641 (in characters).
14642 <!--page 295 -->
14643 <li> An optional length modifier that specifies the size of the receiving object.
14644 <li> A conversion specifier character that specifies the type of conversion to be applied.
14645 </ul>
14646 <p><a name="7.19.6.2p4" href="#7.19.6.2p4"><small>4</small></a>
14647 The fscanf function executes each directive of the format in turn. If a directive fails, as
14648 detailed below, the function returns. Failures are described as input failures (due to the
14649 occurrence of an encoding error or the unavailability of input characters), or matching
14650 failures (due to inappropriate input).
14651 <p><a name="7.19.6.2p5" href="#7.19.6.2p5"><small>5</small></a>
14652 A directive composed of white-space character(s) is executed by reading input up to the
14653 first non-white-space character (which remains unread), or until no more characters can
14654 be read.
14655 <p><a name="7.19.6.2p6" href="#7.19.6.2p6"><small>6</small></a>
14656 A directive that is an ordinary multibyte character is executed by reading the next
14657 characters of the stream. If any of those characters differ from the ones composing the
14658 directive, the directive fails and the differing and subsequent characters remain unread.
14659 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
14660 read, the directive fails.
14661 <p><a name="7.19.6.2p7" href="#7.19.6.2p7"><small>7</small></a>
14662 A directive that is a conversion specification defines a set of matching input sequences, as
14663 described below for each specifier. A conversion specification is executed in the
14664 following steps:
14665 <p><a name="7.19.6.2p8" href="#7.19.6.2p8"><small>8</small></a>
14666 Input white-space characters (as specified by the isspace function) are skipped, unless
14667 the specification includes a [, c, or n specifier.<sup><a href="#note250"><b>250)</b></a></sup>
14668 <p><a name="7.19.6.2p9" href="#7.19.6.2p9"><small>9</small></a>
14669 An input item is read from the stream, unless the specification includes an n specifier. An
14670 input item is defined as the longest sequence of input characters which does not exceed
14671 any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note251"><b>251)</b></a></sup>
14672 The first character, if any, after the input item remains unread. If the length of the input
14673 item is zero, the execution of the directive fails; this condition is a matching failure unless
14674 end-of-file, an encoding error, or a read error prevented input from the stream, in which
14675 case it is an input failure.
14676 <p><a name="7.19.6.2p10" href="#7.19.6.2p10"><small>10</small></a>
14677 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
14678 count of input characters) is converted to a type appropriate to the conversion specifier. If
14679 the input item is not a matching sequence, the execution of the directive fails: this
14680 condition is a matching failure. Unless assignment suppression was indicated by a *, the
14681 result of the conversion is placed in the object pointed to by the first argument following
14682 the format argument that has not already received a conversion result. If this object
14683 does not have an appropriate type, or if the result of the conversion cannot be represented
14686 <!--page 296 -->
14687 in the object, the behavior is undefined.
14688 <p><a name="7.19.6.2p11" href="#7.19.6.2p11"><small>11</small></a>
14689 The length modifiers and their meanings are:
14690 <dl>
14691 <dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14692 to an argument with type pointer to signed char or unsigned char.
14693 <dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14694 to an argument with type pointer to short int or unsigned short
14695 int.
14696 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14697 to an argument with type pointer to long int or unsigned long
14698 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
14699 an argument with type pointer to double; or that a following c, s, or [
14700 conversion specifier applies to an argument with type pointer to wchar_t.
14701 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14702 to an argument with type pointer to long long int or unsigned
14703 long long int.
14704 <dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14705 to an argument with type pointer to intmax_t or uintmax_t.
14706 <dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14707 to an argument with type pointer to size_t or the corresponding signed
14708 integer type.
14709 <dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14710 to an argument with type pointer to ptrdiff_t or the corresponding
14711 unsigned integer type.
14712 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
14713 applies to an argument with type pointer to long double.
14714 </dl>
14715 If a length modifier appears with any conversion specifier other than as specified above,
14716 the behavior is undefined.
14717 <p><a name="7.19.6.2p12" href="#7.19.6.2p12"><small>12</small></a>
14718 The conversion specifiers and their meanings are:
14719 <dl>
14720 <dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
14721 expected for the subject sequence of the strtol function with the value 10
14722 for the base argument. The corresponding argument shall be a pointer to
14723 signed integer.
14724 <dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
14725 <!--page 297 -->
14726 for the subject sequence of the strtol function with the value 0 for the
14727 base argument. The corresponding argument shall be a pointer to signed
14728 integer.
14729 <dt> o <dd> Matches an optionally signed octal integer, whose format is the same as
14730 expected for the subject sequence of the strtoul function with the value 8
14731 for the base argument. The corresponding argument shall be a pointer to
14732 unsigned integer.
14733 <dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
14734 expected for the subject sequence of the strtoul function with the value 10
14735 for the base argument. The corresponding argument shall be a pointer to
14736 unsigned integer.
14737 <dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
14738 as expected for the subject sequence of the strtoul function with the value
14739 16 for the base argument. The corresponding argument shall be a pointer to
14740 unsigned integer.
14741 <dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
14742 format is the same as expected for the subject sequence of the strtod
14743 function. The corresponding argument shall be a pointer to floating.
14744 <dt> c <dd> Matches a sequence of characters of exactly the number specified by the field
14745 width (1 if no field width is present in the directive).<sup><a href="#note252"><b>252)</b></a></sup>
14746 If no l length modifier is present, the corresponding argument shall be a
14747 pointer to the initial element of a character array large enough to accept the
14748 sequence. No null character is added.
14749 If an l length modifier is present, the input shall be a sequence of multibyte
14750 characters that begins in the initial shift state. Each multibyte character in the
14751 sequence is converted to a wide character as if by a call to the mbrtowc
14752 function, with the conversion state described by an mbstate_t object
14753 initialized to zero before the first multibyte character is converted. The
14754 corresponding argument shall be a pointer to the initial element of an array of
14755 wchar_t large enough to accept the resulting sequence of wide characters.
14756 No null wide character is added.
14757 <dt> s <dd> Matches a sequence of non-white-space characters.<sup><a href="#note252"><b>252)</b></a></sup>
14758 If no l length modifier is present, the corresponding argument shall be a
14759 pointer to the initial element of a character array large enough to accept the
14760 sequence and a terminating null character, which will be added automatically.
14761 If an l length modifier is present, the input shall be a sequence of multibyte
14762 <!--page 298 -->
14763 characters that begins in the initial shift state. Each multibyte character is
14764 converted to a wide character as if by a call to the mbrtowc function, with
14765 the conversion state described by an mbstate_t object initialized to zero
14766 before the first multibyte character is converted. The corresponding argument
14767 shall be a pointer to the initial element of an array of wchar_t large enough
14768 to accept the sequence and the terminating null wide character, which will be
14769 added automatically.
14770 <dt> [ <dd> Matches a nonempty sequence of characters from a set of expected characters
14771 (the scanset).<sup><a href="#note252"><b>252)</b></a></sup>
14772 If no l length modifier is present, the corresponding argument shall be a
14773 pointer to the initial element of a character array large enough to accept the
14774 sequence and a terminating null character, which will be added automatically.
14775 If an l length modifier is present, the input shall be a sequence of multibyte
14776 characters that begins in the initial shift state. Each multibyte character is
14777 converted to a wide character as if by a call to the mbrtowc function, with
14778 the conversion state described by an mbstate_t object initialized to zero
14779 before the first multibyte character is converted. The corresponding argument
14780 shall be a pointer to the initial element of an array of wchar_t large enough
14781 to accept the sequence and the terminating null wide character, which will be
14782 added automatically.
14783 The conversion specifier includes all subsequent characters in the format
14784 string, up to and including the matching right bracket (]). The characters
14785 between the brackets (the scanlist) compose the scanset, unless the character
14786 after the left bracket is a circumflex (^), in which case the scanset contains all
14787 characters that do not appear in the scanlist between the circumflex and the
14788 right bracket. If the conversion specifier begins with [] or [^], the right
14789 bracket character is in the scanlist and the next following right bracket
14790 character is the matching right bracket that ends the specification; otherwise
14791 the first following right bracket character is the one that ends the
14792 specification. If a - character is in the scanlist and is not the first, nor the
14793 second where the first character is a ^, nor the last character, the behavior is
14794 implementation-defined.
14795 <dt> p <dd> Matches an implementation-defined set of sequences, which should be the
14796 <!--page 299 -->
14797 same as the set of sequences that may be produced by the %p conversion of
14798 the fprintf function. The corresponding argument shall be a pointer to a
14799 pointer to void. The input item is converted to a pointer value in an
14800 implementation-defined manner. If the input item is a value converted earlier
14801 during the same program execution, the pointer that results shall compare
14802 equal to that value; otherwise the behavior of the %p conversion is undefined.
14803 <dt> n <dd> No input is consumed. The corresponding argument shall be a pointer to
14804 signed integer into which is to be written the number of characters read from
14805 the input stream so far by this call to the fscanf function. Execution of a
14806 %n directive does not increment the assignment count returned at the
14807 completion of execution of the fscanf function. No argument is converted,
14808 but one is consumed. If the conversion specification includes an assignment-
14809 suppressing character or a field width, the behavior is undefined.
14810 <dt> % <dd> Matches a single % character; no conversion or assignment occurs. The
14811 complete conversion specification shall be %%.
14812 </dl>
14813 <p><a name="7.19.6.2p13" href="#7.19.6.2p13"><small>13</small></a>
14814 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note253"><b>253)</b></a></sup>
14815 <p><a name="7.19.6.2p14" href="#7.19.6.2p14"><small>14</small></a>
14816 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
14817 respectively, a, e, f, g, and x.
14818 <p><a name="7.19.6.2p15" href="#7.19.6.2p15"><small>15</small></a>
14819 Trailing white space (including new-line characters) is left unread unless matched by a
14820 directive. The success of literal matches and suppressed assignments is not directly
14821 determinable other than via the %n directive.
14822 <p><b>Returns</b>
14823 <p><a name="7.19.6.2p16" href="#7.19.6.2p16"><small>16</small></a>
14824 The fscanf function returns the value of the macro EOF if an input failure occurs
14825 before any conversion. Otherwise, the function returns the number of input items
14826 assigned, which can be fewer than provided for, or even zero, in the event of an early
14827 matching failure.
14828 <p><a name="7.19.6.2p17" href="#7.19.6.2p17"><small>17</small></a>
14829 EXAMPLE 1 The call:
14830 <pre>
14831 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14832 /* ... */
14833 int n, i; float x; char name[50];
14834 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
14835 </pre>
14836 with the input line:
14837 <pre>
14838 25 54.32E-1 thompson
14839 </pre>
14840 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
14841 thompson\0.
14843 <p><a name="7.19.6.2p18" href="#7.19.6.2p18"><small>18</small></a>
14844 EXAMPLE 2 The call:
14845 <pre>
14846 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14847 /* ... */
14848 int i; float x; char name[50];
14849 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
14850 </pre>
14851 with input:
14855 <!--page 300 -->
14856 <pre>
14857 56789 0123 56a72
14858 </pre>
14859 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
14860 sequence 56\0. The next character read from the input stream will be a.
14862 <p><a name="7.19.6.2p19" href="#7.19.6.2p19"><small>19</small></a>
14863 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
14864 <pre>
14865 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14866 /* ... */
14867 int count; float quant; char units[21], item[21];
14868 do {
14869 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
14870 fscanf(stdin,"%*[^\n]");
14871 } while (!feof(stdin) &amp;&amp; !ferror(stdin));
14872 </pre>
14873 <p><a name="7.19.6.2p20" href="#7.19.6.2p20"><small>20</small></a>
14874 If the stdin stream contains the following lines:
14875 <pre>
14876 2 quarts of oil
14877 -12.8degrees Celsius
14878 lots of luck
14879 10.0LBS of
14880 dirt
14881 100ergs of energy
14882 </pre>
14883 the execution of the above example will be analogous to the following assignments:
14884 <pre>
14885 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
14886 count = 3;
14887 quant = -12.8; strcpy(units, "degrees");
14888 count = 2; // "C" fails to match "o"
14889 count = 0; // "l" fails to match "%f"
14890 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
14891 count = 3;
14892 count = 0; // "100e" fails to match "%f"
14893 count = EOF;
14894 </pre>
14896 <p><a name="7.19.6.2p21" href="#7.19.6.2p21"><small>21</small></a>
14897 EXAMPLE 4 In:
14898 <pre>
14899 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14900 /* ... */
14901 int d1, d2, n1, n2, i;
14902 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
14903 </pre>
14904 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
14905 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
14907 <p><a name="7.19.6.2p22" href="#7.19.6.2p22"><small>22</small></a>
14908 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
14909 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
14910 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
14911 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
14912 entry into the alternate shift state.
14913 <p><a name="7.19.6.2p23" href="#7.19.6.2p23"><small>23</small></a>
14914 After the call:
14915 <!--page 301 -->
14916 <pre>
14917 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14918 /* ... */
14919 char str[50];
14920 fscanf(stdin, "a%s", str);
14921 </pre>
14922 with the input line:
14923 <pre>
14924 a(uparrow) X Y(downarrow) bc
14925 </pre>
14926 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
14927 characters, in the more general case) appears to be a single-byte white-space character.
14928 <p><a name="7.19.6.2p24" href="#7.19.6.2p24"><small>24</small></a>
14929 In contrast, after the call:
14930 <pre>
14931 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14932 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14933 /* ... */
14934 wchar_t wstr[50];
14935 fscanf(stdin, "a%ls", wstr);
14936 </pre>
14937 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
14938 terminating null wide character.
14939 <p><a name="7.19.6.2p25" href="#7.19.6.2p25"><small>25</small></a>
14940 However, the call:
14941 <pre>
14942 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14943 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14944 /* ... */
14945 wchar_t wstr[50];
14946 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
14947 </pre>
14948 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
14949 string.
14950 <p><a name="7.19.6.2p26" href="#7.19.6.2p26"><small>26</small></a>
14951 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
14952 character Y, after the call:
14953 <pre>
14954 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14955 #include <a href="#7.17">&lt;stddef.h&gt;</a>
14956 /* ... */
14957 wchar_t wstr[50];
14958 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
14959 </pre>
14960 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
14961 multibyte character.
14963 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>), the
14964 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.20.1.4">7.20.1.4</a>), conversion state
14965 (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
14966 <!--page 302 -->
14968 <p><b>Footnotes</b>
14969 <p><small><a name="note250" href="#note250">250)</a> These white-space characters are not counted against a specified field width.
14970 </small>
14971 <p><small><a name="note251" href="#note251">251)</a> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
14972 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
14973 </small>
14974 <p><small><a name="note252" href="#note252">252)</a> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
14975 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
14976 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
14977 </small>
14978 <p><small><a name="note253" href="#note253">253)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
14979 </small>
14981 <p><small><a href="#Contents">Contents</a></small>
14982 <h5><a name="7.19.6.3" href="#7.19.6.3">7.19.6.3 The printf function</a></h5>
14983 <p><b>Synopsis</b>
14984 <p><a name="7.19.6.3p1" href="#7.19.6.3p1"><small>1</small></a>
14985 <pre>
14986 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14987 int printf(const char * restrict format, ...);
14988 </pre>
14989 <p><b>Description</b>
14990 <p><a name="7.19.6.3p2" href="#7.19.6.3p2"><small>2</small></a>
14991 The printf function is equivalent to fprintf with the argument stdout interposed
14992 before the arguments to printf.
14993 <p><b>Returns</b>
14994 <p><a name="7.19.6.3p3" href="#7.19.6.3p3"><small>3</small></a>
14995 The printf function returns the number of characters transmitted, or a negative value if
14996 an output or encoding error occurred.
14998 <p><small><a href="#Contents">Contents</a></small>
14999 <h5><a name="7.19.6.4" href="#7.19.6.4">7.19.6.4 The scanf function</a></h5>
15000 <p><b>Synopsis</b>
15001 <p><a name="7.19.6.4p1" href="#7.19.6.4p1"><small>1</small></a>
15002 <pre>
15003 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15004 int scanf(const char * restrict format, ...);
15005 </pre>
15006 <p><b>Description</b>
15007 <p><a name="7.19.6.4p2" href="#7.19.6.4p2"><small>2</small></a>
15008 The scanf function is equivalent to fscanf with the argument stdin interposed
15009 before the arguments to scanf.
15010 <p><b>Returns</b>
15011 <p><a name="7.19.6.4p3" href="#7.19.6.4p3"><small>3</small></a>
15012 The scanf function returns the value of the macro EOF if an input failure occurs before
15013 any conversion. Otherwise, the scanf function returns the number of input items
15014 assigned, which can be fewer than provided for, or even zero, in the event of an early
15015 matching failure.
15017 <p><small><a href="#Contents">Contents</a></small>
15018 <h5><a name="7.19.6.5" href="#7.19.6.5">7.19.6.5 The snprintf function</a></h5>
15019 <p><b>Synopsis</b>
15020 <p><a name="7.19.6.5p1" href="#7.19.6.5p1"><small>1</small></a>
15021 <pre>
15022 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15023 int snprintf(char * restrict s, size_t n,
15024 const char * restrict format, ...);
15025 </pre>
15026 <p><b>Description</b>
15027 <p><a name="7.19.6.5p2" href="#7.19.6.5p2"><small>2</small></a>
15028 The snprintf function is equivalent to fprintf, except that the output is written into
15029 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
15030 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
15031 discarded rather than being written to the array, and a null character is written at the end
15032 of the characters actually written into the array. If copying takes place between objects
15033 that overlap, the behavior is undefined.
15034 <!--page 303 -->
15035 <p><b>Returns</b>
15036 <p><a name="7.19.6.5p3" href="#7.19.6.5p3"><small>3</small></a>
15037 The snprintf function returns the number of characters that would have been written
15038 had n been sufficiently large, not counting the terminating null character, or a negative
15039 value if an encoding error occurred. Thus, the null-terminated output has been
15040 completely written if and only if the returned value is nonnegative and less than n.
15042 <p><small><a href="#Contents">Contents</a></small>
15043 <h5><a name="7.19.6.6" href="#7.19.6.6">7.19.6.6 The sprintf function</a></h5>
15044 <p><b>Synopsis</b>
15045 <p><a name="7.19.6.6p1" href="#7.19.6.6p1"><small>1</small></a>
15046 <pre>
15047 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15048 int sprintf(char * restrict s,
15049 const char * restrict format, ...);
15050 </pre>
15051 <p><b>Description</b>
15052 <p><a name="7.19.6.6p2" href="#7.19.6.6p2"><small>2</small></a>
15053 The sprintf function is equivalent to fprintf, except that the output is written into
15054 an array (specified by the argument s) rather than to a stream. A null character is written
15055 at the end of the characters written; it is not counted as part of the returned value. If
15056 copying takes place between objects that overlap, the behavior is undefined.
15057 <p><b>Returns</b>
15058 <p><a name="7.19.6.6p3" href="#7.19.6.6p3"><small>3</small></a>
15059 The sprintf function returns the number of characters written in the array, not
15060 counting the terminating null character, or a negative value if an encoding error occurred.
15062 <p><small><a href="#Contents">Contents</a></small>
15063 <h5><a name="7.19.6.7" href="#7.19.6.7">7.19.6.7 The sscanf function</a></h5>
15064 <p><b>Synopsis</b>
15065 <p><a name="7.19.6.7p1" href="#7.19.6.7p1"><small>1</small></a>
15066 <pre>
15067 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15068 int sscanf(const char * restrict s,
15069 const char * restrict format, ...);
15070 </pre>
15071 <p><b>Description</b>
15072 <p><a name="7.19.6.7p2" href="#7.19.6.7p2"><small>2</small></a>
15073 The sscanf function is equivalent to fscanf, except that input is obtained from a
15074 string (specified by the argument s) rather than from a stream. Reaching the end of the
15075 string is equivalent to encountering end-of-file for the fscanf function. If copying
15076 takes place between objects that overlap, the behavior is undefined.
15077 <p><b>Returns</b>
15078 <p><a name="7.19.6.7p3" href="#7.19.6.7p3"><small>3</small></a>
15079 The sscanf function returns the value of the macro EOF if an input failure occurs
15080 before any conversion. Otherwise, the sscanf function returns the number of input
15081 items assigned, which can be fewer than provided for, or even zero, in the event of an
15082 early matching failure.
15083 <!--page 304 -->
15085 <p><small><a href="#Contents">Contents</a></small>
15086 <h5><a name="7.19.6.8" href="#7.19.6.8">7.19.6.8 The vfprintf function</a></h5>
15087 <p><b>Synopsis</b>
15088 <p><a name="7.19.6.8p1" href="#7.19.6.8p1"><small>1</small></a>
15089 <pre>
15090 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15091 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15092 int vfprintf(FILE * restrict stream,
15093 const char * restrict format,
15094 va_list arg);
15095 </pre>
15096 <p><b>Description</b>
15097 <p><a name="7.19.6.8p2" href="#7.19.6.8p2"><small>2</small></a>
15098 The vfprintf function is equivalent to fprintf, with the variable argument list
15099 replaced by arg, which shall have been initialized by the va_start macro (and
15100 possibly subsequent va_arg calls). The vfprintf function does not invoke the
15101 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
15102 <p><b>Returns</b>
15103 <p><a name="7.19.6.8p3" href="#7.19.6.8p3"><small>3</small></a>
15104 The vfprintf function returns the number of characters transmitted, or a negative
15105 value if an output or encoding error occurred.
15106 <p><a name="7.19.6.8p4" href="#7.19.6.8p4"><small>4</small></a>
15107 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
15108 <pre>
15109 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15110 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15111 void error(char *function_name, char *format, ...)
15113 va_list args;
15114 va_start(args, format);
15115 // print out name of function causing error
15116 fprintf(stderr, "ERROR in %s: ", function_name);
15117 // print out remainder of message
15118 vfprintf(stderr, format, args);
15119 va_end(args);
15121 </pre>
15126 <!--page 305 -->
15128 <p><b>Footnotes</b>
15129 <p><small><a name="note254" href="#note254">254)</a> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
15130 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
15131 </small>
15133 <p><small><a href="#Contents">Contents</a></small>
15134 <h5><a name="7.19.6.9" href="#7.19.6.9">7.19.6.9 The vfscanf function</a></h5>
15135 <p><b>Synopsis</b>
15136 <p><a name="7.19.6.9p1" href="#7.19.6.9p1"><small>1</small></a>
15137 <pre>
15138 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15139 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15140 int vfscanf(FILE * restrict stream,
15141 const char * restrict format,
15142 va_list arg);
15143 </pre>
15144 <p><b>Description</b>
15145 <p><a name="7.19.6.9p2" href="#7.19.6.9p2"><small>2</small></a>
15146 The vfscanf function is equivalent to fscanf, with the variable argument list
15147 replaced by arg, which shall have been initialized by the va_start macro (and
15148 possibly subsequent va_arg calls). The vfscanf function does not invoke the
15149 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
15150 <p><b>Returns</b>
15151 <p><a name="7.19.6.9p3" href="#7.19.6.9p3"><small>3</small></a>
15152 The vfscanf function returns the value of the macro EOF if an input failure occurs
15153 before any conversion. Otherwise, the vfscanf function returns the number of input
15154 items assigned, which can be fewer than provided for, or even zero, in the event of an
15155 early matching failure.
15157 <p><small><a href="#Contents">Contents</a></small>
15158 <h5><a name="7.19.6.10" href="#7.19.6.10">7.19.6.10 The vprintf function</a></h5>
15159 <p><b>Synopsis</b>
15160 <p><a name="7.19.6.10p1" href="#7.19.6.10p1"><small>1</small></a>
15161 <pre>
15162 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15163 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15164 int vprintf(const char * restrict format,
15165 va_list arg);
15166 </pre>
15167 <p><b>Description</b>
15168 <p><a name="7.19.6.10p2" href="#7.19.6.10p2"><small>2</small></a>
15169 The vprintf function is equivalent to printf, with the variable argument list
15170 replaced by arg, which shall have been initialized by the va_start macro (and
15171 possibly subsequent va_arg calls). The vprintf function does not invoke the
15172 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
15173 <p><b>Returns</b>
15174 <p><a name="7.19.6.10p3" href="#7.19.6.10p3"><small>3</small></a>
15175 The vprintf function returns the number of characters transmitted, or a negative value
15176 if an output or encoding error occurred.
15177 <!--page 306 -->
15179 <p><small><a href="#Contents">Contents</a></small>
15180 <h5><a name="7.19.6.11" href="#7.19.6.11">7.19.6.11 The vscanf function</a></h5>
15181 <p><b>Synopsis</b>
15182 <p><a name="7.19.6.11p1" href="#7.19.6.11p1"><small>1</small></a>
15183 <pre>
15184 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15185 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15186 int vscanf(const char * restrict format,
15187 va_list arg);
15188 </pre>
15189 <p><b>Description</b>
15190 <p><a name="7.19.6.11p2" href="#7.19.6.11p2"><small>2</small></a>
15191 The vscanf function is equivalent to scanf, with the variable argument list replaced
15192 by arg, which shall have been initialized by the va_start macro (and possibly
15193 subsequent va_arg calls). The vscanf function does not invoke the va_end
15194 macro.<sup><a href="#note254"><b>254)</b></a></sup>
15195 <p><b>Returns</b>
15196 <p><a name="7.19.6.11p3" href="#7.19.6.11p3"><small>3</small></a>
15197 The vscanf function returns the value of the macro EOF if an input failure occurs
15198 before any conversion. Otherwise, the vscanf function returns the number of input
15199 items assigned, which can be fewer than provided for, or even zero, in the event of an
15200 early matching failure.
15202 <p><small><a href="#Contents">Contents</a></small>
15203 <h5><a name="7.19.6.12" href="#7.19.6.12">7.19.6.12 The vsnprintf function</a></h5>
15204 <p><b>Synopsis</b>
15205 <p><a name="7.19.6.12p1" href="#7.19.6.12p1"><small>1</small></a>
15206 <pre>
15207 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15208 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15209 int vsnprintf(char * restrict s, size_t n,
15210 const char * restrict format,
15211 va_list arg);
15212 </pre>
15213 <p><b>Description</b>
15214 <p><a name="7.19.6.12p2" href="#7.19.6.12p2"><small>2</small></a>
15215 The vsnprintf function is equivalent to snprintf, with the variable argument list
15216 replaced by arg, which shall have been initialized by the va_start macro (and
15217 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
15218 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
15219 undefined.
15220 <p><b>Returns</b>
15221 <p><a name="7.19.6.12p3" href="#7.19.6.12p3"><small>3</small></a>
15222 The vsnprintf function returns the number of characters that would have been written
15223 had n been sufficiently large, not counting the terminating null character, or a negative
15224 value if an encoding error occurred. Thus, the null-terminated output has been
15225 completely written if and only if the returned value is nonnegative and less than n.
15226 <!--page 307 -->
15228 <p><small><a href="#Contents">Contents</a></small>
15229 <h5><a name="7.19.6.13" href="#7.19.6.13">7.19.6.13 The vsprintf function</a></h5>
15230 <p><b>Synopsis</b>
15231 <p><a name="7.19.6.13p1" href="#7.19.6.13p1"><small>1</small></a>
15232 <pre>
15233 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15234 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15235 int vsprintf(char * restrict s,
15236 const char * restrict format,
15237 va_list arg);
15238 </pre>
15239 <p><b>Description</b>
15240 <p><a name="7.19.6.13p2" href="#7.19.6.13p2"><small>2</small></a>
15241 The vsprintf function is equivalent to sprintf, with the variable argument list
15242 replaced by arg, which shall have been initialized by the va_start macro (and
15243 possibly subsequent va_arg calls). The vsprintf function does not invoke the
15244 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
15245 undefined.
15246 <p><b>Returns</b>
15247 <p><a name="7.19.6.13p3" href="#7.19.6.13p3"><small>3</small></a>
15248 The vsprintf function returns the number of characters written in the array, not
15249 counting the terminating null character, or a negative value if an encoding error occurred.
15251 <p><small><a href="#Contents">Contents</a></small>
15252 <h5><a name="7.19.6.14" href="#7.19.6.14">7.19.6.14 The vsscanf function</a></h5>
15253 <p><b>Synopsis</b>
15254 <p><a name="7.19.6.14p1" href="#7.19.6.14p1"><small>1</small></a>
15255 <pre>
15256 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
15257 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15258 int vsscanf(const char * restrict s,
15259 const char * restrict format,
15260 va_list arg);
15261 </pre>
15262 <p><b>Description</b>
15263 <p><a name="7.19.6.14p2" href="#7.19.6.14p2"><small>2</small></a>
15264 The vsscanf function is equivalent to sscanf, with the variable argument list
15265 replaced by arg, which shall have been initialized by the va_start macro (and
15266 possibly subsequent va_arg calls). The vsscanf function does not invoke the
15267 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
15268 <p><b>Returns</b>
15269 <p><a name="7.19.6.14p3" href="#7.19.6.14p3"><small>3</small></a>
15270 The vsscanf function returns the value of the macro EOF if an input failure occurs
15271 before any conversion. Otherwise, the vsscanf function returns the number of input
15272 items assigned, which can be fewer than provided for, or even zero, in the event of an
15273 early matching failure.
15274 <!--page 308 -->
15276 <p><small><a href="#Contents">Contents</a></small>
15277 <h4><a name="7.19.7" href="#7.19.7">7.19.7 Character input/output functions</a></h4>
15279 <p><small><a href="#Contents">Contents</a></small>
15280 <h5><a name="7.19.7.1" href="#7.19.7.1">7.19.7.1 The fgetc function</a></h5>
15281 <p><b>Synopsis</b>
15282 <p><a name="7.19.7.1p1" href="#7.19.7.1p1"><small>1</small></a>
15283 <pre>
15284 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15285 int fgetc(FILE *stream);
15286 </pre>
15287 <p><b>Description</b>
15288 <p><a name="7.19.7.1p2" href="#7.19.7.1p2"><small>2</small></a>
15289 If the end-of-file indicator for the input stream pointed to by stream is not set and a
15290 next character is present, the fgetc function obtains that character as an unsigned
15291 char converted to an int and advances the associated file position indicator for the
15292 stream (if defined).
15293 <p><b>Returns</b>
15294 <p><a name="7.19.7.1p3" href="#7.19.7.1p3"><small>3</small></a>
15295 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
15296 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
15297 fgetc function returns the next character from the input stream pointed to by stream.
15298 If a read error occurs, the error indicator for the stream is set and the fgetc function
15299 returns EOF.<sup><a href="#note255"><b>255)</b></a></sup>
15301 <p><b>Footnotes</b>
15302 <p><small><a name="note255" href="#note255">255)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
15303 </small>
15305 <p><small><a href="#Contents">Contents</a></small>
15306 <h5><a name="7.19.7.2" href="#7.19.7.2">7.19.7.2 The fgets function</a></h5>
15307 <p><b>Synopsis</b>
15308 <p><a name="7.19.7.2p1" href="#7.19.7.2p1"><small>1</small></a>
15309 <pre>
15310 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15311 char *fgets(char * restrict s, int n,
15312 FILE * restrict stream);
15313 </pre>
15314 <p><b>Description</b>
15315 <p><a name="7.19.7.2p2" href="#7.19.7.2p2"><small>2</small></a>
15316 The fgets function reads at most one less than the number of characters specified by n
15317 from the stream pointed to by stream into the array pointed to by s. No additional
15318 characters are read after a new-line character (which is retained) or after end-of-file. A
15319 null character is written immediately after the last character read into the array.
15320 <p><b>Returns</b>
15321 <p><a name="7.19.7.2p3" href="#7.19.7.2p3"><small>3</small></a>
15322 The fgets function returns s if successful. If end-of-file is encountered and no
15323 characters have been read into the array, the contents of the array remain unchanged and a
15324 null pointer is returned. If a read error occurs during the operation, the array contents are
15325 indeterminate and a null pointer is returned.
15330 <!--page 309 -->
15332 <p><small><a href="#Contents">Contents</a></small>
15333 <h5><a name="7.19.7.3" href="#7.19.7.3">7.19.7.3 The fputc function</a></h5>
15334 <p><b>Synopsis</b>
15335 <p><a name="7.19.7.3p1" href="#7.19.7.3p1"><small>1</small></a>
15336 <pre>
15337 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15338 int fputc(int c, FILE *stream);
15339 </pre>
15340 <p><b>Description</b>
15341 <p><a name="7.19.7.3p2" href="#7.19.7.3p2"><small>2</small></a>
15342 The fputc function writes the character specified by c (converted to an unsigned
15343 char) to the output stream pointed to by stream, at the position indicated by the
15344 associated file position indicator for the stream (if defined), and advances the indicator
15345 appropriately. If the file cannot support positioning requests, or if the stream was opened
15346 with append mode, the character is appended to the output stream.
15347 <p><b>Returns</b>
15348 <p><a name="7.19.7.3p3" href="#7.19.7.3p3"><small>3</small></a>
15349 The fputc function returns the character written. If a write error occurs, the error
15350 indicator for the stream is set and fputc returns EOF.
15352 <p><small><a href="#Contents">Contents</a></small>
15353 <h5><a name="7.19.7.4" href="#7.19.7.4">7.19.7.4 The fputs function</a></h5>
15354 <p><b>Synopsis</b>
15355 <p><a name="7.19.7.4p1" href="#7.19.7.4p1"><small>1</small></a>
15356 <pre>
15357 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15358 int fputs(const char * restrict s,
15359 FILE * restrict stream);
15360 </pre>
15361 <p><b>Description</b>
15362 <p><a name="7.19.7.4p2" href="#7.19.7.4p2"><small>2</small></a>
15363 The fputs function writes the string pointed to by s to the stream pointed to by
15364 stream. The terminating null character is not written.
15365 <p><b>Returns</b>
15366 <p><a name="7.19.7.4p3" href="#7.19.7.4p3"><small>3</small></a>
15367 The fputs function returns EOF if a write error occurs; otherwise it returns a
15368 nonnegative value.
15370 <p><small><a href="#Contents">Contents</a></small>
15371 <h5><a name="7.19.7.5" href="#7.19.7.5">7.19.7.5 The getc function</a></h5>
15372 <p><b>Synopsis</b>
15373 <p><a name="7.19.7.5p1" href="#7.19.7.5p1"><small>1</small></a>
15374 <pre>
15375 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15376 int getc(FILE *stream);
15377 </pre>
15378 <p><b>Description</b>
15379 <p><a name="7.19.7.5p2" href="#7.19.7.5p2"><small>2</small></a>
15380 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
15381 may evaluate stream more than once, so the argument should never be an expression
15382 with side effects.
15383 <!--page 310 -->
15384 <p><b>Returns</b>
15385 <p><a name="7.19.7.5p3" href="#7.19.7.5p3"><small>3</small></a>
15386 The getc function returns the next character from the input stream pointed to by
15387 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
15388 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
15389 getc returns EOF.
15391 <p><small><a href="#Contents">Contents</a></small>
15392 <h5><a name="7.19.7.6" href="#7.19.7.6">7.19.7.6 The getchar function</a></h5>
15393 <p><b>Synopsis</b>
15394 <p><a name="7.19.7.6p1" href="#7.19.7.6p1"><small>1</small></a>
15395 <pre>
15396 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15397 int getchar(void);
15398 </pre>
15399 <p><b>Description</b>
15400 <p><a name="7.19.7.6p2" href="#7.19.7.6p2"><small>2</small></a>
15401 The getchar function is equivalent to getc with the argument stdin.
15402 <p><b>Returns</b>
15403 <p><a name="7.19.7.6p3" href="#7.19.7.6p3"><small>3</small></a>
15404 The getchar function returns the next character from the input stream pointed to by
15405 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
15406 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
15407 getchar returns EOF.
15409 <p><small><a href="#Contents">Contents</a></small>
15410 <h5><a name="7.19.7.7" href="#7.19.7.7">7.19.7.7 The gets function</a></h5>
15411 <p><b>Synopsis</b>
15412 <p><a name="7.19.7.7p1" href="#7.19.7.7p1"><small>1</small></a>
15413 <pre>
15414 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15415 char *gets(char *s);
15416 </pre>
15417 <p><b>Description</b>
15418 <p><a name="7.19.7.7p2" href="#7.19.7.7p2"><small>2</small></a>
15419 The gets function reads characters from the input stream pointed to by stdin, into the
15420 array pointed to by s, until end-of-file is encountered or a new-line character is read.
15421 Any new-line character is discarded, and a null character is written immediately after the
15422 last character read into the array.
15423 <p><b>Returns</b>
15424 <p><a name="7.19.7.7p3" href="#7.19.7.7p3"><small>3</small></a>
15425 The gets function returns s if successful. If end-of-file is encountered and no
15426 characters have been read into the array, the contents of the array remain unchanged and a
15427 null pointer is returned. If a read error occurs during the operation, the array contents are
15428 indeterminate and a null pointer is returned.
15429 <p><b> Forward references</b>: future library directions (<a href="#7.26.9">7.26.9</a>).
15430 <!--page 311 -->
15432 <p><small><a href="#Contents">Contents</a></small>
15433 <h5><a name="7.19.7.8" href="#7.19.7.8">7.19.7.8 The putc function</a></h5>
15434 <p><b>Synopsis</b>
15435 <p><a name="7.19.7.8p1" href="#7.19.7.8p1"><small>1</small></a>
15436 <pre>
15437 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15438 int putc(int c, FILE *stream);
15439 </pre>
15440 <p><b>Description</b>
15441 <p><a name="7.19.7.8p2" href="#7.19.7.8p2"><small>2</small></a>
15442 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
15443 may evaluate stream more than once, so that argument should never be an expression
15444 with side effects.
15445 <p><b>Returns</b>
15446 <p><a name="7.19.7.8p3" href="#7.19.7.8p3"><small>3</small></a>
15447 The putc function returns the character written. If a write error occurs, the error
15448 indicator for the stream is set and putc returns EOF.
15450 <p><small><a href="#Contents">Contents</a></small>
15451 <h5><a name="7.19.7.9" href="#7.19.7.9">7.19.7.9 The putchar function</a></h5>
15452 <p><b>Synopsis</b>
15453 <p><a name="7.19.7.9p1" href="#7.19.7.9p1"><small>1</small></a>
15454 <pre>
15455 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15456 int putchar(int c);
15457 </pre>
15458 <p><b>Description</b>
15459 <p><a name="7.19.7.9p2" href="#7.19.7.9p2"><small>2</small></a>
15460 The putchar function is equivalent to putc with the second argument stdout.
15461 <p><b>Returns</b>
15462 <p><a name="7.19.7.9p3" href="#7.19.7.9p3"><small>3</small></a>
15463 The putchar function returns the character written. If a write error occurs, the error
15464 indicator for the stream is set and putchar returns EOF.
15466 <p><small><a href="#Contents">Contents</a></small>
15467 <h5><a name="7.19.7.10" href="#7.19.7.10">7.19.7.10 The puts function</a></h5>
15468 <p><b>Synopsis</b>
15469 <p><a name="7.19.7.10p1" href="#7.19.7.10p1"><small>1</small></a>
15470 <pre>
15471 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15472 int puts(const char *s);
15473 </pre>
15474 <p><b>Description</b>
15475 <p><a name="7.19.7.10p2" href="#7.19.7.10p2"><small>2</small></a>
15476 The puts function writes the string pointed to by s to the stream pointed to by stdout,
15477 and appends a new-line character to the output. The terminating null character is not
15478 written.
15479 <p><b>Returns</b>
15480 <p><a name="7.19.7.10p3" href="#7.19.7.10p3"><small>3</small></a>
15481 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
15482 value.
15483 <!--page 312 -->
15485 <p><small><a href="#Contents">Contents</a></small>
15486 <h5><a name="7.19.7.11" href="#7.19.7.11">7.19.7.11 The ungetc function</a></h5>
15487 <p><b>Synopsis</b>
15488 <p><a name="7.19.7.11p1" href="#7.19.7.11p1"><small>1</small></a>
15489 <pre>
15490 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15491 int ungetc(int c, FILE *stream);
15492 </pre>
15493 <p><b>Description</b>
15494 <p><a name="7.19.7.11p2" href="#7.19.7.11p2"><small>2</small></a>
15495 The ungetc function pushes the character specified by c (converted to an unsigned
15496 char) back onto the input stream pointed to by stream. Pushed-back characters will be
15497 returned by subsequent reads on that stream in the reverse order of their pushing. A
15498 successful intervening call (with the stream pointed to by stream) to a file positioning
15499 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
15500 stream. The external storage corresponding to the stream is unchanged.
15501 <p><a name="7.19.7.11p3" href="#7.19.7.11p3"><small>3</small></a>
15502 One character of pushback is guaranteed. If the ungetc function is called too many
15503 times on the same stream without an intervening read or file positioning operation on that
15504 stream, the operation may fail.
15505 <p><a name="7.19.7.11p4" href="#7.19.7.11p4"><small>4</small></a>
15506 If the value of c equals that of the macro EOF, the operation fails and the input stream is
15507 unchanged.
15508 <p><a name="7.19.7.11p5" href="#7.19.7.11p5"><small>5</small></a>
15509 A successful call to the ungetc function clears the end-of-file indicator for the stream.
15510 The value of the file position indicator for the stream after reading or discarding all
15511 pushed-back characters shall be the same as it was before the characters were pushed
15512 back. For a text stream, the value of its file position indicator after a successful call to the
15513 ungetc function is unspecified until all pushed-back characters are read or discarded.
15514 For a binary stream, its file position indicator is decremented by each successful call to
15515 the ungetc function; if its value was zero before a call, it is indeterminate after the
15516 call.<sup><a href="#note256"><b>256)</b></a></sup>
15517 <p><b>Returns</b>
15518 <p><a name="7.19.7.11p6" href="#7.19.7.11p6"><small>6</small></a>
15519 The ungetc function returns the character pushed back after conversion, or EOF if the
15520 operation fails.
15521 <p><b> Forward references</b>: file positioning functions (<a href="#7.19.9">7.19.9</a>).
15526 <!--page 313 -->
15528 <p><b>Footnotes</b>
15529 <p><small><a name="note256" href="#note256">256)</a> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
15530 </small>
15532 <p><small><a href="#Contents">Contents</a></small>
15533 <h4><a name="7.19.8" href="#7.19.8">7.19.8 Direct input/output functions</a></h4>
15535 <p><small><a href="#Contents">Contents</a></small>
15536 <h5><a name="7.19.8.1" href="#7.19.8.1">7.19.8.1 The fread function</a></h5>
15537 <p><b>Synopsis</b>
15538 <p><a name="7.19.8.1p1" href="#7.19.8.1p1"><small>1</small></a>
15539 <pre>
15540 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15541 size_t fread(void * restrict ptr,
15542 size_t size, size_t nmemb,
15543 FILE * restrict stream);
15544 </pre>
15545 <p><b>Description</b>
15546 <p><a name="7.19.8.1p2" href="#7.19.8.1p2"><small>2</small></a>
15547 The fread function reads, into the array pointed to by ptr, up to nmemb elements
15548 whose size is specified by size, from the stream pointed to by stream. For each
15549 object, size calls are made to the fgetc function and the results stored, in the order
15550 read, in an array of unsigned char exactly overlaying the object. The file position
15551 indicator for the stream (if defined) is advanced by the number of characters successfully
15552 read. If an error occurs, the resulting value of the file position indicator for the stream is
15553 indeterminate. If a partial element is read, its value is indeterminate.
15554 <p><b>Returns</b>
15555 <p><a name="7.19.8.1p3" href="#7.19.8.1p3"><small>3</small></a>
15556 The fread function returns the number of elements successfully read, which may be
15557 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
15558 fread returns zero and the contents of the array and the state of the stream remain
15559 unchanged.
15561 <p><small><a href="#Contents">Contents</a></small>
15562 <h5><a name="7.19.8.2" href="#7.19.8.2">7.19.8.2 The fwrite function</a></h5>
15563 <p><b>Synopsis</b>
15564 <p><a name="7.19.8.2p1" href="#7.19.8.2p1"><small>1</small></a>
15565 <pre>
15566 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15567 size_t fwrite(const void * restrict ptr,
15568 size_t size, size_t nmemb,
15569 FILE * restrict stream);
15570 </pre>
15571 <p><b>Description</b>
15572 <p><a name="7.19.8.2p2" href="#7.19.8.2p2"><small>2</small></a>
15573 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
15574 whose size is specified by size, to the stream pointed to by stream. For each object,
15575 size calls are made to the fputc function, taking the values (in order) from an array of
15576 unsigned char exactly overlaying the object. The file position indicator for the
15577 stream (if defined) is advanced by the number of characters successfully written. If an
15578 error occurs, the resulting value of the file position indicator for the stream is
15579 indeterminate.
15580 <!--page 314 -->
15581 <p><b>Returns</b>
15582 <p><a name="7.19.8.2p3" href="#7.19.8.2p3"><small>3</small></a>
15583 The fwrite function returns the number of elements successfully written, which will be
15584 less than nmemb only if a write error is encountered. If size or nmemb is zero,
15585 fwrite returns zero and the state of the stream remains unchanged.
15587 <p><small><a href="#Contents">Contents</a></small>
15588 <h4><a name="7.19.9" href="#7.19.9">7.19.9 File positioning functions</a></h4>
15590 <p><small><a href="#Contents">Contents</a></small>
15591 <h5><a name="7.19.9.1" href="#7.19.9.1">7.19.9.1 The fgetpos function</a></h5>
15592 <p><b>Synopsis</b>
15593 <p><a name="7.19.9.1p1" href="#7.19.9.1p1"><small>1</small></a>
15594 <pre>
15595 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15596 int fgetpos(FILE * restrict stream,
15597 fpos_t * restrict pos);
15598 </pre>
15599 <p><b>Description</b>
15600 <p><a name="7.19.9.1p2" href="#7.19.9.1p2"><small>2</small></a>
15601 The fgetpos function stores the current values of the parse state (if any) and file
15602 position indicator for the stream pointed to by stream in the object pointed to by pos.
15603 The values stored contain unspecified information usable by the fsetpos function for
15604 repositioning the stream to its position at the time of the call to the fgetpos function.
15605 <p><b>Returns</b>
15606 <p><a name="7.19.9.1p3" href="#7.19.9.1p3"><small>3</small></a>
15607 If successful, the fgetpos function returns zero; on failure, the fgetpos function
15608 returns nonzero and stores an implementation-defined positive value in errno.
15609 <p><b> Forward references</b>: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
15611 <p><small><a href="#Contents">Contents</a></small>
15612 <h5><a name="7.19.9.2" href="#7.19.9.2">7.19.9.2 The fseek function</a></h5>
15613 <p><b>Synopsis</b>
15614 <p><a name="7.19.9.2p1" href="#7.19.9.2p1"><small>1</small></a>
15615 <pre>
15616 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15617 int fseek(FILE *stream, long int offset, int whence);
15618 </pre>
15619 <p><b>Description</b>
15620 <p><a name="7.19.9.2p2" href="#7.19.9.2p2"><small>2</small></a>
15621 The fseek function sets the file position indicator for the stream pointed to by stream.
15622 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
15623 <p><a name="7.19.9.2p3" href="#7.19.9.2p3"><small>3</small></a>
15624 For a binary stream, the new position, measured in characters from the beginning of the
15625 file, is obtained by adding offset to the position specified by whence. The specified
15626 position is the beginning of the file if whence is SEEK_SET, the current value of the file
15627 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
15628 meaningfully support fseek calls with a whence value of SEEK_END.
15629 <p><a name="7.19.9.2p4" href="#7.19.9.2p4"><small>4</small></a>
15630 For a text stream, either offset shall be zero, or offset shall be a value returned by
15631 an earlier successful call to the ftell function on a stream associated with the same file
15632 and whence shall be SEEK_SET.
15633 <!--page 315 -->
15634 <p><a name="7.19.9.2p5" href="#7.19.9.2p5"><small>5</small></a>
15635 After determining the new position, a successful call to the fseek function undoes any
15636 effects of the ungetc function on the stream, clears the end-of-file indicator for the
15637 stream, and then establishes the new position. After a successful fseek call, the next
15638 operation on an update stream may be either input or output.
15639 <p><b>Returns</b>
15640 <p><a name="7.19.9.2p6" href="#7.19.9.2p6"><small>6</small></a>
15641 The fseek function returns nonzero only for a request that cannot be satisfied.
15642 <p><b> Forward references</b>: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
15644 <p><small><a href="#Contents">Contents</a></small>
15645 <h5><a name="7.19.9.3" href="#7.19.9.3">7.19.9.3 The fsetpos function</a></h5>
15646 <p><b>Synopsis</b>
15647 <p><a name="7.19.9.3p1" href="#7.19.9.3p1"><small>1</small></a>
15648 <pre>
15649 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15650 int fsetpos(FILE *stream, const fpos_t *pos);
15651 </pre>
15652 <p><b>Description</b>
15653 <p><a name="7.19.9.3p2" href="#7.19.9.3p2"><small>2</small></a>
15654 The fsetpos function sets the mbstate_t object (if any) and file position indicator
15655 for the stream pointed to by stream according to the value of the object pointed to by
15656 pos, which shall be a value obtained from an earlier successful call to the fgetpos
15657 function on a stream associated with the same file. If a read or write error occurs, the
15658 error indicator for the stream is set and fsetpos fails.
15659 <p><a name="7.19.9.3p3" href="#7.19.9.3p3"><small>3</small></a>
15660 A successful call to the fsetpos function undoes any effects of the ungetc function
15661 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
15662 parse state and position. After a successful fsetpos call, the next operation on an
15663 update stream may be either input or output.
15664 <p><b>Returns</b>
15665 <p><a name="7.19.9.3p4" href="#7.19.9.3p4"><small>4</small></a>
15666 If successful, the fsetpos function returns zero; on failure, the fsetpos function
15667 returns nonzero and stores an implementation-defined positive value in errno.
15669 <p><small><a href="#Contents">Contents</a></small>
15670 <h5><a name="7.19.9.4" href="#7.19.9.4">7.19.9.4 The ftell function</a></h5>
15671 <p><b>Synopsis</b>
15672 <p><a name="7.19.9.4p1" href="#7.19.9.4p1"><small>1</small></a>
15673 <pre>
15674 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15675 long int ftell(FILE *stream);
15676 </pre>
15677 <p><b>Description</b>
15678 <p><a name="7.19.9.4p2" href="#7.19.9.4p2"><small>2</small></a>
15679 The ftell function obtains the current value of the file position indicator for the stream
15680 pointed to by stream. For a binary stream, the value is the number of characters from
15681 the beginning of the file. For a text stream, its file position indicator contains unspecified
15682 information, usable by the fseek function for returning the file position indicator for the
15683 stream to its position at the time of the ftell call; the difference between two such
15684 return values is not necessarily a meaningful measure of the number of characters written
15685 <!--page 316 -->
15686 or read.
15687 <p><b>Returns</b>
15688 <p><a name="7.19.9.4p3" href="#7.19.9.4p3"><small>3</small></a>
15689 If successful, the ftell function returns the current value of the file position indicator
15690 for the stream. On failure, the ftell function returns -1L and stores an
15691 implementation-defined positive value in errno.
15693 <p><small><a href="#Contents">Contents</a></small>
15694 <h5><a name="7.19.9.5" href="#7.19.9.5">7.19.9.5 The rewind function</a></h5>
15695 <p><b>Synopsis</b>
15696 <p><a name="7.19.9.5p1" href="#7.19.9.5p1"><small>1</small></a>
15697 <pre>
15698 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15699 void rewind(FILE *stream);
15700 </pre>
15701 <p><b>Description</b>
15702 <p><a name="7.19.9.5p2" href="#7.19.9.5p2"><small>2</small></a>
15703 The rewind function sets the file position indicator for the stream pointed to by
15704 stream to the beginning of the file. It is equivalent to
15705 <pre>
15706 (void)fseek(stream, 0L, SEEK_SET)
15707 </pre>
15708 except that the error indicator for the stream is also cleared.
15709 <p><b>Returns</b>
15710 <p><a name="7.19.9.5p3" href="#7.19.9.5p3"><small>3</small></a>
15711 The rewind function returns no value.
15713 <p><small><a href="#Contents">Contents</a></small>
15714 <h4><a name="7.19.10" href="#7.19.10">7.19.10 Error-handling functions</a></h4>
15716 <p><small><a href="#Contents">Contents</a></small>
15717 <h5><a name="7.19.10.1" href="#7.19.10.1">7.19.10.1 The clearerr function</a></h5>
15718 <p><b>Synopsis</b>
15719 <p><a name="7.19.10.1p1" href="#7.19.10.1p1"><small>1</small></a>
15720 <pre>
15721 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15722 void clearerr(FILE *stream);
15723 </pre>
15724 <p><b>Description</b>
15725 <p><a name="7.19.10.1p2" href="#7.19.10.1p2"><small>2</small></a>
15726 The clearerr function clears the end-of-file and error indicators for the stream pointed
15727 to by stream.
15728 <p><b>Returns</b>
15729 <p><a name="7.19.10.1p3" href="#7.19.10.1p3"><small>3</small></a>
15730 The clearerr function returns no value.
15731 <!--page 317 -->
15733 <p><small><a href="#Contents">Contents</a></small>
15734 <h5><a name="7.19.10.2" href="#7.19.10.2">7.19.10.2 The feof function</a></h5>
15735 <p><b>Synopsis</b>
15736 <p><a name="7.19.10.2p1" href="#7.19.10.2p1"><small>1</small></a>
15737 <pre>
15738 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15739 int feof(FILE *stream);
15740 </pre>
15741 <p><b>Description</b>
15742 <p><a name="7.19.10.2p2" href="#7.19.10.2p2"><small>2</small></a>
15743 The feof function tests the end-of-file indicator for the stream pointed to by stream.
15744 <p><b>Returns</b>
15745 <p><a name="7.19.10.2p3" href="#7.19.10.2p3"><small>3</small></a>
15746 The feof function returns nonzero if and only if the end-of-file indicator is set for
15747 stream.
15749 <p><small><a href="#Contents">Contents</a></small>
15750 <h5><a name="7.19.10.3" href="#7.19.10.3">7.19.10.3 The ferror function</a></h5>
15751 <p><b>Synopsis</b>
15752 <p><a name="7.19.10.3p1" href="#7.19.10.3p1"><small>1</small></a>
15753 <pre>
15754 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15755 int ferror(FILE *stream);
15756 </pre>
15757 <p><b>Description</b>
15758 <p><a name="7.19.10.3p2" href="#7.19.10.3p2"><small>2</small></a>
15759 The ferror function tests the error indicator for the stream pointed to by stream.
15760 <p><b>Returns</b>
15761 <p><a name="7.19.10.3p3" href="#7.19.10.3p3"><small>3</small></a>
15762 The ferror function returns nonzero if and only if the error indicator is set for
15763 stream.
15765 <p><small><a href="#Contents">Contents</a></small>
15766 <h5><a name="7.19.10.4" href="#7.19.10.4">7.19.10.4 The perror function</a></h5>
15767 <p><b>Synopsis</b>
15768 <p><a name="7.19.10.4p1" href="#7.19.10.4p1"><small>1</small></a>
15769 <pre>
15770 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15771 void perror(const char *s);
15772 </pre>
15773 <p><b>Description</b>
15774 <p><a name="7.19.10.4p2" href="#7.19.10.4p2"><small>2</small></a>
15775 The perror function maps the error number in the integer expression errno to an
15776 error message. It writes a sequence of characters to the standard error stream thus: first
15777 (if s is not a null pointer and the character pointed to by s is not the null character), the
15778 string pointed to by s followed by a colon (:) and a space; then an appropriate error
15779 message string followed by a new-line character. The contents of the error message
15780 strings are the same as those returned by the strerror function with argument errno.
15781 <p><b>Returns</b>
15782 <p><a name="7.19.10.4p3" href="#7.19.10.4p3"><small>3</small></a>
15783 The perror function returns no value.
15784 <p><b> Forward references</b>: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
15785 <!--page 318 -->
15787 <p><small><a href="#Contents">Contents</a></small>
15788 <h3><a name="7.20" href="#7.20">7.20 General utilities &lt;stdlib.h&gt;</a></h3>
15789 <p><a name="7.20p1" href="#7.20p1"><small>1</small></a>
15790 The header <a href="#7.20">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
15791 defines several macros.<sup><a href="#note257"><b>257)</b></a></sup>
15792 <p><a name="7.20p2" href="#7.20p2"><small>2</small></a>
15793 The types declared are size_t and wchar_t (both described in <a href="#7.17">7.17</a>),
15794 <pre>
15795 div_t
15796 </pre>
15797 which is a structure type that is the type of the value returned by the div function,
15798 <pre>
15799 ldiv_t
15800 </pre>
15801 which is a structure type that is the type of the value returned by the ldiv function, and
15802 <pre>
15803 lldiv_t
15804 </pre>
15805 which is a structure type that is the type of the value returned by the lldiv function.
15806 <p><a name="7.20p3" href="#7.20p3"><small>3</small></a>
15807 The macros defined are NULL (described in <a href="#7.17">7.17</a>);
15808 <pre>
15809 EXIT_FAILURE
15810 </pre>
15812 <pre>
15813 EXIT_SUCCESS
15814 </pre>
15815 which expand to integer constant expressions that can be used as the argument to the
15816 exit function to return unsuccessful or successful termination status, respectively, to the
15817 host environment;
15818 <pre>
15819 RAND_MAX
15820 </pre>
15821 which expands to an integer constant expression that is the maximum value returned by
15822 the rand function; and
15823 <pre>
15824 MB_CUR_MAX
15825 </pre>
15826 which expands to a positive integer expression with type size_t that is the maximum
15827 number of bytes in a multibyte character for the extended character set specified by the
15828 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
15833 <!--page 319 -->
15835 <p><b>Footnotes</b>
15836 <p><small><a name="note257" href="#note257">257)</a> See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
15837 </small>
15839 <p><small><a href="#Contents">Contents</a></small>
15840 <h4><a name="7.20.1" href="#7.20.1">7.20.1 Numeric conversion functions</a></h4>
15841 <p><a name="7.20.1p1" href="#7.20.1p1"><small>1</small></a>
15842 The functions atof, atoi, atol, and atoll need not affect the value of the integer
15843 expression errno on an error. If the value of the result cannot be represented, the
15844 behavior is undefined.
15846 <p><small><a href="#Contents">Contents</a></small>
15847 <h5><a name="7.20.1.1" href="#7.20.1.1">7.20.1.1 The atof function</a></h5>
15848 <p><b>Synopsis</b>
15849 <p><a name="7.20.1.1p1" href="#7.20.1.1p1"><small>1</small></a>
15850 <pre>
15851 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15852 double atof(const char *nptr);
15853 </pre>
15854 <p><b>Description</b>
15855 <p><a name="7.20.1.1p2" href="#7.20.1.1p2"><small>2</small></a>
15856 The atof function converts the initial portion of the string pointed to by nptr to
15857 double representation. Except for the behavior on error, it is equivalent to
15858 <pre>
15859 strtod(nptr, (char **)NULL)
15860 </pre>
15861 <p><b>Returns</b>
15862 <p><a name="7.20.1.1p3" href="#7.20.1.1p3"><small>3</small></a>
15863 The atof function returns the converted value.
15864 <p><b> Forward references</b>: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
15866 <p><small><a href="#Contents">Contents</a></small>
15867 <h5><a name="7.20.1.2" href="#7.20.1.2">7.20.1.2 The atoi, atol, and atoll functions</a></h5>
15868 <p><b>Synopsis</b>
15869 <p><a name="7.20.1.2p1" href="#7.20.1.2p1"><small>1</small></a>
15870 <pre>
15871 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15872 int atoi(const char *nptr);
15873 long int atol(const char *nptr);
15874 long long int atoll(const char *nptr);
15875 </pre>
15876 <p><b>Description</b>
15877 <p><a name="7.20.1.2p2" href="#7.20.1.2p2"><small>2</small></a>
15878 The atoi, atol, and atoll functions convert the initial portion of the string pointed
15879 to by nptr to int, long int, and long long int representation, respectively.
15880 Except for the behavior on error, they are equivalent to
15881 <pre>
15882 atoi: (int)strtol(nptr, (char **)NULL, 10)
15883 atol: strtol(nptr, (char **)NULL, 10)
15884 atoll: strtoll(nptr, (char **)NULL, 10)
15885 </pre>
15886 <p><b>Returns</b>
15887 <p><a name="7.20.1.2p3" href="#7.20.1.2p3"><small>3</small></a>
15888 The atoi, atol, and atoll functions return the converted value.
15889 <p><b> Forward references</b>: the strtol, strtoll, strtoul, and strtoull functions
15890 (<a href="#7.20.1.4">7.20.1.4</a>).
15891 <!--page 320 -->
15893 <p><small><a href="#Contents">Contents</a></small>
15894 <h5><a name="7.20.1.3" href="#7.20.1.3">7.20.1.3 The strtod, strtof, and strtold functions</a></h5>
15895 <p><b>Synopsis</b>
15896 <p><a name="7.20.1.3p1" href="#7.20.1.3p1"><small>1</small></a>
15897 <pre>
15898 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
15899 double strtod(const char * restrict nptr,
15900 char ** restrict endptr);
15901 float strtof(const char * restrict nptr,
15902 char ** restrict endptr);
15903 long double strtold(const char * restrict nptr,
15904 char ** restrict endptr);
15905 </pre>
15906 <p><b>Description</b>
15907 <p><a name="7.20.1.3p2" href="#7.20.1.3p2"><small>2</small></a>
15908 The strtod, strtof, and strtold functions convert the initial portion of the string
15909 pointed to by nptr to double, float, and long double representation,
15910 respectively. First, they decompose the input string into three parts: an initial, possibly
15911 empty, sequence of white-space characters (as specified by the isspace function), a
15912 subject sequence resembling a floating-point constant or representing an infinity or NaN;
15913 and a final string of one or more unrecognized characters, including the terminating null
15914 character of the input string. Then, they attempt to convert the subject sequence to a
15915 floating-point number, and return the result.
15916 <p><a name="7.20.1.3p3" href="#7.20.1.3p3"><small>3</small></a>
15917 The expected form of the subject sequence is an optional plus or minus sign, then one of
15918 the following:
15919 <ul>
15920 <li> a nonempty sequence of decimal digits optionally containing a decimal-point
15921 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
15922 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
15923 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
15924 <li> INF or INFINITY, ignoring case
15925 <li> NAN or NAN(n-char-sequence<sub>opt</sub>), ignoring case in the NAN part, where:
15926 <pre>
15927 n-char-sequence:
15928 digit
15929 nondigit
15930 n-char-sequence digit
15931 n-char-sequence nondigit
15932 </pre>
15933 </ul>
15934 The subject sequence is defined as the longest initial subsequence of the input string,
15935 starting with the first non-white-space character, that is of the expected form. The subject
15936 sequence contains no characters if the input string is not of the expected form.
15937 <p><a name="7.20.1.3p4" href="#7.20.1.3p4"><small>4</small></a>
15938 If the subject sequence has the expected form for a floating-point number, the sequence of
15939 characters starting with the first digit or the decimal-point character (whichever occurs
15940 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
15941 <!--page 321 -->
15942 decimal-point character is used in place of a period, and that if neither an exponent part
15943 nor a decimal-point character appears in a decimal floating point number, or if a binary
15944 exponent part does not appear in a hexadecimal floating point number, an exponent part
15945 of the appropriate type with value zero is assumed to follow the last digit in the string. If
15946 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note258"><b>258)</b></a></sup>
15947 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
15948 the return type, else like a floating constant that is too large for the range of the return
15949 type. A character sequence NAN or NAN(n-char-sequence<sub>opt</sub>), is interpreted as a quiet
15950 NaN, if supported in the return type, else like a subject sequence part that does not have
15951 the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note259"><b>259)</b></a></sup> A
15952 pointer to the final string is stored in the object pointed to by endptr, provided that
15953 endptr is not a null pointer.
15954 <p><a name="7.20.1.3p5" href="#7.20.1.3p5"><small>5</small></a>
15955 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
15956 value resulting from the conversion is correctly rounded.
15957 <p><a name="7.20.1.3p6" href="#7.20.1.3p6"><small>6</small></a>
15958 In other than the "C" locale, additional locale-specific subject sequence forms may be
15959 accepted.
15960 <p><a name="7.20.1.3p7" href="#7.20.1.3p7"><small>7</small></a>
15961 If the subject sequence is empty or does not have the expected form, no conversion is
15962 performed; the value of nptr is stored in the object pointed to by endptr, provided
15963 that endptr is not a null pointer.
15964 <p><b>Recommended practice</b>
15965 <p><a name="7.20.1.3p8" href="#7.20.1.3p8"><small>8</small></a>
15966 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
15967 the result is not exactly representable, the result should be one of the two numbers in the
15968 appropriate internal format that are adjacent to the hexadecimal floating source value,
15969 with the extra stipulation that the error should have a correct sign for the current rounding
15970 direction.
15971 <p><a name="7.20.1.3p9" href="#7.20.1.3p9"><small>9</small></a>
15972 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
15973 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
15974 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
15975 consider the two bounding, adjacent decimal strings L and U, both having
15976 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
15977 The result should be one of the (equal or adjacent) values that would be obtained by
15978 correctly rounding L and U according to the current rounding direction, with the extra
15980 <!--page 322 -->
15981 stipulation that the error with respect to D should have a correct sign for the current
15982 rounding direction.<sup><a href="#note260"><b>260)</b></a></sup>
15983 <p><b>Returns</b>
15984 <p><a name="7.20.1.3p10" href="#7.20.1.3p10"><small>10</small></a>
15985 The functions return the converted value, if any. If no conversion could be performed,
15986 zero is returned. If the correct value is outside the range of representable values, plus or
15987 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
15988 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
15989 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
15990 than the smallest normalized positive number in the return type; whether errno acquires
15991 the value ERANGE is implementation-defined.
15993 <p><b>Footnotes</b>
15994 <p><small><a name="note258" href="#note258">258)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
15995 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
15996 methods may yield different results if rounding is toward positive or negative infinity. In either case,
15997 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
15998 </small>
15999 <p><small><a name="note259" href="#note259">259)</a> An implementation may use the n-char sequence to determine extra information to be represented in
16000 the NaN's significand.
16001 </small>
16002 <p><small><a name="note260" href="#note260">260)</a> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
16003 to the same internal floating value, but if not will round to adjacent values.
16004 </small>
16006 <p><small><a href="#Contents">Contents</a></small>
16007 <h5><a name="7.20.1.4" href="#7.20.1.4">7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions</a></h5>
16008 <p><b>Synopsis</b>
16009 <p><a name="7.20.1.4p1" href="#7.20.1.4p1"><small>1</small></a>
16010 <pre>
16011 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16012 long int strtol(
16013 const char * restrict nptr,
16014 char ** restrict endptr,
16015 int base);
16016 long long int strtoll(
16017 const char * restrict nptr,
16018 char ** restrict endptr,
16019 int base);
16020 unsigned long int strtoul(
16021 const char * restrict nptr,
16022 char ** restrict endptr,
16023 int base);
16024 unsigned long long int strtoull(
16025 const char * restrict nptr,
16026 char ** restrict endptr,
16027 int base);
16028 </pre>
16029 <p><b>Description</b>
16030 <p><a name="7.20.1.4p2" href="#7.20.1.4p2"><small>2</small></a>
16031 The strtol, strtoll, strtoul, and strtoull functions convert the initial
16032 portion of the string pointed to by nptr to long int, long long int, unsigned
16033 long int, and unsigned long long int representation, respectively. First,
16034 they decompose the input string into three parts: an initial, possibly empty, sequence of
16035 white-space characters (as specified by the isspace function), a subject sequence
16038 <!--page 323 -->
16039 resembling an integer represented in some radix determined by the value of base, and a
16040 final string of one or more unrecognized characters, including the terminating null
16041 character of the input string. Then, they attempt to convert the subject sequence to an
16042 integer, and return the result.
16043 <p><a name="7.20.1.4p3" href="#7.20.1.4p3"><small>3</small></a>
16044 If the value of base is zero, the expected form of the subject sequence is that of an
16045 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
16046 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
16047 expected form of the subject sequence is a sequence of letters and digits representing an
16048 integer with the radix specified by base, optionally preceded by a plus or minus sign,
16049 but not including an integer suffix. The letters from a (or A) through z (or Z) are
16050 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
16051 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
16052 optionally precede the sequence of letters and digits, following the sign if present.
16053 <p><a name="7.20.1.4p4" href="#7.20.1.4p4"><small>4</small></a>
16054 The subject sequence is defined as the longest initial subsequence of the input string,
16055 starting with the first non-white-space character, that is of the expected form. The subject
16056 sequence contains no characters if the input string is empty or consists entirely of white
16057 space, or if the first non-white-space character is other than a sign or a permissible letter
16058 or digit.
16059 <p><a name="7.20.1.4p5" href="#7.20.1.4p5"><small>5</small></a>
16060 If the subject sequence has the expected form and the value of base is zero, the sequence
16061 of characters starting with the first digit is interpreted as an integer constant according to
16062 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
16063 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
16064 as given above. If the subject sequence begins with a minus sign, the value resulting from
16065 the conversion is negated (in the return type). A pointer to the final string is stored in the
16066 object pointed to by endptr, provided that endptr is not a null pointer.
16067 <p><a name="7.20.1.4p6" href="#7.20.1.4p6"><small>6</small></a>
16068 In other than the "C" locale, additional locale-specific subject sequence forms may be
16069 accepted.
16070 <p><a name="7.20.1.4p7" href="#7.20.1.4p7"><small>7</small></a>
16071 If the subject sequence is empty or does not have the expected form, no conversion is
16072 performed; the value of nptr is stored in the object pointed to by endptr, provided
16073 that endptr is not a null pointer.
16074 <p><b>Returns</b>
16075 <p><a name="7.20.1.4p8" href="#7.20.1.4p8"><small>8</small></a>
16076 The strtol, strtoll, strtoul, and strtoull functions return the converted
16077 value, if any. If no conversion could be performed, zero is returned. If the correct value
16078 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
16079 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
16080 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
16081 <!--page 324 -->
16083 <p><small><a href="#Contents">Contents</a></small>
16084 <h4><a name="7.20.2" href="#7.20.2">7.20.2 Pseudo-random sequence generation functions</a></h4>
16086 <p><small><a href="#Contents">Contents</a></small>
16087 <h5><a name="7.20.2.1" href="#7.20.2.1">7.20.2.1 The rand function</a></h5>
16088 <p><b>Synopsis</b>
16089 <p><a name="7.20.2.1p1" href="#7.20.2.1p1"><small>1</small></a>
16090 <pre>
16091 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16092 int rand(void);
16093 </pre>
16094 <p><b>Description</b>
16095 <p><a name="7.20.2.1p2" href="#7.20.2.1p2"><small>2</small></a>
16096 The rand function computes a sequence of pseudo-random integers in the range 0 to
16097 RAND_MAX.
16098 <p><a name="7.20.2.1p3" href="#7.20.2.1p3"><small>3</small></a>
16099 The implementation shall behave as if no library function calls the rand function.
16100 <p><b>Returns</b>
16101 <p><a name="7.20.2.1p4" href="#7.20.2.1p4"><small>4</small></a>
16102 The rand function returns a pseudo-random integer.
16103 <p><b>Environmental limits</b>
16104 <p><a name="7.20.2.1p5" href="#7.20.2.1p5"><small>5</small></a>
16105 The value of the RAND_MAX macro shall be at least 32767.
16107 <p><small><a href="#Contents">Contents</a></small>
16108 <h5><a name="7.20.2.2" href="#7.20.2.2">7.20.2.2 The srand function</a></h5>
16109 <p><b>Synopsis</b>
16110 <p><a name="7.20.2.2p1" href="#7.20.2.2p1"><small>1</small></a>
16111 <pre>
16112 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16113 void srand(unsigned int seed);
16114 </pre>
16115 <p><b>Description</b>
16116 <p><a name="7.20.2.2p2" href="#7.20.2.2p2"><small>2</small></a>
16117 The srand function uses the argument as a seed for a new sequence of pseudo-random
16118 numbers to be returned by subsequent calls to rand. If srand is then called with the
16119 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
16120 called before any calls to srand have been made, the same sequence shall be generated
16121 as when srand is first called with a seed value of 1.
16122 <p><a name="7.20.2.2p3" href="#7.20.2.2p3"><small>3</small></a>
16123 The implementation shall behave as if no library function calls the srand function.
16124 <p><b>Returns</b>
16125 <p><a name="7.20.2.2p4" href="#7.20.2.2p4"><small>4</small></a>
16126 The srand function returns no value.
16127 <p><a name="7.20.2.2p5" href="#7.20.2.2p5"><small>5</small></a>
16128 EXAMPLE The following functions define a portable implementation of rand and srand.
16129 <!--page 325 -->
16130 <pre>
16131 static unsigned long int next = 1;
16132 int rand(void) // RAND_MAX assumed to be 32767
16134 next = next * 1103515245 + 12345;
16135 return (unsigned int)(next/65536) % 32768;
16137 void srand(unsigned int seed)
16139 next = seed;
16141 </pre>
16144 <p><small><a href="#Contents">Contents</a></small>
16145 <h4><a name="7.20.3" href="#7.20.3">7.20.3 Memory management functions</a></h4>
16146 <p><a name="7.20.3p1" href="#7.20.3p1"><small>1</small></a>
16147 The order and contiguity of storage allocated by successive calls to the calloc,
16148 malloc, and realloc functions is unspecified. The pointer returned if the allocation
16149 succeeds is suitably aligned so that it may be assigned to a pointer to any type of object
16150 and then used to access such an object or an array of such objects in the space allocated
16151 (until the space is explicitly deallocated). The lifetime of an allocated object extends
16152 from the allocation until the deallocation. Each such allocation shall yield a pointer to an
16153 object disjoint from any other object. The pointer returned points to the start (lowest byte
16154 address) of the allocated space. If the space cannot be allocated, a null pointer is
16155 returned. If the size of the space requested is zero, the behavior is implementation-
16156 defined: either a null pointer is returned, or the behavior is as if the size were some
16157 nonzero value, except that the returned pointer shall not be used to access an object.
16159 <p><small><a href="#Contents">Contents</a></small>
16160 <h5><a name="7.20.3.1" href="#7.20.3.1">7.20.3.1 The calloc function</a></h5>
16161 <p><b>Synopsis</b>
16162 <p><a name="7.20.3.1p1" href="#7.20.3.1p1"><small>1</small></a>
16163 <pre>
16164 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16165 void *calloc(size_t nmemb, size_t size);
16166 </pre>
16167 <p><b>Description</b>
16168 <p><a name="7.20.3.1p2" href="#7.20.3.1p2"><small>2</small></a>
16169 The calloc function allocates space for an array of nmemb objects, each of whose size
16170 is size. The space is initialized to all bits zero.<sup><a href="#note261"><b>261)</b></a></sup>
16171 <p><b>Returns</b>
16172 <p><a name="7.20.3.1p3" href="#7.20.3.1p3"><small>3</small></a>
16173 The calloc function returns either a null pointer or a pointer to the allocated space.
16175 <p><b>Footnotes</b>
16176 <p><small><a name="note261" href="#note261">261)</a> Note that this need not be the same as the representation of floating-point zero or a null pointer
16177 constant.
16178 </small>
16180 <p><small><a href="#Contents">Contents</a></small>
16181 <h5><a name="7.20.3.2" href="#7.20.3.2">7.20.3.2 The free function</a></h5>
16182 <p><b>Synopsis</b>
16183 <p><a name="7.20.3.2p1" href="#7.20.3.2p1"><small>1</small></a>
16184 <pre>
16185 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16186 void free(void *ptr);
16187 </pre>
16188 <p><b>Description</b>
16189 <p><a name="7.20.3.2p2" href="#7.20.3.2p2"><small>2</small></a>
16190 The free function causes the space pointed to by ptr to be deallocated, that is, made
16191 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
16192 the argument does not match a pointer earlier returned by the calloc, malloc, or
16195 <!--page 326 -->
16196 realloc function, or if the space has been deallocated by a call to free or realloc,
16197 the behavior is undefined.
16198 <p><b>Returns</b>
16199 <p><a name="7.20.3.2p3" href="#7.20.3.2p3"><small>3</small></a>
16200 The free function returns no value.
16202 <p><small><a href="#Contents">Contents</a></small>
16203 <h5><a name="7.20.3.3" href="#7.20.3.3">7.20.3.3 The malloc function</a></h5>
16204 <p><b>Synopsis</b>
16205 <p><a name="7.20.3.3p1" href="#7.20.3.3p1"><small>1</small></a>
16206 <pre>
16207 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16208 void *malloc(size_t size);
16209 </pre>
16210 <p><b>Description</b>
16211 <p><a name="7.20.3.3p2" href="#7.20.3.3p2"><small>2</small></a>
16212 The malloc function allocates space for an object whose size is specified by size and
16213 whose value is indeterminate.
16214 <p><b>Returns</b>
16215 <p><a name="7.20.3.3p3" href="#7.20.3.3p3"><small>3</small></a>
16216 The malloc function returns either a null pointer or a pointer to the allocated space.
16218 <p><small><a href="#Contents">Contents</a></small>
16219 <h5><a name="7.20.3.4" href="#7.20.3.4">7.20.3.4 The realloc function</a></h5>
16220 <p><b>Synopsis</b>
16221 <p><a name="7.20.3.4p1" href="#7.20.3.4p1"><small>1</small></a>
16222 <pre>
16223 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16224 void *realloc(void *ptr, size_t size);
16225 </pre>
16226 <p><b>Description</b>
16227 <p><a name="7.20.3.4p2" href="#7.20.3.4p2"><small>2</small></a>
16228 The realloc function deallocates the old object pointed to by ptr and returns a
16229 pointer to a new object that has the size specified by size. The contents of the new
16230 object shall be the same as that of the old object prior to deallocation, up to the lesser of
16231 the new and old sizes. Any bytes in the new object beyond the size of the old object have
16232 indeterminate values.
16233 <p><a name="7.20.3.4p3" href="#7.20.3.4p3"><small>3</small></a>
16234 If ptr is a null pointer, the realloc function behaves like the malloc function for the
16235 specified size. Otherwise, if ptr does not match a pointer earlier returned by the
16236 calloc, malloc, or realloc function, or if the space has been deallocated by a call
16237 to the free or realloc function, the behavior is undefined. If memory for the new
16238 object cannot be allocated, the old object is not deallocated and its value is unchanged.
16239 <p><b>Returns</b>
16240 <p><a name="7.20.3.4p4" href="#7.20.3.4p4"><small>4</small></a>
16241 The realloc function returns a pointer to the new object (which may have the same
16242 value as a pointer to the old object), or a null pointer if the new object could not be
16243 allocated.
16244 <!--page 327 -->
16246 <p><small><a href="#Contents">Contents</a></small>
16247 <h4><a name="7.20.4" href="#7.20.4">7.20.4 Communication with the environment</a></h4>
16249 <p><small><a href="#Contents">Contents</a></small>
16250 <h5><a name="7.20.4.1" href="#7.20.4.1">7.20.4.1 The abort function</a></h5>
16251 <p><b>Synopsis</b>
16252 <p><a name="7.20.4.1p1" href="#7.20.4.1p1"><small>1</small></a>
16253 <pre>
16254 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16255 void abort(void);
16256 </pre>
16257 <p><b>Description</b>
16258 <p><a name="7.20.4.1p2" href="#7.20.4.1p2"><small>2</small></a>
16259 The abort function causes abnormal program termination to occur, unless the signal
16260 SIGABRT is being caught and the signal handler does not return. Whether open streams
16261 with unwritten buffered data are flushed, open streams are closed, or temporary files are
16262 removed is implementation-defined. An implementation-defined form of the status
16263 unsuccessful termination is returned to the host environment by means of the function
16264 call raise(SIGABRT).
16265 <p><b>Returns</b>
16266 <p><a name="7.20.4.1p3" href="#7.20.4.1p3"><small>3</small></a>
16267 The abort function does not return to its caller.
16269 <p><small><a href="#Contents">Contents</a></small>
16270 <h5><a name="7.20.4.2" href="#7.20.4.2">7.20.4.2 The atexit function</a></h5>
16271 <p><b>Synopsis</b>
16272 <p><a name="7.20.4.2p1" href="#7.20.4.2p1"><small>1</small></a>
16273 <pre>
16274 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16275 int atexit(void (*func)(void));
16276 </pre>
16277 <p><b>Description</b>
16278 <p><a name="7.20.4.2p2" href="#7.20.4.2p2"><small>2</small></a>
16279 The atexit function registers the function pointed to by func, to be called without
16280 arguments at normal program termination.
16281 <p><b>Environmental limits</b>
16282 <p><a name="7.20.4.2p3" href="#7.20.4.2p3"><small>3</small></a>
16283 The implementation shall support the registration of at least 32 functions.
16284 <p><b>Returns</b>
16285 <p><a name="7.20.4.2p4" href="#7.20.4.2p4"><small>4</small></a>
16286 The atexit function returns zero if the registration succeeds, nonzero if it fails.
16287 <p><b> Forward references</b>: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
16289 <p><small><a href="#Contents">Contents</a></small>
16290 <h5><a name="7.20.4.3" href="#7.20.4.3">7.20.4.3 The exit function</a></h5>
16291 <p><b>Synopsis</b>
16292 <p><a name="7.20.4.3p1" href="#7.20.4.3p1"><small>1</small></a>
16293 <pre>
16294 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16295 void exit(int status);
16296 </pre>
16297 <p><b>Description</b>
16298 <p><a name="7.20.4.3p2" href="#7.20.4.3p2"><small>2</small></a>
16299 The exit function causes normal program termination to occur. If more than one call to
16300 the exit function is executed by a program, the behavior is undefined.
16301 <!--page 328 -->
16302 <p><a name="7.20.4.3p3" href="#7.20.4.3p3"><small>3</small></a>
16303 First, all functions registered by the atexit function are called, in the reverse order of
16304 their registration,<sup><a href="#note262"><b>262)</b></a></sup> except that a function is called after any previously registered
16305 functions that had already been called at the time it was registered. If, during the call to
16306 any such function, a call to the longjmp function is made that would terminate the call
16307 to the registered function, the behavior is undefined.
16308 <p><a name="7.20.4.3p4" href="#7.20.4.3p4"><small>4</small></a>
16309 Next, all open streams with unwritten buffered data are flushed, all open streams are
16310 closed, and all files created by the tmpfile function are removed.
16311 <p><a name="7.20.4.3p5" href="#7.20.4.3p5"><small>5</small></a>
16312 Finally, control is returned to the host environment. If the value of status is zero or
16313 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
16314 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
16315 of the status unsuccessful termination is returned. Otherwise the status returned is
16316 implementation-defined.
16317 <p><b>Returns</b>
16318 <p><a name="7.20.4.3p6" href="#7.20.4.3p6"><small>6</small></a>
16319 The exit function cannot return to its caller.
16321 <p><b>Footnotes</b>
16322 <p><small><a name="note262" href="#note262">262)</a> Each function is called as many times as it was registered, and in the correct order with respect to
16323 other registered functions.
16324 </small>
16326 <p><small><a href="#Contents">Contents</a></small>
16327 <h5><a name="7.20.4.4" href="#7.20.4.4">7.20.4.4 The _Exit function</a></h5>
16328 <p><b>Synopsis</b>
16329 <p><a name="7.20.4.4p1" href="#7.20.4.4p1"><small>1</small></a>
16330 <pre>
16331 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16332 void _Exit(int status);
16333 </pre>
16334 <p><b>Description</b>
16335 <p><a name="7.20.4.4p2" href="#7.20.4.4p2"><small>2</small></a>
16336 The _Exit function causes normal program termination to occur and control to be
16337 returned to the host environment. No functions registered by the atexit function or
16338 signal handlers registered by the signal function are called. The status returned to the
16339 host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
16340 Whether open streams with unwritten buffered data are flushed, open streams are closed,
16341 or temporary files are removed is implementation-defined.
16342 <p><b>Returns</b>
16343 <p><a name="7.20.4.4p3" href="#7.20.4.4p3"><small>3</small></a>
16344 The _Exit function cannot return to its caller.
16349 <!--page 329 -->
16351 <p><small><a href="#Contents">Contents</a></small>
16352 <h5><a name="7.20.4.5" href="#7.20.4.5">7.20.4.5 The getenv function</a></h5>
16353 <p><b>Synopsis</b>
16354 <p><a name="7.20.4.5p1" href="#7.20.4.5p1"><small>1</small></a>
16355 <pre>
16356 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16357 char *getenv(const char *name);
16358 </pre>
16359 <p><b>Description</b>
16360 <p><a name="7.20.4.5p2" href="#7.20.4.5p2"><small>2</small></a>
16361 The getenv function searches an environment list, provided by the host environment,
16362 for a string that matches the string pointed to by name. The set of environment names
16363 and the method for altering the environment list are implementation-defined.
16364 <p><a name="7.20.4.5p3" href="#7.20.4.5p3"><small>3</small></a>
16365 The implementation shall behave as if no library function calls the getenv function.
16366 <p><b>Returns</b>
16367 <p><a name="7.20.4.5p4" href="#7.20.4.5p4"><small>4</small></a>
16368 The getenv function returns a pointer to a string associated with the matched list
16369 member. The string pointed to shall not be modified by the program, but may be
16370 overwritten by a subsequent call to the getenv function. If the specified name cannot
16371 be found, a null pointer is returned.
16373 <p><small><a href="#Contents">Contents</a></small>
16374 <h5><a name="7.20.4.6" href="#7.20.4.6">7.20.4.6 The system function</a></h5>
16375 <p><b>Synopsis</b>
16376 <p><a name="7.20.4.6p1" href="#7.20.4.6p1"><small>1</small></a>
16377 <pre>
16378 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16379 int system(const char *string);
16380 </pre>
16381 <p><b>Description</b>
16382 <p><a name="7.20.4.6p2" href="#7.20.4.6p2"><small>2</small></a>
16383 If string is a null pointer, the system function determines whether the host
16384 environment has a command processor. If string is not a null pointer, the system
16385 function passes the string pointed to by string to that command processor to be
16386 executed in a manner which the implementation shall document; this might then cause the
16387 program calling system to behave in a non-conforming manner or to terminate.
16388 <p><b>Returns</b>
16389 <p><a name="7.20.4.6p3" href="#7.20.4.6p3"><small>3</small></a>
16390 If the argument is a null pointer, the system function returns nonzero only if a
16391 command processor is available. If the argument is not a null pointer, and the system
16392 function does return, it returns an implementation-defined value.
16393 <!--page 330 -->
16395 <p><small><a href="#Contents">Contents</a></small>
16396 <h4><a name="7.20.5" href="#7.20.5">7.20.5 Searching and sorting utilities</a></h4>
16397 <p><a name="7.20.5p1" href="#7.20.5p1"><small>1</small></a>
16398 These utilities make use of a comparison function to search or sort arrays of unspecified
16399 type. Where an argument declared as size_t nmemb specifies the length of the array
16400 for a function, nmemb can have the value zero on a call to that function; the comparison
16401 function is not called, a search finds no matching element, and sorting performs no
16402 rearrangement. Pointer arguments on such a call shall still have valid values, as described
16403 in <a href="#7.1.4">7.1.4</a>.
16404 <p><a name="7.20.5p2" href="#7.20.5p2"><small>2</small></a>
16405 The implementation shall ensure that the second argument of the comparison function
16406 (when called from bsearch), or both arguments (when called from qsort), are
16407 pointers to elements of the array.<sup><a href="#note263"><b>263)</b></a></sup> The first argument when called from bsearch
16408 shall equal key.
16409 <p><a name="7.20.5p3" href="#7.20.5p3"><small>3</small></a>
16410 The comparison function shall not alter the contents of the array. The implementation
16411 may reorder elements of the array between calls to the comparison function, but shall not
16412 alter the contents of any individual element.
16413 <p><a name="7.20.5p4" href="#7.20.5p4"><small>4</small></a>
16414 When the same objects (consisting of size bytes, irrespective of their current positions
16415 in the array) are passed more than once to the comparison function, the results shall be
16416 consistent with one another. That is, for qsort they shall define a total ordering on the
16417 array, and for bsearch the same object shall always compare the same way with the
16418 key.
16419 <p><a name="7.20.5p5" href="#7.20.5p5"><small>5</small></a>
16420 A sequence point occurs immediately before and immediately after each call to the
16421 comparison function, and also between any call to the comparison function and any
16422 movement of the objects passed as arguments to that call.
16424 <p><b>Footnotes</b>
16425 <p><small><a name="note263" href="#note263">263)</a> That is, if the value passed is p, then the following expressions are always nonzero:
16427 <pre>
16428 ((char *)p - (char *)base) % size == 0
16429 (char *)p &gt;= (char *)base
16430 (char *)p &lt; (char *)base + nmemb * size
16431 </pre>
16432 </small>
16434 <p><small><a href="#Contents">Contents</a></small>
16435 <h5><a name="7.20.5.1" href="#7.20.5.1">7.20.5.1 The bsearch function</a></h5>
16436 <p><b>Synopsis</b>
16437 <p><a name="7.20.5.1p1" href="#7.20.5.1p1"><small>1</small></a>
16438 <pre>
16439 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16440 void *bsearch(const void *key, const void *base,
16441 size_t nmemb, size_t size,
16442 int (*compar)(const void *, const void *));
16443 </pre>
16444 <p><b>Description</b>
16445 <p><a name="7.20.5.1p2" href="#7.20.5.1p2"><small>2</small></a>
16446 The bsearch function searches an array of nmemb objects, the initial element of which
16447 is pointed to by base, for an element that matches the object pointed to by key. The
16450 <!--page 331 -->
16451 size of each element of the array is specified by size.
16452 <p><a name="7.20.5.1p3" href="#7.20.5.1p3"><small>3</small></a>
16453 The comparison function pointed to by compar is called with two arguments that point
16454 to the key object and to an array element, in that order. The function shall return an
16455 integer less than, equal to, or greater than zero if the key object is considered,
16456 respectively, to be less than, to match, or to be greater than the array element. The array
16457 shall consist of: all the elements that compare less than, all the elements that compare
16458 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note264"><b>264)</b></a></sup>
16459 <p><b>Returns</b>
16460 <p><a name="7.20.5.1p4" href="#7.20.5.1p4"><small>4</small></a>
16461 The bsearch function returns a pointer to a matching element of the array, or a null
16462 pointer if no match is found. If two elements compare as equal, which element is
16463 matched is unspecified.
16465 <p><b>Footnotes</b>
16466 <p><small><a name="note264" href="#note264">264)</a> In practice, the entire array is sorted according to the comparison function.
16467 </small>
16469 <p><small><a href="#Contents">Contents</a></small>
16470 <h5><a name="7.20.5.2" href="#7.20.5.2">7.20.5.2 The qsort function</a></h5>
16471 <p><b>Synopsis</b>
16472 <p><a name="7.20.5.2p1" href="#7.20.5.2p1"><small>1</small></a>
16473 <pre>
16474 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16475 void qsort(void *base, size_t nmemb, size_t size,
16476 int (*compar)(const void *, const void *));
16477 </pre>
16478 <p><b>Description</b>
16479 <p><a name="7.20.5.2p2" href="#7.20.5.2p2"><small>2</small></a>
16480 The qsort function sorts an array of nmemb objects, the initial element of which is
16481 pointed to by base. The size of each object is specified by size.
16482 <p><a name="7.20.5.2p3" href="#7.20.5.2p3"><small>3</small></a>
16483 The contents of the array are sorted into ascending order according to a comparison
16484 function pointed to by compar, which is called with two arguments that point to the
16485 objects being compared. The function shall return an integer less than, equal to, or
16486 greater than zero if the first argument is considered to be respectively less than, equal to,
16487 or greater than the second.
16488 <p><a name="7.20.5.2p4" href="#7.20.5.2p4"><small>4</small></a>
16489 If two elements compare as equal, their order in the resulting sorted array is unspecified.
16490 <p><b>Returns</b>
16491 <p><a name="7.20.5.2p5" href="#7.20.5.2p5"><small>5</small></a>
16492 The qsort function returns no value.
16497 <!--page 332 -->
16499 <p><small><a href="#Contents">Contents</a></small>
16500 <h4><a name="7.20.6" href="#7.20.6">7.20.6 Integer arithmetic functions</a></h4>
16502 <p><small><a href="#Contents">Contents</a></small>
16503 <h5><a name="7.20.6.1" href="#7.20.6.1">7.20.6.1 The abs, labs and llabs functions</a></h5>
16504 <p><b>Synopsis</b>
16505 <p><a name="7.20.6.1p1" href="#7.20.6.1p1"><small>1</small></a>
16506 <pre>
16507 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16508 int abs(int j);
16509 long int labs(long int j);
16510 long long int llabs(long long int j);
16511 </pre>
16512 <p><b>Description</b>
16513 <p><a name="7.20.6.1p2" href="#7.20.6.1p2"><small>2</small></a>
16514 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
16515 result cannot be represented, the behavior is undefined.<sup><a href="#note265"><b>265)</b></a></sup>
16516 <p><b>Returns</b>
16517 <p><a name="7.20.6.1p3" href="#7.20.6.1p3"><small>3</small></a>
16518 The abs, labs, and llabs, functions return the absolute value.
16520 <p><b>Footnotes</b>
16521 <p><small><a name="note265" href="#note265">265)</a> The absolute value of the most negative number cannot be represented in two's complement.
16522 </small>
16524 <p><small><a href="#Contents">Contents</a></small>
16525 <h5><a name="7.20.6.2" href="#7.20.6.2">7.20.6.2 The div, ldiv, and lldiv functions</a></h5>
16526 <p><b>Synopsis</b>
16527 <p><a name="7.20.6.2p1" href="#7.20.6.2p1"><small>1</small></a>
16528 <pre>
16529 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16530 div_t div(int numer, int denom);
16531 ldiv_t ldiv(long int numer, long int denom);
16532 lldiv_t lldiv(long long int numer, long long int denom);
16533 </pre>
16534 <p><b>Description</b>
16535 <p><a name="7.20.6.2p2" href="#7.20.6.2p2"><small>2</small></a>
16536 The div, ldiv, and lldiv, functions compute numer / denom and numer %
16537 denom in a single operation.
16538 <p><b>Returns</b>
16539 <p><a name="7.20.6.2p3" href="#7.20.6.2p3"><small>3</small></a>
16540 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
16541 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
16542 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
16543 each of which has the same type as the arguments numer and denom. If either part of
16544 the result cannot be represented, the behavior is undefined.
16549 <!--page 333 -->
16551 <p><small><a href="#Contents">Contents</a></small>
16552 <h4><a name="7.20.7" href="#7.20.7">7.20.7 Multibyte/wide character conversion functions</a></h4>
16553 <p><a name="7.20.7p1" href="#7.20.7p1"><small>1</small></a>
16554 The behavior of the multibyte character functions is affected by the LC_CTYPE category
16555 of the current locale. For a state-dependent encoding, each function is placed into its
16556 initial conversion state by a call for which its character pointer argument, s, is a null
16557 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
16558 state of the function to be altered as necessary. A call with s as a null pointer causes
16559 these functions to return a nonzero value if encodings have state dependency, and zero
16560 otherwise.<sup><a href="#note266"><b>266)</b></a></sup> Changing the LC_CTYPE category causes the conversion state of these
16561 functions to be indeterminate.
16563 <p><b>Footnotes</b>
16564 <p><small><a name="note266" href="#note266">266)</a> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
16565 character codes, but are grouped with an adjacent multibyte character.
16566 </small>
16568 <p><small><a href="#Contents">Contents</a></small>
16569 <h5><a name="7.20.7.1" href="#7.20.7.1">7.20.7.1 The mblen function</a></h5>
16570 <p><b>Synopsis</b>
16571 <p><a name="7.20.7.1p1" href="#7.20.7.1p1"><small>1</small></a>
16572 <pre>
16573 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16574 int mblen(const char *s, size_t n);
16575 </pre>
16576 <p><b>Description</b>
16577 <p><a name="7.20.7.1p2" href="#7.20.7.1p2"><small>2</small></a>
16578 If s is not a null pointer, the mblen function determines the number of bytes contained
16579 in the multibyte character pointed to by s. Except that the conversion state of the
16580 mbtowc function is not affected, it is equivalent to
16581 <pre>
16582 mbtowc((wchar_t *)0, s, n);
16583 </pre>
16584 <p><a name="7.20.7.1p3" href="#7.20.7.1p3"><small>3</small></a>
16585 The implementation shall behave as if no library function calls the mblen function.
16586 <p><b>Returns</b>
16587 <p><a name="7.20.7.1p4" href="#7.20.7.1p4"><small>4</small></a>
16588 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
16589 character encodings, respectively, do or do not have state-dependent encodings. If s is
16590 not a null pointer, the mblen function either returns 0 (if s points to the null character),
16591 or returns the number of bytes that are contained in the multibyte character (if the next n
16592 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
16593 multibyte character).
16594 <p><b> Forward references</b>: the mbtowc function (<a href="#7.20.7.2">7.20.7.2</a>).
16599 <!--page 334 -->
16601 <p><small><a href="#Contents">Contents</a></small>
16602 <h5><a name="7.20.7.2" href="#7.20.7.2">7.20.7.2 The mbtowc function</a></h5>
16603 <p><b>Synopsis</b>
16604 <p><a name="7.20.7.2p1" href="#7.20.7.2p1"><small>1</small></a>
16605 <pre>
16606 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16607 int mbtowc(wchar_t * restrict pwc,
16608 const char * restrict s,
16609 size_t n);
16610 </pre>
16611 <p><b>Description</b>
16612 <p><a name="7.20.7.2p2" href="#7.20.7.2p2"><small>2</small></a>
16613 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
16614 the byte pointed to by s to determine the number of bytes needed to complete the next
16615 multibyte character (including any shift sequences). If the function determines that the
16616 next multibyte character is complete and valid, it determines the value of the
16617 corresponding wide character and then, if pwc is not a null pointer, stores that value in
16618 the object pointed to by pwc. If the corresponding wide character is the null wide
16619 character, the function is left in the initial conversion state.
16620 <p><a name="7.20.7.2p3" href="#7.20.7.2p3"><small>3</small></a>
16621 The implementation shall behave as if no library function calls the mbtowc function.
16622 <p><b>Returns</b>
16623 <p><a name="7.20.7.2p4" href="#7.20.7.2p4"><small>4</small></a>
16624 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
16625 character encodings, respectively, do or do not have state-dependent encodings. If s is
16626 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
16627 or returns the number of bytes that are contained in the converted multibyte character (if
16628 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
16629 form a valid multibyte character).
16630 <p><a name="7.20.7.2p5" href="#7.20.7.2p5"><small>5</small></a>
16631 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
16632 macro.
16634 <p><small><a href="#Contents">Contents</a></small>
16635 <h5><a name="7.20.7.3" href="#7.20.7.3">7.20.7.3 The wctomb function</a></h5>
16636 <p><b>Synopsis</b>
16637 <p><a name="7.20.7.3p1" href="#7.20.7.3p1"><small>1</small></a>
16638 <pre>
16639 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16640 int wctomb(char *s, wchar_t wc);
16641 </pre>
16642 <p><b>Description</b>
16643 <p><a name="7.20.7.3p2" href="#7.20.7.3p2"><small>2</small></a>
16644 The wctomb function determines the number of bytes needed to represent the multibyte
16645 character corresponding to the wide character given by wc (including any shift
16646 sequences), and stores the multibyte character representation in the array whose first
16647 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
16648 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
16649 sequence needed to restore the initial shift state, and the function is left in the initial
16650 conversion state.
16651 <!--page 335 -->
16652 <p><a name="7.20.7.3p3" href="#7.20.7.3p3"><small>3</small></a>
16653 The implementation shall behave as if no library function calls the wctomb function.
16654 <p><b>Returns</b>
16655 <p><a name="7.20.7.3p4" href="#7.20.7.3p4"><small>4</small></a>
16656 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
16657 character encodings, respectively, do or do not have state-dependent encodings. If s is
16658 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
16659 to a valid multibyte character, or returns the number of bytes that are contained in the
16660 multibyte character corresponding to the value of wc.
16661 <p><a name="7.20.7.3p5" href="#7.20.7.3p5"><small>5</small></a>
16662 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
16664 <p><small><a href="#Contents">Contents</a></small>
16665 <h4><a name="7.20.8" href="#7.20.8">7.20.8 Multibyte/wide string conversion functions</a></h4>
16666 <p><a name="7.20.8p1" href="#7.20.8p1"><small>1</small></a>
16667 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
16668 the current locale.
16670 <p><small><a href="#Contents">Contents</a></small>
16671 <h5><a name="7.20.8.1" href="#7.20.8.1">7.20.8.1 The mbstowcs function</a></h5>
16672 <p><b>Synopsis</b>
16673 <p><a name="7.20.8.1p1" href="#7.20.8.1p1"><small>1</small></a>
16674 <pre>
16675 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16676 size_t mbstowcs(wchar_t * restrict pwcs,
16677 const char * restrict s,
16678 size_t n);
16679 </pre>
16680 <p><b>Description</b>
16681 <p><a name="7.20.8.1p2" href="#7.20.8.1p2"><small>2</small></a>
16682 The mbstowcs function converts a sequence of multibyte characters that begins in the
16683 initial shift state from the array pointed to by s into a sequence of corresponding wide
16684 characters and stores not more than n wide characters into the array pointed to by pwcs.
16685 No multibyte characters that follow a null character (which is converted into a null wide
16686 character) will be examined or converted. Each multibyte character is converted as if by
16687 a call to the mbtowc function, except that the conversion state of the mbtowc function is
16688 not affected.
16689 <p><a name="7.20.8.1p3" href="#7.20.8.1p3"><small>3</small></a>
16690 No more than n elements will be modified in the array pointed to by pwcs. If copying
16691 takes place between objects that overlap, the behavior is undefined.
16692 <p><b>Returns</b>
16693 <p><a name="7.20.8.1p4" href="#7.20.8.1p4"><small>4</small></a>
16694 If an invalid multibyte character is encountered, the mbstowcs function returns
16695 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
16696 elements modified, not including a terminating null wide character, if any.<sup><a href="#note267"><b>267)</b></a></sup>
16701 <!--page 336 -->
16703 <p><b>Footnotes</b>
16704 <p><small><a name="note267" href="#note267">267)</a> The array will not be null-terminated if the value returned is n.
16705 </small>
16707 <p><small><a href="#Contents">Contents</a></small>
16708 <h5><a name="7.20.8.2" href="#7.20.8.2">7.20.8.2 The wcstombs function</a></h5>
16709 <p><b>Synopsis</b>
16710 <p><a name="7.20.8.2p1" href="#7.20.8.2p1"><small>1</small></a>
16711 <pre>
16712 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
16713 size_t wcstombs(char * restrict s,
16714 const wchar_t * restrict pwcs,
16715 size_t n);
16716 </pre>
16717 <p><b>Description</b>
16718 <p><a name="7.20.8.2p2" href="#7.20.8.2p2"><small>2</small></a>
16719 The wcstombs function converts a sequence of wide characters from the array pointed
16720 to by pwcs into a sequence of corresponding multibyte characters that begins in the
16721 initial shift state, and stores these multibyte characters into the array pointed to by s,
16722 stopping if a multibyte character would exceed the limit of n total bytes or if a null
16723 character is stored. Each wide character is converted as if by a call to the wctomb
16724 function, except that the conversion state of the wctomb function is not affected.
16725 <p><a name="7.20.8.2p3" href="#7.20.8.2p3"><small>3</small></a>
16726 No more than n bytes will be modified in the array pointed to by s. If copying takes place
16727 between objects that overlap, the behavior is undefined.
16728 <p><b>Returns</b>
16729 <p><a name="7.20.8.2p4" href="#7.20.8.2p4"><small>4</small></a>
16730 If a wide character is encountered that does not correspond to a valid multibyte character,
16731 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
16732 returns the number of bytes modified, not including a terminating null character, if
16733 any.<sup><a href="#note267"><b>267)</b></a></sup>
16734 <!--page 337 -->
16736 <p><small><a href="#Contents">Contents</a></small>
16737 <h3><a name="7.21" href="#7.21">7.21 String handling &lt;string.h&gt;</a></h3>
16739 <p><small><a href="#Contents">Contents</a></small>
16740 <h4><a name="7.21.1" href="#7.21.1">7.21.1 String function conventions</a></h4>
16741 <p><a name="7.21.1p1" href="#7.21.1p1"><small>1</small></a>
16742 The header <a href="#7.21">&lt;string.h&gt;</a> declares one type and several functions, and defines one
16743 macro useful for manipulating arrays of character type and other objects treated as arrays
16744 of character type.<sup><a href="#note268"><b>268)</b></a></sup> The type is size_t and the macro is NULL (both described in
16745 <a href="#7.17">7.17</a>). Various methods are used for determining the lengths of the arrays, but in all cases
16746 a char * or void * argument points to the initial (lowest addressed) character of the
16747 array. If an array is accessed beyond the end of an object, the behavior is undefined.
16748 <p><a name="7.21.1p2" href="#7.21.1p2"><small>2</small></a>
16749 Where an argument declared as size_t n specifies the length of the array for a
16750 function, n can have the value zero on a call to that function. Unless explicitly stated
16751 otherwise in the description of a particular function in this subclause, pointer arguments
16752 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
16753 function that locates a character finds no occurrence, a function that compares two
16754 character sequences returns zero, and a function that copies characters copies zero
16755 characters.
16756 <p><a name="7.21.1p3" href="#7.21.1p3"><small>3</small></a>
16757 For all functions in this subclause, each character shall be interpreted as if it had the type
16758 unsigned char (and therefore every possible object representation is valid and has a
16759 different value).
16761 <p><b>Footnotes</b>
16762 <p><small><a name="note268" href="#note268">268)</a> See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
16763 </small>
16765 <p><small><a href="#Contents">Contents</a></small>
16766 <h4><a name="7.21.2" href="#7.21.2">7.21.2 Copying functions</a></h4>
16768 <p><small><a href="#Contents">Contents</a></small>
16769 <h5><a name="7.21.2.1" href="#7.21.2.1">7.21.2.1 The memcpy function</a></h5>
16770 <p><b>Synopsis</b>
16771 <p><a name="7.21.2.1p1" href="#7.21.2.1p1"><small>1</small></a>
16772 <pre>
16773 #include <a href="#7.21">&lt;string.h&gt;</a>
16774 void *memcpy(void * restrict s1,
16775 const void * restrict s2,
16776 size_t n);
16777 </pre>
16778 <p><b>Description</b>
16779 <p><a name="7.21.2.1p2" href="#7.21.2.1p2"><small>2</small></a>
16780 The memcpy function copies n characters from the object pointed to by s2 into the
16781 object pointed to by s1. If copying takes place between objects that overlap, the behavior
16782 is undefined.
16783 <p><b>Returns</b>
16784 <p><a name="7.21.2.1p3" href="#7.21.2.1p3"><small>3</small></a>
16785 The memcpy function returns the value of s1.
16790 <!--page 338 -->
16792 <p><small><a href="#Contents">Contents</a></small>
16793 <h5><a name="7.21.2.2" href="#7.21.2.2">7.21.2.2 The memmove function</a></h5>
16794 <p><b>Synopsis</b>
16795 <p><a name="7.21.2.2p1" href="#7.21.2.2p1"><small>1</small></a>
16796 <pre>
16797 #include <a href="#7.21">&lt;string.h&gt;</a>
16798 void *memmove(void *s1, const void *s2, size_t n);
16799 </pre>
16800 <p><b>Description</b>
16801 <p><a name="7.21.2.2p2" href="#7.21.2.2p2"><small>2</small></a>
16802 The memmove function copies n characters from the object pointed to by s2 into the
16803 object pointed to by s1. Copying takes place as if the n characters from the object
16804 pointed to by s2 are first copied into a temporary array of n characters that does not
16805 overlap the objects pointed to by s1 and s2, and then the n characters from the
16806 temporary array are copied into the object pointed to by s1.
16807 <p><b>Returns</b>
16808 <p><a name="7.21.2.2p3" href="#7.21.2.2p3"><small>3</small></a>
16809 The memmove function returns the value of s1.
16811 <p><small><a href="#Contents">Contents</a></small>
16812 <h5><a name="7.21.2.3" href="#7.21.2.3">7.21.2.3 The strcpy function</a></h5>
16813 <p><b>Synopsis</b>
16814 <p><a name="7.21.2.3p1" href="#7.21.2.3p1"><small>1</small></a>
16815 <pre>
16816 #include <a href="#7.21">&lt;string.h&gt;</a>
16817 char *strcpy(char * restrict s1,
16818 const char * restrict s2);
16819 </pre>
16820 <p><b>Description</b>
16821 <p><a name="7.21.2.3p2" href="#7.21.2.3p2"><small>2</small></a>
16822 The strcpy function copies the string pointed to by s2 (including the terminating null
16823 character) into the array pointed to by s1. If copying takes place between objects that
16824 overlap, the behavior is undefined.
16825 <p><b>Returns</b>
16826 <p><a name="7.21.2.3p3" href="#7.21.2.3p3"><small>3</small></a>
16827 The strcpy function returns the value of s1.
16829 <p><small><a href="#Contents">Contents</a></small>
16830 <h5><a name="7.21.2.4" href="#7.21.2.4">7.21.2.4 The strncpy function</a></h5>
16831 <p><b>Synopsis</b>
16832 <p><a name="7.21.2.4p1" href="#7.21.2.4p1"><small>1</small></a>
16833 <pre>
16834 #include <a href="#7.21">&lt;string.h&gt;</a>
16835 char *strncpy(char * restrict s1,
16836 const char * restrict s2,
16837 size_t n);
16838 </pre>
16839 <p><b>Description</b>
16840 <p><a name="7.21.2.4p2" href="#7.21.2.4p2"><small>2</small></a>
16841 The strncpy function copies not more than n characters (characters that follow a null
16842 character are not copied) from the array pointed to by s2 to the array pointed to by
16843 <!--page 339 -->
16844 s1.<sup><a href="#note269"><b>269)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
16845 <p><a name="7.21.2.4p3" href="#7.21.2.4p3"><small>3</small></a>
16846 If the array pointed to by s2 is a string that is shorter than n characters, null characters
16847 are appended to the copy in the array pointed to by s1, until n characters in all have been
16848 written.
16849 <p><b>Returns</b>
16850 <p><a name="7.21.2.4p4" href="#7.21.2.4p4"><small>4</small></a>
16851 The strncpy function returns the value of s1.
16853 <p><b>Footnotes</b>
16854 <p><small><a name="note269" href="#note269">269)</a> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
16855 not be null-terminated.
16856 </small>
16858 <p><small><a href="#Contents">Contents</a></small>
16859 <h4><a name="7.21.3" href="#7.21.3">7.21.3 Concatenation functions</a></h4>
16861 <p><small><a href="#Contents">Contents</a></small>
16862 <h5><a name="7.21.3.1" href="#7.21.3.1">7.21.3.1 The strcat function</a></h5>
16863 <p><b>Synopsis</b>
16864 <p><a name="7.21.3.1p1" href="#7.21.3.1p1"><small>1</small></a>
16865 <pre>
16866 #include <a href="#7.21">&lt;string.h&gt;</a>
16867 char *strcat(char * restrict s1,
16868 const char * restrict s2);
16869 </pre>
16870 <p><b>Description</b>
16871 <p><a name="7.21.3.1p2" href="#7.21.3.1p2"><small>2</small></a>
16872 The strcat function appends a copy of the string pointed to by s2 (including the
16873 terminating null character) to the end of the string pointed to by s1. The initial character
16874 of s2 overwrites the null character at the end of s1. If copying takes place between
16875 objects that overlap, the behavior is undefined.
16876 <p><b>Returns</b>
16877 <p><a name="7.21.3.1p3" href="#7.21.3.1p3"><small>3</small></a>
16878 The strcat function returns the value of s1.
16880 <p><small><a href="#Contents">Contents</a></small>
16881 <h5><a name="7.21.3.2" href="#7.21.3.2">7.21.3.2 The strncat function</a></h5>
16882 <p><b>Synopsis</b>
16883 <p><a name="7.21.3.2p1" href="#7.21.3.2p1"><small>1</small></a>
16884 <pre>
16885 #include <a href="#7.21">&lt;string.h&gt;</a>
16886 char *strncat(char * restrict s1,
16887 const char * restrict s2,
16888 size_t n);
16889 </pre>
16890 <p><b>Description</b>
16891 <p><a name="7.21.3.2p2" href="#7.21.3.2p2"><small>2</small></a>
16892 The strncat function appends not more than n characters (a null character and
16893 characters that follow it are not appended) from the array pointed to by s2 to the end of
16894 the string pointed to by s1. The initial character of s2 overwrites the null character at the
16895 end of s1. A terminating null character is always appended to the result.<sup><a href="#note270"><b>270)</b></a></sup> If copying
16897 <!--page 340 -->
16898 takes place between objects that overlap, the behavior is undefined.
16899 <p><b>Returns</b>
16900 <p><a name="7.21.3.2p3" href="#7.21.3.2p3"><small>3</small></a>
16901 The strncat function returns the value of s1.
16902 <p><b> Forward references</b>: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
16904 <p><b>Footnotes</b>
16905 <p><small><a name="note270" href="#note270">270)</a> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
16906 strlen(s1)+n+1.
16907 </small>
16909 <p><small><a href="#Contents">Contents</a></small>
16910 <h4><a name="7.21.4" href="#7.21.4">7.21.4 Comparison functions</a></h4>
16911 <p><a name="7.21.4p1" href="#7.21.4p1"><small>1</small></a>
16912 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
16913 and strncmp is determined by the sign of the difference between the values of the first
16914 pair of characters (both interpreted as unsigned char) that differ in the objects being
16915 compared.
16917 <p><small><a href="#Contents">Contents</a></small>
16918 <h5><a name="7.21.4.1" href="#7.21.4.1">7.21.4.1 The memcmp function</a></h5>
16919 <p><b>Synopsis</b>
16920 <p><a name="7.21.4.1p1" href="#7.21.4.1p1"><small>1</small></a>
16921 <pre>
16922 #include <a href="#7.21">&lt;string.h&gt;</a>
16923 int memcmp(const void *s1, const void *s2, size_t n);
16924 </pre>
16925 <p><b>Description</b>
16926 <p><a name="7.21.4.1p2" href="#7.21.4.1p2"><small>2</small></a>
16927 The memcmp function compares the first n characters of the object pointed to by s1 to
16928 the first n characters of the object pointed to by s2.<sup><a href="#note271"><b>271)</b></a></sup>
16929 <p><b>Returns</b>
16930 <p><a name="7.21.4.1p3" href="#7.21.4.1p3"><small>3</small></a>
16931 The memcmp function returns an integer greater than, equal to, or less than zero,
16932 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
16933 pointed to by s2.
16935 <p><b>Footnotes</b>
16936 <p><small><a name="note271" href="#note271">271)</a> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
16937 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
16938 comparison.
16939 </small>
16941 <p><small><a href="#Contents">Contents</a></small>
16942 <h5><a name="7.21.4.2" href="#7.21.4.2">7.21.4.2 The strcmp function</a></h5>
16943 <p><b>Synopsis</b>
16944 <p><a name="7.21.4.2p1" href="#7.21.4.2p1"><small>1</small></a>
16945 <pre>
16946 #include <a href="#7.21">&lt;string.h&gt;</a>
16947 int strcmp(const char *s1, const char *s2);
16948 </pre>
16949 <p><b>Description</b>
16950 <p><a name="7.21.4.2p2" href="#7.21.4.2p2"><small>2</small></a>
16951 The strcmp function compares the string pointed to by s1 to the string pointed to by
16953 <p><b>Returns</b>
16954 <p><a name="7.21.4.2p3" href="#7.21.4.2p3"><small>3</small></a>
16955 The strcmp function returns an integer greater than, equal to, or less than zero,
16956 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
16958 <!--page 341 -->
16959 pointed to by s2.
16961 <p><small><a href="#Contents">Contents</a></small>
16962 <h5><a name="7.21.4.3" href="#7.21.4.3">7.21.4.3 The strcoll function</a></h5>
16963 <p><b>Synopsis</b>
16964 <p><a name="7.21.4.3p1" href="#7.21.4.3p1"><small>1</small></a>
16965 <pre>
16966 #include <a href="#7.21">&lt;string.h&gt;</a>
16967 int strcoll(const char *s1, const char *s2);
16968 </pre>
16969 <p><b>Description</b>
16970 <p><a name="7.21.4.3p2" href="#7.21.4.3p2"><small>2</small></a>
16971 The strcoll function compares the string pointed to by s1 to the string pointed to by
16972 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
16973 <p><b>Returns</b>
16974 <p><a name="7.21.4.3p3" href="#7.21.4.3p3"><small>3</small></a>
16975 The strcoll function returns an integer greater than, equal to, or less than zero,
16976 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
16977 pointed to by s2 when both are interpreted as appropriate to the current locale.
16979 <p><small><a href="#Contents">Contents</a></small>
16980 <h5><a name="7.21.4.4" href="#7.21.4.4">7.21.4.4 The strncmp function</a></h5>
16981 <p><b>Synopsis</b>
16982 <p><a name="7.21.4.4p1" href="#7.21.4.4p1"><small>1</small></a>
16983 <pre>
16984 #include <a href="#7.21">&lt;string.h&gt;</a>
16985 int strncmp(const char *s1, const char *s2, size_t n);
16986 </pre>
16987 <p><b>Description</b>
16988 <p><a name="7.21.4.4p2" href="#7.21.4.4p2"><small>2</small></a>
16989 The strncmp function compares not more than n characters (characters that follow a
16990 null character are not compared) from the array pointed to by s1 to the array pointed to
16991 by s2.
16992 <p><b>Returns</b>
16993 <p><a name="7.21.4.4p3" href="#7.21.4.4p3"><small>3</small></a>
16994 The strncmp function returns an integer greater than, equal to, or less than zero,
16995 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
16996 to, or less than the possibly null-terminated array pointed to by s2.
16998 <p><small><a href="#Contents">Contents</a></small>
16999 <h5><a name="7.21.4.5" href="#7.21.4.5">7.21.4.5 The strxfrm function</a></h5>
17000 <p><b>Synopsis</b>
17001 <p><a name="7.21.4.5p1" href="#7.21.4.5p1"><small>1</small></a>
17002 <pre>
17003 #include <a href="#7.21">&lt;string.h&gt;</a>
17004 size_t strxfrm(char * restrict s1,
17005 const char * restrict s2,
17006 size_t n);
17007 </pre>
17008 <p><b>Description</b>
17009 <p><a name="7.21.4.5p2" href="#7.21.4.5p2"><small>2</small></a>
17010 The strxfrm function transforms the string pointed to by s2 and places the resulting
17011 string into the array pointed to by s1. The transformation is such that if the strcmp
17012 function is applied to two transformed strings, it returns a value greater than, equal to, or
17013 <!--page 342 -->
17014 less than zero, corresponding to the result of the strcoll function applied to the same
17015 two original strings. No more than n characters are placed into the resulting array
17016 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
17017 be a null pointer. If copying takes place between objects that overlap, the behavior is
17018 undefined.
17019 <p><b>Returns</b>
17020 <p><a name="7.21.4.5p3" href="#7.21.4.5p3"><small>3</small></a>
17021 The strxfrm function returns the length of the transformed string (not including the
17022 terminating null character). If the value returned is n or more, the contents of the array
17023 pointed to by s1 are indeterminate.
17024 <p><a name="7.21.4.5p4" href="#7.21.4.5p4"><small>4</small></a>
17025 EXAMPLE The value of the following expression is the size of the array needed to hold the
17026 transformation of the string pointed to by s.
17027 <pre>
17028 1 + strxfrm(NULL, s, 0)
17029 </pre>
17032 <p><small><a href="#Contents">Contents</a></small>
17033 <h4><a name="7.21.5" href="#7.21.5">7.21.5 Search functions</a></h4>
17035 <p><small><a href="#Contents">Contents</a></small>
17036 <h5><a name="7.21.5.1" href="#7.21.5.1">7.21.5.1 The memchr function</a></h5>
17037 <p><b>Synopsis</b>
17038 <p><a name="7.21.5.1p1" href="#7.21.5.1p1"><small>1</small></a>
17039 <pre>
17040 #include <a href="#7.21">&lt;string.h&gt;</a>
17041 void *memchr(const void *s, int c, size_t n);
17042 </pre>
17043 <p><b>Description</b>
17044 <p><a name="7.21.5.1p2" href="#7.21.5.1p2"><small>2</small></a>
17045 The memchr function locates the first occurrence of c (converted to an unsigned
17046 char) in the initial n characters (each interpreted as unsigned char) of the object
17047 pointed to by s.
17048 <p><b>Returns</b>
17049 <p><a name="7.21.5.1p3" href="#7.21.5.1p3"><small>3</small></a>
17050 The memchr function returns a pointer to the located character, or a null pointer if the
17051 character does not occur in the object.
17053 <p><small><a href="#Contents">Contents</a></small>
17054 <h5><a name="7.21.5.2" href="#7.21.5.2">7.21.5.2 The strchr function</a></h5>
17055 <p><b>Synopsis</b>
17056 <p><a name="7.21.5.2p1" href="#7.21.5.2p1"><small>1</small></a>
17057 <pre>
17058 #include <a href="#7.21">&lt;string.h&gt;</a>
17059 char *strchr(const char *s, int c);
17060 </pre>
17061 <p><b>Description</b>
17062 <p><a name="7.21.5.2p2" href="#7.21.5.2p2"><small>2</small></a>
17063 The strchr function locates the first occurrence of c (converted to a char) in the
17064 string pointed to by s. The terminating null character is considered to be part of the
17065 string.
17066 <p><b>Returns</b>
17067 <p><a name="7.21.5.2p3" href="#7.21.5.2p3"><small>3</small></a>
17068 The strchr function returns a pointer to the located character, or a null pointer if the
17069 character does not occur in the string.
17070 <!--page 343 -->
17072 <p><small><a href="#Contents">Contents</a></small>
17073 <h5><a name="7.21.5.3" href="#7.21.5.3">7.21.5.3 The strcspn function</a></h5>
17074 <p><b>Synopsis</b>
17075 <p><a name="7.21.5.3p1" href="#7.21.5.3p1"><small>1</small></a>
17076 <pre>
17077 #include <a href="#7.21">&lt;string.h&gt;</a>
17078 size_t strcspn(const char *s1, const char *s2);
17079 </pre>
17080 <p><b>Description</b>
17081 <p><a name="7.21.5.3p2" href="#7.21.5.3p2"><small>2</small></a>
17082 The strcspn function computes the length of the maximum initial segment of the string
17083 pointed to by s1 which consists entirely of characters not from the string pointed to by
17085 <p><b>Returns</b>
17086 <p><a name="7.21.5.3p3" href="#7.21.5.3p3"><small>3</small></a>
17087 The strcspn function returns the length of the segment.
17089 <p><small><a href="#Contents">Contents</a></small>
17090 <h5><a name="7.21.5.4" href="#7.21.5.4">7.21.5.4 The strpbrk function</a></h5>
17091 <p><b>Synopsis</b>
17092 <p><a name="7.21.5.4p1" href="#7.21.5.4p1"><small>1</small></a>
17093 <pre>
17094 #include <a href="#7.21">&lt;string.h&gt;</a>
17095 char *strpbrk(const char *s1, const char *s2);
17096 </pre>
17097 <p><b>Description</b>
17098 <p><a name="7.21.5.4p2" href="#7.21.5.4p2"><small>2</small></a>
17099 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
17100 character from the string pointed to by s2.
17101 <p><b>Returns</b>
17102 <p><a name="7.21.5.4p3" href="#7.21.5.4p3"><small>3</small></a>
17103 The strpbrk function returns a pointer to the character, or a null pointer if no character
17104 from s2 occurs in s1.
17106 <p><small><a href="#Contents">Contents</a></small>
17107 <h5><a name="7.21.5.5" href="#7.21.5.5">7.21.5.5 The strrchr function</a></h5>
17108 <p><b>Synopsis</b>
17109 <p><a name="7.21.5.5p1" href="#7.21.5.5p1"><small>1</small></a>
17110 <pre>
17111 #include <a href="#7.21">&lt;string.h&gt;</a>
17112 char *strrchr(const char *s, int c);
17113 </pre>
17114 <p><b>Description</b>
17115 <p><a name="7.21.5.5p2" href="#7.21.5.5p2"><small>2</small></a>
17116 The strrchr function locates the last occurrence of c (converted to a char) in the
17117 string pointed to by s. The terminating null character is considered to be part of the
17118 string.
17119 <p><b>Returns</b>
17120 <p><a name="7.21.5.5p3" href="#7.21.5.5p3"><small>3</small></a>
17121 The strrchr function returns a pointer to the character, or a null pointer if c does not
17122 occur in the string.
17123 <!--page 344 -->
17125 <p><small><a href="#Contents">Contents</a></small>
17126 <h5><a name="7.21.5.6" href="#7.21.5.6">7.21.5.6 The strspn function</a></h5>
17127 <p><b>Synopsis</b>
17128 <p><a name="7.21.5.6p1" href="#7.21.5.6p1"><small>1</small></a>
17129 <pre>
17130 #include <a href="#7.21">&lt;string.h&gt;</a>
17131 size_t strspn(const char *s1, const char *s2);
17132 </pre>
17133 <p><b>Description</b>
17134 <p><a name="7.21.5.6p2" href="#7.21.5.6p2"><small>2</small></a>
17135 The strspn function computes the length of the maximum initial segment of the string
17136 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
17137 <p><b>Returns</b>
17138 <p><a name="7.21.5.6p3" href="#7.21.5.6p3"><small>3</small></a>
17139 The strspn function returns the length of the segment.
17141 <p><small><a href="#Contents">Contents</a></small>
17142 <h5><a name="7.21.5.7" href="#7.21.5.7">7.21.5.7 The strstr function</a></h5>
17143 <p><b>Synopsis</b>
17144 <p><a name="7.21.5.7p1" href="#7.21.5.7p1"><small>1</small></a>
17145 <pre>
17146 #include <a href="#7.21">&lt;string.h&gt;</a>
17147 char *strstr(const char *s1, const char *s2);
17148 </pre>
17149 <p><b>Description</b>
17150 <p><a name="7.21.5.7p2" href="#7.21.5.7p2"><small>2</small></a>
17151 The strstr function locates the first occurrence in the string pointed to by s1 of the
17152 sequence of characters (excluding the terminating null character) in the string pointed to
17153 by s2.
17154 <p><b>Returns</b>
17155 <p><a name="7.21.5.7p3" href="#7.21.5.7p3"><small>3</small></a>
17156 The strstr function returns a pointer to the located string, or a null pointer if the string
17157 is not found. If s2 points to a string with zero length, the function returns s1.
17159 <p><small><a href="#Contents">Contents</a></small>
17160 <h5><a name="7.21.5.8" href="#7.21.5.8">7.21.5.8 The strtok function</a></h5>
17161 <p><b>Synopsis</b>
17162 <p><a name="7.21.5.8p1" href="#7.21.5.8p1"><small>1</small></a>
17163 <pre>
17164 #include <a href="#7.21">&lt;string.h&gt;</a>
17165 char *strtok(char * restrict s1,
17166 const char * restrict s2);
17167 </pre>
17168 <p><b>Description</b>
17169 <p><a name="7.21.5.8p2" href="#7.21.5.8p2"><small>2</small></a>
17170 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
17171 sequence of tokens, each of which is delimited by a character from the string pointed to
17172 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
17173 sequence have a null first argument. The separator string pointed to by s2 may be
17174 different from call to call.
17175 <p><a name="7.21.5.8p3" href="#7.21.5.8p3"><small>3</small></a>
17176 The first call in the sequence searches the string pointed to by s1 for the first character
17177 that is not contained in the current separator string pointed to by s2. If no such character
17178 is found, then there are no tokens in the string pointed to by s1 and the strtok function
17179 <!--page 345 -->
17180 returns a null pointer. If such a character is found, it is the start of the first token.
17181 <p><a name="7.21.5.8p4" href="#7.21.5.8p4"><small>4</small></a>
17182 The strtok function then searches from there for a character that is contained in the
17183 current separator string. If no such character is found, the current token extends to the
17184 end of the string pointed to by s1, and subsequent searches for a token will return a null
17185 pointer. If such a character is found, it is overwritten by a null character, which
17186 terminates the current token. The strtok function saves a pointer to the following
17187 character, from which the next search for a token will start.
17188 <p><a name="7.21.5.8p5" href="#7.21.5.8p5"><small>5</small></a>
17189 Each subsequent call, with a null pointer as the value of the first argument, starts
17190 searching from the saved pointer and behaves as described above.
17191 <p><a name="7.21.5.8p6" href="#7.21.5.8p6"><small>6</small></a>
17192 The implementation shall behave as if no library function calls the strtok function.
17193 <p><b>Returns</b>
17194 <p><a name="7.21.5.8p7" href="#7.21.5.8p7"><small>7</small></a>
17195 The strtok function returns a pointer to the first character of a token, or a null pointer
17196 if there is no token.
17197 <p><a name="7.21.5.8p8" href="#7.21.5.8p8"><small>8</small></a>
17198 EXAMPLE
17199 <pre>
17200 #include <a href="#7.21">&lt;string.h&gt;</a>
17201 static char str[] = "?a???b,,,#c";
17202 char *t;
17203 t = strtok(str, "?"); // t points to the token "a"
17204 t = strtok(NULL, ","); // t points to the token "??b"
17205 t = strtok(NULL, "#,"); // t points to the token "c"
17206 t = strtok(NULL, "?"); // t is a null pointer
17207 </pre>
17210 <p><small><a href="#Contents">Contents</a></small>
17211 <h4><a name="7.21.6" href="#7.21.6">7.21.6 Miscellaneous functions</a></h4>
17213 <p><small><a href="#Contents">Contents</a></small>
17214 <h5><a name="7.21.6.1" href="#7.21.6.1">7.21.6.1 The memset function</a></h5>
17215 <p><b>Synopsis</b>
17216 <p><a name="7.21.6.1p1" href="#7.21.6.1p1"><small>1</small></a>
17217 <pre>
17218 #include <a href="#7.21">&lt;string.h&gt;</a>
17219 void *memset(void *s, int c, size_t n);
17220 </pre>
17221 <p><b>Description</b>
17222 <p><a name="7.21.6.1p2" href="#7.21.6.1p2"><small>2</small></a>
17223 The memset function copies the value of c (converted to an unsigned char) into
17224 each of the first n characters of the object pointed to by s.
17225 <p><b>Returns</b>
17226 <p><a name="7.21.6.1p3" href="#7.21.6.1p3"><small>3</small></a>
17227 The memset function returns the value of s.
17228 <!--page 346 -->
17230 <p><small><a href="#Contents">Contents</a></small>
17231 <h5><a name="7.21.6.2" href="#7.21.6.2">7.21.6.2 The strerror function</a></h5>
17232 <p><b>Synopsis</b>
17233 <p><a name="7.21.6.2p1" href="#7.21.6.2p1"><small>1</small></a>
17234 <pre>
17235 #include <a href="#7.21">&lt;string.h&gt;</a>
17236 char *strerror(int errnum);
17237 </pre>
17238 <p><b>Description</b>
17239 <p><a name="7.21.6.2p2" href="#7.21.6.2p2"><small>2</small></a>
17240 The strerror function maps the number in errnum to a message string. Typically,
17241 the values for errnum come from errno, but strerror shall map any value of type
17242 int to a message.
17243 <p><a name="7.21.6.2p3" href="#7.21.6.2p3"><small>3</small></a>
17244 The implementation shall behave as if no library function calls the strerror function.
17245 <p><b>Returns</b>
17246 <p><a name="7.21.6.2p4" href="#7.21.6.2p4"><small>4</small></a>
17247 The strerror function returns a pointer to the string, the contents of which are locale-
17248 specific. The array pointed to shall not be modified by the program, but may be
17249 overwritten by a subsequent call to the strerror function.
17251 <p><small><a href="#Contents">Contents</a></small>
17252 <h5><a name="7.21.6.3" href="#7.21.6.3">7.21.6.3 The strlen function</a></h5>
17253 <p><b>Synopsis</b>
17254 <p><a name="7.21.6.3p1" href="#7.21.6.3p1"><small>1</small></a>
17255 <pre>
17256 #include <a href="#7.21">&lt;string.h&gt;</a>
17257 size_t strlen(const char *s);
17258 </pre>
17259 <p><b>Description</b>
17260 <p><a name="7.21.6.3p2" href="#7.21.6.3p2"><small>2</small></a>
17261 The strlen function computes the length of the string pointed to by s.
17262 <p><b>Returns</b>
17263 <p><a name="7.21.6.3p3" href="#7.21.6.3p3"><small>3</small></a>
17264 The strlen function returns the number of characters that precede the terminating null
17265 character.
17266 <!--page 347 -->
17268 <p><small><a href="#Contents">Contents</a></small>
17269 <h3><a name="7.22" href="#7.22">7.22 Type-generic math &lt;tgmath.h&gt;</a></h3>
17270 <p><a name="7.22p1" href="#7.22p1"><small>1</small></a>
17271 The header <a href="#7.22">&lt;tgmath.h&gt;</a> includes the headers <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> and
17272 defines several type-generic macros.
17273 <p><a name="7.22p2" href="#7.22p2"><small>2</small></a>
17274 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
17275 double) suffix, several have one or more parameters whose corresponding real type is
17276 double. For each such function, except modf, there is a corresponding type-generic
17277 macro.<sup><a href="#note272"><b>272)</b></a></sup> The parameters whose corresponding real type is double in the function
17278 synopsis are generic parameters. Use of the macro invokes a function whose
17279 corresponding real type and type domain are determined by the arguments for the generic
17280 parameters.<sup><a href="#note273"><b>273)</b></a></sup>
17281 <p><a name="7.22p3" href="#7.22p3"><small>3</small></a>
17282 Use of the macro invokes a function whose generic parameters have the corresponding
17283 real type determined as follows:
17284 <ul>
17285 <li> First, if any argument for generic parameters has type long double, the type
17286 determined is long double.
17287 <li> Otherwise, if any argument for generic parameters has type double or is of integer
17288 type, the type determined is double.
17289 <li> Otherwise, the type determined is float.
17290 </ul>
17291 <p><a name="7.22p4" href="#7.22p4"><small>4</small></a>
17292 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
17293 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
17294 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
17295 corresponding type-generic macro for fabs and cabs is fabs.
17300 <!--page 348 -->
17301 <pre>
17302 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
17303 function function macro
17305 acos cacos acos
17306 asin casin asin
17307 atan catan atan
17308 acosh cacosh acosh
17309 asinh casinh asinh
17310 atanh catanh atanh
17311 cos ccos cos
17312 sin csin sin
17313 tan ctan tan
17314 cosh ccosh cosh
17315 sinh csinh sinh
17316 tanh ctanh tanh
17317 exp cexp exp
17318 log clog log
17319 pow cpow pow
17320 sqrt csqrt sqrt
17321 fabs cabs fabs
17322 </pre>
17323 If at least one argument for a generic parameter is complex, then use of the macro invokes
17324 a complex function; otherwise, use of the macro invokes a real function.
17325 <p><a name="7.22p5" href="#7.22p5"><small>5</small></a>
17326 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
17327 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
17328 name as the function. These type-generic macros are:
17329 <pre>
17330 atan2 fma llround remainder
17331 cbrt fmax log10 remquo
17332 ceil fmin log1p rint
17333 copysign fmod log2 round
17334 erf frexp logb scalbn
17335 erfc hypot lrint scalbln
17336 exp2 ilogb lround tgamma
17337 expm1 ldexp nearbyint trunc
17338 fdim lgamma nextafter
17339 floor llrint nexttoward
17340 </pre>
17341 If all arguments for generic parameters are real, then use of the macro invokes a real
17342 function; otherwise, use of the macro results in undefined behavior.
17343 <p><a name="7.22p6" href="#7.22p6"><small>6</small></a>
17344 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
17345 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
17346 function. These type-generic macros are:
17347 <!--page 349 -->
17348 <pre>
17349 carg conj creal
17350 cimag cproj
17351 </pre>
17352 Use of the macro with any real or complex argument invokes a complex function.
17353 <p><a name="7.22p7" href="#7.22p7"><small>7</small></a>
17354 EXAMPLE With the declarations
17355 <pre>
17356 #include <a href="#7.22">&lt;tgmath.h&gt;</a>
17357 int n;
17358 float f;
17359 double d;
17360 long double ld;
17361 float complex fc;
17362 double complex dc;
17363 long double complex ldc;
17364 </pre>
17365 functions invoked by use of type-generic macros are shown in the following table:
17366 <!--page 350 -->
17367 <pre>
17368 macro use invokes
17370 exp(n) exp(n), the function
17371 acosh(f) acoshf(f)
17372 sin(d) sin(d), the function
17373 atan(ld) atanl(ld)
17374 log(fc) clogf(fc)
17375 sqrt(dc) csqrt(dc)
17376 pow(ldc, f) cpowl(ldc, f)
17377 remainder(n, n) remainder(n, n), the function
17378 nextafter(d, f) nextafter(d, f), the function
17379 nexttoward(f, ld) nexttowardf(f, ld)
17380 copysign(n, ld) copysignl(n, ld)
17381 ceil(fc) undefined behavior
17382 rint(dc) undefined behavior
17383 fmax(ldc, ld) undefined behavior
17384 carg(n) carg(n), the function
17385 cproj(f) cprojf(f)
17386 creal(d) creal(d), the function
17387 cimag(ld) cimagl(ld)
17388 fabs(fc) cabsf(fc)
17389 carg(dc) carg(dc), the function
17390 cproj(ldc) cprojl(ldc)
17391 </pre>
17393 <p><b>Footnotes</b>
17394 <p><small><a name="note272" href="#note272">272)</a> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
17395 make available the corresponding ordinary function.
17396 </small>
17397 <p><small><a name="note273" href="#note273">273)</a> If the type of the argument is not compatible with the type of the parameter for the selected function,
17398 the behavior is undefined.
17399 </small>
17401 <p><small><a href="#Contents">Contents</a></small>
17402 <h3><a name="7.23" href="#7.23">7.23 Date and time &lt;time.h&gt;</a></h3>
17404 <p><small><a href="#Contents">Contents</a></small>
17405 <h4><a name="7.23.1" href="#7.23.1">7.23.1 Components of time</a></h4>
17406 <p><a name="7.23.1p1" href="#7.23.1p1"><small>1</small></a>
17407 The header <a href="#7.23">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
17408 manipulating time. Many functions deal with a calendar time that represents the current
17409 date (according to the Gregorian calendar) and time. Some functions deal with local
17410 time, which is the calendar time expressed for some specific time zone, and with Daylight
17411 Saving Time, which is a temporary change in the algorithm for determining local time.
17412 The local time zone and Daylight Saving Time are implementation-defined.
17413 <p><a name="7.23.1p2" href="#7.23.1p2"><small>2</small></a>
17414 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
17415 <pre>
17416 CLOCKS_PER_SEC
17417 </pre>
17418 which expands to an expression with type clock_t (described below) that is the
17419 number per second of the value returned by the clock function.
17420 <p><a name="7.23.1p3" href="#7.23.1p3"><small>3</small></a>
17421 The types declared are size_t (described in <a href="#7.17">7.17</a>);
17422 <pre>
17423 clock_t
17424 </pre>
17426 <pre>
17427 time_t
17428 </pre>
17429 which are arithmetic types capable of representing times; and
17430 <pre>
17431 struct tm
17432 </pre>
17433 which holds the components of a calendar time, called the broken-down time.
17434 <p><a name="7.23.1p4" href="#7.23.1p4"><small>4</small></a>
17435 The range and precision of times representable in clock_t and time_t are
17436 implementation-defined. The tm structure shall contain at least the following members,
17437 in any order. The semantics of the members and their normal ranges are expressed in the
17438 comments.<sup><a href="#note274"><b>274)</b></a></sup>
17439 <pre>
17440 int tm_sec; // seconds after the minute -- [0, 60]
17441 int tm_min; // minutes after the hour -- [0, 59]
17442 int tm_hour; // hours since midnight -- [0, 23]
17443 int tm_mday; // day of the month -- [1, 31]
17444 int tm_mon; // months since January -- [0, 11]
17445 int tm_year; // years since 1900
17446 int tm_wday; // days since Sunday -- [0, 6]
17447 int tm_yday; // days since January 1 -- [0, 365]
17448 int tm_isdst; // Daylight Saving Time flag
17449 </pre>
17453 <!--page 351 -->
17454 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
17455 Saving Time is not in effect, and negative if the information is not available.
17457 <p><b>Footnotes</b>
17458 <p><small><a name="note274" href="#note274">274)</a> The range [0, 60] for tm_sec allows for a positive leap second.
17459 </small>
17461 <p><small><a href="#Contents">Contents</a></small>
17462 <h4><a name="7.23.2" href="#7.23.2">7.23.2 Time manipulation functions</a></h4>
17464 <p><small><a href="#Contents">Contents</a></small>
17465 <h5><a name="7.23.2.1" href="#7.23.2.1">7.23.2.1 The clock function</a></h5>
17466 <p><b>Synopsis</b>
17467 <p><a name="7.23.2.1p1" href="#7.23.2.1p1"><small>1</small></a>
17468 <pre>
17469 #include <a href="#7.23">&lt;time.h&gt;</a>
17470 clock_t clock(void);
17471 </pre>
17472 <p><b>Description</b>
17473 <p><a name="7.23.2.1p2" href="#7.23.2.1p2"><small>2</small></a>
17474 The clock function determines the processor time used.
17475 <p><b>Returns</b>
17476 <p><a name="7.23.2.1p3" href="#7.23.2.1p3"><small>3</small></a>
17477 The clock function returns the implementation's best approximation to the processor
17478 time used by the program since the beginning of an implementation-defined era related
17479 only to the program invocation. To determine the time in seconds, the value returned by
17480 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
17481 the processor time used is not available or its value cannot be represented, the function
17482 returns the value (clock_t)(-1).<sup><a href="#note275"><b>275)</b></a></sup>
17484 <p><b>Footnotes</b>
17485 <p><small><a name="note275" href="#note275">275)</a> In order to measure the time spent in a program, the clock function should be called at the start of
17486 the program and its return value subtracted from the value returned by subsequent calls.
17487 </small>
17489 <p><small><a href="#Contents">Contents</a></small>
17490 <h5><a name="7.23.2.2" href="#7.23.2.2">7.23.2.2 The difftime function</a></h5>
17491 <p><b>Synopsis</b>
17492 <p><a name="7.23.2.2p1" href="#7.23.2.2p1"><small>1</small></a>
17493 <pre>
17494 #include <a href="#7.23">&lt;time.h&gt;</a>
17495 double difftime(time_t time1, time_t time0);
17496 </pre>
17497 <p><b>Description</b>
17498 <p><a name="7.23.2.2p2" href="#7.23.2.2p2"><small>2</small></a>
17499 The difftime function computes the difference between two calendar times: time1 -
17500 time0.
17501 <p><b>Returns</b>
17502 <p><a name="7.23.2.2p3" href="#7.23.2.2p3"><small>3</small></a>
17503 The difftime function returns the difference expressed in seconds as a double.
17508 <!--page 352 -->
17510 <p><small><a href="#Contents">Contents</a></small>
17511 <h5><a name="7.23.2.3" href="#7.23.2.3">7.23.2.3 The mktime function</a></h5>
17512 <p><b>Synopsis</b>
17513 <p><a name="7.23.2.3p1" href="#7.23.2.3p1"><small>1</small></a>
17514 <pre>
17515 #include <a href="#7.23">&lt;time.h&gt;</a>
17516 time_t mktime(struct tm *timeptr);
17517 </pre>
17518 <p><b>Description</b>
17519 <p><a name="7.23.2.3p2" href="#7.23.2.3p2"><small>2</small></a>
17520 The mktime function converts the broken-down time, expressed as local time, in the
17521 structure pointed to by timeptr into a calendar time value with the same encoding as
17522 that of the values returned by the time function. The original values of the tm_wday
17523 and tm_yday components of the structure are ignored, and the original values of the
17524 other components are not restricted to the ranges indicated above.<sup><a href="#note276"><b>276)</b></a></sup> On successful
17525 completion, the values of the tm_wday and tm_yday components of the structure are
17526 set appropriately, and the other components are set to represent the specified calendar
17527 time, but with their values forced to the ranges indicated above; the final value of
17528 tm_mday is not set until tm_mon and tm_year are determined.
17529 <p><b>Returns</b>
17530 <p><a name="7.23.2.3p3" href="#7.23.2.3p3"><small>3</small></a>
17531 The mktime function returns the specified calendar time encoded as a value of type
17532 time_t. If the calendar time cannot be represented, the function returns the value
17533 (time_t)(-1).
17534 <p><a name="7.23.2.3p4" href="#7.23.2.3p4"><small>4</small></a>
17535 EXAMPLE What day of the week is July 4, 2001?
17536 <pre>
17537 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17538 #include <a href="#7.23">&lt;time.h&gt;</a>
17539 static const char *const wday[] = {
17540 "Sunday", "Monday", "Tuesday", "Wednesday",
17541 "Thursday", "Friday", "Saturday", "-unknown-"
17543 struct tm time_str;
17544 /* ... */
17545 </pre>
17550 <!--page 353 -->
17551 <pre>
17552 time_str.tm_year = 2001 - 1900;
17553 time_str.tm_mon = 7 - 1;
17554 time_str.tm_mday = 4;
17555 time_str.tm_hour = 0;
17556 time_str.tm_min = 0;
17557 time_str.tm_sec = 1;
17558 time_str.tm_isdst = -1;
17559 if (mktime(&amp;time_str) == (time_t)(-1))
17560 time_str.tm_wday = 7;
17561 printf("%s\n", wday[time_str.tm_wday]);
17562 </pre>
17565 <p><b>Footnotes</b>
17566 <p><small><a name="note276" href="#note276">276)</a> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
17567 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
17568 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
17569 </small>
17571 <p><small><a href="#Contents">Contents</a></small>
17572 <h5><a name="7.23.2.4" href="#7.23.2.4">7.23.2.4 The time function</a></h5>
17573 <p><b>Synopsis</b>
17574 <p><a name="7.23.2.4p1" href="#7.23.2.4p1"><small>1</small></a>
17575 <pre>
17576 #include <a href="#7.23">&lt;time.h&gt;</a>
17577 time_t time(time_t *timer);
17578 </pre>
17579 <p><b>Description</b>
17580 <p><a name="7.23.2.4p2" href="#7.23.2.4p2"><small>2</small></a>
17581 The time function determines the current calendar time. The encoding of the value is
17582 unspecified.
17583 <p><b>Returns</b>
17584 <p><a name="7.23.2.4p3" href="#7.23.2.4p3"><small>3</small></a>
17585 The time function returns the implementation's best approximation to the current
17586 calendar time. The value (time_t)(-1) is returned if the calendar time is not
17587 available. If timer is not a null pointer, the return value is also assigned to the object it
17588 points to.
17590 <p><small><a href="#Contents">Contents</a></small>
17591 <h4><a name="7.23.3" href="#7.23.3">7.23.3 Time conversion functions</a></h4>
17592 <p><a name="7.23.3p1" href="#7.23.3p1"><small>1</small></a>
17593 Except for the strftime function, these functions each return a pointer to one of two
17594 types of static objects: a broken-down time structure or an array of char. Execution of
17595 any of the functions that return a pointer to one of these object types may overwrite the
17596 information in any object of the same type pointed to by the value returned from any
17597 previous call to any of them. The implementation shall behave as if no other library
17598 functions call these functions.
17600 <p><small><a href="#Contents">Contents</a></small>
17601 <h5><a name="7.23.3.1" href="#7.23.3.1">7.23.3.1 The asctime function</a></h5>
17602 <p><b>Synopsis</b>
17603 <p><a name="7.23.3.1p1" href="#7.23.3.1p1"><small>1</small></a>
17604 <pre>
17605 #include <a href="#7.23">&lt;time.h&gt;</a>
17606 char *asctime(const struct tm *timeptr);
17607 </pre>
17608 <p><b>Description</b>
17609 <p><a name="7.23.3.1p2" href="#7.23.3.1p2"><small>2</small></a>
17610 The asctime function converts the broken-down time in the structure pointed to by
17611 timeptr into a string in the form
17612 <!--page 354 -->
17613 <pre>
17614 Sun Sep 16 01:03:52 1973\n\0
17615 </pre>
17616 using the equivalent of the following algorithm.
17617 <pre>
17618 char *asctime(const struct tm *timeptr)
17620 static const char wday_name[7][3] = {
17621 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
17623 static const char mon_name[12][3] = {
17624 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
17625 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
17627 static char result[26];
17628 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
17629 wday_name[timeptr-&gt;tm_wday],
17630 mon_name[timeptr-&gt;tm_mon],
17631 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
17632 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
17633 1900 + timeptr-&gt;tm_year);
17634 return result;
17636 </pre>
17637 <p><b>Returns</b>
17638 <p><a name="7.23.3.1p3" href="#7.23.3.1p3"><small>3</small></a>
17639 The asctime function returns a pointer to the string.
17641 <p><small><a href="#Contents">Contents</a></small>
17642 <h5><a name="7.23.3.2" href="#7.23.3.2">7.23.3.2 The ctime function</a></h5>
17643 <p><b>Synopsis</b>
17644 <p><a name="7.23.3.2p1" href="#7.23.3.2p1"><small>1</small></a>
17645 <pre>
17646 #include <a href="#7.23">&lt;time.h&gt;</a>
17647 char *ctime(const time_t *timer);
17648 </pre>
17649 <p><b>Description</b>
17650 <p><a name="7.23.3.2p2" href="#7.23.3.2p2"><small>2</small></a>
17651 The ctime function converts the calendar time pointed to by timer to local time in the
17652 form of a string. It is equivalent to
17653 <pre>
17654 asctime(localtime(timer))
17655 </pre>
17656 <p><b>Returns</b>
17657 <p><a name="7.23.3.2p3" href="#7.23.3.2p3"><small>3</small></a>
17658 The ctime function returns the pointer returned by the asctime function with that
17659 broken-down time as argument.
17660 <p><b> Forward references</b>: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
17661 <!--page 355 -->
17663 <p><small><a href="#Contents">Contents</a></small>
17664 <h5><a name="7.23.3.3" href="#7.23.3.3">7.23.3.3 The gmtime function</a></h5>
17665 <p><b>Synopsis</b>
17666 <p><a name="7.23.3.3p1" href="#7.23.3.3p1"><small>1</small></a>
17667 <pre>
17668 #include <a href="#7.23">&lt;time.h&gt;</a>
17669 struct tm *gmtime(const time_t *timer);
17670 </pre>
17671 <p><b>Description</b>
17672 <p><a name="7.23.3.3p2" href="#7.23.3.3p2"><small>2</small></a>
17673 The gmtime function converts the calendar time pointed to by timer into a broken-
17674 down time, expressed as UTC.
17675 <p><b>Returns</b>
17676 <p><a name="7.23.3.3p3" href="#7.23.3.3p3"><small>3</small></a>
17677 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
17678 specified time cannot be converted to UTC.
17680 <p><small><a href="#Contents">Contents</a></small>
17681 <h5><a name="7.23.3.4" href="#7.23.3.4">7.23.3.4 The localtime function</a></h5>
17682 <p><b>Synopsis</b>
17683 <p><a name="7.23.3.4p1" href="#7.23.3.4p1"><small>1</small></a>
17684 <pre>
17685 #include <a href="#7.23">&lt;time.h&gt;</a>
17686 struct tm *localtime(const time_t *timer);
17687 </pre>
17688 <p><b>Description</b>
17689 <p><a name="7.23.3.4p2" href="#7.23.3.4p2"><small>2</small></a>
17690 The localtime function converts the calendar time pointed to by timer into a
17691 broken-down time, expressed as local time.
17692 <p><b>Returns</b>
17693 <p><a name="7.23.3.4p3" href="#7.23.3.4p3"><small>3</small></a>
17694 The localtime function returns a pointer to the broken-down time, or a null pointer if
17695 the specified time cannot be converted to local time.
17697 <p><small><a href="#Contents">Contents</a></small>
17698 <h5><a name="7.23.3.5" href="#7.23.3.5">7.23.3.5 The strftime function</a></h5>
17699 <p><b>Synopsis</b>
17700 <p><a name="7.23.3.5p1" href="#7.23.3.5p1"><small>1</small></a>
17701 <pre>
17702 #include <a href="#7.23">&lt;time.h&gt;</a>
17703 size_t strftime(char * restrict s,
17704 size_t maxsize,
17705 const char * restrict format,
17706 const struct tm * restrict timeptr);
17707 </pre>
17708 <p><b>Description</b>
17709 <p><a name="7.23.3.5p2" href="#7.23.3.5p2"><small>2</small></a>
17710 The strftime function places characters into the array pointed to by s as controlled by
17711 the string pointed to by format. The format shall be a multibyte character sequence,
17712 beginning and ending in its initial shift state. The format string consists of zero or
17713 more conversion specifiers and ordinary multibyte characters. A conversion specifier
17714 consists of a % character, possibly followed by an E or O modifier character (described
17715 below), followed by a character that determines the behavior of the conversion specifier.
17716 All ordinary multibyte characters (including the terminating null character) are copied
17717 <!--page 356 -->
17718 unchanged into the array. If copying takes place between objects that overlap, the
17719 behavior is undefined. No more than maxsize characters are placed into the array.
17720 <p><a name="7.23.3.5p3" href="#7.23.3.5p3"><small>3</small></a>
17721 Each conversion specifier is replaced by appropriate characters as described in the
17722 following list. The appropriate characters are determined using the LC_TIME category
17723 of the current locale and by the values of zero or more members of the broken-down time
17724 structure pointed to by timeptr, as specified in brackets in the description. If any of
17725 the specified values is outside the normal range, the characters stored are unspecified.
17726 <dl>
17727 <dt> %a <dd> is replaced by the locale's abbreviated weekday name. [tm_wday]
17728 <dt> %A <dd> is replaced by the locale's full weekday name. [tm_wday]
17729 <dt> %b <dd> is replaced by the locale's abbreviated month name. [tm_mon]
17730 <dt> %B <dd> is replaced by the locale's full month name. [tm_mon]
17731 <dt> %c <dd> is replaced by the locale's appropriate date and time representation. [all specified
17732 in <a href="#7.23.1">7.23.1</a>]
17733 <dt> %C <dd> is replaced by the year divided by 100 and truncated to an integer, as a decimal
17734 number (00-99). [tm_year]
17735 <dt> %d <dd> is replaced by the day of the month as a decimal number (01-31). [tm_mday]
17736 <dt> %D <dd> is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
17737 <dt> %e <dd> is replaced by the day of the month as a decimal number (1-31); a single digit is
17738 preceded by a space. [tm_mday]
17739 <dt> %F <dd> is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
17740 tm_mday]
17741 <dt> %g <dd> is replaced by the last 2 digits of the week-based year (see below) as a decimal
17742 number (00-99). [tm_year, tm_wday, tm_yday]
17743 <dt> %G <dd> is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
17744 [tm_year, tm_wday, tm_yday]
17745 <dt> %h <dd> is equivalent to ''%b''. [tm_mon]
17746 <dt> %H <dd> is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
17747 <dt> %I <dd> is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
17748 <dt> %j <dd> is replaced by the day of the year as a decimal number (001-366). [tm_yday]
17749 <dt> %m <dd> is replaced by the month as a decimal number (01-12). [tm_mon]
17750 <dt> %M <dd> is replaced by the minute as a decimal number (00-59). [tm_min]
17751 <dt> %n <dd> is replaced by a new-line character.
17752 <dt> %p <dd> is replaced by the locale's equivalent of the AM/PM designations associated with a
17753 12-hour clock. [tm_hour]
17754 <dt> %r <dd> is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
17755 <dt> %R <dd> is equivalent to ''%H:%M''. [tm_hour, tm_min]
17756 <dt> %S <dd> is replaced by the second as a decimal number (00-60). [tm_sec]
17757 <dt> %t <dd> is replaced by a horizontal-tab character.
17758 <dt> %T <dd> is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
17759 <!--page 357 -->
17760 tm_sec]
17761 <dt> %u <dd>is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
17762 is 1. [tm_wday]
17763 <dt> %U <dd> is replaced by the week number of the year (the first Sunday as the first day of week
17764 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
17765 <dt> %V <dd> is replaced by the ISO 8601 week number (see below) as a decimal number
17766 (01-53). [tm_year, tm_wday, tm_yday]
17767 <dt> %w <dd> is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
17768 [tm_wday]
17769 <dt> %W <dd> is replaced by the week number of the year (the first Monday as the first day of
17770 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
17771 <dt> %x <dd> is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
17772 <dt> %X <dd> is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
17773 <dt> %y <dd> is replaced by the last 2 digits of the year as a decimal number (00-99).
17774 [tm_year]
17775 <dt> %Y <dd> is replaced by the year as a decimal number (e.g., 1997). [tm_year]
17776 <dt> %z <dd> is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
17777 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
17778 zone is determinable. [tm_isdst]
17779 <dt> %Z <dd> is replaced by the locale's time zone name or abbreviation, or by no characters if no
17780 time zone is determinable. [tm_isdst]
17781 <dt> %% <dd> is replaced by %.
17782 </dl>
17783 <p><a name="7.23.3.5p4" href="#7.23.3.5p4"><small>4</small></a>
17784 Some conversion specifiers can be modified by the inclusion of an E or O modifier
17785 character to indicate an alternative format or specification. If the alternative format or
17786 specification does not exist for the current locale, the modifier is ignored.
17787 <dl>
17788 <dt> %Ec <dd> is replaced by the locale's alternative date and time representation.
17789 <dt> %EC <dd>is replaced by the name of the base year (period) in the locale's alternative
17790 representation.
17791 <dt> %Ex <dd>is replaced by the locale's alternative date representation.
17792 <dt> %EX <dd>is replaced by the locale's alternative time representation.
17793 <dt> %Ey <dd>is replaced by the offset from %EC (year only) in the locale's alternative
17794 representation.
17795 <dt> %EY <dd>is replaced by the locale's full alternative year representation.
17796 <dt> %Od <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
17797 (filled as needed with leading zeros, or with leading spaces if there is no alternative
17798 symbol for zero).
17799 <dt> %Oe <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
17800 (filled as needed with leading spaces).
17801 <dt> %OH <dd>is replaced by the hour (24-hour clock), using the locale's alternative numeric
17802 <!--page 358 -->
17803 symbols.
17804 <dt> %OI <dd>is replaced by the hour (12-hour clock), using the locale's alternative numeric
17805 symbols.
17806 <dt> %Om <dd>is replaced by the month, using the locale's alternative numeric symbols.
17807 <dt> %OM <dd>is replaced by the minutes, using the locale's alternative numeric symbols.
17808 <dt> %OS <dd>is replaced by the seconds, using the locale's alternative numeric symbols.
17809 <dt> %Ou <dd>is replaced by the ISO 8601 weekday as a number in the locale's alternative
17810 representation, where Monday is 1.
17811 <dt> %OU <dd>is replaced by the week number, using the locale's alternative numeric symbols.
17812 <dt> %OV <dd>is replaced by the ISO 8601 week number, using the locale's alternative numeric
17813 symbols.
17814 <dt> %Ow <dd>is replaced by the weekday as a number, using the locale's alternative numeric
17815 symbols.
17816 <dt> %OW <dd>is replaced by the week number of the year, using the locale's alternative numeric
17817 symbols.
17818 <dt> %Oy <dd>is replaced by the last 2 digits of the year, using the locale's alternative numeric
17819 symbols.
17820 </dl>
17821 <p><a name="7.23.3.5p5" href="#7.23.3.5p5"><small>5</small></a>
17822 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
17823 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
17824 which is also the week that includes the first Thursday of the year, and is also the first
17825 week that contains at least four days in the year. If the first Monday of January is the
17826 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
17827 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
17828 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
17829 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
17830 %V is replaced by 01.
17831 <p><a name="7.23.3.5p6" href="#7.23.3.5p6"><small>6</small></a>
17832 If a conversion specifier is not one of the above, the behavior is undefined.
17833 <p><a name="7.23.3.5p7" href="#7.23.3.5p7"><small>7</small></a>
17834 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
17835 following specifiers are:
17836 <dl>
17837 <dt> %a <dd> the first three characters of %A.
17838 <dt> %A <dd> one of ''Sunday'', ''Monday'', ... , ''Saturday''.
17839 <dt> %b <dd> the first three characters of %B.
17840 <dt> %B <dd> one of ''January'', ''February'', ... , ''December''.
17841 <dt> %c <dd> equivalent to ''%a %b %e %T %Y''.
17842 <dt> %p <dd> one of ''AM'' or ''PM''.
17843 <dt> %r <dd> equivalent to ''%I:%M:%S %p''.
17844 <dt> %x <dd> equivalent to ''%m/%d/%y''.
17845 <dt> %X <dd> equivalent to %T.
17846 <dt> %Z <dd> implementation-defined.
17847 </dl>
17848 <!--page 359 -->
17849 <p><b>Returns</b>
17850 <p><a name="7.23.3.5p8" href="#7.23.3.5p8"><small>8</small></a>
17851 If the total number of resulting characters including the terminating null character is not
17852 more than maxsize, the strftime function returns the number of characters placed
17853 into the array pointed to by s not including the terminating null character. Otherwise,
17854 zero is returned and the contents of the array are indeterminate.
17855 <!--page 360 -->
17857 <p><small><a href="#Contents">Contents</a></small>
17858 <h3><a name="7.24" href="#7.24">7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a></h3>
17860 <p><small><a href="#Contents">Contents</a></small>
17861 <h4><a name="7.24.1" href="#7.24.1">7.24.1 Introduction</a></h4>
17862 <p><a name="7.24.1p1" href="#7.24.1p1"><small>1</small></a>
17863 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares four data types, one tag, four macros, and many
17864 functions.<sup><a href="#note277"><b>277)</b></a></sup>
17865 <p><a name="7.24.1p2" href="#7.24.1p2"><small>2</small></a>
17866 The types declared are wchar_t and size_t (both described in <a href="#7.17">7.17</a>);
17867 <pre>
17868 mbstate_t
17869 </pre>
17870 which is an object type other than an array type that can hold the conversion state
17871 information necessary to convert between sequences of multibyte characters and wide
17872 characters;
17873 <pre>
17874 wint_t
17875 </pre>
17876 which is an integer type unchanged by default argument promotions that can hold any
17877 value corresponding to members of the extended character set, as well as at least one
17878 value that does not correspond to any member of the extended character set (see WEOF
17879 below);<sup><a href="#note278"><b>278)</b></a></sup> and
17880 <pre>
17881 struct tm
17882 </pre>
17883 which is declared as an incomplete structure type (the contents are described in <a href="#7.23.1">7.23.1</a>).
17884 <p><a name="7.24.1p3" href="#7.24.1p3"><small>3</small></a>
17885 The macros defined are NULL (described in <a href="#7.17">7.17</a>); WCHAR_MIN and WCHAR_MAX
17886 (described in <a href="#7.18.3">7.18.3</a>); and
17887 <pre>
17888 WEOF
17889 </pre>
17890 which expands to a constant expression of type wint_t whose value does not
17891 correspond to any member of the extended character set.<sup><a href="#note279"><b>279)</b></a></sup> It is accepted (and returned)
17892 by several functions in this subclause to indicate end-of-file, that is, no more input from a
17893 stream. It is also used as a wide character value that does not correspond to any member
17894 of the extended character set.
17895 <p><a name="7.24.1p4" href="#7.24.1p4"><small>4</small></a>
17896 The functions declared are grouped as follows:
17897 <ul>
17898 <li> Functions that perform input and output of wide characters, or multibyte characters,
17899 or both;
17900 <li> Functions that provide wide string numeric conversion;
17901 <li> Functions that perform general wide string manipulation;
17904 <!--page 361 -->
17905 <li> Functions for wide string date and time conversion; and
17906 <li> Functions that provide extended capabilities for conversion between multibyte and
17907 wide character sequences.
17908 </ul>
17909 <p><a name="7.24.1p5" href="#7.24.1p5"><small>5</small></a>
17910 Unless explicitly stated otherwise, if the execution of a function described in this
17911 subclause causes copying to take place between objects that overlap, the behavior is
17912 undefined.
17914 <p><b>Footnotes</b>
17915 <p><small><a name="note277" href="#note277">277)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
17916 </small>
17917 <p><small><a name="note278" href="#note278">278)</a> wchar_t and wint_t can be the same integer type.
17918 </small>
17919 <p><small><a name="note279" href="#note279">279)</a> The value of the macro WEOF may differ from that of EOF and need not be negative.
17920 </small>
17922 <p><small><a href="#Contents">Contents</a></small>
17923 <h4><a name="7.24.2" href="#7.24.2">7.24.2 Formatted wide character input/output functions</a></h4>
17924 <p><a name="7.24.2p1" href="#7.24.2p1"><small>1</small></a>
17925 The formatted wide character input/output functions shall behave as if there is a sequence
17926 point after the actions associated with each specifier.<sup><a href="#note280"><b>280)</b></a></sup>
17928 <p><b>Footnotes</b>
17929 <p><small><a name="note280" href="#note280">280)</a> The fwprintf functions perform writes to memory for the %n specifier.
17930 </small>
17932 <p><small><a href="#Contents">Contents</a></small>
17933 <h5><a name="7.24.2.1" href="#7.24.2.1">7.24.2.1 The fwprintf function</a></h5>
17934 <p><b>Synopsis</b>
17935 <p><a name="7.24.2.1p1" href="#7.24.2.1p1"><small>1</small></a>
17936 <pre>
17937 #include <a href="#7.19">&lt;stdio.h&gt;</a>
17938 #include <a href="#7.24">&lt;wchar.h&gt;</a>
17939 int fwprintf(FILE * restrict stream,
17940 const wchar_t * restrict format, ...);
17941 </pre>
17942 <p><b>Description</b>
17943 <p><a name="7.24.2.1p2" href="#7.24.2.1p2"><small>2</small></a>
17944 The fwprintf function writes output to the stream pointed to by stream, under
17945 control of the wide string pointed to by format that specifies how subsequent arguments
17946 are converted for output. If there are insufficient arguments for the format, the behavior
17947 is undefined. If the format is exhausted while arguments remain, the excess arguments
17948 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
17949 when the end of the format string is encountered.
17950 <p><a name="7.24.2.1p3" href="#7.24.2.1p3"><small>3</small></a>
17951 The format is composed of zero or more directives: ordinary wide characters (not %),
17952 which are copied unchanged to the output stream; and conversion specifications, each of
17953 which results in fetching zero or more subsequent arguments, converting them, if
17954 applicable, according to the corresponding conversion specifier, and then writing the
17955 result to the output stream.
17956 <p><a name="7.24.2.1p4" href="#7.24.2.1p4"><small>4</small></a>
17957 Each conversion specification is introduced by the wide character %. After the %, the
17958 following appear in sequence:
17959 <ul>
17960 <li> Zero or more flags (in any order) that modify the meaning of the conversion
17961 specification.
17962 <li> An optional minimum field width. If the converted value has fewer wide characters
17963 than the field width, it is padded with spaces (by default) on the left (or right, if the
17966 <!--page 362 -->
17967 left adjustment flag, described later, has been given) to the field width. The field
17968 width takes the form of an asterisk * (described later) or a nonnegative decimal
17969 integer.<sup><a href="#note281"><b>281)</b></a></sup>
17970 <li> An optional precision that gives the minimum number of digits to appear for the d, i,
17971 o, u, x, and X conversions, the number of digits to appear after the decimal-point
17972 wide character for a, A, e, E, f, and F conversions, the maximum number of
17973 significant digits for the g and G conversions, or the maximum number of wide
17974 characters to be written for s conversions. The precision takes the form of a period
17975 (.) followed either by an asterisk * (described later) or by an optional decimal
17976 integer; if only the period is specified, the precision is taken as zero. If a precision
17977 appears with any other conversion specifier, the behavior is undefined.
17978 <li> An optional length modifier that specifies the size of the argument.
17979 <li> A conversion specifier wide character that specifies the type of conversion to be
17980 applied.
17981 </ul>
17982 <p><a name="7.24.2.1p5" href="#7.24.2.1p5"><small>5</small></a>
17983 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
17984 this case, an int argument supplies the field width or precision. The arguments
17985 specifying field width, or precision, or both, shall appear (in that order) before the
17986 argument (if any) to be converted. A negative field width argument is taken as a - flag
17987 followed by a positive field width. A negative precision argument is taken as if the
17988 precision were omitted.
17989 <p><a name="7.24.2.1p6" href="#7.24.2.1p6"><small>6</small></a>
17990 The flag wide characters and their meanings are:
17991 <dl>
17992 <dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
17993 this flag is not specified.)
17994 <dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
17995 begins with a sign only when a negative value is converted if this flag is not
17996 specified.)<sup><a href="#note282"><b>282)</b></a></sup>
17997 <dt> space<dd> If the first wide character of a signed conversion is not a sign, or if a signed
17998 conversion results in no wide characters, a space is prefixed to the result. If the
17999 space and + flags both appear, the space flag is ignored.
18000 <dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
18001 the precision, if and only if necessary, to force the first digit of the result to be a
18002 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
18003 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
18005 <!--page 363 -->
18006 and G conversions, the result of converting a floating-point number always
18007 contains a decimal-point wide character, even if no digits follow it. (Normally, a
18008 decimal-point wide character appears in the result of these conversions only if a
18009 digit follows it.) For g and G conversions, trailing zeros are not removed from the
18010 result. For other conversions, the behavior is undefined.
18011 <dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
18012 (following any indication of sign or base) are used to pad to the field width rather
18013 than performing space padding, except when converting an infinity or NaN. If the
18014 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
18015 conversions, if a precision is specified, the 0 flag is ignored. For other
18016 conversions, the behavior is undefined.
18017 </dl>
18018 <p><a name="7.24.2.1p7" href="#7.24.2.1p7"><small>7</small></a>
18019 The length modifiers and their meanings are:
18020 <dl>
18021 <dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18022 signed char or unsigned char argument (the argument will have
18023 been promoted according to the integer promotions, but its value shall be
18024 converted to signed char or unsigned char before printing); or that
18025 a following n conversion specifier applies to a pointer to a signed char
18026 argument.
18027 <dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18028 short int or unsigned short int argument (the argument will
18029 have been promoted according to the integer promotions, but its value shall
18030 be converted to short int or unsigned short int before printing);
18031 or that a following n conversion specifier applies to a pointer to a short
18032 int argument.
18033 <dt> l (ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18034 long int or unsigned long int argument; that a following n
18035 conversion specifier applies to a pointer to a long int argument; that a
18036 following c conversion specifier applies to a wint_t argument; that a
18037 following s conversion specifier applies to a pointer to a wchar_t
18038 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
18039 specifier.
18040 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18041 long long int or unsigned long long int argument; or that a
18042 following n conversion specifier applies to a pointer to a long long int
18043 argument.
18044 <dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
18045 <!--page 364 -->
18046 an intmax_t or uintmax_t argument; or that a following n conversion
18047 specifier applies to a pointer to an intmax_t argument.
18048 <dt> z <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18049 size_t or the corresponding signed integer type argument; or that a
18050 following n conversion specifier applies to a pointer to a signed integer type
18051 corresponding to size_t argument.
18052 <dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
18053 ptrdiff_t or the corresponding unsigned integer type argument; or that a
18054 following n conversion specifier applies to a pointer to a ptrdiff_t
18055 argument.
18056 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
18057 applies to a long double argument.
18058 </dl>
18059 If a length modifier appears with any conversion specifier other than as specified above,
18060 the behavior is undefined.
18061 <p><a name="7.24.2.1p8" href="#7.24.2.1p8"><small>8</small></a>
18062 The conversion specifiers and their meanings are:
18063 <dl>
18064 <dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
18065 precision specifies the minimum number of digits to appear; if the value
18066 being converted can be represented in fewer digits, it is expanded with
18067 leading zeros. The default precision is 1. The result of converting a zero
18068 value with a precision of zero is no wide characters.
18069 <dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
18070 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
18071 letters abcdef are used for x conversion and the letters ABCDEF for X
18072 conversion. The precision specifies the minimum number of digits to appear;
18073 if the value being converted can be represented in fewer digits, it is expanded
18074 with leading zeros. The default precision is 1. The result of converting a
18075 zero value with a precision of zero is no wide characters.
18076 <dt> f,F <dd> A double argument representing a floating-point number is converted to
18077 <!--page 365 -->
18078 decimal notation in the style [-]ddd.ddd, where the number of digits after
18079 the decimal-point wide character is equal to the precision specification. If the
18080 precision is missing, it is taken as 6; if the precision is zero and the # flag is
18081 not specified, no decimal-point wide character appears. If a decimal-point
18082 wide character appears, at least one digit appears before it. The value is
18083 rounded to the appropriate number of digits.
18084 A double argument representing an infinity is converted in one of the styles
18085 [-]inf or [-]infinity -- which style is implementation-defined. A
18086 double argument representing a NaN is converted in one of the styles
18087 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
18088 any n-wchar-sequence, is implementation-defined. The F conversion
18089 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
18090 nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup>
18091 <dt> e,E <dd> A double argument representing a floating-point number is converted in the
18092 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
18093 argument is nonzero) before the decimal-point wide character and the number
18094 of digits after it is equal to the precision; if the precision is missing, it is taken
18095 as 6; if the precision is zero and the # flag is not specified, no decimal-point
18096 wide character appears. The value is rounded to the appropriate number of
18097 digits. The E conversion specifier produces a number with E instead of e
18098 introducing the exponent. The exponent always contains at least two digits,
18099 and only as many more digits as necessary to represent the exponent. If the
18100 value is zero, the exponent is zero.
18101 A double argument representing an infinity or NaN is converted in the style
18102 of an f or F conversion specifier.
18103 <dt> g,G <dd> A double argument representing a floating-point number is converted in
18104 style f or e (or in style F or E in the case of a G conversion specifier),
18105 depending on the value converted and the precision. Let P equal the
18106 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
18107 Then, if a conversion with style E would have an exponent of X :
18108 <ul>
18109 <li> if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
18110 P - (X + 1).
18111 <li> otherwise, the conversion is with style e (or E) and precision P - 1.
18112 </ul>
18113 Finally, unless the # flag is used, any trailing zeros are removed from the
18114 fractional portion of the result and the decimal-point wide character is
18115 removed if there is no fractional portion remaining.
18116 A double argument representing an infinity or NaN is converted in the style
18117 of an f or F conversion specifier.
18118 <dt> a,A <dd> A double argument representing a floating-point number is converted in the
18119 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
18120 nonzero if the argument is a normalized floating-point number and is
18121 otherwise unspecified) before the decimal-point wide character<sup><a href="#note284"><b>284)</b></a></sup> and the
18122 number of hexadecimal digits after it is equal to the precision; if the precision
18123 is missing and FLT_RADIX is a power of 2, then the precision is sufficient
18124 <!--page 366 -->
18125 for an exact representation of the value; if the precision is missing and
18126 FLT_RADIX is not a power of 2, then the precision is sufficient to
18127 distinguish<sup><a href="#note285"><b>285)</b></a></sup> values of type double, except that trailing zeros may be
18128 omitted; if the precision is zero and the # flag is not specified, no decimal-
18129 point wide character appears. The letters abcdef are used for a conversion
18130 and the letters ABCDEF for A conversion. The A conversion specifier
18131 produces a number with X and P instead of x and p. The exponent always
18132 contains at least one digit, and only as many more digits as necessary to
18133 represent the decimal exponent of 2. If the value is zero, the exponent is
18134 zero.
18135 A double argument representing an infinity or NaN is converted in the style
18136 of an f or F conversion specifier.
18137 <dt> c <dd> If no l length modifier is present, the int argument is converted to a wide
18138 character as if by calling btowc and the resulting wide character is written.
18139 If an l length modifier is present, the wint_t argument is converted to
18140 wchar_t and written.
18141 <dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
18142 element of a character array containing a multibyte character sequence
18143 beginning in the initial shift state. Characters from the array are converted as
18144 if by repeated calls to the mbrtowc function, with the conversion state
18145 described by an mbstate_t object initialized to zero before the first
18146 multibyte character is converted, and written up to (but not including) the
18147 terminating null wide character. If the precision is specified, no more than
18148 that many wide characters are written. If the precision is not specified or is
18149 greater than the size of the converted array, the converted array shall contain a
18150 null wide character.
18151 If an l length modifier is present, the argument shall be a pointer to the initial
18152 element of an array of wchar_t type. Wide characters from the array are
18153 written up to (but not including) a terminating null wide character. If the
18154 precision is specified, no more than that many wide characters are written. If
18155 the precision is not specified or is greater than the size of the array, the array
18156 shall contain a null wide character.
18157 <dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
18158 converted to a sequence of printing wide characters, in an implementation-
18159 <!--page 367 -->
18160 defined manner.
18161 <dt> n <dd> The argument shall be a pointer to signed integer into which is written the
18162 number of wide characters written to the output stream so far by this call to
18163 fwprintf. No argument is converted, but one is consumed. If the
18164 conversion specification includes any flags, a field width, or a precision, the
18165 behavior is undefined.
18166 <dt> % <dd> A % wide character is written. No argument is converted. The complete
18167 conversion specification shall be %%.
18168 </dl>
18169 <p><a name="7.24.2.1p9" href="#7.24.2.1p9"><small>9</small></a>
18170 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note286"><b>286)</b></a></sup> If any argument is
18171 not the correct type for the corresponding conversion specification, the behavior is
18172 undefined.
18173 <p><a name="7.24.2.1p10" href="#7.24.2.1p10"><small>10</small></a>
18174 In no case does a nonexistent or small field width cause truncation of a field; if the result
18175 of a conversion is wider than the field width, the field is expanded to contain the
18176 conversion result.
18177 <p><a name="7.24.2.1p11" href="#7.24.2.1p11"><small>11</small></a>
18178 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
18179 to a hexadecimal floating number with the given precision.
18180 <p><b>Recommended practice</b>
18181 <p><a name="7.24.2.1p12" href="#7.24.2.1p12"><small>12</small></a>
18182 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
18183 representable in the given precision, the result should be one of the two adjacent numbers
18184 in hexadecimal floating style with the given precision, with the extra stipulation that the
18185 error should have a correct sign for the current rounding direction.
18186 <p><a name="7.24.2.1p13" href="#7.24.2.1p13"><small>13</small></a>
18187 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
18188 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note287"><b>287)</b></a></sup> If the number of
18189 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
18190 representable with DECIMAL_DIG digits, then the result should be an exact
18191 representation with trailing zeros. Otherwise, the source value is bounded by two
18192 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
18193 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
18194 the error should have a correct sign for the current rounding direction.
18195 <p><b>Returns</b>
18196 <p><a name="7.24.2.1p14" href="#7.24.2.1p14"><small>14</small></a>
18197 The fwprintf function returns the number of wide characters transmitted, or a negative
18198 value if an output or encoding error occurred.
18200 <!--page 368 -->
18201 <p><b>Environmental limits</b>
18202 <p><a name="7.24.2.1p15" href="#7.24.2.1p15"><small>15</small></a>
18203 The number of wide characters that can be produced by any single conversion shall be at
18204 least 4095.
18205 <p><a name="7.24.2.1p16" href="#7.24.2.1p16"><small>16</small></a>
18206 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
18207 places:
18208 <pre>
18209 #include <a href="#7.12">&lt;math.h&gt;</a>
18210 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18211 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18212 /* ... */
18213 wchar_t *weekday, *month; // pointers to wide strings
18214 int day, hour, min;
18215 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
18216 weekday, month, day, hour, min);
18217 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
18218 </pre>
18220 <p><b> Forward references</b>: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
18221 (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
18223 <p><b>Footnotes</b>
18224 <p><small><a name="note281" href="#note281">281)</a> Note that 0 is taken as a flag, not as the beginning of a field width.
18225 </small>
18226 <p><small><a name="note282" href="#note282">282)</a> The results of all floating conversions of a negative zero, and of negative values that round to zero,
18227 include a minus sign.
18228 </small>
18229 <p><small><a name="note283" href="#note283">283)</a> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
18230 meaning; the # and 0 flag wide characters have no effect.
18231 </small>
18232 <p><small><a name="note284" href="#note284">284)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
18233 character so that subsequent digits align to nibble (4-bit) boundaries.
18234 </small>
18235 <p><small><a name="note285" href="#note285">285)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> &gt; b n where b is
18236 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
18237 might suffice depending on the implementation's scheme for determining the digit to the left of the
18238 decimal-point wide character.
18239 </small>
18240 <p><small><a name="note286" href="#note286">286)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
18241 </small>
18242 <p><small><a name="note287" href="#note287">287)</a> For binary-to-decimal conversion, the result format's values are the numbers representable with the
18243 given format specifier. The number of significant digits is determined by the format specifier, and in
18244 the case of fixed-point conversion by the source value as well.
18245 </small>
18247 <p><small><a href="#Contents">Contents</a></small>
18248 <h5><a name="7.24.2.2" href="#7.24.2.2">7.24.2.2 The fwscanf function</a></h5>
18249 <p><b>Synopsis</b>
18250 <p><a name="7.24.2.2p1" href="#7.24.2.2p1"><small>1</small></a>
18251 <pre>
18252 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18253 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18254 int fwscanf(FILE * restrict stream,
18255 const wchar_t * restrict format, ...);
18256 </pre>
18257 <p><b>Description</b>
18258 <p><a name="7.24.2.2p2" href="#7.24.2.2p2"><small>2</small></a>
18259 The fwscanf function reads input from the stream pointed to by stream, under
18260 control of the wide string pointed to by format that specifies the admissible input
18261 sequences and how they are to be converted for assignment, using subsequent arguments
18262 as pointers to the objects to receive the converted input. If there are insufficient
18263 arguments for the format, the behavior is undefined. If the format is exhausted while
18264 arguments remain, the excess arguments are evaluated (as always) but are otherwise
18265 ignored.
18266 <p><a name="7.24.2.2p3" href="#7.24.2.2p3"><small>3</small></a>
18267 The format is composed of zero or more directives: one or more white-space wide
18268 characters, an ordinary wide character (neither % nor a white-space wide character), or a
18269 conversion specification. Each conversion specification is introduced by the wide
18270 character %. After the %, the following appear in sequence:
18271 <ul>
18272 <li> An optional assignment-suppressing wide character *.
18273 <li> An optional decimal integer greater than zero that specifies the maximum field width
18274 (in wide characters).
18275 <!--page 369 -->
18276 <li> An optional length modifier that specifies the size of the receiving object.
18277 <li> A conversion specifier wide character that specifies the type of conversion to be
18278 applied.
18279 </ul>
18280 <p><a name="7.24.2.2p4" href="#7.24.2.2p4"><small>4</small></a>
18281 The fwscanf function executes each directive of the format in turn. If a directive fails,
18282 as detailed below, the function returns. Failures are described as input failures (due to the
18283 occurrence of an encoding error or the unavailability of input characters), or matching
18284 failures (due to inappropriate input).
18285 <p><a name="7.24.2.2p5" href="#7.24.2.2p5"><small>5</small></a>
18286 A directive composed of white-space wide character(s) is executed by reading input up to
18287 the first non-white-space wide character (which remains unread), or until no more wide
18288 characters can be read.
18289 <p><a name="7.24.2.2p6" href="#7.24.2.2p6"><small>6</small></a>
18290 A directive that is an ordinary wide character is executed by reading the next wide
18291 character of the stream. If that wide character differs from the directive, the directive
18292 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
18293 of-file, an encoding error, or a read error prevents a wide character from being read, the
18294 directive fails.
18295 <p><a name="7.24.2.2p7" href="#7.24.2.2p7"><small>7</small></a>
18296 A directive that is a conversion specification defines a set of matching input sequences, as
18297 described below for each specifier. A conversion specification is executed in the
18298 following steps:
18299 <p><a name="7.24.2.2p8" href="#7.24.2.2p8"><small>8</small></a>
18300 Input white-space wide characters (as specified by the iswspace function) are skipped,
18301 unless the specification includes a [, c, or n specifier.<sup><a href="#note288"><b>288)</b></a></sup>
18302 <p><a name="7.24.2.2p9" href="#7.24.2.2p9"><small>9</small></a>
18303 An input item is read from the stream, unless the specification includes an n specifier. An
18304 input item is defined as the longest sequence of input wide characters which does not
18305 exceed any specified field width and which is, or is a prefix of, a matching input
18306 sequence.<sup><a href="#note289"><b>289)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
18307 length of the input item is zero, the execution of the directive fails; this condition is a
18308 matching failure unless end-of-file, an encoding error, or a read error prevented input
18309 from the stream, in which case it is an input failure.
18310 <p><a name="7.24.2.2p10" href="#7.24.2.2p10"><small>10</small></a>
18311 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
18312 count of input wide characters) is converted to a type appropriate to the conversion
18313 specifier. If the input item is not a matching sequence, the execution of the directive fails:
18314 this condition is a matching failure. Unless assignment suppression was indicated by a *,
18315 the result of the conversion is placed in the object pointed to by the first argument
18316 following the format argument that has not already received a conversion result. If this
18319 <!--page 370 -->
18320 object does not have an appropriate type, or if the result of the conversion cannot be
18321 represented in the object, the behavior is undefined.
18322 <p><a name="7.24.2.2p11" href="#7.24.2.2p11"><small>11</small></a>
18323 The length modifiers and their meanings are:
18324 <dl>
18325 <dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18326 to an argument with type pointer to signed char or unsigned char.
18327 <dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18328 to an argument with type pointer to short int or unsigned short
18329 int.
18330 <dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18331 to an argument with type pointer to long int or unsigned long
18332 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
18333 an argument with type pointer to double; or that a following c, s, or [
18334 conversion specifier applies to an argument with type pointer to wchar_t.
18335 <dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18336 to an argument with type pointer to long long int or unsigned
18337 long long int.
18338 <dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18339 to an argument with type pointer to intmax_t or uintmax_t.
18340 <dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18341 to an argument with type pointer to size_t or the corresponding signed
18342 integer type.
18343 <dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
18344 to an argument with type pointer to ptrdiff_t or the corresponding
18345 unsigned integer type.
18346 <dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
18347 applies to an argument with type pointer to long double.
18348 </dl>
18349 If a length modifier appears with any conversion specifier other than as specified above,
18350 the behavior is undefined.
18351 <p><a name="7.24.2.2p12" href="#7.24.2.2p12"><small>12</small></a>
18352 The conversion specifiers and their meanings are:
18353 <dl>
18354 <dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
18355 expected for the subject sequence of the wcstol function with the value 10
18356 for the base argument. The corresponding argument shall be a pointer to
18357 signed integer.
18358 <dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
18359 <!--page 371 -->
18360 for the subject sequence of the wcstol function with the value 0 for the
18361 base argument. The corresponding argument shall be a pointer to signed
18362 integer.
18363 <dt> o <dd> Matches an optionally signed octal integer, whose format is the same as
18364 expected for the subject sequence of the wcstoul function with the value 8
18365 for the base argument. The corresponding argument shall be a pointer to
18366 unsigned integer.
18367 <dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
18368 expected for the subject sequence of the wcstoul function with the value 10
18369 for the base argument. The corresponding argument shall be a pointer to
18370 unsigned integer.
18371 <dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
18372 as expected for the subject sequence of the wcstoul function with the value
18373 16 for the base argument. The corresponding argument shall be a pointer to
18374 unsigned integer.
18375 <dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
18376 format is the same as expected for the subject sequence of the wcstod
18377 function. The corresponding argument shall be a pointer to floating.
18378 <dt> c <dd> Matches a sequence of wide characters of exactly the number specified by the
18379 field width (1 if no field width is present in the directive).
18380 If no l length modifier is present, characters from the input field are
18381 converted as if by repeated calls to the wcrtomb function, with the
18382 conversion state described by an mbstate_t object initialized to zero
18383 before the first wide character is converted. The corresponding argument
18384 shall be a pointer to the initial element of a character array large enough to
18385 accept the sequence. No null character is added.
18386 If an l length modifier is present, the corresponding argument shall be a
18387 pointer to the initial element of an array of wchar_t large enough to accept
18388 the sequence. No null wide character is added.
18389 <dt> s <dd> Matches a sequence of non-white-space wide characters.
18390 <!--page 372 -->
18391 If no l length modifier is present, characters from the input field are
18392 converted as if by repeated calls to the wcrtomb function, with the
18393 conversion state described by an mbstate_t object initialized to zero
18394 before the first wide character is converted. The corresponding argument
18395 shall be a pointer to the initial element of a character array large enough to
18396 accept the sequence and a terminating null character, which will be added
18397 automatically.
18398 If an l length modifier is present, the corresponding argument shall be a
18399 pointer to the initial element of an array of wchar_t large enough to accept
18400 the sequence and the terminating null wide character, which will be added
18401 automatically.
18402 <dt> [ <dd> Matches a nonempty sequence of wide characters from a set of expected
18403 characters (the scanset).
18404 If no l length modifier is present, characters from the input field are
18405 converted as if by repeated calls to the wcrtomb function, with the
18406 conversion state described by an mbstate_t object initialized to zero
18407 before the first wide character is converted. The corresponding argument
18408 shall be a pointer to the initial element of a character array large enough to
18409 accept the sequence and a terminating null character, which will be added
18410 automatically.
18411 If an l length modifier is present, the corresponding argument shall be a
18412 pointer to the initial element of an array of wchar_t large enough to accept
18413 the sequence and the terminating null wide character, which will be added
18414 automatically.
18415 The conversion specifier includes all subsequent wide characters in the
18416 format string, up to and including the matching right bracket (]). The wide
18417 characters between the brackets (the scanlist) compose the scanset, unless the
18418 wide character after the left bracket is a circumflex (^), in which case the
18419 scanset contains all wide characters that do not appear in the scanlist between
18420 the circumflex and the right bracket. If the conversion specifier begins with
18421 [] or [^], the right bracket wide character is in the scanlist and the next
18422 following right bracket wide character is the matching right bracket that ends
18423 the specification; otherwise the first following right bracket wide character is
18424 the one that ends the specification. If a - wide character is in the scanlist and
18425 is not the first, nor the second where the first wide character is a ^, nor the
18426 last character, the behavior is implementation-defined.
18427 <dt> p <dd> Matches an implementation-defined set of sequences, which should be the
18428 same as the set of sequences that may be produced by the %p conversion of
18429 the fwprintf function. The corresponding argument shall be a pointer to a
18430 pointer to void. The input item is converted to a pointer value in an
18431 implementation-defined manner. If the input item is a value converted earlier
18432 during the same program execution, the pointer that results shall compare
18433 equal to that value; otherwise the behavior of the %p conversion is undefined.
18434 <dt> n <dd> No input is consumed. The corresponding argument shall be a pointer to
18435 <!--page 373 -->
18436 signed integer into which is to be written the number of wide characters read
18437 from the input stream so far by this call to the fwscanf function. Execution
18438 of a %n directive does not increment the assignment count returned at the
18439 completion of execution of the fwscanf function. No argument is
18440 converted, but one is consumed. If the conversion specification includes an
18441 assignment-suppressing wide character or a field width, the behavior is
18442 undefined.
18443 <dt> % <dd> Matches a single % wide character; no conversion or assignment occurs. The
18444 complete conversion specification shall be %%.
18445 </dl>
18446 <p><a name="7.24.2.2p13" href="#7.24.2.2p13"><small>13</small></a>
18447 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note290"><b>290)</b></a></sup>
18448 <p><a name="7.24.2.2p14" href="#7.24.2.2p14"><small>14</small></a>
18449 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
18450 respectively, a, e, f, g, and x.
18451 <p><a name="7.24.2.2p15" href="#7.24.2.2p15"><small>15</small></a>
18452 Trailing white space (including new-line wide characters) is left unread unless matched
18453 by a directive. The success of literal matches and suppressed assignments is not directly
18454 determinable other than via the %n directive.
18455 <p><b>Returns</b>
18456 <p><a name="7.24.2.2p16" href="#7.24.2.2p16"><small>16</small></a>
18457 The fwscanf function returns the value of the macro EOF if an input failure occurs
18458 before any conversion. Otherwise, the function returns the number of input items
18459 assigned, which can be fewer than provided for, or even zero, in the event of an early
18460 matching failure.
18461 <p><a name="7.24.2.2p17" href="#7.24.2.2p17"><small>17</small></a>
18462 EXAMPLE 1 The call:
18463 <pre>
18464 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18465 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18466 /* ... */
18467 int n, i; float x; wchar_t name[50];
18468 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
18469 </pre>
18470 with the input line:
18471 <pre>
18472 25 54.32E-1 thompson
18473 </pre>
18474 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
18475 thompson\0.
18477 <p><a name="7.24.2.2p18" href="#7.24.2.2p18"><small>18</small></a>
18478 EXAMPLE 2 The call:
18479 <pre>
18480 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18481 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18482 /* ... */
18483 int i; float x; double y;
18484 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
18485 </pre>
18486 with input:
18487 <pre>
18488 56789 0123 56a72
18489 </pre>
18490 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
18491 56.0. The next wide character read from the input stream will be a.
18494 <!--page 374 -->
18495 <p><b> Forward references</b>: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
18496 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
18497 function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
18499 <p><b>Footnotes</b>
18500 <p><small><a name="note288" href="#note288">288)</a> These white-space wide characters are not counted against a specified field width.
18501 </small>
18502 <p><small><a name="note289" href="#note289">289)</a> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
18503 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
18504 </small>
18505 <p><small><a name="note290" href="#note290">290)</a> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
18506 </small>
18508 <p><small><a href="#Contents">Contents</a></small>
18509 <h5><a name="7.24.2.3" href="#7.24.2.3">7.24.2.3 The swprintf function</a></h5>
18510 <p><b>Synopsis</b>
18511 <p><a name="7.24.2.3p1" href="#7.24.2.3p1"><small>1</small></a>
18512 <pre>
18513 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18514 int swprintf(wchar_t * restrict s,
18515 size_t n,
18516 const wchar_t * restrict format, ...);
18517 </pre>
18518 <p><b>Description</b>
18519 <p><a name="7.24.2.3p2" href="#7.24.2.3p2"><small>2</small></a>
18520 The swprintf function is equivalent to fwprintf, except that the argument s
18521 specifies an array of wide characters into which the generated output is to be written,
18522 rather than written to a stream. No more than n wide characters are written, including a
18523 terminating null wide character, which is always added (unless n is zero).
18524 <p><b>Returns</b>
18525 <p><a name="7.24.2.3p3" href="#7.24.2.3p3"><small>3</small></a>
18526 The swprintf function returns the number of wide characters written in the array, not
18527 counting the terminating null wide character, or a negative value if an encoding error
18528 occurred or if n or more wide characters were requested to be written.
18530 <p><small><a href="#Contents">Contents</a></small>
18531 <h5><a name="7.24.2.4" href="#7.24.2.4">7.24.2.4 The swscanf function</a></h5>
18532 <p><b>Synopsis</b>
18533 <p><a name="7.24.2.4p1" href="#7.24.2.4p1"><small>1</small></a>
18534 <pre>
18535 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18536 int swscanf(const wchar_t * restrict s,
18537 const wchar_t * restrict format, ...);
18538 </pre>
18539 <p><b>Description</b>
18540 <p><a name="7.24.2.4p2" href="#7.24.2.4p2"><small>2</small></a>
18541 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
18542 wide string from which the input is to be obtained, rather than from a stream. Reaching
18543 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
18544 function.
18545 <p><b>Returns</b>
18546 <p><a name="7.24.2.4p3" href="#7.24.2.4p3"><small>3</small></a>
18547 The swscanf function returns the value of the macro EOF if an input failure occurs
18548 before any conversion. Otherwise, the swscanf function returns the number of input
18549 items assigned, which can be fewer than provided for, or even zero, in the event of an
18550 early matching failure.
18551 <!--page 375 -->
18553 <p><small><a href="#Contents">Contents</a></small>
18554 <h5><a name="7.24.2.5" href="#7.24.2.5">7.24.2.5 The vfwprintf function</a></h5>
18555 <p><b>Synopsis</b>
18556 <p><a name="7.24.2.5p1" href="#7.24.2.5p1"><small>1</small></a>
18557 <pre>
18558 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18559 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18560 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18561 int vfwprintf(FILE * restrict stream,
18562 const wchar_t * restrict format,
18563 va_list arg);
18564 </pre>
18565 <p><b>Description</b>
18566 <p><a name="7.24.2.5p2" href="#7.24.2.5p2"><small>2</small></a>
18567 The vfwprintf function is equivalent to fwprintf, with the variable argument list
18568 replaced by arg, which shall have been initialized by the va_start macro (and
18569 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
18570 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18571 <p><b>Returns</b>
18572 <p><a name="7.24.2.5p3" href="#7.24.2.5p3"><small>3</small></a>
18573 The vfwprintf function returns the number of wide characters transmitted, or a
18574 negative value if an output or encoding error occurred.
18575 <p><a name="7.24.2.5p4" href="#7.24.2.5p4"><small>4</small></a>
18576 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
18577 routine.
18578 <pre>
18579 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18580 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18581 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18582 void error(char *function_name, wchar_t *format, ...)
18584 va_list args;
18585 va_start(args, format);
18586 // print out name of function causing error
18587 fwprintf(stderr, L"ERROR in %s: ", function_name);
18588 // print out remainder of message
18589 vfwprintf(stderr, format, args);
18590 va_end(args);
18592 </pre>
18597 <!--page 376 -->
18599 <p><b>Footnotes</b>
18600 <p><small><a name="note291" href="#note291">291)</a> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
18601 invoke the va_arg macro, the value of arg after the return is indeterminate.
18602 </small>
18604 <p><small><a href="#Contents">Contents</a></small>
18605 <h5><a name="7.24.2.6" href="#7.24.2.6">7.24.2.6 The vfwscanf function</a></h5>
18606 <p><b>Synopsis</b>
18607 <p><a name="7.24.2.6p1" href="#7.24.2.6p1"><small>1</small></a>
18608 <pre>
18609 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18610 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18611 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18612 int vfwscanf(FILE * restrict stream,
18613 const wchar_t * restrict format,
18614 va_list arg);
18615 </pre>
18616 <p><b>Description</b>
18617 <p><a name="7.24.2.6p2" href="#7.24.2.6p2"><small>2</small></a>
18618 The vfwscanf function is equivalent to fwscanf, with the variable argument list
18619 replaced by arg, which shall have been initialized by the va_start macro (and
18620 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
18621 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18622 <p><b>Returns</b>
18623 <p><a name="7.24.2.6p3" href="#7.24.2.6p3"><small>3</small></a>
18624 The vfwscanf function returns the value of the macro EOF if an input failure occurs
18625 before any conversion. Otherwise, the vfwscanf function returns the number of input
18626 items assigned, which can be fewer than provided for, or even zero, in the event of an
18627 early matching failure.
18629 <p><small><a href="#Contents">Contents</a></small>
18630 <h5><a name="7.24.2.7" href="#7.24.2.7">7.24.2.7 The vswprintf function</a></h5>
18631 <p><b>Synopsis</b>
18632 <p><a name="7.24.2.7p1" href="#7.24.2.7p1"><small>1</small></a>
18633 <pre>
18634 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18635 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18636 int vswprintf(wchar_t * restrict s,
18637 size_t n,
18638 const wchar_t * restrict format,
18639 va_list arg);
18640 </pre>
18641 <p><b>Description</b>
18642 <p><a name="7.24.2.7p2" href="#7.24.2.7p2"><small>2</small></a>
18643 The vswprintf function is equivalent to swprintf, with the variable argument list
18644 replaced by arg, which shall have been initialized by the va_start macro (and
18645 possibly subsequent va_arg calls). The vswprintf function does not invoke the
18646 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18647 <p><b>Returns</b>
18648 <p><a name="7.24.2.7p3" href="#7.24.2.7p3"><small>3</small></a>
18649 The vswprintf function returns the number of wide characters written in the array, not
18650 counting the terminating null wide character, or a negative value if an encoding error
18651 occurred or if n or more wide characters were requested to be generated.
18652 <!--page 377 -->
18654 <p><small><a href="#Contents">Contents</a></small>
18655 <h5><a name="7.24.2.8" href="#7.24.2.8">7.24.2.8 The vswscanf function</a></h5>
18656 <p><b>Synopsis</b>
18657 <p><a name="7.24.2.8p1" href="#7.24.2.8p1"><small>1</small></a>
18658 <pre>
18659 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18660 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18661 int vswscanf(const wchar_t * restrict s,
18662 const wchar_t * restrict format,
18663 va_list arg);
18664 </pre>
18665 <p><b>Description</b>
18666 <p><a name="7.24.2.8p2" href="#7.24.2.8p2"><small>2</small></a>
18667 The vswscanf function is equivalent to swscanf, with the variable argument list
18668 replaced by arg, which shall have been initialized by the va_start macro (and
18669 possibly subsequent va_arg calls). The vswscanf function does not invoke the
18670 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18671 <p><b>Returns</b>
18672 <p><a name="7.24.2.8p3" href="#7.24.2.8p3"><small>3</small></a>
18673 The vswscanf function returns the value of the macro EOF if an input failure occurs
18674 before any conversion. Otherwise, the vswscanf function returns the number of input
18675 items assigned, which can be fewer than provided for, or even zero, in the event of an
18676 early matching failure.
18678 <p><small><a href="#Contents">Contents</a></small>
18679 <h5><a name="7.24.2.9" href="#7.24.2.9">7.24.2.9 The vwprintf function</a></h5>
18680 <p><b>Synopsis</b>
18681 <p><a name="7.24.2.9p1" href="#7.24.2.9p1"><small>1</small></a>
18682 <pre>
18683 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18684 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18685 int vwprintf(const wchar_t * restrict format,
18686 va_list arg);
18687 </pre>
18688 <p><b>Description</b>
18689 <p><a name="7.24.2.9p2" href="#7.24.2.9p2"><small>2</small></a>
18690 The vwprintf function is equivalent to wprintf, with the variable argument list
18691 replaced by arg, which shall have been initialized by the va_start macro (and
18692 possibly subsequent va_arg calls). The vwprintf function does not invoke the
18693 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18694 <p><b>Returns</b>
18695 <p><a name="7.24.2.9p3" href="#7.24.2.9p3"><small>3</small></a>
18696 The vwprintf function returns the number of wide characters transmitted, or a negative
18697 value if an output or encoding error occurred.
18698 <!--page 378 -->
18700 <p><small><a href="#Contents">Contents</a></small>
18701 <h5><a name="7.24.2.10" href="#7.24.2.10">7.24.2.10 The vwscanf function</a></h5>
18702 <p><b>Synopsis</b>
18703 <p><a name="7.24.2.10p1" href="#7.24.2.10p1"><small>1</small></a>
18704 <pre>
18705 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
18706 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18707 int vwscanf(const wchar_t * restrict format,
18708 va_list arg);
18709 </pre>
18710 <p><b>Description</b>
18711 <p><a name="7.24.2.10p2" href="#7.24.2.10p2"><small>2</small></a>
18712 The vwscanf function is equivalent to wscanf, with the variable argument list
18713 replaced by arg, which shall have been initialized by the va_start macro (and
18714 possibly subsequent va_arg calls). The vwscanf function does not invoke the
18715 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
18716 <p><b>Returns</b>
18717 <p><a name="7.24.2.10p3" href="#7.24.2.10p3"><small>3</small></a>
18718 The vwscanf function returns the value of the macro EOF if an input failure occurs
18719 before any conversion. Otherwise, the vwscanf function returns the number of input
18720 items assigned, which can be fewer than provided for, or even zero, in the event of an
18721 early matching failure.
18723 <p><small><a href="#Contents">Contents</a></small>
18724 <h5><a name="7.24.2.11" href="#7.24.2.11">7.24.2.11 The wprintf function</a></h5>
18725 <p><b>Synopsis</b>
18726 <p><a name="7.24.2.11p1" href="#7.24.2.11p1"><small>1</small></a>
18727 <pre>
18728 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18729 int wprintf(const wchar_t * restrict format, ...);
18730 </pre>
18731 <p><b>Description</b>
18732 <p><a name="7.24.2.11p2" href="#7.24.2.11p2"><small>2</small></a>
18733 The wprintf function is equivalent to fwprintf with the argument stdout
18734 interposed before the arguments to wprintf.
18735 <p><b>Returns</b>
18736 <p><a name="7.24.2.11p3" href="#7.24.2.11p3"><small>3</small></a>
18737 The wprintf function returns the number of wide characters transmitted, or a negative
18738 value if an output or encoding error occurred.
18740 <p><small><a href="#Contents">Contents</a></small>
18741 <h5><a name="7.24.2.12" href="#7.24.2.12">7.24.2.12 The wscanf function</a></h5>
18742 <p><b>Synopsis</b>
18743 <p><a name="7.24.2.12p1" href="#7.24.2.12p1"><small>1</small></a>
18744 <pre>
18745 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18746 int wscanf(const wchar_t * restrict format, ...);
18747 </pre>
18748 <p><b>Description</b>
18749 <p><a name="7.24.2.12p2" href="#7.24.2.12p2"><small>2</small></a>
18750 The wscanf function is equivalent to fwscanf with the argument stdin interposed
18751 before the arguments to wscanf.
18752 <!--page 379 -->
18753 <p><b>Returns</b>
18754 <p><a name="7.24.2.12p3" href="#7.24.2.12p3"><small>3</small></a>
18755 The wscanf function returns the value of the macro EOF if an input failure occurs
18756 before any conversion. Otherwise, the wscanf function returns the number of input
18757 items assigned, which can be fewer than provided for, or even zero, in the event of an
18758 early matching failure.
18760 <p><small><a href="#Contents">Contents</a></small>
18761 <h4><a name="7.24.3" href="#7.24.3">7.24.3 Wide character input/output functions</a></h4>
18763 <p><small><a href="#Contents">Contents</a></small>
18764 <h5><a name="7.24.3.1" href="#7.24.3.1">7.24.3.1 The fgetwc function</a></h5>
18765 <p><b>Synopsis</b>
18766 <p><a name="7.24.3.1p1" href="#7.24.3.1p1"><small>1</small></a>
18767 <pre>
18768 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18769 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18770 wint_t fgetwc(FILE *stream);
18771 </pre>
18772 <p><b>Description</b>
18773 <p><a name="7.24.3.1p2" href="#7.24.3.1p2"><small>2</small></a>
18774 If the end-of-file indicator for the input stream pointed to by stream is not set and a
18775 next wide character is present, the fgetwc function obtains that wide character as a
18776 wchar_t converted to a wint_t and advances the associated file position indicator for
18777 the stream (if defined).
18778 <p><b>Returns</b>
18779 <p><a name="7.24.3.1p3" href="#7.24.3.1p3"><small>3</small></a>
18780 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
18781 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
18782 the fgetwc function returns the next wide character from the input stream pointed to by
18783 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
18784 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
18785 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note292"><b>292)</b></a></sup>
18787 <p><b>Footnotes</b>
18788 <p><small><a name="note292" href="#note292">292)</a> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
18789 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
18790 </small>
18792 <p><small><a href="#Contents">Contents</a></small>
18793 <h5><a name="7.24.3.2" href="#7.24.3.2">7.24.3.2 The fgetws function</a></h5>
18794 <p><b>Synopsis</b>
18795 <p><a name="7.24.3.2p1" href="#7.24.3.2p1"><small>1</small></a>
18796 <pre>
18797 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18798 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18799 wchar_t *fgetws(wchar_t * restrict s,
18800 int n, FILE * restrict stream);
18801 </pre>
18802 <p><b>Description</b>
18803 <p><a name="7.24.3.2p2" href="#7.24.3.2p2"><small>2</small></a>
18804 The fgetws function reads at most one less than the number of wide characters
18805 specified by n from the stream pointed to by stream into the array pointed to by s. No
18808 <!--page 380 -->
18809 additional wide characters are read after a new-line wide character (which is retained) or
18810 after end-of-file. A null wide character is written immediately after the last wide
18811 character read into the array.
18812 <p><b>Returns</b>
18813 <p><a name="7.24.3.2p3" href="#7.24.3.2p3"><small>3</small></a>
18814 The fgetws function returns s if successful. If end-of-file is encountered and no
18815 characters have been read into the array, the contents of the array remain unchanged and a
18816 null pointer is returned. If a read or encoding error occurs during the operation, the array
18817 contents are indeterminate and a null pointer is returned.
18819 <p><small><a href="#Contents">Contents</a></small>
18820 <h5><a name="7.24.3.3" href="#7.24.3.3">7.24.3.3 The fputwc function</a></h5>
18821 <p><b>Synopsis</b>
18822 <p><a name="7.24.3.3p1" href="#7.24.3.3p1"><small>1</small></a>
18823 <pre>
18824 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18825 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18826 wint_t fputwc(wchar_t c, FILE *stream);
18827 </pre>
18828 <p><b>Description</b>
18829 <p><a name="7.24.3.3p2" href="#7.24.3.3p2"><small>2</small></a>
18830 The fputwc function writes the wide character specified by c to the output stream
18831 pointed to by stream, at the position indicated by the associated file position indicator
18832 for the stream (if defined), and advances the indicator appropriately. If the file cannot
18833 support positioning requests, or if the stream was opened with append mode, the
18834 character is appended to the output stream.
18835 <p><b>Returns</b>
18836 <p><a name="7.24.3.3p3" href="#7.24.3.3p3"><small>3</small></a>
18837 The fputwc function returns the wide character written. If a write error occurs, the
18838 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
18839 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
18841 <p><small><a href="#Contents">Contents</a></small>
18842 <h5><a name="7.24.3.4" href="#7.24.3.4">7.24.3.4 The fputws function</a></h5>
18843 <p><b>Synopsis</b>
18844 <p><a name="7.24.3.4p1" href="#7.24.3.4p1"><small>1</small></a>
18845 <pre>
18846 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18847 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18848 int fputws(const wchar_t * restrict s,
18849 FILE * restrict stream);
18850 </pre>
18851 <p><b>Description</b>
18852 <p><a name="7.24.3.4p2" href="#7.24.3.4p2"><small>2</small></a>
18853 The fputws function writes the wide string pointed to by s to the stream pointed to by
18854 stream. The terminating null wide character is not written.
18855 <p><b>Returns</b>
18856 <p><a name="7.24.3.4p3" href="#7.24.3.4p3"><small>3</small></a>
18857 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
18858 returns a nonnegative value.
18859 <!--page 381 -->
18861 <p><small><a href="#Contents">Contents</a></small>
18862 <h5><a name="7.24.3.5" href="#7.24.3.5">7.24.3.5 The fwide function</a></h5>
18863 <p><b>Synopsis</b>
18864 <p><a name="7.24.3.5p1" href="#7.24.3.5p1"><small>1</small></a>
18865 <pre>
18866 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18867 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18868 int fwide(FILE *stream, int mode);
18869 </pre>
18870 <p><b>Description</b>
18871 <p><a name="7.24.3.5p2" href="#7.24.3.5p2"><small>2</small></a>
18872 The fwide function determines the orientation of the stream pointed to by stream. If
18873 mode is greater than zero, the function first attempts to make the stream wide oriented. If
18874 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note293"><b>293)</b></a></sup>
18875 Otherwise, mode is zero and the function does not alter the orientation of the stream.
18876 <p><b>Returns</b>
18877 <p><a name="7.24.3.5p3" href="#7.24.3.5p3"><small>3</small></a>
18878 The fwide function returns a value greater than zero if, after the call, the stream has
18879 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
18880 stream has no orientation.
18882 <p><b>Footnotes</b>
18883 <p><small><a name="note293" href="#note293">293)</a> If the orientation of the stream has already been determined, fwide does not change it.
18884 </small>
18886 <p><small><a href="#Contents">Contents</a></small>
18887 <h5><a name="7.24.3.6" href="#7.24.3.6">7.24.3.6 The getwc function</a></h5>
18888 <p><b>Synopsis</b>
18889 <p><a name="7.24.3.6p1" href="#7.24.3.6p1"><small>1</small></a>
18890 <pre>
18891 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18892 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18893 wint_t getwc(FILE *stream);
18894 </pre>
18895 <p><b>Description</b>
18896 <p><a name="7.24.3.6p2" href="#7.24.3.6p2"><small>2</small></a>
18897 The getwc function is equivalent to fgetwc, except that if it is implemented as a
18898 macro, it may evaluate stream more than once, so the argument should never be an
18899 expression with side effects.
18900 <p><b>Returns</b>
18901 <p><a name="7.24.3.6p3" href="#7.24.3.6p3"><small>3</small></a>
18902 The getwc function returns the next wide character from the input stream pointed to by
18903 stream, or WEOF.
18905 <p><small><a href="#Contents">Contents</a></small>
18906 <h5><a name="7.24.3.7" href="#7.24.3.7">7.24.3.7 The getwchar function</a></h5>
18907 <p><b>Synopsis</b>
18908 <p><a name="7.24.3.7p1" href="#7.24.3.7p1"><small>1</small></a>
18909 <pre>
18910 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18911 wint_t getwchar(void);
18912 </pre>
18917 <!--page 382 -->
18918 <p><b>Description</b>
18919 <p><a name="7.24.3.7p2" href="#7.24.3.7p2"><small>2</small></a>
18920 The getwchar function is equivalent to getwc with the argument stdin.
18921 <p><b>Returns</b>
18922 <p><a name="7.24.3.7p3" href="#7.24.3.7p3"><small>3</small></a>
18923 The getwchar function returns the next wide character from the input stream pointed to
18924 by stdin, or WEOF.
18926 <p><small><a href="#Contents">Contents</a></small>
18927 <h5><a name="7.24.3.8" href="#7.24.3.8">7.24.3.8 The putwc function</a></h5>
18928 <p><b>Synopsis</b>
18929 <p><a name="7.24.3.8p1" href="#7.24.3.8p1"><small>1</small></a>
18930 <pre>
18931 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18932 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18933 wint_t putwc(wchar_t c, FILE *stream);
18934 </pre>
18935 <p><b>Description</b>
18936 <p><a name="7.24.3.8p2" href="#7.24.3.8p2"><small>2</small></a>
18937 The putwc function is equivalent to fputwc, except that if it is implemented as a
18938 macro, it may evaluate stream more than once, so that argument should never be an
18939 expression with side effects.
18940 <p><b>Returns</b>
18941 <p><a name="7.24.3.8p3" href="#7.24.3.8p3"><small>3</small></a>
18942 The putwc function returns the wide character written, or WEOF.
18944 <p><small><a href="#Contents">Contents</a></small>
18945 <h5><a name="7.24.3.9" href="#7.24.3.9">7.24.3.9 The putwchar function</a></h5>
18946 <p><b>Synopsis</b>
18947 <p><a name="7.24.3.9p1" href="#7.24.3.9p1"><small>1</small></a>
18948 <pre>
18949 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18950 wint_t putwchar(wchar_t c);
18951 </pre>
18952 <p><b>Description</b>
18953 <p><a name="7.24.3.9p2" href="#7.24.3.9p2"><small>2</small></a>
18954 The putwchar function is equivalent to putwc with the second argument stdout.
18955 <p><b>Returns</b>
18956 <p><a name="7.24.3.9p3" href="#7.24.3.9p3"><small>3</small></a>
18957 The putwchar function returns the character written, or WEOF.
18959 <p><small><a href="#Contents">Contents</a></small>
18960 <h5><a name="7.24.3.10" href="#7.24.3.10">7.24.3.10 The ungetwc function</a></h5>
18961 <p><b>Synopsis</b>
18962 <p><a name="7.24.3.10p1" href="#7.24.3.10p1"><small>1</small></a>
18963 <pre>
18964 #include <a href="#7.19">&lt;stdio.h&gt;</a>
18965 #include <a href="#7.24">&lt;wchar.h&gt;</a>
18966 wint_t ungetwc(wint_t c, FILE *stream);
18967 </pre>
18968 <p><b>Description</b>
18969 <p><a name="7.24.3.10p2" href="#7.24.3.10p2"><small>2</small></a>
18970 The ungetwc function pushes the wide character specified by c back onto the input
18971 stream pointed to by stream. Pushed-back wide characters will be returned by
18972 subsequent reads on that stream in the reverse order of their pushing. A successful
18973 <!--page 383 -->
18974 intervening call (with the stream pointed to by stream) to a file positioning function
18975 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
18976 stream. The external storage corresponding to the stream is unchanged.
18977 <p><a name="7.24.3.10p3" href="#7.24.3.10p3"><small>3</small></a>
18978 One wide character of pushback is guaranteed, even if the call to the ungetwc function
18979 follows just after a call to a formatted wide character input function fwscanf,
18980 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
18981 on the same stream without an intervening read or file positioning operation on that
18982 stream, the operation may fail.
18983 <p><a name="7.24.3.10p4" href="#7.24.3.10p4"><small>4</small></a>
18984 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
18985 unchanged.
18986 <p><a name="7.24.3.10p5" href="#7.24.3.10p5"><small>5</small></a>
18987 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
18988 The value of the file position indicator for the stream after reading or discarding all
18989 pushed-back wide characters is the same as it was before the wide characters were pushed
18990 back. For a text or binary stream, the value of its file position indicator after a successful
18991 call to the ungetwc function is unspecified until all pushed-back wide characters are
18992 read or discarded.
18993 <p><b>Returns</b>
18994 <p><a name="7.24.3.10p6" href="#7.24.3.10p6"><small>6</small></a>
18995 The ungetwc function returns the wide character pushed back, or WEOF if the operation
18996 fails.
18998 <p><small><a href="#Contents">Contents</a></small>
18999 <h4><a name="7.24.4" href="#7.24.4">7.24.4 General wide string utilities</a></h4>
19000 <p><a name="7.24.4p1" href="#7.24.4p1"><small>1</small></a>
19001 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
19002 manipulation. Various methods are used for determining the lengths of the arrays, but in
19003 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
19004 array. If an array is accessed beyond the end of an object, the behavior is undefined.
19005 <p><a name="7.24.4p2" href="#7.24.4p2"><small>2</small></a>
19006 Where an argument declared as size_t n determines the length of the array for a
19007 function, n can have the value zero on a call to that function. Unless explicitly stated
19008 otherwise in the description of a particular function in this subclause, pointer arguments
19009 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
19010 function that locates a wide character finds no occurrence, a function that compares two
19011 wide character sequences returns zero, and a function that copies wide characters copies
19012 zero wide characters.
19013 <!--page 384 -->
19015 <p><small><a href="#Contents">Contents</a></small>
19016 <h5><a name="7.24.4.1" href="#7.24.4.1">7.24.4.1 Wide string numeric conversion functions</a></h5>
19018 <p><small><a href="#Contents">Contents</a></small>
19019 <h5><a name="7.24.4.1.1" href="#7.24.4.1.1">7.24.4.1.1 The wcstod, wcstof, and wcstold functions</a></h5>
19020 <p><b>Synopsis</b>
19021 <p><a name="7.24.4.1.1p1" href="#7.24.4.1.1p1"><small>1</small></a>
19022 <pre>
19023 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19024 double wcstod(const wchar_t * restrict nptr,
19025 wchar_t ** restrict endptr);
19026 float wcstof(const wchar_t * restrict nptr,
19027 wchar_t ** restrict endptr);
19028 long double wcstold(const wchar_t * restrict nptr,
19029 wchar_t ** restrict endptr);
19030 </pre>
19031 <p><b>Description</b>
19032 <p><a name="7.24.4.1.1p2" href="#7.24.4.1.1p2"><small>2</small></a>
19033 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
19034 string pointed to by nptr to double, float, and long double representation,
19035 respectively. First, they decompose the input string into three parts: an initial, possibly
19036 empty, sequence of white-space wide characters (as specified by the iswspace
19037 function), a subject sequence resembling a floating-point constant or representing an
19038 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
19039 including the terminating null wide character of the input wide string. Then, they attempt
19040 to convert the subject sequence to a floating-point number, and return the result.
19041 <p><a name="7.24.4.1.1p3" href="#7.24.4.1.1p3"><small>3</small></a>
19042 The expected form of the subject sequence is an optional plus or minus sign, then one of
19043 the following:
19044 <ul>
19045 <li> a nonempty sequence of decimal digits optionally containing a decimal-point wide
19046 character, then an optional exponent part as defined for the corresponding single-byte
19047 characters in <a href="#6.4.4.2">6.4.4.2</a>;
19048 <li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
19049 decimal-point wide character, then an optional binary exponent part as defined in
19050 <a href="#6.4.4.2">6.4.4.2</a>;
19051 <li> INF or INFINITY, or any other wide string equivalent except for case
19052 <li> NAN or NAN(n-wchar-sequence<sub>opt</sub>), or any other wide string equivalent except for
19053 case in the NAN part, where:
19054 <pre>
19055 n-wchar-sequence:
19056 digit
19057 nondigit
19058 n-wchar-sequence digit
19059 n-wchar-sequence nondigit
19060 </pre>
19061 </ul>
19062 The subject sequence is defined as the longest initial subsequence of the input wide
19063 string, starting with the first non-white-space wide character, that is of the expected form.
19064 <!--page 385 -->
19065 The subject sequence contains no wide characters if the input wide string is not of the
19066 expected form.
19067 <p><a name="7.24.4.1.1p4" href="#7.24.4.1.1p4"><small>4</small></a>
19068 If the subject sequence has the expected form for a floating-point number, the sequence of
19069 wide characters starting with the first digit or the decimal-point wide character
19070 (whichever occurs first) is interpreted as a floating constant according to the rules of
19071 <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
19072 if neither an exponent part nor a decimal-point wide character appears in a decimal
19073 floating point number, or if a binary exponent part does not appear in a hexadecimal
19074 floating point number, an exponent part of the appropriate type with value zero is
19075 assumed to follow the last digit in the string. If the subject sequence begins with a minus
19076 sign, the sequence is interpreted as negated.<sup><a href="#note294"><b>294)</b></a></sup> A wide character sequence INF or
19077 INFINITY is interpreted as an infinity, if representable in the return type, else like a
19078 floating constant that is too large for the range of the return type. A wide character
19079 sequence NAN or NAN(n-wchar-sequence<sub>opt</sub>) is interpreted as a quiet NaN, if supported
19080 in the return type, else like a subject sequence part that does not have the expected form;
19081 the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note295"><b>295)</b></a></sup> A pointer to the
19082 final wide string is stored in the object pointed to by endptr, provided that endptr is
19083 not a null pointer.
19084 <p><a name="7.24.4.1.1p5" href="#7.24.4.1.1p5"><small>5</small></a>
19085 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
19086 value resulting from the conversion is correctly rounded.
19087 <p><a name="7.24.4.1.1p6" href="#7.24.4.1.1p6"><small>6</small></a>
19088 In other than the "C" locale, additional locale-specific subject sequence forms may be
19089 accepted.
19090 <p><a name="7.24.4.1.1p7" href="#7.24.4.1.1p7"><small>7</small></a>
19091 If the subject sequence is empty or does not have the expected form, no conversion is
19092 performed; the value of nptr is stored in the object pointed to by endptr, provided
19093 that endptr is not a null pointer.
19094 <p><b>Recommended practice</b>
19095 <p><a name="7.24.4.1.1p8" href="#7.24.4.1.1p8"><small>8</small></a>
19096 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
19097 the result is not exactly representable, the result should be one of the two numbers in the
19098 appropriate internal format that are adjacent to the hexadecimal floating source value,
19099 with the extra stipulation that the error should have a correct sign for the current rounding
19100 direction.
19104 <!--page 386 -->
19105 <p><a name="7.24.4.1.1p9" href="#7.24.4.1.1p9"><small>9</small></a>
19106 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
19107 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
19108 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
19109 consider the two bounding, adjacent decimal strings L and U, both having
19110 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
19111 The result should be one of the (equal or adjacent) values that would be obtained by
19112 correctly rounding L and U according to the current rounding direction, with the extra
19113 stipulation that the error with respect to D should have a correct sign for the current
19114 rounding direction.<sup><a href="#note296"><b>296)</b></a></sup>
19115 <p><b>Returns</b>
19116 <p><a name="7.24.4.1.1p10" href="#7.24.4.1.1p10"><small>10</small></a>
19117 The functions return the converted value, if any. If no conversion could be performed,
19118 zero is returned. If the correct value is outside the range of representable values, plus or
19119 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
19120 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
19121 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
19122 than the smallest normalized positive number in the return type; whether errno acquires
19123 the value ERANGE is implementation-defined.
19128 <!--page 387 -->
19130 <p><b>Footnotes</b>
19131 <p><small><a name="note294" href="#note294">294)</a> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
19132 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
19133 methods may yield different results if rounding is toward positive or negative infinity. In either case,
19134 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
19135 </small>
19136 <p><small><a name="note295" href="#note295">295)</a> An implementation may use the n-wchar sequence to determine extra information to be represented in
19137 the NaN's significand.
19138 </small>
19139 <p><small><a name="note296" href="#note296">296)</a> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
19140 to the same internal floating value, but if not will round to adjacent values.
19141 </small>
19143 <p><small><a href="#Contents">Contents</a></small>
19144 <h5><a name="7.24.4.1.2" href="#7.24.4.1.2">7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</a></h5>
19145 <p><b>Synopsis</b>
19146 <p><a name="7.24.4.1.2p1" href="#7.24.4.1.2p1"><small>1</small></a>
19147 <pre>
19148 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19149 long int wcstol(
19150 const wchar_t * restrict nptr,
19151 wchar_t ** restrict endptr,
19152 int base);
19153 long long int wcstoll(
19154 const wchar_t * restrict nptr,
19155 wchar_t ** restrict endptr,
19156 int base);
19157 unsigned long int wcstoul(
19158 const wchar_t * restrict nptr,
19159 wchar_t ** restrict endptr,
19160 int base);
19161 unsigned long long int wcstoull(
19162 const wchar_t * restrict nptr,
19163 wchar_t ** restrict endptr,
19164 int base);
19165 </pre>
19166 <p><b>Description</b>
19167 <p><a name="7.24.4.1.2p2" href="#7.24.4.1.2p2"><small>2</small></a>
19168 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
19169 portion of the wide string pointed to by nptr to long int, long long int,
19170 unsigned long int, and unsigned long long int representation,
19171 respectively. First, they decompose the input string into three parts: an initial, possibly
19172 empty, sequence of white-space wide characters (as specified by the iswspace
19173 function), a subject sequence resembling an integer represented in some radix determined
19174 by the value of base, and a final wide string of one or more unrecognized wide
19175 characters, including the terminating null wide character of the input wide string. Then,
19176 they attempt to convert the subject sequence to an integer, and return the result.
19177 <p><a name="7.24.4.1.2p3" href="#7.24.4.1.2p3"><small>3</small></a>
19178 If the value of base is zero, the expected form of the subject sequence is that of an
19179 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
19180 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
19181 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
19182 is a sequence of letters and digits representing an integer with the radix specified by
19183 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
19184 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
19185 letters and digits whose ascribed values are less than that of base are permitted. If the
19186 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
19187 of letters and digits, following the sign if present.
19188 <!--page 388 -->
19189 <p><a name="7.24.4.1.2p4" href="#7.24.4.1.2p4"><small>4</small></a>
19190 The subject sequence is defined as the longest initial subsequence of the input wide
19191 string, starting with the first non-white-space wide character, that is of the expected form.
19192 The subject sequence contains no wide characters if the input wide string is empty or
19193 consists entirely of white space, or if the first non-white-space wide character is other
19194 than a sign or a permissible letter or digit.
19195 <p><a name="7.24.4.1.2p5" href="#7.24.4.1.2p5"><small>5</small></a>
19196 If the subject sequence has the expected form and the value of base is zero, the sequence
19197 of wide characters starting with the first digit is interpreted as an integer constant
19198 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
19199 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
19200 letter its value as given above. If the subject sequence begins with a minus sign, the value
19201 resulting from the conversion is negated (in the return type). A pointer to the final wide
19202 string is stored in the object pointed to by endptr, provided that endptr is not a null
19203 pointer.
19204 <p><a name="7.24.4.1.2p6" href="#7.24.4.1.2p6"><small>6</small></a>
19205 In other than the "C" locale, additional locale-specific subject sequence forms may be
19206 accepted.
19207 <p><a name="7.24.4.1.2p7" href="#7.24.4.1.2p7"><small>7</small></a>
19208 If the subject sequence is empty or does not have the expected form, no conversion is
19209 performed; the value of nptr is stored in the object pointed to by endptr, provided
19210 that endptr is not a null pointer.
19211 <p><b>Returns</b>
19212 <p><a name="7.24.4.1.2p8" href="#7.24.4.1.2p8"><small>8</small></a>
19213 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
19214 value, if any. If no conversion could be performed, zero is returned. If the correct value
19215 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
19216 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
19217 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
19219 <p><small><a href="#Contents">Contents</a></small>
19220 <h5><a name="7.24.4.2" href="#7.24.4.2">7.24.4.2 Wide string copying functions</a></h5>
19222 <p><small><a href="#Contents">Contents</a></small>
19223 <h5><a name="7.24.4.2.1" href="#7.24.4.2.1">7.24.4.2.1 The wcscpy function</a></h5>
19224 <p><b>Synopsis</b>
19225 <p><a name="7.24.4.2.1p1" href="#7.24.4.2.1p1"><small>1</small></a>
19226 <pre>
19227 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19228 wchar_t *wcscpy(wchar_t * restrict s1,
19229 const wchar_t * restrict s2);
19230 </pre>
19231 <p><b>Description</b>
19232 <p><a name="7.24.4.2.1p2" href="#7.24.4.2.1p2"><small>2</small></a>
19233 The wcscpy function copies the wide string pointed to by s2 (including the terminating
19234 null wide character) into the array pointed to by s1.
19235 <p><b>Returns</b>
19236 <p><a name="7.24.4.2.1p3" href="#7.24.4.2.1p3"><small>3</small></a>
19237 The wcscpy function returns the value of s1.
19238 <!--page 389 -->
19240 <p><small><a href="#Contents">Contents</a></small>
19241 <h5><a name="7.24.4.2.2" href="#7.24.4.2.2">7.24.4.2.2 The wcsncpy function</a></h5>
19242 <p><b>Synopsis</b>
19243 <p><a name="7.24.4.2.2p1" href="#7.24.4.2.2p1"><small>1</small></a>
19244 <pre>
19245 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19246 wchar_t *wcsncpy(wchar_t * restrict s1,
19247 const wchar_t * restrict s2,
19248 size_t n);
19249 </pre>
19250 <p><b>Description</b>
19251 <p><a name="7.24.4.2.2p2" href="#7.24.4.2.2p2"><small>2</small></a>
19252 The wcsncpy function copies not more than n wide characters (those that follow a null
19253 wide character are not copied) from the array pointed to by s2 to the array pointed to by
19254 s1.<sup><a href="#note297"><b>297)</b></a></sup>
19255 <p><a name="7.24.4.2.2p3" href="#7.24.4.2.2p3"><small>3</small></a>
19256 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
19257 wide characters are appended to the copy in the array pointed to by s1, until n wide
19258 characters in all have been written.
19259 <p><b>Returns</b>
19260 <p><a name="7.24.4.2.2p4" href="#7.24.4.2.2p4"><small>4</small></a>
19261 The wcsncpy function returns the value of s1.
19263 <p><b>Footnotes</b>
19264 <p><small><a name="note297" href="#note297">297)</a> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
19265 result will not be null-terminated.
19266 </small>
19268 <p><small><a href="#Contents">Contents</a></small>
19269 <h5><a name="7.24.4.2.3" href="#7.24.4.2.3">7.24.4.2.3 The wmemcpy function</a></h5>
19270 <p><b>Synopsis</b>
19271 <p><a name="7.24.4.2.3p1" href="#7.24.4.2.3p1"><small>1</small></a>
19272 <pre>
19273 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19274 wchar_t *wmemcpy(wchar_t * restrict s1,
19275 const wchar_t * restrict s2,
19276 size_t n);
19277 </pre>
19278 <p><b>Description</b>
19279 <p><a name="7.24.4.2.3p2" href="#7.24.4.2.3p2"><small>2</small></a>
19280 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
19281 object pointed to by s1.
19282 <p><b>Returns</b>
19283 <p><a name="7.24.4.2.3p3" href="#7.24.4.2.3p3"><small>3</small></a>
19284 The wmemcpy function returns the value of s1.
19289 <!--page 390 -->
19291 <p><small><a href="#Contents">Contents</a></small>
19292 <h5><a name="7.24.4.2.4" href="#7.24.4.2.4">7.24.4.2.4 The wmemmove function</a></h5>
19293 <p><b>Synopsis</b>
19294 <p><a name="7.24.4.2.4p1" href="#7.24.4.2.4p1"><small>1</small></a>
19295 <pre>
19296 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19297 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
19298 size_t n);
19299 </pre>
19300 <p><b>Description</b>
19301 <p><a name="7.24.4.2.4p2" href="#7.24.4.2.4p2"><small>2</small></a>
19302 The wmemmove function copies n wide characters from the object pointed to by s2 to
19303 the object pointed to by s1. Copying takes place as if the n wide characters from the
19304 object pointed to by s2 are first copied into a temporary array of n wide characters that
19305 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
19306 the temporary array are copied into the object pointed to by s1.
19307 <p><b>Returns</b>
19308 <p><a name="7.24.4.2.4p3" href="#7.24.4.2.4p3"><small>3</small></a>
19309 The wmemmove function returns the value of s1.
19311 <p><small><a href="#Contents">Contents</a></small>
19312 <h5><a name="7.24.4.3" href="#7.24.4.3">7.24.4.3 Wide string concatenation functions</a></h5>
19314 <p><small><a href="#Contents">Contents</a></small>
19315 <h5><a name="7.24.4.3.1" href="#7.24.4.3.1">7.24.4.3.1 The wcscat function</a></h5>
19316 <p><b>Synopsis</b>
19317 <p><a name="7.24.4.3.1p1" href="#7.24.4.3.1p1"><small>1</small></a>
19318 <pre>
19319 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19320 wchar_t *wcscat(wchar_t * restrict s1,
19321 const wchar_t * restrict s2);
19322 </pre>
19323 <p><b>Description</b>
19324 <p><a name="7.24.4.3.1p2" href="#7.24.4.3.1p2"><small>2</small></a>
19325 The wcscat function appends a copy of the wide string pointed to by s2 (including the
19326 terminating null wide character) to the end of the wide string pointed to by s1. The initial
19327 wide character of s2 overwrites the null wide character at the end of s1.
19328 <p><b>Returns</b>
19329 <p><a name="7.24.4.3.1p3" href="#7.24.4.3.1p3"><small>3</small></a>
19330 The wcscat function returns the value of s1.
19332 <p><small><a href="#Contents">Contents</a></small>
19333 <h5><a name="7.24.4.3.2" href="#7.24.4.3.2">7.24.4.3.2 The wcsncat function</a></h5>
19334 <p><b>Synopsis</b>
19335 <p><a name="7.24.4.3.2p1" href="#7.24.4.3.2p1"><small>1</small></a>
19336 <pre>
19337 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19338 wchar_t *wcsncat(wchar_t * restrict s1,
19339 const wchar_t * restrict s2,
19340 size_t n);
19341 </pre>
19342 <p><b>Description</b>
19343 <p><a name="7.24.4.3.2p2" href="#7.24.4.3.2p2"><small>2</small></a>
19344 The wcsncat function appends not more than n wide characters (a null wide character
19345 and those that follow it are not appended) from the array pointed to by s2 to the end of
19346 <!--page 391 -->
19347 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
19348 wide character at the end of s1. A terminating null wide character is always appended to
19349 the result.<sup><a href="#note298"><b>298)</b></a></sup>
19350 <p><b>Returns</b>
19351 <p><a name="7.24.4.3.2p3" href="#7.24.4.3.2p3"><small>3</small></a>
19352 The wcsncat function returns the value of s1.
19354 <p><b>Footnotes</b>
19355 <p><small><a name="note298" href="#note298">298)</a> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
19356 wcslen(s1)+n+1.
19357 </small>
19359 <p><small><a href="#Contents">Contents</a></small>
19360 <h5><a name="7.24.4.4" href="#7.24.4.4">7.24.4.4 Wide string comparison functions</a></h5>
19361 <p><a name="7.24.4.4p1" href="#7.24.4.4p1"><small>1</small></a>
19362 Unless explicitly stated otherwise, the functions described in this subclause order two
19363 wide characters the same way as two integers of the underlying integer type designated
19364 by wchar_t.
19366 <p><small><a href="#Contents">Contents</a></small>
19367 <h5><a name="7.24.4.4.1" href="#7.24.4.4.1">7.24.4.4.1 The wcscmp function</a></h5>
19368 <p><b>Synopsis</b>
19369 <p><a name="7.24.4.4.1p1" href="#7.24.4.4.1p1"><small>1</small></a>
19370 <pre>
19371 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19372 int wcscmp(const wchar_t *s1, const wchar_t *s2);
19373 </pre>
19374 <p><b>Description</b>
19375 <p><a name="7.24.4.4.1p2" href="#7.24.4.4.1p2"><small>2</small></a>
19376 The wcscmp function compares the wide string pointed to by s1 to the wide string
19377 pointed to by s2.
19378 <p><b>Returns</b>
19379 <p><a name="7.24.4.4.1p3" href="#7.24.4.4.1p3"><small>3</small></a>
19380 The wcscmp function returns an integer greater than, equal to, or less than zero,
19381 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
19382 wide string pointed to by s2.
19384 <p><small><a href="#Contents">Contents</a></small>
19385 <h5><a name="7.24.4.4.2" href="#7.24.4.4.2">7.24.4.4.2 The wcscoll function</a></h5>
19386 <p><b>Synopsis</b>
19387 <p><a name="7.24.4.4.2p1" href="#7.24.4.4.2p1"><small>1</small></a>
19388 <pre>
19389 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19390 int wcscoll(const wchar_t *s1, const wchar_t *s2);
19391 </pre>
19392 <p><b>Description</b>
19393 <p><a name="7.24.4.4.2p2" href="#7.24.4.4.2p2"><small>2</small></a>
19394 The wcscoll function compares the wide string pointed to by s1 to the wide string
19395 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
19396 current locale.
19397 <p><b>Returns</b>
19398 <p><a name="7.24.4.4.2p3" href="#7.24.4.4.2p3"><small>3</small></a>
19399 The wcscoll function returns an integer greater than, equal to, or less than zero,
19400 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
19403 <!--page 392 -->
19404 wide string pointed to by s2 when both are interpreted as appropriate to the current
19405 locale.
19407 <p><small><a href="#Contents">Contents</a></small>
19408 <h5><a name="7.24.4.4.3" href="#7.24.4.4.3">7.24.4.4.3 The wcsncmp function</a></h5>
19409 <p><b>Synopsis</b>
19410 <p><a name="7.24.4.4.3p1" href="#7.24.4.4.3p1"><small>1</small></a>
19411 <pre>
19412 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19413 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
19414 size_t n);
19415 </pre>
19416 <p><b>Description</b>
19417 <p><a name="7.24.4.4.3p2" href="#7.24.4.4.3p2"><small>2</small></a>
19418 The wcsncmp function compares not more than n wide characters (those that follow a
19419 null wide character are not compared) from the array pointed to by s1 to the array
19420 pointed to by s2.
19421 <p><b>Returns</b>
19422 <p><a name="7.24.4.4.3p3" href="#7.24.4.4.3p3"><small>3</small></a>
19423 The wcsncmp function returns an integer greater than, equal to, or less than zero,
19424 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
19425 to, or less than the possibly null-terminated array pointed to by s2.
19427 <p><small><a href="#Contents">Contents</a></small>
19428 <h5><a name="7.24.4.4.4" href="#7.24.4.4.4">7.24.4.4.4 The wcsxfrm function</a></h5>
19429 <p><b>Synopsis</b>
19430 <p><a name="7.24.4.4.4p1" href="#7.24.4.4.4p1"><small>1</small></a>
19431 <pre>
19432 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19433 size_t wcsxfrm(wchar_t * restrict s1,
19434 const wchar_t * restrict s2,
19435 size_t n);
19436 </pre>
19437 <p><b>Description</b>
19438 <p><a name="7.24.4.4.4p2" href="#7.24.4.4.4p2"><small>2</small></a>
19439 The wcsxfrm function transforms the wide string pointed to by s2 and places the
19440 resulting wide string into the array pointed to by s1. The transformation is such that if
19441 the wcscmp function is applied to two transformed wide strings, it returns a value greater
19442 than, equal to, or less than zero, corresponding to the result of the wcscoll function
19443 applied to the same two original wide strings. No more than n wide characters are placed
19444 into the resulting array pointed to by s1, including the terminating null wide character. If
19445 n is zero, s1 is permitted to be a null pointer.
19446 <p><b>Returns</b>
19447 <p><a name="7.24.4.4.4p3" href="#7.24.4.4.4p3"><small>3</small></a>
19448 The wcsxfrm function returns the length of the transformed wide string (not including
19449 the terminating null wide character). If the value returned is n or greater, the contents of
19450 the array pointed to by s1 are indeterminate.
19451 <p><a name="7.24.4.4.4p4" href="#7.24.4.4.4p4"><small>4</small></a>
19452 EXAMPLE The value of the following expression is the length of the array needed to hold the
19453 transformation of the wide string pointed to by s:
19454 <!--page 393 -->
19455 <pre>
19456 1 + wcsxfrm(NULL, s, 0)
19457 </pre>
19460 <p><small><a href="#Contents">Contents</a></small>
19461 <h5><a name="7.24.4.4.5" href="#7.24.4.4.5">7.24.4.4.5 The wmemcmp function</a></h5>
19462 <p><b>Synopsis</b>
19463 <p><a name="7.24.4.4.5p1" href="#7.24.4.4.5p1"><small>1</small></a>
19464 <pre>
19465 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19466 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
19467 size_t n);
19468 </pre>
19469 <p><b>Description</b>
19470 <p><a name="7.24.4.4.5p2" href="#7.24.4.4.5p2"><small>2</small></a>
19471 The wmemcmp function compares the first n wide characters of the object pointed to by
19472 s1 to the first n wide characters of the object pointed to by s2.
19473 <p><b>Returns</b>
19474 <p><a name="7.24.4.4.5p3" href="#7.24.4.4.5p3"><small>3</small></a>
19475 The wmemcmp function returns an integer greater than, equal to, or less than zero,
19476 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
19477 pointed to by s2.
19479 <p><small><a href="#Contents">Contents</a></small>
19480 <h5><a name="7.24.4.5" href="#7.24.4.5">7.24.4.5 Wide string search functions</a></h5>
19482 <p><small><a href="#Contents">Contents</a></small>
19483 <h5><a name="7.24.4.5.1" href="#7.24.4.5.1">7.24.4.5.1 The wcschr function</a></h5>
19484 <p><b>Synopsis</b>
19485 <p><a name="7.24.4.5.1p1" href="#7.24.4.5.1p1"><small>1</small></a>
19486 <pre>
19487 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19488 wchar_t *wcschr(const wchar_t *s, wchar_t c);
19489 </pre>
19490 <p><b>Description</b>
19491 <p><a name="7.24.4.5.1p2" href="#7.24.4.5.1p2"><small>2</small></a>
19492 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
19493 The terminating null wide character is considered to be part of the wide string.
19494 <p><b>Returns</b>
19495 <p><a name="7.24.4.5.1p3" href="#7.24.4.5.1p3"><small>3</small></a>
19496 The wcschr function returns a pointer to the located wide character, or a null pointer if
19497 the wide character does not occur in the wide string.
19499 <p><small><a href="#Contents">Contents</a></small>
19500 <h5><a name="7.24.4.5.2" href="#7.24.4.5.2">7.24.4.5.2 The wcscspn function</a></h5>
19501 <p><b>Synopsis</b>
19502 <p><a name="7.24.4.5.2p1" href="#7.24.4.5.2p1"><small>1</small></a>
19503 <pre>
19504 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19505 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
19506 </pre>
19507 <p><b>Description</b>
19508 <p><a name="7.24.4.5.2p2" href="#7.24.4.5.2p2"><small>2</small></a>
19509 The wcscspn function computes the length of the maximum initial segment of the wide
19510 string pointed to by s1 which consists entirely of wide characters not from the wide
19511 string pointed to by s2.
19512 <!--page 394 -->
19513 <p><b>Returns</b>
19514 <p><a name="7.24.4.5.2p3" href="#7.24.4.5.2p3"><small>3</small></a>
19515 The wcscspn function returns the length of the segment.
19517 <p><small><a href="#Contents">Contents</a></small>
19518 <h5><a name="7.24.4.5.3" href="#7.24.4.5.3">7.24.4.5.3 The wcspbrk function</a></h5>
19519 <p><b>Synopsis</b>
19520 <p><a name="7.24.4.5.3p1" href="#7.24.4.5.3p1"><small>1</small></a>
19521 <pre>
19522 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19523 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
19524 </pre>
19525 <p><b>Description</b>
19526 <p><a name="7.24.4.5.3p2" href="#7.24.4.5.3p2"><small>2</small></a>
19527 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
19528 any wide character from the wide string pointed to by s2.
19529 <p><b>Returns</b>
19530 <p><a name="7.24.4.5.3p3" href="#7.24.4.5.3p3"><small>3</small></a>
19531 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
19532 no wide character from s2 occurs in s1.
19534 <p><small><a href="#Contents">Contents</a></small>
19535 <h5><a name="7.24.4.5.4" href="#7.24.4.5.4">7.24.4.5.4 The wcsrchr function</a></h5>
19536 <p><b>Synopsis</b>
19537 <p><a name="7.24.4.5.4p1" href="#7.24.4.5.4p1"><small>1</small></a>
19538 <pre>
19539 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19540 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
19541 </pre>
19542 <p><b>Description</b>
19543 <p><a name="7.24.4.5.4p2" href="#7.24.4.5.4p2"><small>2</small></a>
19544 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
19545 s. The terminating null wide character is considered to be part of the wide string.
19546 <p><b>Returns</b>
19547 <p><a name="7.24.4.5.4p3" href="#7.24.4.5.4p3"><small>3</small></a>
19548 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
19549 not occur in the wide string.
19551 <p><small><a href="#Contents">Contents</a></small>
19552 <h5><a name="7.24.4.5.5" href="#7.24.4.5.5">7.24.4.5.5 The wcsspn function</a></h5>
19553 <p><b>Synopsis</b>
19554 <p><a name="7.24.4.5.5p1" href="#7.24.4.5.5p1"><small>1</small></a>
19555 <pre>
19556 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19557 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
19558 </pre>
19559 <p><b>Description</b>
19560 <p><a name="7.24.4.5.5p2" href="#7.24.4.5.5p2"><small>2</small></a>
19561 The wcsspn function computes the length of the maximum initial segment of the wide
19562 string pointed to by s1 which consists entirely of wide characters from the wide string
19563 pointed to by s2.
19564 <p><b>Returns</b>
19565 <p><a name="7.24.4.5.5p3" href="#7.24.4.5.5p3"><small>3</small></a>
19566 The wcsspn function returns the length of the segment.
19567 <!--page 395 -->
19569 <p><small><a href="#Contents">Contents</a></small>
19570 <h5><a name="7.24.4.5.6" href="#7.24.4.5.6">7.24.4.5.6 The wcsstr function</a></h5>
19571 <p><b>Synopsis</b>
19572 <p><a name="7.24.4.5.6p1" href="#7.24.4.5.6p1"><small>1</small></a>
19573 <pre>
19574 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19575 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
19576 </pre>
19577 <p><b>Description</b>
19578 <p><a name="7.24.4.5.6p2" href="#7.24.4.5.6p2"><small>2</small></a>
19579 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
19580 the sequence of wide characters (excluding the terminating null wide character) in the
19581 wide string pointed to by s2.
19582 <p><b>Returns</b>
19583 <p><a name="7.24.4.5.6p3" href="#7.24.4.5.6p3"><small>3</small></a>
19584 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
19585 wide string is not found. If s2 points to a wide string with zero length, the function
19586 returns s1.
19588 <p><small><a href="#Contents">Contents</a></small>
19589 <h5><a name="7.24.4.5.7" href="#7.24.4.5.7">7.24.4.5.7 The wcstok function</a></h5>
19590 <p><b>Synopsis</b>
19591 <p><a name="7.24.4.5.7p1" href="#7.24.4.5.7p1"><small>1</small></a>
19592 <pre>
19593 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19594 wchar_t *wcstok(wchar_t * restrict s1,
19595 const wchar_t * restrict s2,
19596 wchar_t ** restrict ptr);
19597 </pre>
19598 <p><b>Description</b>
19599 <p><a name="7.24.4.5.7p2" href="#7.24.4.5.7p2"><small>2</small></a>
19600 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
19601 a sequence of tokens, each of which is delimited by a wide character from the wide string
19602 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
19603 which the wcstok function stores information necessary for it to continue scanning the
19604 same wide string.
19605 <p><a name="7.24.4.5.7p3" href="#7.24.4.5.7p3"><small>3</small></a>
19606 The first call in a sequence has a non-null first argument and stores an initial value in the
19607 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
19608 the object pointed to by ptr is required to have the value stored by the previous call in
19609 the sequence, which is then updated. The separator wide string pointed to by s2 may be
19610 different from call to call.
19611 <p><a name="7.24.4.5.7p4" href="#7.24.4.5.7p4"><small>4</small></a>
19612 The first call in the sequence searches the wide string pointed to by s1 for the first wide
19613 character that is not contained in the current separator wide string pointed to by s2. If no
19614 such wide character is found, then there are no tokens in the wide string pointed to by s1
19615 and the wcstok function returns a null pointer. If such a wide character is found, it is
19616 the start of the first token.
19617 <p><a name="7.24.4.5.7p5" href="#7.24.4.5.7p5"><small>5</small></a>
19618 The wcstok function then searches from there for a wide character that is contained in
19619 the current separator wide string. If no such wide character is found, the current token
19620 <!--page 396 -->
19621 extends to the end of the wide string pointed to by s1, and subsequent searches in the
19622 same wide string for a token return a null pointer. If such a wide character is found, it is
19623 overwritten by a null wide character, which terminates the current token.
19624 <p><a name="7.24.4.5.7p6" href="#7.24.4.5.7p6"><small>6</small></a>
19625 In all cases, the wcstok function stores sufficient information in the pointer pointed to
19626 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
19627 value for ptr, shall start searching just past the element overwritten by a null wide
19628 character (if any).
19629 <p><b>Returns</b>
19630 <p><a name="7.24.4.5.7p7" href="#7.24.4.5.7p7"><small>7</small></a>
19631 The wcstok function returns a pointer to the first wide character of a token, or a null
19632 pointer if there is no token.
19633 <p><a name="7.24.4.5.7p8" href="#7.24.4.5.7p8"><small>8</small></a>
19634 EXAMPLE
19635 <pre>
19636 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19637 static wchar_t str1[] = L"?a???b,,,#c";
19638 static wchar_t str2[] = L"\t \t";
19639 wchar_t *t, *ptr1, *ptr2;
19640 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
19641 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
19642 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
19643 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
19644 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer
19645 </pre>
19648 <p><small><a href="#Contents">Contents</a></small>
19649 <h5><a name="7.24.4.5.8" href="#7.24.4.5.8">7.24.4.5.8 The wmemchr function</a></h5>
19650 <p><b>Synopsis</b>
19651 <p><a name="7.24.4.5.8p1" href="#7.24.4.5.8p1"><small>1</small></a>
19652 <pre>
19653 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19654 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
19655 size_t n);
19656 </pre>
19657 <p><b>Description</b>
19658 <p><a name="7.24.4.5.8p2" href="#7.24.4.5.8p2"><small>2</small></a>
19659 The wmemchr function locates the first occurrence of c in the initial n wide characters of
19660 the object pointed to by s.
19661 <p><b>Returns</b>
19662 <p><a name="7.24.4.5.8p3" href="#7.24.4.5.8p3"><small>3</small></a>
19663 The wmemchr function returns a pointer to the located wide character, or a null pointer if
19664 the wide character does not occur in the object.
19665 <!--page 397 -->
19667 <p><small><a href="#Contents">Contents</a></small>
19668 <h5><a name="7.24.4.6" href="#7.24.4.6">7.24.4.6 Miscellaneous functions</a></h5>
19670 <p><small><a href="#Contents">Contents</a></small>
19671 <h5><a name="7.24.4.6.1" href="#7.24.4.6.1">7.24.4.6.1 The wcslen function</a></h5>
19672 <p><b>Synopsis</b>
19673 <p><a name="7.24.4.6.1p1" href="#7.24.4.6.1p1"><small>1</small></a>
19674 <pre>
19675 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19676 size_t wcslen(const wchar_t *s);
19677 </pre>
19678 <p><b>Description</b>
19679 <p><a name="7.24.4.6.1p2" href="#7.24.4.6.1p2"><small>2</small></a>
19680 The wcslen function computes the length of the wide string pointed to by s.
19681 <p><b>Returns</b>
19682 <p><a name="7.24.4.6.1p3" href="#7.24.4.6.1p3"><small>3</small></a>
19683 The wcslen function returns the number of wide characters that precede the terminating
19684 null wide character.
19686 <p><small><a href="#Contents">Contents</a></small>
19687 <h5><a name="7.24.4.6.2" href="#7.24.4.6.2">7.24.4.6.2 The wmemset function</a></h5>
19688 <p><b>Synopsis</b>
19689 <p><a name="7.24.4.6.2p1" href="#7.24.4.6.2p1"><small>1</small></a>
19690 <pre>
19691 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19692 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
19693 </pre>
19694 <p><b>Description</b>
19695 <p><a name="7.24.4.6.2p2" href="#7.24.4.6.2p2"><small>2</small></a>
19696 The wmemset function copies the value of c into each of the first n wide characters of
19697 the object pointed to by s.
19698 <p><b>Returns</b>
19699 <p><a name="7.24.4.6.2p3" href="#7.24.4.6.2p3"><small>3</small></a>
19700 The wmemset function returns the value of s.
19702 <p><small><a href="#Contents">Contents</a></small>
19703 <h4><a name="7.24.5" href="#7.24.5">7.24.5 Wide character time conversion functions</a></h4>
19705 <p><small><a href="#Contents">Contents</a></small>
19706 <h5><a name="7.24.5.1" href="#7.24.5.1">7.24.5.1 The wcsftime function</a></h5>
19707 <p><b>Synopsis</b>
19708 <p><a name="7.24.5.1p1" href="#7.24.5.1p1"><small>1</small></a>
19709 <pre>
19710 #include <a href="#7.23">&lt;time.h&gt;</a>
19711 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19712 size_t wcsftime(wchar_t * restrict s,
19713 size_t maxsize,
19714 const wchar_t * restrict format,
19715 const struct tm * restrict timeptr);
19716 </pre>
19717 <p><b>Description</b>
19718 <p><a name="7.24.5.1p2" href="#7.24.5.1p2"><small>2</small></a>
19719 The wcsftime function is equivalent to the strftime function, except that:
19720 <ul>
19721 <li> The argument s points to the initial element of an array of wide characters into which
19722 the generated output is to be placed.
19723 <!--page 398 -->
19724 <li> The argument maxsize indicates the limiting number of wide characters.
19725 <li> The argument format is a wide string and the conversion specifiers are replaced by
19726 corresponding sequences of wide characters.
19727 <li> The return value indicates the number of wide characters.
19728 </ul>
19729 <p><b>Returns</b>
19730 <p><a name="7.24.5.1p3" href="#7.24.5.1p3"><small>3</small></a>
19731 If the total number of resulting wide characters including the terminating null wide
19732 character is not more than maxsize, the wcsftime function returns the number of
19733 wide characters placed into the array pointed to by s not including the terminating null
19734 wide character. Otherwise, zero is returned and the contents of the array are
19735 indeterminate.
19737 <p><small><a href="#Contents">Contents</a></small>
19738 <h4><a name="7.24.6" href="#7.24.6">7.24.6 Extended multibyte/wide character conversion utilities</a></h4>
19739 <p><a name="7.24.6p1" href="#7.24.6p1"><small>1</small></a>
19740 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
19741 between multibyte characters and wide characters.
19742 <p><a name="7.24.6p2" href="#7.24.6p2"><small>2</small></a>
19743 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.24.6.3">7.24.6.3</a> and
19744 <a href="#7.24.6.4">7.24.6.4</a> -- take as a last argument a pointer to an object of type mbstate_t that is used
19745 to describe the current conversion state from a particular multibyte character sequence to
19746 a wide character sequence (or the reverse) under the rules of a particular setting for the
19747 LC_CTYPE category of the current locale.
19748 <p><a name="7.24.6p3" href="#7.24.6p3"><small>3</small></a>
19749 The initial conversion state corresponds, for a conversion in either direction, to the
19750 beginning of a new multibyte character in the initial shift state. A zero-valued
19751 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
19752 valued mbstate_t object can be used to initiate conversion involving any multibyte
19753 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
19754 been altered by any of the functions described in this subclause, and is then used with a
19755 different multibyte character sequence, or in the other conversion direction, or with a
19756 different LC_CTYPE category setting than on earlier function calls, the behavior is
19757 undefined.<sup><a href="#note299"><b>299)</b></a></sup>
19758 <p><a name="7.24.6p4" href="#7.24.6p4"><small>4</small></a>
19759 On entry, each function takes the described conversion state (either internal or pointed to
19760 by an argument) as current. The conversion state described by the pointed-to object is
19761 altered as needed to track the shift state, and the position within a multibyte character, for
19762 the associated multibyte character sequence.
19767 <!--page 399 -->
19769 <p><b>Footnotes</b>
19770 <p><small><a name="note299" href="#note299">299)</a> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
19771 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
19772 character string.
19773 </small>
19775 <p><small><a href="#Contents">Contents</a></small>
19776 <h5><a name="7.24.6.1" href="#7.24.6.1">7.24.6.1 Single-byte/wide character conversion functions</a></h5>
19778 <p><small><a href="#Contents">Contents</a></small>
19779 <h5><a name="7.24.6.1.1" href="#7.24.6.1.1">7.24.6.1.1 The btowc function</a></h5>
19780 <p><b>Synopsis</b>
19781 <p><a name="7.24.6.1.1p1" href="#7.24.6.1.1p1"><small>1</small></a>
19782 <pre>
19783 #include <a href="#7.19">&lt;stdio.h&gt;</a>
19784 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19785 wint_t btowc(int c);
19786 </pre>
19787 <p><b>Description</b>
19788 <p><a name="7.24.6.1.1p2" href="#7.24.6.1.1p2"><small>2</small></a>
19789 The btowc function determines whether c constitutes a valid single-byte character in the
19790 initial shift state.
19791 <p><b>Returns</b>
19792 <p><a name="7.24.6.1.1p3" href="#7.24.6.1.1p3"><small>3</small></a>
19793 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
19794 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
19795 returns the wide character representation of that character.
19797 <p><small><a href="#Contents">Contents</a></small>
19798 <h5><a name="7.24.6.1.2" href="#7.24.6.1.2">7.24.6.1.2 The wctob function</a></h5>
19799 <p><b>Synopsis</b>
19800 <p><a name="7.24.6.1.2p1" href="#7.24.6.1.2p1"><small>1</small></a>
19801 <pre>
19802 #include <a href="#7.19">&lt;stdio.h&gt;</a>
19803 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19804 int wctob(wint_t c);
19805 </pre>
19806 <p><b>Description</b>
19807 <p><a name="7.24.6.1.2p2" href="#7.24.6.1.2p2"><small>2</small></a>
19808 The wctob function determines whether c corresponds to a member of the extended
19809 character set whose multibyte character representation is a single byte when in the initial
19810 shift state.
19811 <p><b>Returns</b>
19812 <p><a name="7.24.6.1.2p3" href="#7.24.6.1.2p3"><small>3</small></a>
19813 The wctob function returns EOF if c does not correspond to a multibyte character with
19814 length one in the initial shift state. Otherwise, it returns the single-byte representation of
19815 that character as an unsigned char converted to an int.
19817 <p><small><a href="#Contents">Contents</a></small>
19818 <h5><a name="7.24.6.2" href="#7.24.6.2">7.24.6.2 Conversion state functions</a></h5>
19820 <p><small><a href="#Contents">Contents</a></small>
19821 <h5><a name="7.24.6.2.1" href="#7.24.6.2.1">7.24.6.2.1 The mbsinit function</a></h5>
19822 <p><b>Synopsis</b>
19823 <p><a name="7.24.6.2.1p1" href="#7.24.6.2.1p1"><small>1</small></a>
19824 <pre>
19825 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19826 int mbsinit(const mbstate_t *ps);
19827 </pre>
19828 <p><b>Description</b>
19829 <p><a name="7.24.6.2.1p2" href="#7.24.6.2.1p2"><small>2</small></a>
19830 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
19831 mbstate_t object describes an initial conversion state.
19832 <!--page 400 -->
19833 <p><b>Returns</b>
19834 <p><a name="7.24.6.2.1p3" href="#7.24.6.2.1p3"><small>3</small></a>
19835 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
19836 describes an initial conversion state; otherwise, it returns zero.
19838 <p><small><a href="#Contents">Contents</a></small>
19839 <h5><a name="7.24.6.3" href="#7.24.6.3">7.24.6.3 Restartable multibyte/wide character conversion functions</a></h5>
19840 <p><a name="7.24.6.3p1" href="#7.24.6.3p1"><small>1</small></a>
19841 These functions differ from the corresponding multibyte character functions of <a href="#7.20.7">7.20.7</a>
19842 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
19843 pointer to mbstate_t that points to an object that can completely describe the current
19844 conversion state of the associated multibyte character sequence. If ps is a null pointer,
19845 each function uses its own internal mbstate_t object instead, which is initialized at
19846 program startup to the initial conversion state. The implementation behaves as if no
19847 library function calls these functions with a null pointer for ps.
19848 <p><a name="7.24.6.3p2" href="#7.24.6.3p2"><small>2</small></a>
19849 Also unlike their corresponding functions, the return value does not represent whether the
19850 encoding is state-dependent.
19852 <p><small><a href="#Contents">Contents</a></small>
19853 <h5><a name="7.24.6.3.1" href="#7.24.6.3.1">7.24.6.3.1 The mbrlen function</a></h5>
19854 <p><b>Synopsis</b>
19855 <p><a name="7.24.6.3.1p1" href="#7.24.6.3.1p1"><small>1</small></a>
19856 <pre>
19857 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19858 size_t mbrlen(const char * restrict s,
19859 size_t n,
19860 mbstate_t * restrict ps);
19861 </pre>
19862 <p><b>Description</b>
19863 <p><a name="7.24.6.3.1p2" href="#7.24.6.3.1p2"><small>2</small></a>
19864 The mbrlen function is equivalent to the call:
19865 <pre>
19866 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
19867 </pre>
19868 where internal is the mbstate_t object for the mbrlen function, except that the
19869 expression designated by ps is evaluated only once.
19870 <p><b>Returns</b>
19871 <p><a name="7.24.6.3.1p3" href="#7.24.6.3.1p3"><small>3</small></a>
19872 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
19873 or (size_t)(-1).
19874 <p><b> Forward references</b>: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
19875 <!--page 401 -->
19877 <p><small><a href="#Contents">Contents</a></small>
19878 <h5><a name="7.24.6.3.2" href="#7.24.6.3.2">7.24.6.3.2 The mbrtowc function</a></h5>
19879 <p><b>Synopsis</b>
19880 <p><a name="7.24.6.3.2p1" href="#7.24.6.3.2p1"><small>1</small></a>
19881 <pre>
19882 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19883 size_t mbrtowc(wchar_t * restrict pwc,
19884 const char * restrict s,
19885 size_t n,
19886 mbstate_t * restrict ps);
19887 </pre>
19888 <p><b>Description</b>
19889 <p><a name="7.24.6.3.2p2" href="#7.24.6.3.2p2"><small>2</small></a>
19890 If s is a null pointer, the mbrtowc function is equivalent to the call:
19891 <pre>
19892 mbrtowc(NULL, "", 1, ps)
19893 </pre>
19894 In this case, the values of the parameters pwc and n are ignored.
19895 <p><a name="7.24.6.3.2p3" href="#7.24.6.3.2p3"><small>3</small></a>
19896 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
19897 the byte pointed to by s to determine the number of bytes needed to complete the next
19898 multibyte character (including any shift sequences). If the function determines that the
19899 next multibyte character is complete and valid, it determines the value of the
19900 corresponding wide character and then, if pwc is not a null pointer, stores that value in
19901 the object pointed to by pwc. If the corresponding wide character is the null wide
19902 character, the resulting state described is the initial conversion state.
19903 <p><b>Returns</b>
19904 <p><a name="7.24.6.3.2p4" href="#7.24.6.3.2p4"><small>4</small></a>
19905 The mbrtowc function returns the first of the following that applies (given the current
19906 conversion state):
19907 <dl>
19908 <dt> 0 <dd> if the next n or fewer bytes complete the multibyte character that
19909 corresponds to the null wide character (which is the value stored).
19910 <dt> between 1 and n inclusive<dd> if the next n or fewer bytes complete a valid multibyte
19911 character (which is the value stored); the value returned is the number
19912 of bytes that complete the multibyte character.
19913 <dt> (size_t)(-2)<dd> if the next n bytes contribute to an incomplete (but potentially valid)
19914 multibyte character, and all n bytes have been processed (no value is
19915 stored).<sup><a href="#note300"><b>300)</b></a></sup>
19916 <dt> (size_t)(-1)<dd> if an encoding error occurs, in which case the next n or fewer bytes
19917 do not contribute to a complete and valid multibyte character (no
19918 value is stored); the value of the macro EILSEQ is stored in errno,
19919 and the conversion state is unspecified.
19920 </dl>
19921 <!--page 402 -->
19923 <p><b>Footnotes</b>
19924 <p><small><a name="note300" href="#note300">300)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
19925 sequence of redundant shift sequences (for implementations with state-dependent encodings).
19926 </small>
19928 <p><small><a href="#Contents">Contents</a></small>
19929 <h5><a name="7.24.6.3.3" href="#7.24.6.3.3">7.24.6.3.3 The wcrtomb function</a></h5>
19930 <p><b>Synopsis</b>
19931 <p><a name="7.24.6.3.3p1" href="#7.24.6.3.3p1"><small>1</small></a>
19932 <pre>
19933 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19934 size_t wcrtomb(char * restrict s,
19935 wchar_t wc,
19936 mbstate_t * restrict ps);
19937 </pre>
19938 <p><b>Description</b>
19939 <p><a name="7.24.6.3.3p2" href="#7.24.6.3.3p2"><small>2</small></a>
19940 If s is a null pointer, the wcrtomb function is equivalent to the call
19941 <pre>
19942 wcrtomb(buf, L'\0', ps)
19943 </pre>
19944 where buf is an internal buffer.
19945 <p><a name="7.24.6.3.3p3" href="#7.24.6.3.3p3"><small>3</small></a>
19946 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
19947 to represent the multibyte character that corresponds to the wide character given by wc
19948 (including any shift sequences), and stores the multibyte character representation in the
19949 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
19950 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
19951 to restore the initial shift state; the resulting state described is the initial conversion state.
19952 <p><b>Returns</b>
19953 <p><a name="7.24.6.3.3p4" href="#7.24.6.3.3p4"><small>4</small></a>
19954 The wcrtomb function returns the number of bytes stored in the array object (including
19955 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
19956 the function stores the value of the macro EILSEQ in errno and returns
19957 (size_t)(-1); the conversion state is unspecified.
19959 <p><small><a href="#Contents">Contents</a></small>
19960 <h5><a name="7.24.6.4" href="#7.24.6.4">7.24.6.4 Restartable multibyte/wide string conversion functions</a></h5>
19961 <p><a name="7.24.6.4p1" href="#7.24.6.4p1"><small>1</small></a>
19962 These functions differ from the corresponding multibyte string functions of <a href="#7.20.8">7.20.8</a>
19963 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
19964 mbstate_t that points to an object that can completely describe the current conversion
19965 state of the associated multibyte character sequence. If ps is a null pointer, each function
19966 uses its own internal mbstate_t object instead, which is initialized at program startup
19967 to the initial conversion state. The implementation behaves as if no library function calls
19968 these functions with a null pointer for ps.
19969 <p><a name="7.24.6.4p2" href="#7.24.6.4p2"><small>2</small></a>
19970 Also unlike their corresponding functions, the conversion source parameter, src, has a
19971 pointer-to-pointer type. When the function is storing the results of conversions (that is,
19972 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
19973 to reflect the amount of the source processed by that invocation.
19974 <!--page 403 -->
19976 <p><small><a href="#Contents">Contents</a></small>
19977 <h5><a name="7.24.6.4.1" href="#7.24.6.4.1">7.24.6.4.1 The mbsrtowcs function</a></h5>
19978 <p><b>Synopsis</b>
19979 <p><a name="7.24.6.4.1p1" href="#7.24.6.4.1p1"><small>1</small></a>
19980 <pre>
19981 #include <a href="#7.24">&lt;wchar.h&gt;</a>
19982 size_t mbsrtowcs(wchar_t * restrict dst,
19983 const char ** restrict src,
19984 size_t len,
19985 mbstate_t * restrict ps);
19986 </pre>
19987 <p><b>Description</b>
19988 <p><a name="7.24.6.4.1p2" href="#7.24.6.4.1p2"><small>2</small></a>
19989 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
19990 conversion state described by the object pointed to by ps, from the array indirectly
19991 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
19992 pointer, the converted characters are stored into the array pointed to by dst. Conversion
19993 continues up to and including a terminating null character, which is also stored.
19994 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
19995 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
19996 characters have been stored into the array pointed to by dst.<sup><a href="#note301"><b>301)</b></a></sup> Each conversion takes
19997 place as if by a call to the mbrtowc function.
19998 <p><a name="7.24.6.4.1p3" href="#7.24.6.4.1p3"><small>3</small></a>
19999 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
20000 pointer (if conversion stopped due to reaching a terminating null character) or the address
20001 just past the last multibyte character converted (if any). If conversion stopped due to
20002 reaching a terminating null character and if dst is not a null pointer, the resulting state
20003 described is the initial conversion state.
20004 <p><b>Returns</b>
20005 <p><a name="7.24.6.4.1p4" href="#7.24.6.4.1p4"><small>4</small></a>
20006 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
20007 character, an encoding error occurs: the mbsrtowcs function stores the value of the
20008 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
20009 unspecified. Otherwise, it returns the number of multibyte characters successfully
20010 converted, not including the terminating null character (if any).
20015 <!--page 404 -->
20017 <p><b>Footnotes</b>
20018 <p><small><a name="note301" href="#note301">301)</a> Thus, the value of len is ignored if dst is a null pointer.
20019 </small>
20021 <p><small><a href="#Contents">Contents</a></small>
20022 <h5><a name="7.24.6.4.2" href="#7.24.6.4.2">7.24.6.4.2 The wcsrtombs function</a></h5>
20023 <p><b>Synopsis</b>
20024 <p><a name="7.24.6.4.2p1" href="#7.24.6.4.2p1"><small>1</small></a>
20025 <pre>
20026 #include <a href="#7.24">&lt;wchar.h&gt;</a>
20027 size_t wcsrtombs(char * restrict dst,
20028 const wchar_t ** restrict src,
20029 size_t len,
20030 mbstate_t * restrict ps);
20031 </pre>
20032 <p><b>Description</b>
20033 <p><a name="7.24.6.4.2p2" href="#7.24.6.4.2p2"><small>2</small></a>
20034 The wcsrtombs function converts a sequence of wide characters from the array
20035 indirectly pointed to by src into a sequence of corresponding multibyte characters that
20036 begins in the conversion state described by the object pointed to by ps. If dst is not a
20037 null pointer, the converted characters are then stored into the array pointed to by dst.
20038 Conversion continues up to and including a terminating null wide character, which is also
20039 stored. Conversion stops earlier in two cases: when a wide character is reached that does
20040 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
20041 next multibyte character would exceed the limit of len total bytes to be stored into the
20042 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
20043 function.<sup><a href="#note302"><b>302)</b></a></sup>
20044 <p><a name="7.24.6.4.2p3" href="#7.24.6.4.2p3"><small>3</small></a>
20045 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
20046 pointer (if conversion stopped due to reaching a terminating null wide character) or the
20047 address just past the last wide character converted (if any). If conversion stopped due to
20048 reaching a terminating null wide character, the resulting state described is the initial
20049 conversion state.
20050 <p><b>Returns</b>
20051 <p><a name="7.24.6.4.2p4" href="#7.24.6.4.2p4"><small>4</small></a>
20052 If conversion stops because a wide character is reached that does not correspond to a
20053 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
20054 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
20055 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
20056 character sequence, not including the terminating null character (if any).
20061 <!--page 405 -->
20063 <p><b>Footnotes</b>
20064 <p><small><a name="note302" href="#note302">302)</a> If conversion stops because a terminating null wide character has been reached, the bytes stored
20065 include those necessary to reach the initial shift state immediately before the null byte.
20066 </small>
20068 <p><small><a href="#Contents">Contents</a></small>
20069 <h3><a name="7.25" href="#7.25">7.25 Wide character classification and mapping utilities &lt;wctype.h&gt;</a></h3>
20071 <p><small><a href="#Contents">Contents</a></small>
20072 <h4><a name="7.25.1" href="#7.25.1">7.25.1 Introduction</a></h4>
20073 <p><a name="7.25.1p1" href="#7.25.1p1"><small>1</small></a>
20074 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares three data types, one macro, and many functions.<sup><a href="#note303"><b>303)</b></a></sup>
20075 <p><a name="7.25.1p2" href="#7.25.1p2"><small>2</small></a>
20076 The types declared are
20077 <pre>
20078 wint_t
20079 </pre>
20080 described in <a href="#7.24.1">7.24.1</a>;
20081 <pre>
20082 wctrans_t
20083 </pre>
20084 which is a scalar type that can hold values which represent locale-specific character
20085 mappings; and
20086 <pre>
20087 wctype_t
20088 </pre>
20089 which is a scalar type that can hold values which represent locale-specific character
20090 classifications.
20091 <p><a name="7.25.1p3" href="#7.25.1p3"><small>3</small></a>
20092 The macro defined is WEOF (described in <a href="#7.24.1">7.24.1</a>).
20093 <p><a name="7.25.1p4" href="#7.25.1p4"><small>4</small></a>
20094 The functions declared are grouped as follows:
20095 <ul>
20096 <li> Functions that provide wide character classification;
20097 <li> Extensible functions that provide wide character classification;
20098 <li> Functions that provide wide character case mapping;
20099 <li> Extensible functions that provide wide character mapping.
20100 </ul>
20101 <p><a name="7.25.1p5" href="#7.25.1p5"><small>5</small></a>
20102 For all functions described in this subclause that accept an argument of type wint_t, the
20103 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
20104 this argument has any other value, the behavior is undefined.
20105 <p><a name="7.25.1p6" href="#7.25.1p6"><small>6</small></a>
20106 The behavior of these functions is affected by the LC_CTYPE category of the current
20107 locale.
20112 <!--page 406 -->
20114 <p><b>Footnotes</b>
20115 <p><small><a name="note303" href="#note303">303)</a> See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
20116 </small>
20118 <p><small><a href="#Contents">Contents</a></small>
20119 <h4><a name="7.25.2" href="#7.25.2">7.25.2 Wide character classification utilities</a></h4>
20120 <p><a name="7.25.2p1" href="#7.25.2p1"><small>1</small></a>
20121 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
20122 characters.
20123 <p><a name="7.25.2p2" href="#7.25.2p2"><small>2</small></a>
20124 The term printing wide character refers to a member of a locale-specific set of wide
20125 characters, each of which occupies at least one printing position on a display device. The
20126 term control wide character refers to a member of a locale-specific set of wide characters
20127 that are not printing wide characters.
20129 <p><small><a href="#Contents">Contents</a></small>
20130 <h5><a name="7.25.2.1" href="#7.25.2.1">7.25.2.1 Wide character classification functions</a></h5>
20131 <p><a name="7.25.2.1p1" href="#7.25.2.1p1"><small>1</small></a>
20132 The functions in this subclause return nonzero (true) if and only if the value of the
20133 argument wc conforms to that in the description of the function.
20134 <p><a name="7.25.2.1p2" href="#7.25.2.1p2"><small>2</small></a>
20135 Each of the following functions returns true for each wide character that corresponds (as
20136 if by a call to the wctob function) to a single-byte character for which the corresponding
20137 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
20138 iswpunct functions may differ with respect to wide characters other than L' ' that are
20139 both printing and white-space wide characters.<sup><a href="#note304"><b>304)</b></a></sup>
20140 <p><b> Forward references</b>: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
20142 <p><b>Footnotes</b>
20143 <p><small><a name="note304" href="#note304">304)</a> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
20144 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
20145 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
20146 &amp;&amp; iswspace(wc) is true, but not both.
20147 </small>
20149 <p><small><a href="#Contents">Contents</a></small>
20150 <h5><a name="7.25.2.1.1" href="#7.25.2.1.1">7.25.2.1.1 The iswalnum function</a></h5>
20151 <p><b>Synopsis</b>
20152 <p><a name="7.25.2.1.1p1" href="#7.25.2.1.1p1"><small>1</small></a>
20153 <pre>
20154 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20155 int iswalnum(wint_t wc);
20156 </pre>
20157 <p><b>Description</b>
20158 <p><a name="7.25.2.1.1p2" href="#7.25.2.1.1p2"><small>2</small></a>
20159 The iswalnum function tests for any wide character for which iswalpha or
20160 iswdigit is true.
20162 <p><small><a href="#Contents">Contents</a></small>
20163 <h5><a name="7.25.2.1.2" href="#7.25.2.1.2">7.25.2.1.2 The iswalpha function</a></h5>
20164 <p><b>Synopsis</b>
20165 <p><a name="7.25.2.1.2p1" href="#7.25.2.1.2p1"><small>1</small></a>
20166 <pre>
20167 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20168 int iswalpha(wint_t wc);
20169 </pre>
20170 <p><b>Description</b>
20171 <p><a name="7.25.2.1.2p2" href="#7.25.2.1.2p2"><small>2</small></a>
20172 The iswalpha function tests for any wide character for which iswupper or
20173 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
20175 <!--page 407 -->
20176 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
20177 is true.<sup><a href="#note305"><b>305)</b></a></sup>
20179 <p><b>Footnotes</b>
20180 <p><small><a name="note305" href="#note305">305)</a> The functions iswlower and iswupper test true or false separately for each of these additional
20181 wide characters; all four combinations are possible.
20182 </small>
20184 <p><small><a href="#Contents">Contents</a></small>
20185 <h5><a name="7.25.2.1.3" href="#7.25.2.1.3">7.25.2.1.3 The iswblank function</a></h5>
20186 <p><b>Synopsis</b>
20187 <p><a name="7.25.2.1.3p1" href="#7.25.2.1.3p1"><small>1</small></a>
20188 <pre>
20189 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20190 int iswblank(wint_t wc);
20191 </pre>
20192 <p><b>Description</b>
20193 <p><a name="7.25.2.1.3p2" href="#7.25.2.1.3p2"><small>2</small></a>
20194 The iswblank function tests for any wide character that is a standard blank wide
20195 character or is one of a locale-specific set of wide characters for which iswspace is true
20196 and that is used to separate words within a line of text. The standard blank wide
20197 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
20198 locale, iswblank returns true only for the standard blank characters.
20200 <p><small><a href="#Contents">Contents</a></small>
20201 <h5><a name="7.25.2.1.4" href="#7.25.2.1.4">7.25.2.1.4 The iswcntrl function</a></h5>
20202 <p><b>Synopsis</b>
20203 <p><a name="7.25.2.1.4p1" href="#7.25.2.1.4p1"><small>1</small></a>
20204 <pre>
20205 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20206 int iswcntrl(wint_t wc);
20207 </pre>
20208 <p><b>Description</b>
20209 <p><a name="7.25.2.1.4p2" href="#7.25.2.1.4p2"><small>2</small></a>
20210 The iswcntrl function tests for any control wide character.
20212 <p><small><a href="#Contents">Contents</a></small>
20213 <h5><a name="7.25.2.1.5" href="#7.25.2.1.5">7.25.2.1.5 The iswdigit function</a></h5>
20214 <p><b>Synopsis</b>
20215 <p><a name="7.25.2.1.5p1" href="#7.25.2.1.5p1"><small>1</small></a>
20216 <pre>
20217 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20218 int iswdigit(wint_t wc);
20219 </pre>
20220 <p><b>Description</b>
20221 <p><a name="7.25.2.1.5p2" href="#7.25.2.1.5p2"><small>2</small></a>
20222 The iswdigit function tests for any wide character that corresponds to a decimal-digit
20223 character (as defined in <a href="#5.2.1">5.2.1</a>).
20225 <p><small><a href="#Contents">Contents</a></small>
20226 <h5><a name="7.25.2.1.6" href="#7.25.2.1.6">7.25.2.1.6 The iswgraph function</a></h5>
20227 <p><b>Synopsis</b>
20228 <p><a name="7.25.2.1.6p1" href="#7.25.2.1.6p1"><small>1</small></a>
20229 <pre>
20230 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20231 int iswgraph(wint_t wc);
20232 </pre>
20237 <!--page 408 -->
20238 <p><b>Description</b>
20239 <p><a name="7.25.2.1.6p2" href="#7.25.2.1.6p2"><small>2</small></a>
20240 The iswgraph function tests for any wide character for which iswprint is true and
20241 iswspace is false.<sup><a href="#note306"><b>306)</b></a></sup>
20243 <p><b>Footnotes</b>
20244 <p><small><a name="note306" href="#note306">306)</a> Note that the behavior of the iswgraph and iswpunct functions may differ from their
20245 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
20246 characters other than ' '.
20247 </small>
20249 <p><small><a href="#Contents">Contents</a></small>
20250 <h5><a name="7.25.2.1.7" href="#7.25.2.1.7">7.25.2.1.7 The iswlower function</a></h5>
20251 <p><b>Synopsis</b>
20252 <p><a name="7.25.2.1.7p1" href="#7.25.2.1.7p1"><small>1</small></a>
20253 <pre>
20254 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20255 int iswlower(wint_t wc);
20256 </pre>
20257 <p><b>Description</b>
20258 <p><a name="7.25.2.1.7p2" href="#7.25.2.1.7p2"><small>2</small></a>
20259 The iswlower function tests for any wide character that corresponds to a lowercase
20260 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
20261 iswdigit, iswpunct, or iswspace is true.
20263 <p><small><a href="#Contents">Contents</a></small>
20264 <h5><a name="7.25.2.1.8" href="#7.25.2.1.8">7.25.2.1.8 The iswprint function</a></h5>
20265 <p><b>Synopsis</b>
20266 <p><a name="7.25.2.1.8p1" href="#7.25.2.1.8p1"><small>1</small></a>
20267 <pre>
20268 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20269 int iswprint(wint_t wc);
20270 </pre>
20271 <p><b>Description</b>
20272 <p><a name="7.25.2.1.8p2" href="#7.25.2.1.8p2"><small>2</small></a>
20273 The iswprint function tests for any printing wide character.
20275 <p><small><a href="#Contents">Contents</a></small>
20276 <h5><a name="7.25.2.1.9" href="#7.25.2.1.9">7.25.2.1.9 The iswpunct function</a></h5>
20277 <p><b>Synopsis</b>
20278 <p><a name="7.25.2.1.9p1" href="#7.25.2.1.9p1"><small>1</small></a>
20279 <pre>
20280 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20281 int iswpunct(wint_t wc);
20282 </pre>
20283 <p><b>Description</b>
20284 <p><a name="7.25.2.1.9p2" href="#7.25.2.1.9p2"><small>2</small></a>
20285 The iswpunct function tests for any printing wide character that is one of a locale-
20286 specific set of punctuation wide characters for which neither iswspace nor iswalnum
20287 is true.<sup><a href="#note306"><b>306)</b></a></sup>
20289 <p><small><a href="#Contents">Contents</a></small>
20290 <h5><a name="7.25.2.1.10" href="#7.25.2.1.10">7.25.2.1.10 The iswspace function</a></h5>
20291 <p><b>Synopsis</b>
20292 <p><a name="7.25.2.1.10p1" href="#7.25.2.1.10p1"><small>1</small></a>
20293 <pre>
20294 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20295 int iswspace(wint_t wc);
20296 </pre>
20300 <!--page 409 -->
20301 <p><b>Description</b>
20302 <p><a name="7.25.2.1.10p2" href="#7.25.2.1.10p2"><small>2</small></a>
20303 The iswspace function tests for any wide character that corresponds to a locale-specific
20304 set of white-space wide characters for which none of iswalnum, iswgraph, or
20305 iswpunct is true.
20307 <p><small><a href="#Contents">Contents</a></small>
20308 <h5><a name="7.25.2.1.11" href="#7.25.2.1.11">7.25.2.1.11 The iswupper function</a></h5>
20309 <p><b>Synopsis</b>
20310 <p><a name="7.25.2.1.11p1" href="#7.25.2.1.11p1"><small>1</small></a>
20311 <pre>
20312 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20313 int iswupper(wint_t wc);
20314 </pre>
20315 <p><b>Description</b>
20316 <p><a name="7.25.2.1.11p2" href="#7.25.2.1.11p2"><small>2</small></a>
20317 The iswupper function tests for any wide character that corresponds to an uppercase
20318 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
20319 iswdigit, iswpunct, or iswspace is true.
20321 <p><small><a href="#Contents">Contents</a></small>
20322 <h5><a name="7.25.2.1.12" href="#7.25.2.1.12">7.25.2.1.12 The iswxdigit function</a></h5>
20323 <p><b>Synopsis</b>
20324 <p><a name="7.25.2.1.12p1" href="#7.25.2.1.12p1"><small>1</small></a>
20325 <pre>
20326 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20327 int iswxdigit(wint_t wc);
20328 </pre>
20329 <p><b>Description</b>
20330 <p><a name="7.25.2.1.12p2" href="#7.25.2.1.12p2"><small>2</small></a>
20331 The iswxdigit function tests for any wide character that corresponds to a
20332 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
20334 <p><small><a href="#Contents">Contents</a></small>
20335 <h5><a name="7.25.2.2" href="#7.25.2.2">7.25.2.2 Extensible wide character classification functions</a></h5>
20336 <p><a name="7.25.2.2p1" href="#7.25.2.2p1"><small>1</small></a>
20337 The functions wctype and iswctype provide extensible wide character classification
20338 as well as testing equivalent to that performed by the functions described in the previous
20339 subclause (<a href="#7.25.2.1">7.25.2.1</a>).
20341 <p><small><a href="#Contents">Contents</a></small>
20342 <h5><a name="7.25.2.2.1" href="#7.25.2.2.1">7.25.2.2.1 The iswctype function</a></h5>
20343 <p><b>Synopsis</b>
20344 <p><a name="7.25.2.2.1p1" href="#7.25.2.2.1p1"><small>1</small></a>
20345 <pre>
20346 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20347 int iswctype(wint_t wc, wctype_t desc);
20348 </pre>
20349 <p><b>Description</b>
20350 <p><a name="7.25.2.2.1p2" href="#7.25.2.2.1p2"><small>2</small></a>
20351 The iswctype function determines whether the wide character wc has the property
20352 described by desc. The current setting of the LC_CTYPE category shall be the same as
20353 during the call to wctype that returned the value desc.
20354 <p><a name="7.25.2.2.1p3" href="#7.25.2.2.1p3"><small>3</small></a>
20355 Each of the following expressions has a truth-value equivalent to the call to the wide
20356 character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
20357 <!--page 410 -->
20358 <pre>
20359 iswctype(wc, wctype("alnum")) // iswalnum(wc)
20360 iswctype(wc, wctype("alpha")) // iswalpha(wc)
20361 iswctype(wc, wctype("blank")) // iswblank(wc)
20362 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
20363 iswctype(wc, wctype("digit")) // iswdigit(wc)
20364 iswctype(wc, wctype("graph")) // iswgraph(wc)
20365 iswctype(wc, wctype("lower")) // iswlower(wc)
20366 iswctype(wc, wctype("print")) // iswprint(wc)
20367 iswctype(wc, wctype("punct")) // iswpunct(wc)
20368 iswctype(wc, wctype("space")) // iswspace(wc)
20369 iswctype(wc, wctype("upper")) // iswupper(wc)
20370 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
20371 </pre>
20372 <p><b>Returns</b>
20373 <p><a name="7.25.2.2.1p4" href="#7.25.2.2.1p4"><small>4</small></a>
20374 The iswctype function returns nonzero (true) if and only if the value of the wide
20375 character wc has the property described by desc.
20376 <p><b> Forward references</b>: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
20378 <p><small><a href="#Contents">Contents</a></small>
20379 <h5><a name="7.25.2.2.2" href="#7.25.2.2.2">7.25.2.2.2 The wctype function</a></h5>
20380 <p><b>Synopsis</b>
20381 <p><a name="7.25.2.2.2p1" href="#7.25.2.2.2p1"><small>1</small></a>
20382 <pre>
20383 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20384 wctype_t wctype(const char *property);
20385 </pre>
20386 <p><b>Description</b>
20387 <p><a name="7.25.2.2.2p2" href="#7.25.2.2.2p2"><small>2</small></a>
20388 The wctype function constructs a value with type wctype_t that describes a class of
20389 wide characters identified by the string argument property.
20390 <p><a name="7.25.2.2.2p3" href="#7.25.2.2.2p3"><small>3</small></a>
20391 The strings listed in the description of the iswctype function shall be valid in all
20392 locales as property arguments to the wctype function.
20393 <p><b>Returns</b>
20394 <p><a name="7.25.2.2.2p4" href="#7.25.2.2.2p4"><small>4</small></a>
20395 If property identifies a valid class of wide characters according to the LC_CTYPE
20396 category of the current locale, the wctype function returns a nonzero value that is valid
20397 as the second argument to the iswctype function; otherwise, it returns zero. *
20398 <!--page 411 -->
20400 <p><small><a href="#Contents">Contents</a></small>
20401 <h4><a name="7.25.3" href="#7.25.3">7.25.3 Wide character case mapping utilities</a></h4>
20402 <p><a name="7.25.3p1" href="#7.25.3p1"><small>1</small></a>
20403 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
20405 <p><small><a href="#Contents">Contents</a></small>
20406 <h5><a name="7.25.3.1" href="#7.25.3.1">7.25.3.1 Wide character case mapping functions</a></h5>
20408 <p><small><a href="#Contents">Contents</a></small>
20409 <h5><a name="7.25.3.1.1" href="#7.25.3.1.1">7.25.3.1.1 The towlower function</a></h5>
20410 <p><b>Synopsis</b>
20411 <p><a name="7.25.3.1.1p1" href="#7.25.3.1.1p1"><small>1</small></a>
20412 <pre>
20413 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20414 wint_t towlower(wint_t wc);
20415 </pre>
20416 <p><b>Description</b>
20417 <p><a name="7.25.3.1.1p2" href="#7.25.3.1.1p2"><small>2</small></a>
20418 The towlower function converts an uppercase letter to a corresponding lowercase letter.
20419 <p><b>Returns</b>
20420 <p><a name="7.25.3.1.1p3" href="#7.25.3.1.1p3"><small>3</small></a>
20421 If the argument is a wide character for which iswupper is true and there are one or
20422 more corresponding wide characters, as specified by the current locale, for which
20423 iswlower is true, the towlower function returns one of the corresponding wide
20424 characters (always the same one for any given locale); otherwise, the argument is
20425 returned unchanged.
20427 <p><small><a href="#Contents">Contents</a></small>
20428 <h5><a name="7.25.3.1.2" href="#7.25.3.1.2">7.25.3.1.2 The towupper function</a></h5>
20429 <p><b>Synopsis</b>
20430 <p><a name="7.25.3.1.2p1" href="#7.25.3.1.2p1"><small>1</small></a>
20431 <pre>
20432 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20433 wint_t towupper(wint_t wc);
20434 </pre>
20435 <p><b>Description</b>
20436 <p><a name="7.25.3.1.2p2" href="#7.25.3.1.2p2"><small>2</small></a>
20437 The towupper function converts a lowercase letter to a corresponding uppercase letter.
20438 <p><b>Returns</b>
20439 <p><a name="7.25.3.1.2p3" href="#7.25.3.1.2p3"><small>3</small></a>
20440 If the argument is a wide character for which iswlower is true and there are one or
20441 more corresponding wide characters, as specified by the current locale, for which
20442 iswupper is true, the towupper function returns one of the corresponding wide
20443 characters (always the same one for any given locale); otherwise, the argument is
20444 returned unchanged.
20446 <p><small><a href="#Contents">Contents</a></small>
20447 <h5><a name="7.25.3.2" href="#7.25.3.2">7.25.3.2 Extensible wide character case mapping functions</a></h5>
20448 <p><a name="7.25.3.2p1" href="#7.25.3.2p1"><small>1</small></a>
20449 The functions wctrans and towctrans provide extensible wide character mapping as
20450 well as case mapping equivalent to that performed by the functions described in the
20451 previous subclause (<a href="#7.25.3.1">7.25.3.1</a>).
20452 <!--page 412 -->
20454 <p><small><a href="#Contents">Contents</a></small>
20455 <h5><a name="7.25.3.2.1" href="#7.25.3.2.1">7.25.3.2.1 The towctrans function</a></h5>
20456 <p><b>Synopsis</b>
20457 <p><a name="7.25.3.2.1p1" href="#7.25.3.2.1p1"><small>1</small></a>
20458 <pre>
20459 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20460 wint_t towctrans(wint_t wc, wctrans_t desc);
20461 </pre>
20462 <p><b>Description</b>
20463 <p><a name="7.25.3.2.1p2" href="#7.25.3.2.1p2"><small>2</small></a>
20464 The towctrans function maps the wide character wc using the mapping described by
20465 desc. The current setting of the LC_CTYPE category shall be the same as during the call
20466 to wctrans that returned the value desc.
20467 <p><a name="7.25.3.2.1p3" href="#7.25.3.2.1p3"><small>3</small></a>
20468 Each of the following expressions behaves the same as the call to the wide character case
20469 mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
20470 <pre>
20471 towctrans(wc, wctrans("tolower")) // towlower(wc)
20472 towctrans(wc, wctrans("toupper")) // towupper(wc)
20473 </pre>
20474 <p><b>Returns</b>
20475 <p><a name="7.25.3.2.1p4" href="#7.25.3.2.1p4"><small>4</small></a>
20476 The towctrans function returns the mapped value of wc using the mapping described
20477 by desc.
20479 <p><small><a href="#Contents">Contents</a></small>
20480 <h5><a name="7.25.3.2.2" href="#7.25.3.2.2">7.25.3.2.2 The wctrans function</a></h5>
20481 <p><b>Synopsis</b>
20482 <p><a name="7.25.3.2.2p1" href="#7.25.3.2.2p1"><small>1</small></a>
20483 <pre>
20484 #include <a href="#7.25">&lt;wctype.h&gt;</a>
20485 wctrans_t wctrans(const char *property);
20486 </pre>
20487 <p><b>Description</b>
20488 <p><a name="7.25.3.2.2p2" href="#7.25.3.2.2p2"><small>2</small></a>
20489 The wctrans function constructs a value with type wctrans_t that describes a
20490 mapping between wide characters identified by the string argument property.
20491 <p><a name="7.25.3.2.2p3" href="#7.25.3.2.2p3"><small>3</small></a>
20492 The strings listed in the description of the towctrans function shall be valid in all
20493 locales as property arguments to the wctrans function.
20494 <p><b>Returns</b>
20495 <p><a name="7.25.3.2.2p4" href="#7.25.3.2.2p4"><small>4</small></a>
20496 If property identifies a valid mapping of wide characters according to the LC_CTYPE
20497 category of the current locale, the wctrans function returns a nonzero value that is valid
20498 as the second argument to the towctrans function; otherwise, it returns zero.
20499 <!--page 413 -->
20501 <p><small><a href="#Contents">Contents</a></small>
20502 <h3><a name="7.26" href="#7.26">7.26 Future library directions</a></h3>
20503 <p><a name="7.26p1" href="#7.26p1"><small>1</small></a>
20504 The following names are grouped under individual headers for convenience. All external
20505 names described below are reserved no matter what headers are included by the program.
20507 <p><small><a href="#Contents">Contents</a></small>
20508 <h4><a name="7.26.1" href="#7.26.1">7.26.1 Complex arithmetic &lt;complex.h&gt;</a></h4>
20509 <p><a name="7.26.1p1" href="#7.26.1p1"><small>1</small></a>
20510 The function names
20511 <pre>
20512 cerf cexpm1 clog2
20513 cerfc clog10 clgamma
20514 cexp2 clog1p ctgamma
20515 </pre>
20516 and the same names suffixed with f or l may be added to the declarations in the
20517 <a href="#7.3">&lt;complex.h&gt;</a> header.
20519 <p><small><a href="#Contents">Contents</a></small>
20520 <h4><a name="7.26.2" href="#7.26.2">7.26.2 Character handling &lt;ctype.h&gt;</a></h4>
20521 <p><a name="7.26.2p1" href="#7.26.2p1"><small>1</small></a>
20522 Function names that begin with either is or to, and a lowercase letter may be added to
20523 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
20525 <p><small><a href="#Contents">Contents</a></small>
20526 <h4><a name="7.26.3" href="#7.26.3">7.26.3 Errors &lt;errno.h&gt;</a></h4>
20527 <p><a name="7.26.3p1" href="#7.26.3p1"><small>1</small></a>
20528 Macros that begin with E and a digit or E and an uppercase letter may be added to the
20529 declarations in the <a href="#7.5">&lt;errno.h&gt;</a> header.
20531 <p><small><a href="#Contents">Contents</a></small>
20532 <h4><a name="7.26.4" href="#7.26.4">7.26.4 Format conversion of integer types &lt;inttypes.h&gt;</a></h4>
20533 <p><a name="7.26.4p1" href="#7.26.4p1"><small>1</small></a>
20534 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
20535 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
20537 <p><small><a href="#Contents">Contents</a></small>
20538 <h4><a name="7.26.5" href="#7.26.5">7.26.5 Localization &lt;locale.h&gt;</a></h4>
20539 <p><a name="7.26.5p1" href="#7.26.5p1"><small>1</small></a>
20540 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
20541 the <a href="#7.11">&lt;locale.h&gt;</a> header.
20543 <p><small><a href="#Contents">Contents</a></small>
20544 <h4><a name="7.26.6" href="#7.26.6">7.26.6 Signal handling &lt;signal.h&gt;</a></h4>
20545 <p><a name="7.26.6p1" href="#7.26.6p1"><small>1</small></a>
20546 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
20547 letter may be added to the definitions in the <a href="#7.14">&lt;signal.h&gt;</a> header.
20549 <p><small><a href="#Contents">Contents</a></small>
20550 <h4><a name="7.26.7" href="#7.26.7">7.26.7 Boolean type and values &lt;stdbool.h&gt;</a></h4>
20551 <p><a name="7.26.7p1" href="#7.26.7p1"><small>1</small></a>
20552 The ability to undefine and perhaps then redefine the macros bool, true, and false is
20553 an obsolescent feature.
20555 <p><small><a href="#Contents">Contents</a></small>
20556 <h4><a name="7.26.8" href="#7.26.8">7.26.8 Integer types &lt;stdint.h&gt;</a></h4>
20557 <p><a name="7.26.8p1" href="#7.26.8p1"><small>1</small></a>
20558 Typedef names beginning with int or uint and ending with _t may be added to the
20559 types defined in the <a href="#7.18">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
20560 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
20561 <a href="#7.18">&lt;stdint.h&gt;</a> header.
20562 <!--page 414 -->
20564 <p><small><a href="#Contents">Contents</a></small>
20565 <h4><a name="7.26.9" href="#7.26.9">7.26.9 Input/output &lt;stdio.h&gt;</a></h4>
20566 <p><a name="7.26.9p1" href="#7.26.9p1"><small>1</small></a>
20567 Lowercase letters may be added to the conversion specifiers and length modifiers in
20568 fprintf and fscanf. Other characters may be used in extensions.
20569 <p><a name="7.26.9p2" href="#7.26.9p2"><small>2</small></a>
20570 The gets function is obsolescent, and is deprecated.
20571 <p><a name="7.26.9p3" href="#7.26.9p3"><small>3</small></a>
20572 The use of ungetc on a binary stream where the file position indicator is zero prior to
20573 the call is an obsolescent feature.
20575 <p><small><a href="#Contents">Contents</a></small>
20576 <h4><a name="7.26.10" href="#7.26.10">7.26.10 General utilities &lt;stdlib.h&gt;</a></h4>
20577 <p><a name="7.26.10p1" href="#7.26.10p1"><small>1</small></a>
20578 Function names that begin with str and a lowercase letter may be added to the
20579 declarations in the <a href="#7.20">&lt;stdlib.h&gt;</a> header.
20581 <p><small><a href="#Contents">Contents</a></small>
20582 <h4><a name="7.26.11" href="#7.26.11">7.26.11 String handling &lt;string.h&gt;</a></h4>
20583 <p><a name="7.26.11p1" href="#7.26.11p1"><small>1</small></a>
20584 Function names that begin with str, mem, or wcs and a lowercase letter may be added
20585 to the declarations in the <a href="#7.21">&lt;string.h&gt;</a> header.
20587 <p><small><a href="#Contents">Contents</a></small>
20588 <h4><a name="7.26.12" href="#7.26.12">7.26.12 Extended multibyte and wide character utilities &lt;wchar.h&gt;</a></h4>
20589 <p><a name="7.26.12p1" href="#7.26.12p1"><small>1</small></a>
20590 Function names that begin with wcs and a lowercase letter may be added to the
20591 declarations in the <a href="#7.24">&lt;wchar.h&gt;</a> header.
20592 <p><a name="7.26.12p2" href="#7.26.12p2"><small>2</small></a>
20593 Lowercase letters may be added to the conversion specifiers and length modifiers in
20594 fwprintf and fwscanf. Other characters may be used in extensions.
20596 <p><small><a href="#Contents">Contents</a></small>
20597 <h4><a name="7.26.13" href="#7.26.13">7.26.13 Wide character classification and mapping utilities</a></h4>
20598 <a href="#7.25">&lt;wctype.h&gt;</a>
20599 <p><a name="7.26.13p1" href="#7.26.13p1"><small>1</small></a>
20600 Function names that begin with is or to and a lowercase letter may be added to the
20601 declarations in the <a href="#7.25">&lt;wctype.h&gt;</a> header.
20602 <!--page 415 -->
20604 <p><small><a href="#Contents">Contents</a></small>
20605 <h2><a name="A" href="#A">Annex A</a></h2>
20606 <pre>
20607 (informative)
20608 Language syntax summary
20609 </pre>
20610 <p><a name="Ap1" href="#Ap1"><small>1</small></a>
20611 NOTE The notation is described in <a href="#6.1">6.1</a>.
20614 <p><small><a href="#Contents">Contents</a></small>
20615 <h3><a name="A.1" href="#A.1">A.1 Lexical grammar</a></h3>
20617 <p><small><a href="#Contents">Contents</a></small>
20618 <h4><a name="A.1.1" href="#A.1.1">A.1.1 Lexical elements</a></h4>
20619 (<a href="#6.4">6.4</a>) token:
20620 <pre>
20621 keyword
20622 identifier
20623 constant
20624 string-literal
20625 punctuator
20626 </pre>
20627 (<a href="#6.4">6.4</a>) preprocessing-token:
20628 <pre>
20629 header-name
20630 identifier
20631 pp-number
20632 character-constant
20633 string-literal
20634 punctuator
20635 each non-white-space character that cannot be one of the above
20636 </pre>
20638 <p><small><a href="#Contents">Contents</a></small>
20639 <h4><a name="A.1.2" href="#A.1.2">A.1.2 Keywords</a></h4>
20640 (<a href="#6.4.1">6.4.1</a>) keyword: one of
20641 <!--page 416 -->
20642 <pre>
20643 auto enum restrict unsigned
20644 break extern return void
20645 case float short volatile
20646 char for signed while
20647 const goto sizeof _Bool
20648 continue if static _Complex
20649 default inline struct _Imaginary
20650 do int switch
20651 double long typedef
20652 else register union
20653 </pre>
20655 <p><small><a href="#Contents">Contents</a></small>
20656 <h4><a name="A.1.3" href="#A.1.3">A.1.3 Identifiers</a></h4>
20657 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
20658 <pre>
20659 identifier-nondigit
20660 identifier identifier-nondigit
20661 identifier digit
20662 </pre>
20663 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
20664 <pre>
20665 nondigit
20666 universal-character-name
20667 other implementation-defined characters
20668 </pre>
20669 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
20670 <pre>
20671 _ a b c d e f g h i j k l m
20672 n o p q r s t u v w x y z
20673 A B C D E F G H I J K L M
20674 N O P Q R S T U V W X Y Z
20675 </pre>
20676 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
20677 <pre>
20678 0 1 2 3 4 5 6 7 8 9
20679 </pre>
20681 <p><small><a href="#Contents">Contents</a></small>
20682 <h4><a name="A.1.4" href="#A.1.4">A.1.4 Universal character names</a></h4>
20683 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
20684 <pre>
20685 \u hex-quad
20686 \U hex-quad hex-quad
20687 </pre>
20688 (<a href="#6.4.3">6.4.3</a>) hex-quad:
20689 <pre>
20690 hexadecimal-digit hexadecimal-digit
20691 hexadecimal-digit hexadecimal-digit
20692 </pre>
20694 <p><small><a href="#Contents">Contents</a></small>
20695 <h4><a name="A.1.5" href="#A.1.5">A.1.5 Constants</a></h4>
20696 (<a href="#6.4.4">6.4.4</a>) constant:
20697 <pre>
20698 integer-constant
20699 floating-constant
20700 enumeration-constant
20701 character-constant
20702 </pre>
20703 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
20704 <pre>
20705 decimal-constant integer-suffix<sub>opt</sub>
20706 octal-constant integer-suffix<sub>opt</sub>
20707 hexadecimal-constant integer-suffix<sub>opt</sub>
20708 </pre>
20709 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
20710 <!--page 417 -->
20711 <pre>
20712 nonzero-digit
20713 decimal-constant digit
20714 </pre>
20715 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
20716 <pre>
20718 octal-constant octal-digit
20719 </pre>
20720 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
20721 <pre>
20722 hexadecimal-prefix hexadecimal-digit
20723 hexadecimal-constant hexadecimal-digit
20724 </pre>
20725 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
20726 <pre>
20727 0x 0X
20728 </pre>
20729 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
20730 <pre>
20731 1 2 3 4 5 6 7 8 9
20732 </pre>
20733 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
20734 <pre>
20735 0 1 2 3 4 5 6 7
20736 </pre>
20737 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
20738 <pre>
20739 0 1 2 3 4 5 6 7 8 9
20740 a b c d e f
20741 A B C D E F
20742 </pre>
20743 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
20744 <pre>
20745 unsigned-suffix long-suffix<sub>opt</sub>
20746 unsigned-suffix long-long-suffix
20747 long-suffix unsigned-suffix<sub>opt</sub>
20748 long-long-suffix unsigned-suffix<sub>opt</sub>
20749 </pre>
20750 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
20751 <pre>
20753 </pre>
20754 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
20755 <pre>
20757 </pre>
20758 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
20759 <pre>
20760 ll LL
20761 </pre>
20762 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
20763 <pre>
20764 decimal-floating-constant
20765 hexadecimal-floating-constant
20766 </pre>
20767 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
20768 <!--page 418 -->
20769 <pre>
20770 fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
20771 digit-sequence exponent-part floating-suffix<sub>opt</sub>
20772 </pre>
20773 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
20774 <pre>
20775 hexadecimal-prefix hexadecimal-fractional-constant
20776 binary-exponent-part floating-suffix<sub>opt</sub>
20777 hexadecimal-prefix hexadecimal-digit-sequence
20778 binary-exponent-part floating-suffix<sub>opt</sub>
20779 </pre>
20780 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
20781 <pre>
20782 digit-sequence<sub>opt</sub> . digit-sequence
20783 digit-sequence .
20784 </pre>
20785 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
20786 <pre>
20787 e sign<sub>opt</sub> digit-sequence
20788 E sign<sub>opt</sub> digit-sequence
20789 </pre>
20790 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
20791 <pre>
20793 </pre>
20794 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
20795 <pre>
20796 digit
20797 digit-sequence digit
20798 </pre>
20799 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
20800 <pre>
20801 hexadecimal-digit-sequence<sub>opt</sub> .
20802 hexadecimal-digit-sequence
20803 hexadecimal-digit-sequence .
20804 </pre>
20805 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
20806 <pre>
20807 p sign<sub>opt</sub> digit-sequence
20808 P sign<sub>opt</sub> digit-sequence
20809 </pre>
20810 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
20811 <pre>
20812 hexadecimal-digit
20813 hexadecimal-digit-sequence hexadecimal-digit
20814 </pre>
20815 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
20816 <pre>
20817 f l F L
20818 </pre>
20819 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
20820 <pre>
20821 identifier
20822 </pre>
20823 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
20824 <!--page 419 -->
20825 <pre>
20826 ' c-char-sequence '
20827 L' c-char-sequence '
20828 </pre>
20829 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
20830 <pre>
20831 c-char
20832 c-char-sequence c-char
20833 </pre>
20834 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
20835 <pre>
20836 any member of the source character set except
20837 the single-quote ', backslash \, or new-line character
20838 escape-sequence
20839 </pre>
20840 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
20841 <pre>
20842 simple-escape-sequence
20843 octal-escape-sequence
20844 hexadecimal-escape-sequence
20845 universal-character-name
20846 </pre>
20847 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
20848 <pre>
20849 \' \" \? \\
20850 \a \b \f \n \r \t \v
20851 </pre>
20852 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
20853 <pre>
20854 \ octal-digit
20855 \ octal-digit octal-digit
20856 \ octal-digit octal-digit octal-digit
20857 </pre>
20858 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
20859 <pre>
20860 \x hexadecimal-digit
20861 hexadecimal-escape-sequence hexadecimal-digit
20862 </pre>
20864 <p><small><a href="#Contents">Contents</a></small>
20865 <h4><a name="A.1.6" href="#A.1.6">A.1.6 String literals</a></h4>
20866 (<a href="#6.4.5">6.4.5</a>) string-literal:
20867 <pre>
20868 " s-char-sequence<sub>opt</sub> "
20869 L" s-char-sequence<sub>opt</sub> "
20870 </pre>
20871 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
20872 <pre>
20873 s-char
20874 s-char-sequence s-char
20875 </pre>
20876 (<a href="#6.4.5">6.4.5</a>) s-char:
20877 <!--page 420 -->
20878 <pre>
20879 any member of the source character set except
20880 the double-quote ", backslash \, or new-line character
20881 escape-sequence
20882 </pre>
20884 <p><small><a href="#Contents">Contents</a></small>
20885 <h4><a name="A.1.7" href="#A.1.7">A.1.7 Punctuators</a></h4>
20886 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
20887 <pre>
20888 [ ] ( ) { } . -&gt;
20889 ++ -- &amp; * + - ~ !
20890 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
20891 ? : ; ...
20892 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
20893 , # ##
20894 &lt;: :&gt; &lt;% %&gt; %: %:%:
20895 </pre>
20897 <p><small><a href="#Contents">Contents</a></small>
20898 <h4><a name="A.1.8" href="#A.1.8">A.1.8 Header names</a></h4>
20899 (<a href="#6.4.7">6.4.7</a>) header-name:
20900 <pre>
20901 &lt; h-char-sequence &gt;
20902 " q-char-sequence "
20903 </pre>
20904 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
20905 <pre>
20906 h-char
20907 h-char-sequence h-char
20908 </pre>
20909 (<a href="#6.4.7">6.4.7</a>) h-char:
20910 <pre>
20911 any member of the source character set except
20912 the new-line character and &gt;
20913 </pre>
20914 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
20915 <pre>
20916 q-char
20917 q-char-sequence q-char
20918 </pre>
20919 (<a href="#6.4.7">6.4.7</a>) q-char:
20920 <pre>
20921 any member of the source character set except
20922 the new-line character and "
20923 </pre>
20925 <p><small><a href="#Contents">Contents</a></small>
20926 <h4><a name="A.1.9" href="#A.1.9">A.1.9 Preprocessing numbers</a></h4>
20927 (<a href="#6.4.8">6.4.8</a>) pp-number:
20928 <!--page 421 -->
20929 <pre>
20930 digit
20931 . digit
20932 pp-number digit
20933 pp-number identifier-nondigit
20934 pp-number e sign
20935 pp-number E sign
20936 pp-number p sign
20937 pp-number P sign
20938 pp-number .
20939 </pre>
20941 <p><small><a href="#Contents">Contents</a></small>
20942 <h3><a name="A.2" href="#A.2">A.2 Phrase structure grammar</a></h3>
20944 <p><small><a href="#Contents">Contents</a></small>
20945 <h4><a name="A.2.1" href="#A.2.1">A.2.1 Expressions</a></h4>
20946 (<a href="#6.5.1">6.5.1</a>) primary-expression:
20947 <pre>
20948 identifier
20949 constant
20950 string-literal
20951 ( expression )
20952 </pre>
20953 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
20954 <pre>
20955 primary-expression
20956 postfix-expression [ expression ]
20957 postfix-expression ( argument-expression-list<sub>opt</sub> )
20958 postfix-expression . identifier
20959 postfix-expression -&gt; identifier
20960 postfix-expression ++
20961 postfix-expression --
20962 ( type-name ) { initializer-list }
20963 ( type-name ) { initializer-list , }
20964 </pre>
20965 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
20966 <pre>
20967 assignment-expression
20968 argument-expression-list , assignment-expression
20969 </pre>
20970 (<a href="#6.5.3">6.5.3</a>) unary-expression:
20971 <pre>
20972 postfix-expression
20973 ++ unary-expression
20974 -- unary-expression
20975 unary-operator cast-expression
20976 sizeof unary-expression
20977 sizeof ( type-name )
20978 </pre>
20979 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
20980 <pre>
20981 &amp; * + - ~ !
20982 </pre>
20983 (<a href="#6.5.4">6.5.4</a>) cast-expression:
20984 <pre>
20985 unary-expression
20986 ( type-name ) cast-expression
20987 </pre>
20988 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
20989 <!--page 422 -->
20990 <pre>
20991 cast-expression
20992 multiplicative-expression * cast-expression
20993 multiplicative-expression / cast-expression
20994 multiplicative-expression % cast-expression
20995 </pre>
20996 (<a href="#6.5.6">6.5.6</a>) additive-expression:
20997 <pre>
20998 multiplicative-expression
20999 additive-expression + multiplicative-expression
21000 additive-expression - multiplicative-expression
21001 </pre>
21002 (<a href="#6.5.7">6.5.7</a>) shift-expression:
21003 <pre>
21004 additive-expression
21005 shift-expression &lt;&lt; additive-expression
21006 shift-expression &gt;&gt; additive-expression
21007 </pre>
21008 (<a href="#6.5.8">6.5.8</a>) relational-expression:
21009 <pre>
21010 shift-expression
21011 relational-expression &lt; shift-expression
21012 relational-expression &gt; shift-expression
21013 relational-expression &lt;= shift-expression
21014 relational-expression &gt;= shift-expression
21015 </pre>
21016 (<a href="#6.5.9">6.5.9</a>) equality-expression:
21017 <pre>
21018 relational-expression
21019 equality-expression == relational-expression
21020 equality-expression != relational-expression
21021 </pre>
21022 (<a href="#6.5.10">6.5.10</a>) AND-expression:
21023 <pre>
21024 equality-expression
21025 AND-expression &amp; equality-expression
21026 </pre>
21027 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
21028 <pre>
21029 AND-expression
21030 exclusive-OR-expression ^ AND-expression
21031 </pre>
21032 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
21033 <pre>
21034 exclusive-OR-expression
21035 inclusive-OR-expression | exclusive-OR-expression
21036 </pre>
21037 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
21038 <pre>
21039 inclusive-OR-expression
21040 logical-AND-expression &amp;&amp; inclusive-OR-expression
21041 </pre>
21042 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
21043 <pre>
21044 logical-AND-expression
21045 logical-OR-expression || logical-AND-expression
21046 </pre>
21047 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
21048 <!--page 423 -->
21049 <pre>
21050 logical-OR-expression
21051 logical-OR-expression ? expression : conditional-expression
21052 </pre>
21053 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
21054 <pre>
21055 conditional-expression
21056 unary-expression assignment-operator assignment-expression
21057 </pre>
21058 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
21059 <pre>
21060 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
21061 </pre>
21062 (<a href="#6.5.17">6.5.17</a>) expression:
21063 <pre>
21064 assignment-expression
21065 expression , assignment-expression
21066 </pre>
21067 (<a href="#6.6">6.6</a>) constant-expression:
21068 <pre>
21069 conditional-expression
21070 </pre>
21072 <p><small><a href="#Contents">Contents</a></small>
21073 <h4><a name="A.2.2" href="#A.2.2">A.2.2 Declarations</a></h4>
21074 (<a href="#6.7">6.7</a>) declaration:
21075 <pre>
21076 declaration-specifiers init-declarator-list<sub>opt</sub> ;
21077 </pre>
21078 (<a href="#6.7">6.7</a>) declaration-specifiers:
21079 <pre>
21080 storage-class-specifier declaration-specifiers<sub>opt</sub>
21081 type-specifier declaration-specifiers<sub>opt</sub>
21082 type-qualifier declaration-specifiers<sub>opt</sub>
21083 function-specifier declaration-specifiers<sub>opt</sub>
21084 </pre>
21085 (<a href="#6.7">6.7</a>) init-declarator-list:
21086 <pre>
21087 init-declarator
21088 init-declarator-list , init-declarator
21089 </pre>
21090 (<a href="#6.7">6.7</a>) init-declarator:
21091 <pre>
21092 declarator
21093 declarator = initializer
21094 </pre>
21095 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
21096 <!--page 424 -->
21097 <pre>
21098 typedef
21099 extern
21100 static
21101 auto
21102 register
21103 </pre>
21104 (<a href="#6.7.2">6.7.2</a>) type-specifier:
21105 <pre>
21106 void
21107 char
21108 short
21110 long
21111 float
21112 double
21113 signed
21114 unsigned
21115 _Bool
21116 _Complex
21117 struct-or-union-specifier *
21118 enum-specifier
21119 typedef-name
21120 </pre>
21121 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
21122 <pre>
21123 struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
21124 struct-or-union identifier
21125 </pre>
21126 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
21127 <pre>
21128 struct
21129 union
21130 </pre>
21131 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
21132 <pre>
21133 struct-declaration
21134 struct-declaration-list struct-declaration
21135 </pre>
21136 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
21137 <pre>
21138 specifier-qualifier-list struct-declarator-list ;
21139 </pre>
21140 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
21141 <pre>
21142 type-specifier specifier-qualifier-list<sub>opt</sub>
21143 type-qualifier specifier-qualifier-list<sub>opt</sub>
21144 </pre>
21145 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
21146 <pre>
21147 struct-declarator
21148 struct-declarator-list , struct-declarator
21149 </pre>
21150 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
21151 <!--page 425 -->
21152 <pre>
21153 declarator
21154 declarator<sub>opt</sub> : constant-expression
21155 </pre>
21156 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
21157 <pre>
21158 enum identifier<sub>opt</sub> { enumerator-list }
21159 enum identifier<sub>opt</sub> { enumerator-list , }
21160 enum identifier
21161 </pre>
21162 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
21163 <pre>
21164 enumerator
21165 enumerator-list , enumerator
21166 </pre>
21167 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
21168 <pre>
21169 enumeration-constant
21170 enumeration-constant = constant-expression
21171 </pre>
21172 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
21173 <pre>
21174 const
21175 restrict
21176 volatile
21177 </pre>
21178 (<a href="#6.7.4">6.7.4</a>) function-specifier:
21179 <pre>
21180 inline
21181 </pre>
21182 (<a href="#6.7.5">6.7.5</a>) declarator:
21183 <pre>
21184 pointer<sub>opt</sub> direct-declarator
21185 </pre>
21186 (<a href="#6.7.5">6.7.5</a>) direct-declarator:
21187 <pre>
21188 identifier
21189 ( declarator )
21190 direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
21191 direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
21192 direct-declarator [ type-qualifier-list static assignment-expression ]
21193 direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
21194 direct-declarator ( parameter-type-list )
21195 direct-declarator ( identifier-list<sub>opt</sub> )
21196 </pre>
21197 (<a href="#6.7.5">6.7.5</a>) pointer:
21198 <pre>
21199 * type-qualifier-list<sub>opt</sub>
21200 * type-qualifier-list<sub>opt</sub> pointer
21201 </pre>
21202 (<a href="#6.7.5">6.7.5</a>) type-qualifier-list:
21203 <pre>
21204 type-qualifier
21205 type-qualifier-list type-qualifier
21206 </pre>
21207 (<a href="#6.7.5">6.7.5</a>) parameter-type-list:
21208 <!--page 426 -->
21209 <pre>
21210 parameter-list
21211 parameter-list , ...
21212 </pre>
21213 (<a href="#6.7.5">6.7.5</a>) parameter-list:
21214 <pre>
21215 parameter-declaration
21216 parameter-list , parameter-declaration
21217 </pre>
21218 (<a href="#6.7.5">6.7.5</a>) parameter-declaration:
21219 <pre>
21220 declaration-specifiers declarator
21221 declaration-specifiers abstract-declarator<sub>opt</sub>
21222 </pre>
21223 (<a href="#6.7.5">6.7.5</a>) identifier-list:
21224 <pre>
21225 identifier
21226 identifier-list , identifier
21227 </pre>
21228 (<a href="#6.7.6">6.7.6</a>) type-name:
21229 <pre>
21230 specifier-qualifier-list abstract-declarator<sub>opt</sub>
21231 </pre>
21232 (<a href="#6.7.6">6.7.6</a>) abstract-declarator:
21233 <pre>
21234 pointer
21235 pointer<sub>opt</sub> direct-abstract-declarator
21236 </pre>
21237 (<a href="#6.7.6">6.7.6</a>) direct-abstract-declarator:
21238 <pre>
21239 ( abstract-declarator )
21240 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
21241 assignment-expression<sub>opt</sub> ]
21242 direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
21243 assignment-expression ]
21244 direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
21245 assignment-expression ]
21246 direct-abstract-declarator<sub>opt</sub> [ * ]
21247 direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )
21248 </pre>
21249 (<a href="#6.7.7">6.7.7</a>) typedef-name:
21250 <pre>
21251 identifier
21252 </pre>
21253 (<a href="#6.7.8">6.7.8</a>) initializer:
21254 <pre>
21255 assignment-expression
21256 { initializer-list }
21257 { initializer-list , }
21258 </pre>
21259 (<a href="#6.7.8">6.7.8</a>) initializer-list:
21260 <pre>
21261 designation<sub>opt</sub> initializer
21262 initializer-list , designation<sub>opt</sub> initializer
21263 </pre>
21264 (<a href="#6.7.8">6.7.8</a>) designation:
21265 <!--page 427 -->
21266 <pre>
21267 designator-list =
21268 </pre>
21269 (<a href="#6.7.8">6.7.8</a>) designator-list:
21270 <pre>
21271 designator
21272 designator-list designator
21273 </pre>
21274 (<a href="#6.7.8">6.7.8</a>) designator:
21275 <pre>
21276 [ constant-expression ]
21277 . identifier
21278 </pre>
21280 <p><small><a href="#Contents">Contents</a></small>
21281 <h4><a name="A.2.3" href="#A.2.3">A.2.3 Statements</a></h4>
21282 (<a href="#6.8">6.8</a>) statement:
21283 <pre>
21284 labeled-statement
21285 compound-statement
21286 expression-statement
21287 selection-statement
21288 iteration-statement
21289 jump-statement
21290 </pre>
21291 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
21292 <pre>
21293 identifier : statement
21294 case constant-expression : statement
21295 default : statement
21296 </pre>
21297 (<a href="#6.8.2">6.8.2</a>) compound-statement:
21298 <pre>
21299 { block-item-list<sub>opt</sub> }
21300 </pre>
21301 (<a href="#6.8.2">6.8.2</a>) block-item-list:
21302 <pre>
21303 block-item
21304 block-item-list block-item
21305 </pre>
21306 (<a href="#6.8.2">6.8.2</a>) block-item:
21307 <pre>
21308 declaration
21309 statement
21310 </pre>
21311 (<a href="#6.8.3">6.8.3</a>) expression-statement:
21312 <pre>
21313 expression<sub>opt</sub> ;
21314 </pre>
21315 (<a href="#6.8.4">6.8.4</a>) selection-statement:
21316 <!--page 428 -->
21317 <pre>
21318 if ( expression ) statement
21319 if ( expression ) statement else statement
21320 switch ( expression ) statement
21321 </pre>
21322 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
21323 <pre>
21324 while ( expression ) statement
21325 do statement while ( expression ) ;
21326 for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
21327 for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
21328 </pre>
21329 (<a href="#6.8.6">6.8.6</a>) jump-statement:
21330 <pre>
21331 goto identifier ;
21332 continue ;
21333 break ;
21334 return expression<sub>opt</sub> ;
21335 </pre>
21337 <p><small><a href="#Contents">Contents</a></small>
21338 <h4><a name="A.2.4" href="#A.2.4">A.2.4 External definitions</a></h4>
21339 (<a href="#6.9">6.9</a>) translation-unit:
21340 <pre>
21341 external-declaration
21342 translation-unit external-declaration
21343 </pre>
21344 (<a href="#6.9">6.9</a>) external-declaration:
21345 <pre>
21346 function-definition
21347 declaration
21348 </pre>
21349 (<a href="#6.9.1">6.9.1</a>) function-definition:
21350 <pre>
21351 declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
21352 </pre>
21353 (<a href="#6.9.1">6.9.1</a>) declaration-list:
21354 <pre>
21355 declaration
21356 declaration-list declaration
21357 </pre>
21359 <p><small><a href="#Contents">Contents</a></small>
21360 <h3><a name="A.3" href="#A.3">A.3 Preprocessing directives</a></h3>
21361 (<a href="#6.10">6.10</a>) preprocessing-file:
21362 <pre>
21363 group<sub>opt</sub>
21364 </pre>
21365 (<a href="#6.10">6.10</a>) group:
21366 <pre>
21367 group-part
21368 group group-part
21369 </pre>
21370 (<a href="#6.10">6.10</a>) group-part:
21371 <pre>
21372 if-section
21373 control-line
21374 text-line
21375 # non-directive
21376 </pre>
21377 (<a href="#6.10">6.10</a>) if-section:
21378 <!--page 429 -->
21379 <pre>
21380 if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
21381 </pre>
21382 (<a href="#6.10">6.10</a>) if-group:
21383 <pre>
21384 # if constant-expression new-line group<sub>opt</sub>
21385 # ifdef identifier new-line group<sub>opt</sub>
21386 # ifndef identifier new-line group<sub>opt</sub>
21387 </pre>
21388 (<a href="#6.10">6.10</a>) elif-groups:
21389 <pre>
21390 elif-group
21391 elif-groups elif-group
21392 </pre>
21393 (<a href="#6.10">6.10</a>) elif-group:
21394 <pre>
21395 # elif constant-expression new-line group<sub>opt</sub>
21396 </pre>
21397 (<a href="#6.10">6.10</a>) else-group:
21398 <pre>
21399 # else new-line group<sub>opt</sub>
21400 </pre>
21401 (<a href="#6.10">6.10</a>) endif-line:
21402 <pre>
21403 # endif new-line
21404 </pre>
21405 (<a href="#6.10">6.10</a>) control-line:
21406 <pre>
21407 # include pp-tokens new-line
21408 # define identifier replacement-list new-line
21409 # define identifier lparen identifier-list<sub>opt</sub> )
21410 replacement-list new-line
21411 # define identifier lparen ... ) replacement-list new-line
21412 # define identifier lparen identifier-list , ... )
21413 replacement-list new-line
21414 # undef identifier new-line
21415 # line pp-tokens new-line
21416 # error pp-tokens<sub>opt</sub> new-line
21417 # pragma pp-tokens<sub>opt</sub> new-line
21418 # new-line
21419 </pre>
21420 (<a href="#6.10">6.10</a>) text-line:
21421 <pre>
21422 pp-tokens<sub>opt</sub> new-line
21423 </pre>
21424 (<a href="#6.10">6.10</a>) non-directive:
21425 <pre>
21426 pp-tokens new-line
21427 </pre>
21428 (<a href="#6.10">6.10</a>) lparen:
21429 <pre>
21430 a ( character not immediately preceded by white-space
21431 </pre>
21432 (<a href="#6.10">6.10</a>) replacement-list:
21433 <!--page 430 -->
21434 <pre>
21435 pp-tokens<sub>opt</sub>
21436 </pre>
21437 (<a href="#6.10">6.10</a>) pp-tokens:
21438 <pre>
21439 preprocessing-token
21440 pp-tokens preprocessing-token
21441 </pre>
21442 (<a href="#6.10">6.10</a>) new-line:
21443 <!--page 431 -->
21444 <pre>
21445 the new-line character
21446 </pre>
21448 <p><small><a href="#Contents">Contents</a></small>
21449 <h2><a name="B" href="#B">Annex B</a></h2>
21450 <pre>
21451 (informative)
21452 Library summary
21453 </pre>
21455 <p><small><a href="#Contents">Contents</a></small>
21456 <h3><a name="B.1" href="#B.1">B.1 Diagnostics &lt;assert.h&gt;</a></h3>
21457 <pre>
21458 NDEBUG
21459 void assert(scalar expression);
21460 </pre>
21462 <p><small><a href="#Contents">Contents</a></small>
21463 <h3><a name="B.2" href="#B.2">B.2 Complex &lt;complex.h&gt;</a></h3>
21464 <!--page 432 -->
21465 <!--page 433 -->
21466 <pre>
21467 complex imaginary I
21468 _Complex_I _Imaginary_I
21469 #pragma STDC CX_LIMITED_RANGE on-off-switch
21470 double complex cacos(double complex z);
21471 float complex cacosf(float complex z);
21472 long double complex cacosl(long double complex z);
21473 double complex casin(double complex z);
21474 float complex casinf(float complex z);
21475 long double complex casinl(long double complex z);
21476 double complex catan(double complex z);
21477 float complex catanf(float complex z);
21478 long double complex catanl(long double complex z);
21479 double complex ccos(double complex z);
21480 float complex ccosf(float complex z);
21481 long double complex ccosl(long double complex z);
21482 double complex csin(double complex z);
21483 float complex csinf(float complex z);
21484 long double complex csinl(long double complex z);
21485 double complex ctan(double complex z);
21486 float complex ctanf(float complex z);
21487 long double complex ctanl(long double complex z);
21488 double complex cacosh(double complex z);
21489 float complex cacoshf(float complex z);
21490 long double complex cacoshl(long double complex z);
21491 double complex casinh(double complex z);
21492 float complex casinhf(float complex z);
21493 long double complex casinhl(long double complex z);
21494 double complex catanh(double complex z);
21495 float complex catanhf(float complex z);
21496 long double complex catanhl(long double complex z);
21497 double complex ccosh(double complex z);
21498 float complex ccoshf(float complex z);
21499 long double complex ccoshl(long double complex z);
21500 double complex csinh(double complex z);
21501 float complex csinhf(float complex z);
21502 long double complex csinhl(long double complex z);
21503 double complex ctanh(double complex z);
21504 float complex ctanhf(float complex z);
21505 long double complex ctanhl(long double complex z);
21506 double complex cexp(double complex z);
21507 float complex cexpf(float complex z);
21508 long double complex cexpl(long double complex z);
21509 double complex clog(double complex z);
21510 float complex clogf(float complex z);
21511 long double complex clogl(long double complex z);
21512 double cabs(double complex z);
21513 float cabsf(float complex z);
21514 long double cabsl(long double complex z);
21515 double complex cpow(double complex x, double complex y);
21516 float complex cpowf(float complex x, float complex y);
21517 long double complex cpowl(long double complex x,
21518 long double complex y);
21519 double complex csqrt(double complex z);
21520 float complex csqrtf(float complex z);
21521 long double complex csqrtl(long double complex z);
21522 double carg(double complex z);
21523 float cargf(float complex z);
21524 long double cargl(long double complex z);
21525 double cimag(double complex z);
21526 float cimagf(float complex z);
21527 long double cimagl(long double complex z);
21528 double complex conj(double complex z);
21529 float complex conjf(float complex z);
21530 long double complex conjl(long double complex z);
21531 double complex cproj(double complex z);
21532 float complex cprojf(float complex z);
21533 long double complex cprojl(long double complex z);
21534 double creal(double complex z);
21535 float crealf(float complex z);
21536 long double creall(long double complex z);
21537 </pre>
21539 <p><small><a href="#Contents">Contents</a></small>
21540 <h3><a name="B.3" href="#B.3">B.3 Character handling &lt;ctype.h&gt;</a></h3>
21541 <pre>
21542 int isalnum(int c);
21543 int isalpha(int c);
21544 int isblank(int c);
21545 int iscntrl(int c);
21546 int isdigit(int c);
21547 int isgraph(int c);
21548 int islower(int c);
21549 int isprint(int c);
21550 int ispunct(int c);
21551 int isspace(int c);
21552 int isupper(int c);
21553 int isxdigit(int c);
21554 int tolower(int c);
21555 int toupper(int c);
21556 </pre>
21558 <p><small><a href="#Contents">Contents</a></small>
21559 <h3><a name="B.4" href="#B.4">B.4 Errors &lt;errno.h&gt;</a></h3>
21560 <pre>
21561 EDOM EILSEQ ERANGE errno
21562 </pre>
21564 <p><small><a href="#Contents">Contents</a></small>
21565 <h3><a name="B.5" href="#B.5">B.5 Floating-point environment &lt;fenv.h&gt;</a></h3>
21566 <!--page 434 -->
21567 <pre>
21568 fenv_t FE_OVERFLOW FE_TOWARDZERO
21569 fexcept_t FE_UNDERFLOW FE_UPWARD
21570 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
21571 FE_INEXACT FE_DOWNWARD
21572 FE_INVALID FE_TONEAREST
21573 #pragma STDC FENV_ACCESS on-off-switch
21574 int feclearexcept(int excepts);
21575 int fegetexceptflag(fexcept_t *flagp, int excepts);
21576 int feraiseexcept(int excepts);
21577 int fesetexceptflag(const fexcept_t *flagp,
21578 int excepts);
21579 int fetestexcept(int excepts);
21580 int fegetround(void);
21581 int fesetround(int round);
21582 int fegetenv(fenv_t *envp);
21583 int feholdexcept(fenv_t *envp);
21584 int fesetenv(const fenv_t *envp);
21585 int feupdateenv(const fenv_t *envp);
21586 </pre>
21588 <p><small><a href="#Contents">Contents</a></small>
21589 <h3><a name="B.6" href="#B.6">B.6 Characteristics of floating types &lt;float.h&gt;</a></h3>
21590 <pre>
21591 FLT_ROUNDS DBL_MIN_EXP FLT_MAX
21592 FLT_EVAL_METHOD LDBL_MIN_EXP DBL_MAX
21593 FLT_RADIX FLT_MIN_10_EXP LDBL_MAX
21594 FLT_MANT_DIG DBL_MIN_10_EXP FLT_EPSILON
21595 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_EPSILON
21596 LDBL_MANT_DIG FLT_MAX_EXP LDBL_EPSILON
21597 DECIMAL_DIG DBL_MAX_EXP FLT_MIN
21598 FLT_DIG LDBL_MAX_EXP DBL_MIN
21599 DBL_DIG FLT_MAX_10_EXP LDBL_MIN
21600 LDBL_DIG DBL_MAX_10_EXP
21601 FLT_MIN_EXP LDBL_MAX_10_EXP
21602 </pre>
21604 <p><small><a href="#Contents">Contents</a></small>
21605 <h3><a name="B.7" href="#B.7">B.7 Format conversion of integer types &lt;inttypes.h&gt;</a></h3>
21606 <!--page 435 -->
21607 <pre>
21608 imaxdiv_t
21609 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
21610 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
21611 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
21612 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
21613 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
21614 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
21615 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
21616 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
21617 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
21618 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
21619 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
21620 intmax_t imaxabs(intmax_t j);
21621 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
21622 intmax_t strtoimax(const char * restrict nptr,
21623 char ** restrict endptr, int base);
21624 uintmax_t strtoumax(const char * restrict nptr,
21625 char ** restrict endptr, int base);
21626 intmax_t wcstoimax(const wchar_t * restrict nptr,
21627 wchar_t ** restrict endptr, int base);
21628 uintmax_t wcstoumax(const wchar_t * restrict nptr,
21629 wchar_t ** restrict endptr, int base);
21630 </pre>
21632 <p><small><a href="#Contents">Contents</a></small>
21633 <h3><a name="B.8" href="#B.8">B.8 Alternative spellings &lt;iso646.h&gt;</a></h3>
21634 <pre>
21635 and bitor not_eq xor
21636 and_eq compl or xor_eq
21637 bitand not or_eq
21638 </pre>
21640 <p><small><a href="#Contents">Contents</a></small>
21641 <h3><a name="B.9" href="#B.9">B.9 Sizes of integer types &lt;limits.h&gt;</a></h3>
21642 <pre>
21643 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
21644 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
21645 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
21646 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
21647 CHAR_MIN USHRT_MAX LONG_MAX
21648 </pre>
21650 <p><small><a href="#Contents">Contents</a></small>
21651 <h3><a name="B.10" href="#B.10">B.10 Localization &lt;locale.h&gt;</a></h3>
21652 <pre>
21653 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
21654 NULL LC_COLLATE LC_MONETARY LC_TIME
21655 char *setlocale(int category, const char *locale);
21656 struct lconv *localeconv(void);
21657 </pre>
21659 <p><small><a href="#Contents">Contents</a></small>
21660 <h3><a name="B.11" href="#B.11">B.11 Mathematics &lt;math.h&gt;</a></h3>
21661 <!--page 436 -->
21662 <!--page 437 -->
21663 <!--page 438 -->
21664 <!--page 439 -->
21665 <!--page 440 -->
21666 <pre>
21667 float_t FP_INFINITE FP_FAST_FMAL
21668 double_t FP_NAN FP_ILOGB0
21669 HUGE_VAL FP_NORMAL FP_ILOGBNAN
21670 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
21671 HUGE_VALL FP_ZERO MATH_ERREXCEPT
21672 INFINITY FP_FAST_FMA math_errhandling
21673 NAN FP_FAST_FMAF
21674 #pragma STDC FP_CONTRACT on-off-switch
21675 int fpclassify(real-floating x);
21676 int isfinite(real-floating x);
21677 int isinf(real-floating x);
21678 int isnan(real-floating x);
21679 int isnormal(real-floating x);
21680 int signbit(real-floating x);
21681 double acos(double x);
21682 float acosf(float x);
21683 long double acosl(long double x);
21684 double asin(double x);
21685 float asinf(float x);
21686 long double asinl(long double x);
21687 double atan(double x);
21688 float atanf(float x);
21689 long double atanl(long double x);
21690 double atan2(double y, double x);
21691 float atan2f(float y, float x);
21692 long double atan2l(long double y, long double x);
21693 double cos(double x);
21694 float cosf(float x);
21695 long double cosl(long double x);
21696 double sin(double x);
21697 float sinf(float x);
21698 long double sinl(long double x);
21699 double tan(double x);
21700 float tanf(float x);
21701 long double tanl(long double x);
21702 double acosh(double x);
21703 float acoshf(float x);
21704 long double acoshl(long double x);
21705 double asinh(double x);
21706 float asinhf(float x);
21707 long double asinhl(long double x);
21708 double atanh(double x);
21709 float atanhf(float x);
21710 long double atanhl(long double x);
21711 double cosh(double x);
21712 float coshf(float x);
21713 long double coshl(long double x);
21714 double sinh(double x);
21715 float sinhf(float x);
21716 long double sinhl(long double x);
21717 double tanh(double x);
21718 float tanhf(float x);
21719 long double tanhl(long double x);
21720 double exp(double x);
21721 float expf(float x);
21722 long double expl(long double x);
21723 double exp2(double x);
21724 float exp2f(float x);
21725 long double exp2l(long double x);
21726 double expm1(double x);
21727 float expm1f(float x);
21728 long double expm1l(long double x);
21729 double frexp(double value, int *exp);
21730 float frexpf(float value, int *exp);
21731 long double frexpl(long double value, int *exp);
21732 int ilogb(double x);
21733 int ilogbf(float x);
21734 int ilogbl(long double x);
21735 double ldexp(double x, int exp);
21736 float ldexpf(float x, int exp);
21737 long double ldexpl(long double x, int exp);
21738 double log(double x);
21739 float logf(float x);
21740 long double logl(long double x);
21741 double log10(double x);
21742 float log10f(float x);
21743 long double log10l(long double x);
21744 double log1p(double x);
21745 float log1pf(float x);
21746 long double log1pl(long double x);
21747 double log2(double x);
21748 float log2f(float x);
21749 long double log2l(long double x);
21750 double logb(double x);
21751 float logbf(float x);
21752 long double logbl(long double x);
21753 double modf(double value, double *iptr);
21754 float modff(float value, float *iptr);
21755 long double modfl(long double value, long double *iptr);
21756 double scalbn(double x, int n);
21757 float scalbnf(float x, int n);
21758 long double scalbnl(long double x, int n);
21759 double scalbln(double x, long int n);
21760 float scalblnf(float x, long int n);
21761 long double scalblnl(long double x, long int n);
21762 double cbrt(double x);
21763 float cbrtf(float x);
21764 long double cbrtl(long double x);
21765 double fabs(double x);
21766 float fabsf(float x);
21767 long double fabsl(long double x);
21768 double hypot(double x, double y);
21769 float hypotf(float x, float y);
21770 long double hypotl(long double x, long double y);
21771 double pow(double x, double y);
21772 float powf(float x, float y);
21773 long double powl(long double x, long double y);
21774 double sqrt(double x);
21775 float sqrtf(float x);
21776 long double sqrtl(long double x);
21777 double erf(double x);
21778 float erff(float x);
21779 long double erfl(long double x);
21780 double erfc(double x);
21781 float erfcf(float x);
21782 long double erfcl(long double x);
21783 double lgamma(double x);
21784 float lgammaf(float x);
21785 long double lgammal(long double x);
21786 double tgamma(double x);
21787 float tgammaf(float x);
21788 long double tgammal(long double x);
21789 double ceil(double x);
21790 float ceilf(float x);
21791 long double ceill(long double x);
21792 double floor(double x);
21793 float floorf(float x);
21794 long double floorl(long double x);
21795 double nearbyint(double x);
21796 float nearbyintf(float x);
21797 long double nearbyintl(long double x);
21798 double rint(double x);
21799 float rintf(float x);
21800 long double rintl(long double x);
21801 long int lrint(double x);
21802 long int lrintf(float x);
21803 long int lrintl(long double x);
21804 long long int llrint(double x);
21805 long long int llrintf(float x);
21806 long long int llrintl(long double x);
21807 double round(double x);
21808 float roundf(float x);
21809 long double roundl(long double x);
21810 long int lround(double x);
21811 long int lroundf(float x);
21812 long int lroundl(long double x);
21813 long long int llround(double x);
21814 long long int llroundf(float x);
21815 long long int llroundl(long double x);
21816 double trunc(double x);
21817 float truncf(float x);
21818 long double truncl(long double x);
21819 double fmod(double x, double y);
21820 float fmodf(float x, float y);
21821 long double fmodl(long double x, long double y);
21822 double remainder(double x, double y);
21823 float remainderf(float x, float y);
21824 long double remainderl(long double x, long double y);
21825 double remquo(double x, double y, int *quo);
21826 float remquof(float x, float y, int *quo);
21827 long double remquol(long double x, long double y,
21828 int *quo);
21829 double copysign(double x, double y);
21830 float copysignf(float x, float y);
21831 long double copysignl(long double x, long double y);
21832 double nan(const char *tagp);
21833 float nanf(const char *tagp);
21834 long double nanl(const char *tagp);
21835 double nextafter(double x, double y);
21836 float nextafterf(float x, float y);
21837 long double nextafterl(long double x, long double y);
21838 double nexttoward(double x, long double y);
21839 float nexttowardf(float x, long double y);
21840 long double nexttowardl(long double x, long double y);
21841 double fdim(double x, double y);
21842 float fdimf(float x, float y);
21843 long double fdiml(long double x, long double y);
21844 double fmax(double x, double y);
21845 float fmaxf(float x, float y);
21846 long double fmaxl(long double x, long double y);
21847 double fmin(double x, double y);
21848 float fminf(float x, float y);
21849 long double fminl(long double x, long double y);
21850 double fma(double x, double y, double z);
21851 float fmaf(float x, float y, float z);
21852 long double fmal(long double x, long double y,
21853 long double z);
21854 int isgreater(real-floating x, real-floating y);
21855 int isgreaterequal(real-floating x, real-floating y);
21856 int isless(real-floating x, real-floating y);
21857 int islessequal(real-floating x, real-floating y);
21858 int islessgreater(real-floating x, real-floating y);
21859 int isunordered(real-floating x, real-floating y);
21860 </pre>
21862 <p><small><a href="#Contents">Contents</a></small>
21863 <h3><a name="B.12" href="#B.12">B.12 Nonlocal jumps &lt;setjmp.h&gt;</a></h3>
21864 <pre>
21865 jmp_buf
21866 int setjmp(jmp_buf env);
21867 void longjmp(jmp_buf env, int val);
21868 </pre>
21870 <p><small><a href="#Contents">Contents</a></small>
21871 <h3><a name="B.13" href="#B.13">B.13 Signal handling &lt;signal.h&gt;</a></h3>
21872 <pre>
21873 sig_atomic_t SIG_IGN SIGILL SIGTERM
21874 SIG_DFL SIGABRT SIGINT
21875 SIG_ERR SIGFPE SIGSEGV
21876 void (*signal(int sig, void (*func)(int)))(int);
21877 int raise(int sig);
21878 </pre>
21880 <p><small><a href="#Contents">Contents</a></small>
21881 <h3><a name="B.14" href="#B.14">B.14 Variable arguments &lt;stdarg.h&gt;</a></h3>
21882 <pre>
21883 va_list
21884 type va_arg(va_list ap, type);
21885 void va_copy(va_list dest, va_list src);
21886 void va_end(va_list ap);
21887 void va_start(va_list ap, parmN);
21888 </pre>
21890 <p><small><a href="#Contents">Contents</a></small>
21891 <h3><a name="B.15" href="#B.15">B.15 Boolean type and values &lt;stdbool.h&gt;</a></h3>
21892 <!--page 441 -->
21893 <pre>
21894 bool
21895 true
21896 false
21897 __bool_true_false_are_defined
21898 </pre>
21900 <p><small><a href="#Contents">Contents</a></small>
21901 <h3><a name="B.16" href="#B.16">B.16 Common definitions &lt;stddef.h&gt;</a></h3>
21902 <pre>
21903 ptrdiff_t size_t wchar_t NULL
21904 offsetof(type, member-designator)
21905 </pre>
21907 <p><small><a href="#Contents">Contents</a></small>
21908 <h3><a name="B.17" href="#B.17">B.17 Integer types &lt;stdint.h&gt;</a></h3>
21909 <pre>
21910 intN_t INT_LEASTN_MIN PTRDIFF_MAX
21911 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
21912 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
21913 uint_leastN_t INT_FASTN_MIN SIZE_MAX
21914 int_fastN_t INT_FASTN_MAX WCHAR_MIN
21915 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
21916 intptr_t INTPTR_MIN WINT_MIN
21917 uintptr_t INTPTR_MAX WINT_MAX
21918 intmax_t UINTPTR_MAX INTN_C(value)
21919 uintmax_t INTMAX_MIN UINTN_C(value)
21920 INTN_MIN INTMAX_MAX INTMAX_C(value)
21921 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
21922 UINTN_MAX PTRDIFF_MIN
21923 </pre>
21925 <p><small><a href="#Contents">Contents</a></small>
21926 <h3><a name="B.18" href="#B.18">B.18 Input/output &lt;stdio.h&gt;</a></h3>
21927 <!--page 442 -->
21928 <!--page 443 -->
21929 <pre>
21930 size_t _IOLBF FILENAME_MAX TMP_MAX
21931 FILE _IONBF L_tmpnam stderr
21932 fpos_t BUFSIZ SEEK_CUR stdin
21933 NULL EOF SEEK_END stdout
21934 _IOFBF FOPEN_MAX SEEK_SET
21935 int remove(const char *filename);
21936 int rename(const char *old, const char *new);
21937 FILE *tmpfile(void);
21938 char *tmpnam(char *s);
21939 int fclose(FILE *stream);
21940 int fflush(FILE *stream);
21941 FILE *fopen(const char * restrict filename,
21942 const char * restrict mode);
21943 FILE *freopen(const char * restrict filename,
21944 const char * restrict mode,
21945 FILE * restrict stream);
21946 void setbuf(FILE * restrict stream,
21947 char * restrict buf);
21948 int setvbuf(FILE * restrict stream,
21949 char * restrict buf,
21950 int mode, size_t size);
21951 int fprintf(FILE * restrict stream,
21952 const char * restrict format, ...);
21953 int fscanf(FILE * restrict stream,
21954 const char * restrict format, ...);
21955 int printf(const char * restrict format, ...);
21956 int scanf(const char * restrict format, ...);
21957 int snprintf(char * restrict s, size_t n,
21958 const char * restrict format, ...);
21959 int sprintf(char * restrict s,
21960 const char * restrict format, ...);
21961 int sscanf(const char * restrict s,
21962 const char * restrict format, ...);
21963 int vfprintf(FILE * restrict stream,
21964 const char * restrict format, va_list arg);
21965 int vfscanf(FILE * restrict stream,
21966 const char * restrict format, va_list arg);
21967 int vprintf(const char * restrict format, va_list arg);
21968 int vscanf(const char * restrict format, va_list arg);
21969 int vsnprintf(char * restrict s, size_t n,
21970 const char * restrict format, va_list arg);
21971 int vsprintf(char * restrict s,
21972 const char * restrict format, va_list arg);
21973 int vsscanf(const char * restrict s,
21974 const char * restrict format, va_list arg);
21975 int fgetc(FILE *stream);
21976 char *fgets(char * restrict s, int n,
21977 FILE * restrict stream);
21978 int fputc(int c, FILE *stream);
21979 int fputs(const char * restrict s,
21980 FILE * restrict stream);
21981 int getc(FILE *stream);
21982 int getchar(void);
21983 char *gets(char *s);
21984 int putc(int c, FILE *stream);
21985 int putchar(int c);
21986 int puts(const char *s);
21987 int ungetc(int c, FILE *stream);
21988 size_t fread(void * restrict ptr,
21989 size_t size, size_t nmemb,
21990 FILE * restrict stream);
21991 size_t fwrite(const void * restrict ptr,
21992 size_t size, size_t nmemb,
21993 FILE * restrict stream);
21994 int fgetpos(FILE * restrict stream,
21995 fpos_t * restrict pos);
21996 int fseek(FILE *stream, long int offset, int whence);
21997 int fsetpos(FILE *stream, const fpos_t *pos);
21998 long int ftell(FILE *stream);
21999 void rewind(FILE *stream);
22000 void clearerr(FILE *stream);
22001 int feof(FILE *stream);
22002 int ferror(FILE *stream);
22003 void perror(const char *s);
22004 </pre>
22006 <p><small><a href="#Contents">Contents</a></small>
22007 <h3><a name="B.19" href="#B.19">B.19 General utilities &lt;stdlib.h&gt;</a></h3>
22008 <!--page 444 -->
22009 <!--page 445 -->
22010 <pre>
22011 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
22012 wchar_t lldiv_t EXIT_SUCCESS
22013 div_t NULL RAND_MAX
22014 double atof(const char *nptr);
22015 int atoi(const char *nptr);
22016 long int atol(const char *nptr);
22017 long long int atoll(const char *nptr);
22018 double strtod(const char * restrict nptr,
22019 char ** restrict endptr);
22020 float strtof(const char * restrict nptr,
22021 char ** restrict endptr);
22022 long double strtold(const char * restrict nptr,
22023 char ** restrict endptr);
22024 long int strtol(const char * restrict nptr,
22025 char ** restrict endptr, int base);
22026 long long int strtoll(const char * restrict nptr,
22027 char ** restrict endptr, int base);
22028 unsigned long int strtoul(
22029 const char * restrict nptr,
22030 char ** restrict endptr, int base);
22031 unsigned long long int strtoull(
22032 const char * restrict nptr,
22033 char ** restrict endptr, int base);
22034 int rand(void);
22035 void srand(unsigned int seed);
22036 void *calloc(size_t nmemb, size_t size);
22037 void free(void *ptr);
22038 void *malloc(size_t size);
22039 void *realloc(void *ptr, size_t size);
22040 void abort(void);
22041 int atexit(void (*func)(void));
22042 void exit(int status);
22043 void _Exit(int status);
22044 char *getenv(const char *name);
22045 int system(const char *string);
22046 void *bsearch(const void *key, const void *base,
22047 size_t nmemb, size_t size,
22048 int (*compar)(const void *, const void *));
22049 void qsort(void *base, size_t nmemb, size_t size,
22050 int (*compar)(const void *, const void *));
22051 int abs(int j);
22052 long int labs(long int j);
22053 long long int llabs(long long int j);
22054 div_t div(int numer, int denom);
22055 ldiv_t ldiv(long int numer, long int denom);
22056 lldiv_t lldiv(long long int numer,
22057 long long int denom);
22058 int mblen(const char *s, size_t n);
22059 int mbtowc(wchar_t * restrict pwc,
22060 const char * restrict s, size_t n);
22061 int wctomb(char *s, wchar_t wchar);
22062 size_t mbstowcs(wchar_t * restrict pwcs,
22063 const char * restrict s, size_t n);
22064 size_t wcstombs(char * restrict s,
22065 const wchar_t * restrict pwcs, size_t n);
22066 </pre>
22068 <p><small><a href="#Contents">Contents</a></small>
22069 <h3><a name="B.20" href="#B.20">B.20 String handling &lt;string.h&gt;</a></h3>
22070 <!--page 446 -->
22071 <pre>
22072 size_t
22073 NULL
22074 void *memcpy(void * restrict s1,
22075 const void * restrict s2, size_t n);
22076 void *memmove(void *s1, const void *s2, size_t n);
22077 char *strcpy(char * restrict s1,
22078 const char * restrict s2);
22079 char *strncpy(char * restrict s1,
22080 const char * restrict s2, size_t n);
22081 char *strcat(char * restrict s1,
22082 const char * restrict s2);
22083 char *strncat(char * restrict s1,
22084 const char * restrict s2, size_t n);
22085 int memcmp(const void *s1, const void *s2, size_t n);
22086 int strcmp(const char *s1, const char *s2);
22087 int strcoll(const char *s1, const char *s2);
22088 int strncmp(const char *s1, const char *s2, size_t n);
22089 size_t strxfrm(char * restrict s1,
22090 const char * restrict s2, size_t n);
22091 void *memchr(const void *s, int c, size_t n);
22092 char *strchr(const char *s, int c);
22093 size_t strcspn(const char *s1, const char *s2);
22094 char *strpbrk(const char *s1, const char *s2);
22095 char *strrchr(const char *s, int c);
22096 size_t strspn(const char *s1, const char *s2);
22097 char *strstr(const char *s1, const char *s2);
22098 char *strtok(char * restrict s1,
22099 const char * restrict s2);
22100 void *memset(void *s, int c, size_t n);
22101 char *strerror(int errnum);
22102 size_t strlen(const char *s);
22103 </pre>
22105 <p><small><a href="#Contents">Contents</a></small>
22106 <h3><a name="B.21" href="#B.21">B.21 Type-generic math &lt;tgmath.h&gt;</a></h3>
22107 <pre>
22108 acos sqrt fmod nextafter
22109 asin fabs frexp nexttoward
22110 atan atan2 hypot remainder
22111 acosh cbrt ilogb remquo
22112 asinh ceil ldexp rint
22113 atanh copysign lgamma round
22114 cos erf llrint scalbn
22115 sin erfc llround scalbln
22116 tan exp2 log10 tgamma
22117 cosh expm1 log1p trunc
22118 sinh fdim log2 carg
22119 tanh floor logb cimag
22120 exp fma lrint conj
22121 log fmax lround cproj
22122 pow fmin nearbyint creal
22123 </pre>
22125 <p><small><a href="#Contents">Contents</a></small>
22126 <h3><a name="B.22" href="#B.22">B.22 Date and time &lt;time.h&gt;</a></h3>
22127 <!--page 447 -->
22128 <pre>
22129 NULL size_t time_t
22130 CLOCKS_PER_SEC clock_t struct tm
22131 clock_t clock(void);
22132 double difftime(time_t time1, time_t time0);
22133 time_t mktime(struct tm *timeptr);
22134 time_t time(time_t *timer);
22135 char *asctime(const struct tm *timeptr);
22136 char *ctime(const time_t *timer);
22137 struct tm *gmtime(const time_t *timer);
22138 struct tm *localtime(const time_t *timer);
22139 size_t strftime(char * restrict s,
22140 size_t maxsize,
22141 const char * restrict format,
22142 const struct tm * restrict timeptr);
22143 </pre>
22145 <p><small><a href="#Contents">Contents</a></small>
22146 <h3><a name="B.23" href="#B.23">B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt;</a></h3>
22147 <!--page 448 -->
22148 <!--page 449 -->
22149 <pre>
22150 wchar_t wint_t WCHAR_MAX
22151 size_t struct tm WCHAR_MIN
22152 mbstate_t NULL WEOF
22153 int fwprintf(FILE * restrict stream,
22154 const wchar_t * restrict format, ...);
22155 int fwscanf(FILE * restrict stream,
22156 const wchar_t * restrict format, ...);
22157 int swprintf(wchar_t * restrict s, size_t n,
22158 const wchar_t * restrict format, ...);
22159 int swscanf(const wchar_t * restrict s,
22160 const wchar_t * restrict format, ...);
22161 int vfwprintf(FILE * restrict stream,
22162 const wchar_t * restrict format, va_list arg);
22163 int vfwscanf(FILE * restrict stream,
22164 const wchar_t * restrict format, va_list arg);
22165 int vswprintf(wchar_t * restrict s, size_t n,
22166 const wchar_t * restrict format, va_list arg);
22167 int vswscanf(const wchar_t * restrict s,
22168 const wchar_t * restrict format, va_list arg);
22169 int vwprintf(const wchar_t * restrict format,
22170 va_list arg);
22171 int vwscanf(const wchar_t * restrict format,
22172 va_list arg);
22173 int wprintf(const wchar_t * restrict format, ...);
22174 int wscanf(const wchar_t * restrict format, ...);
22175 wint_t fgetwc(FILE *stream);
22176 wchar_t *fgetws(wchar_t * restrict s, int n,
22177 FILE * restrict stream);
22178 wint_t fputwc(wchar_t c, FILE *stream);
22179 int fputws(const wchar_t * restrict s,
22180 FILE * restrict stream);
22181 int fwide(FILE *stream, int mode);
22182 wint_t getwc(FILE *stream);
22183 wint_t getwchar(void);
22184 wint_t putwc(wchar_t c, FILE *stream);
22185 wint_t putwchar(wchar_t c);
22186 wint_t ungetwc(wint_t c, FILE *stream);
22187 double wcstod(const wchar_t * restrict nptr,
22188 wchar_t ** restrict endptr);
22189 float wcstof(const wchar_t * restrict nptr,
22190 wchar_t ** restrict endptr);
22191 long double wcstold(const wchar_t * restrict nptr,
22192 wchar_t ** restrict endptr);
22193 long int wcstol(const wchar_t * restrict nptr,
22194 wchar_t ** restrict endptr, int base);
22195 long long int wcstoll(const wchar_t * restrict nptr,
22196 wchar_t ** restrict endptr, int base);
22197 unsigned long int wcstoul(const wchar_t * restrict nptr,
22198 wchar_t ** restrict endptr, int base);
22199 unsigned long long int wcstoull(
22200 const wchar_t * restrict nptr,
22201 wchar_t ** restrict endptr, int base);
22202 wchar_t *wcscpy(wchar_t * restrict s1,
22203 const wchar_t * restrict s2);
22204 wchar_t *wcsncpy(wchar_t * restrict s1,
22205 const wchar_t * restrict s2, size_t n);
22206 wchar_t *wmemcpy(wchar_t * restrict s1,
22207 const wchar_t * restrict s2, size_t n);
22208 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
22209 size_t n);
22210 wchar_t *wcscat(wchar_t * restrict s1,
22211 const wchar_t * restrict s2);
22212 wchar_t *wcsncat(wchar_t * restrict s1,
22213 const wchar_t * restrict s2, size_t n);
22214 int wcscmp(const wchar_t *s1, const wchar_t *s2);
22215 int wcscoll(const wchar_t *s1, const wchar_t *s2);
22216 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
22217 size_t n);
22218 size_t wcsxfrm(wchar_t * restrict s1,
22219 const wchar_t * restrict s2, size_t n);
22220 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
22221 size_t n);
22222 wchar_t *wcschr(const wchar_t *s, wchar_t c);
22223 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
22224 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); *
22225 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
22226 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
22227 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
22228 wchar_t *wcstok(wchar_t * restrict s1,
22229 const wchar_t * restrict s2,
22230 wchar_t ** restrict ptr);
22231 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
22232 size_t wcslen(const wchar_t *s);
22233 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
22234 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
22235 const wchar_t * restrict format,
22236 const struct tm * restrict timeptr);
22237 wint_t btowc(int c);
22238 int wctob(wint_t c);
22239 int mbsinit(const mbstate_t *ps);
22240 size_t mbrlen(const char * restrict s, size_t n,
22241 mbstate_t * restrict ps);
22242 size_t mbrtowc(wchar_t * restrict pwc,
22243 const char * restrict s, size_t n,
22244 mbstate_t * restrict ps);
22245 size_t wcrtomb(char * restrict s, wchar_t wc,
22246 mbstate_t * restrict ps);
22247 size_t mbsrtowcs(wchar_t * restrict dst,
22248 const char ** restrict src, size_t len,
22249 mbstate_t * restrict ps);
22250 size_t wcsrtombs(char * restrict dst,
22251 const wchar_t ** restrict src, size_t len,
22252 mbstate_t * restrict ps);
22253 </pre>
22255 <p><small><a href="#Contents">Contents</a></small>
22256 <h3><a name="B.24" href="#B.24">B.24 Wide character classification and mapping utilities &lt;wctype.h&gt;</a></h3>
22257 <!--page 450 -->
22258 <!--page 451 -->
22259 <pre>
22260 wint_t wctrans_t wctype_t WEOF
22261 int iswalnum(wint_t wc);
22262 int iswalpha(wint_t wc);
22263 int iswblank(wint_t wc);
22264 int iswcntrl(wint_t wc);
22265 int iswdigit(wint_t wc);
22266 int iswgraph(wint_t wc);
22267 int iswlower(wint_t wc);
22268 int iswprint(wint_t wc);
22269 int iswpunct(wint_t wc);
22270 int iswspace(wint_t wc);
22271 int iswupper(wint_t wc);
22272 int iswxdigit(wint_t wc);
22273 int iswctype(wint_t wc, wctype_t desc);
22274 wctype_t wctype(const char *property);
22275 wint_t towlower(wint_t wc);
22276 wint_t towupper(wint_t wc);
22277 wint_t towctrans(wint_t wc, wctrans_t desc);
22278 wctrans_t wctrans(const char *property);
22279 </pre>
22281 <p><small><a href="#Contents">Contents</a></small>
22282 <h2><a name="C" href="#C">Annex C</a></h2>
22283 <pre>
22284 (informative)
22285 Sequence points
22286 </pre>
22287 <p><a name="Cp1" href="#Cp1"><small>1</small></a>
22288 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
22289 <ul>
22290 <li> The call to a function, after the arguments have been evaluated (<a href="#6.5.2.2">6.5.2.2</a>).
22291 <li> The end of the first operand of the following operators: logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>);
22292 logical OR || (<a href="#6.5.14">6.5.14</a>); conditional ? (<a href="#6.5.15">6.5.15</a>); comma , (<a href="#6.5.17">6.5.17</a>).
22293 <li> The end of a full declarator: declarators (<a href="#6.7.5">6.7.5</a>);
22294 <li> The end of a full expression: an initializer (<a href="#6.7.8">6.7.8</a>); the expression in an expression
22295 statement (<a href="#6.8.3">6.8.3</a>); the controlling expression of a selection statement (if or switch)
22296 (<a href="#6.8.4">6.8.4</a>); the controlling expression of a while or do statement (<a href="#6.8.5">6.8.5</a>); each of the
22297 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the expression in a return statement
22298 (<a href="#6.8.6.4">6.8.6.4</a>).
22299 <li> Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
22300 <li> After the actions associated with each formatted input/output function conversion
22301 specifier (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
22302 <li> Immediately before and immediately after each call to a comparison function, and
22303 also between any call to a comparison function and any movement of the objects
22304 passed as arguments to that call (<a href="#7.20.5">7.20.5</a>).
22305 <!--page 452 -->
22306 </ul>
22308 <p><small><a href="#Contents">Contents</a></small>
22309 <h2><a name="D" href="#D">Annex D</a></h2>
22310 <pre>
22311 (normative)
22312 Universal character names for identifiers
22313 </pre>
22314 <p><a name="Dp1" href="#Dp1"><small>1</small></a>
22315 This clause lists the hexadecimal code values that are valid in universal character names
22316 in identifiers.
22317 <p><a name="Dp2" href="#Dp2"><small>2</small></a>
22318 This table is reproduced unchanged from ISO/IEC TR 10176:1998, produced by ISO/IEC
22319 JTC 1/SC 22/WG 20, except for the omission of ranges that are part of the basic character
22320 sets.
22321 <table border=1>
22322 <tr><td> Latin: <td> 00AA, 00BA, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217,
22323 0250-02A8, 1E00-1E9B, 1EA0-1EF9, 207F
22324 <tr><td> Greek: <td> 0386, 0388-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6,
22325 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 1F00-1F15, 1F18-1F1D,
22326 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D,
22327 1F5F-1F7D, 1F80-1FB4, 1FB6-1FBC, 1FC2-1FC4, 1FC6-1FCC,
22328 1FD0-1FD3, 1FD6-1FDB, 1FE0-1FEC, 1FF2-1FF4, 1FF6-1FFC
22329 <tr><td> Cyrillic: <td> 0401-040C, 040E-044F, 0451-045C, 045E-0481, 0490-04C4,
22330 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9
22331 <tr><td> Armenian: <td> 0531-0556, 0561-0587
22332 <tr><td> Hebrew: <td> 05B0-05B9, 05BB-05BD, 05BF, 05C1-05C2, 05D0-05EA,
22333 05F0-05F2
22334 <tr><td> Arabic: <td> 0621-063A, 0640-0652, 0670-06B7, 06BA-06BE, 06C0-06CE,
22335 06D0-06DC, 06E5-06E8, 06EA-06ED
22336 <tr><td> Devanagari:<td> 0901-0903, 0905-0939, 093E-094D, 0950-0952, 0958-0963
22337 <tr><td> Bengali: <td> 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0,
22338 09B2, 09B6-09B9, 09BE-09C4, 09C7-09C8, 09CB-09CD,
22339 09DC-09DD, 09DF-09E3, 09F0-09F1
22340 <tr><td> Gurmukhi: <td> 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30,
22341 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3E-0A42, 0A47-0A48,
22342 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A74
22343 <tr><td> Gujarati: <td> 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8,
22344 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABD-0AC5,
22345 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0
22346 <tr><td> Oriya: <td> 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
22347 <!--page 453 -->
22348 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
22349 0B5C-0B5D, 0B5F-0B61
22350 <tr><td> Tamil: <td> 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
22351 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5,
22352 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD
22353 <tr><td> Telugu: <td> 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33,
22354 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C60-0C61
22355 <tr><td> Kannada: <td> 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3,
22356 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CDE,
22357 0CE0-0CE1
22358 <tr><td> Malayalam: <td> 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39,
22359 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D60-0D61
22360 <tr><td> Thai: <td> 0E01-0E3A, 0E40-0E5B
22361 <tr><td> Lao: <td> 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97,
22362 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB,
22363 0EAD-0EAE, 0EB0-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6,
22364 0EC8-0ECD, 0EDC-0EDD
22365 <tr><td> Tibetan: <td> 0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 0F49-0F69,
22366 0F71-0F84, 0F86-0F8B, 0F90-0F95, 0F97, 0F99-0FAD,
22367 0FB1-0FB7, 0FB9
22368 <tr><td> Georgian: <td> 10A0-10C5, 10D0-10F6
22369 <tr><td> Hiragana: <td> 3041-3093, 309B-309C
22370 <tr><td> Katakana: <td> 30A1-30F6, 30FB-30FC
22371 <tr><td> Bopomofo: <td> 3105-312C
22372 <tr><td> CJK Unified Ideographs:<td> 4E00-9FA5
22373 <tr><td> Hangul: <td> AC00-D7A3
22374 <tr><td> Digits: <td> 0660-0669, 06F0-06F9, 0966-096F, 09E6-09EF, 0A66-0A6F,
22375 0AE6-0AEF, 0B66-0B6F, 0BE7-0BEF, 0C66-0C6F, 0CE6-0CEF,
22376 0D66-0D6F, 0E50-0E59, 0ED0-0ED9, 0F20-0F33
22377 <tr><td> Special characters:<td> 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1,
22378 <!--page 454 -->
22379 02E0-02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F-2040, 2102,
22380 2107, 210A-2113, 2115, 2118-211D, 2124, 2126, 2128, 212A-2131,
22381 2133-2138, 2160-2182, 3005-3007, 3021-3029
22382 </table>
22384 <p><small><a href="#Contents">Contents</a></small>
22385 <h2><a name="E" href="#E">Annex E</a></h2>
22386 <pre>
22387 (informative)
22388 Implementation limits
22389 </pre>
22390 <p><a name="Ep1" href="#Ep1"><small>1</small></a>
22391 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
22392 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
22393 with the same sign. The values shall all be constant expressions suitable for use in #if
22394 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
22395 <pre>
22396 #define CHAR_BIT 8
22397 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
22398 #define CHAR_MIN 0 or SCHAR_MIN
22399 #define INT_MAX +32767
22400 #define INT_MIN -32767
22401 #define LONG_MAX +2147483647
22402 #define LONG_MIN -2147483647
22403 #define LLONG_MAX +9223372036854775807
22404 #define LLONG_MIN -9223372036854775807
22405 #define MB_LEN_MAX 1
22406 #define SCHAR_MAX +127
22407 #define SCHAR_MIN -127
22408 #define SHRT_MAX +32767
22409 #define SHRT_MIN -32767
22410 #define UCHAR_MAX 255
22411 #define USHRT_MAX 65535
22412 #define UINT_MAX 65535
22413 #define ULONG_MAX 4294967295
22414 #define ULLONG_MAX 18446744073709551615
22415 </pre>
22416 <p><a name="Ep2" href="#Ep2"><small>2</small></a>
22417 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
22418 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
22419 directives; all floating values shall be constant expressions. The components are
22420 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
22421 <p><a name="Ep3" href="#Ep3"><small>3</small></a>
22422 The values given in the following list shall be replaced by implementation-defined
22423 expressions:
22424 <pre>
22425 #define FLT_EVAL_METHOD
22426 #define FLT_ROUNDS
22427 </pre>
22428 <p><a name="Ep4" href="#Ep4"><small>4</small></a>
22429 The values given in the following list shall be replaced by implementation-defined
22430 constant expressions that are greater or equal in magnitude (absolute value) to those
22431 shown, with the same sign:
22432 <!--page 455 -->
22433 <pre>
22434 #define DBL_DIG 10
22435 #define DBL_MANT_DIG
22436 #define DBL_MAX_10_EXP +37
22437 #define DBL_MAX_EXP
22438 #define DBL_MIN_10_EXP -37
22439 #define DBL_MIN_EXP
22440 #define DECIMAL_DIG 10
22441 #define FLT_DIG 6
22442 #define FLT_MANT_DIG
22443 #define FLT_MAX_10_EXP +37
22444 #define FLT_MAX_EXP
22445 #define FLT_MIN_10_EXP -37
22446 #define FLT_MIN_EXP
22447 #define FLT_RADIX 2
22448 #define LDBL_DIG 10
22449 #define LDBL_MANT_DIG
22450 #define LDBL_MAX_10_EXP +37
22451 #define LDBL_MAX_EXP
22452 #define LDBL_MIN_10_EXP -37
22453 #define LDBL_MIN_EXP
22454 </pre>
22455 <p><a name="Ep5" href="#Ep5"><small>5</small></a>
22456 The values given in the following list shall be replaced by implementation-defined
22457 constant expressions with values that are greater than or equal to those shown:
22458 <pre>
22459 #define DBL_MAX 1E+37
22460 #define FLT_MAX 1E+37
22461 #define LDBL_MAX 1E+37
22462 </pre>
22463 <p><a name="Ep6" href="#Ep6"><small>6</small></a>
22464 The values given in the following list shall be replaced by implementation-defined
22465 constant expressions with (positive) values that are less than or equal to those shown:
22466 <!--page 456 -->
22467 <pre>
22468 #define DBL_EPSILON 1E-9
22469 #define DBL_MIN 1E-37
22470 #define FLT_EPSILON 1E-5
22471 #define FLT_MIN 1E-37
22472 #define LDBL_EPSILON 1E-9
22473 #define LDBL_MIN 1E-37
22474 </pre>
22476 <p><small><a href="#Contents">Contents</a></small>
22477 <h2><a name="F" href="#F">Annex F</a></h2>
22478 <pre>
22479 (normative)
22480 IEC 60559 floating-point arithmetic
22481 </pre>
22483 <p><small><a href="#Contents">Contents</a></small>
22484 <h3><a name="F.1" href="#F.1">F.1 Introduction</a></h3>
22485 <p><a name="F.1p1" href="#F.1p1"><small>1</small></a>
22486 This annex specifies C language support for the IEC 60559 floating-point standard. The
22487 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
22488 microprocessor systems, second edition (IEC 60559:1989), previously designated
22489 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
22490 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
22491 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
22492 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
22493 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
22494 defines __STDC_IEC_559__ shall conform to the specifications in this annex. Where
22495 a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified
22496 behavior is adopted by reference, unless stated otherwise.
22498 <p><small><a href="#Contents">Contents</a></small>
22499 <h3><a name="F.2" href="#F.2">F.2 Types</a></h3>
22500 <p><a name="F.2p1" href="#F.2p1"><small>1</small></a>
22501 The C floating types match the IEC 60559 formats as follows:
22502 <ul>
22503 <li> The float type matches the IEC 60559 single format.
22504 <li> The double type matches the IEC 60559 double format.
22505 <li> The long double type matches an IEC 60559 extended format,<sup><a href="#note307"><b>307)</b></a></sup> else a
22506 non-IEC 60559 extended format, else the IEC 60559 double format.
22507 </ul>
22508 Any non-IEC 60559 extended format used for the long double type shall have more
22509 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note308"><b>308)</b></a></sup>
22510 <p><b>Recommended practice</b>
22511 <p><a name="F.2p2" href="#F.2p2"><small>2</small></a>
22512 The long double type should match an IEC 60559 extended format.
22517 <!--page 457 -->
22519 <p><b>Footnotes</b>
22520 <p><small><a name="note307" href="#note307">307)</a> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
22521 and quadruple 128-bit IEC 60559 formats.
22522 </small>
22523 <p><small><a name="note308" href="#note308">308)</a> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
22524 all double values.
22525 </small>
22527 <p><small><a href="#Contents">Contents</a></small>
22528 <h4><a name="F.2.1" href="#F.2.1">F.2.1 Infinities, signed zeros, and NaNs</a></h4>
22529 <p><a name="F.2.1p1" href="#F.2.1p1"><small>1</small></a>
22530 This specification does not define the behavior of signaling NaNs.<sup><a href="#note309"><b>309)</b></a></sup> It generally uses
22531 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
22532 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
22534 <p><b>Footnotes</b>
22535 <p><small><a name="note309" href="#note309">309)</a> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
22536 sufficient for closure of the arithmetic.
22537 </small>
22539 <p><small><a href="#Contents">Contents</a></small>
22540 <h3><a name="F.3" href="#F.3">F.3 Operators and functions</a></h3>
22541 <p><a name="F.3p1" href="#F.3p1"><small>1</small></a>
22542 C operators and functions provide IEC 60559 required and recommended facilities as
22543 listed below.
22544 <ul>
22545 <li> The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
22546 divide operations.
22547 <li> The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
22548 <li> The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
22549 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
22550 with additional information.
22551 <li> The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
22552 floating-point number to an integer value (in the same precision). The nearbyint
22553 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
22554 Appendix to ANSI/IEEE 854.
22555 <li> The conversions for floating types provide the IEC 60559 conversions between
22556 floating-point precisions.
22557 <li> The conversions from integer to floating types provide the IEC 60559 conversions
22558 from integer to floating point.
22559 <li> The conversions from floating to integer types provide IEC 60559-like conversions
22560 but always round toward zero.
22561 <li> The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
22562 conversions, which honor the directed rounding mode, from floating point to the
22563 long int and long long int integer formats. The lrint and llrint
22564 functions can be used to implement IEC 60559 conversions from floating to other
22565 integer formats.
22566 <li> The translation time conversion of floating constants and the strtod, strtof,
22567 strtold, fprintf, fscanf, and related library functions in <a href="#7.20">&lt;stdlib.h&gt;</a>,
22568 <a href="#7.19">&lt;stdio.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a> provide IEC 60559 binary-decimal conversions. The
22569 strtold function in <a href="#7.20">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
22570 Appendix to ANSI/IEEE 854.
22572 <!--page 458 -->
22573 <li> The relational and equality operators provide IEC 60559 comparisons. IEC 60559
22574 identifies a need for additional comparison predicates to facilitate writing code that
22575 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
22576 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
22577 supplement the language operators to address this need. The islessgreater and
22578 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
22579 the unordered predicate recommended in the Appendix to IEC 60559.
22580 <li> The feclearexcept, feraiseexcept, and fetestexcept functions in
22581 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
22582 exception status flags. The fegetexceptflag and fesetexceptflag
22583 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
22584 one time. These functions are used in conjunction with the type fexcept_t and the
22585 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
22586 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
22587 <li> The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
22588 to select among the IEC 60559 directed rounding modes represented by the rounding
22589 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
22590 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
22591 IEC 60559 directed rounding modes.
22592 <li> The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
22593 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
22594 the IEC 60559 status flags and control modes.
22595 <li> The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
22596 recommended in the Appendix to IEC 60559.
22597 <li> The unary minus (-) operator provides the minus (-) operation recommended in the
22598 Appendix to IEC 60559.
22599 <li> The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
22600 recommended in the Appendix to IEC 60559.
22601 <li> The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
22602 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
22603 <li> The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
22604 function recommended in the Appendix to IEC 60559 (but with a minor change to
22605 better handle signed zeros).
22606 <li> The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
22607 the Appendix to IEC 60559.
22608 <li> The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
22609 Appendix to IEC 60559.
22610 <!--page 459 -->
22611 <li> The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
22612 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
22613 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
22614 function recommended in the Appendix to IEC 60559 (except that the classification
22615 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
22616 </ul>
22618 <p><small><a href="#Contents">Contents</a></small>
22619 <h3><a name="F.4" href="#F.4">F.4 Floating to integer conversion</a></h3>
22620 <p><a name="F.4p1" href="#F.4p1"><small>1</small></a>
22621 If the floating value is infinite or NaN or if the integral part of the floating value exceeds
22622 the range of the integer type, then the ''invalid'' floating-point exception is raised and the
22623 resulting value is unspecified. Whether conversion of non-integer floating values whose
22624 integral part is within the range of the integer type raises the ''inexact'' floating-point
22625 exception is unspecified.<sup><a href="#note310"><b>310)</b></a></sup>
22627 <p><b>Footnotes</b>
22628 <p><small><a name="note310" href="#note310">310)</a> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
22629 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
22630 cases where it matters, library functions can be used to effect such conversions with or without raising
22631 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
22632 <a href="#7.12">&lt;math.h&gt;</a>.
22633 </small>
22635 <p><small><a href="#Contents">Contents</a></small>
22636 <h3><a name="F.5" href="#F.5">F.5 Binary-decimal conversion</a></h3>
22637 <p><a name="F.5p1" href="#F.5p1"><small>1</small></a>
22638 Conversion from the widest supported IEC 60559 format to decimal with
22639 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note311"><b>311)</b></a></sup>
22640 <p><a name="F.5p2" href="#F.5p2"><small>2</small></a>
22641 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
22642 particular, conversion between any supported IEC 60559 format and decimal with
22643 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
22644 rounding mode), which assures that conversion from the widest supported IEC 60559
22645 format to decimal with DECIMAL_DIG digits and back is the identity function.
22646 <p><a name="F.5p3" href="#F.5p3"><small>3</small></a>
22647 Functions such as strtod that convert character sequences to floating types honor the
22648 rounding direction. Hence, if the rounding direction might be upward or downward, the
22649 implementation cannot convert a minus-signed sequence by negating the converted
22650 unsigned sequence.
22655 <!--page 460 -->
22657 <p><b>Footnotes</b>
22658 <p><small><a name="note311" href="#note311">311)</a> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
22659 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
22660 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
22661 DBL_DIG are 18 and 15, respectively, for these formats.)
22662 </small>
22664 <p><small><a href="#Contents">Contents</a></small>
22665 <h3><a name="F.6" href="#F.6">F.6 Contracted expressions</a></h3>
22666 <p><a name="F.6p1" href="#F.6p1"><small>1</small></a>
22667 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
22668 rounding directions in a manner consistent with the basic arithmetic operations covered
22669 by IEC 60559.
22670 <p><b>Recommended practice</b>
22671 <p><a name="F.6p2" href="#F.6p2"><small>2</small></a>
22672 A contracted expression should raise floating-point exceptions in a manner generally
22673 consistent with the basic arithmetic operations. A contracted expression should deliver
22674 the same value as its uncontracted counterpart, else should be correctly rounded (once).
22676 <p><small><a href="#Contents">Contents</a></small>
22677 <h3><a name="F.7" href="#F.7">F.7 Floating-point environment</a></h3>
22678 <p><a name="F.7p1" href="#F.7p1"><small>1</small></a>
22679 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
22680 point exception status flags and directed-rounding control modes. It includes also
22681 IEC 60559 dynamic rounding precision and trap enablement modes, if the
22682 implementation supports them.<sup><a href="#note312"><b>312)</b></a></sup>
22684 <p><b>Footnotes</b>
22685 <p><small><a name="note312" href="#note312">312)</a> This specification does not require dynamic rounding precision nor trap enablement modes.
22686 </small>
22688 <p><small><a href="#Contents">Contents</a></small>
22689 <h4><a name="F.7.1" href="#F.7.1">F.7.1 Environment management</a></h4>
22690 <p><a name="F.7.1p1" href="#F.7.1p1"><small>1</small></a>
22691 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
22692 status flags, and that rounding control modes can be set explicitly to affect result values of
22693 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
22694 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
22695 which respect sequence points.<sup><a href="#note313"><b>313)</b></a></sup>
22697 <p><b>Footnotes</b>
22698 <p><small><a name="note313" href="#note313">313)</a> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
22699 point control modes will be the default ones and the floating-point status flags will not be tested,
22700 which allows certain optimizations (see <a href="#F.8">F.8</a>).
22701 </small>
22703 <p><small><a href="#Contents">Contents</a></small>
22704 <h4><a name="F.7.2" href="#F.7.2">F.7.2 Translation</a></h4>
22705 <p><a name="F.7.2p1" href="#F.7.2p1"><small>1</small></a>
22706 During translation the IEC 60559 default modes are in effect:
22707 <ul>
22708 <li> The rounding direction mode is rounding to nearest.
22709 <li> The rounding precision mode (if supported) is set so that results are not shortened.
22710 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
22711 </ul>
22712 <p><b>Recommended practice</b>
22713 <p><a name="F.7.2p2" href="#F.7.2p2"><small>2</small></a>
22714 The implementation should produce a diagnostic message for each translation-time
22719 <!--page 461 -->
22720 floating-point exception, other than ''inexact'';<sup><a href="#note314"><b>314)</b></a></sup> the implementation should then
22721 proceed with the translation of the program.
22723 <p><b>Footnotes</b>
22724 <p><small><a name="note314" href="#note314">314)</a> As floating constants are converted to appropriate internal representations at translation time, their
22725 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
22726 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
22727 strtod, provide execution-time conversion of numeric strings.
22728 </small>
22730 <p><small><a href="#Contents">Contents</a></small>
22731 <h4><a name="F.7.3" href="#F.7.3">F.7.3 Execution</a></h4>
22732 <p><a name="F.7.3p1" href="#F.7.3p1"><small>1</small></a>
22733 At program startup the floating-point environment is initialized as prescribed by
22734 IEC 60559:
22735 <ul>
22736 <li> All floating-point exception status flags are cleared.
22737 <li> The rounding direction mode is rounding to nearest.
22738 <li> The dynamic rounding precision mode (if supported) is set so that results are not
22739 shortened.
22740 <li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
22741 </ul>
22743 <p><small><a href="#Contents">Contents</a></small>
22744 <h4><a name="F.7.4" href="#F.7.4">F.7.4 Constant expressions</a></h4>
22745 <p><a name="F.7.4p1" href="#F.7.4p1"><small>1</small></a>
22746 An arithmetic constant expression of floating type, other than one in an initializer for an
22747 object that has static storage duration, is evaluated (as if) during execution; thus, it is
22748 affected by any operative floating-point control modes and raises floating-point
22749 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
22750 is ''on'').<sup><a href="#note315"><b>315)</b></a></sup>
22751 <p><a name="F.7.4p2" href="#F.7.4p2"><small>2</small></a>
22752 EXAMPLE
22753 <pre>
22754 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22755 #pragma STDC FENV_ACCESS ON
22756 void f(void)
22758 float w[] = { 0.0/0.0 }; // raises an exception
22759 static float x = 0.0/0.0; // does not raise an exception
22760 float y = 0.0/0.0; // raises an exception
22761 double z = 0.0/0.0; // raises an exception
22762 /* ... */
22764 </pre>
22765 <p><a name="F.7.4p3" href="#F.7.4p3"><small>3</small></a>
22766 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
22767 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
22770 <!--page 462 -->
22771 execution time.
22774 <p><b>Footnotes</b>
22775 <p><small><a name="note315" href="#note315">315)</a> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
22776 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
22777 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
22778 efficiency of translation-time evaluation through static initialization, such as
22780 <pre>
22781 const static double one_third = 1.0/3.0;
22782 </pre>
22783 </small>
22785 <p><small><a href="#Contents">Contents</a></small>
22786 <h4><a name="F.7.5" href="#F.7.5">F.7.5 Initialization</a></h4>
22787 <p><a name="F.7.5p1" href="#F.7.5p1"><small>1</small></a>
22788 All computation for automatic initialization is done (as if) at execution time; thus, it is
22789 affected by any operative modes and raises floating-point exceptions as required by
22790 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
22791 for initialization of objects that have static storage duration is done (as if) at translation
22792 time.
22793 <p><a name="F.7.5p2" href="#F.7.5p2"><small>2</small></a>
22794 EXAMPLE
22795 <pre>
22796 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22797 #pragma STDC FENV_ACCESS ON
22798 void f(void)
22800 float u[] = { 1.1e75 }; // raises exceptions
22801 static float v = 1.1e75; // does not raise exceptions
22802 float w = 1.1e75; // raises exceptions
22803 double x = 1.1e75; // may raise exceptions
22804 float y = 1.1e75f; // may raise exceptions
22805 long double z = 1.1e75; // does not raise exceptions
22806 /* ... */
22808 </pre>
22809 <p><a name="F.7.5p3" href="#F.7.5p3"><small>3</small></a>
22810 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
22811 done at translation time. The automatic initialization of u and w require an execution-time conversion to
22812 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
22813 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
22814 conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note316"><b>316)</b></a></sup> The
22815 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
22816 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
22817 their internal representations occur at translation time in all cases.
22822 <!--page 463 -->
22824 <p><b>Footnotes</b>
22825 <p><small><a name="note316" href="#note316">316)</a> Use of float_t and double_t variables increases the likelihood of translation-time computation.
22826 For example, the automatic initialization
22828 <pre>
22829 double_t x = 1.1e75;
22830 </pre>
22831 could be done at translation time, regardless of the expression evaluation method.
22832 </small>
22834 <p><small><a href="#Contents">Contents</a></small>
22835 <h4><a name="F.7.6" href="#F.7.6">F.7.6 Changing the environment</a></h4>
22836 <p><a name="F.7.6p1" href="#F.7.6p1"><small>1</small></a>
22837 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
22838 change floating-point status flags and control modes just as indicated by their
22839 specifications (including conformance to IEC 60559). They do not change flags or modes
22840 (so as to be detectable by the user) in any other cases.
22841 <p><a name="F.7.6p2" href="#F.7.6p2"><small>2</small></a>
22842 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
22843 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
22844 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
22845 before ''inexact''.
22847 <p><small><a href="#Contents">Contents</a></small>
22848 <h3><a name="F.8" href="#F.8">F.8 Optimization</a></h3>
22849 <p><a name="F.8p1" href="#F.8p1"><small>1</small></a>
22850 This section identifies code transformations that might subvert IEC 60559-specified
22851 behavior, and others that do not.
22853 <p><small><a href="#Contents">Contents</a></small>
22854 <h4><a name="F.8.1" href="#F.8.1">F.8.1 Global transformations</a></h4>
22855 <p><a name="F.8.1p1" href="#F.8.1p1"><small>1</small></a>
22856 Floating-point arithmetic operations and external function calls may entail side effects
22857 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
22858 ''on''. The flags and modes in the floating-point environment may be regarded as global
22859 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
22860 flags.
22861 <p><a name="F.8.1p2" href="#F.8.1p2"><small>2</small></a>
22862 Concern about side effects may inhibit code motion and removal of seemingly useless
22863 code. For example, in
22864 <pre>
22865 #include <a href="#7.6">&lt;fenv.h&gt;</a>
22866 #pragma STDC FENV_ACCESS ON
22867 void f(double x)
22869 /* ... */
22870 for (i = 0; i &lt; n; i++) x + 1;
22871 /* ... */
22873 </pre>
22874 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
22875 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
22876 course these optimizations are valid if the implementation can rule out the nettlesome
22877 cases.)
22878 <p><a name="F.8.1p3" href="#F.8.1p3"><small>3</small></a>
22879 This specification does not require support for trap handlers that maintain information
22880 about the order or count of floating-point exceptions. Therefore, between function calls,
22881 floating-point exceptions need not be precise: the actual order and number of occurrences
22882 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
22883 the preceding loop could be treated as
22884 <!--page 464 -->
22885 <pre>
22886 if (0 &lt; n) x + 1;
22887 </pre>
22889 <p><small><a href="#Contents">Contents</a></small>
22890 <h4><a name="F.8.2" href="#F.8.2">F.8.2 Expression transformations</a></h4>
22891 <p><a name="F.8.2p1" href="#F.8.2p1"><small>1</small></a>
22892 <table border=1>
22893 <tr><td><pre> x / 2 &lt;-&gt; x * 0.5 </pre><td> Although similar transformations involving inexact
22894 constants generally do not yield numerically equivalent
22895 expressions, if the constants are exact then such
22896 transformations can be made on IEC 60559 machines
22897 and others that round perfectly.
22898 <tr><td><pre> 1 * x and x / 1 -&gt; x </pre><td> The expressions 1 * x, x / 1, and x are equivalent
22899 (on IEC 60559 machines, among others).<sup><a href="#note317"><b>317)</b></a></sup>
22900 <tr><td><pre> x / x -&gt; 1.0 </pre><td> The expressions x / x and 1.0 are not equivalent if x
22901 can be zero, infinite, or NaN.
22902 <tr><td><pre> x - y &lt;-&gt; x + (-y) </pre><td> The expressions x - y, x + (-y), and (-y) + x
22903 are equivalent (on IEC 60559 machines, among others).
22904 <tr><td><pre> x - y &lt;-&gt; -(y - x) </pre><td> The expressions x - y and -(y - x) are not
22905 equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the
22906 default rounding direction).<sup><a href="#note318"><b>318)</b></a></sup>
22907 <tr><td><pre> x - x -&gt; 0.0 </pre><td> The expressions x - x and 0.0 are not equivalent if
22908 x is a NaN or infinite.
22909 <tr><td><pre> 0 * x -&gt; 0.0 </pre><td> The expressions 0 * x and 0.0 are not equivalent if
22910 x is a NaN, infinite, or -0.
22911 <tr><td><pre> x + 0 -&gt; x </pre><td> The expressions x + 0 and x are not equivalent if x is
22912 -0, because (-0) + (+0) yields +0 (in the default
22913 rounding direction), not -0.
22914 <tr><td><pre> x - 0 -&gt; x </pre><td> (+0) - (+0) yields -0 when rounding is downward
22915 (toward -(inf)), but +0 otherwise, and (-0) - (+0) always
22916 yields -0; so, if the state of the FENV_ACCESS pragma
22917 is ''off'', promising default rounding, then the
22918 implementation can replace x - 0 by x, even if x
22919 <!--page 465 -->
22920 might be zero.
22921 <tr><td><pre> -x &lt;-&gt; 0 - x </pre><td> The expressions -x and 0 - x are not equivalent if x
22922 is +0, because -(+0) yields -0, but 0 - (+0) yields +0
22923 (unless rounding is downward).
22924 </table>
22926 <p><b>Footnotes</b>
22927 <p><small><a name="note317" href="#note317">317)</a> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
22928 other transformations that remove arithmetic operators.
22929 </small>
22930 <p><small><a name="note318" href="#note318">318)</a> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
22931 Examples include:
22933 <pre>
22934 1/(1/ (+-) (inf)) is (+-) (inf)
22935 </pre>
22938 <pre>
22939 conj(csqrt(z)) is csqrt(conj(z)),
22940 </pre>
22941 for complex z.
22942 </small>
22944 <p><small><a href="#Contents">Contents</a></small>
22945 <h4><a name="F.8.3" href="#F.8.3">F.8.3 Relational operators</a></h4>
22946 <p><a name="F.8.3p1" href="#F.8.3p1"><small>1</small></a>
22947 <table border=1>
22948 <tr><td><pre> x != x -&gt; false </pre><td> The statement x != x is true if x is a NaN.
22949 <tr><td><pre> x == x -&gt; true </pre><td> The statement x == x is false if x is a NaN.
22950 <tr><td><pre> x &lt; y -&gt; isless(x,y) </pre><td> (and similarly for &lt;=, &gt;, &gt;=) Though numerically
22951 equal, these expressions are not equivalent because of
22952 side effects when x or y is a NaN and the state of the
22953 FENV_ACCESS pragma is ''on''. This transformation,
22954 which would be desirable if extra code were required to
22955 cause the ''invalid'' floating-point exception for
22956 unordered cases, could be performed provided the state
22957 of the FENV_ACCESS pragma is ''off''.
22958 </table>
22959 The sense of relational operators shall be maintained. This includes handling unordered
22960 cases as expressed by the source code.
22961 <p><a name="F.8.3p2" href="#F.8.3p2"><small>2</small></a>
22962 EXAMPLE
22963 <pre>
22964 // calls g and raises ''invalid'' if a and b are unordered
22965 if (a &lt; b)
22966 f();
22967 else
22968 g();
22969 </pre>
22970 is not equivalent to
22971 <pre>
22972 // calls f and raises ''invalid'' if a and b are unordered
22973 if (a &gt;= b)
22974 g();
22975 else
22976 f();
22977 </pre>
22978 nor to
22979 <pre>
22980 // calls f without raising ''invalid'' if a and b are unordered
22981 if (isgreaterequal(a,b))
22982 g();
22983 else
22984 f();
22985 </pre>
22986 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
22987 <!--page 466 -->
22988 <pre>
22989 // calls g without raising ''invalid'' if a and b are unordered
22990 if (isless(a,b))
22991 f();
22992 else
22993 g();
22994 </pre>
22995 but is equivalent to
22996 <pre>
22997 if (!(a &lt; b))
22998 g();
22999 else
23000 f();
23001 </pre>
23004 <p><small><a href="#Contents">Contents</a></small>
23005 <h4><a name="F.8.4" href="#F.8.4">F.8.4 Constant arithmetic</a></h4>
23006 <p><a name="F.8.4p1" href="#F.8.4p1"><small>1</small></a>
23007 The implementation shall honor floating-point exceptions raised by execution-time
23008 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.7.4">F.7.4</a>
23009 and <a href="#F.7.5">F.7.5</a>.) An operation on constants that raises no floating-point exception can be
23010 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
23011 further check is required to assure that changing the rounding direction to downward does
23012 not alter the sign of the result,<sup><a href="#note319"><b>319)</b></a></sup> and implementations that support dynamic rounding
23013 precision modes shall assure further that the result of the operation raises no floating-
23014 point exception when converted to the semantic type of the operation.
23016 <p><b>Footnotes</b>
23017 <p><small><a name="note319" href="#note319">319)</a> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
23018 </small>
23020 <p><small><a href="#Contents">Contents</a></small>
23021 <h3><a name="F.9" href="#F.9">F.9 Mathematics &lt;math.h&gt;</a></h3>
23022 <p><a name="F.9p1" href="#F.9p1"><small>1</small></a>
23023 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
23024 for IEC 60559 implementations.
23025 <p><a name="F.9p2" href="#F.9p2"><small>2</small></a>
23026 The Standard C macro HUGE_VAL and its float and long double analogs,
23027 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
23028 infinities.
23029 <p><a name="F.9p3" href="#F.9p3"><small>3</small></a>
23030 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
23031 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
23032 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
23033 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
23034 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
23035 <p><a name="F.9p4" href="#F.9p4"><small>4</small></a>
23036 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
23037 nonzero value.
23038 <p><a name="F.9p5" href="#F.9p5"><small>5</small></a>
23039 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
23040 subsequent subclauses of this annex.
23041 <p><a name="F.9p6" href="#F.9p6"><small>6</small></a>
23042 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
23043 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
23046 <!--page 467 -->
23047 whose magnitude is too large.
23048 <p><a name="F.9p7" href="#F.9p7"><small>7</small></a>
23049 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
23050 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note320"><b>320)</b></a></sup>
23051 <p><a name="F.9p8" href="#F.9p8"><small>8</small></a>
23052 Whether or when library functions raise the ''inexact'' floating-point exception is
23053 unspecified, unless explicitly specified otherwise.
23054 <p><a name="F.9p9" href="#F.9p9"><small>9</small></a>
23055 Whether or when library functions raise an undeserved ''underflow'' floating-point
23056 exception is unspecified.<sup><a href="#note321"><b>321)</b></a></sup> Otherwise, as implied by <a href="#F.7.6">F.7.6</a>, the <a href="#7.12">&lt;math.h&gt;</a> functions do
23057 not raise spurious floating-point exceptions (detectable by the user), other than the
23058 ''inexact'' floating-point exception.
23059 <p><a name="F.9p10" href="#F.9p10"><small>10</small></a>
23060 Whether the functions honor the rounding direction mode is implementation-defined,
23061 unless explicitly specified otherwise.
23062 <p><a name="F.9p11" href="#F.9p11"><small>11</small></a>
23063 Functions with a NaN argument return a NaN result and raise no floating-point exception,
23064 except where stated otherwise.
23065 <p><a name="F.9p12" href="#F.9p12"><small>12</small></a>
23066 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
23067 For families of functions, the specifications apply to all of the functions even though only
23068 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
23069 occurs in both an argument and the result, the result has the same sign as the argument.
23070 <p><b>Recommended practice</b>
23071 <p><a name="F.9p13" href="#F.9p13"><small>13</small></a>
23072 If a function with one or more NaN arguments returns a NaN result, the result should be
23073 the same as one of the NaN arguments (after possible type conversion), except perhaps
23074 for the sign.
23076 <p><b>Footnotes</b>
23077 <p><small><a name="note320" href="#note320">320)</a> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
23078 when the floating-point exception is raised.
23079 </small>
23080 <p><small><a name="note321" href="#note321">321)</a> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
23081 avoiding them would be too costly.
23082 </small>
23084 <p><small><a href="#Contents">Contents</a></small>
23085 <h4><a name="F.9.1" href="#F.9.1">F.9.1 Trigonometric functions</a></h4>
23087 <p><small><a href="#Contents">Contents</a></small>
23088 <h5><a name="F.9.1.1" href="#F.9.1.1">F.9.1.1 The acos functions</a></h5>
23089 <p><a name="F.9.1.1p1" href="#F.9.1.1p1"><small>1</small></a>
23090 <ul>
23091 <li> acos(1) returns +0.
23092 <li> acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
23093 | x | &gt; 1.
23098 <!--page 468 -->
23099 </ul>
23101 <p><small><a href="#Contents">Contents</a></small>
23102 <h5><a name="F.9.1.2" href="#F.9.1.2">F.9.1.2 The asin functions</a></h5>
23103 <p><a name="F.9.1.2p1" href="#F.9.1.2p1"><small>1</small></a>
23104 <ul>
23105 <li> asin((+-)0) returns (+-)0.
23106 <li> asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
23107 | x | &gt; 1.
23108 </ul>
23110 <p><small><a href="#Contents">Contents</a></small>
23111 <h5><a name="F.9.1.3" href="#F.9.1.3">F.9.1.3 The atan functions</a></h5>
23112 <p><a name="F.9.1.3p1" href="#F.9.1.3p1"><small>1</small></a>
23113 <ul>
23114 <li> atan((+-)0) returns (+-)0.
23115 <li> atan((+-)(inf)) returns (+-)pi /2.
23116 </ul>
23118 <p><small><a href="#Contents">Contents</a></small>
23119 <h5><a name="F.9.1.4" href="#F.9.1.4">F.9.1.4 The atan2 functions</a></h5>
23120 <p><a name="F.9.1.4p1" href="#F.9.1.4p1"><small>1</small></a>
23121 <ul>
23122 <li> atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note322"><b>322)</b></a></sup>
23123 <li> atan2((+-)0, +0) returns (+-)0.
23124 <li> atan2((+-)0, x) returns (+-)pi for x &lt; 0.
23125 <li> atan2((+-)0, x) returns (+-)0 for x &gt; 0.
23126 <li> atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
23127 <li> atan2(y, (+-)0) returns pi /2 for y &gt; 0.
23128 <li> atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
23129 <li> atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
23130 <li> atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
23131 <li> atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
23132 <li> atan2((+-)(inf), +(inf)) returns (+-)pi /4.
23133 </ul>
23135 <p><b>Footnotes</b>
23136 <p><small><a name="note322" href="#note322">322)</a> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
23137 the ''divide-by-zero'' floating-point exception.
23138 </small>
23140 <p><small><a href="#Contents">Contents</a></small>
23141 <h5><a name="F.9.1.5" href="#F.9.1.5">F.9.1.5 The cos functions</a></h5>
23142 <p><a name="F.9.1.5p1" href="#F.9.1.5p1"><small>1</small></a>
23143 <ul>
23144 <li> cos((+-)0) returns 1.
23145 <li> cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
23146 </ul>
23148 <p><small><a href="#Contents">Contents</a></small>
23149 <h5><a name="F.9.1.6" href="#F.9.1.6">F.9.1.6 The sin functions</a></h5>
23150 <p><a name="F.9.1.6p1" href="#F.9.1.6p1"><small>1</small></a>
23151 <ul>
23152 <li> sin((+-)0) returns (+-)0.
23153 <li> sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
23158 <!--page 469 -->
23159 </ul>
23161 <p><small><a href="#Contents">Contents</a></small>
23162 <h5><a name="F.9.1.7" href="#F.9.1.7">F.9.1.7 The tan functions</a></h5>
23163 <p><a name="F.9.1.7p1" href="#F.9.1.7p1"><small>1</small></a>
23164 <ul>
23165 <li> tan((+-)0) returns (+-)0.
23166 <li> tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
23167 </ul>
23169 <p><small><a href="#Contents">Contents</a></small>
23170 <h4><a name="F.9.2" href="#F.9.2">F.9.2 Hyperbolic functions</a></h4>
23172 <p><small><a href="#Contents">Contents</a></small>
23173 <h5><a name="F.9.2.1" href="#F.9.2.1">F.9.2.1 The acosh functions</a></h5>
23174 <p><a name="F.9.2.1p1" href="#F.9.2.1p1"><small>1</small></a>
23175 <ul>
23176 <li> acosh(1) returns +0.
23177 <li> acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
23178 <li> acosh(+(inf)) returns +(inf).
23179 </ul>
23181 <p><small><a href="#Contents">Contents</a></small>
23182 <h5><a name="F.9.2.2" href="#F.9.2.2">F.9.2.2 The asinh functions</a></h5>
23183 <p><a name="F.9.2.2p1" href="#F.9.2.2p1"><small>1</small></a>
23184 <ul>
23185 <li> asinh((+-)0) returns (+-)0.
23186 <li> asinh((+-)(inf)) returns (+-)(inf).
23187 </ul>
23189 <p><small><a href="#Contents">Contents</a></small>
23190 <h5><a name="F.9.2.3" href="#F.9.2.3">F.9.2.3 The atanh functions</a></h5>
23191 <p><a name="F.9.2.3p1" href="#F.9.2.3p1"><small>1</small></a>
23192 <ul>
23193 <li> atanh((+-)0) returns (+-)0.
23194 <li> atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
23195 <li> atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
23196 | x | &gt; 1.
23197 </ul>
23199 <p><small><a href="#Contents">Contents</a></small>
23200 <h5><a name="F.9.2.4" href="#F.9.2.4">F.9.2.4 The cosh functions</a></h5>
23201 <p><a name="F.9.2.4p1" href="#F.9.2.4p1"><small>1</small></a>
23202 <ul>
23203 <li> cosh((+-)0) returns 1.
23204 <li> cosh((+-)(inf)) returns +(inf).
23205 </ul>
23207 <p><small><a href="#Contents">Contents</a></small>
23208 <h5><a name="F.9.2.5" href="#F.9.2.5">F.9.2.5 The sinh functions</a></h5>
23209 <p><a name="F.9.2.5p1" href="#F.9.2.5p1"><small>1</small></a>
23210 <ul>
23211 <li> sinh((+-)0) returns (+-)0.
23212 <li> sinh((+-)(inf)) returns (+-)(inf).
23213 </ul>
23215 <p><small><a href="#Contents">Contents</a></small>
23216 <h5><a name="F.9.2.6" href="#F.9.2.6">F.9.2.6 The tanh functions</a></h5>
23217 <p><a name="F.9.2.6p1" href="#F.9.2.6p1"><small>1</small></a>
23218 <ul>
23219 <li> tanh((+-)0) returns (+-)0.
23220 <li> tanh((+-)(inf)) returns (+-)1.
23221 <!--page 470 -->
23222 </ul>
23224 <p><small><a href="#Contents">Contents</a></small>
23225 <h4><a name="F.9.3" href="#F.9.3">F.9.3 Exponential and logarithmic functions</a></h4>
23227 <p><small><a href="#Contents">Contents</a></small>
23228 <h5><a name="F.9.3.1" href="#F.9.3.1">F.9.3.1 The exp functions</a></h5>
23229 <p><a name="F.9.3.1p1" href="#F.9.3.1p1"><small>1</small></a>
23230 <ul>
23231 <li> exp((+-)0) returns 1.
23232 <li> exp(-(inf)) returns +0.
23233 <li> exp(+(inf)) returns +(inf).
23234 </ul>
23236 <p><small><a href="#Contents">Contents</a></small>
23237 <h5><a name="F.9.3.2" href="#F.9.3.2">F.9.3.2 The exp2 functions</a></h5>
23238 <p><a name="F.9.3.2p1" href="#F.9.3.2p1"><small>1</small></a>
23239 <ul>
23240 <li> exp2((+-)0) returns 1.
23241 <li> exp2(-(inf)) returns +0.
23242 <li> exp2(+(inf)) returns +(inf).
23243 </ul>
23245 <p><small><a href="#Contents">Contents</a></small>
23246 <h5><a name="F.9.3.3" href="#F.9.3.3">F.9.3.3 The expm1 functions</a></h5>
23247 <p><a name="F.9.3.3p1" href="#F.9.3.3p1"><small>1</small></a>
23248 <ul>
23249 <li> expm1((+-)0) returns (+-)0.
23250 <li> expm1(-(inf)) returns -1.
23251 <li> expm1(+(inf)) returns +(inf).
23252 </ul>
23254 <p><small><a href="#Contents">Contents</a></small>
23255 <h5><a name="F.9.3.4" href="#F.9.3.4">F.9.3.4 The frexp functions</a></h5>
23256 <p><a name="F.9.3.4p1" href="#F.9.3.4p1"><small>1</small></a>
23257 <ul>
23258 <li> frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
23259 <li> frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
23260 pointed to by exp.
23261 <li> frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
23262 (and returns a NaN).
23263 </ul>
23264 <p><a name="F.9.3.4p2" href="#F.9.3.4p2"><small>2</small></a>
23265 frexp raises no floating-point exceptions.
23266 <p><a name="F.9.3.4p3" href="#F.9.3.4p3"><small>3</small></a>
23267 On a binary system, the body of the frexp function might be
23268 <pre>
23270 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
23271 return scalbn(value, -(*exp));
23273 </pre>
23275 <p><small><a href="#Contents">Contents</a></small>
23276 <h5><a name="F.9.3.5" href="#F.9.3.5">F.9.3.5 The ilogb functions</a></h5>
23277 <p><a name="F.9.3.5p1" href="#F.9.3.5p1"><small>1</small></a>
23278 If the correct result is outside the range of the return type, the numeric result is
23279 unspecified and the ''invalid'' floating-point exception is raised.
23280 <!--page 471 -->
23282 <p><small><a href="#Contents">Contents</a></small>
23283 <h5><a name="F.9.3.6" href="#F.9.3.6">F.9.3.6 The ldexp functions</a></h5>
23284 <p><a name="F.9.3.6p1" href="#F.9.3.6p1"><small>1</small></a>
23285 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
23287 <p><small><a href="#Contents">Contents</a></small>
23288 <h5><a name="F.9.3.7" href="#F.9.3.7">F.9.3.7 The log functions</a></h5>
23289 <p><a name="F.9.3.7p1" href="#F.9.3.7p1"><small>1</small></a>
23290 <ul>
23291 <li> log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
23292 <li> log(1) returns +0.
23293 <li> log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
23294 <li> log(+(inf)) returns +(inf).
23295 </ul>
23297 <p><small><a href="#Contents">Contents</a></small>
23298 <h5><a name="F.9.3.8" href="#F.9.3.8">F.9.3.8 The log10 functions</a></h5>
23299 <p><a name="F.9.3.8p1" href="#F.9.3.8p1"><small>1</small></a>
23300 <ul>
23301 <li> log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
23302 <li> log10(1) returns +0.
23303 <li> log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
23304 <li> log10(+(inf)) returns +(inf).
23305 </ul>
23307 <p><small><a href="#Contents">Contents</a></small>
23308 <h5><a name="F.9.3.9" href="#F.9.3.9">F.9.3.9 The log1p functions</a></h5>
23309 <p><a name="F.9.3.9p1" href="#F.9.3.9p1"><small>1</small></a>
23310 <ul>
23311 <li> log1p((+-)0) returns (+-)0.
23312 <li> log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
23313 <li> log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
23314 x &lt; -1.
23315 <li> log1p(+(inf)) returns +(inf).
23316 </ul>
23318 <p><small><a href="#Contents">Contents</a></small>
23319 <h5><a name="F.9.3.10" href="#F.9.3.10">F.9.3.10 The log2 functions</a></h5>
23320 <p><a name="F.9.3.10p1" href="#F.9.3.10p1"><small>1</small></a>
23321 <ul>
23322 <li> log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
23323 <li> log2(1) returns +0.
23324 <li> log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
23325 <li> log2(+(inf)) returns +(inf).
23326 </ul>
23328 <p><small><a href="#Contents">Contents</a></small>
23329 <h5><a name="F.9.3.11" href="#F.9.3.11">F.9.3.11 The logb functions</a></h5>
23330 <p><a name="F.9.3.11p1" href="#F.9.3.11p1"><small>1</small></a>
23331 <ul>
23332 <li> logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
23333 <li> logb((+-)(inf)) returns +(inf).
23334 <!--page 472 -->
23335 </ul>
23337 <p><small><a href="#Contents">Contents</a></small>
23338 <h5><a name="F.9.3.12" href="#F.9.3.12">F.9.3.12 The modf functions</a></h5>
23339 <p><a name="F.9.3.12p1" href="#F.9.3.12p1"><small>1</small></a>
23340 <ul>
23341 <li> modf((+-)x, iptr) returns a result with the same sign as x.
23342 <li> modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
23343 <li> modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
23344 NaN).
23345 </ul>
23346 <p><a name="F.9.3.12p2" href="#F.9.3.12p2"><small>2</small></a>
23347 modf behaves as though implemented by
23348 <pre>
23349 #include <a href="#7.12">&lt;math.h&gt;</a>
23350 #include <a href="#7.6">&lt;fenv.h&gt;</a>
23351 #pragma STDC FENV_ACCESS ON
23352 double modf(double value, double *iptr)
23354 int save_round = fegetround();
23355 fesetround(FE_TOWARDZERO);
23356 *iptr = nearbyint(value);
23357 fesetround(save_round);
23358 return copysign(
23359 isinf(value) ? 0.0 :
23360 value - (*iptr), value);
23362 </pre>
23364 <p><small><a href="#Contents">Contents</a></small>
23365 <h5><a name="F.9.3.13" href="#F.9.3.13">F.9.3.13 The scalbn and scalbln functions</a></h5>
23366 <p><a name="F.9.3.13p1" href="#F.9.3.13p1"><small>1</small></a>
23367 <ul>
23368 <li> scalbn((+-)0, n) returns (+-)0.
23369 <li> scalbn(x, 0) returns x.
23370 <li> scalbn((+-)(inf), n) returns (+-)(inf).
23371 </ul>
23373 <p><small><a href="#Contents">Contents</a></small>
23374 <h4><a name="F.9.4" href="#F.9.4">F.9.4 Power and absolute value functions</a></h4>
23376 <p><small><a href="#Contents">Contents</a></small>
23377 <h5><a name="F.9.4.1" href="#F.9.4.1">F.9.4.1 The cbrt functions</a></h5>
23378 <p><a name="F.9.4.1p1" href="#F.9.4.1p1"><small>1</small></a>
23379 <ul>
23380 <li> cbrt((+-)0) returns (+-)0.
23381 <li> cbrt((+-)(inf)) returns (+-)(inf).
23382 </ul>
23384 <p><small><a href="#Contents">Contents</a></small>
23385 <h5><a name="F.9.4.2" href="#F.9.4.2">F.9.4.2 The fabs functions</a></h5>
23386 <p><a name="F.9.4.2p1" href="#F.9.4.2p1"><small>1</small></a>
23387 <ul>
23388 <li> fabs((+-)0) returns +0.
23389 <li> fabs((+-)(inf)) returns +(inf).
23390 <!--page 473 -->
23391 </ul>
23393 <p><small><a href="#Contents">Contents</a></small>
23394 <h5><a name="F.9.4.3" href="#F.9.4.3">F.9.4.3 The hypot functions</a></h5>
23395 <p><a name="F.9.4.3p1" href="#F.9.4.3p1"><small>1</small></a>
23396 <ul>
23397 <li> hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
23398 <li> hypot(x, (+-)0) is equivalent to fabs(x).
23399 <li> hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
23400 </ul>
23402 <p><small><a href="#Contents">Contents</a></small>
23403 <h5><a name="F.9.4.4" href="#F.9.4.4">F.9.4.4 The pow functions</a></h5>
23404 <p><a name="F.9.4.4p1" href="#F.9.4.4p1"><small>1</small></a>
23405 <ul>
23406 <li> pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
23407 for y an odd integer &lt; 0.
23408 <li> pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
23409 for y &lt; 0 and not an odd integer.
23410 <li> pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
23411 <li> pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
23412 <li> pow(-1, (+-)(inf)) returns 1.
23413 <li> pow(+1, y) returns 1 for any y, even a NaN.
23414 <li> pow(x, (+-)0) returns 1 for any x, even a NaN.
23415 <li> pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
23416 finite x &lt; 0 and finite non-integer y.
23417 <li> pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
23418 <li> pow(x, -(inf)) returns +0 for | x | &gt; 1.
23419 <li> pow(x, +(inf)) returns +0 for | x | &lt; 1.
23420 <li> pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
23421 <li> pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
23422 <li> pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
23423 <li> pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
23424 <li> pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
23425 <li> pow(+(inf), y) returns +0 for y &lt; 0.
23426 <li> pow(+(inf), y) returns +(inf) for y &gt; 0.
23427 <!--page 474 -->
23428 </ul>
23430 <p><small><a href="#Contents">Contents</a></small>
23431 <h5><a name="F.9.4.5" href="#F.9.4.5">F.9.4.5 The sqrt functions</a></h5>
23432 <p><a name="F.9.4.5p1" href="#F.9.4.5p1"><small>1</small></a>
23433 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
23435 <p><small><a href="#Contents">Contents</a></small>
23436 <h4><a name="F.9.5" href="#F.9.5">F.9.5 Error and gamma functions</a></h4>
23438 <p><small><a href="#Contents">Contents</a></small>
23439 <h5><a name="F.9.5.1" href="#F.9.5.1">F.9.5.1 The erf functions</a></h5>
23440 <p><a name="F.9.5.1p1" href="#F.9.5.1p1"><small>1</small></a>
23441 <ul>
23442 <li> erf((+-)0) returns (+-)0.
23443 <li> erf((+-)(inf)) returns (+-)1.
23444 </ul>
23446 <p><small><a href="#Contents">Contents</a></small>
23447 <h5><a name="F.9.5.2" href="#F.9.5.2">F.9.5.2 The erfc functions</a></h5>
23448 <p><a name="F.9.5.2p1" href="#F.9.5.2p1"><small>1</small></a>
23449 <ul>
23450 <li> erfc(-(inf)) returns 2.
23451 <li> erfc(+(inf)) returns +0.
23452 </ul>
23454 <p><small><a href="#Contents">Contents</a></small>
23455 <h5><a name="F.9.5.3" href="#F.9.5.3">F.9.5.3 The lgamma functions</a></h5>
23456 <p><a name="F.9.5.3p1" href="#F.9.5.3p1"><small>1</small></a>
23457 <ul>
23458 <li> lgamma(1) returns +0.
23459 <li> lgamma(2) returns +0.
23460 <li> lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
23461 x a negative integer or zero.
23462 <li> lgamma(-(inf)) returns +(inf).
23463 <li> lgamma(+(inf)) returns +(inf).
23464 </ul>
23466 <p><small><a href="#Contents">Contents</a></small>
23467 <h5><a name="F.9.5.4" href="#F.9.5.4">F.9.5.4 The tgamma functions</a></h5>
23468 <p><a name="F.9.5.4p1" href="#F.9.5.4p1"><small>1</small></a>
23469 <ul>
23470 <li> tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
23471 <li> tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
23472 negative integer.
23473 <li> tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
23474 <li> tgamma(+(inf)) returns +(inf).
23475 </ul>
23477 <p><small><a href="#Contents">Contents</a></small>
23478 <h4><a name="F.9.6" href="#F.9.6">F.9.6 Nearest integer functions</a></h4>
23480 <p><small><a href="#Contents">Contents</a></small>
23481 <h5><a name="F.9.6.1" href="#F.9.6.1">F.9.6.1 The ceil functions</a></h5>
23482 <p><a name="F.9.6.1p1" href="#F.9.6.1p1"><small>1</small></a>
23483 <ul>
23484 <li> ceil((+-)0) returns (+-)0.
23485 <li> ceil((+-)(inf)) returns (+-)(inf).
23486 </ul>
23487 <p><a name="F.9.6.1p2" href="#F.9.6.1p2"><small>2</small></a>
23488 The double version of ceil behaves as though implemented by
23489 <!--page 475 -->
23490 <pre>
23491 #include <a href="#7.12">&lt;math.h&gt;</a>
23492 #include <a href="#7.6">&lt;fenv.h&gt;</a>
23493 #pragma STDC FENV_ACCESS ON
23494 double ceil(double x)
23496 double result;
23497 int save_round = fegetround();
23498 fesetround(FE_UPWARD);
23499 result = rint(x); // or nearbyint instead of rint
23500 fesetround(save_round);
23501 return result;
23503 </pre>
23505 <p><small><a href="#Contents">Contents</a></small>
23506 <h5><a name="F.9.6.2" href="#F.9.6.2">F.9.6.2 The floor functions</a></h5>
23507 <p><a name="F.9.6.2p1" href="#F.9.6.2p1"><small>1</small></a>
23508 <ul>
23509 <li> floor((+-)0) returns (+-)0.
23510 <li> floor((+-)(inf)) returns (+-)(inf).
23511 </ul>
23512 <p><a name="F.9.6.2p2" href="#F.9.6.2p2"><small>2</small></a>
23513 See the sample implementation for ceil in <a href="#F.9.6.1">F.9.6.1</a>.
23515 <p><small><a href="#Contents">Contents</a></small>
23516 <h5><a name="F.9.6.3" href="#F.9.6.3">F.9.6.3 The nearbyint functions</a></h5>
23517 <p><a name="F.9.6.3p1" href="#F.9.6.3p1"><small>1</small></a>
23518 The nearbyint functions use IEC 60559 rounding according to the current rounding
23519 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
23520 value from the argument.
23521 <ul>
23522 <li> nearbyint((+-)0) returns (+-)0 (for all rounding directions).
23523 <li> nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
23524 </ul>
23526 <p><small><a href="#Contents">Contents</a></small>
23527 <h5><a name="F.9.6.4" href="#F.9.6.4">F.9.6.4 The rint functions</a></h5>
23528 <p><a name="F.9.6.4p1" href="#F.9.6.4p1"><small>1</small></a>
23529 The rint functions differ from the nearbyint functions only in that they do raise the
23530 ''inexact'' floating-point exception if the result differs in value from the argument.
23532 <p><small><a href="#Contents">Contents</a></small>
23533 <h5><a name="F.9.6.5" href="#F.9.6.5">F.9.6.5 The lrint and llrint functions</a></h5>
23534 <p><a name="F.9.6.5p1" href="#F.9.6.5p1"><small>1</small></a>
23535 The lrint and llrint functions provide floating-to-integer conversion as prescribed
23536 by IEC 60559. They round according to the current rounding direction. If the rounded
23537 value is outside the range of the return type, the numeric result is unspecified and the
23538 ''invalid'' floating-point exception is raised. When they raise no other floating-point
23539 exception and the result differs from the argument, they raise the ''inexact'' floating-point
23540 exception.
23541 <!--page 476 -->
23543 <p><small><a href="#Contents">Contents</a></small>
23544 <h5><a name="F.9.6.6" href="#F.9.6.6">F.9.6.6 The round functions</a></h5>
23545 <p><a name="F.9.6.6p1" href="#F.9.6.6p1"><small>1</small></a>
23546 <ul>
23547 <li> round((+-)0) returns (+-)0.
23548 <li> round((+-)(inf)) returns (+-)(inf).
23549 </ul>
23550 <p><a name="F.9.6.6p2" href="#F.9.6.6p2"><small>2</small></a>
23551 The double version of round behaves as though implemented by
23552 <pre>
23553 #include <a href="#7.12">&lt;math.h&gt;</a>
23554 #include <a href="#7.6">&lt;fenv.h&gt;</a>
23555 #pragma STDC FENV_ACCESS ON
23556 double round(double x)
23558 double result;
23559 fenv_t save_env;
23560 feholdexcept(&amp;save_env);
23561 result = rint(x);
23562 if (fetestexcept(FE_INEXACT)) {
23563 fesetround(FE_TOWARDZERO);
23564 result = rint(copysign(0.5 + fabs(x), x));
23566 feupdateenv(&amp;save_env);
23567 return result;
23569 </pre>
23570 The round functions may, but are not required to, raise the ''inexact'' floating-point
23571 exception for non-integer numeric arguments, as this implementation does.
23573 <p><small><a href="#Contents">Contents</a></small>
23574 <h5><a name="F.9.6.7" href="#F.9.6.7">F.9.6.7 The lround and llround functions</a></h5>
23575 <p><a name="F.9.6.7p1" href="#F.9.6.7p1"><small>1</small></a>
23576 The lround and llround functions differ from the lrint and llrint functions
23577 with the default rounding direction just in that the lround and llround functions
23578 round halfway cases away from zero and need not raise the ''inexact'' floating-point
23579 exception for non-integer arguments that round to within the range of the return type.
23581 <p><small><a href="#Contents">Contents</a></small>
23582 <h5><a name="F.9.6.8" href="#F.9.6.8">F.9.6.8 The trunc functions</a></h5>
23583 <p><a name="F.9.6.8p1" href="#F.9.6.8p1"><small>1</small></a>
23584 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
23585 rounding direction).
23586 <ul>
23587 <li> trunc((+-)0) returns (+-)0.
23588 <li> trunc((+-)(inf)) returns (+-)(inf).
23589 <!--page 477 -->
23590 </ul>
23592 <p><small><a href="#Contents">Contents</a></small>
23593 <h4><a name="F.9.7" href="#F.9.7">F.9.7 Remainder functions</a></h4>
23595 <p><small><a href="#Contents">Contents</a></small>
23596 <h5><a name="F.9.7.1" href="#F.9.7.1">F.9.7.1 The fmod functions</a></h5>
23597 <p><a name="F.9.7.1p1" href="#F.9.7.1p1"><small>1</small></a>
23598 <ul>
23599 <li> fmod((+-)0, y) returns (+-)0 for y not zero.
23600 <li> fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
23601 infinite or y zero.
23602 <li> fmod(x, (+-)(inf)) returns x for x not infinite.
23603 </ul>
23604 <p><a name="F.9.7.1p2" href="#F.9.7.1p2"><small>2</small></a>
23605 The double version of fmod behaves as though implemented by
23606 <pre>
23607 #include <a href="#7.12">&lt;math.h&gt;</a>
23608 #include <a href="#7.6">&lt;fenv.h&gt;</a>
23609 #pragma STDC FENV_ACCESS ON
23610 double fmod(double x, double y)
23612 double result;
23613 result = remainder(fabs(x), (y = fabs(y)));
23614 if (signbit(result)) result += y;
23615 return copysign(result, x);
23617 </pre>
23619 <p><small><a href="#Contents">Contents</a></small>
23620 <h5><a name="F.9.7.2" href="#F.9.7.2">F.9.7.2 The remainder functions</a></h5>
23621 <p><a name="F.9.7.2p1" href="#F.9.7.2p1"><small>1</small></a>
23622 The remainder functions are fully specified as a basic arithmetic operation in
23623 IEC 60559.
23625 <p><small><a href="#Contents">Contents</a></small>
23626 <h5><a name="F.9.7.3" href="#F.9.7.3">F.9.7.3 The remquo functions</a></h5>
23627 <p><a name="F.9.7.3p1" href="#F.9.7.3p1"><small>1</small></a>
23628 The remquo functions follow the specifications for the remainder functions. They
23629 have no further specifications special to IEC 60559 implementations.
23631 <p><small><a href="#Contents">Contents</a></small>
23632 <h4><a name="F.9.8" href="#F.9.8">F.9.8 Manipulation functions</a></h4>
23634 <p><small><a href="#Contents">Contents</a></small>
23635 <h5><a name="F.9.8.1" href="#F.9.8.1">F.9.8.1 The copysign functions</a></h5>
23636 <p><a name="F.9.8.1p1" href="#F.9.8.1p1"><small>1</small></a>
23637 copysign is specified in the Appendix to IEC 60559.
23639 <p><small><a href="#Contents">Contents</a></small>
23640 <h5><a name="F.9.8.2" href="#F.9.8.2">F.9.8.2 The nan functions</a></h5>
23641 <p><a name="F.9.8.2p1" href="#F.9.8.2p1"><small>1</small></a>
23642 All IEC 60559 implementations support quiet NaNs, in all floating formats.
23643 <!--page 478 -->
23645 <p><small><a href="#Contents">Contents</a></small>
23646 <h5><a name="F.9.8.3" href="#F.9.8.3">F.9.8.3 The nextafter functions</a></h5>
23647 <p><a name="F.9.8.3p1" href="#F.9.8.3p1"><small>1</small></a>
23648 <ul>
23649 <li> nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
23650 for x finite and the function value infinite.
23651 <li> nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
23652 exceptions for the function value subnormal or zero and x != y.
23653 </ul>
23655 <p><small><a href="#Contents">Contents</a></small>
23656 <h5><a name="F.9.8.4" href="#F.9.8.4">F.9.8.4 The nexttoward functions</a></h5>
23657 <p><a name="F.9.8.4p1" href="#F.9.8.4p1"><small>1</small></a>
23658 No additional requirements beyond those on nextafter.
23660 <p><small><a href="#Contents">Contents</a></small>
23661 <h4><a name="F.9.9" href="#F.9.9">F.9.9 Maximum, minimum, and positive difference functions</a></h4>
23663 <p><small><a href="#Contents">Contents</a></small>
23664 <h5><a name="F.9.9.1" href="#F.9.9.1">F.9.9.1 The fdim functions</a></h5>
23665 <p><a name="F.9.9.1p1" href="#F.9.9.1p1"><small>1</small></a>
23666 No additional requirements.
23668 <p><small><a href="#Contents">Contents</a></small>
23669 <h5><a name="F.9.9.2" href="#F.9.9.2">F.9.9.2 The fmax functions</a></h5>
23670 <p><a name="F.9.9.2p1" href="#F.9.9.2p1"><small>1</small></a>
23671 If just one argument is a NaN, the fmax functions return the other argument (if both
23672 arguments are NaNs, the functions return a NaN).
23673 <p><a name="F.9.9.2p2" href="#F.9.9.2p2"><small>2</small></a>
23674 The body of the fmax function might be<sup><a href="#note323"><b>323)</b></a></sup>
23675 <pre>
23676 { return (isgreaterequal(x, y) ||
23677 isnan(y)) ? x : y; }
23678 </pre>
23680 <p><b>Footnotes</b>
23681 <p><small><a name="note323" href="#note323">323)</a> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
23682 return +0; however, implementation in software might be impractical.
23683 </small>
23685 <p><small><a href="#Contents">Contents</a></small>
23686 <h5><a name="F.9.9.3" href="#F.9.9.3">F.9.9.3 The fmin functions</a></h5>
23687 <p><a name="F.9.9.3p1" href="#F.9.9.3p1"><small>1</small></a>
23688 The fmin functions are analogous to the fmax functions (see <a href="#F.9.9.2">F.9.9.2</a>).
23690 <p><small><a href="#Contents">Contents</a></small>
23691 <h4><a name="F.9.10" href="#F.9.10">F.9.10 Floating multiply-add</a></h4>
23693 <p><small><a href="#Contents">Contents</a></small>
23694 <h5><a name="F.9.10.1" href="#F.9.10.1">F.9.10.1 The fma functions</a></h5>
23695 <p><a name="F.9.10.1p1" href="#F.9.10.1p1"><small>1</small></a>
23696 <ul>
23697 <li> fma(x, y, z) computes xy + z, correctly rounded once.
23698 <li> fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
23699 exception if one of x and y is infinite, the other is zero, and z is a NaN.
23700 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
23701 one of x and y is infinite, the other is zero, and z is not a NaN.
23702 <li> fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
23703 times y is an exact infinity and z is also an infinity but with the opposite sign.
23708 <!--page 479 -->
23709 </ul>
23711 <p><small><a href="#Contents">Contents</a></small>
23712 <h2><a name="G" href="#G">Annex G</a></h2>
23713 <pre>
23714 (informative)
23715 IEC 60559-compatible complex arithmetic
23716 </pre>
23718 <p><small><a href="#Contents">Contents</a></small>
23719 <h3><a name="G.1" href="#G.1">G.1 Introduction</a></h3>
23720 <p><a name="G.1p1" href="#G.1p1"><small>1</small></a>
23721 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
23722 IEC 60559 real floating-point arithmetic. Although these specifications have been
23723 carefully designed, there is little existing practice to validate the design decisions.
23724 Therefore, these specifications are not normative, but should be viewed more as
23725 recommended practice. An implementation that defines
23726 __STDC_IEC_559_COMPLEX__ should conform to the specifications in this annex.
23728 <p><small><a href="#Contents">Contents</a></small>
23729 <h3><a name="G.2" href="#G.2">G.2 Types</a></h3>
23730 <p><a name="G.2p1" href="#G.2p1"><small>1</small></a>
23731 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
23732 used as a type specifier within declaration specifiers in the same way as _Complex is
23733 (thus, _Imaginary float is a valid type name).
23734 <p><a name="G.2p2" href="#G.2p2"><small>2</small></a>
23735 There are three imaginary types, designated as float _Imaginary, double
23736 _Imaginary, and long double _Imaginary. The imaginary types (along with
23737 the real floating and complex types) are floating types.
23738 <p><a name="G.2p3" href="#G.2p3"><small>3</small></a>
23739 For imaginary types, the corresponding real type is given by deleting the keyword
23740 _Imaginary from the type name.
23741 <p><a name="G.2p4" href="#G.2p4"><small>4</small></a>
23742 Each imaginary type has the same representation and alignment requirements as the
23743 corresponding real type. The value of an object of imaginary type is the value of the real
23744 representation times the imaginary unit.
23745 <p><a name="G.2p5" href="#G.2p5"><small>5</small></a>
23746 The imaginary type domain comprises the imaginary types.
23748 <p><small><a href="#Contents">Contents</a></small>
23749 <h3><a name="G.3" href="#G.3">G.3 Conventions</a></h3>
23750 <p><a name="G.3p1" href="#G.3p1"><small>1</small></a>
23751 A complex or imaginary value with at least one infinite part is regarded as an infinity
23752 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
23753 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
23754 a zero if each of its parts is a zero.
23755 <!--page 480 -->
23757 <p><small><a href="#Contents">Contents</a></small>
23758 <h3><a name="G.4" href="#G.4">G.4 Conversions</a></h3>
23760 <p><small><a href="#Contents">Contents</a></small>
23761 <h4><a name="G.4.1" href="#G.4.1">G.4.1 Imaginary types</a></h4>
23762 <p><a name="G.4.1p1" href="#G.4.1p1"><small>1</small></a>
23763 Conversions among imaginary types follow rules analogous to those for real floating
23764 types.
23766 <p><small><a href="#Contents">Contents</a></small>
23767 <h4><a name="G.4.2" href="#G.4.2">G.4.2 Real and imaginary</a></h4>
23768 <p><a name="G.4.2p1" href="#G.4.2p1"><small>1</small></a>
23769 When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note324"><b>324)</b></a></sup> the
23770 result is a positive zero.
23771 <p><a name="G.4.2p2" href="#G.4.2p2"><small>2</small></a>
23772 When a value of real type is converted to an imaginary type, the result is a positive
23773 imaginary zero.
23775 <p><b>Footnotes</b>
23776 <p><small><a name="note324" href="#note324">324)</a> See <a href="#6.3.1.2">6.3.1.2</a>.
23777 </small>
23779 <p><small><a href="#Contents">Contents</a></small>
23780 <h4><a name="G.4.3" href="#G.4.3">G.4.3 Imaginary and complex</a></h4>
23781 <p><a name="G.4.3p1" href="#G.4.3p1"><small>1</small></a>
23782 When a value of imaginary type is converted to a complex type, the real part of the
23783 complex result value is a positive zero and the imaginary part of the complex result value
23784 is determined by the conversion rules for the corresponding real types.
23785 <p><a name="G.4.3p2" href="#G.4.3p2"><small>2</small></a>
23786 When a value of complex type is converted to an imaginary type, the real part of the
23787 complex value is discarded and the value of the imaginary part is converted according to
23788 the conversion rules for the corresponding real types.
23790 <p><small><a href="#Contents">Contents</a></small>
23791 <h3><a name="G.5" href="#G.5">G.5 Binary operators</a></h3>
23792 <p><a name="G.5p1" href="#G.5p1"><small>1</small></a>
23793 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
23794 operation with an imaginary operand.
23795 <p><a name="G.5p2" href="#G.5p2"><small>2</small></a>
23796 For most operand types, the value of the result of a binary operator with an imaginary or
23797 complex operand is completely determined, with reference to real arithmetic, by the usual
23798 mathematical formula. For some operand types, the usual mathematical formula is
23799 problematic because of its treatment of infinities and because of undue overflow or
23800 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
23801 not completely determined.
23806 <!--page 481 -->
23808 <p><small><a href="#Contents">Contents</a></small>
23809 <h4><a name="G.5.1" href="#G.5.1">G.5.1 Multiplicative operators</a></h4>
23810 <p><b>Semantics</b>
23811 <p><a name="G.5.1p1" href="#G.5.1p1"><small>1</small></a>
23812 If one operand has real type and the other operand has imaginary type, then the result has
23813 imaginary type. If both operands have imaginary type, then the result has real type. (If
23814 either operand has complex type, then the result has complex type.)
23815 <p><a name="G.5.1p2" href="#G.5.1p2"><small>2</small></a>
23816 If the operands are not both complex, then the result and floating-point exception
23817 behavior of the * operator is defined by the usual mathematical formula:
23818 <pre>
23819 * u iv u + iv
23820 </pre>
23822 <pre>
23823 x xu i(xv) (xu) + i(xv)
23824 </pre>
23826 <pre>
23827 iy i(yu) -yv (-yv) + i(yu)
23828 </pre>
23830 <pre>
23831 x + iy (xu) + i(yu) (-yv) + i(xv)
23832 </pre>
23833 <p><a name="G.5.1p3" href="#G.5.1p3"><small>3</small></a>
23834 If the second operand is not complex, then the result and floating-point exception
23835 behavior of the / operator is defined by the usual mathematical formula:
23836 <pre>
23837 / u iv
23838 </pre>
23840 <pre>
23841 x x/u i(-x/v)
23842 </pre>
23844 <pre>
23845 iy i(y/u) y/v
23846 </pre>
23848 <pre>
23849 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
23850 </pre>
23851 <p><a name="G.5.1p4" href="#G.5.1p4"><small>4</small></a>
23852 The * and / operators satisfy the following infinity properties for all real, imaginary, and
23853 complex operands:<sup><a href="#note325"><b>325)</b></a></sup>
23854 <ul>
23855 <li> if one operand is an infinity and the other operand is a nonzero finite number or an
23856 infinity, then the result of the * operator is an infinity;
23857 <li> if the first operand is an infinity and the second operand is a finite number, then the
23858 result of the / operator is an infinity;
23859 <li> if the first operand is a finite number and the second operand is an infinity, then the
23860 result of the / operator is a zero;
23865 <!--page 482 -->
23866 <li> if the first operand is a nonzero finite number or an infinity and the second operand is
23867 a zero, then the result of the / operator is an infinity.
23868 </ul>
23869 <p><a name="G.5.1p5" href="#G.5.1p5"><small>5</small></a>
23870 If both operands of the * operator are complex or if the second operand of the / operator
23871 is complex, the operator raises floating-point exceptions if appropriate for the calculation
23872 of the parts of the result, and may raise spurious floating-point exceptions.
23873 <p><a name="G.5.1p6" href="#G.5.1p6"><small>6</small></a>
23874 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
23875 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
23876 <!--page 483 -->
23877 <pre>
23878 #include <a href="#7.12">&lt;math.h&gt;</a>
23879 #include <a href="#7.3">&lt;complex.h&gt;</a>
23880 /* Multiply z * w ... */
23881 double complex _Cmultd(double complex z, double complex w)
23883 #pragma STDC FP_CONTRACT OFF
23884 double a, b, c, d, ac, bd, ad, bc, x, y;
23885 a = creal(z); b = cimag(z);
23886 c = creal(w); d = cimag(w);
23887 ac = a * c; bd = b * d;
23888 ad = a * d; bc = b * c;
23889 x = ac - bd; y = ad + bc;
23890 if (isnan(x) &amp;&amp; isnan(y)) {
23891 /* Recover infinities that computed as NaN+iNaN ... */
23892 int recalc = 0;
23893 if ( isinf(a) || isinf(b) ) { // z is infinite
23894 /* "Box" the infinity and change NaNs in the other factor to 0 */
23895 a = copysign(isinf(a) ? 1.0 : 0.0, a);
23896 b = copysign(isinf(b) ? 1.0 : 0.0, b);
23897 if (isnan(c)) c = copysign(0.0, c);
23898 if (isnan(d)) d = copysign(0.0, d);
23899 recalc = 1;
23901 if ( isinf(c) || isinf(d) ) { // w is infinite
23902 /* "Box" the infinity and change NaNs in the other factor to 0 */
23903 c = copysign(isinf(c) ? 1.0 : 0.0, c);
23904 d = copysign(isinf(d) ? 1.0 : 0.0, d);
23905 if (isnan(a)) a = copysign(0.0, a);
23906 if (isnan(b)) b = copysign(0.0, b);
23907 recalc = 1;
23909 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
23910 isinf(ad) || isinf(bc))) {
23911 /* Recover infinities from overflow by changing NaNs to 0 ... */
23912 if (isnan(a)) a = copysign(0.0, a);
23913 if (isnan(b)) b = copysign(0.0, b);
23914 if (isnan(c)) c = copysign(0.0, c);
23915 if (isnan(d)) d = copysign(0.0, d);
23916 recalc = 1;
23918 if (recalc) {
23919 x = INFINITY * ( a * c - b * d );
23920 y = INFINITY * ( a * d + b * c );
23923 return x + I * y;
23925 </pre>
23926 <p><a name="G.5.1p7" href="#G.5.1p7"><small>7</small></a>
23927 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
23928 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
23930 <p><a name="G.5.1p8" href="#G.5.1p8"><small>8</small></a>
23931 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
23932 <!--page 484 -->
23933 <pre>
23934 #include <a href="#7.12">&lt;math.h&gt;</a>
23935 #include <a href="#7.3">&lt;complex.h&gt;</a>
23936 /* Divide z / w ... */
23937 double complex _Cdivd(double complex z, double complex w)
23939 #pragma STDC FP_CONTRACT OFF
23940 double a, b, c, d, logbw, denom, x, y;
23941 int ilogbw = 0;
23942 a = creal(z); b = cimag(z);
23943 c = creal(w); d = cimag(w);
23944 logbw = logb(fmax(fabs(c), fabs(d)));
23945 if (isfinite(logbw)) {
23946 ilogbw = (int)logbw;
23947 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
23949 denom = c * c + d * d;
23950 x = scalbn((a * c + b * d) / denom, -ilogbw);
23951 y = scalbn((b * c - a * d) / denom, -ilogbw);
23952 /* Recover infinities and zeros that computed as NaN+iNaN; */
23953 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
23954 if (isnan(x) &amp;&amp; isnan(y)) {
23955 if ((denom == 0.0) &amp;&amp;
23956 (!isnan(a) || !isnan(b))) {
23957 x = copysign(INFINITY, c) * a;
23958 y = copysign(INFINITY, c) * b;
23960 else if ((isinf(a) || isinf(b)) &amp;&amp;
23961 isfinite(c) &amp;&amp; isfinite(d)) {
23962 a = copysign(isinf(a) ? 1.0 : 0.0, a);
23963 b = copysign(isinf(b) ? 1.0 : 0.0, b);
23964 x = INFINITY * ( a * c + b * d );
23965 y = INFINITY * ( b * c - a * d );
23967 else if (isinf(logbw) &amp;&amp;
23968 isfinite(a) &amp;&amp; isfinite(b)) {
23969 c = copysign(isinf(c) ? 1.0 : 0.0, c);
23970 d = copysign(isinf(d) ? 1.0 : 0.0, d);
23971 x = 0.0 * ( a * c + b * d );
23972 y = 0.0 * ( b * c - a * d );
23975 return x + I * y;
23977 </pre>
23978 <p><a name="G.5.1p9" href="#G.5.1p9"><small>9</small></a>
23979 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
23980 for multiplication. In the spirit of the multiplication example above, this code does not defend against
23981 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
23982 with division, provides better roundoff characteristics.
23985 <p><b>Footnotes</b>
23986 <p><small><a name="note325" href="#note325">325)</a> These properties are already implied for those cases covered in the tables, but are required for all cases
23987 (at least where the state for CX_LIMITED_RANGE is ''off'').
23988 </small>
23990 <p><small><a href="#Contents">Contents</a></small>
23991 <h4><a name="G.5.2" href="#G.5.2">G.5.2 Additive operators</a></h4>
23992 <p><b>Semantics</b>
23993 <p><a name="G.5.2p1" href="#G.5.2p1"><small>1</small></a>
23994 If both operands have imaginary type, then the result has imaginary type. (If one operand
23995 has real type and the other operand has imaginary type, or if either operand has complex
23996 type, then the result has complex type.)
23997 <p><a name="G.5.2p2" href="#G.5.2p2"><small>2</small></a>
23998 In all cases the result and floating-point exception behavior of a + or - operator is defined
23999 by the usual mathematical formula:
24000 <pre>
24001 + or - u iv u + iv
24002 </pre>
24004 <pre>
24005 x x(+-)u x (+-) iv (x (+-) u) (+-) iv
24006 </pre>
24008 <pre>
24009 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
24010 </pre>
24012 <pre>
24013 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
24014 </pre>
24016 <p><small><a href="#Contents">Contents</a></small>
24017 <h3><a name="G.6" href="#G.6">G.6 Complex arithmetic &lt;complex.h&gt;</a></h3>
24018 <p><a name="G.6p1" href="#G.6p1"><small>1</small></a>
24019 The macros
24020 <pre>
24021 imaginary
24022 </pre>
24024 <pre>
24025 _Imaginary_I
24026 </pre>
24027 are defined, respectively, as _Imaginary and a constant expression of type const
24028 float _Imaginary with the value of the imaginary unit. The macro
24029 <pre>
24031 </pre>
24032 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
24033 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
24034 imaginary.
24035 <p><a name="G.6p2" href="#G.6p2"><small>2</small></a>
24036 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
24037 particularly suited to IEC 60559 implementations. For families of functions, the
24038 specifications apply to all of the functions even though only the principal function is
24039 <!--page 485 -->
24040 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
24041 and the result, the result has the same sign as the argument.
24042 <p><a name="G.6p3" href="#G.6p3"><small>3</small></a>
24043 The functions are continuous onto both sides of their branch cuts, taking into account the
24044 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)(2).
24045 <p><a name="G.6p4" href="#G.6p4"><small>4</small></a>
24046 Since complex and imaginary values are composed of real values, each function may be
24047 regarded as computing real values from real values. Except as noted, the functions treat
24048 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
24049 manner consistent with the specifications for real functions in F.9.<sup><a href="#note326"><b>326)</b></a></sup>
24050 <p><a name="G.6p5" href="#G.6p5"><small>5</small></a>
24051 The functions cimag, conj, cproj, and creal are fully specified for all
24052 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
24053 point exceptions.
24054 <p><a name="G.6p6" href="#G.6p6"><small>6</small></a>
24055 Each of the functions cabs and carg is specified by a formula in terms of a real
24056 function (whose special cases are covered in <a href="#F">annex F</a>):
24057 <pre>
24058 cabs(x + iy) = hypot(x, y)
24059 carg(x + iy) = atan2(y, x)
24060 </pre>
24061 <p><a name="G.6p7" href="#G.6p7"><small>7</small></a>
24062 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
24063 a formula in terms of other complex functions (whose special cases are specified below):
24064 <pre>
24065 casin(z) = -i casinh(iz)
24066 catan(z) = -i catanh(iz)
24067 ccos(z) = ccosh(iz)
24068 csin(z) = -i csinh(iz)
24069 ctan(z) = -i ctanh(iz)
24070 </pre>
24071 <p><a name="G.6p8" href="#G.6p8"><small>8</small></a>
24072 For the other functions, the following subclauses specify behavior for special cases,
24073 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
24074 families of functions, the specifications apply to all of the functions even though only the
24075 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
24076 specifications for the upper half-plane imply the specifications for the lower half-plane; if
24077 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
24078 specifications for the first quadrant imply the specifications for the other three quadrants.
24079 <p><a name="G.6p9" href="#G.6p9"><small>9</small></a>
24080 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
24085 <!--page 486 -->
24087 <p><b>Footnotes</b>
24088 <p><small><a name="note326" href="#note326">326)</a> As noted in <a href="#G.3">G.3</a>, a complex value with at least one infinite part is regarded as an infinity even if its
24089 other part is a NaN.
24090 </small>
24092 <p><small><a href="#Contents">Contents</a></small>
24093 <h4><a name="G.6.1" href="#G.6.1">G.6.1 Trigonometric functions</a></h4>
24095 <p><small><a href="#Contents">Contents</a></small>
24096 <h5><a name="G.6.1.1" href="#G.6.1.1">G.6.1.1 The cacos functions</a></h5>
24097 <p><a name="G.6.1.1p1" href="#G.6.1.1p1"><small>1</small></a>
24098 <ul>
24099 <li> cacos(conj(z)) = conj(cacos(z)).
24100 <li> cacos((+-)0 + i0) returns pi /2 - i0.
24101 <li> cacos((+-)0 + iNaN) returns pi /2 + iNaN.
24102 <li> cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
24103 <li> cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24104 point exception, for nonzero finite x.
24105 <li> cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
24106 <li> cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
24107 <li> cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
24108 <li> cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
24109 <li> cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
24110 result is unspecified).
24111 <li> cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24112 point exception, for finite y.
24113 <li> cacos(NaN + i (inf)) returns NaN - i (inf).
24114 <li> cacos(NaN + iNaN) returns NaN + iNaN.
24115 </ul>
24117 <p><small><a href="#Contents">Contents</a></small>
24118 <h4><a name="G.6.2" href="#G.6.2">G.6.2 Hyperbolic functions</a></h4>
24120 <p><small><a href="#Contents">Contents</a></small>
24121 <h5><a name="G.6.2.1" href="#G.6.2.1">G.6.2.1 The cacosh functions</a></h5>
24122 <p><a name="G.6.2.1p1" href="#G.6.2.1p1"><small>1</small></a>
24123 <ul>
24124 <li> cacosh(conj(z)) = conj(cacosh(z)).
24125 <li> cacosh((+-)0 + i0) returns +0 + ipi /2.
24126 <li> cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
24127 <li> cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
24128 floating-point exception, for finite x.
24129 <li> cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
24130 <li> cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
24131 <li> cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
24132 <li> cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
24133 <li> cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
24134 <!--page 487 -->
24135 <li> cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
24136 floating-point exception, for finite y.
24137 <li> cacosh(NaN + i (inf)) returns +(inf) + iNaN.
24138 <li> cacosh(NaN + iNaN) returns NaN + iNaN.
24139 </ul>
24141 <p><small><a href="#Contents">Contents</a></small>
24142 <h5><a name="G.6.2.2" href="#G.6.2.2">G.6.2.2 The casinh functions</a></h5>
24143 <p><a name="G.6.2.2p1" href="#G.6.2.2p1"><small>1</small></a>
24144 <ul>
24145 <li> casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
24146 <li> casinh(+0 + i0) returns 0 + i0.
24147 <li> casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
24148 <li> casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
24149 floating-point exception, for finite x.
24150 <li> casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
24151 <li> casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
24152 <li> casinh(+(inf) + iNaN) returns +(inf) + iNaN.
24153 <li> casinh(NaN + i0) returns NaN + i0.
24154 <li> casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
24155 floating-point exception, for finite nonzero y.
24156 <li> casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
24157 is unspecified).
24158 <li> casinh(NaN + iNaN) returns NaN + iNaN.
24159 </ul>
24161 <p><small><a href="#Contents">Contents</a></small>
24162 <h5><a name="G.6.2.3" href="#G.6.2.3">G.6.2.3 The catanh functions</a></h5>
24163 <p><a name="G.6.2.3p1" href="#G.6.2.3p1"><small>1</small></a>
24164 <ul>
24165 <li> catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
24166 <li> catanh(+0 + i0) returns +0 + i0.
24167 <li> catanh(+0 + iNaN) returns +0 + iNaN.
24168 <li> catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
24169 exception.
24170 <li> catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
24171 <li> catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
24172 floating-point exception, for nonzero finite x.
24173 <li> catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
24174 <li> catanh(+(inf) + i (inf)) returns +0 + ipi /2.
24175 <li> catanh(+(inf) + iNaN) returns +0 + iNaN.
24176 <!--page 488 -->
24177 <li> catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
24178 floating-point exception, for finite y.
24179 <li> catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
24180 unspecified).
24181 <li> catanh(NaN + iNaN) returns NaN + iNaN.
24182 </ul>
24184 <p><small><a href="#Contents">Contents</a></small>
24185 <h5><a name="G.6.2.4" href="#G.6.2.4">G.6.2.4 The ccosh functions</a></h5>
24186 <p><a name="G.6.2.4p1" href="#G.6.2.4p1"><small>1</small></a>
24187 <ul>
24188 <li> ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
24189 <li> ccosh(+0 + i0) returns 1 + i0.
24190 <li> ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
24191 result is unspecified) and raises the ''invalid'' floating-point exception.
24192 <li> ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
24193 result is unspecified).
24194 <li> ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
24195 exception, for finite nonzero x.
24196 <li> ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24197 point exception, for finite nonzero x.
24198 <li> ccosh(+(inf) + i0) returns +(inf) + i0.
24199 <li> ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
24200 <li> ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
24201 unspecified) and raises the ''invalid'' floating-point exception.
24202 <li> ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
24203 <li> ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
24204 result is unspecified).
24205 <li> ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24206 point exception, for all nonzero numbers y.
24207 <li> ccosh(NaN + iNaN) returns NaN + iNaN.
24208 </ul>
24210 <p><small><a href="#Contents">Contents</a></small>
24211 <h5><a name="G.6.2.5" href="#G.6.2.5">G.6.2.5 The csinh functions</a></h5>
24212 <p><a name="G.6.2.5p1" href="#G.6.2.5p1"><small>1</small></a>
24213 <ul>
24214 <li> csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
24215 <li> csinh(+0 + i0) returns +0 + i0.
24216 <li> csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
24217 unspecified) and raises the ''invalid'' floating-point exception.
24218 <li> csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
24219 unspecified).
24220 <!--page 489 -->
24221 <li> csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
24222 exception, for positive finite x.
24223 <li> csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24224 point exception, for finite nonzero x.
24225 <li> csinh(+(inf) + i0) returns +(inf) + i0.
24226 <li> csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
24227 <li> csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
24228 unspecified) and raises the ''invalid'' floating-point exception.
24229 <li> csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
24230 is unspecified).
24231 <li> csinh(NaN + i0) returns NaN + i0.
24232 <li> csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24233 point exception, for all nonzero numbers y.
24234 <li> csinh(NaN + iNaN) returns NaN + iNaN.
24235 </ul>
24237 <p><small><a href="#Contents">Contents</a></small>
24238 <h5><a name="G.6.2.6" href="#G.6.2.6">G.6.2.6 The ctanh functions</a></h5>
24239 <p><a name="G.6.2.6p1" href="#G.6.2.6p1"><small>1</small></a>
24240 <ul>
24241 <li> ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
24242 <li> ctanh(+0 + i0) returns +0 + i0.
24243 <li> ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
24244 exception, for finite x.
24245 <li> ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24246 point exception, for finite x.
24247 <li> ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
24248 <li> ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
24249 is unspecified).
24250 <li> ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
24251 result is unspecified).
24252 <li> ctanh(NaN + i0) returns NaN + i0.
24253 <li> ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24254 point exception, for all nonzero numbers y.
24255 <li> ctanh(NaN + iNaN) returns NaN + iNaN.
24256 <!--page 490 -->
24257 </ul>
24259 <p><small><a href="#Contents">Contents</a></small>
24260 <h4><a name="G.6.3" href="#G.6.3">G.6.3 Exponential and logarithmic functions</a></h4>
24262 <p><small><a href="#Contents">Contents</a></small>
24263 <h5><a name="G.6.3.1" href="#G.6.3.1">G.6.3.1 The cexp functions</a></h5>
24264 <p><a name="G.6.3.1p1" href="#G.6.3.1p1"><small>1</small></a>
24265 <ul>
24266 <li> cexp(conj(z)) = conj(cexp(z)).
24267 <li> cexp((+-)0 + i0) returns 1 + i0.
24268 <li> cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
24269 exception, for finite x.
24270 <li> cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24271 point exception, for finite x.
24272 <li> cexp(+(inf) + i0) returns +(inf) + i0.
24273 <li> cexp(-(inf) + iy) returns +0 cis(y), for finite y.
24274 <li> cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
24275 <li> cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
24276 the result are unspecified).
24277 <li> cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
24278 exception (where the sign of the real part of the result is unspecified).
24279 <li> cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
24280 of the result are unspecified).
24281 <li> cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
24282 is unspecified).
24283 <li> cexp(NaN + i0) returns NaN + i0.
24284 <li> cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24285 point exception, for all nonzero numbers y.
24286 <li> cexp(NaN + iNaN) returns NaN + iNaN.
24287 </ul>
24289 <p><small><a href="#Contents">Contents</a></small>
24290 <h5><a name="G.6.3.2" href="#G.6.3.2">G.6.3.2 The clog functions</a></h5>
24291 <p><a name="G.6.3.2p1" href="#G.6.3.2p1"><small>1</small></a>
24292 <ul>
24293 <li> clog(conj(z)) = conj(clog(z)).
24294 <li> clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
24295 exception.
24296 <li> clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
24297 exception.
24298 <li> clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
24299 <li> clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24300 point exception, for finite x.
24301 <!--page 491 -->
24302 <li> clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
24303 <li> clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
24304 <li> clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
24305 <li> clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
24306 <li> clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
24307 <li> clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24308 point exception, for finite y.
24309 <li> clog(NaN + i (inf)) returns +(inf) + iNaN.
24310 <li> clog(NaN + iNaN) returns NaN + iNaN.
24311 </ul>
24313 <p><small><a href="#Contents">Contents</a></small>
24314 <h4><a name="G.6.4" href="#G.6.4">G.6.4 Power and absolute-value functions</a></h4>
24316 <p><small><a href="#Contents">Contents</a></small>
24317 <h5><a name="G.6.4.1" href="#G.6.4.1">G.6.4.1 The cpow functions</a></h5>
24318 <p><a name="G.6.4.1p1" href="#G.6.4.1p1"><small>1</small></a>
24319 The cpow functions raise floating-point exceptions if appropriate for the calculation of
24320 the parts of the result, and may raise spurious exceptions.<sup><a href="#note327"><b>327)</b></a></sup>
24322 <p><b>Footnotes</b>
24323 <p><small><a name="note327" href="#note327">327)</a> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
24324 implementations that treat special cases more carefully.
24325 </small>
24327 <p><small><a href="#Contents">Contents</a></small>
24328 <h5><a name="G.6.4.2" href="#G.6.4.2">G.6.4.2 The csqrt functions</a></h5>
24329 <p><a name="G.6.4.2p1" href="#G.6.4.2p1"><small>1</small></a>
24330 <ul>
24331 <li> csqrt(conj(z)) = conj(csqrt(z)).
24332 <li> csqrt((+-)0 + i0) returns +0 + i0.
24333 <li> csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
24334 <li> csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24335 point exception, for finite x.
24336 <li> csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
24337 <li> csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
24338 <li> csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
24339 result is unspecified).
24340 <li> csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
24341 <li> csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
24342 point exception, for finite y.
24343 <li> csqrt(NaN + iNaN) returns NaN + iNaN.
24348 <!--page 492 -->
24349 </ul>
24351 <p><small><a href="#Contents">Contents</a></small>
24352 <h3><a name="G.7" href="#G.7">G.7 Type-generic math &lt;tgmath.h&gt;</a></h3>
24353 <p><a name="G.7p1" href="#G.7p1"><small>1</small></a>
24354 Type-generic macros that accept complex arguments also accept imaginary arguments. If
24355 an argument is imaginary, the macro expands to an expression whose type is real,
24356 imaginary, or complex, as appropriate for the particular function: if the argument is
24357 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
24358 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
24359 the types of the others are complex.
24360 <p><a name="G.7p2" href="#G.7p2"><small>2</small></a>
24361 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
24362 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
24363 functions:
24364 <!--page 493 -->
24365 <pre>
24366 cos(iy) = cosh(y)
24367 sin(iy) = i sinh(y)
24368 tan(iy) = i tanh(y)
24369 cosh(iy) = cos(y)
24370 sinh(iy) = i sin(y)
24371 tanh(iy) = i tan(y)
24372 asin(iy) = i asinh(y)
24373 atan(iy) = i atanh(y)
24374 asinh(iy) = i asin(y)
24375 atanh(iy) = i atan(y)
24376 </pre>
24378 <p><small><a href="#Contents">Contents</a></small>
24379 <h2><a name="H" href="#H">Annex H</a></h2>
24380 <pre>
24381 (informative)
24382 Language independent arithmetic
24383 </pre>
24385 <p><small><a href="#Contents">Contents</a></small>
24386 <h3><a name="H.1" href="#H.1">H.1 Introduction</a></h3>
24387 <p><a name="H.1p1" href="#H.1p1"><small>1</small></a>
24388 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
24389 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
24390 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
24392 <p><small><a href="#Contents">Contents</a></small>
24393 <h3><a name="H.2" href="#H.2">H.2 Types</a></h3>
24394 <p><a name="H.2p1" href="#H.2p1"><small>1</small></a>
24395 The relevant C arithmetic types meet the requirements of LIA-1 types if an
24396 implementation adds notification of exceptional arithmetic operations and meets the 1
24397 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
24399 <p><small><a href="#Contents">Contents</a></small>
24400 <h4><a name="H.2.1" href="#H.2.1">H.2.1 Boolean type</a></h4>
24401 <p><a name="H.2.1p1" href="#H.2.1p1"><small>1</small></a>
24402 The LIA-1 data type Boolean is implemented by the C data type bool with values of
24403 true and false, all from <a href="#7.16">&lt;stdbool.h&gt;</a>.
24405 <p><small><a href="#Contents">Contents</a></small>
24406 <h4><a name="H.2.2" href="#H.2.2">H.2.2 Integer types</a></h4>
24407 <p><a name="H.2.2p1" href="#H.2.2p1"><small>1</small></a>
24408 The signed C integer types int, long int, long long int, and the corresponding
24409 unsigned types are compatible with LIA-1. If an implementation adds support for the
24410 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
24411 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
24412 in that overflows or out-of-bounds results silently wrap. An implementation that defines
24413 signed integer types as also being modulo need not detect integer overflow, in which case,
24414 only integer divide-by-zero need be detected.
24415 <p><a name="H.2.2p2" href="#H.2.2p2"><small>2</small></a>
24416 The parameters for the integer data types can be accessed by the following:
24417 <pre>
24418 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
24419 ULLONG_MAX
24420 minint INT_MIN, LONG_MIN, LLONG_MIN
24421 </pre>
24422 <p><a name="H.2.2p3" href="#H.2.2p3"><small>3</small></a>
24423 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
24424 is always 0 for the unsigned types, and is not provided for those types.
24425 <!--page 494 -->
24427 <p><small><a href="#Contents">Contents</a></small>
24428 <h5><a name="H.2.2.1" href="#H.2.2.1">H.2.2.1 Integer operations</a></h5>
24429 <p><a name="H.2.2.1p1" href="#H.2.2.1p1"><small>1</small></a>
24430 The integer operations on integer types are the following:
24431 <pre>
24432 addI x + y
24433 subI x - y
24434 mulI x * y
24435 divI, divtI x / y
24436 remI, remtI x % y
24437 negI -x
24438 absI abs(x), labs(x), llabs(x)
24439 eqI x == y
24440 neqI x != y
24441 lssI x &lt; y
24442 leqI x &lt;= y
24443 gtrI x &gt; y
24444 geqI x &gt;= y
24445 </pre>
24446 where x and y are expressions of the same integer type.
24448 <p><small><a href="#Contents">Contents</a></small>
24449 <h4><a name="H.2.3" href="#H.2.3">H.2.3 Floating-point types</a></h4>
24450 <p><a name="H.2.3p1" href="#H.2.3p1"><small>1</small></a>
24451 The C floating-point types float, double, and long double are compatible with
24452 LIA-1. If an implementation adds support for the LIA-1 exceptional values
24453 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
24454 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
24455 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
24456 conformant types.
24458 <p><small><a href="#Contents">Contents</a></small>
24459 <h5><a name="H.2.3.1" href="#H.2.3.1">H.2.3.1 Floating-point parameters</a></h5>
24460 <p><a name="H.2.3.1p1" href="#H.2.3.1p1"><small>1</small></a>
24461 The parameters for a floating point data type can be accessed by the following:
24462 <pre>
24463 r FLT_RADIX
24464 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
24465 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
24466 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
24467 </pre>
24468 <p><a name="H.2.3.1p2" href="#H.2.3.1p2"><small>2</small></a>
24469 The derived constants for the floating point types are accessed by the following:
24470 <!--page 495 -->
24471 <pre>
24472 fmax FLT_MAX, DBL_MAX, LDBL_MAX
24473 fminN FLT_MIN, DBL_MIN, LDBL_MIN
24474 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
24475 rnd_style FLT_ROUNDS
24476 </pre>
24478 <p><small><a href="#Contents">Contents</a></small>
24479 <h5><a name="H.2.3.2" href="#H.2.3.2">H.2.3.2 Floating-point operations</a></h5>
24480 <p><a name="H.2.3.2p1" href="#H.2.3.2p1"><small>1</small></a>
24481 The floating-point operations on floating-point types are the following:
24482 <pre>
24483 addF x + y
24484 subF x - y
24485 mulF x * y
24486 divF x / y
24487 negF -x
24488 absF fabsf(x), fabs(x), fabsl(x)
24489 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
24490 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
24491 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
24492 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
24493 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
24494 eqF x == y
24495 neqF x != y
24496 lssF x &lt; y
24497 leqF x &lt;= y
24498 gtrF x &gt; y
24499 geqF x &gt;= y
24500 </pre>
24501 where x and y are expressions of the same floating point type, n is of type int, and li
24502 is of type long int.
24504 <p><small><a href="#Contents">Contents</a></small>
24505 <h5><a name="H.2.3.3" href="#H.2.3.3">H.2.3.3 Rounding styles</a></h5>
24506 <p><a name="H.2.3.3p1" href="#H.2.3.3p1"><small>1</small></a>
24507 The C Standard requires all floating types to use the same radix and rounding style, so
24508 that only one identifier for each is provided to map to LIA-1.
24509 <p><a name="H.2.3.3p2" href="#H.2.3.3p2"><small>2</small></a>
24510 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
24511 <pre>
24512 truncate FLT_ROUNDS == 0
24513 <!--page 496 -->
24514 nearest FLT_ROUNDS == 1
24515 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
24516 </pre>
24517 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
24518 in all relevant LIA-1 operations, not just addition as in C.
24520 <p><small><a href="#Contents">Contents</a></small>
24521 <h4><a name="H.2.4" href="#H.2.4">H.2.4 Type conversions</a></h4>
24522 <p><a name="H.2.4p1" href="#H.2.4p1"><small>1</small></a>
24523 The LIA-1 type conversions are the following type casts:
24524 <pre>
24525 cvtI' -&gt; I (int)i, (long int)i, (long long int)i,
24526 (unsigned int)i, (unsigned long int)i,
24527 (unsigned long long int)i
24528 cvtF -&gt; I (int)x, (long int)x, (long long int)x,
24529 (unsigned int)x, (unsigned long int)x,
24530 (unsigned long long int)x
24531 cvtI -&gt; F (float)i, (double)i, (long double)i
24532 cvtF' -&gt; F (float)x, (double)x, (long double)x
24533 </pre>
24534 <p><a name="H.2.4p2" href="#H.2.4p2"><small>2</small></a>
24535 In the above conversions from floating to integer, the use of (cast)x can be replaced with
24536 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
24537 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
24538 conversion functions, lrint(), llrint(), lround(), and llround(), can be
24539 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
24540 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
24541 <p><a name="H.2.4p3" href="#H.2.4p3"><small>3</small></a>
24542 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
24543 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
24544 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
24545 to 65535.0 which can then be cast to unsigned short int. But, the
24546 remainder() function is not useful for doing silent wrapping to signed integer types,
24547 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
24548 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
24549 int.
24550 <p><a name="H.2.4p4" href="#H.2.4p4"><small>4</small></a>
24551 C's conversions (casts) from floating-point to floating-point can meet LIA-1
24552 requirements if an implementation uses round-to-nearest (IEC 60559 default).
24553 <p><a name="H.2.4p5" href="#H.2.4p5"><small>5</small></a>
24554 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
24555 implementation uses round-to-nearest.
24556 <!--page 497 -->
24558 <p><small><a href="#Contents">Contents</a></small>
24559 <h3><a name="H.3" href="#H.3">H.3 Notification</a></h3>
24560 <p><a name="H.3p1" href="#H.3p1"><small>1</small></a>
24561 Notification is the process by which a user or program is informed that an exceptional
24562 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
24563 allows an implementation to cause a notification to occur when any arithmetic operation
24564 returns an exceptional value as defined in LIA-1 clause 5.
24566 <p><small><a href="#Contents">Contents</a></small>
24567 <h4><a name="H.3.1" href="#H.3.1">H.3.1 Notification alternatives</a></h4>
24568 <p><a name="H.3.1p1" href="#H.3.1p1"><small>1</small></a>
24569 LIA-1 requires at least the following two alternatives for handling of notifications:
24570 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
24571 resume.
24572 <p><a name="H.3.1p2" href="#H.3.1p2"><small>2</small></a>
24573 An implementation need only support a given notification alternative for the entire
24574 program. An implementation may support the ability to switch between notification
24575 alternatives during execution, but is not required to do so. An implementation can
24576 provide separate selection for each kind of notification, but this is not required.
24577 <p><a name="H.3.1p3" href="#H.3.1p3"><small>3</small></a>
24578 C allows an implementation to provide notification. C's SIGFPE (for traps) and
24579 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
24580 can provide LIA-1 notification.
24581 <p><a name="H.3.1p4" href="#H.3.1p4"><small>4</small></a>
24582 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
24583 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
24584 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
24585 and-resume behavior with the same constraint.
24587 <p><small><a href="#Contents">Contents</a></small>
24588 <h5><a name="H.3.1.1" href="#H.3.1.1">H.3.1.1 Indicators</a></h5>
24589 <p><a name="H.3.1.1p1" href="#H.3.1.1p1"><small>1</small></a>
24590 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
24591 <p><a name="H.3.1.1p2" href="#H.3.1.1p2"><small>2</small></a>
24592 The following mapping is for floating-point types:
24593 <pre>
24594 undefined FE_INVALID, FE_DIVBYZERO
24595 floating_overflow FE_OVERFLOW
24596 underflow FE_UNDERFLOW
24597 </pre>
24598 <p><a name="H.3.1.1p3" href="#H.3.1.1p3"><small>3</small></a>
24599 The floating-point indicator interrogation and manipulation operations are:
24600 <pre>
24601 set_indicators feraiseexcept(i)
24602 clear_indicators feclearexcept(i)
24603 test_indicators fetestexcept(i)
24604 current_indicators fetestexcept(FE_ALL_EXCEPT)
24605 </pre>
24606 where i is an expression of type int representing a subset of the LIA-1 indicators.
24607 <p><a name="H.3.1.1p4" href="#H.3.1.1p4"><small>4</small></a>
24608 C allows an implementation to provide the following LIA-1 required behavior: at
24609 program termination if any indicator is set the implementation shall send an unambiguous
24610 <!--page 498 -->
24611 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
24612 <p><a name="H.3.1.1p5" href="#H.3.1.1p5"><small>5</small></a>
24613 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
24614 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
24615 point indicators.
24617 <p><small><a href="#Contents">Contents</a></small>
24618 <h5><a name="H.3.1.2" href="#H.3.1.2">H.3.1.2 Traps</a></h5>
24619 <p><a name="H.3.1.2p1" href="#H.3.1.2p1"><small>1</small></a>
24620 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
24621 math library functions (which are not permitted to generate any externally visible
24622 exceptional conditions). An implementation can provide an alternative of notification
24623 through termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
24624 <p><a name="H.3.1.2p2" href="#H.3.1.2p2"><small>2</small></a>
24625 LIA-1 does not require that traps be precise.
24626 <p><a name="H.3.1.2p3" href="#H.3.1.2p3"><small>3</small></a>
24627 C does require that SIGFPE be the signal corresponding to arithmetic exceptions, if there
24628 is any signal raised for them.
24629 <p><a name="H.3.1.2p4" href="#H.3.1.2p4"><small>4</small></a>
24630 C supports signal handlers for SIGFPE and allows trapping of arithmetic exceptions.
24631 When arithmetic exceptions do trap, C's signal-handler mechanism allows trap-and-
24632 terminate (either default implementation behavior or user replacement for it) or trap-and-
24633 resume, at the programmer's option.
24634 <!--page 499 -->
24636 <p><small><a href="#Contents">Contents</a></small>
24637 <h2><a name="I" href="#I">Annex I</a></h2>
24638 <pre>
24639 (informative)
24640 Common warnings
24641 </pre>
24642 <p><a name="Ip1" href="#Ip1"><small>1</small></a>
24643 An implementation may generate warnings in many situations, none of which are
24644 specified as part of this International Standard. The following are a few of the more
24645 common situations.
24646 <p><a name="Ip2" href="#Ip2"><small>2</small></a>
24647 <ul>
24648 <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>).
24649 <li> A block with initialization of an object that has automatic storage duration is jumped
24650 into (<a href="#6.2.4">6.2.4</a>).
24651 <li> An implicit narrowing conversion is encountered, such as the assignment of a long
24652 int or a double to an int, or a pointer to void to a pointer to any type other than
24653 a character type (<a href="#6.3">6.3</a>).
24654 <li> A hexadecimal floating constant cannot be represented exactly in its evaluation format
24655 (<a href="#6.4.4.2">6.4.4.2</a>).
24656 <li> An integer character constant includes more than one character or a wide character
24657 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
24658 <li> The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
24659 <li> An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
24660 lvalue in one operand, and a side effect to, or an access to the value of, the identical
24661 lvalue in the other operand (<a href="#6.5">6.5</a>).
24662 <li> A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
24663 <li> The arguments in a function call do not agree in number and type with those of the
24664 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
24665 <li> An object is defined but not used (<a href="#6.7">6.7</a>).
24666 <li> A value is given to an object of an enumerated type other than by assignment of an
24667 enumeration constant that is a member of that type, or an enumeration object that has
24668 the same type, or the value of a function that returns the same enumerated type
24669 (<a href="#6.7.2.2">6.7.2.2</a>).
24670 <li> An aggregate has a partly bracketed initialization (<a href="#6.7.7">6.7.7</a>).
24671 <li> A statement cannot be reached (<a href="#6.8">6.8</a>).
24672 <li> A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
24673 <li> A constant expression is used as the controlling expression of a selection statement
24674 (<a href="#6.8.4">6.8.4</a>).
24675 <!--page 500 -->
24676 <li> An incorrectly formed preprocessing group is encountered while skipping a
24677 preprocessing group (<a href="#6.10.1">6.10.1</a>).
24678 <li> An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
24679 <!--page 501 -->
24680 </ul>
24682 <p><small><a href="#Contents">Contents</a></small>
24683 <h2><a name="J" href="#J">Annex J</a></h2>
24684 <pre>
24685 (informative)
24686 Portability issues
24687 </pre>
24688 <p><a name="Jp1" href="#Jp1"><small>1</small></a>
24689 This annex collects some information about portability that appears in this International
24690 Standard.
24692 <p><small><a href="#Contents">Contents</a></small>
24693 <h3><a name="J.1" href="#J.1">J.1 Unspecified behavior</a></h3>
24694 <p><a name="J.1p1" href="#J.1p1"><small>1</small></a>
24695 The following are unspecified:
24696 <ul>
24697 <li> The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
24698 <li> The termination status returned to the hosted environment if the return type of main
24699 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
24700 <li> The behavior of the display device if a printing character is written when the active
24701 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
24702 <li> The behavior of the display device if a backspace character is written when the active
24703 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
24704 <li> The behavior of the display device if a horizontal tab character is written when the
24705 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
24706 <li> The behavior of the display device if a vertical tab character is written when the active
24707 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
24708 <li> How an extended source character that does not correspond to a universal character
24709 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
24710 <li> Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
24711 <li> The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
24712 <li> The value of a union member other than the last one stored into (<a href="#6.2.6.1">6.2.6.1</a>).
24713 <li> The representation used when storing a value in an object that has more than one
24714 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
24715 <li> The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
24716 <li> Whether certain operators can generate negative zeros and whether a negative zero
24717 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
24718 <li> Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
24719 <li> The order in which subexpressions are evaluated and the order in which side effects
24720 take place, except as specified for the function-call (), &amp;&amp;, ||, ?:, and comma
24721 operators (<a href="#6.5">6.5</a>).
24722 <!--page 502 -->
24723 <li> The order in which the function designator, arguments, and subexpressions within the
24724 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
24725 <li> The order of side effects among compound literal initialization list expressions
24726 (<a href="#6.5.2.5">6.5.2.5</a>).
24727 <li> The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
24728 <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>).
24729 <li> Whether a call to an inline function uses the inline definition or the external definition
24730 of the function (<a href="#6.7.4">6.7.4</a>).
24731 <li> Whether or not a size expression is evaluated when it is part of the operand of a
24732 sizeof operator and changing the value of the size expression would not affect the
24733 result of the operator (<a href="#6.7.5.2">6.7.5.2</a>).
24734 <li> The order in which any side effects occur among the initialization list expressions in
24735 an initializer (<a href="#6.7.8">6.7.8</a>).
24736 <li> The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
24737 <li> When a fully expanded macro replacement list contains a function-like macro name
24738 as its last preprocessing token and the next preprocessing token from the source file is
24739 a (, and the fully expanded replacement of that macro ends with the name of the first
24740 macro and the next preprocessing token from the source file is again a (, whether that
24741 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
24742 <li> The order in which # and ## operations are evaluated during macro substitution
24743 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
24744 <li> Whether errno is a macro or an identifier with external linkage (<a href="#7.5">7.5</a>).
24745 <li> The state of the floating-point status flags when execution passes from a part of the
24746 program translated with FENV_ACCESS ''off'' to a part translated with
24747 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
24748 <li> The order in which feraiseexcept raises floating-point exceptions, except as
24749 stated in <a href="#F.7.6">F.7.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
24750 <li> Whether math_errhandling is a macro or an identifier with external linkage
24751 (<a href="#7.12">7.12</a>).
24752 <li> The results of the frexp functions when the specified value is not a floating-point
24753 number (<a href="#7.12.6.4">7.12.6.4</a>).
24754 <li> The numeric result of the ilogb functions when the correct value is outside the
24755 range of the return type (<a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.9.3.5">F.9.3.5</a>).
24756 <li> The result of rounding when the value is out of range (<a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.5">F.9.6.5</a>).
24757 <!--page 503 -->
24758 <li> The value stored by the remquo functions in the object pointed to by quo when y is
24759 zero (<a href="#7.12.10.3">7.12.10.3</a>).
24760 <li> Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
24761 <li> Whether va_copy and va_end are macros or identifiers with external linkage
24762 (<a href="#7.15.1">7.15.1</a>).
24763 <li> The hexadecimal digit before the decimal point when a non-normalized floating-point
24764 number is printed with an a or A conversion specifier (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
24765 <li> The value of the file position indicator after a successful call to the ungetc function
24766 for a text stream, or the ungetwc function for any stream, until all pushed-back
24767 characters are read or discarded (<a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.3.10">7.24.3.10</a>).
24768 <li> The details of the value stored by the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>).
24769 <li> The details of the value returned by the ftell function for a text stream (<a href="#7.19.9.4">7.19.9.4</a>).
24770 <li> Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
24771 functions convert a minus-signed sequence to a negative number directly or by
24772 negating the value resulting from converting the corresponding unsigned sequence
24773 (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
24774 <li> The order and contiguity of storage allocated by successive calls to the calloc,
24775 malloc, and realloc functions (<a href="#7.20.3">7.20.3</a>).
24776 <li> The amount of storage allocated by a successful call to the calloc, malloc, or
24777 realloc function when 0 bytes was requested (<a href="#7.20.3">7.20.3</a>).
24778 <li> Which of two elements that compare as equal is matched by the bsearch function
24779 (<a href="#7.20.5.1">7.20.5.1</a>).
24780 <li> The order of two elements that compare as equal in an array sorted by the qsort
24781 function (<a href="#7.20.5.2">7.20.5.2</a>).
24782 <li> The encoding of the calendar time returned by the time function (<a href="#7.23.2.4">7.23.2.4</a>).
24783 <li> The characters stored by the strftime or wcsftime function if any of the time
24784 values being converted is outside the normal range (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
24785 <li> The conversion state after an encoding error occurs (<a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>,
24786 <a href="#7.24.6.4.2">7.24.6.4.2</a>,
24787 <li> The resulting value when the ''invalid'' floating-point exception is raised during
24788 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
24789 <li> Whether conversion of non-integer IEC 60559 floating values to integer raises the
24790 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
24791 <!--page 504 -->
24792 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
24793 exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
24794 <li> Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
24795 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
24796 <li> The exponent value stored by frexp for a NaN or infinity (<a href="#F.9.3.4">F.9.3.4</a>).
24797 <li> The numeric result returned by the lrint, llrint, lround, and llround
24798 functions if the rounded value is outside the range of the return type (<a href="#F.9.6.5">F.9.6.5</a>, <a href="#F.9.6.7">F.9.6.7</a>).
24799 <li> The sign of one part of the complex result of several math functions for certain
24800 exceptional values in IEC 60559 compatible implementations (<a href="#G.6.1.1">G.6.1.1</a>, <a href="#G.6.2.2">G.6.2.2</a>,
24801 <a href="#G.6.2.3">G.6.2.3</a>, <a href="#G.6.2.4">G.6.2.4</a>, <a href="#G.6.2.5">G.6.2.5</a>, <a href="#G.6.2.6">G.6.2.6</a>, <a href="#G.6.3.1">G.6.3.1</a>, <a href="#G.6.4.2">G.6.4.2</a>).
24802 </ul>
24804 <p><small><a href="#Contents">Contents</a></small>
24805 <h3><a name="J.2" href="#J.2">J.2 Undefined behavior</a></h3>
24806 <p><a name="J.2p1" href="#J.2p1"><small>1</small></a>
24807 The behavior is undefined in the following circumstances:
24808 <ul>
24809 <li> A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
24810 (clause 4).
24811 <li> A nonempty source file does not end in a new-line character which is not immediately
24812 preceded by a backslash character or ends in a partial preprocessing token or
24813 comment (<a href="#5.1.1.2">5.1.1.2</a>).
24814 <li> Token concatenation produces a character sequence matching the syntax of a
24815 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
24816 <li> A program in a hosted environment does not define a function named main using one
24817 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
24818 <li> A character not in the basic source character set is encountered in a source file, except
24819 in an identifier, a character constant, a string literal, a header name, a comment, or a
24820 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
24821 <li> An identifier, comment, string literal, character constant, or header name contains an
24822 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>).
24823 <li> The same identifier has both internal and external linkage in the same translation unit
24824 (<a href="#6.2.2">6.2.2</a>).
24825 <li> An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
24826 <li> The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
24827 <li> The value of an object with automatic storage duration is used while it is
24828 indeterminate (<a href="#6.2.4">6.2.4</a>, <a href="#6.7.8">6.7.8</a>, <a href="#6.8">6.8</a>).
24829 <li> A trap representation is read by an lvalue expression that does not have character type
24830 (<a href="#6.2.6.1">6.2.6.1</a>).
24831 <!--page 505 -->
24832 <li> A trap representation is produced by a side effect that modifies any part of the object
24833 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
24834 <li> The arguments to certain operators are such that could produce a negative zero result,
24835 but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
24836 <li> Two declarations of the same object or function specify types that are not compatible
24837 (<a href="#6.2.7">6.2.7</a>).
24838 <li> Conversion to or from an integer type produces a value outside the range that can be
24839 represented (<a href="#6.3.1.4">6.3.1.4</a>).
24840 <li> Demotion of one real floating type to another produces a value outside the range that
24841 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
24842 <li> An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
24843 <li> A non-array lvalue with an incomplete type is used in a context that requires the value
24844 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
24845 <li> An lvalue having array type is converted to a pointer to the initial element of the
24846 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
24847 <li> An attempt is made to use the value of a void expression, or an implicit or explicit
24848 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
24849 <li> Conversion of a pointer to an integer type produces a value outside the range that can
24850 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
24851 <li> Conversion between two pointer types produces a result that is incorrectly aligned
24852 (<a href="#6.3.2.3">6.3.2.3</a>).
24853 <li> A pointer is used to call a function whose type is not compatible with the pointed-to
24854 type (<a href="#6.3.2.3">6.3.2.3</a>).
24855 <li> An unmatched ' or " character is encountered on a logical source line during
24856 tokenization (<a href="#6.4">6.4</a>).
24857 <li> A reserved keyword token is used in translation phase 7 or 8 for some purpose other
24858 than as a keyword (<a href="#6.4.1">6.4.1</a>).
24859 <li> A universal character name in an identifier does not designate a character whose
24860 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
24861 <li> The initial character of an identifier is a universal character name designating a digit
24862 (<a href="#6.4.2.1">6.4.2.1</a>).
24863 <li> Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
24864 <li> The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
24865 <!--page 506 -->
24866 <li> The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
24867 <li> The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
24868 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
24869 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
24870 <li> Between two sequence points, an object is modified more than once, or is modified
24871 and the prior value is read other than to determine the value to be stored (<a href="#6.5">6.5</a>).
24872 <li> An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
24873 <li> An object has its stored value accessed other than by an lvalue of an allowable type
24874 (<a href="#6.5">6.5</a>).
24875 <li> An attempt is made to modify the result of a function call, a conditional operator, an
24876 assignment operator, or a comma operator, or to access it after the next sequence
24877 point (<a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.15">6.5.15</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.5.17">6.5.17</a>).
24878 <li> For a call to a function without a function prototype in scope, the number of
24879 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
24880 <li> For call to a function without a function prototype in scope where the function is
24881 defined with a function prototype, either the prototype ends with an ellipsis or the
24882 types of the arguments after promotion are not compatible with the types of the
24883 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
24884 <li> For a call to a function without a function prototype in scope where the function is not
24885 defined with a function prototype, the types of the arguments after promotion are not
24886 compatible with those of the parameters after promotion (with certain exceptions)
24887 (<a href="#6.5.2.2">6.5.2.2</a>).
24888 <li> A function is defined with a type that is not compatible with the type (of the
24889 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
24890 <li> The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
24891 <li> A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
24892 <li> The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
24893 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
24894 integer type produces a result that does not point into, or just beyond, the same array
24895 object (<a href="#6.5.6">6.5.6</a>).
24896 <li> Addition or subtraction of a pointer into, or just beyond, an array object and an
24897 integer type produces a result that points just beyond the array object and is used as
24898 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
24899 <li> Pointers that do not point into, or just beyond, the same array object are subtracted
24900 (<a href="#6.5.6">6.5.6</a>).
24901 <!--page 507 -->
24902 <li> An array subscript is out of range, even if an object is apparently accessible with the
24903 given subscript (as in the lvalue expression a[1][7] given the declaration int
24904 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
24905 <li> The result of subtracting two pointers is not representable in an object of type
24906 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
24907 <li> An expression is shifted by a negative number or by an amount greater than or equal
24908 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
24909 <li> An expression having signed promoted type is left-shifted and either the value of the
24910 expression is negative or the result of shifting would be not be representable in the
24911 promoted type (<a href="#6.5.7">6.5.7</a>).
24912 <li> Pointers that do not point to the same aggregate or union (nor just beyond the same
24913 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
24914 <li> An object is assigned to an inexactly overlapping object or to an exactly overlapping
24915 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
24916 <li> An expression that is required to be an integer constant expression does not have an
24917 integer type; has operands that are not integer constants, enumeration constants,
24918 character constants, sizeof expressions whose results are integer constants, or
24919 immediately-cast floating constants; or contains casts (outside operands to sizeof
24920 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
24921 <li> A constant expression in an initializer is not, or does not evaluate to, one of the
24922 following: an arithmetic constant expression, a null pointer constant, an address
24923 constant, or an address constant for an object type plus or minus an integer constant
24924 expression (<a href="#6.6">6.6</a>).
24925 <li> An arithmetic constant expression does not have arithmetic type; has operands that
24926 are not integer constants, floating constants, enumeration constants, character
24927 constants, or sizeof expressions; or contains casts (outside operands to sizeof
24928 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
24929 <li> The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
24930 address &amp;, or indirection * operator or a pointer cast in creating an address constant
24931 (<a href="#6.6">6.6</a>).
24932 <li> An identifier for an object is declared with no linkage and the type of the object is
24933 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
24934 <li> A function is declared at block scope with an explicit storage-class specifier other
24935 than extern (<a href="#6.7.1">6.7.1</a>).
24936 <li> A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
24937 <!--page 508 -->
24938 <li> An attempt is made to access, or generate a pointer to just past, a flexible array
24939 member of a structure when the referenced object provides no elements for that array
24940 (<a href="#6.7.2.1">6.7.2.1</a>).
24941 <li> When the complete type is needed, an incomplete structure or union type is not
24942 completed in the same scope by another declaration of the tag that defines the content
24943 (<a href="#6.7.2.3">6.7.2.3</a>).
24944 <li> An attempt is made to modify an object defined with a const-qualified type through
24945 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
24946 <li> An attempt is made to refer to an object defined with a volatile-qualified type through
24947 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
24948 <li> The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
24949 <li> Two qualified types that are required to be compatible do not have the identically
24950 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
24951 <li> An object which has been modified is accessed through a restrict-qualified pointer to
24952 a const-qualified type, or through a restrict-qualified pointer and another pointer that
24953 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
24954 <li> A restrict-qualified pointer is assigned a value based on another restricted pointer
24955 whose associated block neither began execution before the block associated with this
24956 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
24957 <li> A function with external linkage is declared with an inline function specifier, but is
24958 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
24959 <li> Two pointer types that are required to be compatible are not identically qualified, or
24960 are not pointers to compatible types (<a href="#6.7.5.1">6.7.5.1</a>).
24961 <li> The size expression in an array declaration is not a constant expression and evaluates
24962 at program execution time to a nonpositive value (<a href="#6.7.5.2">6.7.5.2</a>).
24963 <li> In a context requiring two array types to be compatible, they do not have compatible
24964 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.5.2">6.7.5.2</a>).
24965 <li> A declaration of an array parameter includes the keyword static within the [ and
24966 ] and the corresponding argument does not provide access to the first element of an
24967 array with at least the specified number of elements (<a href="#6.7.5.3">6.7.5.3</a>).
24968 <li> A storage-class specifier or type qualifier modifies the keyword void as a function
24969 parameter type list (<a href="#6.7.5.3">6.7.5.3</a>).
24970 <li> In a context requiring two function types to be compatible, they do not have
24971 compatible return types, or their parameters disagree in use of the ellipsis terminator
24972 or the number and type of parameters (after default argument promotion, when there
24973 is no parameter type list or when one type is specified by a function definition with an
24974 <!--page 509 -->
24975 identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
24976 <li> The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
24977 <li> The initializer for a scalar is neither a single expression nor a single expression
24978 enclosed in braces (<a href="#6.7.8">6.7.8</a>).
24979 <li> The initializer for a structure or union object that has automatic storage duration is
24980 neither an initializer list nor a single expression that has compatible structure or union
24981 type (<a href="#6.7.8">6.7.8</a>).
24982 <li> The initializer for an aggregate or union, other than an array initialized by a string
24983 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.8">6.7.8</a>).
24984 <li> An identifier with external linkage is used, but in the program there does not exist
24985 exactly one external definition for the identifier, or the identifier is not used and there
24986 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
24987 <li> A function definition includes an identifier list, but the types of the parameters are not
24988 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
24989 <li> An adjusted parameter type in a function definition is not an object type (<a href="#6.9.1">6.9.1</a>).
24990 <li> A function that accepts a variable number of arguments is defined without a
24991 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
24992 <li> The } that terminates a function is reached, and the value of the function call is used
24993 by the caller (<a href="#6.9.1">6.9.1</a>).
24994 <li> An identifier for an object with internal linkage and an incomplete type is declared
24995 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
24996 <li> The token defined is generated during the expansion of a #if or #elif
24997 preprocessing directive, or the use of the defined unary operator does not match
24998 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
24999 <li> The #include preprocessing directive that results after expansion does not match
25000 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
25001 <li> The character sequence in an #include preprocessing directive does not start with a
25002 letter (<a href="#6.10.2">6.10.2</a>).
25003 <li> There are sequences of preprocessing tokens within the list of macro arguments that
25004 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
25005 <li> The result of the preprocessing operator # is not a valid character string literal
25006 (<a href="#6.10.3.2">6.10.3.2</a>).
25007 <li> The result of the preprocessing operator ## is not a valid preprocessing token
25008 (<a href="#6.10.3.3">6.10.3.3</a>).
25009 <!--page 510 -->
25010 <li> The #line preprocessing directive that results after expansion does not match one of
25011 the two well-defined forms, or its digit sequence specifies zero or a number greater
25012 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
25013 <li> A non-STDC #pragma preprocessing directive that is documented as causing
25014 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
25015 <li> A #pragma STDC preprocessing directive does not match one of the well-defined
25016 forms (<a href="#6.10.6">6.10.6</a>).
25017 <li> The name of a predefined macro, or the identifier defined, is the subject of a
25018 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
25019 <li> An attempt is made to copy an object to an overlapping object by use of a library
25020 function, other than as explicitly allowed (e.g., memmove) (clause 7).
25021 <li> A file with the same name as one of the standard headers, not provided as part of the
25022 implementation, is placed in any of the standard places that are searched for included
25023 source files (<a href="#7.1.2">7.1.2</a>).
25024 <li> A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
25025 <li> A function, object, type, or macro that is specified as being declared or defined by
25026 some standard header is used before any header that declares or defines it is included
25027 (<a href="#7.1.2">7.1.2</a>).
25028 <li> A standard header is included while a macro is defined with the same name as a
25029 keyword (<a href="#7.1.2">7.1.2</a>).
25030 <li> The program attempts to declare a library function itself, rather than via a standard
25031 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
25032 <li> The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
25033 (<a href="#7.1.3">7.1.3</a>).
25034 <li> The program removes the definition of a macro whose name begins with an
25035 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
25036 <li> An argument to a library function has an invalid value or a type not expected by a
25037 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
25038 <li> The pointer passed to a library function array parameter does not have a value such
25039 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
25040 <li> The macro definition of assert is suppressed in order to access an actual function
25041 (<a href="#7.2">7.2</a>).
25042 <li> The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
25043 <li> The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
25044 any context other than outside all external declarations or preceding all explicit
25045 <!--page 511 -->
25046 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>).
25047 <li> The value of an argument to a character handling function is neither equal to the value
25048 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
25049 <li> A macro definition of errno is suppressed in order to access an actual object, or the
25050 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
25051 <li> Part of the program tests floating-point status flags, sets floating-point control modes,
25052 or runs under non-default mode settings, but was translated with the state for the
25053 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
25054 <li> The exception-mask argument for one of the functions that provide access to the
25055 floating-point status flags has a nonzero value not obtained by bitwise OR of the
25056 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
25057 <li> The fesetexceptflag function is used to set floating-point status flags that were
25058 not specified in the call to the fegetexceptflag function that provided the value
25059 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
25060 <li> The argument to fesetenv or feupdateenv is neither an object set by a call to
25061 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>).
25062 <li> The value of the result of an integer arithmetic or conversion function cannot be
25063 represented (<a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.6.1">7.20.6.1</a>, <a href="#7.20.6.2">7.20.6.2</a>, <a href="#7.20.1">7.20.1</a>).
25064 <li> The program modifies the string pointed to by the value returned by the setlocale
25065 function (<a href="#7.11.1.1">7.11.1.1</a>).
25066 <li> The program modifies the structure pointed to by the value returned by the
25067 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
25068 <li> A macro definition of math_errhandling is suppressed or the program defines
25069 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
25070 <li> An argument to a floating-point classification or comparison macro is not of real
25071 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
25072 <li> A macro definition of setjmp is suppressed in order to access an actual function, or
25073 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
25074 <li> An invocation of the setjmp macro occurs other than in an allowed context
25075 (<a href="#7.13.2.1">7.13.2.1</a>).
25076 <li> The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
25077 <li> After a longjmp, there is an attempt to access the value of an object of automatic
25078 storage class with non-volatile-qualified type, local to the function containing the
25079 invocation of the corresponding setjmp macro, that was changed between the
25080 setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
25081 <!--page 512 -->
25082 <li> The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
25083 <li> A signal handler returns when the signal corresponded to a computational exception
25084 (<a href="#7.14.1.1">7.14.1.1</a>).
25085 <li> A signal occurs as the result of calling the abort or raise function, and the signal
25086 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
25087 <li> A signal occurs other than as the result of calling the abort or raise function, and
25088 the signal handler refers to an object with static storage duration other than by
25089 assigning a value to an object declared as volatile sig_atomic_t, or calls any
25090 function in the standard library other than the abort function, the _Exit function,
25091 or the signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
25092 <li> The value of errno is referred to after a signal occurred other than as the result of
25093 calling the abort or raise function and the corresponding signal handler obtained
25094 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
25095 <li> A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
25096 <li> A function with a variable number of arguments attempts to access its varying
25097 arguments other than through a properly declared and initialized va_list object, or
25098 before the va_start macro is invoked (<a href="#7.15">7.15</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.4">7.15.1.4</a>).
25099 <li> The macro va_arg is invoked using the parameter ap that was passed to a function
25100 that invoked the macro va_arg with the same parameter (<a href="#7.15">7.15</a>).
25101 <li> A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
25102 order to access an actual function, or the program defines an external identifier with
25103 the name va_copy or va_end (<a href="#7.15.1">7.15.1</a>).
25104 <li> The va_start or va_copy macro is invoked without a corresponding invocation
25105 of the va_end macro in the same function, or vice versa (<a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.3">7.15.1.3</a>,
25106 <a href="#7.15.1.4">7.15.1.4</a>).
25107 <li> The type parameter to the va_arg macro is not such that a pointer to an object of
25108 that type can be obtained simply by postfixing a * (<a href="#7.15.1.1">7.15.1.1</a>).
25109 <li> The va_arg macro is invoked when there is no actual next argument, or with a
25110 specified type that is not compatible with the promoted type of the actual next
25111 argument, with certain exceptions (<a href="#7.15.1.1">7.15.1.1</a>).
25112 <li> The va_copy or va_start macro is called to initialize a va_list that was
25113 previously initialized by either macro without an intervening invocation of the
25114 va_end macro for the same va_list (<a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.4">7.15.1.4</a>).
25115 <li> The parameter parmN of a va_start macro is declared with the register
25116 storage class, with a function or array type, or with a type that is not compatible with
25117 the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
25118 <!--page 513 -->
25119 <li> The member designator parameter of an offsetof macro is an invalid right
25120 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
25121 <li> The argument in an instance of one of the integer-constant macros is not a decimal,
25122 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
25123 corresponding type (<a href="#7.18.4">7.18.4</a>).
25124 <li> A byte input/output function is applied to a wide-oriented stream, or a wide character
25125 input/output function is applied to a byte-oriented stream (<a href="#7.19.2">7.19.2</a>).
25126 <li> Use is made of any portion of a file beyond the most recent wide character written to
25127 a wide-oriented stream (<a href="#7.19.2">7.19.2</a>).
25128 <li> The value of a pointer to a FILE object is used after the associated file is closed
25129 (<a href="#7.19.3">7.19.3</a>).
25130 <li> The stream for the fflush function points to an input stream or to an update stream
25131 in which the most recent operation was input (<a href="#7.19.5.2">7.19.5.2</a>).
25132 <li> The string pointed to by the mode argument in a call to the fopen function does not
25133 exactly match one of the specified character sequences (<a href="#7.19.5.3">7.19.5.3</a>).
25134 <li> An output operation on an update stream is followed by an input operation without an
25135 intervening call to the fflush function or a file positioning function, or an input
25136 operation on an update stream is followed by an output operation with an intervening
25137 call to a file positioning function (<a href="#7.19.5.3">7.19.5.3</a>).
25138 <li> An attempt is made to use the contents of the array that was supplied in a call to the
25139 setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
25140 <li> There are insufficient arguments for the format in a call to one of the formatted
25141 input/output functions, or an argument does not have an appropriate type (<a href="#7.19.6.1">7.19.6.1</a>,
25142 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25143 <li> The format in a call to one of the formatted input/output functions or to the
25144 strftime or wcsftime function is not a valid multibyte character sequence that
25145 begins and ends in its initial shift state (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>,
25146 <a href="#7.24.5.1">7.24.5.1</a>).
25147 <li> In a call to one of the formatted output functions, a precision appears with a
25148 conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25149 <li> A conversion specification for a formatted output function uses an asterisk to denote
25150 an argument-supplied field width or precision, but the corresponding argument is not
25151 provided (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25152 <li> A conversion specification for a formatted output function uses a # or 0 flag with a
25153 conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25154 <!--page 514 -->
25155 <li> A conversion specification for one of the formatted input/output functions uses a
25156 length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
25157 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25158 <li> An s conversion specifier is encountered by one of the formatted output functions,
25159 and the argument is missing the null terminator (unless a precision is specified that
25160 does not require null termination) (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25161 <li> An n conversion specification for one of the formatted input/output functions includes
25162 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.19.6.1">7.19.6.1</a>,
25163 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25164 <li> A % conversion specifier is encountered by one of the formatted input/output
25165 functions, but the complete conversion specification is not exactly %% (<a href="#7.19.6.1">7.19.6.1</a>,
25166 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25167 <li> An invalid conversion specification is found in the format for one of the formatted
25168 input/output functions, or the strftime or wcsftime function (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>,
25169 <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.5.1">7.24.5.1</a>).
25170 <li> The number of characters transmitted by a formatted output function is greater than
25171 INT_MAX (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.10">7.19.6.10</a>).
25172 <li> The result of a conversion by one of the formatted input functions cannot be
25173 represented in the corresponding object, or the receiving object does not have an
25174 appropriate type (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25175 <li> A c, s, or [ conversion specifier is encountered by one of the formatted input
25176 functions, and the array pointed to by the corresponding argument is not large enough
25177 to accept the input sequence (and a null terminator if the conversion specifier is s or
25178 [) (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25179 <li> A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
25180 formatted input functions, but the input is not a valid multibyte character sequence
25181 that begins in the initial shift state (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25182 <li> The input item for a %p conversion by one of the formatted input functions is not a
25183 value converted earlier during the same program execution (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25184 <li> The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
25185 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
25186 vwscanf function is called with an improperly initialized va_list argument, or
25187 the argument is used (other than in an invocation of va_end) after the function
25188 returns (<a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>, <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
25189 <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>).
25190 <li> The contents of the array supplied in a call to the fgets, gets, or fgetws function
25191 are used after a read error occurred (<a href="#7.19.7.2">7.19.7.2</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.24.3.2">7.24.3.2</a>).
25192 <!--page 515 -->
25193 <li> The file position indicator for a binary stream is used after a call to the ungetc
25194 function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
25195 <li> The file position indicator for a stream is used after an error occurred during a call to
25196 the fread or fwrite function (<a href="#7.19.8.1">7.19.8.1</a>, <a href="#7.19.8.2">7.19.8.2</a>).
25197 <li> A partial element read by a call to the fread function is used (<a href="#7.19.8.1">7.19.8.1</a>).
25198 <li> The fseek function is called for a text stream with a nonzero offset and either the
25199 offset was not returned by a previous successful call to the ftell function on a
25200 stream associated with the same file or whence is not SEEK_SET (<a href="#7.19.9.2">7.19.9.2</a>).
25201 <li> The fsetpos function is called to set a position that was not returned by a previous
25202 successful call to the fgetpos function on a stream associated with the same file
25203 (<a href="#7.19.9.3">7.19.9.3</a>).
25204 <li> A non-null pointer returned by a call to the calloc, malloc, or realloc function
25205 with a zero requested size is used to access an object (<a href="#7.20.3">7.20.3</a>).
25206 <li> The value of a pointer that refers to space deallocated by a call to the free or
25207 realloc function is used (<a href="#7.20.3">7.20.3</a>).
25208 <li> The pointer argument to the free or realloc function does not match a pointer
25209 earlier returned by calloc, malloc, or realloc, or the space has been
25210 deallocated by a call to free or realloc (<a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a>).
25211 <li> The value of the object allocated by the malloc function is used (<a href="#7.20.3.3">7.20.3.3</a>).
25212 <li> The value of any bytes in a new object allocated by the realloc function beyond
25213 the size of the old object are used (<a href="#7.20.3.4">7.20.3.4</a>).
25214 <li> The program executes more than one call to the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
25215 <li> During the call to a function registered with the atexit function, a call is made to
25216 the longjmp function that would terminate the call to the registered function
25217 (<a href="#7.20.4.3">7.20.4.3</a>).
25218 <li> The string set up by the getenv or strerror function is modified by the program
25219 (<a href="#7.20.4.5">7.20.4.5</a>, <a href="#7.21.6.2">7.21.6.2</a>).
25220 <li> A command is executed through the system function in a way that is documented as
25221 causing termination or some other form of undefined behavior (<a href="#7.20.4.6">7.20.4.6</a>).
25222 <li> A searching or sorting utility function is called with an invalid pointer argument, even
25223 if the number of elements is zero (<a href="#7.20.5">7.20.5</a>).
25224 <li> The comparison function called by a searching or sorting utility function alters the
25225 contents of the array being searched or sorted, or returns ordering values
25226 inconsistently (<a href="#7.20.5">7.20.5</a>).
25227 <!--page 516 -->
25228 <li> The array being searched by the bsearch function does not have its elements in
25229 proper order (<a href="#7.20.5.1">7.20.5.1</a>).
25230 <li> The current conversion state is used by a multibyte/wide character conversion
25231 function after changing the LC_CTYPE category (<a href="#7.20.7">7.20.7</a>).
25232 <li> A string or wide string utility function is instructed to access an array beyond the end
25233 of an object (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
25234 <li> A string or wide string utility function is called with an invalid pointer argument, even
25235 if the length is zero (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
25236 <li> The contents of the destination array are used after a call to the strxfrm,
25237 strftime, wcsxfrm, or wcsftime function in which the specified length was
25238 too small to hold the entire null-terminated result (<a href="#7.21.4.5">7.21.4.5</a>, <a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a>,
25239 <a href="#7.24.5.1">7.24.5.1</a>).
25240 <li> The first argument in the very first call to the strtok or wcstok is a null pointer
25241 (<a href="#7.21.5.8">7.21.5.8</a>, <a href="#7.24.4.5.7">7.24.4.5.7</a>).
25242 <li> The type of an argument to a type-generic macro is not compatible with the type of
25243 the corresponding parameter of the selected function (<a href="#7.22">7.22</a>).
25244 <li> A complex argument is supplied for a generic parameter of a type-generic macro that
25245 has no corresponding complex function (<a href="#7.22">7.22</a>).
25246 <li> The argument corresponding to an s specifier without an l qualifier in a call to the
25247 fwprintf function does not point to a valid multibyte character sequence that
25248 begins in the initial shift state (<a href="#7.24.2.11">7.24.2.11</a>).
25249 <li> In a call to the wcstok function, the object pointed to by ptr does not have the
25250 value stored by the previous call for the same wide string (<a href="#7.24.4.5.7">7.24.4.5.7</a>).
25251 <li> An mbstate_t object is used inappropriately (<a href="#7.24.6">7.24.6</a>).
25252 <li> The value of an argument of type wint_t to a wide character classification or case
25253 mapping function is neither equal to the value of WEOF nor representable as a
25254 wchar_t (<a href="#7.25.1">7.25.1</a>).
25255 <li> The iswctype function is called using a different LC_CTYPE category from the
25256 one in effect for the call to the wctype function that returned the description
25257 (<a href="#7.25.2.2.1">7.25.2.2.1</a>).
25258 <li> The towctrans function is called using a different LC_CTYPE category from the
25259 one in effect for the call to the wctrans function that returned the description
25260 (<a href="#7.25.3.2.1">7.25.3.2.1</a>).
25261 <!--page 517 -->
25262 </ul>
25264 <p><small><a href="#Contents">Contents</a></small>
25265 <h3><a name="J.3" href="#J.3">J.3 Implementation-defined behavior</a></h3>
25266 <p><a name="J.3p1" href="#J.3p1"><small>1</small></a>
25267 A conforming implementation is required to document its choice of behavior in each of
25268 the areas listed in this subclause. The following are implementation-defined:
25270 <p><small><a href="#Contents">Contents</a></small>
25271 <h4><a name="J.3.1" href="#J.3.1">J.3.1 Translation</a></h4>
25272 <p><a name="J.3.1p1" href="#J.3.1p1"><small>1</small></a>
25273 <ul>
25274 <li> How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
25275 <li> Whether each nonempty sequence of white-space characters other than new-line is
25276 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
25277 </ul>
25279 <p><small><a href="#Contents">Contents</a></small>
25280 <h4><a name="J.3.2" href="#J.3.2">J.3.2 Environment</a></h4>
25281 <p><a name="J.3.2p1" href="#J.3.2p1"><small>1</small></a>
25282 <ul>
25283 <li> The mapping between physical source file multibyte characters and the source
25284 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
25285 <li> The name and type of the function called at program startup in a freestanding
25286 environment (<a href="#5.1.2.1">5.1.2.1</a>).
25287 <li> The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
25288 <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>).
25289 <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>).
25290 <li> What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
25291 <li> The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
25292 <li> Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
25293 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
25294 <li> Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
25295 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
25296 <li> The set of environment names and the method for altering the environment list used
25297 by the getenv function (<a href="#7.20.4.5">7.20.4.5</a>).
25298 <li> The manner of execution of the string by the system function (<a href="#7.20.4.6">7.20.4.6</a>).
25299 </ul>
25301 <p><small><a href="#Contents">Contents</a></small>
25302 <h4><a name="J.3.3" href="#J.3.3">J.3.3 Identifiers</a></h4>
25303 <p><a name="J.3.3p1" href="#J.3.3p1"><small>1</small></a>
25304 <ul>
25305 <li> Which additional multibyte characters may appear in identifiers and their
25306 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
25307 <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>).
25308 <!--page 518 -->
25309 </ul>
25311 <p><small><a href="#Contents">Contents</a></small>
25312 <h4><a name="J.3.4" href="#J.3.4">J.3.4 Characters</a></h4>
25313 <p><a name="J.3.4p1" href="#J.3.4p1"><small>1</small></a>
25314 <ul>
25315 <li> The number of bits in a byte (<a href="#3.6">3.6</a>).
25316 <li> The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
25317 <li> The unique value of the member of the execution character set produced for each of
25318 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
25319 <li> The value of a char object into which has been stored any character other than a
25320 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
25321 <li> Which of signed char or unsigned char has the same range, representation,
25322 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>).
25323 <li> The mapping of members of the source character set (in character constants and string
25324 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>).
25325 <li> The value of an integer character constant containing more than one character or
25326 containing a character or escape sequence that does not map to a single-byte
25327 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
25328 <li> The value of a wide character constant containing more than one multibyte character,
25329 or containing a multibyte character or escape sequence not represented in the
25330 extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
25331 <li> The current locale used to convert a wide character constant consisting of a single
25332 multibyte character that maps to a member of the extended execution character set
25333 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
25334 <li> The current locale used to convert a wide string literal into corresponding wide
25335 character codes (<a href="#6.4.5">6.4.5</a>).
25336 <li> The value of a string literal containing a multibyte character or escape sequence not
25337 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
25338 </ul>
25340 <p><small><a href="#Contents">Contents</a></small>
25341 <h4><a name="J.3.5" href="#J.3.5">J.3.5 Integers</a></h4>
25342 <p><a name="J.3.5p1" href="#J.3.5p1"><small>1</small></a>
25343 <ul>
25344 <li> Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
25345 <li> Whether signed integer types are represented using sign and magnitude, two's
25346 complement, or ones' complement, and whether the extraordinary value is a trap
25347 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
25348 <li> The rank of any extended integer type relative to another extended integer type with
25349 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
25350 <li> The result of, or the signal raised by, converting an integer to a signed integer type
25351 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
25352 <!--page 519 -->
25353 <li> The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
25354 </ul>
25356 <p><small><a href="#Contents">Contents</a></small>
25357 <h4><a name="J.3.6" href="#J.3.6">J.3.6 Floating point</a></h4>
25358 <p><a name="J.3.6p1" href="#J.3.6p1"><small>1</small></a>
25359 <ul>
25360 <li> The accuracy of the floating-point operations and of the library functions in
25361 <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>).
25362 <li> The accuracy of the conversions between floating-point internal representations and
25363 string representations performed by the library functions in <a href="#7.19">&lt;stdio.h&gt;</a>,
25364 <a href="#7.20">&lt;stdlib.h&gt;</a>, and <a href="#7.24">&lt;wchar.h&gt;</a> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
25365 <li> The rounding behaviors characterized by non-standard values of FLT_ROUNDS
25366 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
25367 <li> The evaluation methods characterized by non-standard negative values of
25368 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
25369 <li> The direction of rounding when an integer is converted to a floating-point number that
25370 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
25371 <li> The direction of rounding when a floating-point number is converted to a narrower
25372 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
25373 <li> How the nearest representable value or the larger or smaller representable value
25374 immediately adjacent to the nearest representable value is chosen for certain floating
25375 constants (<a href="#6.4.4.2">6.4.4.2</a>).
25376 <li> Whether and how floating expressions are contracted when not disallowed by the
25377 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
25378 <li> The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
25379 <li> Additional floating-point exceptions, rounding modes, environments, and
25380 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
25381 <li> The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>). *
25382 </ul>
25384 <p><small><a href="#Contents">Contents</a></small>
25385 <h4><a name="J.3.7" href="#J.3.7">J.3.7 Arrays and pointers</a></h4>
25386 <p><a name="J.3.7p1" href="#J.3.7p1"><small>1</small></a>
25387 <ul>
25388 <li> The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
25389 <li> The size of the result of subtracting two pointers to elements of the same array
25390 (<a href="#6.5.6">6.5.6</a>).
25391 <!--page 520 -->
25392 </ul>
25394 <p><small><a href="#Contents">Contents</a></small>
25395 <h4><a name="J.3.8" href="#J.3.8">J.3.8 Hints</a></h4>
25396 <p><a name="J.3.8p1" href="#J.3.8p1"><small>1</small></a>
25397 <ul>
25398 <li> The extent to which suggestions made by using the register storage-class
25399 specifier are effective (<a href="#6.7.1">6.7.1</a>).
25400 <li> The extent to which suggestions made by using the inline function specifier are
25401 effective (<a href="#6.7.4">6.7.4</a>).
25402 </ul>
25404 <p><small><a href="#Contents">Contents</a></small>
25405 <h4><a name="J.3.9" href="#J.3.9">J.3.9 Structures, unions, enumerations, and bit-fields</a></h4>
25406 <p><a name="J.3.9p1" href="#J.3.9p1"><small>1</small></a>
25407 <ul>
25408 <li> Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
25409 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
25410 <li> Allowable bit-field types other than _Bool, signed int, and unsigned int
25411 (<a href="#6.7.2.1">6.7.2.1</a>).
25412 <li> Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
25413 <li> The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
25414 <li> The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
25415 no problem unless binary data written by one implementation is read by another.
25416 <li> The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
25417 </ul>
25419 <p><small><a href="#Contents">Contents</a></small>
25420 <h4><a name="J.3.10" href="#J.3.10">J.3.10 Qualifiers</a></h4>
25421 <p><a name="J.3.10p1" href="#J.3.10p1"><small>1</small></a>
25422 <ul>
25423 <li> What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
25424 </ul>
25426 <p><small><a href="#Contents">Contents</a></small>
25427 <h4><a name="J.3.11" href="#J.3.11">J.3.11 Preprocessing directives</a></h4>
25428 <p><a name="J.3.11p1" href="#J.3.11p1"><small>1</small></a>
25429 <ul>
25430 <li> The locations within #pragma directives where header name preprocessing tokens
25431 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
25432 <li> How sequences in both forms of header names are mapped to headers or external
25433 source file names (<a href="#6.4.7">6.4.7</a>).
25434 <li> Whether the value of a character constant in a constant expression that controls
25435 conditional inclusion matches the value of the same character constant in the
25436 execution character set (<a href="#6.10.1">6.10.1</a>).
25437 <li> Whether the value of a single-character character constant in a constant expression
25438 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
25439 <li> The places that are searched for an included &lt; &gt; delimited header, and how the places
25440 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
25441 <li> How the named source file is searched for in an included " " delimited header
25442 (<a href="#6.10.2">6.10.2</a>).
25443 <li> The method by which preprocessing tokens (possibly resulting from macro
25444 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
25445 <!--page 521 -->
25446 <li> The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
25447 <li> Whether the # operator inserts a \ character before the \ character that begins a
25448 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
25449 <li> The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
25450 <li> The definitions for __DATE__ and __TIME__ when respectively, the date and
25451 time of translation are not available (<a href="#6.10.8">6.10.8</a>).
25452 </ul>
25454 <p><small><a href="#Contents">Contents</a></small>
25455 <h4><a name="J.3.12" href="#J.3.12">J.3.12 Library functions</a></h4>
25456 <p><a name="J.3.12p1" href="#J.3.12p1"><small>1</small></a>
25457 <ul>
25458 <li> Any library facilities available to a freestanding program, other than the minimal set
25459 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
25460 <li> The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
25461 <li> The representation of the floating-point status flags stored by the
25462 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
25463 <li> Whether the feraiseexcept function raises the ''inexact'' floating-point
25464 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
25465 (<a href="#7.6.2.3">7.6.2.3</a>).
25466 <li> Strings other than "C" and "" that may be passed as the second argument to the
25467 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
25468 <li> The types defined for float_t and double_t when the value of the
25469 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
25470 <li> Domain errors for the mathematics functions, other than those required by this
25471 International Standard (<a href="#7.12.1">7.12.1</a>).
25472 <li> The values returned by the mathematics functions on domain errors (<a href="#7.12.1">7.12.1</a>).
25473 <li> The values returned by the mathematics functions on underflow range errors, whether
25474 errno is set to the value of the macro ERANGE when the integer expression
25475 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
25476 floating-point exception is raised when the integer expression math_errhandling
25477 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
25478 <li> Whether a domain error occurs or zero is returned when an fmod function has a
25479 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
25480 <li> Whether a domain error occurs or zero is returned when a remainder function has
25481 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
25482 <li> The base-2 logarithm of the modulus used by the remquo functions in reducing the
25483 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
25484 <!--page 522 -->
25485 <li> Whether a domain error occurs or zero is returned when a remquo function has a
25486 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
25487 <li> Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
25488 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>).
25489 <li> The null pointer constant to which the macro NULL expands (<a href="#7.17">7.17</a>).
25490 <li> Whether the last line of a text stream requires a terminating new-line character
25491 (<a href="#7.19.2">7.19.2</a>).
25492 <li> Whether space characters that are written out to a text stream immediately before a
25493 new-line character appear when read in (<a href="#7.19.2">7.19.2</a>).
25494 <li> The number of null characters that may be appended to data written to a binary
25495 stream (<a href="#7.19.2">7.19.2</a>).
25496 <li> Whether the file position indicator of an append-mode stream is initially positioned at
25497 the beginning or end of the file (<a href="#7.19.3">7.19.3</a>).
25498 <li> Whether a write on a text stream causes the associated file to be truncated beyond that
25499 point (<a href="#7.19.3">7.19.3</a>).
25500 <li> The characteristics of file buffering (<a href="#7.19.3">7.19.3</a>).
25501 <li> Whether a zero-length file actually exists (<a href="#7.19.3">7.19.3</a>).
25502 <li> The rules for composing valid file names (<a href="#7.19.3">7.19.3</a>).
25503 <li> Whether the same file can be simultaneously open multiple times (<a href="#7.19.3">7.19.3</a>).
25504 <li> The nature and choice of encodings used for multibyte characters in files (<a href="#7.19.3">7.19.3</a>).
25505 <li> The effect of the remove function on an open file (<a href="#7.19.4.1">7.19.4.1</a>).
25506 <li> The effect if a file with the new name exists prior to a call to the rename function
25507 (<a href="#7.19.4.2">7.19.4.2</a>).
25508 <li> Whether an open temporary file is removed upon abnormal program termination
25509 (<a href="#7.19.4.3">7.19.4.3</a>).
25510 <li> Which changes of mode are permitted (if any), and under what circumstances
25511 (<a href="#7.19.5.4">7.19.5.4</a>).
25512 <li> The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
25513 sequence printed for a NaN (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25514 <li> The output for %p conversion in the fprintf or fwprintf function (<a href="#7.19.6.1">7.19.6.1</a>,
25515 <a href="#7.24.2.1">7.24.2.1</a>).
25516 <li> The interpretation of a - character that is neither the first nor the last character, nor
25517 the second where a ^ character is the first, in the scanlist for %[ conversion in the
25518 fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>).
25519 <!--page 523 -->
25520 <li> The set of sequences matched by a %p conversion and the interpretation of the
25521 corresponding input item in the fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
25522 <li> The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
25523 functions on failure (<a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.9.4">7.19.9.4</a>).
25524 <li> The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
25525 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
25526 function (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
25527 <li> Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
25528 function sets errno to ERANGE when underflow occurs (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
25529 <li> Whether the calloc, malloc, and realloc functions return a null pointer or a
25530 pointer to an allocated object when the size requested is zero (<a href="#7.20.3">7.20.3</a>).
25531 <li> Whether open streams with unwritten buffered data are flushed, open streams are
25532 closed, or temporary files are removed when the abort or _Exit function is called
25533 (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.4">7.20.4.4</a>).
25534 <li> The termination status returned to the host environment by the abort, exit, or
25535 _Exit function (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.3">7.20.4.3</a>, <a href="#7.20.4.4">7.20.4.4</a>).
25536 <li> The value returned by the system function when its argument is not a null pointer
25537 (<a href="#7.20.4.6">7.20.4.6</a>).
25538 <li> The local time zone and Daylight Saving Time (<a href="#7.23.1">7.23.1</a>).
25539 <li> The range and precision of times representable in clock_t and time_t (<a href="#7.23">7.23</a>).
25540 <li> The era for the clock function (<a href="#7.23.2.1">7.23.2.1</a>).
25541 <li> The replacement string for the %Z specifier to the strftime, and wcsftime
25542 functions in the "C" locale (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
25543 <li> Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
25544 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.9">F.9</a>).
25545 </ul>
25547 <p><small><a href="#Contents">Contents</a></small>
25548 <h4><a name="J.3.13" href="#J.3.13">J.3.13 Architecture</a></h4>
25549 <p><a name="J.3.13p1" href="#J.3.13p1"><small>1</small></a>
25550 <ul>
25551 <li> The values or expressions assigned to the macros specified in the headers
25552 <a href="#7.7">&lt;float.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, and <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#5.2.4.2">5.2.4.2</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>).
25553 <li> The number, order, and encoding of bytes in any object (when not explicitly specified
25554 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
25555 <li> The value of the result of the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>).
25556 <!--page 524 -->
25557 </ul>
25559 <p><small><a href="#Contents">Contents</a></small>
25560 <h3><a name="J.4" href="#J.4">J.4 Locale-specific behavior</a></h3>
25561 <p><a name="J.4p1" href="#J.4p1"><small>1</small></a>
25562 The following characteristics of a hosted environment are locale-specific and are required
25563 to be documented by the implementation:
25564 <ul>
25565 <li> Additional members of the source and execution character sets beyond the basic
25566 character set (<a href="#5.2.1">5.2.1</a>).
25567 <li> The presence, meaning, and representation of additional multibyte characters in the
25568 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
25569 <li> The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
25570 <li> The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
25571 <li> The decimal-point character (<a href="#7.1.1">7.1.1</a>).
25572 <li> The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
25573 <li> The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
25574 <li> The sets of characters tested for by the isalpha, isblank, islower, ispunct,
25575 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
25576 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>,
25577 <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>).
25578 <li> The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
25579 <li> Additional subject sequences accepted by the numeric conversion functions (<a href="#7.20.1">7.20.1</a>,
25580 <a href="#7.24.4.1">7.24.4.1</a>).
25581 <li> The collation sequence of the execution character set (<a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.24.4.4.2">7.24.4.4.2</a>).
25582 <li> The contents of the error message strings set up by the strerror function
25583 (<a href="#7.21.6.2">7.21.6.2</a>).
25584 <li> The formats for time and date (<a href="#7.23.3.5">7.23.3.5</a>, <a href="#7.24.5.1">7.24.5.1</a>).
25585 <li> Character mappings that are supported by the towctrans function (<a href="#7.25.1">7.25.1</a>).
25586 <li> Character classifications that are supported by the iswctype function (<a href="#7.25.1">7.25.1</a>).
25587 <!--page 525 -->
25588 </ul>
25590 <p><small><a href="#Contents">Contents</a></small>
25591 <h3><a name="J.5" href="#J.5">J.5 Common extensions</a></h3>
25592 <p><a name="J.5p1" href="#J.5p1"><small>1</small></a>
25593 The following extensions are widely used in many systems, but are not portable to all
25594 implementations. The inclusion of any extension that may cause a strictly conforming
25595 program to become invalid renders an implementation nonconforming. Examples of such
25596 extensions are new keywords, extra library functions declared in standard headers, or
25597 predefined macros with names that do not begin with an underscore.
25599 <p><small><a href="#Contents">Contents</a></small>
25600 <h4><a name="J.5.1" href="#J.5.1">J.5.1 Environment arguments</a></h4>
25601 <p><a name="J.5.1p1" href="#J.5.1p1"><small>1</small></a>
25602 In a hosted environment, the main function receives a third argument, char *envp[],
25603 that points to a null-terminated array of pointers to char, each of which points to a string
25604 that provides information about the environment for this execution of the program
25605 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
25607 <p><small><a href="#Contents">Contents</a></small>
25608 <h4><a name="J.5.2" href="#J.5.2">J.5.2 Specialized identifiers</a></h4>
25609 <p><a name="J.5.2p1" href="#J.5.2p1"><small>1</small></a>
25610 Characters other than the underscore _, letters, and digits, that are not part of the basic
25611 source character set (such as the dollar sign $, or characters in national character sets)
25612 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
25614 <p><small><a href="#Contents">Contents</a></small>
25615 <h4><a name="J.5.3" href="#J.5.3">J.5.3 Lengths and cases of identifiers</a></h4>
25616 <p><a name="J.5.3p1" href="#J.5.3p1"><small>1</small></a>
25617 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
25619 <p><small><a href="#Contents">Contents</a></small>
25620 <h4><a name="J.5.4" href="#J.5.4">J.5.4 Scopes of identifiers</a></h4>
25621 <p><a name="J.5.4p1" href="#J.5.4p1"><small>1</small></a>
25622 A function identifier, or the identifier of an object the declaration of which contains the
25623 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
25625 <p><small><a href="#Contents">Contents</a></small>
25626 <h4><a name="J.5.5" href="#J.5.5">J.5.5 Writable string literals</a></h4>
25627 <p><a name="J.5.5p1" href="#J.5.5p1"><small>1</small></a>
25628 String literals are modifiable (in which case, identical string literals should denote distinct
25629 objects) (<a href="#6.4.5">6.4.5</a>).
25631 <p><small><a href="#Contents">Contents</a></small>
25632 <h4><a name="J.5.6" href="#J.5.6">J.5.6 Other arithmetic types</a></h4>
25633 <p><a name="J.5.6p1" href="#J.5.6p1"><small>1</small></a>
25634 Additional arithmetic types, such as __int128 or double double, and their
25635 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
25636 more range or precision than long double, may be used for evaluating expressions of
25637 other floating types, and may be used to define float_t or double_t.
25638 <!--page 526 -->
25640 <p><small><a href="#Contents">Contents</a></small>
25641 <h4><a name="J.5.7" href="#J.5.7">J.5.7 Function pointer casts</a></h4>
25642 <p><a name="J.5.7p1" href="#J.5.7p1"><small>1</small></a>
25643 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
25644 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
25645 <p><a name="J.5.7p2" href="#J.5.7p2"><small>2</small></a>
25646 A pointer to a function may be cast to a pointer to an object or to void, allowing a
25647 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
25649 <p><small><a href="#Contents">Contents</a></small>
25650 <h4><a name="J.5.8" href="#J.5.8">J.5.8 Extended bit-field types</a></h4>
25651 <p><a name="J.5.8p1" href="#J.5.8p1"><small>1</small></a>
25652 A bit-field may be declared with a type other than _Bool, unsigned int, or
25653 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
25655 <p><small><a href="#Contents">Contents</a></small>
25656 <h4><a name="J.5.9" href="#J.5.9">J.5.9 The fortran keyword</a></h4>
25657 <p><a name="J.5.9p1" href="#J.5.9p1"><small>1</small></a>
25658 The fortran function specifier may be used in a function declaration to indicate that
25659 calls suitable for FORTRAN should be generated, or that a different representation for the
25660 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
25662 <p><small><a href="#Contents">Contents</a></small>
25663 <h4><a name="J.5.10" href="#J.5.10">J.5.10 The asm keyword</a></h4>
25664 <p><a name="J.5.10p1" href="#J.5.10p1"><small>1</small></a>
25665 The asm keyword may be used to insert assembly language directly into the translator
25666 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
25667 <pre>
25668 asm ( character-string-literal );
25669 </pre>
25671 <p><small><a href="#Contents">Contents</a></small>
25672 <h4><a name="J.5.11" href="#J.5.11">J.5.11 Multiple external definitions</a></h4>
25673 <p><a name="J.5.11p1" href="#J.5.11p1"><small>1</small></a>
25674 There may be more than one external definition for the identifier of an object, with or
25675 without the explicit use of the keyword extern; if the definitions disagree, or more than
25676 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
25678 <p><small><a href="#Contents">Contents</a></small>
25679 <h4><a name="J.5.12" href="#J.5.12">J.5.12 Predefined macro names</a></h4>
25680 <p><a name="J.5.12p1" href="#J.5.12p1"><small>1</small></a>
25681 Macro names that do not begin with an underscore, describing the translation and
25682 execution environments, are defined by the implementation before translation begins
25683 (<a href="#6.10.8">6.10.8</a>).
25685 <p><small><a href="#Contents">Contents</a></small>
25686 <h4><a name="J.5.13" href="#J.5.13">J.5.13 Floating-point status flags</a></h4>
25687 <p><a name="J.5.13p1" href="#J.5.13p1"><small>1</small></a>
25688 If any floating-point status flags are set on normal termination after all calls to functions
25689 registered by the atexit function have been made (see <a href="#7.20.4.3">7.20.4.3</a>), the implementation
25690 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
25691 <!--page 527 -->
25693 <p><small><a href="#Contents">Contents</a></small>
25694 <h4><a name="J.5.14" href="#J.5.14">J.5.14 Extra arguments for signal handlers</a></h4>
25695 <p><a name="J.5.14p1" href="#J.5.14p1"><small>1</small></a>
25696 Handlers for specific signals are called with extra arguments in addition to the signal
25697 number (<a href="#7.14.1.1">7.14.1.1</a>).
25699 <p><small><a href="#Contents">Contents</a></small>
25700 <h4><a name="J.5.15" href="#J.5.15">J.5.15 Additional stream types and file-opening modes</a></h4>
25701 <p><a name="J.5.15p1" href="#J.5.15p1"><small>1</small></a>
25702 Additional mappings from files to streams are supported (<a href="#7.19.2">7.19.2</a>).
25703 <p><a name="J.5.15p2" href="#J.5.15p2"><small>2</small></a>
25704 Additional file-opening modes may be specified by characters appended to the mode
25705 argument of the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
25707 <p><small><a href="#Contents">Contents</a></small>
25708 <h4><a name="J.5.16" href="#J.5.16">J.5.16 Defined file position indicator</a></h4>
25709 <p><a name="J.5.16p1" href="#J.5.16p1"><small>1</small></a>
25710 The file position indicator is decremented by each successful call to the ungetc or
25711 ungetwc function for a text stream, except if its value was zero before a call (<a href="#7.19.7.11">7.19.7.11</a>,
25712 <a href="#7.24.3.10">7.24.3.10</a>).
25714 <p><small><a href="#Contents">Contents</a></small>
25715 <h4><a name="J.5.17" href="#J.5.17">J.5.17 Math error reporting</a></h4>
25716 <p><a name="J.5.17p1" href="#J.5.17p1"><small>1</small></a>
25717 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
25718 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
25719 <a href="#7.12">7.12</a>).
25720 <!--page 528 -->
25722 <p><small><a href="#Contents">Contents</a></small>
25723 <h2><a name="Bibliography" href="#Bibliography">Bibliography</a></h2>
25724 <ol>
25725 <li> ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
25726 published in The C Programming Language by Brian W. Kernighan and Dennis
25727 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
25728 <li> 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
25729 California, USA, November 1984.
25730 <li> ANSI X3/TR-1-82 (1982), American National Dictionary for Information
25731 Processing Systems, Information Processing Systems Technical Report.
25732 <li> ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
25733 Arithmetic.
25734 <li> ANSI/IEEE 854-1988, American National Standard for Radix-Independent
25735 Floating-Point Arithmetic.
25736 <li> IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
25737 second edition (previously designated IEC 559:1989).
25738 <li> ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
25739 symbols for use in the physical sciences and technology.
25740 <li> ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
25741 information interchange.
25742 <li> ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
25743 Fundamental terms.
25744 <li> ISO 4217:1995, Codes for the representation of currencies and funds.
25745 <li> ISO 8601:1988, Data elements and interchange formats -- Information
25746 interchange -- Representation of dates and times.
25747 <li> ISO/IEC 9899:1990, Programming languages -- C.
25748 <li> ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
25749 <li> ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
25750 <li> ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
25751 <li> ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
25752 Interface (POSIX) -- Part 2: Shell and Utilities.
25753 <li> ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
25754 preparation of programming language standards.
25755 <li> ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
25756 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
25757 <!--page 529 -->
25758 <li> ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
25759 ISO/IEC 10646-1:1993.
25760 <li> ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
25761 ISO/IEC 10646-1:1993.
25762 <li> ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
25763 Transformation Format for 16 planes of group 00 (UTF-16).
25764 <li> ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
25765 Transformation Format 8 (UTF-8).
25766 <li> ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
25767 <li> ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
25768 <li> ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
25769 syllables.
25770 <li> ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993 Tibetan.
25771 <li> ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
25772 additional characters.
25773 <li> ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
25774 <li> ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
25775 Identifiers for characters.
25776 <li> ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
25777 Ethiopic.
25778 <li> ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
25779 Unified Canadian Aboriginal Syllabics.
25780 <li> ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
25781 Cherokee.
25782 <li> ISO/IEC 10967-1:1994, Information technology -- Language independent
25783 arithmetic -- Part 1: Integer and floating point arithmetic.
25784 <!--page 530 -->
25785 <!--page 531 -->
25786 </ol>
25788 <p><small><a href="#Contents">Contents</a></small>
25789 <h2><a name="Index" href="#Index">Index</a></h2>
25790 <pre>
25791 [^ x ^], <a href="#3.18">3.18</a> , (comma punctuator), <a href="#6.5.2">6.5.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.7.2.2">6.7.2.2</a>,
25792 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>
25793 [_ x _], <a href="#3.19">3.19</a> - (subtraction operator), <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a>
25794 ! (logical negation operator), <a href="#6.5.3.3">6.5.3.3</a> - (unary minus operator), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
25795 != (inequality operator), <a href="#6.5.9">6.5.9</a> -- (postfix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a>
25796 # operator, <a href="#6.10.3.2">6.10.3.2</a> -- (prefix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>
25797 # preprocessing directive, <a href="#6.10.7">6.10.7</a> -= (subtraction assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25798 # punctuator, <a href="#6.10">6.10</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
25799 ## operator, <a href="#6.10.3.3">6.10.3.3</a> . (structure/union member operator), <a href="#6.3.2.1">6.3.2.1</a>,
25800 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> <a href="#6.5.2.3">6.5.2.3</a>
25801 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.8">6.7.8</a>
25802 #else preprocessing directive, <a href="#6.10.1">6.10.1</a> ... (ellipsis punctuator), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a>
25803 #endif preprocessing directive, <a href="#6.10.1">6.10.1</a> / (division operator), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a>
25804 #error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> /* */ (comment delimiters), <a href="#6.4.9">6.4.9</a>
25805 #if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, // (comment delimiter), <a href="#6.4.9">6.4.9</a>
25806 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> /= (division assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25807 #ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> : (colon punctuator), <a href="#6.7.2.1">6.7.2.1</a>
25808 #ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> :&gt; (alternative spelling of ]), <a href="#6.4.6">6.4.6</a>
25809 #include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, ; (semicolon punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>,
25810 <a href="#6.10.2">6.10.2</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
25811 #line preprocessing directive, <a href="#6.10.4">6.10.4</a> &lt; (less-than operator), <a href="#6.5.8">6.5.8</a>
25812 #pragma preprocessing directive, <a href="#6.10.6">6.10.6</a> &lt;% (alternative spelling of {), <a href="#6.4.6">6.4.6</a>
25813 #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>
25814 <a href="#7.1.4">7.1.4</a> &lt;&lt; (left-shift operator), <a href="#6.5.7">6.5.7</a>
25815 % (remainder operator), <a href="#6.5.5">6.5.5</a> &lt;&lt;= (left-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25816 %: (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>
25817 %:%: (alternative spelling of ##), <a href="#6.4.6">6.4.6</a> <a href="#7.2">&lt;assert.h&gt;</a> header, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
25818 %= (remainder assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.3">&lt;complex.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>,
25819 %&gt; (alternative spelling of }), <a href="#6.4.6">6.4.6</a> <a href="#7.26.1">7.26.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
25820 &amp; (address operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#7.4">&lt;ctype.h&gt;</a> header, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
25821 &amp; (bitwise AND operator), <a href="#6.5.10">6.5.10</a> <a href="#7.5">&lt;errno.h&gt;</a> header, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
25822 &amp;&amp; (logical AND operator), <a href="#6.5.13">6.5.13</a> <a href="#7.6">&lt;fenv.h&gt;</a> header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>,
25823 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#H">H</a>
25824 ' ' (space character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.7">&lt;float.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>,
25825 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>
25826 ( ) (cast operator), <a href="#6.5.4">6.5.4</a> <a href="#7.8">&lt;inttypes.h&gt;</a> header, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
25827 ( ) (function-call operator), <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.9">&lt;iso646.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.9">7.9</a>
25828 ( ) (parentheses punctuator), <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> <a href="#7.10">&lt;limits.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
25829 ( ){ } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> <a href="#7.11">&lt;locale.h&gt;</a> header, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
25830 * (asterisk punctuator), <a href="#6.7.5.1">6.7.5.1</a>, <a href="#6.7.5.2">6.7.5.2</a> <a href="#7.12">&lt;math.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>,
25831 * (indirection operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#F.9">F.9</a>, <a href="#J.5.17">J.5.17</a>
25832 * (multiplication operator), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a> <a href="#7.13">&lt;setjmp.h&gt;</a> header, <a href="#7.13">7.13</a>
25833 *= (multiplication assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.14">&lt;signal.h&gt;</a> header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
25834 + (addition operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#7.15">&lt;stdarg.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
25835 <a href="#G.5.2">G.5.2</a> <a href="#7.16">&lt;stdbool.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a>
25836 + (unary plus operator), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.17">&lt;stddef.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
25837 ++ (postfix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a>
25838 ++ (prefix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> <a href="#7.18">&lt;stdint.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>,
25839 += (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.18">7.18</a>, <a href="#7.26.8">7.26.8</a>
25840 , (comma operator), <a href="#6.5.17">6.5.17</a>
25841 <!--page 532 -->
25842 <a href="#7.19">&lt;stdio.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a> __cplusplus macro, <a href="#6.10.8">6.10.8</a>
25843 <a href="#7.20">&lt;stdlib.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a> __DATE__ macro, <a href="#6.10.8">6.10.8</a>
25844 <a href="#7.21">&lt;string.h&gt;</a> header, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a> __FILE__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#7.2.1.1">7.2.1.1</a>
25845 <a href="#7.22">&lt;tgmath.h&gt;</a> header, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> __func__ identifier, <a href="#6.4.2.2">6.4.2.2</a>, <a href="#7.2.1.1">7.2.1.1</a>
25846 <a href="#7.23">&lt;time.h&gt;</a> header, <a href="#7.23">7.23</a> __LINE__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#7.2.1.1">7.2.1.1</a>
25847 <a href="#7.24">&lt;wchar.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, __STDC_, <a href="#6.11.9">6.11.9</a>
25848 <a href="#7.26.12">7.26.12</a>, <a href="#F">F</a> __STDC__ macro, <a href="#6.10.8">6.10.8</a>
25849 <a href="#7.25">&lt;wctype.h&gt;</a> header, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a> __STDC_CONSTANT_MACROS macro, <a href="#7.18.4">7.18.4</a>
25850 = (equal-sign punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.8">6.7.8</a> __STDC_FORMAT_MACROS macro, <a href="#7.8.1">7.8.1</a>
25851 = (simple assignment operator), <a href="#6.5.16.1">6.5.16.1</a> __STDC_HOSTED__ macro, <a href="#6.10.8">6.10.8</a>
25852 == (equality operator), <a href="#6.5.9">6.5.9</a> __STDC_IEC_559__ macro, <a href="#6.10.8">6.10.8</a>, <a href="#F.1">F.1</a>
25853 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
25854 &gt;= (greater-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a> <a href="#6.10.8">6.10.8</a>, <a href="#G.1">G.1</a>
25855 &gt;&gt; (right-shift operator), <a href="#6.5.7">6.5.7</a> __STDC_ISO_10646__ macro, <a href="#6.10.8">6.10.8</a>
25856 &gt;&gt;= (right-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a> __STDC_LIMIT_MACROS macro, <a href="#7.18.2">7.18.2</a>,
25857 ? : (conditional operator), <a href="#6.5.15">6.5.15</a> <a href="#7.18.3">7.18.3</a>
25858 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
25859 [ ] (array subscript operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#6.10.8">6.10.8</a>, <a href="#7.17">7.17</a>
25860 [ ] (brackets punctuator), <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.8">6.7.8</a> __STDC_VERSION__ macro, <a href="#6.10.8">6.10.8</a>
25861 \ (backslash character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a> __TIME__ macro, <a href="#6.10.8">6.10.8</a>
25862 \ (escape character), <a href="#6.4.4.4">6.4.4.4</a> __VA_ARGS__ identifier, <a href="#6.10.3">6.10.3</a>, <a href="#6.10.3.1">6.10.3.1</a>
25863 \" (double-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, _Bool type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a>, <a href="#6.7.2">6.7.2</a>
25864 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> _Bool type conversions, <a href="#6.3.1.2">6.3.1.2</a>
25865 \\ (backslash escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a> _Complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
25866 \' (single-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> _Complex_I macro, <a href="#7.3.1">7.3.1</a>
25867 \0 (null character), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> _Exit function, <a href="#7.20.4.4">7.20.4.4</a>
25868 padding of binary stream, <a href="#7.19.2">7.19.2</a> _Imaginary keyword, <a href="#G.2">G.2</a>
25869 \? (question-mark escape sequence), <a href="#6.4.4.4">6.4.4.4</a> _Imaginary types, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
25870 \a (alert escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _Imaginary_I macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a>
25871 \b (backspace escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> _IOFBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
25872 \f (form-feed escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, _IOLBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.6">7.19.5.6</a>
25873 <a href="#7.4.1.10">7.4.1.10</a> _IONBF macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
25874 \n (new-line escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, _Pragma operator, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>
25875 <a href="#7.4.1.10">7.4.1.10</a> { } (braces punctuator), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>,
25876 \octal digits (octal-character escape sequence), <a href="#6.8.2">6.8.2</a>
25877 <a href="#6.4.4.4">6.4.4.4</a> { } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a>
25878 \r (carriage-return escape sequence), <a href="#5.2.2">5.2.2</a>, | (bitwise inclusive OR operator), <a href="#6.5.12">6.5.12</a>
25879 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> |= (bitwise inclusive OR assignment operator),
25880 \t (horizontal-tab escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.5.16.2">6.5.16.2</a>
25881 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a> || (logical OR operator), <a href="#6.5.14">6.5.14</a>
25882 \U (universal character names), <a href="#6.4.3">6.4.3</a> ~ (bitwise complement operator), <a href="#6.5.3.3">6.5.3.3</a>
25883 \u (universal character names), <a href="#6.4.3">6.4.3</a>
25884 \v (vertical-tab escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, abort function, <a href="#7.2.1.1">7.2.1.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.19.3">7.19.3</a>,
25885 <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.20.4.1">7.20.4.1</a>
25886 \x hexadecimal digits (hexadecimal-character abs function, <a href="#7.20.6.1">7.20.6.1</a>
25887 escape sequence), <a href="#6.4.4.4">6.4.4.4</a> absolute-value functions
25888 ^ (bitwise exclusive OR operator), <a href="#6.5.11">6.5.11</a> complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a>
25889 ^= (bitwise exclusive OR assignment operator), integer, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.20.6.1">7.20.6.1</a>
25890 <a href="#6.5.16.2">6.5.16.2</a> real, <a href="#7.12.7">7.12.7</a>, <a href="#F.9.4">F.9.4</a>
25891 __bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
25892 macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
25893 <!--page 533 -->
25894 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
25895 accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
25896 acos functions, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#F.9.1.1">F.9.1.1</a> declarator, <a href="#6.7.5.2">6.7.5.2</a>
25897 acos type-generic macro, <a href="#7.22">7.22</a> initialization, <a href="#6.7.8">6.7.8</a>
25898 acosh functions, <a href="#7.12.5.1">7.12.5.1</a>, <a href="#F.9.2.1">F.9.2.1</a> multidimensional, <a href="#6.5.2.1">6.5.2.1</a>
25899 acosh type-generic macro, <a href="#7.22">7.22</a> parameter, <a href="#6.9.1">6.9.1</a>
25900 active position, <a href="#5.2.2">5.2.2</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
25901 actual argument, <a href="#3.3">3.3</a> subscript operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
25902 actual parameter (deprecated), <a href="#3.3">3.3</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
25903 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> type, <a href="#6.2.5">6.2.5</a>
25904 addition operator (+), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, type conversion, <a href="#6.3.2.1">6.3.2.1</a>
25905 <a href="#G.5.2">G.5.2</a> variable length, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
25906 additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25907 address constant, <a href="#6.6">6.6</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
25908 address operator (&amp;), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> ASCII code set, <a href="#5.2.1.1">5.2.1.1</a>
25909 aggregate initialization, <a href="#6.7.8">6.7.8</a> asctime function, <a href="#7.23.3.1">7.23.3.1</a>
25910 aggregate types, <a href="#6.2.5">6.2.5</a> asin functions, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#F.9.1.2">F.9.1.2</a>
25911 alert escape sequence (\a), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> asin type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25912 aliasing, <a href="#6.5">6.5</a> asinh functions, <a href="#7.12.5.2">7.12.5.2</a>, <a href="#F.9.2.2">F.9.2.2</a>
25913 alignment, <a href="#3.2">3.2</a> asinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25914 pointer, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.3">6.3.2.3</a> asm keyword, <a href="#J.5.10">J.5.10</a>
25915 structure/union member, <a href="#6.7.2.1">6.7.2.1</a> assert macro, <a href="#7.2.1.1">7.2.1.1</a>
25916 allocated storage, order and contiguity, <a href="#7.20.3">7.20.3</a> assert.h header, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
25917 and macro, <a href="#7.9">7.9</a> assignment
25918 AND operators compound, <a href="#6.5.16.2">6.5.16.2</a>
25919 bitwise (&amp;), <a href="#6.5.10">6.5.10</a> conversion, <a href="#6.5.16.1">6.5.16.1</a>
25920 bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> expression, <a href="#6.5.16">6.5.16</a>
25921 logical (&amp;&amp;), <a href="#6.5.13">6.5.13</a> operators, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a>
25922 and_eq macro, <a href="#7.9">7.9</a> simple, <a href="#6.5.16.1">6.5.16.1</a>
25923 ANSI/IEEE 754, <a href="#F.1">F.1</a> associativity of operators, <a href="#6.5">6.5</a>
25924 ANSI/IEEE 854, <a href="#F.1">F.1</a> asterisk punctuator (*), <a href="#6.7.5.1">6.7.5.1</a>, <a href="#6.7.5.2">6.7.5.2</a>
25925 argc (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a> atan functions, <a href="#7.12.4.3">7.12.4.3</a>, <a href="#F.9.1.3">F.9.1.3</a>
25926 argument, <a href="#3.3">3.3</a> atan type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25927 array, <a href="#6.9.1">6.9.1</a> atan2 functions, <a href="#7.12.4.4">7.12.4.4</a>, <a href="#F.9.1.4">F.9.1.4</a>
25928 default promotions, <a href="#6.5.2.2">6.5.2.2</a> atan2 type-generic macro, <a href="#7.22">7.22</a>
25929 function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a> atanh functions, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#F.9.2.3">F.9.2.3</a>
25930 macro, substitution, <a href="#6.10.3.1">6.10.3.1</a> atanh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25931 argument, complex, <a href="#7.3.9.1">7.3.9.1</a> atexit function, <a href="#7.20.4.2">7.20.4.2</a>, <a href="#7.20.4.3">7.20.4.3</a>, <a href="#7.20.4.4">7.20.4.4</a>,
25932 argv (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a> <a href="#J.5.13">J.5.13</a>
25933 arithmetic constant expression, <a href="#6.6">6.6</a> atof function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.1">7.20.1.1</a>
25934 arithmetic conversions, usual, see usual arithmetic atoi function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
25935 conversions atol function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
25936 arithmetic operators atoll function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
25937 additive, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> auto storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
25938 bitwise, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a> automatic storage duration, <a href="#5.2.3">5.2.3</a>, <a href="#6.2.4">6.2.4</a>
25939 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>
25940 multiplicative, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a> backslash character (\), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
25941 shift, <a href="#6.5.7">6.5.7</a> backslash escape sequence (\\), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>
25942 unary, <a href="#6.5.3.3">6.5.3.3</a> backspace escape sequence (\b), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
25943 arithmetic types, <a href="#6.2.5">6.2.5</a> basic character set, <a href="#3.6">3.6</a>, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>
25944 arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
25945 <!--page 534 -->
25946 behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
25947 binary streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, calloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.1">7.20.3.1</a>, <a href="#7.20.3.2">7.20.3.2</a>,
25948 <a href="#7.19.9.4">7.19.9.4</a> <a href="#7.20.3.4">7.20.3.4</a>
25949 bit, <a href="#3.5">3.5</a> carg functions, <a href="#7.3.9.1">7.3.9.1</a>, <a href="#G.6">G.6</a>
25950 high order, <a href="#3.6">3.6</a> carg type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
25951 low order, <a href="#3.6">3.6</a> carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>,
25952 bit-field, <a href="#6.7.2.1">6.7.2.1</a> <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a>
25953 bitand macro, <a href="#7.9">7.9</a> case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
25954 bitor macro, <a href="#7.9">7.9</a> case mapping functions
25955 bitwise operators, <a href="#6.5">6.5</a> character, <a href="#7.4.2">7.4.2</a>
25956 AND, <a href="#6.5.10">6.5.10</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
25957 AND assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
25958 complement (~), <a href="#6.5.3.3">6.5.3.3</a> casin functions, <a href="#7.3.5.2">7.3.5.2</a>, <a href="#G.6">G.6</a>
25959 exclusive OR, <a href="#6.5.11">6.5.11</a> type-generic macro for, <a href="#7.22">7.22</a>
25960 exclusive OR assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> casinh functions, <a href="#7.3.6.2">7.3.6.2</a>, <a href="#G.6.2.2">G.6.2.2</a>
25961 inclusive OR, <a href="#6.5.12">6.5.12</a> type-generic macro for, <a href="#7.22">7.22</a>
25962 inclusive OR assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> cast expression, <a href="#6.5.4">6.5.4</a>
25963 shift, <a href="#6.5.7">6.5.7</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
25964 blank character, <a href="#7.4.1.3">7.4.1.3</a> catan functions, <a href="#7.3.5.3">7.3.5.3</a>, <a href="#G.6">G.6</a>
25965 block, <a href="#6.8">6.8</a>, <a href="#6.8.2">6.8.2</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> type-generic macro for, <a href="#7.22">7.22</a>
25966 block scope, <a href="#6.2.1">6.2.1</a> catanh functions, <a href="#7.3.6.3">7.3.6.3</a>, <a href="#G.6.2.3">G.6.2.3</a>
25967 block structure, <a href="#6.2.1">6.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
25968 bold type convention, <a href="#6.1">6.1</a> cbrt functions, <a href="#7.12.7.1">7.12.7.1</a>, <a href="#F.9.4.1">F.9.4.1</a>
25969 bool macro, <a href="#7.16">7.16</a> cbrt type-generic macro, <a href="#7.22">7.22</a>
25970 boolean type, <a href="#6.3.1.2">6.3.1.2</a> ccos functions, <a href="#7.3.5.4">7.3.5.4</a>, <a href="#G.6">G.6</a>
25971 boolean type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a> type-generic macro for, <a href="#7.22">7.22</a>
25972 braces punctuator ({ }), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>, ccosh functions, <a href="#7.3.6.4">7.3.6.4</a>, <a href="#G.6.2.4">G.6.2.4</a>
25973 <a href="#6.8.2">6.8.2</a> type-generic macro for, <a href="#7.22">7.22</a>
25974 brackets operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> ceil functions, <a href="#7.12.9.1">7.12.9.1</a>, <a href="#F.9.6.1">F.9.6.1</a>
25975 brackets punctuator ([ ]), <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.8">6.7.8</a> ceil type-generic macro, <a href="#7.22">7.22</a>
25976 branch cuts, <a href="#7.3.3">7.3.3</a> cerf function, <a href="#7.26.1">7.26.1</a>
25977 break statement, <a href="#6.8.6.3">6.8.6.3</a> cerfc function, <a href="#7.26.1">7.26.1</a>
25978 broken-down time, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.3">7.23.3</a>, cexp functions, <a href="#7.3.7.1">7.3.7.1</a>, <a href="#G.6.3.1">G.6.3.1</a>
25979 <a href="#7.23.3.1">7.23.3.1</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a>, <a href="#7.23.3.5">7.23.3.5</a> type-generic macro for, <a href="#7.22">7.22</a>
25980 bsearch function, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.1">7.20.5.1</a> cexp2 function, <a href="#7.26.1">7.26.1</a>
25981 btowc function, <a href="#7.24.6.1.1">7.24.6.1.1</a> cexpm1 function, <a href="#7.26.1">7.26.1</a>
25982 BUFSIZ macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.5">7.19.5.5</a> char type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>
25983 byte, <a href="#3.6">3.6</a>, <a href="#6.5.3.4">6.5.3.4</a> char type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
25984 byte input/output functions, <a href="#7.19.1">7.19.1</a> <a href="#6.3.1.8">6.3.1.8</a>
25985 byte-oriented stream, <a href="#7.19.2">7.19.2</a> CHAR_BIT macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
25986 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>
25987 <a href="#C">C</a> program, <a href="#5.1.1.1">5.1.1.1</a> CHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
25988 <a href="#C">C</a>++, <a href="#7.8.1">7.8.1</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.18.4">7.18.4</a> character, <a href="#3.7">3.7</a>, <a href="#3.7.1">3.7.1</a>
25989 cabs functions, <a href="#7.3.8.1">7.3.8.1</a>, <a href="#G.6">G.6</a> character array initialization, <a href="#6.7.8">6.7.8</a>
25990 type-generic macro for, <a href="#7.22">7.22</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
25991 cacos functions, <a href="#7.3.5.1">7.3.5.1</a>, <a href="#G.6.1.1">G.6.1.1</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
25992 type-generic macro for, <a href="#7.22">7.22</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
25993 cacosh functions, <a href="#7.3.6.1">7.3.6.1</a>, <a href="#G.6.2.1">G.6.2.1</a> character classification functions, <a href="#7.4.1">7.4.1</a>
25994 type-generic macro for, <a href="#7.22">7.22</a> wide character, <a href="#7.25.2.1">7.25.2.1</a>
25995 calendar time, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.2">7.23.2.2</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.2.4">7.23.2.4</a>, extensible, <a href="#7.25.2.2">7.25.2.2</a>
25996 <a href="#7.23.3.2">7.23.3.2</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a> character constant, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
25997 <!--page 535 -->
25998 character display semantics, <a href="#5.2.2">5.2.2</a> complex.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>, <a href="#7.26.1">7.26.1</a>,
25999 character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a> <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
26000 character input/output functions, <a href="#7.19.7">7.19.7</a> compliance, see conformance
26001 wide character, <a href="#7.24.3">7.24.3</a> components of time, <a href="#7.23.1">7.23.1</a>
26002 character sets, <a href="#5.2.1">5.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
26003 character string literal, see string literal compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
26004 character type conversion, <a href="#6.3.1.1">6.3.1.1</a> compound literals, <a href="#6.5.2.5">6.5.2.5</a>
26005 character types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.8">6.7.8</a> compound statement, <a href="#6.8.2">6.8.2</a>
26006 cimag functions, <a href="#7.3.9.2">7.3.9.2</a>, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> compound-literal operator (( ){ }), <a href="#6.5.2.5">6.5.2.5</a>
26007 cimag type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> concatenation functions
26008 cis function, <a href="#G.6">G.6</a> string, <a href="#7.21.3">7.21.3</a>
26009 classification functions wide string, <a href="#7.24.4.3">7.24.4.3</a>
26010 character, <a href="#7.4.1">7.4.1</a> concatenation, preprocessing, see preprocessing
26011 floating-point, <a href="#7.12.3">7.12.3</a> concatenation
26012 wide character, <a href="#7.25.2.1">7.25.2.1</a> conceptual models, <a href="#5.1">5.1</a>
26013 extensible, <a href="#7.25.2.2">7.25.2.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
26014 clearerr function, <a href="#7.19.10.1">7.19.10.1</a> conditional operator (? :), <a href="#6.5.15">6.5.15</a>
26015 clgamma function, <a href="#7.26.1">7.26.1</a> conformance, <a href="#4">4</a>
26016 clock function, <a href="#7.23.2.1">7.23.2.1</a> conj functions, <a href="#7.3.9.3">7.3.9.3</a>, <a href="#G.6">G.6</a>
26017 clock_t type, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.1">7.23.2.1</a> conj type-generic macro, <a href="#7.22">7.22</a>
26018 CLOCKS_PER_SEC macro, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.1">7.23.2.1</a> const type qualifier, <a href="#6.7.3">6.7.3</a>
26019 clog functions, <a href="#7.3.7.2">7.3.7.2</a>, <a href="#G.6.3.2">G.6.3.2</a> const-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.7.3">6.7.3</a>
26020 type-generic macro for, <a href="#7.22">7.22</a> constant expression, <a href="#6.6">6.6</a>, <a href="#F.7.4">F.7.4</a>
26021 clog10 function, <a href="#7.26.1">7.26.1</a> constants, <a href="#6.4.4">6.4.4</a>
26022 clog1p function, <a href="#7.26.1">7.26.1</a> as primary expression, <a href="#6.5.1">6.5.1</a>
26023 clog2 function, <a href="#7.26.1">7.26.1</a> character, <a href="#6.4.4.4">6.4.4.4</a>
26024 collating sequences, <a href="#5.2.1">5.2.1</a> enumeration, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
26025 colon punctuator (:), <a href="#6.7.2.1">6.7.2.1</a> floating, <a href="#6.4.4.2">6.4.4.2</a>
26026 comma operator (,), <a href="#6.5.17">6.5.17</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
26027 comma punctuator (,), <a href="#6.5.2">6.5.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.7.2.2">6.7.2.2</a>, integer, <a href="#6.4.4.1">6.4.4.1</a>
26028 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a> octal, <a href="#6.4.4.1">6.4.4.1</a>
26029 command processor, <a href="#7.20.4.6">7.20.4.6</a> constraint, <a href="#3.8">3.8</a>, <a href="#4">4</a>
26030 comment delimiters (/* */ and //), <a href="#6.4.9">6.4.9</a> content of structure/union/enumeration, <a href="#6.7.2.3">6.7.2.3</a>
26031 comments, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.4.9">6.4.9</a> contiguity of allocated storage, <a href="#7.20.3">7.20.3</a>
26032 common extensions, <a href="#J.5">J.5</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
26033 common initial sequence, <a href="#6.5.2.3">6.5.2.3</a> contracted expression, <a href="#6.5">6.5</a>, <a href="#7.12.2">7.12.2</a>, <a href="#F.6">F.6</a>
26034 common real type, <a href="#6.3.1.8">6.3.1.8</a> control character, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
26035 common warnings, <a href="#I">I</a> control wide character, <a href="#7.25.2">7.25.2</a>
26036 comparison functions, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.1">7.20.5.1</a>, <a href="#7.20.5.2">7.20.5.2</a> conversion, <a href="#6.3">6.3</a>
26037 string, <a href="#7.21.4">7.21.4</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
26038 wide string, <a href="#7.24.4.4">7.24.4.4</a> array argument, <a href="#6.9.1">6.9.1</a> *
26039 comparison macros, <a href="#7.12.14">7.12.14</a> array parameter, <a href="#6.9.1">6.9.1</a>
26040 comparison, pointer, <a href="#6.5.8">6.5.8</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
26041 compatible type, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.5">6.7.5</a> boolean, <a href="#6.3.1.2">6.3.1.2</a>
26042 compl macro, <a href="#7.9">7.9</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
26043 complement operator (~), <a href="#6.5.3.3">6.5.3.3</a> by assignment, <a href="#6.5.16.1">6.5.16.1</a>
26044 complex macro, <a href="#7.3.1">7.3.1</a> by return statement, <a href="#6.8.6.4">6.8.6.4</a>
26045 complex numbers, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a> complex types, <a href="#6.3.1.6">6.3.1.6</a>
26046 complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#6.3.1.7">6.3.1.7</a> explicit, <a href="#6.3">6.3</a>
26047 complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
26048 complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#G">G</a> function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
26049 <!--page 536 -->
26050 function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
26051 function parameter, <a href="#6.9.1">6.9.1</a> csinh functions, <a href="#7.3.6.5">7.3.6.5</a>, <a href="#G.6.2.5">G.6.2.5</a>
26052 imaginary, <a href="#G.4.1">G.4.1</a> type-generic macro for, <a href="#7.22">7.22</a>
26053 imaginary and complex, <a href="#G.4.3">G.4.3</a> csqrt functions, <a href="#7.3.8.3">7.3.8.3</a>, <a href="#G.6.4.2">G.6.4.2</a>
26054 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.22">7.22</a>
26055 lvalues, <a href="#6.3.2.1">6.3.2.1</a> ctan functions, <a href="#7.3.5.6">7.3.5.6</a>, <a href="#G.6">G.6</a>
26056 pointer, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> type-generic macro for, <a href="#7.22">7.22</a>
26057 real and complex, <a href="#6.3.1.7">6.3.1.7</a> ctanh functions, <a href="#7.3.6.6">7.3.6.6</a>, <a href="#G.6.2.6">G.6.2.6</a>
26058 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.22">7.22</a>
26059 real floating and integer, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> ctgamma function, <a href="#7.26.1">7.26.1</a>
26060 real floating types, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#F.3">F.3</a> ctime function, <a href="#7.23.3.2">7.23.3.2</a>
26061 signed and unsigned integers, <a href="#6.3.1.3">6.3.1.3</a> ctype.h header, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
26062 usual arithmetic, see usual arithmetic current object, <a href="#6.7.8">6.7.8</a>
26063 conversions CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
26064 void type, <a href="#6.3.2.2">6.3.2.2</a>
26065 conversion functions data stream, see streams
26066 multibyte/wide character, <a href="#7.20.7">7.20.7</a> date and time header, <a href="#7.23">7.23</a>
26067 extended, <a href="#7.24.6">7.24.6</a> Daylight Saving Time, <a href="#7.23.1">7.23.1</a>
26068 restartable, <a href="#7.24.6.3">7.24.6.3</a> DBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26069 multibyte/wide string, <a href="#7.20.8">7.20.8</a> DBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26070 restartable, <a href="#7.24.6.4">7.24.6.4</a> DBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26071 numeric, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a> DBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26072 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1">7.24.4.1</a> DBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26073 single byte/wide character, <a href="#7.24.6.1">7.24.6.1</a> DBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26074 time, <a href="#7.23.3">7.23.3</a> DBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26075 wide character, <a href="#7.24.5">7.24.5</a> DBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26076 conversion specifier, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, DBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26077 <a href="#7.24.2.2">7.24.2.2</a> decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
26078 conversion state, <a href="#7.20.7">7.20.7</a>, <a href="#7.24.6">7.24.6</a>, <a href="#7.24.6.2.1">7.24.6.2.1</a>, decimal digit, <a href="#5.2.1">5.2.1</a>
26079 <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4">7.24.6.4</a>, decimal-point character, <a href="#7.1.1">7.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26080 <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
26081 conversion state functions, <a href="#7.24.6.2">7.24.6.2</a> <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.5">F.5</a>
26082 copying functions declaration specifiers, <a href="#6.7">6.7</a>
26083 string, <a href="#7.21.2">7.21.2</a> declarations, <a href="#6.7">6.7</a>
26084 wide string, <a href="#7.24.4.2">7.24.4.2</a> function, <a href="#6.7.5.3">6.7.5.3</a>
26085 copysign functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#7.12.11.1">7.12.11.1</a>, <a href="#F.3">F.3</a>, pointer, <a href="#6.7.5.1">6.7.5.1</a>
26086 <a href="#F.9.8.1">F.9.8.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
26087 copysign type-generic macro, <a href="#7.22">7.22</a> typedef, <a href="#6.7.7">6.7.7</a>
26088 correctly rounded result, <a href="#3.9">3.9</a> declarator, <a href="#6.7.5">6.7.5</a>
26089 corresponding real type, <a href="#6.2.5">6.2.5</a> abstract, <a href="#6.7.6">6.7.6</a>
26090 cos functions, <a href="#7.12.4.5">7.12.4.5</a>, <a href="#F.9.1.5">F.9.1.5</a> declarator type derivation, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.5">6.7.5</a>
26091 cos type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
26092 cosh functions, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#F.9.2.4">F.9.2.4</a> increment and decrement
26093 cosh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> default argument promotions, <a href="#6.5.2.2">6.5.2.2</a>
26094 cpow functions, <a href="#7.3.8.2">7.3.8.2</a>, <a href="#G.6.4.1">G.6.4.1</a> default initialization, <a href="#6.7.8">6.7.8</a>
26095 type-generic macro for, <a href="#7.22">7.22</a> default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a>
26096 cproj functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> define preprocessing directive, <a href="#6.10.3">6.10.3</a>
26097 cproj type-generic macro, <a href="#7.22">7.22</a> defined operator, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.8">6.10.8</a>
26098 creal functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a> definition, <a href="#6.7">6.7</a>
26099 creal type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> function, <a href="#6.9.1">6.9.1</a>
26100 csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a> derived declarator types, <a href="#6.2.5">6.2.5</a>
26101 <!--page 537 -->
26102 derived types, <a href="#6.2.5">6.2.5</a> end-of-file indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>,
26103 designated initializer, <a href="#6.7.8">6.7.8</a> <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>,
26104 destringizing, <a href="#6.10.9">6.10.9</a> <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.10.1">7.19.10.1</a>, <a href="#7.19.10.2">7.19.10.2</a>, <a href="#7.24.3.1">7.24.3.1</a>,
26105 device input/output, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.24.3.10">7.24.3.10</a>
26106 diagnostic message, <a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a> end-of-file macro, see EOF macro
26107 diagnostics, <a href="#5.1.1.3">5.1.1.3</a> end-of-line indicator, <a href="#5.2.1">5.2.1</a>
26108 diagnostics header, <a href="#7.2">7.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
26109 difftime function, <a href="#7.23.2.2">7.23.2.2</a> enum type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.2">6.7.2.2</a>
26110 digit, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> enumerated type, <a href="#6.2.5">6.2.5</a>
26111 digraphs, <a href="#6.4.6">6.4.6</a> enumeration, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.2">6.7.2.2</a>
26112 direct input/output functions, <a href="#7.19.8">7.19.8</a> enumeration constant, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
26113 display device, <a href="#5.2.2">5.2.2</a> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
26114 div function, <a href="#7.20.6.2">7.20.6.2</a> enumeration members, <a href="#6.7.2.2">6.7.2.2</a>
26115 div_t type, <a href="#7.20">7.20</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
26116 division assignment operator (/=), <a href="#6.5.16.2">6.5.16.2</a> enumeration tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
26117 division operator (/), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a> enumerator, <a href="#6.7.2.2">6.7.2.2</a>
26118 do statement, <a href="#6.8.5.2">6.8.5.2</a> environment, <a href="#5">5</a>
26119 documentation of implementation, <a href="#4">4</a> environment functions, <a href="#7.20.4">7.20.4</a>
26120 domain error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#7.12.4.4">7.12.4.4</a>, environment list, <a href="#7.20.4.5">7.20.4.5</a>
26121 <a href="#7.12.5.1">7.12.5.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#7.12.6.7">7.12.6.7</a>, environmental considerations, <a href="#5.2">5.2</a>
26122 <a href="#7.12.6.8">7.12.6.8</a>, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, environmental limits, <a href="#5.2.4">5.2.4</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.19.2">7.19.2</a>,
26123 <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.4.4">7.19.4.4</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.20.2.1">7.20.2.1</a>, <a href="#7.20.4.2">7.20.4.2</a>,
26124 <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a> <a href="#7.24.2.1">7.24.2.1</a>
26125 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> EOF macro, <a href="#7.4">7.4</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.1">7.19.5.1</a>, <a href="#7.19.5.2">7.19.5.2</a>,
26126 double _Complex type, <a href="#6.2.5">6.2.5</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.11">7.19.6.11</a>,
26127 double _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#7.19.6.14">7.19.6.14</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.4">7.19.7.4</a>,
26128 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.7.10">7.19.7.10</a>,
26129 double _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.2.4">7.24.2.4</a>,
26130 double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.2.12">7.24.2.12</a>,
26131 <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.2">F.2</a> <a href="#7.24.3.4">7.24.3.4</a>, <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.24.6.1.2">7.24.6.1.2</a>
26132 double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, equal-sign punctuator (=), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.8">6.7.8</a>
26133 <a href="#6.3.1.8">6.3.1.8</a> equal-to operator, see equality operator
26134 double-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> equality expressions, <a href="#6.5.9">6.5.9</a>
26135 double-quote escape sequence (\"), <a href="#6.4.4.4">6.4.4.4</a>, equality operator (==), <a href="#6.5.9">6.5.9</a>
26136 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> ERANGE macro, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.12.1">7.12.1</a>,
26137 double_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a> <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, see
26138 also range error
26139 EDOM macro, <a href="#7.5">7.5</a>, <a href="#7.12.1">7.12.1</a>, see also domain error erf functions, <a href="#7.12.8.1">7.12.8.1</a>, <a href="#F.9.5.1">F.9.5.1</a>
26140 effective type, <a href="#6.5">6.5</a> erf type-generic macro, <a href="#7.22">7.22</a>
26141 EILSEQ macro, <a href="#7.5">7.5</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, erfc functions, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#F.9.5.2">F.9.5.2</a>
26142 <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a>, erfc type-generic macro, <a href="#7.22">7.22</a>
26143 see also encoding error errno macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.3.2">7.3.2</a>, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>,
26144 element type, <a href="#6.2.5">6.2.5</a> <a href="#7.12.1">7.12.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.10.4">7.19.10.4</a>,
26145 elif preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.24.3.1">7.24.3.1</a>,
26146 ellipsis punctuator (...), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a> <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>,
26147 else preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a>, <a href="#J.5.17">J.5.17</a>
26148 else statement, <a href="#6.8.4.1">6.8.4.1</a> errno.h header, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
26149 empty statement, <a href="#6.8.3">6.8.3</a> error
26150 encoding error, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, domain, see domain error
26151 <a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> encoding, see encoding error
26152 end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
26153 <!--page 538 -->
26154 error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
26155 error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.9.5">F.9.5</a> extended integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>,
26156 error indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.18">7.18</a>
26157 <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.8">7.19.7.8</a>, extended multibyte/wide character conversion
26158 <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.10.1">7.19.10.1</a>, <a href="#7.19.10.3">7.19.10.3</a>, utilities, <a href="#7.24.6">7.24.6</a>
26159 <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a> extensible wide character case mapping functions,
26160 error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> <a href="#7.25.3.2">7.25.3.2</a>
26161 error-handling functions, <a href="#7.19.10">7.19.10</a>, <a href="#7.21.6.2">7.21.6.2</a> extensible wide character classification functions,
26162 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.25.2.2">7.25.2.2</a>
26163 escape sequences, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.11.4">6.11.4</a> extern storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.7.1">6.7.1</a>
26164 evaluation format, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#7.12">7.12</a> external definition, <a href="#6.9">6.9</a>
26165 evaluation method, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#F.7.5">F.7.5</a> external identifiers, underscore, <a href="#7.1.3">7.1.3</a>
26166 evaluation order, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
26167 exceptional condition, <a href="#6.5">6.5</a>, <a href="#7.12.1">7.12.1</a> external name, <a href="#6.4.2.1">6.4.2.1</a>
26168 excess precision, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, external object definitions, <a href="#6.9.2">6.9.2</a>
26169 <a href="#6.8.6.4">6.8.6.4</a>
26170 excess range, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> fabs functions, <a href="#7.12.7.2">7.12.7.2</a>, <a href="#F.9.4.2">F.9.4.2</a>
26171 exclusive OR operators fabs type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
26172 bitwise (^), <a href="#6.5.11">6.5.11</a> false macro, <a href="#7.16">7.16</a>
26173 bitwise assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> fclose function, <a href="#7.19.5.1">7.19.5.1</a>
26174 executable program, <a href="#5.1.1.1">5.1.1.1</a> fdim functions, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#F.9.9.1">F.9.9.1</a>
26175 execution character set, <a href="#5.2.1">5.2.1</a> fdim type-generic macro, <a href="#7.22">7.22</a>
26176 execution environment, <a href="#5">5</a>, <a href="#5.1.2">5.1.2</a>, see also FE_ALL_EXCEPT macro, <a href="#7.6">7.6</a>
26177 environmental limits FE_DFL_ENV macro, <a href="#7.6">7.6</a>
26178 execution sequence, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.8">6.8</a> FE_DIVBYZERO macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26179 exit function, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a>, FE_DOWNWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26180 <a href="#7.20.4.4">7.20.4.4</a> FE_INEXACT macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26181 EXIT_FAILURE macro, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a> FE_INVALID macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26182 EXIT_SUCCESS macro, <a href="#7.20">7.20</a>, <a href="#7.20.4.3">7.20.4.3</a> FE_OVERFLOW macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26183 exp functions, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#F.9.3.1">F.9.3.1</a> FE_TONEAREST macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26184 exp type-generic macro, <a href="#7.22">7.22</a> FE_TOWARDZERO macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26185 exp2 functions, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#F.9.3.2">F.9.3.2</a> FE_UNDERFLOW macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26186 exp2 type-generic macro, <a href="#7.22">7.22</a> FE_UPWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26187 explicit conversion, <a href="#6.3">6.3</a> feclearexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.1">7.6.2.1</a>, <a href="#F.3">F.3</a>
26188 expm1 functions, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#F.9.3.3">F.9.3.3</a> fegetenv function, <a href="#7.6.4.1">7.6.4.1</a>, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
26189 expm1 type-generic macro, <a href="#7.22">7.22</a> fegetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.2">7.6.2.2</a>, <a href="#F.3">F.3</a>
26190 exponent part, <a href="#6.4.4.2">6.4.4.2</a> fegetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.1">7.6.3.1</a>, <a href="#F.3">F.3</a>
26191 exponential functions feholdexcept function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.3">7.6.4.3</a>,
26192 complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a> <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
26193 real, <a href="#7.12.6">7.12.6</a>, <a href="#F.9.3">F.9.3</a> fenv.h header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>, <a href="#H">H</a>
26194 expression, <a href="#6.5">6.5</a> FENV_ACCESS pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#F.7">F.7</a>, <a href="#F.8">F.8</a>,
26195 assignment, <a href="#6.5.16">6.5.16</a> <a href="#F.9">F.9</a>
26196 cast, <a href="#6.5.4">6.5.4</a> fenv_t type, <a href="#7.6">7.6</a>
26197 constant, <a href="#6.6">6.6</a> feof function, <a href="#7.19.10.2">7.19.10.2</a>
26198 full, <a href="#6.8">6.8</a> feraiseexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.3">7.6.2.3</a>, <a href="#F.3">F.3</a>
26199 order of evaluation, <a href="#6.5">6.5</a> ferror function, <a href="#7.19.10.3">7.19.10.3</a>
26200 parenthesized, <a href="#6.5.1">6.5.1</a> fesetenv function, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#F.3">F.3</a>
26201 primary, <a href="#6.5.1">6.5.1</a> fesetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.4">7.6.2.4</a>, <a href="#F.3">F.3</a>
26202 unary, <a href="#6.5.3">6.5.3</a> fesetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.2">7.6.3.2</a>, <a href="#F.3">F.3</a>
26203 expression statement, <a href="#6.8.3">6.8.3</a> fetestexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.5">7.6.2.5</a>, <a href="#F.3">F.3</a>
26204 extended character set, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.1.2">5.2.1.2</a> feupdateenv function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
26205 <!--page 539 -->
26206 fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.7.6">F.7.6</a>
26207 fflush function, <a href="#7.19.5.2">7.19.5.2</a>, <a href="#7.19.5.3">7.19.5.3</a> floor functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.9.6.2">F.9.6.2</a>
26208 fgetc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, floor type-generic macro, <a href="#7.22">7.22</a>
26209 <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.8.1">7.19.8.1</a> FLT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26210 fgetpos function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a> FLT_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26211 fgets function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.2">7.19.7.2</a> FLT_EVAL_METHOD macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.8.6.4">6.8.6.4</a>,
26212 fgetwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.12">7.12</a>
26213 <a href="#7.24.3.6">7.24.3.6</a> FLT_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26214 fgetws function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.2">7.24.3.2</a> FLT_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26215 field width, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> FLT_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26216 file, <a href="#7.19.3">7.19.3</a> FLT_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26217 access functions, <a href="#7.19.5">7.19.5</a> FLT_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26218 name, <a href="#7.19.3">7.19.3</a> FLT_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26219 operations, <a href="#7.19.4">7.19.4</a> FLT_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26220 position indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, FLT_RADIX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26221 <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>, <a href="#7.19.7.3">7.19.7.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>
26222 <a href="#7.19.8.1">7.19.8.1</a>, <a href="#7.19.8.2">7.19.8.2</a>, <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.2">7.19.9.2</a>, FLT_ROUNDS macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a>
26223 <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.19.9.4">7.19.9.4</a>, <a href="#7.19.9.5">7.19.9.5</a>, <a href="#7.24.3.1">7.24.3.1</a>, fma functions, <a href="#7.12">7.12</a>, <a href="#7.12.13.1">7.12.13.1</a>, <a href="#F.9.10.1">F.9.10.1</a>
26224 <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.3.10">7.24.3.10</a> fma type-generic macro, <a href="#7.22">7.22</a>
26225 positioning functions, <a href="#7.19.9">7.19.9</a> fmax functions, <a href="#7.12.12.2">7.12.12.2</a>, <a href="#F.9.9.2">F.9.9.2</a>
26226 file scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.9">6.9</a> fmax type-generic macro, <a href="#7.22">7.22</a>
26227 FILE type, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> fmin functions, <a href="#7.12.12.3">7.12.12.3</a>, <a href="#F.9.9.3">F.9.9.3</a>
26228 FILENAME_MAX macro, <a href="#7.19.1">7.19.1</a> fmin type-generic macro, <a href="#7.22">7.22</a>
26229 flags, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> fmod functions, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#F.9.7.1">F.9.7.1</a>
26230 floating-point status, see floating-point status fmod type-generic macro, <a href="#7.22">7.22</a>
26231 flag fopen function, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.5.4">7.19.5.4</a>
26232 flexible array member, <a href="#6.7.2.1">6.7.2.1</a> FOPEN_MAX macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.4.3">7.19.4.3</a>
26233 float _Complex type, <a href="#6.2.5">6.2.5</a> for statement, <a href="#6.8.5">6.8.5</a>, <a href="#6.8.5.3">6.8.5.3</a>
26234 float _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, form-feed character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
26235 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a> form-feed escape sequence (\f), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
26236 float _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.4.1.10">7.4.1.10</a>
26237 float type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#F.2">F.2</a> formal argument (deprecated), <a href="#3.15">3.15</a>
26238 float type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, formal parameter, <a href="#3.15">3.15</a>
26239 <a href="#6.3.1.8">6.3.1.8</a> formatted input/output functions, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.19.6">7.19.6</a>
26240 float.h header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>, wide character, <a href="#7.24.2">7.24.2</a>
26241 <a href="#7.24.4.1.1">7.24.4.1.1</a> fortran keyword, <a href="#J.5.9">J.5.9</a>
26242 float_t type, <a href="#7.12">7.12</a>, <a href="#J.5.6">J.5.6</a> forward reference, <a href="#3.11">3.11</a>
26243 floating constant, <a href="#6.4.4.2">6.4.4.2</a> FP_CONTRACT pragma, <a href="#6.5">6.5</a>, <a href="#6.10.6">6.10.6</a>, <a href="#7.12.2">7.12.2</a>, see
26244 floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a> also contracted expression
26245 floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>, FP_FAST_FMA macro, <a href="#7.12">7.12</a>
26246 <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> FP_FAST_FMAF macro, <a href="#7.12">7.12</a>
26247 floating types, <a href="#6.2.5">6.2.5</a>, <a href="#6.11.1">6.11.1</a> FP_FAST_FMAL macro, <a href="#7.12">7.12</a>
26248 floating-point accuracy, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.5">6.5</a>, FP_ILOGB0 macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
26249 <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.5">F.5</a>, see also contracted expression FP_ILOGBNAN macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
26250 floating-point arithmetic functions, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> FP_INFINITE macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26251 floating-point classification functions, <a href="#7.12.3">7.12.3</a> FP_NAN macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26252 floating-point control mode, <a href="#7.6">7.6</a>, <a href="#F.7.6">F.7.6</a> FP_NORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26253 floating-point environment, <a href="#7.6">7.6</a>, <a href="#F.7">F.7</a>, <a href="#F.7.6">F.7.6</a> FP_SUBNORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26254 floating-point exception, <a href="#7.6">7.6</a>, <a href="#7.6.2">7.6.2</a>, <a href="#F.9">F.9</a> FP_ZERO macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
26255 floating-point number, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.2.5">6.2.5</a> fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a>
26256 floating-point rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a> fpos_t type, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>
26257 <!--page 540 -->
26258 fprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.1">7.19.6.1</a>, language, <a href="#6.11">6.11</a>
26259 <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.5">7.19.6.5</a>, <a href="#7.19.6.6">7.19.6.6</a>, library, <a href="#7.26">7.26</a>
26260 <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.3">F.3</a> fwide function, <a href="#7.19.2">7.19.2</a>, <a href="#7.24.3.5">7.24.3.5</a>
26261 fputc function, <a href="#5.2.2">5.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.7.3">7.19.7.3</a>, fwprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.2">7.19.6.2</a>,
26262 <a href="#7.19.7.8">7.19.7.8</a>, <a href="#7.19.8.2">7.19.8.2</a> <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.2.3">7.24.2.3</a>, <a href="#7.24.2.5">7.24.2.5</a>,
26263 fputs function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.4">7.19.7.4</a> <a href="#7.24.2.11">7.24.2.11</a>
26264 fputwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.24.3.3">7.24.3.3</a>, fwrite function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.2">7.19.8.2</a>
26265 <a href="#7.24.3.8">7.24.3.8</a> fwscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.2">7.24.2.2</a>,
26266 fputws function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.4">7.24.3.4</a> <a href="#7.24.2.4">7.24.2.4</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.12">7.24.2.12</a>, <a href="#7.24.3.10">7.24.3.10</a>
26267 fread function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.1">7.19.8.1</a>
26268 free function, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a> gamma functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.9.5">F.9.5</a>
26269 freestanding execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, general utilities, <a href="#7.20">7.20</a>
26270 <a href="#5.1.2.1">5.1.2.1</a> wide string, <a href="#7.24.4">7.24.4</a>
26271 freopen function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.4">7.19.5.4</a> general wide string utilities, <a href="#7.24.4">7.24.4</a>
26272 frexp functions, <a href="#7.12.6.4">7.12.6.4</a>, <a href="#F.9.3.4">F.9.3.4</a> generic parameters, <a href="#7.22">7.22</a>
26273 frexp type-generic macro, <a href="#7.22">7.22</a> getc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>
26274 fscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, getchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.6">7.19.7.6</a>
26275 <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#F.3">F.3</a> getenv function, <a href="#7.20.4.5">7.20.4.5</a>
26276 fseek function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, gets function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.26.9">7.26.9</a>
26277 <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a>, <a href="#7.19.9.5">7.19.9.5</a>, <a href="#7.24.3.10">7.24.3.10</a> getwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.6">7.24.3.6</a>, <a href="#7.24.3.7">7.24.3.7</a>
26278 fsetpos function, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, getwchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.7">7.24.3.7</a>
26279 <a href="#7.19.9.1">7.19.9.1</a>, <a href="#7.19.9.3">7.19.9.3</a>, <a href="#7.24.3.10">7.24.3.10</a> gmtime function, <a href="#7.23.3.3">7.23.3.3</a>
26280 ftell function, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a> goto statement, <a href="#6.2.1">6.2.1</a>, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.6.1">6.8.6.1</a>
26281 full declarator, <a href="#6.7.5">6.7.5</a> graphic characters, <a href="#5.2.1">5.2.1</a>
26282 full expression, <a href="#6.8">6.8</a> greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a>
26283 fully buffered stream, <a href="#7.19.3">7.19.3</a> greater-than-or-equal-to operator (&gt;=), <a href="#6.5.8">6.5.8</a>
26284 function
26285 argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a> header, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.2">7.1.2</a>, see also standard headers
26286 body, <a href="#6.9.1">6.9.1</a> header names, <a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>, <a href="#6.10.2">6.10.2</a>
26287 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>
26288 library, <a href="#7.1.4">7.1.4</a> hexadecimal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
26289 declarator, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.11.6">6.11.6</a> hexadecimal prefix, <a href="#6.4.4.1">6.4.4.1</a>
26290 definition, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.7">6.11.7</a> hexadecimal-character escape sequence
26291 designator, <a href="#6.3.2.1">6.3.2.1</a> (\x hexadecimal digits), <a href="#6.4.4.4">6.4.4.4</a>
26292 image, <a href="#5.2.3">5.2.3</a> high-order bit, <a href="#3.6">3.6</a>
26293 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.4">7.1.4</a> horizontal-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
26294 name length, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> horizontal-tab escape sequence (\r), <a href="#7.25.2.1.3">7.25.2.1.3</a>
26295 parameter, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a> horizontal-tab escape sequence (\t), <a href="#5.2.2">5.2.2</a>,
26296 prototype, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.7">6.2.7</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>
26297 <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.6">6.11.6</a>, <a href="#6.11.7">6.11.7</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.12">7.12</a> hosted execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.2">5.1.2.2</a>
26298 prototype scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.7.5.2">6.7.5.2</a> HUGE_VAL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26299 recursive call, <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
26300 return, <a href="#6.8.6.4">6.8.6.4</a> HUGE_VALF macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26301 scope, <a href="#6.2.1">6.2.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
26302 type, <a href="#6.2.5">6.2.5</a> HUGE_VALL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26303 type conversion, <a href="#6.3.2.1">6.3.2.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#F.9">F.9</a>
26304 function specifiers, <a href="#6.7.4">6.7.4</a> hyperbolic functions
26305 function type, <a href="#6.2.5">6.2.5</a> complex, <a href="#7.3.6">7.3.6</a>, <a href="#G.6.2">G.6.2</a>
26306 function-call operator (( )), <a href="#6.5.2.2">6.5.2.2</a> real, <a href="#7.12.5">7.12.5</a>, <a href="#F.9.2">F.9.2</a>
26307 function-like macro, <a href="#6.10.3">6.10.3</a> hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.9.4.3">F.9.4.3</a>
26308 future directions hypot type-generic macro, <a href="#7.22">7.22</a>
26309 <!--page 541 -->
26310 <a href="#I">I</a> macro, <a href="#7.3.1">7.3.1</a>, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> initial position, <a href="#5.2.2">5.2.2</a>
26311 identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a> initial shift state, <a href="#5.2.1.2">5.2.1.2</a>
26312 linkage, see linkage initialization, <a href="#5.1.2">5.1.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.5">6.5.2.5</a>, <a href="#6.7.8">6.7.8</a>,
26313 maximum length, <a href="#6.4.2.1">6.4.2.1</a> <a href="#F.7.5">F.7.5</a>
26314 name spaces, <a href="#6.2.3">6.2.3</a> in blocks, <a href="#6.8">6.8</a>
26315 reserved, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a> initializer, <a href="#6.7.8">6.7.8</a>
26316 scope, <a href="#6.2.1">6.2.1</a> permitted form, <a href="#6.6">6.6</a>
26317 type, <a href="#6.2.5">6.2.5</a> string literal, <a href="#6.3.2.1">6.3.2.1</a>
26318 identifier list, <a href="#6.7.5">6.7.5</a> inline, <a href="#6.7.4">6.7.4</a>
26319 identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a> inner scope, <a href="#6.2.1">6.2.1</a>
26320 IEC 559, <a href="#F.1">F.1</a> input failure, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a>
26321 IEC 60559, <a href="#2">2</a>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8">6.10.8</a>, <a href="#7.3.3">7.3.3</a>, <a href="#7.6">7.6</a>, input/output functions
26322 <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.14">7.12.14</a>, <a href="#F">F</a>, <a href="#G">G</a>, <a href="#H.1">H.1</a> character, <a href="#7.19.7">7.19.7</a>
26323 IEEE 754, <a href="#F.1">F.1</a> direct, <a href="#7.19.8">7.19.8</a>
26324 IEEE 854, <a href="#F.1">F.1</a> formatted, <a href="#7.19.6">7.19.6</a>
26325 IEEE floating-point arithmetic standard, see wide character, <a href="#7.24.2">7.24.2</a>
26326 IEC 60559, ANSI/IEEE 754, wide character, <a href="#7.24.3">7.24.3</a>
26327 ANSI/IEEE 854 formatted, <a href="#7.24.2">7.24.2</a>
26328 if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, input/output header, <a href="#7.19">7.19</a>
26329 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> input/output, device, <a href="#5.1.2.3">5.1.2.3</a>
26330 if statement, <a href="#6.8.4.1">6.8.4.1</a> int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.7.2">6.7.2</a>
26331 ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
26332 ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.3.1.8">6.3.1.8</a>
26333 ilogb functions, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.9.3.5">F.9.3.5</a> INT_FASTN_MAX macros, <a href="#7.18.2.3">7.18.2.3</a>
26334 ilogb type-generic macro, <a href="#7.22">7.22</a> INT_FASTN_MIN macros, <a href="#7.18.2.3">7.18.2.3</a>
26335 imaginary macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a> int_fastN_t types, <a href="#7.18.1.3">7.18.1.3</a>
26336 imaginary numbers, <a href="#G">G</a> INT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
26337 imaginary type domain, <a href="#G.2">G.2</a> INT_LEASTN_MIN macros, <a href="#7.18.2.2">7.18.2.2</a>
26338 imaginary types, <a href="#G">G</a> int_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
26339 imaxabs function, <a href="#7.8.2.1">7.8.2.1</a> INT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
26340 imaxdiv function, <a href="#7.8">7.8</a>, <a href="#7.8.2.2">7.8.2.2</a> INT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>
26341 imaxdiv_t type, <a href="#7.8">7.8</a> integer arithmetic functions, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>,
26342 implementation, <a href="#3.12">3.12</a> <a href="#7.20.6">7.20.6</a>
26343 implementation limit, <a href="#3.13">3.13</a>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.4.2.1">6.4.2.1</a>, integer character constant, <a href="#6.4.4.4">6.4.4.4</a>
26344 <a href="#6.7.5">6.7.5</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#E">E</a>, see also environmental integer constant, <a href="#6.4.4.1">6.4.4.1</a>
26345 limits integer constant expression, <a href="#6.6">6.6</a>
26346 implementation-defined behavior, <a href="#3.4.1">3.4.1</a>, <a href="#4">4</a>, <a href="#J.3">J.3</a> integer conversion rank, <a href="#6.3.1.1">6.3.1.1</a>
26347 implementation-defined value, <a href="#3.17.1">3.17.1</a> integer promotions, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.3.1.1">6.3.1.1</a>,
26348 implicit conversion, <a href="#6.3">6.3</a> <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.3.3">6.5.3.3</a>, <a href="#6.5.7">6.5.7</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#7.18.2">7.18.2</a>, <a href="#7.18.3">7.18.3</a>,
26349 implicit initialization, <a href="#6.7.8">6.7.8</a> <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>
26350 include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.2">6.10.2</a> integer suffix, <a href="#6.4.4.1">6.4.4.1</a>
26351 inclusive OR operators integer type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
26352 bitwise (|), <a href="#6.5.12">6.5.12</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
26353 bitwise assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> integer types, <a href="#6.2.5">6.2.5</a>, <a href="#7.18">7.18</a>
26354 incomplete type, <a href="#6.2.5">6.2.5</a> extended, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#7.18">7.18</a>
26355 increment operators, see arithmetic operators, interactive device, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.3">7.19.5.3</a>
26356 increment and decrement internal linkage, <a href="#6.2.2">6.2.2</a>
26357 indeterminate value, <a href="#3.17.2">3.17.2</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
26358 indirection operator (*), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> interrupt, <a href="#5.2.3">5.2.3</a>
26359 inequality operator (!=), <a href="#6.5.9">6.5.9</a> INTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
26360 INFINITY macro, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> INTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
26361 <!--page 542 -->
26362 INTMAX_MIN macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a> iswalpha function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
26363 intmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26364 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> iswblank function, <a href="#7.25.2.1.3">7.25.2.1.3</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26365 INTN_C macros, <a href="#7.18.4.1">7.18.4.1</a> iswcntrl function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.4">7.25.2.1.4</a>,
26366 INTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26367 INTN_MIN macros, <a href="#7.18.2.1">7.18.2.1</a> iswctype function, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
26368 intN_t types, <a href="#7.18.1.1">7.18.1.1</a> iswdigit function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
26369 INTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a> <a href="#7.25.2.1.5">7.25.2.1.5</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26370 INTPTR_MIN macro, <a href="#7.18.2.4">7.18.2.4</a> iswgraph function, <a href="#7.25.2.1">7.25.2.1</a>, <a href="#7.25.2.1.6">7.25.2.1.6</a>,
26371 intptr_t type, <a href="#7.18.1.4">7.18.1.4</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26372 inttypes.h header, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a> iswlower function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.7">7.25.2.1.7</a>,
26373 isalnum function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.9">7.4.1.9</a>, <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.1.2">7.25.3.1.2</a>
26374 isalpha function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a> iswprint function, <a href="#7.25.2.1.6">7.25.2.1.6</a>, <a href="#7.25.2.1.8">7.25.2.1.8</a>,
26375 isblank function, <a href="#7.4.1.3">7.4.1.3</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>
26376 iscntrl function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.4">7.4.1.4</a>, <a href="#7.4.1.7">7.4.1.7</a>, iswpunct function, <a href="#7.25.2.1">7.25.2.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
26377 <a href="#7.4.1.11">7.4.1.11</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>,
26378 isdigit function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.5">7.4.1.5</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26379 <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.11.1.1">7.11.1.1</a> iswspace function, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>,
26380 isfinite macro, <a href="#7.12.3.2">7.12.3.2</a>, <a href="#F.3">F.3</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.6">7.25.2.1.6</a>,
26381 isgraph function, <a href="#7.4.1.6">7.4.1.6</a> <a href="#7.25.2.1.7">7.25.2.1.7</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, <a href="#7.25.2.1.10">7.25.2.1.10</a>,
26382 isgreater macro, <a href="#7.12.14.1">7.12.14.1</a>, <a href="#F.3">F.3</a> <a href="#7.25.2.1.11">7.25.2.1.11</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26383 isgreaterequal macro, <a href="#7.12.14.2">7.12.14.2</a>, <a href="#F.3">F.3</a> iswupper function, <a href="#7.25.2.1.2">7.25.2.1.2</a>, <a href="#7.25.2.1.11">7.25.2.1.11</a>,
26384 isinf macro, <a href="#7.12.3.3">7.12.3.3</a> <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.1.2">7.25.3.1.2</a>
26385 isless macro, <a href="#7.12.14.3">7.12.14.3</a>, <a href="#F.3">F.3</a> iswxdigit function, <a href="#7.25.2.1.12">7.25.2.1.12</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
26386 islessequal macro, <a href="#7.12.14.4">7.12.14.4</a>, <a href="#F.3">F.3</a> isxdigit function, <a href="#7.4.1.12">7.4.1.12</a>, <a href="#7.11.1.1">7.11.1.1</a>
26387 islessgreater macro, <a href="#7.12.14.5">7.12.14.5</a>, <a href="#F.3">F.3</a> italic type convention, <a href="#3">3</a>, <a href="#6.1">6.1</a>
26388 islower function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.2.1">7.4.2.1</a>, iteration statements, <a href="#6.8.5">6.8.5</a>
26389 <a href="#7.4.2.2">7.4.2.2</a>
26390 isnan macro, <a href="#7.12.3.4">7.12.3.4</a>, <a href="#F.3">F.3</a> jmp_buf type, <a href="#7.13">7.13</a>
26391 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a> jump statements, <a href="#6.8.6">6.8.6</a>
26392 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
26393 ISO 4217, <a href="#2">2</a>, <a href="#7.11.2.1">7.11.2.1</a> keywords, <a href="#6.4.1">6.4.1</a>, <a href="#G.2">G.2</a>, <a href="#J.5.9">J.5.9</a>, <a href="#J.5.10">J.5.10</a>
26394 ISO 8601, <a href="#2">2</a>, <a href="#7.23.3.5">7.23.3.5</a> known constant size, <a href="#6.2.5">6.2.5</a>
26395 ISO/IEC 10646, <a href="#2">2</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.4.3">6.4.3</a>, <a href="#6.10.8">6.10.8</a>
26396 ISO/IEC 10976-1, <a href="#H.1">H.1</a> L_tmpnam macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.4">7.19.4.4</a>
26397 ISO/IEC 2382-1, <a href="#2">2</a>, <a href="#3">3</a> label name, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.3">6.2.3</a>
26398 ISO/IEC 646, <a href="#2">2</a>, <a href="#5.2.1.1">5.2.1.1</a> labeled statement, <a href="#6.8.1">6.8.1</a>
26399 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labs function, <a href="#7.20.6.1">7.20.6.1</a>
26400 ISO/IEC TR 10176, <a href="#D">D</a> language, <a href="#6">6</a>
26401 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> future directions, <a href="#6.11">6.11</a>
26402 isprint function, <a href="#5.2.2">5.2.2</a>, <a href="#7.4.1.8">7.4.1.8</a> syntax summary, <a href="#A">A</a>
26403 ispunct function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, Latin alphabet, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
26404 <a href="#7.4.1.11">7.4.1.11</a> LC_ALL macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26405 isspace function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, LC_COLLATE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.3">7.21.4.3</a>,
26406 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.4.2">7.24.4.4.2</a>
26407 <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a> LC_CTYPE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.20">7.20</a>, <a href="#7.20.7">7.20.7</a>,
26408 isunordered macro, <a href="#7.12.14.6">7.12.14.6</a>, <a href="#F.3">F.3</a> <a href="#7.20.8">7.20.8</a>, <a href="#7.24.6">7.24.6</a>, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>,
26409 isupper function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.4.2.1">7.4.2.1</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
26410 <a href="#7.4.2.2">7.4.2.2</a> LC_MONETARY macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26411 iswalnum function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, LC_NUMERIC macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26412 <a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a> LC_TIME macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3.5">7.23.3.5</a>
26413 <!--page 543 -->
26414 lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
26415 LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> lldiv function, <a href="#7.20.6.2">7.20.6.2</a>
26416 LDBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> lldiv_t type, <a href="#7.20">7.20</a>
26417 LDBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> LLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>,
26418 LDBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.24.4.1.2">7.24.4.1.2</a>
26419 LDBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> LLONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>,
26420 LDBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.24.4.1.2">7.24.4.1.2</a>
26421 LDBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.5">F.9.6.5</a>
26422 LDBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llrint type-generic macro, <a href="#7.22">7.22</a>
26423 LDBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.7">F.9.6.7</a>
26424 ldexp functions, <a href="#7.12.6.6">7.12.6.6</a>, <a href="#F.9.3.6">F.9.3.6</a> llround type-generic macro, <a href="#7.22">7.22</a>
26425 ldexp type-generic macro, <a href="#7.22">7.22</a> local time, <a href="#7.23.1">7.23.1</a>
26426 ldiv function, <a href="#7.20.6.2">7.20.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
26427 ldiv_t type, <a href="#7.20">7.20</a> locale-specific behavior, <a href="#3.4.2">3.4.2</a>, <a href="#J.4">J.4</a>
26428 leading underscore in identifiers, <a href="#7.1.3">7.1.3</a> locale.h header, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
26429 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>
26430 left-shift operator (&lt;&lt;), <a href="#6.5.7">6.5.7</a> localization, <a href="#7.11">7.11</a>
26431 length localtime function, <a href="#7.23.3.4">7.23.3.4</a>
26432 external name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> log functions, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#F.9.3.7">F.9.3.7</a>
26433 function name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> log type-generic macro, <a href="#7.22">7.22</a>
26434 identifier, <a href="#6.4.2.1">6.4.2.1</a> log10 functions, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#F.9.3.8">F.9.3.8</a>
26435 internal name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a> log10 type-generic macro, <a href="#7.22">7.22</a>
26436 length function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.24.4.6.1">7.24.4.6.1</a>, log1p functions, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#F.9.3.9">F.9.3.9</a>
26437 <a href="#7.24.6.3.1">7.24.6.3.1</a> log1p type-generic macro, <a href="#7.22">7.22</a>
26438 length modifier, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, log2 functions, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#F.9.3.10">F.9.3.10</a>
26439 <a href="#7.24.2.2">7.24.2.2</a> log2 type-generic macro, <a href="#7.22">7.22</a>
26440 less-than operator (&lt;), <a href="#6.5.8">6.5.8</a> logarithmic functions
26441 less-than-or-equal-to operator (&lt;=), <a href="#6.5.8">6.5.8</a> complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
26442 letter, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> real, <a href="#7.12.6">7.12.6</a>, <a href="#F.9.3">F.9.3</a>
26443 lexical elements, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a> logb functions, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.11">F.9.3.11</a>
26444 lgamma functions, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#F.9.5.3">F.9.5.3</a> logb type-generic macro, <a href="#7.22">7.22</a>
26445 lgamma type-generic macro, <a href="#7.22">7.22</a> logical operators
26446 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a> AND (&amp;&amp;), <a href="#6.5.13">6.5.13</a>
26447 future directions, <a href="#7.26">7.26</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
26448 summary, <a href="#B">B</a> OR (||), <a href="#6.5.14">6.5.14</a>
26449 terms, <a href="#7.1.1">7.1.1</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
26450 use of functions, <a href="#7.1.4">7.1.4</a> long double _Complex type, <a href="#6.2.5">6.2.5</a>
26451 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type conversion,
26452 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>
26453 environmental, see environmental limits long double _Imaginary type, <a href="#G.2">G.2</a>
26454 implementation, see implementation limits long double suffix, l or <a href="#L">L</a>, <a href="#6.4.4.2">6.4.4.2</a>
26455 numerical, see numerical limits long double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>,
26456 translation, see translation limits <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.2">F.2</a>
26457 limits.h header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a> long double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>,
26458 line buffered stream, <a href="#7.19.3">7.19.3</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
26459 line number, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8">6.10.8</a> long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
26460 line preprocessing directive, <a href="#6.10.4">6.10.4</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
26461 lines, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#7.19.2">7.19.2</a> long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
26462 preprocessing directive, <a href="#6.10">6.10</a> <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
26463 linkage, <a href="#6.2.2">6.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.4">6.7.4</a>, <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.9">6.9</a>, <a href="#6.9.2">6.9.2</a>, long integer suffix, l or <a href="#L">L</a>, <a href="#6.4.4.1">6.4.4.1</a>
26464 <a href="#6.11.2">6.11.2</a> long long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>,
26465 <!--page 544 -->
26466 <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> mbsinit function, <a href="#7.24.6.2.1">7.24.6.2.1</a>
26467 long long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, mbsrtowcs function, <a href="#7.24.6.4.1">7.24.6.4.1</a>
26468 <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> mbstate_t type, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.1">7.19.6.1</a>,
26469 long long integer suffix, ll or LL, <a href="#6.4.4.1">6.4.4.1</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.6">7.24.6</a>,
26470 LONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.6.2.1">7.24.6.2.1</a>, <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.24.6.3.1">7.24.6.3.1</a>, <a href="#7.24.6.4">7.24.6.4</a>
26471 LONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> mbstowcs function, <a href="#6.4.5">6.4.5</a>, <a href="#7.20.8.1">7.20.8.1</a>, <a href="#7.24.6.4">7.24.6.4</a>
26472 longjmp function, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>, <a href="#7.20.4.3">7.20.4.3</a> mbtowc function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.20.7.2">7.20.7.2</a>, <a href="#7.20.8.1">7.20.8.1</a>,
26473 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.24.6.3">7.24.6.3</a>
26474 low-order bit, <a href="#3.6">3.6</a> member access operators (. and -&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26475 lowercase letter, <a href="#5.2.1">5.2.1</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
26476 lrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.5">F.9.6.5</a> memchr function, <a href="#7.21.5.1">7.21.5.1</a>
26477 lrint type-generic macro, <a href="#7.22">7.22</a> memcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.1">7.21.4.1</a>
26478 lround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.7">F.9.6.7</a> memcpy function, <a href="#7.21.2.1">7.21.2.1</a>
26479 lround type-generic macro, <a href="#7.22">7.22</a> memmove function, <a href="#7.21.2.2">7.21.2.2</a>
26480 lvalue, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.3.1">6.5.3.1</a>, <a href="#6.5.16">6.5.16</a> memory management functions, <a href="#7.20.3">7.20.3</a>
26481 memset function, <a href="#7.21.6.1">7.21.6.1</a>
26482 macro argument substitution, <a href="#6.10.3.1">6.10.3.1</a> minimum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a>
26483 macro definition minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
26484 library function, <a href="#7.1.4">7.1.4</a> miscellaneous functions
26485 macro invocation, <a href="#6.10.3">6.10.3</a> string, <a href="#7.21.6">7.21.6</a>
26486 macro name, <a href="#6.10.3">6.10.3</a> wide string, <a href="#7.24.4.6">7.24.4.6</a>
26487 length, <a href="#5.2.4.1">5.2.4.1</a> mktime function, <a href="#7.23.2.3">7.23.2.3</a>
26488 predefined, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a> modf functions, <a href="#7.12.6.12">7.12.6.12</a>, <a href="#F.9.3.12">F.9.3.12</a>
26489 redefinition, <a href="#6.10.3">6.10.3</a> modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
26490 scope, <a href="#6.10.3.5">6.10.3.5</a> modulus functions, <a href="#7.12.6.12">7.12.6.12</a>
26491 macro parameter, <a href="#6.10.3">6.10.3</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
26492 macro preprocessor, <a href="#6.10">6.10</a> multibyte character, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
26493 macro replacement, <a href="#6.10.3">6.10.3</a> multibyte conversion functions
26494 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> wide character, <a href="#7.20.7">7.20.7</a>
26495 main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#6.7.3.1">6.7.3.1</a>, <a href="#6.7.4">6.7.4</a>, extended, <a href="#7.24.6">7.24.6</a>
26496 <a href="#7.19.3">7.19.3</a> restartable, <a href="#7.24.6.3">7.24.6.3</a>
26497 malloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.3">7.20.3.3</a>, wide string, <a href="#7.20.8">7.20.8</a>
26498 <a href="#7.20.3.4">7.20.3.4</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
26499 manipulation functions multibyte string, <a href="#7.1.1">7.1.1</a>
26500 complex, <a href="#7.3.9">7.3.9</a> multibyte/wide character conversion functions,
26501 real, <a href="#7.12.11">7.12.11</a>, <a href="#F.9.8">F.9.8</a> <a href="#7.20.7">7.20.7</a>
26502 matching failure, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.10">7.24.2.10</a> extended, <a href="#7.24.6">7.24.6</a>
26503 math.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>, <a href="#F.9">F.9</a>, restartable, <a href="#7.24.6.3">7.24.6.3</a>
26504 <a href="#J.5.17">J.5.17</a> multibyte/wide string conversion functions, <a href="#7.20.8">7.20.8</a>
26505 MATH_ERREXCEPT macro, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
26506 math_errhandling macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.12">7.12</a>, <a href="#F.9">F.9</a> multidimensional array, <a href="#6.5.2.1">6.5.2.1</a>
26507 MATH_ERRNO macro, <a href="#7.12">7.12</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
26508 maximum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a> multiplication operator (*), <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a>
26509 MB_CUR_MAX macro, <a href="#7.1.1">7.1.1</a>, <a href="#7.20">7.20</a>, <a href="#7.20.7.2">7.20.7.2</a>, multiplicative expressions, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
26510 <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>
26511 MB_LEN_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.1.1">7.1.1</a>, <a href="#7.20">7.20</a> n-char sequence, <a href="#7.20.1.3">7.20.1.3</a>
26512 mblen function, <a href="#7.20.7.1">7.20.7.1</a>, <a href="#7.24.6.3">7.24.6.3</a> n-wchar sequence, <a href="#7.24.4.1.1">7.24.4.1.1</a>
26513 mbrlen function, <a href="#7.24.6.3.1">7.24.6.3.1</a> name
26514 mbrtowc function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, external, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a>
26515 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.6.3.1">7.24.6.3.1</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>, file, <a href="#7.19.3">7.19.3</a>
26516 <a href="#7.24.6.4.1">7.24.6.4.1</a> internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
26517 <!--page 545 -->
26518 label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
26519 structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
26520 name spaces, <a href="#6.2.3">6.2.3</a> offsetof macro, <a href="#7.17">7.17</a>
26521 named label, <a href="#6.8.1">6.8.1</a> on-off switch, <a href="#6.10.6">6.10.6</a>
26522 NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a> ones' complement, <a href="#6.2.6.2">6.2.6.2</a>
26523 nan functions, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#F.2.1">F.2.1</a>, <a href="#F.9.8.2">F.9.8.2</a> operand, <a href="#6.4.6">6.4.6</a>, <a href="#6.5">6.5</a>
26524 NAN macro, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> operating system, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#7.20.4.6">7.20.4.6</a>
26525 NDEBUG macro, <a href="#7.2">7.2</a> operations on files, <a href="#7.19.4">7.19.4</a>
26526 nearbyint functions, <a href="#7.12.9.3">7.12.9.3</a>, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, operator, <a href="#6.4.6">6.4.6</a>
26527 <a href="#F.9.6.3">F.9.6.3</a> operators, <a href="#6.5">6.5</a>
26528 nearbyint type-generic macro, <a href="#7.22">7.22</a> assignment, <a href="#6.5.16">6.5.16</a>
26529 nearest integer functions, <a href="#7.12.9">7.12.9</a>, <a href="#F.9.6">F.9.6</a> associativity, <a href="#6.5">6.5</a>
26530 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> equality, <a href="#6.5.9">6.5.9</a>
26531 negative zero, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.12.11.1">7.12.11.1</a> multiplicative, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
26532 new-line character, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#6.10.4">6.10.4</a> postfix, <a href="#6.5.2">6.5.2</a>
26533 new-line escape sequence (\n), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, precedence, <a href="#6.5">6.5</a>
26534 <a href="#7.4.1.10">7.4.1.10</a> preprocessing, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>, <a href="#6.10.9">6.10.9</a>
26535 nextafter functions, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, relational, <a href="#6.5.8">6.5.8</a>
26536 <a href="#F.9.8.3">F.9.8.3</a> shift, <a href="#6.5.7">6.5.7</a>
26537 nextafter type-generic macro, <a href="#7.22">7.22</a> unary, <a href="#6.5.3">6.5.3</a>
26538 nexttoward functions, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, <a href="#F.9.8.4">F.9.8.4</a> unary arithmetic, <a href="#6.5.3.3">6.5.3.3</a>
26539 nexttoward type-generic macro, <a href="#7.22">7.22</a> or macro, <a href="#7.9">7.9</a>
26540 no linkage, <a href="#6.2.2">6.2.2</a> OR operators
26541 non-stop floating-point control mode, <a href="#7.6.4.2">7.6.4.2</a> bitwise exclusive (^), <a href="#6.5.11">6.5.11</a>
26542 nongraphic characters, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> bitwise exclusive assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
26543 nonlocal jumps header, <a href="#7.13">7.13</a> bitwise inclusive (|), <a href="#6.5.12">6.5.12</a>
26544 norm, complex, <a href="#7.3.8.1">7.3.8.1</a> bitwise inclusive assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
26545 not macro, <a href="#7.9">7.9</a> logical (||), <a href="#6.5.14">6.5.14</a>
26546 not-equal-to operator, see inequality operator or_eq macro, <a href="#7.9">7.9</a>
26547 not_eq macro, <a href="#7.9">7.9</a> order of allocated storage, <a href="#7.20.3">7.20.3</a>
26548 null character (\0), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> order of evaluation, <a href="#6.5">6.5</a>
26549 padding of binary stream, <a href="#7.19.2">7.19.2</a> ordinary identifier name space, <a href="#6.2.3">6.2.3</a>
26550 NULL macro, <a href="#7.11">7.11</a>, <a href="#7.17">7.17</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.20">7.20</a>, <a href="#7.21.1">7.21.1</a>, orientation of stream, <a href="#7.19.2">7.19.2</a>, <a href="#7.24.3.5">7.24.3.5</a>
26551 <a href="#7.23.1">7.23.1</a>, <a href="#7.24.1">7.24.1</a> outer scope, <a href="#6.2.1">6.2.1</a>
26552 null pointer, <a href="#6.3.2.3">6.3.2.3</a>
26553 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> padding
26554 null preprocessing directive, <a href="#6.10.7">6.10.7</a> binary stream, <a href="#7.19.2">7.19.2</a>
26555 null statement, <a href="#6.8.3">6.8.3</a> bits, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.18.1.1">7.18.1.1</a>
26556 null wide character, <a href="#7.1.1">7.1.1</a> structure/union, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a>
26557 number classification macros, <a href="#7.12">7.12</a>, <a href="#7.12.3.1">7.12.3.1</a> parameter, <a href="#3.15">3.15</a>
26558 numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a> array, <a href="#6.9.1">6.9.1</a>
26559 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1">7.24.4.1</a> ellipsis, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.10.3">6.10.3</a>
26560 numerical limits, <a href="#5.2.4.2">5.2.4.2</a> function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a>
26561 macro, <a href="#6.10.3">6.10.3</a>
26562 object, <a href="#3.14">3.14</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
26563 object representation, <a href="#6.2.6.1">6.2.6.1</a> program, <a href="#5.1.2.2.1">5.1.2.2.1</a>
26564 object type, <a href="#6.2.5">6.2.5</a> parameter type list, <a href="#6.7.5.3">6.7.5.3</a>
26565 object-like macro, <a href="#6.10.3">6.10.3</a> parentheses punctuator (( )), <a href="#6.7.5.3">6.7.5.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a>
26566 obsolescence, <a href="#6.11">6.11</a>, <a href="#7.26">7.26</a> parenthesized expression, <a href="#6.5.1">6.5.1</a>
26567 octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</a>
26568 octal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.4">6.4.4.4</a> permitted form of initializer, <a href="#6.6">6.6</a>
26569 <!--page 546 -->
26570 perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
26571 phase angle, complex, <a href="#7.3.9.1">7.3.9.1</a> primary expression, <a href="#6.5.1">6.5.1</a>
26572 physical source lines, <a href="#5.1.1.2">5.1.1.2</a> printf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.10">7.19.6.10</a>
26573 placemarker, <a href="#6.10.3.3">6.10.3.3</a> printing character, <a href="#5.2.2">5.2.2</a>, <a href="#7.4">7.4</a>, <a href="#7.4.1.8">7.4.1.8</a>
26574 plus operator, unary, <a href="#6.5.3.3">6.5.3.3</a> printing wide character, <a href="#7.25.2">7.25.2</a>
26575 pointer arithmetic, <a href="#6.5.6">6.5.6</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
26576 pointer comparison, <a href="#6.5.8">6.5.8</a> program execution, <a href="#5.1.2.2.2">5.1.2.2.2</a>, <a href="#5.1.2.3">5.1.2.3</a>
26577 pointer declarator, <a href="#6.7.5.1">6.7.5.1</a> program file, <a href="#5.1.1.1">5.1.1.1</a>
26578 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> program image, <a href="#5.1.1.2">5.1.1.2</a>
26579 pointer to function, <a href="#6.5.2.2">6.5.2.2</a> program name (argv[0]), <a href="#5.1.2.2.1">5.1.2.2.1</a>
26580 pointer type, <a href="#6.2.5">6.2.5</a> program parameters, <a href="#5.1.2.2.1">5.1.2.2.1</a>
26581 pointer type conversion, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> program startup, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.1">5.1.2.2.1</a>
26582 pointer, null, <a href="#6.3.2.3">6.3.2.3</a> program structure, <a href="#5.1.1.1">5.1.1.1</a>
26583 portability, <a href="#4">4</a>, <a href="#J">J</a> program termination, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>,
26584 position indicator, file, see file position indicator <a href="#5.1.2.3">5.1.2.3</a>
26585 positive difference, <a href="#7.12.12.1">7.12.12.1</a> program, conforming, <a href="#4">4</a>
26586 positive difference functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.9.9">F.9.9</a> program, strictly conforming, <a href="#4">4</a>
26587 postfix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> promotions
26588 postfix expressions, <a href="#6.5.2">6.5.2</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
26589 postfix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> integer, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.3.1.1">6.3.1.1</a>
26590 pow functions, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#F.9.4.4">F.9.4.4</a> prototype, see function prototype
26591 pow type-generic macro, <a href="#7.22">7.22</a> pseudo-random sequence functions, <a href="#7.20.2">7.20.2</a>
26592 power functions PTRDIFF_MAX macro, <a href="#7.18.3">7.18.3</a>
26593 complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a> PTRDIFF_MIN macro, <a href="#7.18.3">7.18.3</a>
26594 real, <a href="#7.12.7">7.12.7</a>, <a href="#F.9.4">F.9.4</a> ptrdiff_t type, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>,
26595 pp-number, <a href="#6.4.8">6.4.8</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
26596 pragma operator, <a href="#6.10.9">6.10.9</a> punctuators, <a href="#6.4.6">6.4.6</a>
26597 pragma preprocessing directive, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> putc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.8">7.19.7.8</a>, <a href="#7.19.7.9">7.19.7.9</a>
26598 precedence of operators, <a href="#6.5">6.5</a> putchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.9">7.19.7.9</a>
26599 precedence of syntax rules, <a href="#5.1.1.2">5.1.1.2</a> puts function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.10">7.19.7.10</a>
26600 precision, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a> putwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.8">7.24.3.8</a>, <a href="#7.24.3.9">7.24.3.9</a>
26601 excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> putwchar function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.9">7.24.3.9</a>
26602 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
26603 prefix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> qsort function, <a href="#7.20.5">7.20.5</a>, <a href="#7.20.5.2">7.20.5.2</a>
26604 prefix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> qualified types, <a href="#6.2.5">6.2.5</a>
26605 preprocessing concatenation, <a href="#6.10.3.3">6.10.3.3</a> qualified version of type, <a href="#6.2.5">6.2.5</a>
26606 preprocessing directives, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10">6.10</a> question-mark escape sequence (\?), <a href="#6.4.4.4">6.4.4.4</a>
26607 preprocessing file, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.10">6.10</a> quiet NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26608 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
26609 preprocessing operators raise function, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a>, <a href="#7.20.4.1">7.20.4.1</a>
26610 #, <a href="#6.10.3.2">6.10.3.2</a> rand function, <a href="#7.20">7.20</a>, <a href="#7.20.2.1">7.20.2.1</a>, <a href="#7.20.2.2">7.20.2.2</a>
26611 ##, <a href="#6.10.3.3">6.10.3.3</a> RAND_MAX macro, <a href="#7.20">7.20</a>, <a href="#7.20.2.1">7.20.2.1</a>
26612 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> range
26613 defined, <a href="#6.10.1">6.10.1</a> excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>
26614 preprocessing tokens, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a> range error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#7.12.5.5">7.12.5.5</a>,
26615 preprocessing translation unit, <a href="#5.1.1.1">5.1.1.1</a> <a href="#7.12.6.1">7.12.6.1</a>, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#7.12.6.5">7.12.6.5</a>,
26616 preprocessor, <a href="#6.10">6.10</a> <a href="#7.12.6.6">7.12.6.6</a>, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#7.12.6.9">7.12.6.9</a>,
26617 PRIcFASTN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#7.12.7.3">7.12.7.3</a>,
26618 PRIcLEASTN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#7.12.8.4">7.12.8.4</a>,
26619 PRIcMAX macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.12.1">7.12.12.1</a>,
26620 PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
26621 <!--page 547 -->
26622 rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
26623 real floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, save calling environment function, <a href="#7.13.1">7.13.1</a>
26624 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> scalar types, <a href="#6.2.5">6.2.5</a>
26625 real floating types, <a href="#6.2.5">6.2.5</a> scalbln function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.13">F.9.3.13</a>
26626 real type domain, <a href="#6.2.5">6.2.5</a> scalbln type-generic macro, <a href="#7.22">7.22</a>
26627 real types, <a href="#6.2.5">6.2.5</a> scalbn function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.9.3.13">F.9.3.13</a>
26628 real-floating, <a href="#7.12.3">7.12.3</a> scalbn type-generic macro, <a href="#7.22">7.22</a>
26629 realloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.2">7.20.3.2</a>, <a href="#7.20.3.4">7.20.3.4</a> scanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.19.6.11">7.19.6.11</a>
26630 recommended practice, <a href="#3.16">3.16</a> scanlist, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>
26631 recursion, <a href="#6.5.2.2">6.5.2.2</a> scanset, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>
26632 recursive function call, <a href="#6.5.2.2">6.5.2.2</a> SCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26633 redefinition of macro, <a href="#6.10.3">6.10.3</a> SCHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26634 reentrancy, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a> SCNcFASTN macros, <a href="#7.8.1">7.8.1</a>
26635 library functions, <a href="#7.1.4">7.1.4</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
26636 referenced type, <a href="#6.2.5">6.2.5</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
26637 register storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a> SCNcN macros, <a href="#7.8.1">7.8.1</a>
26638 relational expressions, <a href="#6.5.8">6.5.8</a> SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
26639 reliability of data, interrupted, <a href="#5.1.2.3">5.1.2.3</a> scope of identifier, <a href="#6.2.1">6.2.1</a>, <a href="#6.9.2">6.9.2</a>
26640 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> search functions
26641 remainder functions, <a href="#7.12.10">7.12.10</a>, <a href="#F.9.7">F.9.7</a> string, <a href="#7.21.5">7.21.5</a>
26642 remainder functions, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, utility, <a href="#7.20.5">7.20.5</a>
26643 <a href="#F.9.7.2">F.9.7.2</a> wide string, <a href="#7.24.4.5">7.24.4.5</a>
26644 remainder operator (%), <a href="#6.5.5">6.5.5</a> SEEK_CUR macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
26645 remainder type-generic macro, <a href="#7.22">7.22</a> SEEK_END macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
26646 remove function, <a href="#7.19.4.1">7.19.4.1</a>, <a href="#7.19.4.4">7.19.4.4</a> SEEK_SET macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.9.2">7.19.9.2</a>
26647 remquo functions, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, <a href="#F.9.7.3">F.9.7.3</a> selection statements, <a href="#6.8.4">6.8.4</a>
26648 remquo type-generic macro, <a href="#7.22">7.22</a> self-referential structure, <a href="#6.7.2.3">6.7.2.3</a>
26649 rename function, <a href="#7.19.4.2">7.19.4.2</a> semicolon punctuator (;), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>,
26650 representations of types, <a href="#6.2.6">6.2.6</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
26651 pointer, <a href="#6.2.5">6.2.5</a> separate compilation, <a href="#5.1.1.1">5.1.1.1</a>
26652 rescanning and replacement, <a href="#6.10.3.4">6.10.3.4</a> separate translation, <a href="#5.1.1.1">5.1.1.1</a>
26653 reserved identifiers, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a> sequence points, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.8">6.8</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.19.6">7.19.6</a>,
26654 restartable multibyte/wide character conversion <a href="#7.20.5">7.20.5</a>, <a href="#7.24.2">7.24.2</a>, <a href="#C">C</a>
26655 functions, <a href="#7.24.6.3">7.24.6.3</a> sequencing of statements, <a href="#6.8">6.8</a>
26656 restartable multibyte/wide string conversion setbuf function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.1">7.19.5.1</a>, <a href="#7.19.5.5">7.19.5.5</a>
26657 functions, <a href="#7.24.6.4">7.24.6.4</a> setjmp macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>
26658 restore calling environment function, <a href="#7.13.2">7.13.2</a> setjmp.h header, <a href="#7.13">7.13</a>
26659 restrict type qualifier, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a> setlocale function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26660 restrict-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a> setvbuf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.1">7.19.5.1</a>,
26661 return statement, <a href="#6.8.6.4">6.8.6.4</a> <a href="#7.19.5.5">7.19.5.5</a>, <a href="#7.19.5.6">7.19.5.6</a>
26662 rewind function, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.5">7.19.9.5</a>, shall, <a href="#4">4</a>
26663 <a href="#7.24.3.10">7.24.3.10</a> shift expressions, <a href="#6.5.7">6.5.7</a>
26664 right-shift assignment operator (&gt;&gt;=), <a href="#6.5.16.2">6.5.16.2</a> shift sequence, <a href="#7.1.1">7.1.1</a>
26665 right-shift operator (&gt;&gt;), <a href="#6.5.7">6.5.7</a> shift states, <a href="#5.2.1.2">5.2.1.2</a>
26666 rint functions, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, <a href="#F.9.6.4">F.9.6.4</a> short identifier, character, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.3">6.4.3</a>
26667 rint type-generic macro, <a href="#7.22">7.22</a> short int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>,
26668 round functions, <a href="#7.12.9.6">7.12.9.6</a>, <a href="#F.9.6.6">F.9.6.6</a> <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>
26669 round type-generic macro, <a href="#7.22">7.22</a> short int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
26670 rounding mode, floating point, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
26671 rvalue, <a href="#6.3.2.1">6.3.2.1</a> SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26672 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26673 <!--page 548 -->
26674 side effects, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a> source lines, <a href="#5.1.1.2">5.1.1.2</a>
26675 SIG_ATOMIC_MAX macro, <a href="#7.18.3">7.18.3</a> source text, <a href="#5.1.1.2">5.1.1.2</a>
26676 SIG_ATOMIC_MIN macro, <a href="#7.18.3">7.18.3</a> space character (' '), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>,
26677 sig_atomic_t type, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.18.3">7.18.3</a> <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.25.2.1.3">7.25.2.1.3</a>
26678 SIG_DFL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sprintf function, <a href="#7.19.6.6">7.19.6.6</a>, <a href="#7.19.6.13">7.19.6.13</a>
26679 SIG_ERR macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sqrt functions, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#F.3">F.3</a>, <a href="#F.9.4.5">F.9.4.5</a>
26680 SIG_IGN macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> sqrt type-generic macro, <a href="#7.22">7.22</a>
26681 SIGABRT macro, <a href="#7.14">7.14</a>, <a href="#7.20.4.1">7.20.4.1</a> srand function, <a href="#7.20.2.2">7.20.2.2</a>
26682 SIGFPE macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.5.17">J.5.17</a> sscanf function, <a href="#7.19.6.7">7.19.6.7</a>, <a href="#7.19.6.14">7.19.6.14</a>
26683 SIGILL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> standard error stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.10.4">7.19.10.4</a>
26684 SIGINT macro, <a href="#7.14">7.14</a> standard headers, <a href="#4">4</a>, <a href="#7.1.2">7.1.2</a>
26685 sign and magnitude, <a href="#6.2.6.2">6.2.6.2</a> <a href="#7.2">&lt;assert.h&gt;</a>, <a href="#7.2">7.2</a>, <a href="#B.1">B.1</a>
26686 sign bit, <a href="#6.2.6.2">6.2.6.2</a> <a href="#7.3">&lt;complex.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>, <a href="#7.26.1">7.26.1</a>,
26687 signal function, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.20.4.4">7.20.4.4</a> <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
26688 signal handler, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a> <a href="#7.4">&lt;ctype.h&gt;</a>, <a href="#7.4">7.4</a>, <a href="#7.26.2">7.26.2</a>
26689 signal handling functions, <a href="#7.14.1">7.14.1</a> <a href="#7.5">&lt;errno.h&gt;</a>, <a href="#7.5">7.5</a>, <a href="#7.26.3">7.26.3</a>
26690 signal.h header, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a> <a href="#7.6">&lt;fenv.h&gt;</a>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F">F</a>, <a href="#H">H</a>
26691 signaling NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#F.2.1">F.2.1</a> <a href="#7.7">&lt;float.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26692 signals, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1">7.14.1</a> <a href="#7.24.4.1.1">7.24.4.1.1</a>
26693 signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a> <a href="#7.8">&lt;inttypes.h&gt;</a>, <a href="#7.8">7.8</a>, <a href="#7.26.4">7.26.4</a>
26694 signed char type, <a href="#6.2.5">6.2.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#4">4</a>, <a href="#7.9">7.9</a>
26695 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
26696 signed character, <a href="#6.3.1.1">6.3.1.1</a> <a href="#7.11">&lt;locale.h&gt;</a>, <a href="#7.11">7.11</a>, <a href="#7.26.5">7.26.5</a>
26697 signed integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a> <a href="#7.12">&lt;math.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.22">7.22</a>, <a href="#F">F</a>, <a href="#F.9">F.9</a>,
26698 signed type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#J.5.17">J.5.17</a>
26699 <a href="#6.3.1.8">6.3.1.8</a> <a href="#7.13">&lt;setjmp.h&gt;</a>, <a href="#7.13">7.13</a>
26700 signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a> <a href="#7.14">&lt;signal.h&gt;</a>, <a href="#7.14">7.14</a>, <a href="#7.26.6">7.26.6</a>
26701 significand part, <a href="#6.4.4.2">6.4.4.2</a> <a href="#7.15">&lt;stdarg.h&gt;</a>, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a>
26702 SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a> <a href="#7.16">&lt;stdbool.h&gt;</a>, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a>
26703 SIGTERM macro, <a href="#7.14">7.14</a> <a href="#7.17">&lt;stddef.h&gt;</a>, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
26704 simple assignment operator (=), <a href="#6.5.16.1">6.5.16.1</a> <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a>
26705 sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.9.1.6">F.9.1.6</a> <a href="#7.18">&lt;stdint.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.18">7.18</a>,
26706 sin type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#7.26.8">7.26.8</a>
26707 single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a> <a href="#7.19">&lt;stdio.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a>
26708 single-byte/wide character conversion functions, <a href="#7.20">&lt;stdlib.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a>
26709 <a href="#7.24.6.1">7.24.6.1</a> <a href="#7.21">&lt;string.h&gt;</a>, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a>
26710 single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.22">&lt;tgmath.h&gt;</a>, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
26711 single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> <a href="#7.23">&lt;time.h&gt;</a>, <a href="#7.23">7.23</a>
26712 sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.9.2.5">F.9.2.5</a> <a href="#7.24">&lt;wchar.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, <a href="#7.26.12">7.26.12</a>,
26713 sinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#F">F</a>
26714 SIZE_MAX macro, <a href="#7.18.3">7.18.3</a> <a href="#7.25">&lt;wctype.h&gt;</a>, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
26715 size_t type, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.1">7.19.1</a>, standard input stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>
26716 <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20">7.20</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.23.1">7.23.1</a>, standard integer types, <a href="#6.2.5">6.2.5</a>
26717 <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> standard output stream, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a>
26718 sizeof operator, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3">6.5.3</a>, <a href="#6.5.3.4">6.5.3.4</a> standard signed integer types, <a href="#6.2.5">6.2.5</a>
26719 snprintf function, <a href="#7.19.6.5">7.19.6.5</a>, <a href="#7.19.6.12">7.19.6.12</a> state-dependent encoding, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#7.20.7">7.20.7</a>
26720 sorting utility functions, <a href="#7.20.5">7.20.5</a> statements, <a href="#6.8">6.8</a>
26721 source character set, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a> break, <a href="#6.8.6.3">6.8.6.3</a>
26722 source file, <a href="#5.1.1.1">5.1.1.1</a> compound, <a href="#6.8.2">6.8.2</a>
26723 name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8">6.10.8</a> continue, <a href="#6.8.6.2">6.8.6.2</a>
26724 source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
26725 <!--page 549 -->
26726 else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
26727 expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
26728 for, <a href="#6.8.5.3">6.8.5.3</a> comparison functions, <a href="#7.21.4">7.21.4</a>
26729 goto, <a href="#6.8.6.1">6.8.6.1</a> concatenation functions, <a href="#7.21.3">7.21.3</a>
26730 if, <a href="#6.8.4.1">6.8.4.1</a> conversion functions, <a href="#7.11.1.1">7.11.1.1</a>
26731 iteration, <a href="#6.8.5">6.8.5</a> copying functions, <a href="#7.21.2">7.21.2</a>
26732 jump, <a href="#6.8.6">6.8.6</a> library function conventions, <a href="#7.21.1">7.21.1</a>
26733 labeled, <a href="#6.8.1">6.8.1</a> literal, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.7.8">6.7.8</a>
26734 null, <a href="#6.8.3">6.8.3</a> miscellaneous functions, <a href="#7.21.6">7.21.6</a>
26735 return, <a href="#6.8.6.4">6.8.6.4</a> numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1">7.20.1</a>
26736 selection, <a href="#6.8.4">6.8.4</a> search functions, <a href="#7.21.5">7.21.5</a>
26737 sequencing, <a href="#6.8">6.8</a> string handling header, <a href="#7.21">7.21</a>
26738 switch, <a href="#6.8.4.2">6.8.4.2</a> string.h header, <a href="#7.21">7.21</a>, <a href="#7.26.11">7.26.11</a>
26739 while, <a href="#6.8.5.1">6.8.5.1</a> stringizing, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.9">6.10.9</a>
26740 static storage duration, <a href="#6.2.4">6.2.4</a> strlen function, <a href="#7.21.6.3">7.21.6.3</a>
26741 static storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.7.1">6.7.1</a> strncat function, <a href="#7.21.3.2">7.21.3.2</a>
26742 static, in array declarators, <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.7.5.3">6.7.5.3</a> strncmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.4">7.21.4.4</a>
26743 stdarg.h header, <a href="#4">4</a>, <a href="#6.7.5.3">6.7.5.3</a>, <a href="#7.15">7.15</a> strncpy function, <a href="#7.21.2.4">7.21.2.4</a>
26744 stdbool.h header, <a href="#4">4</a>, <a href="#7.16">7.16</a>, <a href="#7.26.7">7.26.7</a>, <a href="#H">H</a> strpbrk function, <a href="#7.21.5.4">7.21.5.4</a>
26745 STDC, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> strrchr function, <a href="#7.21.5.5">7.21.5.5</a>
26746 stddef.h header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, strspn function, <a href="#7.21.5.6">7.21.5.6</a>
26747 <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.17">7.17</a> strstr function, <a href="#7.21.5.7">7.21.5.7</a>
26748 stderr macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a> strtod function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.3">7.20.1.3</a>,
26749 stdin macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.4">7.19.6.4</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#F.3">F.3</a>
26750 <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.24.2.12">7.24.2.12</a>, <a href="#7.24.3.7">7.24.3.7</a> strtof function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.3">F.3</a>
26751 stdint.h header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.18">7.18</a>, strtoimax function, <a href="#7.8.2.3">7.8.2.3</a>
26752 <a href="#7.26.8">7.26.8</a> strtok function, <a href="#7.21.5.8">7.21.5.8</a>
26753 stdio.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a> strtol function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.2">7.20.1.2</a>,
26754 stdlib.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a> <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a>
26755 stdout macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.3">7.19.6.3</a>, strtold function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.20.1.3">7.20.1.3</a>, <a href="#F.3">F.3</a>
26756 <a href="#7.19.7.9">7.19.7.9</a>, <a href="#7.19.7.10">7.19.7.10</a>, <a href="#7.24.2.11">7.24.2.11</a>, <a href="#7.24.3.9">7.24.3.9</a> strtoll function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1.2">7.20.1.2</a>, <a href="#7.20.1.4">7.20.1.4</a>
26757 storage duration, <a href="#6.2.4">6.2.4</a> strtoul function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20.1.2">7.20.1.2</a>,
26758 storage order of array, <a href="#6.5.2.1">6.5.2.1</a> <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.2">7.24.2.2</a>
26759 storage-class specifiers, <a href="#6.7.1">6.7.1</a>, <a href="#6.11.5">6.11.5</a> strtoull function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.20.1.2">7.20.1.2</a>, <a href="#7.20.1.4">7.20.1.4</a>
26760 strcat function, <a href="#7.21.3.1">7.21.3.1</a> strtoumax function, <a href="#7.8.2.3">7.8.2.3</a>
26761 strchr function, <a href="#7.21.5.2">7.21.5.2</a> struct hack, see flexible array member
26762 strcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.2">7.21.4.2</a> structure
26763 strcoll function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.5">7.21.4.5</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26764 strcpy function, <a href="#7.21.2.3">7.21.2.3</a> content, <a href="#6.7.2.3">6.7.2.3</a>
26765 strcspn function, <a href="#7.21.5.3">7.21.5.3</a> dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>
26766 streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.20.4.3">7.20.4.3</a> initialization, <a href="#6.7.8">6.7.8</a>
26767 fully buffered, <a href="#7.19.3">7.19.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
26768 line buffered, <a href="#7.19.3">7.19.3</a> member name space, <a href="#6.2.3">6.2.3</a>
26769 orientation, <a href="#7.19.2">7.19.2</a> member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>
26770 standard error, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26771 standard input, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> specifier, <a href="#6.7.2.1">6.7.2.1</a>
26772 standard output, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.3">7.19.3</a> tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
26773 unbuffered, <a href="#7.19.3">7.19.3</a> type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>
26774 strerror function, <a href="#7.19.10.4">7.19.10.4</a>, <a href="#7.21.6.2">7.21.6.2</a> strxfrm function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.4.5">7.21.4.5</a>
26775 strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3">7.23.3</a>, <a href="#7.23.3.5">7.23.3.5</a>, subscripting, <a href="#6.5.2.1">6.5.2.1</a>
26776 <a href="#7.24.5.1">7.24.5.1</a> subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a>
26777 <!--page 550 -->
26778 subtraction operator (-), <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> tolower function, <a href="#7.4.2.1">7.4.2.1</a>
26779 suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
26780 floating constant, <a href="#6.4.4.2">6.4.4.2</a> towctrans function, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
26781 integer constant, <a href="#6.4.4.1">6.4.4.1</a> towlower function, <a href="#7.25.3.1.1">7.25.3.1.1</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>
26782 switch body, <a href="#6.8.4.2">6.8.4.2</a> towupper function, <a href="#7.25.3.1.2">7.25.3.1.2</a>, <a href="#7.25.3.2.1">7.25.3.2.1</a>
26783 switch case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation environment, <a href="#5">5</a>, <a href="#5.1.1">5.1.1</a>
26784 switch default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation limits, <a href="#5.2.4.1">5.2.4.1</a>
26785 switch statement, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> translation phases, <a href="#5.1.1.2">5.1.1.2</a>
26786 swprintf function, <a href="#7.24.2.3">7.24.2.3</a>, <a href="#7.24.2.7">7.24.2.7</a> translation unit, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.9">6.9</a>
26787 swscanf function, <a href="#7.24.2.4">7.24.2.4</a>, <a href="#7.24.2.8">7.24.2.8</a> trap representation, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.3.2.3">6.3.2.3</a>,
26788 symbols, <a href="#3">3</a> <a href="#6.5.2.3">6.5.2.3</a>
26789 syntactic categories, <a href="#6.1">6.1</a> trigonometric functions
26790 syntax notation, <a href="#6.1">6.1</a> complex, <a href="#7.3.5">7.3.5</a>, <a href="#G.6.1">G.6.1</a>
26791 syntax rule precedence, <a href="#5.1.1.2">5.1.1.2</a> real, <a href="#7.12.4">7.12.4</a>, <a href="#F.9.1">F.9.1</a>
26792 syntax summary, language, <a href="#A">A</a> trigraph sequences, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1.1">5.2.1.1</a>
26793 system function, <a href="#7.20.4.6">7.20.4.6</a> true macro, <a href="#7.16">7.16</a>
26794 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.9.6.8">F.9.6.8</a>
26795 tab characters, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> trunc type-generic macro, <a href="#7.22">7.22</a>
26796 tag compatibility, <a href="#6.2.7">6.2.7</a> truncation, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.5.3">7.19.5.3</a>
26797 tag name space, <a href="#6.2.3">6.2.3</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
26798 tags, <a href="#6.7.2.3">6.7.2.3</a> two's complement, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.18.1.1">7.18.1.1</a>
26799 tan functions, <a href="#7.12.4.7">7.12.4.7</a>, <a href="#F.9.1.7">F.9.1.7</a> type category, <a href="#6.2.5">6.2.5</a>
26800 tan type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> type conversion, <a href="#6.3">6.3</a>
26801 tanh functions, <a href="#7.12.5.6">7.12.5.6</a>, <a href="#F.9.2.6">F.9.2.6</a> type definitions, <a href="#6.7.7">6.7.7</a>
26802 tanh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> type domain, <a href="#6.2.5">6.2.5</a>, <a href="#G.2">G.2</a>
26803 tentative definition, <a href="#6.9.2">6.9.2</a> type names, <a href="#6.7.6">6.7.6</a>
26804 terms, <a href="#3">3</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
26805 text streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.9.4">7.19.9.4</a> type qualifiers, <a href="#6.7.3">6.7.3</a>
26806 tgamma functions, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#F.9.5.4">F.9.5.4</a> type specifiers, <a href="#6.7.2">6.7.2</a>
26807 tgamma type-generic macro, <a href="#7.22">7.22</a> type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
26808 tgmath.h header, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> typedef declaration, <a href="#6.7.7">6.7.7</a>
26809 time typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.7">6.7.7</a>
26810 broken down, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.3">7.23.3</a>, <a href="#7.23.3.1">7.23.3.1</a>, types, <a href="#6.2.5">6.2.5</a>
26811 <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a>, <a href="#7.23.3.5">7.23.3.5</a> character, <a href="#6.7.8">6.7.8</a>
26812 calendar, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.2">7.23.2.2</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.2.4">7.23.2.4</a>, compatible, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.5">6.7.5</a>
26813 <a href="#7.23.3.2">7.23.3.2</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a> complex, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>
26814 components, <a href="#7.23.1">7.23.1</a> composite, <a href="#6.2.7">6.2.7</a>
26815 conversion functions, <a href="#7.23.3">7.23.3</a> const qualified, <a href="#6.7.3">6.7.3</a>
26816 wide character, <a href="#7.24.5">7.24.5</a> conversions, <a href="#6.3">6.3</a>
26817 local, <a href="#7.23.1">7.23.1</a> imaginary, <a href="#G">G</a>
26818 manipulation functions, <a href="#7.23.2">7.23.2</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
26819 time function, <a href="#7.23.2.4">7.23.2.4</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
26820 time.h header, <a href="#7.23">7.23</a>
26821 time_t type, <a href="#7.23.1">7.23.1</a> UCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26822 tm structure type, <a href="#7.23.1">7.23.1</a>, <a href="#7.24.1">7.24.1</a> UINT_FASTN_MAX macros, <a href="#7.18.2.3">7.18.2.3</a>
26823 TMP_MAX macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.19.4.4">7.19.4.4</a> uint_fastN_t types, <a href="#7.18.1.3">7.18.1.3</a>
26824 tmpfile function, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.20.4.3">7.20.4.3</a> UINT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
26825 tmpnam function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.3">7.19.4.3</a>, <a href="#7.19.4.4">7.19.4.4</a> uint_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
26826 token, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, see also preprocessing tokens UINT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26827 token concatenation, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
26828 token pasting, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
26829 <!--page 551 -->
26830 uintmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26831 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> usual arithmetic conversions, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.5.5">6.5.5</a>, <a href="#6.5.6">6.5.6</a>,
26832 UINTN_C macros, <a href="#7.18.4.1">7.18.4.1</a> <a href="#6.5.8">6.5.8</a>, <a href="#6.5.9">6.5.9</a>, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a>, <a href="#6.5.15">6.5.15</a>
26833 UINTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> utilities, general, <a href="#7.20">7.20</a>
26834 uintN_t types, <a href="#7.18.1.1">7.18.1.1</a> wide string, <a href="#7.24.4">7.24.4</a>
26835 UINTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a>
26836 uintptr_t type, <a href="#7.18.1.4">7.18.1.4</a> va_arg macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.2">7.15.1.2</a>,
26837 ULLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>,
26838 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
26839 ULONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.20.1.4">7.20.1.4</a>, <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>,
26840 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
26841 unary arithmetic operators, <a href="#6.5.3.3">6.5.3.3</a> va_copy macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>, <a href="#7.15.1.2">7.15.1.2</a>,
26842 unary expression, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.3">7.15.1.3</a>
26843 unary minus operator (-), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a> va_end macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.3">7.15.1.3</a>,
26844 unary operators, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>,
26845 unary plus operator (+), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>,
26846 unbuffered stream, <a href="#7.19.3">7.19.3</a> <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>,
26847 undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
26848 <a href="#7.1.4">7.1.4</a> va_list type, <a href="#7.15">7.15</a>, <a href="#7.15.1.3">7.15.1.3</a>
26849 undefined behavior, <a href="#3.4.3">3.4.3</a>, <a href="#4">4</a>, <a href="#J.2">J.2</a> va_start macro, <a href="#7.15">7.15</a>, <a href="#7.15.1">7.15.1</a>, <a href="#7.15.1.1">7.15.1.1</a>,
26850 underscore character, <a href="#6.4.2.1">6.4.2.1</a> <a href="#7.15.1.2">7.15.1.2</a>, <a href="#7.15.1.3">7.15.1.3</a>, <a href="#7.15.1.4">7.15.1.4</a>, <a href="#7.19.6.8">7.19.6.8</a>,
26851 underscore, leading, in identifier, <a href="#7.1.3">7.1.3</a> <a href="#7.19.6.9">7.19.6.9</a>, <a href="#7.19.6.10">7.19.6.10</a>, <a href="#7.19.6.11">7.19.6.11</a>, <a href="#7.19.6.12">7.19.6.12</a>,
26852 ungetc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, <a href="#7.19.6.13">7.19.6.13</a>, <a href="#7.19.6.14">7.19.6.14</a>, <a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>,
26853 <a href="#7.19.9.3">7.19.9.3</a> <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>
26854 ungetwc function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3.10">7.24.3.10</a> value, <a href="#3.17">3.17</a>
26855 Unicode required set, <a href="#6.10.8">6.10.8</a> value bits, <a href="#6.2.6.2">6.2.6.2</a>
26856 union variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.15">7.15</a>
26857 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> variable arguments header, <a href="#7.15">7.15</a>
26858 content, <a href="#6.7.2.3">6.7.2.3</a> variable length array, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
26859 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> variably modified type, <a href="#6.7.5">6.7.5</a>, <a href="#6.7.5.2">6.7.5.2</a>
26860 initialization, <a href="#6.7.8">6.7.8</a> vertical-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
26861 member alignment, <a href="#6.7.2.1">6.7.2.1</a> vertical-tab escape sequence (\v), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
26862 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.4.1.10">7.4.1.10</a>
26863 member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a> vfprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>
26864 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> vfscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.9">7.19.6.9</a>
26865 specifier, <a href="#6.7.2.1">6.7.2.1</a> vfwprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.5">7.24.2.5</a>
26866 tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a> vfwscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.3.10">7.24.3.10</a>
26867 type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a> visibility of identifier, <a href="#6.2.1">6.2.1</a>
26868 universal character name, <a href="#6.4.3">6.4.3</a> VLA, see variable length array
26869 unqualified type, <a href="#6.2.5">6.2.5</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
26870 unqualified version of type, <a href="#6.2.5">6.2.5</a> void function parameter, <a href="#6.7.5.3">6.7.5.3</a>
26871 unsigned integer suffix, u or <a href="#U">U</a>, <a href="#6.4.4.1">6.4.4.1</a> void type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.7.2">6.7.2</a>
26872 unsigned integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a> void type conversion, <a href="#6.3.2.2">6.3.2.2</a>
26873 unsigned type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, volatile storage, <a href="#5.1.2.3">5.1.2.3</a>
26874 <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> volatile type qualifier, <a href="#6.7.3">6.7.3</a>
26875 unsigned types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, volatile-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
26876 <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> vprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.10">7.19.6.10</a>
26877 unspecified behavior, <a href="#3.4.4">3.4.4</a>, <a href="#4">4</a>, <a href="#J.1">J.1</a> vscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.11">7.19.6.11</a>
26878 unspecified value, <a href="#3.17.3">3.17.3</a> vsnprintf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.12">7.19.6.12</a>
26879 uppercase letter, <a href="#5.2.1">5.2.1</a> vsprintf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.13">7.19.6.13</a>
26880 use of library functions, <a href="#7.1.4">7.1.4</a> vsscanf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.14">7.19.6.14</a>
26881 <!--page 552 -->
26882 vswprintf function, <a href="#7.24.2.7">7.24.2.7</a> wctype.h header, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
26883 vswscanf function, <a href="#7.24.2.8">7.24.2.8</a> wctype_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
26884 vwprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.9">7.24.2.9</a> WEOF macro, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.3.1">7.24.3.1</a>, <a href="#7.24.3.3">7.24.3.3</a>, <a href="#7.24.3.6">7.24.3.6</a>,
26885 vwscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.3.10">7.24.3.10</a> <a href="#7.24.3.7">7.24.3.7</a>, <a href="#7.24.3.8">7.24.3.8</a>, <a href="#7.24.3.9">7.24.3.9</a>, <a href="#7.24.3.10">7.24.3.10</a>,
26886 <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.25.1">7.25.1</a>
26887 warnings, <a href="#I">I</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
26888 wchar.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.24">7.24</a>, <a href="#7.26.12">7.26.12</a>, white space, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#7.4.1.10">7.4.1.10</a>,
26889 <a href="#F">F</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>
26890 WCHAR_MAX macro, <a href="#7.18.3">7.18.3</a>, <a href="#7.24.1">7.24.1</a> white-space characters, <a href="#6.4">6.4</a>
26891 WCHAR_MIN macro, <a href="#7.18.3">7.18.3</a>, <a href="#7.24.1">7.24.1</a> wide character, <a href="#3.7.3">3.7.3</a>
26892 wchar_t type, <a href="#3.7.3">3.7.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.8">6.7.8</a>, case mapping functions, <a href="#7.25.3.1">7.25.3.1</a>
26893 <a href="#6.10.8">6.10.8</a>, <a href="#7.17">7.17</a>, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.20">7.20</a>, extensible, <a href="#7.25.3.2">7.25.3.2</a>
26894 <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> classification functions, <a href="#7.25.2.1">7.25.2.1</a>
26895 wcrtomb function, <a href="#7.19.3">7.19.3</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, extensible, <a href="#7.25.2.2">7.25.2.2</a>
26896 <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> constant, <a href="#6.4.4.4">6.4.4.4</a>
26897 wcscat function, <a href="#7.24.4.3.1">7.24.4.3.1</a> formatted input/output functions, <a href="#7.24.2">7.24.2</a>
26898 wcschr function, <a href="#7.24.4.5.1">7.24.4.5.1</a> input functions, <a href="#7.19.1">7.19.1</a>
26899 wcscmp function, <a href="#7.24.4.4.1">7.24.4.4.1</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a> input/output functions, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.3">7.24.3</a>
26900 wcscoll function, <a href="#7.24.4.4.2">7.24.4.4.2</a>, <a href="#7.24.4.4.4">7.24.4.4.4</a> output functions, <a href="#7.19.1">7.19.1</a>
26901 wcscpy function, <a href="#7.24.4.2.1">7.24.4.2.1</a> single-byte conversion functions, <a href="#7.24.6.1">7.24.6.1</a>
26902 wcscspn function, <a href="#7.24.4.5.2">7.24.4.5.2</a> wide string, <a href="#7.1.1">7.1.1</a>
26903 wcsftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.5.1">7.24.5.1</a> wide string comparison functions, <a href="#7.24.4.4">7.24.4.4</a>
26904 wcslen function, <a href="#7.24.4.6.1">7.24.4.6.1</a> wide string concatenation functions, <a href="#7.24.4.3">7.24.4.3</a>
26905 wcsncat function, <a href="#7.24.4.3.2">7.24.4.3.2</a> wide string copying functions, <a href="#7.24.4.2">7.24.4.2</a>
26906 wcsncmp function, <a href="#7.24.4.4.3">7.24.4.4.3</a> wide string literal, see string literal
26907 wcsncpy function, <a href="#7.24.4.2.2">7.24.4.2.2</a> wide string miscellaneous functions, <a href="#7.24.4.6">7.24.4.6</a>
26908 wcspbrk function, <a href="#7.24.4.5.3">7.24.4.5.3</a> wide string numeric conversion functions, <a href="#7.8.2.4">7.8.2.4</a>,
26909 wcsrchr function, <a href="#7.24.4.5.4">7.24.4.5.4</a> <a href="#7.24.4.1">7.24.4.1</a>
26910 wcsrtombs function, <a href="#7.24.6.4.2">7.24.6.4.2</a> wide string search functions, <a href="#7.24.4.5">7.24.4.5</a>
26911 wcsspn function, <a href="#7.24.4.5.5">7.24.4.5.5</a> wide-oriented stream, <a href="#7.19.2">7.19.2</a>
26912 wcsstr function, <a href="#7.24.4.5.6">7.24.4.5.6</a> width, <a href="#6.2.6.2">6.2.6.2</a>
26913 wcstod function, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a> WINT_MAX macro, <a href="#7.18.3">7.18.3</a>
26914 wcstod function, <a href="#7.24.4.1.1">7.24.4.1.1</a> WINT_MIN macro, <a href="#7.18.3">7.18.3</a>
26915 wcstof function, <a href="#7.24.4.1.1">7.24.4.1.1</a> wint_t type, <a href="#7.18.3">7.18.3</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.24.2.1">7.24.2.1</a>,
26916 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#7.25.1">7.25.1</a>
26917 wcstok function, <a href="#7.24.4.5.7">7.24.4.5.7</a> wmemchr function, <a href="#7.24.4.5.8">7.24.4.5.8</a>
26918 wcstol function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, wmemcmp function, <a href="#7.24.4.4.5">7.24.4.4.5</a>
26919 <a href="#7.24.4.1.2">7.24.4.1.2</a> wmemcpy function, <a href="#7.24.4.2.3">7.24.4.2.3</a>
26920 wcstold function, <a href="#7.24.4.1.1">7.24.4.1.1</a> wmemmove function, <a href="#7.24.4.2.4">7.24.4.2.4</a>
26921 wcstoll function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a> wmemset function, <a href="#7.24.4.6.2">7.24.4.6.2</a>
26922 wcstombs function, <a href="#7.20.8.2">7.20.8.2</a>, <a href="#7.24.6.4">7.24.6.4</a> wprintf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.11">7.24.2.11</a>
26923 wcstoul function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>, wscanf function, <a href="#7.19.1">7.19.1</a>, <a href="#7.24.2.10">7.24.2.10</a>, <a href="#7.24.2.12">7.24.2.12</a>,
26924 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.3.10">7.24.3.10</a>
26925 wcstoull function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.24.4.1.2">7.24.4.1.2</a>
26926 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> xor macro, <a href="#7.9">7.9</a>
26927 wcsxfrm function, <a href="#7.24.4.4.4">7.24.4.4.4</a> xor_eq macro, <a href="#7.9">7.9</a>
26928 wctob function, <a href="#7.24.6.1.2">7.24.6.1.2</a>, <a href="#7.25.2.1">7.25.2.1</a>
26929 wctomb function, <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.20.8.2">7.20.8.2</a>, <a href="#7.24.6.3">7.24.6.3</a>
26930 wctrans function, <a href="#7.25.3.2.1">7.25.3.2.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
26931 wctrans_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
26932 wctype function, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
26933 </pre>
26934 <p><small><a href="#Contents">Contents</a></small>
26935 </body></html>