remove old c1x draft
[c-standard.git] / n1256.html
blob440a39ef2bb523deaf10dc32b5bbb3553fa876ef
1 <html><head><title>WG14/N1256 Committee Draft -- Septermber 7, 2007 ISO/IEC 9899:TC3</title></head><body><pre>
2 WG14/N1256 Committee Draft -- Septermber 7, 2007 ISO/IEC 9899:TC3
5 <a name="Contents" href="#Contents">Contents</a>
6 <a href="#Foreword">Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi</a>
7 <a href="#Introduction">Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv</a>
8 <a href="#1">1. Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1</a>
9 <a href="#2">2. Normative references . . . . . . . . . . . . . . . . . . . . . . . 2</a>
10 <a href="#3">3. Terms, definitions, and symbols . . . . . . . . . . . . . . . . . . . 3</a>
11 <a href="#4">4. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . 7</a>
12 <a href="#5">5. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 9</a>
13 <a href="#5.1"> 5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . 9</a>
14 <a href="#5.1.1"> 5.1.1 Translation environment . . . . . . . . . . . . . . . . 9</a>
15 <a href="#5.1.2"> 5.1.2 Execution environments . . . . . . . . . . . . . . . . 11</a>
16 <a href="#5.2"> 5.2 Environmental considerations . . . . . . . . . . . . . . . . . 17</a>
17 <a href="#5.2.1"> 5.2.1 Character sets . . . . . . . . . . . . . . . . . . . . 17</a>
18 <a href="#5.2.2"> 5.2.2 Character display semantics . . . . . . . . . . . . . . 19</a>
19 <a href="#5.2.3"> 5.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . 20</a>
20 <a href="#5.2.4"> 5.2.4 Environmental limits . . . . . . . . . . . . . . . . . 20</a>
21 <a href="#6">6. Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29</a>
22 <a href="#6.1"> 6.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 29</a>
23 <a href="#6.2"> 6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 29</a>
24 <a href="#6.2.1"> 6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . 29</a>
25 <a href="#6.2.2"> 6.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 30</a>
26 <a href="#6.2.3"> 6.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . 31</a>
27 <a href="#6.2.4"> 6.2.4 Storage durations of objects . . . . . . . . . . . . . . 32</a>
28 <a href="#6.2.5"> 6.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . 33</a>
29 <a href="#6.2.6"> 6.2.6 Representations of types . . . . . . . . . . . . . . . . 37</a>
30 <a href="#6.2.7"> 6.2.7 Compatible type and composite type . . . . . . . . . . . 40</a>
31 <a href="#6.3"> 6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 42</a>
32 <a href="#6.3.1"> 6.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . 42</a>
33 <a href="#6.3.2"> 6.3.2 Other operands . . . . . . . . . . . . . . . . . . . 46</a>
34 <a href="#6.4"> 6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . 49</a>
35 <a href="#6.4.1"> 6.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . 50</a>
36 <a href="#6.4.2"> 6.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . 51</a>
37 <a href="#6.4.3"> 6.4.3 Universal character names . . . . . . . . . . . . . . . 53</a>
38 <a href="#6.4.4"> 6.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . 54</a>
39 <a href="#6.4.5"> 6.4.5 String literals . . . . . . . . . . . . . . . . . . . . 62</a>
40 <a href="#6.4.6"> 6.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . 63</a>
41 <a href="#6.4.7"> 6.4.7 Header names . . . . . . . . . . . . . . . . . . . . 64</a>
42 <a href="#6.4.8"> 6.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . 65</a>
43 <a href="#6.4.9"> 6.4.9 Comments . . . . . . . . . . . . . . . . . . . . . 66</a>
44 <a href="#6.5"> 6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . 67</a>
47 [page iii]
49 <a href="#6.5.1"> 6.5.1 Primary expressions . . . . . . . . . . . . . . . . . 69</a>
50 <a href="#6.5.2"> 6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . 69</a>
51 <a href="#6.5.3"> 6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . 78</a>
52 <a href="#6.5.4"> 6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . 81</a>
53 <a href="#6.5.5"> 6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . 82</a>
54 <a href="#6.5.6"> 6.5.6 Additive operators . . . . . . . . . . . . . . . . . . 82</a>
55 <a href="#6.5.7"> 6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . 84</a>
56 <a href="#6.5.8"> 6.5.8 Relational operators . . . . . . . . . . . . . . . . . . 85</a>
57 <a href="#6.5.9"> 6.5.9 Equality operators . . . . . . . . . . . . . . . . . . 86</a>
58 <a href="#6.5.10"> 6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . 87</a>
59 <a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . 88</a>
60 <a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . 88</a>
61 <a href="#6.5.13"> 6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . 89</a>
62 <a href="#6.5.14"> 6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . 89</a>
63 <a href="#6.5.15"> 6.5.15 Conditional operator . . . . . . . . . . . . . . . . . 90</a>
64 <a href="#6.5.16"> 6.5.16 Assignment operators . . . . . . . . . . . . . . . . . 91</a>
65 <a href="#6.5.17"> 6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . 94</a>
66 <a href="#6.6"> 6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . 95</a>
67 <a href="#6.7"> 6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . 97</a>
68 <a href="#6.7.1"> 6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . 98</a>
69 <a href="#6.7.2"> 6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . 99</a>
70 <a href="#6.7.3"> 6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . 108</a>
71 <a href="#6.7.4"> 6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . 112</a>
72 <a href="#6.7.5"> 6.7.5 Declarators . . . . . . . . . . . . . . . . . . . . . 114</a>
73 <a href="#6.7.6"> 6.7.6 Type names . . . . . . . . . . . . . . . . . . . . . 122</a>
74 <a href="#6.7.7"> 6.7.7 Type definitions . . . . . . . . . . . . . . . . . . . 123</a>
75 <a href="#6.7.8"> 6.7.8 Initialization . . . . . . . . . . . . . . . . . . . . 125</a>
76 <a href="#6.8"> 6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . 131</a>
77 <a href="#6.8.1"> 6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . 131</a>
78 <a href="#6.8.2"> 6.8.2 Compound statement . . . . . . . . . . . . . . . . . 132</a>
79 <a href="#6.8.3"> 6.8.3 Expression and null statements . . . . . . . . . . . . . 132</a>
80 <a href="#6.8.4"> 6.8.4 Selection statements . . . . . . . . . . . . . . . . . 133</a>
81 <a href="#6.8.5"> 6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . 135</a>
82 <a href="#6.8.6"> 6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . 136</a>
83 <a href="#6.9"> 6.9 External definitions . . . . . . . . . . . . . . . . . . . . . 140</a>
84 <a href="#6.9.1"> 6.9.1 Function definitions . . . . . . . . . . . . . . . . . . 141</a>
85 <a href="#6.9.2"> 6.9.2 External object definitions . . . . . . . . . . . . . . . 143</a>
86 <a href="#6.10"> 6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . 145</a>
87 <a href="#6.10.1"> 6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . 147</a>
88 <a href="#6.10.2"> 6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . 149</a>
89 <a href="#6.10.3"> 6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . 151</a>
90 <a href="#6.10.4"> 6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . 158</a>
91 <a href="#6.10.5"> 6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . 159</a>
92 <a href="#6.10.6"> 6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . 159</a>
94 [page iv]
96 <a href="#6.10.7"> 6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . 160</a>
97 <a href="#6.10.8"> 6.10.8 Predefined macro names . . . . . . . . . . . . . . . . 160</a>
98 <a href="#6.10.9"> 6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . 161</a>
99 <a href="#6.11"> 6.11 Future language directions . . . . . . . . . . . . . . . . . . 163</a>
100 <a href="#6.11.1"> 6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . 163</a>
101 <a href="#6.11.2"> 6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 163</a>
102 <a href="#6.11.3"> 6.11.3 External names . . . . . . . . . . . . . . . . . . . 163</a>
103 <a href="#6.11.4"> 6.11.4 Character escape sequences . . . . . . . . . . . . . . 163</a>
104 <a href="#6.11.5"> 6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . 163</a>
105 <a href="#6.11.6"> 6.11.6 Function declarators . . . . . . . . . . . . . . . . . 163</a>
106 <a href="#6.11.7"> 6.11.7 Function definitions . . . . . . . . . . . . . . . . . . 163</a>
107 <a href="#6.11.8"> 6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . 163</a>
108 <a href="#6.11.9"> 6.11.9 Predefined macro names . . . . . . . . . . . . . . . . 163</a>
109 <a href="#7">7. Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164</a>
110 <a href="#7.1"> 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 164</a>
111 <a href="#7.1.1"> 7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . 164</a>
112 <a href="#7.1.2"> 7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . 165</a>
113 <a href="#7.1.3"> 7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . 166</a>
114 <a href="#7.1.4"> 7.1.4 Use of library functions . . . . . . . . . . . . . . . . 166</a>
115 <a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 169</a>
116 <a href="#7.2.1"> 7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . 169</a>
117 <a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 170</a>
118 <a href="#7.3.1"> 7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . 170</a>
119 <a href="#7.3.2"> 7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . 171</a>
120 <a href="#7.3.3"> 7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . 171</a>
121 <a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma . . . . . . . . . . . 171</a>
122 <a href="#7.3.5"> 7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . 172</a>
123 <a href="#7.3.6"> 7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . 174</a>
124 <a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions . . . . . . . . . . 176</a>
125 <a href="#7.3.8"> 7.3.8 Power and absolute-value functions . . . . . . . . . . . 177</a>
126 <a href="#7.3.9"> 7.3.9 Manipulation functions . . . . . . . . . . . . . . . . 178</a>
127 <a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 181</a>
128 <a href="#7.4.1"> 7.4.1 Character classification functions . . . . . . . . . . . . 181</a>
129 <a href="#7.4.2"> 7.4.2 Character case mapping functions . . . . . . . . . . . . 184</a>
130 <a href="#7.5"> 7.5 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 186</a>
131 <a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 187</a>
132 <a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma . . . . . . . . . . . . . . 189</a>
133 <a href="#7.6.2"> 7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . 190</a>
134 <a href="#7.6.3"> 7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . 193</a>
135 <a href="#7.6.4"> 7.6.4 Environment . . . . . . . . . . . . . . . . . . . . 194</a>
136 <a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 197</a>
137 <a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 198</a>
138 <a href="#7.8.1"> 7.8.1 Macros for format specifiers . . . . . . . . . . . . . . 198</a>
139 <a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types . . . . . . . . . 199</a>
141 [page v]
143 <a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 202</a>
144 <a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 203</a>
145 <a href="#7.11"> 7.11 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 204</a>
146 <a href="#7.11.1"> 7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . 205</a>
147 <a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry . . . . . . . . . . 206</a>
148 <a href="#7.12"> 7.12 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 212</a>
149 <a href="#7.12.1"> 7.12.1 Treatment of error conditions . . . . . . . . . . . . . . 214</a>
150 <a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma . . . . . . . . . . . . . . 215</a>
151 <a href="#7.12.3"> 7.12.3 Classification macros . . . . . . . . . . . . . . . . . 216</a>
152 <a href="#7.12.4"> 7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . 218</a>
153 <a href="#7.12.5"> 7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . 221</a>
154 <a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions . . . . . . . . . . 223</a>
155 <a href="#7.12.7"> 7.12.7 Power and absolute-value functions . . . . . . . . . . . 228</a>
156 <a href="#7.12.8"> 7.12.8 Error and gamma functions . . . . . . . . . . . . . . . 230</a>
157 <a href="#7.12.9"> 7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . 231</a>
158 <a href="#7.12.10"> 7.12.10 Remainder functions . . . . . . . . . . . . . . . . . 235</a>
159 <a href="#7.12.11"> 7.12.11 Manipulation functions . . . . . . . . . . . . . . . . 236</a>
160 <a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions . . . 238</a>
161 <a href="#7.12.13"> 7.12.13 Floating multiply-add . . . . . . . . . . . . . . . . . 239</a>
162 <a href="#7.12.14"> 7.12.14 Comparison macros . . . . . . . . . . . . . . . . . . 240</a>
163 <a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 243</a>
164 <a href="#7.13.1"> 7.13.1 Save calling environment . . . . . . . . . . . . . . . 243</a>
165 <a href="#7.13.2"> 7.13.2 Restore calling environment . . . . . . . . . . . . . . 244</a>
166 <a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 246</a>
167 <a href="#7.14.1"> 7.14.1 Specify signal handling . . . . . . . . . . . . . . . . 247</a>
168 <a href="#7.14.2"> 7.14.2 Send signal . . . . . . . . . . . . . . . . . . . . . 248</a>
169 <a href="#7.15"> 7.15 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 249</a>
170 <a href="#7.15.1"> 7.15.1 Variable argument list access macros . . . . . . . . . . . 249</a>
171 <a href="#7.16"> 7.16 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 253</a>
172 <a href="#7.17"> 7.17 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 254</a>
173 <a href="#7.18"> 7.18 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 255</a>
174 <a href="#7.18.1"> 7.18.1 Integer types . . . . . . . . . . . . . . . . . . . . 255</a>
175 <a href="#7.18.2"> 7.18.2 Limits of specified-width integer types . . . . . . . . . . 257</a>
176 <a href="#7.18.3"> 7.18.3 Limits of other integer types . . . . . . . . . . . . . . 259</a>
177 <a href="#7.18.4"> 7.18.4 Macros for integer constants . . . . . . . . . . . . . . 260</a>
178 <a href="#7.19"> 7.19 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 262</a>
179 <a href="#7.19.1"> 7.19.1 Introduction . . . . . . . . . . . . . . . . . . . . . 262</a>
180 <a href="#7.19.2"> 7.19.2 Streams . . . . . . . . . . . . . . . . . . . . . . 264</a>
181 <a href="#7.19.3"> 7.19.3 Files . . . . . . . . . . . . . . . . . . . . . . . . 266</a>
182 <a href="#7.19.4"> 7.19.4 Operations on files . . . . . . . . . . . . . . . . . . 268</a>
183 <a href="#7.19.5"> 7.19.5 File access functions . . . . . . . . . . . . . . . . . 270</a>
184 <a href="#7.19.6"> 7.19.6 Formatted input/output functions . . . . . . . . . . . . 274</a>
185 <a href="#7.19.7"> 7.19.7 Character input/output functions . . . . . . . . . . . . . 296</a>
186 <a href="#7.19.8"> 7.19.8 Direct input/output functions . . . . . . . . . . . . . . 301</a>
188 [page vi]
190 <a href="#7.19.9"> 7.19.9 File positioning functions . . . . . . . . . . . . . . . 302</a>
191 <a href="#7.19.10"> 7.19.10 Error-handling functions . . . . . . . . . . . . . . . . 304</a>
192 <a href="#7.20"> 7.20 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 306</a>
193 <a href="#7.20.1"> 7.20.1 Numeric conversion functions . . . . . . . . . . . . . . 307</a>
194 <a href="#7.20.2"> 7.20.2 Pseudo-random sequence generation functions . . . . . . . 312</a>
195 <a href="#7.20.3"> 7.20.3 Memory management functions . . . . . . . . . . . . . 313</a>
196 <a href="#7.20.4"> 7.20.4 Communication with the environment . . . . . . . . . . 315</a>
197 <a href="#7.20.5"> 7.20.5 Searching and sorting utilities . . . . . . . . . . . . . . 318</a>
198 <a href="#7.20.6"> 7.20.6 Integer arithmetic functions . . . . . . . . . . . . . . 320</a>
199 <a href="#7.20.7"> 7.20.7 Multibyte/wide character conversion functions . . . . . . . 321</a>
200 <a href="#7.20.8"> 7.20.8 Multibyte/wide string conversion functions . . . . . . . . 323</a>
201 <a href="#7.21"> 7.21 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 325</a>
202 <a href="#7.21.1"> 7.21.1 String function conventions . . . . . . . . . . . . . . . 325</a>
203 <a href="#7.21.2"> 7.21.2 Copying functions . . . . . . . . . . . . . . . . . . 325</a>
204 <a href="#7.21.3"> 7.21.3 Concatenation functions . . . . . . . . . . . . . . . . 327</a>
205 <a href="#7.21.4"> 7.21.4 Comparison functions . . . . . . . . . . . . . . . . . 328</a>
206 <a href="#7.21.5"> 7.21.5 Search functions . . . . . . . . . . . . . . . . . . . 330</a>
207 <a href="#7.21.6"> 7.21.6 Miscellaneous functions . . . . . . . . . . . . . . . . 333</a>
208 <a href="#7.22"> 7.22 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 335</a>
209 <a href="#7.23"> 7.23 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 338</a>
210 <a href="#7.23.1"> 7.23.1 Components of time . . . . . . . . . . . . . . . . . 338</a>
211 <a href="#7.23.2"> 7.23.2 Time manipulation functions . . . . . . . . . . . . . . 339</a>
212 <a href="#7.23.3"> 7.23.3 Time conversion functions . . . . . . . . . . . . . . . 341</a>
213 <a href="#7.24"> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt; . . . . . 348</a>
214 <a href="#7.24.1"> 7.24.1 Introduction . . . . . . . . . . . . . . . . . . . . . 348</a>
215 <a href="#7.24.2"> 7.24.2 Formatted wide character input/output functions . . . . . . 349</a>
216 <a href="#7.24.3"> 7.24.3 Wide character input/output functions . . . . . . . . . . 367</a>
217 <a href="#7.24.4"> 7.24.4 General wide string utilities . . . . . . . . . . . . . . 371</a>
218 <a href="#7.24.5"> 7.24.5 Wide character time conversion functions . . . . . . . . . 385</a>
219 <a href="#7.24.6"> 7.24.6 Extended multibyte/wide character conversion utilities . . . . 386</a>
220 <a href="#7.25"> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 393</a>
221 <a href="#7.25.1"> 7.25.1 Introduction . . . . . . . . . . . . . . . . . . . . . 393</a>
222 <a href="#7.25.2"> 7.25.2 Wide character classification utilities . . . . . . . . . . . 394</a>
223 <a href="#7.25.3"> 7.25.3 Wide character case mapping utilities . . . . . . . . . . . 399</a>
224 <a href="#7.26"> 7.26 Future library directions . . . . . . . . . . . . . . . . . . . 401</a>
225 <a href="#7.26.1"> 7.26.1 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . 401</a>
226 <a href="#7.26.2"> 7.26.2 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . 401</a>
227 <a href="#7.26.3"> 7.26.3 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . 401</a>
228 <a href="#7.26.4"> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt; . . . . 401</a>
229 <a href="#7.26.5"> 7.26.5 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . 401</a>
230 <a href="#7.26.6"> 7.26.6 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . 401</a>
231 <a href="#7.26.7"> 7.26.7 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . 401</a>
232 <a href="#7.26.8"> 7.26.8 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . 401</a>
233 <a href="#7.26.9"> 7.26.9 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . 402</a>
235 [page vii]
237 <a href="#7.26.10"> 7.26.10 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . 402</a>
238 <a href="#7.26.11"> 7.26.11 String handling &lt;string.h&gt; . . . . . . . . . . . . . 402</a>
239 <a href="#7.26.12"> 7.26.12 Extended multibyte and wide character utilities
240 &lt;wchar.h&gt; . . . . . . . . . . . . . . . . . . . . 402</a>
241 <a href="#7.26.13"> 7.26.13 Wide character classification and mapping utilities
242 &lt;wctype.h&gt; . . . . . . . . . . . . . . . . . . . . 402</a>
243 <a href="#A">Annex A (informative) Language syntax summary . . . . . . . . . . . . 403</a>
244 <a href="#A.1"> A.1 Lexical grammar . . . . . . . . . . . . . . . . . . . . . . 403</a>
245 <a href="#A.2"> A.2 Phrase structure grammar . . . . . . . . . . . . . . . . . . . 409</a>
246 <a href="#A.3"> A.3 Preprocessing directives . . . . . . . . . . . . . . . . . . . 416</a>
247 <a href="#B">Annex B (informative) Library summary . . . . . . . . . . . . . . . . 419</a>
248 <a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 419</a>
249 <a href="#B.2"> B.2 Complex &lt;complex.h&gt; . . . . . . . . . . . . . . . . . . . 419</a>
250 <a href="#B.3"> B.3 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 421</a>
251 <a href="#B.4"> B.4 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 421</a>
252 <a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 421</a>
253 <a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 422</a>
254 <a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 422</a>
255 <a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 423</a>
256 <a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 423</a>
257 <a href="#B.10"> B.10 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 423</a>
258 <a href="#B.11"> B.11 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 423</a>
259 <a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 428</a>
260 <a href="#B.13"> B.13 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 428</a>
261 <a href="#B.14"> B.14 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 428</a>
262 <a href="#B.15"> B.15 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 428</a>
263 <a href="#B.16"> B.16 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 429</a>
264 <a href="#B.17"> B.17 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 429</a>
265 <a href="#B.18"> B.18 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 429</a>
266 <a href="#B.19"> B.19 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 431</a>
267 <a href="#B.20"> B.20 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 433</a>
268 <a href="#B.21"> B.21 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 434</a>
269 <a href="#B.22"> B.22 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 434</a>
270 <a href="#B.23"> B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt; . . . . . . 435</a>
271 <a href="#B.24"> B.24 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 437</a>
272 <a href="#C">Annex C (informative) Sequence points . . . . . . . . . . . . . . . . . 439</a>
273 <a href="#D">Annex D (normative) Universal character names for identifiers . . . . . . . 440</a>
274 <a href="#E">Annex E (informative) Implementation limits . . . . . . . . . . . . . . 442</a>
275 <a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic . . . . . . . . . . 444</a>
276 <a href="#F.1"> F.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 444</a>
277 <a href="#F.2"> F.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 444</a>
278 <a href="#F.3"> F.3 Operators and functions . . . . . . . . . . . . . . . . . . . 445</a>
280 [page viii]
282 <a href="#F.4"> F.4 Floating to integer conversion . . . . . . . . . . . . . . . . . 447</a>
283 <a href="#F.5"> F.5 Binary-decimal conversion . . . . . . . . . . . . . . . . . . 447</a>
284 <a href="#F.6"> F.6 Contracted expressions . . . . . . . . . . . . . . . . . . . . 448</a>
285 <a href="#F.7"> F.7 Floating-point environment . . . . . . . . . . . . . . . . . . 448</a>
286 <a href="#F.8"> F.8 Optimization . . . . . . . . . . . . . . . . . . . . . . . . 451</a>
287 <a href="#F.9"> F.9 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 454</a>
288 <a href="#G">Annex G (informative) IEC 60559-compatible complex arithmetic . . . . . . 467</a>
289 <a href="#G.1"> G.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
290 <a href="#G.2"> G.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
291 <a href="#G.3"> G.3 Conventions . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
292 <a href="#G.4"> G.4 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 468</a>
293 <a href="#G.5"> G.5 Binary operators . . . . . . . . . . . . . . . . . . . . . . 468</a>
294 <a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 472</a>
295 <a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 480</a>
296 <a href="#H">Annex H (informative) Language independent arithmetic . . . . . . . . . . 481</a>
297 <a href="#H.1"> H.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 481</a>
298 <a href="#H.2"> H.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 481</a>
299 <a href="#H.3"> H.3 Notification . . . . . . . . . . . . . . . . . . . . . . . . 485</a>
300 <a href="#I">Annex I (informative) Common warnings . . . . . . . . . . . . . . . . 487</a>
301 <a href="#J">Annex J (informative) Portability issues . . . . . . . . . . . . . . . . . 489</a>
302 <a href="#J.1"> J.1 Unspecified behavior . . . . . . . . . . . . . . . . . . . . . 489</a>
303 <a href="#J.2"> J.2 Undefined behavior . . . . . . . . . . . . . . . . . . . . . 492</a>
304 <a href="#J.3"> J.3 Implementation-defined behavior . . . . . . . . . . . . . . . . 505</a>
305 <a href="#J.4"> J.4 Locale-specific behavior . . . . . . . . . . . . . . . . . . . 512</a>
306 <a href="#J.5"> J.5 Common extensions . . . . . . . . . . . . . . . . . . . . . 513</a>
307 <a href="#Bibliography">Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 516</a>
308 <a href="#Index">Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519</a>
313 [<a name="pix" href="#pix">page ix</a>] (<a href="#Contents">Contents</a>)
317 [<a name="px" href="#px">page x</a>] (<a href="#Contents">Contents</a>)
319 <a name="Foreword" href="#Foreword"><b> Foreword</b></a>
320 1 ISO (the International Organization for Standardization) and IEC (the International
321 Electrotechnical Commission) form the specialized system for worldwide
322 standardization. National bodies that are member of ISO or IEC participate in the
323 development of International Standards through technical committees established by the
324 respective organization to deal with particular fields of technical activity. ISO and IEC
325 technical committees collaborate in fields of mutual interest. Other international
326 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
327 take part in the work.
328 2 International Standards are drafted in accordance with the rules given in the ISO/IEC
329 Directives, Part 3.
330 3 In the field of information technology, ISO and IEC have established a joint technical
331 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
332 committee are circulated to national bodies for voting. Publication as an International
333 Standard requires approval by at least 75% of the national bodies casting a vote.
334 4 International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
335 ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,
336 their environments and system software interfaces. The Working Group responsible for
337 this standard (WG 14) maintains a site on the World Wide Web at
338 http://www.open-std.org/JTC1/SC22/WG14/ containing additional
339 information relevant to this standard such as a Rationale for many of the decisions made
340 during its preparation and a log of Defect Reports and Responses.
341 5 This second edition cancels and replaces the first edition, ISO/IEC 9899:1990, as
342 amended and corrected by ISO/IEC 9899/COR1:1994, ISO/IEC 9899/AMD1:1995, and
343 ISO/IEC 9899/COR2:1996. Major changes from the previous edition include:
344 -- restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
345 in AMD1)
346 -- 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
347 specified in AMD1)
348 -- more precise aliasing rules via effective type
349 -- restricted pointers
350 -- variable length arrays
351 -- flexible array members
352 -- static and type qualifiers in parameter array declarators
353 -- complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
354 -- type-generic math macros in <a href="#7.22">&lt;tgmath.h&gt;</a>
355 -- the long long int type and library functions
358 [<a name="pxi" href="#pxi">page xi</a>] (<a href="#Contents">Contents</a>)
360 -- increased minimum translation limits
361 -- additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
362 -- remove implicit int
363 -- reliable integer division
364 -- universal character names (\u and \U)
365 -- extended identifiers
366 -- hexadecimal floating-point constants and %a and %A printf/scanf conversion
367 specifiers
368 -- compound literals
369 -- designated initializers
370 -- // comments
371 -- 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>
372 -- remove implicit function declaration
373 -- preprocessor arithmetic done in intmax_t/uintmax_t
374 -- mixed declarations and code
375 -- new block scopes for selection and iteration statements
376 -- integer constant type rules
377 -- integer promotion rules
378 -- macros with a variable number of arguments
379 -- 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>
380 -- additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
381 -- treatment of error conditions by math library functions (math_errhandling)
382 -- floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
383 -- IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
384 -- trailing comma allowed in enum declaration
385 -- %lf conversion specifier allowed in printf
386 -- inline functions
387 -- the snprintf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a>
388 -- boolean type in <a href="#7.16">&lt;stdbool.h&gt;</a>
389 -- idempotent type qualifiers
390 -- empty macro arguments
393 [<a name="pxii" href="#pxii">page xii</a>] (<a href="#Contents">Contents</a>)
395 -- new structure type compatibility rules (tag compatibility)
396 -- additional predefined macro names
397 -- _Pragma preprocessing operator
398 -- standard pragmas
399 -- __func__ predefined identifier
400 -- va_copy macro
401 -- additional strftime conversion specifiers
402 -- LIA compatibility annex
403 -- deprecate ungetc at the beginning of a binary file
404 -- remove deprecation of aliased array parameters
405 -- conversion of array to pointer not limited to lvalues
406 -- relaxed constraints on aggregate and union initialization
407 -- relaxed restrictions on portable header names
408 -- return without expression not permitted in function that returns a value (and vice
409 versa)
410 6 Annexes D and F form a normative part of this standard; annexes A, B, C, E, G, H, I, J,
411 the bibliography, and the index are for information only. In accordance with Part 3 of the
412 ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples are
413 also for information only.
418 [<a name="pxiii" href="#pxiii">page xiii</a>] (<a href="#Contents">Contents</a>)
420 <a name="Introduction" href="#Introduction"><b> Introduction</b></a>
421 1 With the introduction of new devices and extended character sets, new features may be
422 added to this International Standard. Subclauses in the language and library clauses warn
423 implementors and programmers of usages which, though valid in themselves, may
424 conflict with future additions.
425 2 Certain features are obsolescent, which means that they may be considered for
426 withdrawal in future revisions of this International Standard. They are retained because
427 of their widespread use, but their use in new implementations (for implementation
428 features) or new programs (for language [6.11] or library features [7.26]) is discouraged.
429 3 This International Standard is divided into four major subdivisions:
430 -- preliminary elements (clauses 1-4);
431 -- the characteristics of environments that translate and execute C programs (clause 5);
432 -- the language syntax, constraints, and semantics (clause 6);
433 -- the library facilities (clause 7).
434 4 Examples are provided to illustrate possible forms of the constructions described.
435 Footnotes are provided to emphasize consequences of the rules described in that
436 subclause or elsewhere in this International Standard. References are used to refer to
437 other related subclauses. Recommendations are provided to give advice or guidance to
438 implementors. Annexes provide additional information and summarize the information
439 contained in this International Standard. A bibliography lists documents that were
440 referred to during the preparation of the standard.
441 5 The language clause (clause 6) is derived from ''The C Reference Manual''.
442 6 The library clause (clause 7) is based on the 1984 /usr/group Standard.
447 [<a name="pxiv" href="#pxiv">page xiv</a>] (<a href="#Contents">Contents</a>)
451 Programming languages -- C
456 <a name="1" href="#1"><b> 1. Scope</b></a>
457 1 This International Standard specifies the form and establishes the interpretation of
458 programs written in the C programming language.1) It specifies
459 -- the representation of C programs;
460 -- the syntax and constraints of the C language;
461 -- the semantic rules for interpreting C programs;
462 -- the representation of input data to be processed by C programs;
463 -- the representation of output data produced by C programs;
464 -- the restrictions and limits imposed by a conforming implementation of C.
465 2 This International Standard does not specify
466 -- the mechanism by which C programs are transformed for use by a data-processing
467 system;
468 -- the mechanism by which C programs are invoked for use by a data-processing
469 system;
470 -- the mechanism by which input data are transformed for use by a C program;
471 -- the mechanism by which output data are transformed after being produced by a C
472 program;
473 -- the size or complexity of a program and its data that will exceed the capacity of any
474 specific data-processing system or the capacity of a particular processor;
477 1) This International Standard is designed to promote the portability of C programs among a variety of
478 data-processing systems. It is intended for use by implementors and programmers.
480 [<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
482 -- all minimal requirements of a data-processing system that is capable of supporting a
483 conforming implementation.
485 <a name="2" href="#2"><b> 2. Normative references</b></a>
486 1 The following normative documents contain provisions which, through reference in this
487 text, constitute provisions of this International Standard. For dated references,
488 subsequent amendments to, or revisions of, any of these publications do not apply.
489 However, parties to agreements based on this International Standard are encouraged to
490 investigate the possibility of applying the most recent editions of the normative
491 documents indicated below. For undated references, the latest edition of the normative
492 document referred to applies. Members of ISO and IEC maintain registers of currently
493 valid International Standards.
494 2 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
495 use in the physical sciences and technology.
496 3 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
497 interchange.
498 4 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
499 terms.
500 5 ISO 4217, Codes for the representation of currencies and funds.
501 6 ISO 8601, Data elements and interchange formats -- Information interchange --
502 Representation of dates and times.
503 7 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
504 Character Set (UCS).
505 8 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
506 designated IEC 559:1989).
511 [<a name="p2" href="#p2">page 2</a>] (<a href="#Contents">Contents</a>)
514 <a name="3" href="#3"><b> 3. Terms, definitions, and symbols</b></a>
515 1 For the purposes of this International Standard, the following definitions apply. Other
516 terms are defined where they appear in italic type or on the left side of a syntax rule.
517 Terms explicitly defined in this International Standard are not to be presumed to refer
518 implicitly to similar terms defined elsewhere. Terms not defined in this International
519 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
520 defined in this International Standard are to be interpreted according to ISO 31-11.
521 <a name="3.1" href="#3.1"><b> 3.1</b></a>
522 1 access
523 &lt;execution-time action&gt; to read or modify the value of an object
524 2 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
526 3 NOTE 2 "Modify'' includes the case where the new value being stored is the same as the previous value.
528 4 NOTE 3 Expressions that are not evaluated do not access objects.
530 <a name="3.2" href="#3.2"><b> 3.2</b></a>
531 1 alignment
532 requirement that objects of a particular type be located on storage boundaries with
533 addresses that are particular multiples of a byte address
534 <a name="3.3" href="#3.3"><b> 3.3</b></a>
535 1 argument
536 actual argument
537 actual parameter (deprecated)
538 expression in the comma-separated list bounded by the parentheses in a function call
539 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
540 by the parentheses in a function-like macro invocation
541 <a name="3.4" href="#3.4"><b> 3.4</b></a>
542 1 behavior
543 external appearance or action
544 <a name="3.4.1" href="#3.4.1"><b> 3.4.1</b></a>
545 1 implementation-defined behavior
546 unspecified behavior where each implementation documents how the choice is made
547 2 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
548 when a signed integer is shifted right.
550 <a name="3.4.2" href="#3.4.2"><b> 3.4.2</b></a>
551 1 locale-specific behavior
552 behavior that depends on local conventions of nationality, culture, and language that each
553 implementation documents
556 [<a name="p3" href="#p3">page 3</a>] (<a href="#Contents">Contents</a>)
558 2 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
559 characters other than the 26 lowercase Latin letters.
561 <a name="3.4.3" href="#3.4.3"><b> 3.4.3</b></a>
562 1 undefined behavior
563 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
564 for which this International Standard imposes no requirements
565 2 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
566 results, to behaving during translation or program execution in a documented manner characteristic of the
567 environment (with or without the issuance of a diagnostic message), to terminating a translation or
568 execution (with the issuance of a diagnostic message).
570 3 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
572 <a name="3.4.4" href="#3.4.4"><b> 3.4.4</b></a>
573 1 unspecified behavior
574 use of an unspecified value, or other behavior where this International Standard provides
575 two or more possibilities and imposes no further requirements on which is chosen in any
576 instance
577 2 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
578 evaluated.
580 <a name="3.5" href="#3.5"><b> 3.5</b></a>
581 1 bit
582 unit of data storage in the execution environment large enough to hold an object that may
583 have one of two values
584 2 NOTE It need not be possible to express the address of each individual bit of an object.
586 <a name="3.6" href="#3.6"><b> 3.6</b></a>
587 1 byte
588 addressable unit of data storage large enough to hold any member of the basic character
589 set of the execution environment
590 2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
592 3 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
593 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
594 bit.
596 <a name="3.7" href="#3.7"><b> 3.7</b></a>
597 1 character
598 &lt;abstract&gt; member of a set of elements used for the organization, control, or
599 representation of data
600 <a name="3.7.1" href="#3.7.1"><b> 3.7.1</b></a>
601 1 character
602 single-byte character
603 &lt;C&gt; bit representation that fits in a byte
604 [<a name="p4" href="#p4">page 4</a>] (<a href="#Contents">Contents</a>)
606 <a name="3.7.2" href="#3.7.2"><b> 3.7.2</b></a>
607 1 multibyte character
608 sequence of one or more bytes representing a member of the extended character set of
609 either the source or the execution environment
610 2 NOTE The extended character set is a superset of the basic character set.
612 <a name="3.7.3" href="#3.7.3"><b> 3.7.3</b></a>
613 1 wide character
614 bit representation that fits in an object of type wchar_t, capable of representing any
615 character in the current locale
616 <a name="3.8" href="#3.8"><b> 3.8</b></a>
617 1 constraint
618 restriction, either syntactic or semantic, by which the exposition of language elements is
619 to be interpreted
620 <a name="3.9" href="#3.9"><b> 3.9</b></a>
621 1 correctly rounded result
622 representation in the result format that is nearest in value, subject to the current rounding
623 mode, to what the result would be given unlimited range and precision
624 <a name="3.10" href="#3.10"><b> 3.10</b></a>
625 1 diagnostic message
626 message belonging to an implementation-defined subset of the implementation's message
627 output
628 <a name="3.11" href="#3.11"><b> 3.11</b></a>
629 1 forward reference
630 reference to a later subclause of this International Standard that contains additional
631 information relevant to this subclause
632 <a name="3.12" href="#3.12"><b> 3.12</b></a>
633 1 implementation
634 particular set of software, running in a particular translation environment under particular
635 control options, that performs translation of programs for, and supports execution of
636 functions in, a particular execution environment
637 <a name="3.13" href="#3.13"><b> 3.13</b></a>
638 1 implementation limit
639 restriction imposed upon programs by the implementation
640 <a name="3.14" href="#3.14"><b> 3.14</b></a>
641 1 object
642 region of data storage in the execution environment, the contents of which can represent
643 values
645 [<a name="p5" href="#p5">page 5</a>] (<a href="#Contents">Contents</a>)
647 2 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>.
649 <a name="3.15" href="#3.15"><b> 3.15</b></a>
650 1 parameter
651 formal parameter
652 formal argument (deprecated)
653 object declared as part of a function declaration or definition that acquires a value on
654 entry to the function, or an identifier from the comma-separated list bounded by the
655 parentheses immediately following the macro name in a function-like macro definition
656 <a name="3.16" href="#3.16"><b> 3.16</b></a>
657 1 recommended practice
658 specification that is strongly recommended as being in keeping with the intent of the
659 standard, but that may be impractical for some implementations
660 <a name="3.17" href="#3.17"><b> 3.17</b></a>
661 1 value
662 precise meaning of the contents of an object when interpreted as having a specific type
663 <a name="3.17.1" href="#3.17.1"><b> 3.17.1</b></a>
664 1 implementation-defined value
665 unspecified value where each implementation documents how the choice is made
666 <a name="3.17.2" href="#3.17.2"><b> 3.17.2</b></a>
667 1 indeterminate value
668 either an unspecified value or a trap representation
669 <a name="3.17.3" href="#3.17.3"><b> 3.17.3</b></a>
670 1 unspecified value
671 valid value of the relevant type where this International Standard imposes no
672 requirements on which value is chosen in any instance
673 2 NOTE An unspecified value cannot be a trap representation.
675 <a name="3.18" href="#3.18"><b> 3.18</b></a>
676 1 ??? x???
677 ceiling of x: the least integer greater than or equal to x
678 2 EXAMPLE ???2.4??? is 3, ???-2.4??? is -2.
680 <a name="3.19" href="#3.19"><b> 3.19</b></a>
681 1 ??? x???
682 floor of x: the greatest integer less than or equal to x
683 2 EXAMPLE ???2.4??? is 2, ???-2.4??? is -3.
688 [<a name="p6" href="#p6">page 6</a>] (<a href="#Contents">Contents</a>)
691 <a name="4" href="#4"><b> 4. Conformance</b></a>
692 1 In this International Standard, ''shall'' is to be interpreted as a requirement on an
693 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
694 prohibition.
695 2 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the
696 behavior is undefined. Undefined behavior is otherwise indicated in this International
697 Standard by the words ''undefined behavior'' or by the omission of any explicit definition
698 of behavior. There is no difference in emphasis among these three; they all describe
699 ''behavior that is undefined''.
700 3 A program that is correct in all other aspects, operating on correct data, containing
701 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
702 4 The implementation shall not successfully translate a preprocessing translation unit
703 containing a #error preprocessing directive unless it is part of a group skipped by
704 conditional inclusion.
705 5 A strictly conforming program shall use only those features of the language and library
706 specified in this International Standard.2) It shall not produce output dependent on any
707 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
708 minimum implementation limit.
709 6 The two forms of conforming implementation are hosted and freestanding. A conforming
710 hosted implementation shall accept any strictly conforming program. A conforming
711 freestanding implementation shall accept any strictly conforming program that does not
712 use complex types and in which the use of the features specified in the library clause
713 (clause 7) is confined to the contents of the standard headers <a href="#7.7">&lt;float.h&gt;</a>,
714 <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
715 <a href="#7.18">&lt;stdint.h&gt;</a>. A conforming implementation may have extensions (including additional
716 library functions), provided they do not alter the behavior of any strictly conforming
717 program.3)
721 2) A strictly conforming program can use conditional features (such as those in <a href="#F">annex F</a>) provided the
722 use is guarded by a #ifdef directive with the appropriate macro. For example:
723 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
724 /* ... */
725 fesetround(FE_UPWARD);
726 /* ... */
727 #endif
729 3) This implies that a conforming implementation reserves no identifiers other than those explicitly
730 reserved in this International Standard.
732 [<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
734 7 A conforming program is one that is acceptable to a conforming implementation.4)
735 8 An implementation shall be accompanied by a document that defines all implementation-
736 defined and locale-specific characteristics and all extensions.
737 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
738 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>
739 (<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>
740 (<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
741 <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>).
746 4) Strictly conforming programs are intended to be maximally portable among conforming
747 implementations. Conforming programs may depend upon nonportable features of a conforming
748 implementation.
750 [<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
753 <a name="5" href="#5"><b> 5. Environment</b></a>
754 1 An implementation translates C source files and executes C programs in two data-
755 processing-system environments, which will be called the translation environment and
756 the execution environment in this International Standard. Their characteristics define and
757 constrain the results of executing conforming C programs constructed according to the
758 syntactic and semantic rules for conforming implementations.
759 Forward references: In this clause, only a few of many possible forward references
760 have been noted.
761 <a name="5.1" href="#5.1"><b> 5.1 Conceptual models</b></a>
762 <a name="5.1.1" href="#5.1.1"><b> 5.1.1 Translation environment</b></a>
763 <a name="5.1.1.1" href="#5.1.1.1"><b> 5.1.1.1 Program structure</b></a>
764 1 A C program need not all be translated at the same time. The text of the program is kept
765 in units called source files, (or preprocessing files) in this International Standard. A
766 source file together with all the headers and source files included via the preprocessing
767 directive #include is known as a preprocessing translation unit. After preprocessing, a
768 preprocessing translation unit is called a translation unit. Previously translated translation
769 units may be preserved individually or in libraries. The separate translation units of a
770 program communicate by (for example) calls to functions whose identifiers have external
771 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
772 of data files. Translation units may be separately translated and then later linked to
773 produce an executable program.
774 Forward references: linkages of identifiers (<a href="#6.2.2">6.2.2</a>), external definitions (<a href="#6.9">6.9</a>),
775 preprocessing directives (<a href="#6.10">6.10</a>).
776 <a name="5.1.1.2" href="#5.1.1.2"><b> 5.1.1.2 Translation phases</b></a>
777 1 The precedence among the syntax rules of translation is specified by the following
778 phases.5)
779 1. Physical source file multibyte characters are mapped, in an implementation-
780 defined manner, to the source character set (introducing new-line characters for
781 end-of-line indicators) if necessary. Trigraph sequences are replaced by
782 corresponding single-character internal representations.
786 5) Implementations shall behave as if these separate phases occur, even though many are typically folded
787 together in practice. Source files, translation units, and translated translation units need not
788 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
789 and any external representation. The description is conceptual only, and does not specify any
790 particular implementation.
792 [<a name="p9" href="#p9">page 9</a>] (<a href="#Contents">Contents</a>)
794 2. Each instance of a backslash character (\) immediately followed by a new-line
795 character is deleted, splicing physical source lines to form logical source lines.
796 Only the last backslash on any physical source line shall be eligible for being part
797 of such a splice. A source file that is not empty shall end in a new-line character,
798 which shall not be immediately preceded by a backslash character before any such
799 splicing takes place.
800 3. The source file is decomposed into preprocessing tokens6) and sequences of
801 white-space characters (including comments). A source file shall not end in a
802 partial preprocessing token or in a partial comment. Each comment is replaced by
803 one space character. New-line characters are retained. Whether each nonempty
804 sequence of white-space characters other than new-line is retained or replaced by
805 one space character is implementation-defined.
806 4. Preprocessing directives are executed, macro invocations are expanded, and
807 _Pragma unary operator expressions are executed. If a character sequence that
808 matches the syntax of a universal character name is produced by token
809 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
810 directive causes the named header or source file to be processed from phase 1
811 through phase 4, recursively. All preprocessing directives are then deleted.
812 5. Each source character set member and escape sequence in character constants and
813 string literals is converted to the corresponding member of the execution character
814 set; if there is no corresponding member, it is converted to an implementation-
815 defined member other than the null (wide) character.7)
816 6. Adjacent string literal tokens are concatenated.
817 7. White-space characters separating tokens are no longer significant. Each
818 preprocessing token is converted into a token. The resulting tokens are
819 syntactically and semantically analyzed and translated as a translation unit.
820 8. All external object and function references are resolved. Library components are
821 linked to satisfy external references to functions and objects not defined in the
822 current translation. All such translator output is collected into a program image
823 which contains information needed for execution in its execution environment.
824 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), lexical elements (<a href="#6.4">6.4</a>),
825 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>).
829 6) As described in <a href="#6.4">6.4</a>, the process of dividing a source file's characters into preprocessing tokens is
830 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
831 7) An implementation need not convert all non-corresponding source characters to the same execution
832 character.
834 [<a name="p10" href="#p10">page 10</a>] (<a href="#Contents">Contents</a>)
836 <a name="5.1.1.3" href="#5.1.1.3"><b> 5.1.1.3 Diagnostics</b></a>
837 1 A conforming implementation shall produce at least one diagnostic message (identified in
838 an implementation-defined manner) if a preprocessing translation unit or translation unit
839 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
840 specified as undefined or implementation-defined. Diagnostic messages need not be
841 produced in other circumstances.8)
842 2 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
843 char i;
844 int i;
845 because in those cases where wording in this International Standard describes the behavior for a construct
846 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
848 <a name="5.1.2" href="#5.1.2"><b> 5.1.2 Execution environments</b></a>
849 1 Two execution environments are defined: freestanding and hosted. In both cases,
850 program startup occurs when a designated C function is called by the execution
851 environment. All objects with static storage duration shall be initialized (set to their
852 initial values) before program startup. The manner and timing of such initialization are
853 otherwise unspecified. Program termination returns control to the execution
854 environment.
855 Forward references: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.8">6.7.8</a>).
856 <a name="5.1.2.1" href="#5.1.2.1"><b> 5.1.2.1 Freestanding environment</b></a>
857 1 In a freestanding environment (in which C program execution may take place without any
858 benefit of an operating system), the name and type of the function called at program
859 startup are implementation-defined. Any library facilities available to a freestanding
860 program, other than the minimal set required by clause 4, are implementation-defined.
861 2 The effect of program termination in a freestanding environment is implementation-
862 defined.
863 <a name="5.1.2.2" href="#5.1.2.2"><b> 5.1.2.2 Hosted environment</b></a>
864 1 A hosted environment need not be provided, but shall conform to the following
865 specifications if present.
870 8) The intent is that an implementation should identify the nature of, and where possible localize, each
871 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
872 valid program is still correctly translated. It may also successfully translate an invalid program.
874 [<a name="p11" href="#p11">page 11</a>] (<a href="#Contents">Contents</a>)
876 <a name="5.1.2.2.1" href="#5.1.2.2.1"><b> 5.1.2.2.1 Program startup</b></a>
877 1 The function called at program startup is named main. The implementation declares no
878 prototype for this function. It shall be defined with a return type of int and with no
879 parameters:
880 int main(void) { /* ... */ }
881 or with two parameters (referred to here as argc and argv, though any names may be
882 used, as they are local to the function in which they are declared):
883 int main(int argc, char *argv[]) { /* ... */ }
884 or equivalent;9) or in some other implementation-defined manner.
885 2 If they are declared, the parameters to the main function shall obey the following
886 constraints:
887 -- The value of argc shall be nonnegative.
888 -- argv[argc] shall be a null pointer.
889 -- If the value of argc is greater than zero, the array members argv[0] through
890 argv[argc-1] inclusive shall contain pointers to strings, which are given
891 implementation-defined values by the host environment prior to program startup. The
892 intent is to supply to the program information determined prior to program startup
893 from elsewhere in the hosted environment. If the host environment is not capable of
894 supplying strings with letters in both uppercase and lowercase, the implementation
895 shall ensure that the strings are received in lowercase.
896 -- If the value of argc is greater than zero, the string pointed to by argv[0]
897 represents the program name; argv[0][0] shall be the null character if the
898 program name is not available from the host environment. If the value of argc is
899 greater than one, the strings pointed to by argv[1] through argv[argc-1]
900 represent the program parameters.
901 -- The parameters argc and argv and the strings pointed to by the argv array shall
902 be modifiable by the program, and retain their last-stored values between program
903 startup and program termination.
904 <a name="5.1.2.2.2" href="#5.1.2.2.2"><b> 5.1.2.2.2 Program execution</b></a>
905 1 In a hosted environment, a program may use all the functions, macros, type definitions,
906 and objects described in the library clause (clause 7).
910 9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
911 char ** argv, and so on.
913 [<a name="p12" href="#p12">page 12</a>] (<a href="#Contents">Contents</a>)
915 <a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
916 1 If the return type of the main function is a type compatible with int, a return from the
917 initial call to the main function is equivalent to calling the exit function with the value
918 returned by the main function as its argument;10) reaching the } that terminates the
919 main function returns a value of 0. If the return type is not compatible with int, the
920 termination status returned to the host environment is unspecified.
921 Forward references: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
922 <a name="5.1.2.3" href="#5.1.2.3"><b> 5.1.2.3 Program execution</b></a>
923 1 The semantic descriptions in this International Standard describe the behavior of an
924 abstract machine in which issues of optimization are irrelevant.
925 2 Accessing a volatile object, modifying an object, modifying a file, or calling a function
926 that does any of those operations are all side effects,11) which are changes in the state of
927 the execution environment. Evaluation of an expression may produce side effects. At
928 certain specified points in the execution sequence called sequence points, all side effects
929 of previous evaluations shall be complete and no side effects of subsequent evaluations
930 shall have taken place. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
931 3 In the abstract machine, all expressions are evaluated as specified by the semantics. An
932 actual implementation need not evaluate part of an expression if it can deduce that its
933 value is not used and that no needed side effects are produced (including any caused by
934 calling a function or accessing a volatile object).
935 4 When the processing of the abstract machine is interrupted by receipt of a signal, only the
936 values of objects as of the previous sequence point may be relied on. Objects that may be
937 modified between the previous sequence point and the next sequence point need not have
938 received their correct values yet.
939 5 The least requirements on a conforming implementation are:
940 -- At sequence points, volatile objects are stable in the sense that previous accesses are
941 complete and subsequent accesses have not yet occurred.
946 10) In accordance with <a href="#6.2.4">6.2.4</a>, the lifetimes of objects with automatic storage duration declared in main
947 will have ended in the former case, even where they would not have in the latter.
948 11) The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
949 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
950 values of floating-point operations. Implementations that support such floating-point state are
951 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
952 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
953 effects matter, freeing the implementations in other cases.
955 [<a name="p13" href="#p13">page 13</a>] (<a href="#Contents">Contents</a>)
957 -- At program termination, all data written into files shall be identical to the result that
958 execution of the program according to the abstract semantics would have produced.
959 -- The input and output dynamics of interactive devices shall take place as specified in
960 <a name="7.19.3" href="#7.19.3"><b> 7.19.3. The intent of these requirements is that unbuffered or line-buffered output</b></a>
961 appear as soon as possible, to ensure that prompting messages actually appear prior to
962 a program waiting for input.
963 6 What constitutes an interactive device is implementation-defined.
964 7 More stringent correspondences between abstract and actual semantics may be defined by
965 each implementation.
966 8 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
967 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
968 abstract semantics. The keyword volatile would then be redundant.
969 9 Alternatively, an implementation might perform various optimizations within each translation unit, such
970 that the actual semantics would agree with the abstract semantics only when making function calls across
971 translation unit boundaries. In such an implementation, at the time of each function entry and function
972 return where the calling function and the called function are in different translation units, the values of all
973 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
974 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
975 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
976 type of implementation, objects referred to by interrupt service routines activated by the signal function
977 would require explicit specification of volatile storage, as well as other implementation-defined
978 restrictions.
980 10 EXAMPLE 2 In executing the fragment
981 char c1, c2;
982 /* ... */
983 c1 = c1 + c2;
984 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
985 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
986 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
987 produce the same result, possibly omitting the promotions.
989 11 EXAMPLE 3 Similarly, in the fragment
990 float f1, f2;
991 double d;
992 /* ... */
993 f1 = f2 * d;
994 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
995 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
996 were replaced by the constant <a href="#2.0">2.0</a>, which has type double).
1001 [<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
1003 12 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1004 semantics. Values are independent of whether they are represented in a register or in memory. For
1005 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1006 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1007 perform their specified conversion. For the fragment
1008 double d1, d2;
1009 float f;
1010 d1 = f = expression;
1011 d2 = (float) expression;
1012 the values assigned to d1 and d2 are required to have been converted to float.
1014 13 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1015 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1016 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1017 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1018 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1019 numbers are often not valid (see <a href="#F.8">F.8</a>).
1020 double x, y, z;
1021 /* ... */
1022 x = (x * y) * z; // not equivalent to x *= y * z;
1023 z = (x - y) + y ; // not equivalent to z = x;
1024 z = x + x * y; // not equivalent to z = x * (<a href="#1.0">1.0</a> + y);
1025 y = x / <a href="#5.0">5.0</a>; // not equivalent to y = x * 0.2;
1027 14 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1028 int a, b;
1029 /* ... */
1030 a = a + 32760 + b + 5;
1031 the expression statement behaves exactly the same as
1032 a = (((a + 32760) + b) + 5);
1033 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1034 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1035 which overflows produce an explicit trap and in which the range of values representable by an int is
1036 [-32768, +32767], the implementation cannot rewrite this expression as
1037 a = ((a + b) + 32765);
1038 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1039 while the original expression would not; nor can the expression be rewritten either as
1040 a = ((a + 32765) + b);
1042 a = (a + (b + 32765));
1043 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1044 in which overflow silently generates some value and where positive and negative overflows cancel, the
1045 above expression statement can be rewritten by the implementation in any of the above ways because the
1046 same result will occur.
1051 [<a name="p15" href="#p15">page 15</a>] (<a href="#Contents">Contents</a>)
1053 15 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1054 following fragment
1055 #include <a href="#7.19">&lt;stdio.h&gt;</a>
1056 int sum;
1057 char *p;
1058 /* ... */
1059 sum = sum * 10 - '0' + (*p++ = getchar());
1060 the expression statement is grouped as if it were written as
1061 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1062 but the actual increment of p can occur at any time between the previous sequence point and the next
1063 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1064 value.
1066 Forward references: expressions (<a href="#6.5">6.5</a>), type qualifiers (<a href="#6.7.3">6.7.3</a>), statements (<a href="#6.8">6.8</a>), the
1067 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.19.3">7.19.3</a>).
1072 [<a name="p16" href="#p16">page 16</a>] (<a href="#Contents">Contents</a>)
1074 <a name="5.2" href="#5.2"><b> 5.2 Environmental considerations</b></a>
1075 <a name="5.2.1" href="#5.2.1"><b> 5.2.1 Character sets</b></a>
1076 1 Two sets of characters and their associated collating sequences shall be defined: the set in
1077 which source files are written (the source character set), and the set interpreted in the
1078 execution environment (the execution character set). Each set is further divided into a
1079 basic character set, whose contents are given by this subclause, and a set of zero or more
1080 locale-specific members (which are not members of the basic character set) called
1081 extended characters. The combined set is also called the extended character set. The
1082 values of the members of the execution character set are implementation-defined.
1083 2 In a character constant or string literal, members of the execution character set shall be
1084 represented by corresponding members of the source character set or by escape
1085 sequences consisting of the backslash \ followed by one or more characters. A byte with
1086 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1087 is used to terminate a character string.
1088 3 Both the basic source and basic execution character sets shall have the following
1089 members: the 26 uppercase letters of the Latin alphabet
1090 A B C D E F G H I J K L M
1091 N O P Q R S T U V W X Y Z
1092 the 26 lowercase letters of the Latin alphabet
1093 a b c d e f g h i j k l m
1094 n o p q r s t u v w x y z
1095 the 10 decimal digits
1096 0 1 2 3 4 5 6 7 8 9
1097 the following 29 graphic characters
1098 ! " # % &amp; ' ( ) * + , - . / :
1099 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~
1100 the space character, and control characters representing horizontal tab, vertical tab, and
1101 form feed. The representation of each member of the source and execution basic
1102 character sets shall fit in a byte. In both the source and execution basic character sets, the
1103 value of each character after 0 in the above list of decimal digits shall be one greater than
1104 the value of the previous. In source files, there shall be some way of indicating the end of
1105 each line of text; this International Standard treats such an end-of-line indicator as if it
1106 were a single new-line character. In the basic execution character set, there shall be
1107 control characters representing alert, backspace, carriage return, and new line. If any
1108 other characters are encountered in a source file (except in an identifier, a character
1109 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1111 [<a name="p17" href="#p17">page 17</a>] (<a href="#Contents">Contents</a>)
1113 converted to a token), the behavior is undefined.
1114 4 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1115 Standard the term does not include other characters that are letters in other alphabets.
1116 5 The universal character name construct provides a way to name other characters.
1117 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), character constants (<a href="#6.4.4.4">6.4.4.4</a>),
1118 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>).
1119 <a name="5.2.1.1" href="#5.2.1.1"><b> 5.2.1.1 Trigraph sequences</b></a>
1120 1 Before any other processing takes place, each occurrence of one of the following
1121 sequences of three characters (called trigraph sequences12)) is replaced with the
1122 corresponding single character.
1123 ??= # ??) ] ??! |
1124 ??( [ ??' ^ ??&gt; }
1125 ??/ \ ??&lt; { ??- ~
1126 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1127 above is not changed.
1128 2 EXAMPLE 1
1129 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1130 becomes
1131 #define arraycheck(a, b) a[b] || b[a]
1133 3 EXAMPLE 2 The following source line
1134 printf("Eh???/n");
1135 becomes (after replacement of the trigraph sequence ??/)
1136 printf("Eh?\n");
1138 <a name="5.2.1.2" href="#5.2.1.2"><b> 5.2.1.2 Multibyte characters</b></a>
1139 1 The source character set may contain multibyte characters, used to represent members of
1140 the extended character set. The execution character set may also contain multibyte
1141 characters, which need not have the same encoding as for the source character set. For
1142 both character sets, the following shall hold:
1143 -- The basic character set shall be present and each character shall be encoded as a
1144 single byte.
1145 -- The presence, meaning, and representation of any additional members is locale-
1146 specific.
1148 12) The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1149 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1151 [<a name="p18" href="#p18">page 18</a>] (<a href="#Contents">Contents</a>)
1153 -- A multibyte character set may have a state-dependent encoding, wherein each
1154 sequence of multibyte characters begins in an initial shift state and enters other
1155 locale-specific shift states when specific multibyte characters are encountered in the
1156 sequence. While in the initial shift state, all single-byte characters retain their usual
1157 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1158 in the sequence is a function of the current shift state.
1159 -- A byte with all bits zero shall be interpreted as a null character independent of shift
1160 state. Such a byte shall not occur as part of any other multibyte character.
1161 2 For source files, the following shall hold:
1162 -- An identifier, comment, string literal, character constant, or header name shall begin
1163 and end in the initial shift state.
1164 -- An identifier, comment, string literal, character constant, or header name shall consist
1165 of a sequence of valid multibyte characters.
1166 <a name="5.2.2" href="#5.2.2"><b> 5.2.2 Character display semantics</b></a>
1167 1 The active position is that location on a display device where the next character output by
1168 the fputc function would appear. The intent of writing a printing character (as defined
1169 by the isprint function) to a display device is to display a graphic representation of
1170 that character at the active position and then advance the active position to the next
1171 position on the current line. The direction of writing is locale-specific. If the active
1172 position is at the final position of a line (if there is one), the behavior of the display device
1173 is unspecified.
1174 2 Alphabetic escape sequences representing nongraphic characters in the execution
1175 character set are intended to produce actions on display devices as follows:
1176 \a (alert) Produces an audible or visible alert without changing the active position.
1177 \b (backspace) Moves the active position to the previous position on the current line. If
1178 the active position is at the initial position of a line, the behavior of the display
1179 device is unspecified.
1180 \f ( form feed) Moves the active position to the initial position at the start of the next
1181 logical page.
1182 \n (new line) Moves the active position to the initial position of the next line.
1183 \r (carriage return) Moves the active position to the initial position of the current line.
1184 \t (horizontal tab) Moves the active position to the next horizontal tabulation position
1185 on the current line. If the active position is at or past the last defined horizontal
1186 tabulation position, the behavior of the display device is unspecified.
1187 \v (vertical tab) Moves the active position to the initial position of the next vertical
1188 tabulation position. If the active position is at or past the last defined vertical
1189 [<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
1191 tabulation position, the behavior of the display device is unspecified.
1192 3 Each of these escape sequences shall produce a unique implementation-defined value
1193 which can be stored in a single char object. The external representations in a text file
1194 need not be identical to the internal representations, and are outside the scope of this
1195 International Standard.
1196 Forward references: the isprint function (<a href="#7.4.1.8">7.4.1.8</a>), the fputc function (<a href="#7.19.7.3">7.19.7.3</a>).
1197 <a name="5.2.3" href="#5.2.3"><b> 5.2.3 Signals and interrupts</b></a>
1198 1 Functions shall be implemented such that they may be interrupted at any time by a signal,
1199 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1200 invocations' control flow (after the interruption), function return values, or objects with
1201 automatic storage duration. All such objects shall be maintained outside the function
1202 image (the instructions that compose the executable representation of a function) on a
1203 per-invocation basis.
1204 <a name="5.2.4" href="#5.2.4"><b> 5.2.4 Environmental limits</b></a>
1205 1 Both the translation and execution environments constrain the implementation of
1206 language translators and libraries. The following summarizes the language-related
1207 environmental limits on a conforming implementation; the library-related limits are
1208 discussed in clause 7.
1209 <a name="5.2.4.1" href="#5.2.4.1"><b> 5.2.4.1 Translation limits</b></a>
1210 1 The implementation shall be able to translate and execute at least one program that
1211 contains at least one instance of every one of the following limits:13)
1212 -- 127 nesting levels of blocks
1213 -- 63 nesting levels of conditional inclusion
1214 -- 12 pointer, array, and function declarators (in any combinations) modifying an
1215 arithmetic, structure, union, or incomplete type in a declaration
1216 -- 63 nesting levels of parenthesized declarators within a full declarator
1217 -- 63 nesting levels of parenthesized expressions within a full expression
1218 -- 63 significant initial characters in an internal identifier or a macro name (each
1219 universal character name or extended source character is considered a single
1220 character)
1221 -- 31 significant initial characters in an external identifier (each universal character name
1222 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1225 13) Implementations should avoid imposing fixed translation limits whenever possible.
1227 [<a name="p20" href="#p20">page 20</a>] (<a href="#Contents">Contents</a>)
1229 universal character name specifying a short identifier of 00010000 or more is
1230 considered 10 characters, and each extended source character is considered the same
1231 number of characters as the corresponding universal character name, if any)14)
1232 -- 4095 external identifiers in one translation unit
1233 -- 511 identifiers with block scope declared in one block
1234 -- 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1235 -- 127 parameters in one function definition
1236 -- 127 arguments in one function call
1237 -- 127 parameters in one macro definition
1238 -- 127 arguments in one macro invocation
1239 -- 4095 characters in a logical source line
1240 -- 4095 characters in a character string literal or wide string literal (after concatenation)
1241 -- 65535 bytes in an object (in a hosted environment only)
1242 -- 15 nesting levels for #included files
1243 -- 1023 case labels for a switch statement (excluding those for any nested switch
1244 statements)
1245 -- 1023 members in a single structure or union
1246 -- 1023 enumeration constants in a single enumeration
1247 -- 63 levels of nested structure or union definitions in a single struct-declaration-list
1248 <a name="5.2.4.2" href="#5.2.4.2"><b> 5.2.4.2 Numerical limits</b></a>
1249 1 An implementation is required to document all the limits specified in this subclause,
1250 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
1251 specified in <a href="#7.18">&lt;stdint.h&gt;</a>.
1252 Forward references: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
1253 <a name="5.2.4.2.1" href="#5.2.4.2.1"><b> 5.2.4.2.1 Sizes of integer types &lt;limits.h&gt;</b></a>
1254 1 The values given below shall be replaced by constant expressions suitable for use in #if
1255 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1256 following shall be replaced by expressions that have the same type as would an
1257 expression that is an object of the corresponding type converted according to the integer
1258 promotions. Their implementation-defined values shall be equal or greater in magnitude
1261 14) See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1263 [<a name="p21" href="#p21">page 21</a>] (<a href="#Contents">Contents</a>)
1265 (absolute value) to those shown, with the same sign.
1266 -- number of bits for smallest object that is not a bit-field (byte)
1267 CHAR_BIT 8
1268 -- minimum value for an object of type signed char
1269 SCHAR_MIN -127 // -(27 - 1)
1270 -- maximum value for an object of type signed char
1271 SCHAR_MAX +127 // 27 - 1
1272 -- maximum value for an object of type unsigned char
1273 UCHAR_MAX 255 // 28 - 1
1274 -- minimum value for an object of type char
1275 CHAR_MIN see below
1276 -- maximum value for an object of type char
1277 CHAR_MAX see below
1278 -- maximum number of bytes in a multibyte character, for any supported locale
1279 MB_LEN_MAX 1
1280 -- minimum value for an object of type short int
1281 SHRT_MIN -32767 // -(215 - 1)
1282 -- maximum value for an object of type short int
1283 SHRT_MAX +32767 // 215 - 1
1284 -- maximum value for an object of type unsigned short int
1285 USHRT_MAX 65535 // 216 - 1
1286 -- minimum value for an object of type int
1287 INT_MIN -32767 // -(215 - 1)
1288 -- maximum value for an object of type int
1289 INT_MAX +32767 // 215 - 1
1290 -- maximum value for an object of type unsigned int
1291 UINT_MAX 65535 // 216 - 1
1292 -- minimum value for an object of type long int
1293 LONG_MIN -2147483647 // -(231 - 1)
1294 -- maximum value for an object of type long int
1295 LONG_MAX +2147483647 // 231 - 1
1296 -- maximum value for an object of type unsigned long int
1297 ULONG_MAX 4294967295 // 232 - 1
1300 [<a name="p22" href="#p22">page 22</a>] (<a href="#Contents">Contents</a>)
1302 -- minimum value for an object of type long long int
1303 LLONG_MIN -9223372036854775807 // -(263 - 1)
1304 -- maximum value for an object of type long long int
1305 LLONG_MAX +9223372036854775807 // 263 - 1
1306 -- maximum value for an object of type unsigned long long int
1307 ULLONG_MAX 18446744073709551615 // 264 - 1
1308 2 If the value of an object of type char is treated as a signed integer when used in an
1309 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1310 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1311 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1312 UCHAR_MAX.15) The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
1313 Forward references: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
1314 <a name="5.2.4.2.2" href="#5.2.4.2.2"><b> 5.2.4.2.2 Characteristics of floating types &lt;float.h&gt;</b></a>
1315 1 The characteristics of floating types are defined in terms of a model that describes a
1316 representation of floating-point numbers and values that provide information about an
1317 implementation's floating-point arithmetic.16) The following parameters are used to
1318 define the model for each floating-point type:
1319 s sign ((+-)1)
1320 b base or radix of exponent representation (an integer &gt; 1)
1321 e exponent (an integer between a minimum emin and a maximum emax )
1322 p precision (the number of base-b digits in the significand)
1323 fk nonnegative integers less than b (the significand digits)
1324 2 A floating-point number (x) is defined by the following model:
1326 x = sb e (Sum) f k b-k ,
1328 emin &lt;= e &lt;= emax
1330 3 In addition to normalized floating-point numbers ( f 1 &gt; 0 if x != 0), floating types may be
1331 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1332 numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
1333 e &gt; emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
1334 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1335 through almost every arithmetic operation without raising a floating-point exception; a
1336 signaling NaN generally raises a floating-point exception when occurring as an
1339 15) See <a href="#6.2.5">6.2.5</a>.
1340 16) The floating-point model is intended to clarify the description of each floating-point characteristic and
1341 does not require the floating-point arithmetic of the implementation to be identical.
1343 [<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
1345 arithmetic operand.17)
1346 4 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
1347 sign or may leave them unsigned. Wherever such values are unsigned, any requirement
1348 in this International Standard to retrieve the sign shall produce an unspecified sign, and
1349 any requirement to set the sign shall be ignored.
1350 5 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1351 <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-
1352 defined, as is the accuracy of the conversion between floating-point internal
1353 representations and string representations performed by the library functions in
1354 <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
1355 accuracy is unknown.
1356 6 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
1357 expressions suitable for use in #if preprocessing directives; all floating values shall be
1358 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1359 and FLT_ROUNDS have separate names for all three floating-point types. The floating-
1360 point model representation is provided for all values except FLT_EVAL_METHOD and
1361 FLT_ROUNDS.
1362 7 The rounding mode for floating-point addition is characterized by the implementation-
1363 defined value of FLT_ROUNDS:18)
1364 -1 indeterminable
1365 0 toward zero
1366 1 to nearest
1367 2 toward positive infinity
1368 3 toward negative infinity
1369 All other values for FLT_ROUNDS characterize implementation-defined rounding
1370 behavior.
1371 8 Except for assignment and cast (which remove all extra range and precision), the values
1372 of operations with floating operands and values subject to the usual arithmetic
1373 conversions and of floating constants are evaluated to a format whose range and precision
1374 may be greater than required by the type. The use of evaluation formats is characterized
1375 by the implementation-defined value of FLT_EVAL_METHOD:19)
1379 17) IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1380 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1381 similar behavior.
1382 18) Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1383 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
1385 [<a name="p24" href="#p24">page 24</a>] (<a href="#Contents">Contents</a>)
1387 -1 indeterminable;
1388 0 evaluate all operations and constants just to the range and precision of the
1389 type;
1390 1 evaluate operations and constants of type float and double to the
1391 range and precision of the double type, evaluate long double
1392 operations and constants to the range and precision of the long double
1393 type;
1394 2 evaluate all operations and constants to the range and precision of the
1395 long double type.
1396 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1397 behavior.
1398 9 The values given in the following list shall be replaced by constant expressions with
1399 implementation-defined values that are greater or equal in magnitude (absolute value) to
1400 those shown, with the same sign:
1401 -- radix of exponent representation, b
1402 FLT_RADIX 2
1403 -- number of base-FLT_RADIX digits in the floating-point significand, p
1404 FLT_MANT_DIG
1405 DBL_MANT_DIG
1406 LDBL_MANT_DIG
1407 -- number of decimal digits, n, such that any floating-point number in the widest
1408 supported floating type with pmax radix b digits can be rounded to a floating-point
1409 number with n decimal digits and back again without change to the value,
1410 ??? pmax log10 b if b is a power of 10
1412 ??? ???1 + pmax log10 b??? otherwise
1413 DECIMAL_DIG 10
1414 -- number of decimal digits, q, such that any floating-point number with q decimal digits
1415 can be rounded into a floating-point number with p radix b digits and back again
1416 without change to the q decimal digits,
1421 19) The evaluation method determines evaluation formats of expressions involving all floating types, not
1422 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1423 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1424 double.
1426 [<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
1428 ??? p log10 b if b is a power of 10
1430 ??? ???( p - 1) log10 b??? otherwise
1431 FLT_DIG 6
1432 DBL_DIG 10
1433 LDBL_DIG 10
1434 -- minimum negative integer such that FLT_RADIX raised to one less than that power is
1435 a normalized floating-point number, emin
1436 FLT_MIN_EXP
1437 DBL_MIN_EXP
1438 LDBL_MIN_EXP
1439 -- minimum negative integer such that 10 raised to that power is in the range of
1440 normalized floating-point numbers, ???log10 b emin -1 ???
1441 ??? ???
1442 FLT_MIN_10_EXP -37
1443 DBL_MIN_10_EXP -37
1444 LDBL_MIN_10_EXP -37
1445 -- maximum integer such that FLT_RADIX raised to one less than that power is a
1446 representable finite floating-point number, emax
1447 FLT_MAX_EXP
1448 DBL_MAX_EXP
1449 LDBL_MAX_EXP
1450 -- maximum integer such that 10 raised to that power is in the range of representable
1451 finite floating-point numbers, ???log10 ((1 - b- p )b emax )???
1452 FLT_MAX_10_EXP +37
1453 DBL_MAX_10_EXP +37
1454 LDBL_MAX_10_EXP +37
1455 10 The values given in the following list shall be replaced by constant expressions with
1456 implementation-defined values that are greater than or equal to those shown:
1457 -- maximum representable finite floating-point number, (1 - b- p )b emax
1458 FLT_MAX 1E+37
1459 DBL_MAX 1E+37
1460 LDBL_MAX 1E+37
1461 11 The values given in the following list shall be replaced by constant expressions with
1462 implementation-defined (positive) values that are less than or equal to those shown:
1463 -- the difference between 1 and the least value greater than 1 that is representable in the
1464 given floating point type, b1- p
1465 [<a name="p26" href="#p26">page 26</a>] (<a href="#Contents">Contents</a>)
1467 FLT_EPSILON 1E-5
1468 DBL_EPSILON 1E-9
1469 LDBL_EPSILON 1E-9
1470 -- minimum normalized positive floating-point number, b emin -1
1471 FLT_MIN 1E-37
1472 DBL_MIN 1E-37
1473 LDBL_MIN 1E-37
1474 Recommended practice
1475 12 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1476 should be the identity function.
1477 13 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1478 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
1479 float:
1481 x = s16e (Sum) f k 16-k ,
1483 -31 &lt;= e &lt;= +32
1485 FLT_RADIX 16
1486 FLT_MANT_DIG 6
1487 FLT_EPSILON 9.53674316E-07F
1488 FLT_DIG 6
1489 FLT_MIN_EXP -31
1490 FLT_MIN 2.93873588E-39F
1491 FLT_MIN_10_EXP -38
1492 FLT_MAX_EXP +32
1493 FLT_MAX 3.40282347E+38F
1494 FLT_MAX_10_EXP +38
1496 14 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1497 single-precision and double-precision normalized numbers in IEC 60559,20) and the appropriate values in a
1498 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
1500 x f = s2e (Sum) f k 2-k ,
1502 -125 &lt;= e &lt;= +128
1505 x d = s2e (Sum) f k 2-k ,
1507 -1021 &lt;= e &lt;= +1024
1509 FLT_RADIX 2
1510 DECIMAL_DIG 17
1511 FLT_MANT_DIG 24
1512 FLT_EPSILON 1.19209290E-07F // decimal constant
1513 FLT_EPSILON 0X1P-23F // hex constant
1516 20) The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1517 limits are one less than shown here.
1519 [<a name="p27" href="#p27">page 27</a>] (<a href="#Contents">Contents</a>)
1521 FLT_DIG 6
1522 FLT_MIN_EXP -125
1523 FLT_MIN 1.17549435E-38F // decimal constant
1524 FLT_MIN 0X1P-126F // hex constant
1525 FLT_MIN_10_EXP -37
1526 FLT_MAX_EXP +128
1527 FLT_MAX 3.40282347E+38F // decimal constant
1528 FLT_MAX 0X1.fffffeP127F // hex constant
1529 FLT_MAX_10_EXP +38
1530 DBL_MANT_DIG 53
1531 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1532 DBL_EPSILON 0X1P-52 // hex constant
1533 DBL_DIG 15
1534 DBL_MIN_EXP -1021
1535 DBL_MIN 2.2250738585072014E-308 // decimal constant
1536 DBL_MIN 0X1P-1022 // hex constant
1537 DBL_MIN_10_EXP -307
1538 DBL_MAX_EXP +1024
1539 DBL_MAX 1.7976931348623157E+308 // decimal constant
1540 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1541 DBL_MAX_10_EXP +308
1542 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1543 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1544 precision), then DECIMAL_DIG would be 21.
1546 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1547 <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>
1548 (<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>
1549 (<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>).
1554 [<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
1557 <a name="6" href="#6"><b> 6. Language</b></a>
1558 <a name="6.1" href="#6.1"><b> 6.1 Notation</b></a>
1559 1 In the syntax notation used in this clause, syntactic categories (nonterminals) are
1560 indicated by italic type, and literal words and character set members (terminals) by bold
1561 type. A colon (:) following a nonterminal introduces its definition. Alternative
1562 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
1563 optional symbol is indicated by the subscript ''opt'', so that
1564 { expressionopt }
1565 indicates an optional expression enclosed in braces.
1566 2 When syntactic categories are referred to in the main text, they are not italicized and
1567 words are separated by spaces instead of hyphens.
1568 3 A summary of the language syntax is given in <a href="#A">annex A</a>.
1569 <a name="6.2" href="#6.2"><b> 6.2 Concepts</b></a>
1570 <a name="6.2.1" href="#6.2.1"><b> 6.2.1 Scopes of identifiers</b></a>
1571 1 An identifier can denote an object; a function; a tag or a member of a structure, union, or
1572 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
1573 same identifier can denote different entities at different points in the program. A member
1574 of an enumeration is called an enumeration constant. Macro names and macro
1575 parameters are not considered further here, because prior to the semantic phase of
1576 program translation any occurrences of macro names in the source file are replaced by the
1577 preprocessing token sequences that constitute their macro definitions.
1578 2 For each different entity that an identifier designates, the identifier is visible (i.e., can be
1579 used) only within a region of program text called its scope. Different entities designated
1580 by the same identifier either have different scopes, or are in different name spaces. There
1581 are four kinds of scopes: function, file, block, and function prototype. (A function
1582 prototype is a declaration of a function that declares the types of its parameters.)
1583 3 A label name is the only kind of identifier that has function scope. It can be used (in a
1584 goto statement) anywhere in the function in which it appears, and is declared implicitly
1585 by its syntactic appearance (followed by a : and a statement).
1586 4 Every other identifier has scope determined by the placement of its declaration (in a
1587 declarator or type specifier). If the declarator or type specifier that declares the identifier
1588 appears outside of any block or list of parameters, the identifier has file scope, which
1589 terminates at the end of the translation unit. If the declarator or type specifier that
1590 declares the identifier appears inside a block or within the list of parameter declarations in
1591 a function definition, the identifier has block scope, which terminates at the end of the
1592 associated block. If the declarator or type specifier that declares the identifier appears
1593 [<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
1595 within the list of parameter declarations in a function prototype (not part of a function
1596 definition), the identifier has function prototype scope, which terminates at the end of the
1597 function declarator. If an identifier designates two different entities in the same name
1598 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will be a
1599 strict subset of the scope of the other entity (the outer scope). Within the inner scope, the
1600 identifier designates the entity declared in the inner scope; the entity declared in the outer
1601 scope is hidden (and not visible) within the inner scope.
1602 5 Unless explicitly stated otherwise, where this International Standard uses the term
1603 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
1604 entity in the relevant name space whose declaration is visible at the point the identifier
1605 occurs.
1606 6 Two identifiers have the same scope if and only if their scopes terminate at the same
1607 point.
1608 7 Structure, union, and enumeration tags have scope that begins just after the appearance of
1609 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
1610 begins just after the appearance of its defining enumerator in an enumerator list. Any
1611 other identifier has scope that begins just after the completion of its declarator.
1612 Forward references: declarations (<a href="#6.7">6.7</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), function definitions
1613 (<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>),
1614 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
1615 <a name="6.2.2" href="#6.2.2"><b> 6.2.2 Linkages of identifiers</b></a>
1616 1 An identifier declared in different scopes or in the same scope more than once can be
1617 made to refer to the same object or function by a process called linkage.21) There are
1618 three kinds of linkage: external, internal, and none.
1619 2 In the set of translation units and libraries that constitutes an entire program, each
1620 declaration of a particular identifier with external linkage denotes the same object or
1621 function. Within one translation unit, each declaration of an identifier with internal
1622 linkage denotes the same object or function. Each declaration of an identifier with no
1623 linkage denotes a unique entity.
1624 3 If the declaration of a file scope identifier for an object or a function contains the storage-
1625 class specifier static, the identifier has internal linkage.22)
1626 4 For an identifier declared with the storage-class specifier extern in a scope in which a
1630 21) There is no linkage between different identifiers.
1631 22) A function declaration can contain the storage-class specifier static only if it is at file scope; see
1632 <a name="6.7.1" href="#6.7.1"><b> 6.7.1.</b></a>
1634 [<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
1636 prior declaration of that identifier is visible,23) if the prior declaration specifies internal or
1637 external linkage, the linkage of the identifier at the later declaration is the same as the
1638 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
1639 declaration specifies no linkage, then the identifier has external linkage.
1640 5 If the declaration of an identifier for a function has no storage-class specifier, its linkage
1641 is determined exactly as if it were declared with the storage-class specifier extern. If
1642 the declaration of an identifier for an object has file scope and no storage-class specifier,
1643 its linkage is external.
1644 6 The following identifiers have no linkage: an identifier declared to be anything other than
1645 an object or a function; an identifier declared to be a function parameter; a block scope
1646 identifier for an object declared without the storage-class specifier extern.
1647 7 If, within a translation unit, the same identifier appears with both internal and external
1648 linkage, the behavior is undefined.
1649 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), external definitions (<a href="#6.9">6.9</a>),
1650 statements (<a href="#6.8">6.8</a>).
1651 <a name="6.2.3" href="#6.2.3"><b> 6.2.3 Name spaces of identifiers</b></a>
1652 1 If more than one declaration of a particular identifier is visible at any point in a
1653 translation unit, the syntactic context disambiguates uses that refer to different entities.
1654 Thus, there are separate name spaces for various categories of identifiers, as follows:
1655 -- label names (disambiguated by the syntax of the label declaration and use);
1656 -- the tags of structures, unions, and enumerations (disambiguated by following any24)
1657 of the keywords struct, union, or enum);
1658 -- the members of structures or unions; each structure or union has a separate name
1659 space for its members (disambiguated by the type of the expression used to access the
1660 member via the . or -&gt; operator);
1661 -- all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
1662 enumeration constants).
1663 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), labeled statements (<a href="#6.8.1">6.8.1</a>),
1664 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
1665 (<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>).
1670 23) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
1671 24) There is only one name space for tags even though three are possible.
1673 [<a name="p31" href="#p31">page 31</a>] (<a href="#Contents">Contents</a>)
1675 <a name="6.2.4" href="#6.2.4"><b> 6.2.4 Storage durations of objects</b></a>
1676 1 An object has a storage duration that determines its lifetime. There are three storage
1677 durations: static, automatic, and allocated. Allocated storage is described in <a href="#7.20.3">7.20.3</a>.
1678 2 The lifetime of an object is the portion of program execution during which storage is
1679 guaranteed to be reserved for it. An object exists, has a constant address,25) and retains
1680 its last-stored value throughout its lifetime.26) If an object is referred to outside of its
1681 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
1682 the object it points to reaches the end of its lifetime.
1683 3 An object whose identifier is declared with external or internal linkage, or with the
1684 storage-class specifier static has static storage duration. Its lifetime is the entire
1685 execution of the program and its stored value is initialized only once, prior to program
1686 startup.
1687 4 An object whose identifier is declared with no linkage and without the storage-class
1688 specifier static has automatic storage duration.
1689 5 For such an object that does not have a variable length array type, its lifetime extends
1690 from entry into the block with which it is associated until execution of that block ends in
1691 any way. (Entering an enclosed block or calling a function suspends, but does not end,
1692 execution of the current block.) If the block is entered recursively, a new instance of the
1693 object is created each time. The initial value of the object is indeterminate. If an
1694 initialization is specified for the object, it is performed each time the declaration is
1695 reached in the execution of the block; otherwise, the value becomes indeterminate each
1696 time the declaration is reached.
1697 6 For such an object that does have a variable length array type, its lifetime extends from
1698 the declaration of the object until execution of the program leaves the scope of the
1699 declaration.27) If the scope is entered recursively, a new instance of the object is created
1700 each time. The initial value of the object is indeterminate.
1701 Forward references: statements (<a href="#6.8">6.8</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), declarators (<a href="#6.7.5">6.7.5</a>), array
1702 declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
1707 25) The term ''constant address'' means that two pointers to the object constructed at possibly different
1708 times will compare equal. The address may be different during two different executions of the same
1709 program.
1710 26) In the case of a volatile object, the last store need not be explicit in the program.
1711 27) Leaving the innermost block containing the declaration, or jumping to a point in that block or an
1712 embedded block prior to the declaration, leaves the scope of the declaration.
1714 [<a name="p32" href="#p32">page 32</a>] (<a href="#Contents">Contents</a>)
1716 <a name="6.2.5" href="#6.2.5"><b> 6.2.5 Types</b></a>
1717 1 The meaning of a value stored in an object or returned by a function is determined by the
1718 type of the expression used to access it. (An identifier declared to be an object is the
1719 simplest such expression; the type is specified in the declaration of the identifier.) Types
1720 are partitioned into object types (types that fully describe objects), function types (types
1721 that describe functions), and incomplete types (types that describe objects but lack
1722 information needed to determine their sizes).
1723 2 An object declared as type _Bool is large enough to store the values 0 and 1.
1724 3 An object declared as type char is large enough to store any member of the basic
1725 execution character set. If a member of the basic execution character set is stored in a
1726 char object, its value is guaranteed to be nonnegative. If any other character is stored in
1727 a char object, the resulting value is implementation-defined but shall be within the range
1728 of values that can be represented in that type.
1729 4 There are five standard signed integer types, designated as signed char, short
1730 int, int, long int, and long long int. (These and other types may be
1731 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
1732 implementation-defined extended signed integer types.28) The standard and extended
1733 signed integer types are collectively called signed integer types.29)
1734 5 An object declared as type signed char occupies the same amount of storage as a
1735 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
1736 architecture of the execution environment (large enough to contain any value in the range
1737 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
1738 6 For each of the signed integer types, there is a corresponding (but different) unsigned
1739 integer type (designated with the keyword unsigned) that uses the same amount of
1740 storage (including sign information) and has the same alignment requirements. The type
1741 _Bool and the unsigned integer types that correspond to the standard signed integer
1742 types are the standard unsigned integer types. The unsigned integer types that
1743 correspond to the extended signed integer types are the extended unsigned integer types.
1744 The standard and extended unsigned integer types are collectively called unsigned integer
1745 types.30)
1749 28) Implementation-defined keywords shall have the form of an identifier reserved for any use as
1750 described in <a href="#7.1.3">7.1.3</a>.
1751 29) Therefore, any statement in this Standard about signed integer types also applies to the extended
1752 signed integer types.
1753 30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended
1754 unsigned integer types.
1756 [<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
1758 7 The standard signed integer types and standard unsigned integer types are collectively
1759 called the standard integer types, the extended signed integer types and extended
1760 unsigned integer types are collectively called the extended integer types.
1761 8 For any two integer types with the same signedness and different integer conversion rank
1762 (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
1763 subrange of the values of the other type.
1764 9 The range of nonnegative values of a signed integer type is a subrange of the
1765 corresponding unsigned integer type, and the representation of the same value in each
1766 type is the same.31) A computation involving unsigned operands can never overflow,
1767 because a result that cannot be represented by the resulting unsigned integer type is
1768 reduced modulo the number that is one greater than the largest value that can be
1769 represented by the resulting type.
1770 10 There are three real floating types, designated as float, double, and long
1771 double.32) The set of values of the type float is a subset of the set of values of the
1772 type double; the set of values of the type double is a subset of the set of values of the
1773 type long double.
1774 11 There are three complex types, designated as float _Complex, double
1775 _Complex, and long double _Complex.33) The real floating and complex types
1776 are collectively called the floating types.
1777 12 For each floating type there is a corresponding real type, which is always a real floating
1778 type. For real floating types, it is the same type. For complex types, it is the type given
1779 by deleting the keyword _Complex from the type name.
1780 13 Each complex type has the same representation and alignment requirements as an array
1781 type containing exactly two elements of the corresponding real type; the first element is
1782 equal to the real part, and the second element to the imaginary part, of the complex
1783 number.
1784 14 The type char, the signed and unsigned integer types, and the floating types are
1785 collectively called the basic types. Even if the implementation defines two or more basic
1786 types to have the same representation, they are nevertheless different types.34)
1788 31) The same representation and alignment requirements are meant to imply interchangeability as
1789 arguments to functions, return values from functions, and members of unions.
1790 32) See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
1791 33) A specification for imaginary types is in informative <a href="#G">annex G</a>.
1792 34) An implementation may define new keywords that provide alternative ways to designate a basic (or
1793 any other) type; this does not violate the requirement that all basic types be different.
1794 Implementation-defined keywords shall have the form of an identifier reserved for any use as
1795 described in <a href="#7.1.3">7.1.3</a>.
1797 [<a name="p34" href="#p34">page 34</a>] (<a href="#Contents">Contents</a>)
1799 15 The three types char, signed char, and unsigned char are collectively called
1800 the character types. The implementation shall define char to have the same range,
1801 representation, and behavior as either signed char or unsigned char.35)
1802 16 An enumeration comprises a set of named integer constant values. Each distinct
1803 enumeration constitutes a different enumerated type.
1804 17 The type char, the signed and unsigned integer types, and the enumerated types are
1805 collectively called integer types. The integer and real floating types are collectively called
1806 real types.
1807 18 Integer and floating types are collectively called arithmetic types. Each arithmetic type
1808 belongs to one type domain: the real type domain comprises the real types, the complex
1809 type domain comprises the complex types.
1810 19 The void type comprises an empty set of values; it is an incomplete type that cannot be
1811 completed.
1812 20 Any number of derived types can be constructed from the object, function, and
1813 incomplete types, as follows:
1814 -- An array type describes a contiguously allocated nonempty set of objects with a
1815 particular member object type, called the element type.36) Array types are
1816 characterized by their element type and by the number of elements in the array. An
1817 array type is said to be derived from its element type, and if its element type is T , the
1818 array type is sometimes called ''array of T ''. The construction of an array type from
1819 an element type is called ''array type derivation''.
1820 -- A structure type describes a sequentially allocated nonempty set of member objects
1821 (and, in certain circumstances, an incomplete array), each of which has an optionally
1822 specified name and possibly distinct type.
1823 -- A union type describes an overlapping nonempty set of member objects, each of
1824 which has an optionally specified name and possibly distinct type.
1825 -- A function type describes a function with specified return type. A function type is
1826 characterized by its return type and the number and types of its parameters. A
1827 function type is said to be derived from its return type, and if its return type is T , the
1828 function type is sometimes called ''function returning T ''. The construction of a
1829 function type from a return type is called ''function type derivation''.
1833 35) 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
1834 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
1835 other two and is not compatible with either.
1836 36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
1838 [<a name="p35" href="#p35">page 35</a>] (<a href="#Contents">Contents</a>)
1840 -- A pointer type may be derived from a function type, an object type, or an incomplete
1841 type, called the referenced type. A pointer type describes an object whose value
1842 provides a reference to an entity of the referenced type. A pointer type derived from
1843 the referenced type T is sometimes called ''pointer to T ''. The construction of a
1844 pointer type from a referenced type is called ''pointer type derivation''.
1845 These methods of constructing derived types can be applied recursively.
1846 21 Arithmetic types and pointer types are collectively called scalar types. Array and
1847 structure types are collectively called aggregate types.37)
1848 22 An array type of unknown size is an incomplete type. It is completed, for an identifier of
1849 that type, by specifying the size in a later declaration (with internal or external linkage).
1850 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
1851 type. It is completed, for all declarations of that type, by declaring the same structure or
1852 union tag with its defining content later in the same scope.
1853 23 A type has known constant size if the type is not incomplete and is not a variable length
1854 array type.
1855 24 Array, function, and pointer types are collectively called derived declarator types. A
1856 declarator type derivation from a type T is the construction of a derived declarator type
1857 from T by the application of an array-type, a function-type, or a pointer-type derivation to
1859 25 A type is characterized by its type category, which is either the outermost derivation of a
1860 derived type (as noted above in the construction of derived types), or the type itself if the
1861 type consists of no derived types.
1862 26 Any type so far mentioned is an unqualified type. Each unqualified type has several
1863 qualified versions of its type,38) corresponding to the combinations of one, two, or all
1864 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
1865 versions of a type are distinct types that belong to the same type category and have the
1866 same representation and alignment requirements.39) A derived type is not qualified by the
1867 qualifiers (if any) of the type from which it is derived.
1868 27 A pointer to void shall have the same representation and alignment requirements as a
1869 pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of
1870 compatible types shall have the same representation and alignment requirements. All
1873 37) Note that aggregate type does not include union type because an object with union type can only
1874 contain one member at a time.
1875 38) See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
1876 39) The same representation and alignment requirements are meant to imply interchangeability as
1877 arguments to functions, return values from functions, and members of unions.
1879 [<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
1881 pointers to structure types shall have the same representation and alignment requirements
1882 as each other. All pointers to union types shall have the same representation and
1883 alignment requirements as each other. Pointers to other types need not have the same
1884 representation or alignment requirements.
1885 28 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
1886 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
1887 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
1888 qualified float'' and is a pointer to a qualified type.
1890 29 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
1891 function returning struct tag''. The array has length five and the function has a single parameter of type
1892 float. Its type category is array.
1894 Forward references: compatible type and composite type (<a href="#6.2.7">6.2.7</a>), declarations (<a href="#6.7">6.7</a>).
1895 <a name="6.2.6" href="#6.2.6"><b> 6.2.6 Representations of types</b></a>
1896 <a name="6.2.6.1" href="#6.2.6.1"><b> 6.2.6.1 General</b></a>
1897 1 The representations of all types are unspecified except as stated in this subclause.
1898 2 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
1899 the number, order, and encoding of which are either explicitly specified or
1900 implementation-defined.
1901 3 Values stored in unsigned bit-fields and objects of type unsigned char shall be
1902 represented using a pure binary notation.40)
1903 4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
1904 bits, where n is the size of an object of that type, in bytes. The value may be copied into
1905 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
1906 called the object representation of the value. Values stored in bit-fields consist of m bits,
1907 where m is the size specified for the bit-field. The object representation is the set of m
1908 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
1909 than NaNs) with the same object representation compare equal, but values that compare
1910 equal may have different object representations.
1911 5 Certain object representations need not represent a value of the object type. If the stored
1912 value of an object has such a representation and is read by an lvalue expression that does
1913 not have character type, the behavior is undefined. If such a representation is produced
1914 by a side effect that modifies all or any part of the object by an lvalue expression that
1915 does not have character type, the behavior is undefined.41) Such a representation is called
1917 40) A positional representation for integers that uses the binary digits 0 and 1, in which the values
1918 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
1919 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
1920 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
1921 type unsigned char range from 0 to 2
1922 CHAR_BIT
1923 - 1.
1925 [<a name="p37" href="#p37">page 37</a>] (<a href="#Contents">Contents</a>)
1927 a trap representation.
1928 6 When a value is stored in an object of structure or union type, including in a member
1929 object, the bytes of the object representation that correspond to any padding bytes take
1930 unspecified values.42) The value of a structure or union object is never a trap
1931 representation, even though the value of a member of the structure or union object may be
1932 a trap representation.
1933 7 When a value is stored in a member of an object of union type, the bytes of the object
1934 representation that do not correspond to that member but do correspond to other members
1935 take unspecified values.
1936 8 Where an operator is applied to a value that has more than one object representation,
1937 which object representation is used shall not affect the value of the result.43) Where a
1938 value is stored in an object using a type that has more than one object representation for
1939 that value, it is unspecified which representation is used, but a trap representation shall
1940 not be generated.
1941 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), lvalues, arrays, and function
1942 designators (<a href="#6.3.2.1">6.3.2.1</a>).
1943 <a name="6.2.6.2" href="#6.2.6.2"><b> 6.2.6.2 Integer types</b></a>
1944 1 For unsigned integer types other than unsigned char, the bits of the object
1945 representation shall be divided into two groups: value bits and padding bits (there need
1946 not be any of the latter). If there are N value bits, each bit shall represent a different
1947 power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
1948 representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
1949 known as the value representation. The values of any padding bits are unspecified.44)
1950 2 For signed integer types, the bits of the object representation shall be divided into three
1951 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
1953 41) Thus, an automatic variable can be initialized to a trap representation without causing undefined
1954 behavior, but the value of the variable cannot be used until a proper value is stored in it.
1955 42) Thus, for example, structure assignment need not copy any padding bits.
1956 43) It is possible for objects x and y with the same effective type T to have the same value when they are
1957 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
1958 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
1959 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
1960 on values of type T may distinguish between them.
1961 44) Some combinations of padding bits might generate trap representations, for example, if one padding
1962 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
1963 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
1964 with unsigned types. All other combinations of padding bits are alternative object representations of
1965 the value specified by the value bits.
1967 [<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
1969 there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
1970 the same bit in the object representation of the corresponding unsigned type (if there are
1971 M value bits in the signed type and N in the unsigned type, then M &lt;= N ). If the sign bit
1972 is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be
1973 modified in one of the following ways:
1974 -- the corresponding value with sign bit 0 is negated (sign and magnitude);
1975 -- the sign bit has the value -(2 N ) (two's complement);
1976 -- the sign bit has the value -(2 N - 1) (ones' complement ).
1977 Which of these applies is implementation-defined, as is whether the value with sign bit 1
1978 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
1979 complement), is a trap representation or a normal value. In the case of sign and
1980 magnitude and ones' complement, if this representation is a normal value it is called a
1981 negative zero.
1982 3 If the implementation supports negative zeros, they shall be generated only by:
1983 -- the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with arguments that produce such a value;
1984 -- the +, -, *, /, and % operators where one argument is a negative zero and the result is
1985 zero;
1986 -- compound assignment operators based on the above cases.
1987 It is unspecified whether these cases actually generate a negative zero or a normal zero,
1988 and whether a negative zero becomes a normal zero when stored in an object.
1989 4 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
1990 and &gt;&gt; operators with arguments that would produce such a value is undefined.
1991 5 The values of any padding bits are unspecified.45) A valid (non-trap) object representation
1992 of a signed integer type where the sign bit is zero is a valid object representation of the
1993 corresponding unsigned type, and shall represent the same value. For any integer type,
1994 the object representation where all the bits are zero shall be a representation of the value
1995 zero in that type.
1996 6 The precision of an integer type is the number of bits it uses to represent values,
1997 excluding any sign and padding bits. The width of an integer type is the same but
1998 including any sign bit; thus for unsigned integer types the two values are the same, while
2001 45) Some combinations of padding bits might generate trap representations, for example, if one padding
2002 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2003 representation other than as part of an exceptional condition such as an overflow. All other
2004 combinations of padding bits are alternative object representations of the value specified by the value
2005 bits.
2007 [<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
2009 for signed integer types the width is one greater than the precision.
2010 <a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
2011 1 Two types have compatible type if their types are the same. Additional rules for
2012 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
2013 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.46) Moreover, two structure,
2014 union, or enumerated types declared in separate translation units are compatible if their
2015 tags and members satisfy the following requirements: If one is declared with a tag, the
2016 other shall be declared with the same tag. If both are complete types, then the following
2017 additional requirements apply: there shall be a one-to-one correspondence between their
2018 members such that each pair of corresponding members are declared with compatible
2019 types, and such that if one member of a corresponding pair is declared with a name, the
2020 other member is declared with the same name. For two structures, corresponding
2021 members shall be declared in the same order. For two structures or unions, corresponding
2022 bit-fields shall have the same widths. For two enumerations, corresponding members
2023 shall have the same values.
2024 2 All declarations that refer to the same object or function shall have compatible type;
2025 otherwise, the behavior is undefined.
2026 3 A composite type can be constructed from two types that are compatible; it is a type that
2027 is compatible with both of the two types and satisfies the following conditions:
2028 -- If one type is an array of known constant size, the composite type is an array of that
2029 size; otherwise, if one type is a variable length array, the composite type is that type.
2030 -- If only one type is a function type with a parameter type list (a function prototype),
2031 the composite type is a function prototype with the parameter type list.
2032 -- If both types are function types with parameter type lists, the type of each parameter
2033 in the composite parameter type list is the composite type of the corresponding
2034 parameters.
2035 These rules apply recursively to the types from which the two types are derived.
2036 4 For an identifier with internal or external linkage declared in a scope in which a prior
2037 declaration of that identifier is visible,47) if the prior declaration specifies internal or
2038 external linkage, the type of the identifier at the later declaration becomes the composite
2039 type.
2044 46) Two types need not be identical to be compatible.
2045 47) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2047 [<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
2049 5 EXAMPLE Given the following two file scope declarations:
2050 int f(int (*)(), double (*)[3]);
2051 int f(int (*)(char *), double (*)[]);
2052 The resulting composite type for the function is:
2053 int f(int (*)(char *), double (*)[3]);
2058 [<a name="p41" href="#p41">page 41</a>] (<a href="#Contents">Contents</a>)
2060 <a name="6.3" href="#6.3"><b> 6.3 Conversions</b></a>
2061 1 Several operators convert operand values from one type to another automatically. This
2062 subclause specifies the result required from such an implicit conversion, as well as those
2063 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2064 the conversions performed by most ordinary operators; it is supplemented as required by
2065 the discussion of each operator in <a href="#6.5">6.5</a>.
2066 2 Conversion of an operand value to a compatible type causes no change to the value or the
2067 representation.
2068 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>).
2069 <a name="6.3.1" href="#6.3.1"><b> 6.3.1 Arithmetic operands</b></a>
2070 <a name="6.3.1.1" href="#6.3.1.1"><b> 6.3.1.1 Boolean, characters, and integers</b></a>
2071 1 Every integer type has an integer conversion rank defined as follows:
2072 -- No two signed integer types shall have the same rank, even if they have the same
2073 representation.
2074 -- The rank of a signed integer type shall be greater than the rank of any signed integer
2075 type with less precision.
2076 -- The rank of long long int shall be greater than the rank of long int, which
2077 shall be greater than the rank of int, which shall be greater than the rank of short
2078 int, which shall be greater than the rank of signed char.
2079 -- The rank of any unsigned integer type shall equal the rank of the corresponding
2080 signed integer type, if any.
2081 -- The rank of any standard integer type shall be greater than the rank of any extended
2082 integer type with the same width.
2083 -- The rank of char shall equal the rank of signed char and unsigned char.
2084 -- The rank of _Bool shall be less than the rank of all other standard integer types.
2085 -- The rank of any enumerated type shall equal the rank of the compatible integer type
2086 (see <a href="#6.7.2.2">6.7.2.2</a>).
2087 -- The rank of any extended signed integer type relative to another extended signed
2088 integer type with the same precision is implementation-defined, but still subject to the
2089 other rules for determining the integer conversion rank.
2090 -- For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2091 greater rank than T3, then T1 has greater rank than T3.
2092 2 The following may be used in an expression wherever an int or unsigned int may
2093 be used:
2095 [<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
2097 -- An object or expression with an integer type whose integer conversion rank is less
2098 than or equal to the rank of int and unsigned int.
2099 -- A bit-field of type _Bool, int, signed int, or unsigned int.
2100 If an int can represent all values of the original type, the value is converted to an int;
2101 otherwise, it is converted to an unsigned int. These are called the integer
2102 promotions.48) All other types are unchanged by the integer promotions.
2103 3 The integer promotions preserve value including sign. As discussed earlier, whether a
2104 ''plain'' char is treated as signed is implementation-defined.
2105 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2106 (<a href="#6.7.2.1">6.7.2.1</a>).
2107 <a name="6.3.1.2" href="#6.3.1.2"><b> 6.3.1.2 Boolean type</b></a>
2108 1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2109 to 0; otherwise, the result is 1.
2110 <a name="6.3.1.3" href="#6.3.1.3"><b> 6.3.1.3 Signed and unsigned integers</b></a>
2111 1 When a value with integer type is converted to another integer type other than _Bool, if
2112 the value can be represented by the new type, it is unchanged.
2113 2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2114 subtracting one more than the maximum value that can be represented in the new type
2115 until the value is in the range of the new type.49)
2116 3 Otherwise, the new type is signed and the value cannot be represented in it; either the
2117 result is implementation-defined or an implementation-defined signal is raised.
2118 <a name="6.3.1.4" href="#6.3.1.4"><b> 6.3.1.4 Real floating and integer</b></a>
2119 1 When a finite value of real floating type is converted to an integer type other than _Bool,
2120 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2121 the integral part cannot be represented by the integer type, the behavior is undefined.50)
2122 2 When a value of integer type is converted to a real floating type, if the value being
2123 converted can be represented exactly in the new type, it is unchanged. If the value being
2124 converted is in the range of values that can be represented but cannot be represented
2126 48) The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2127 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2128 shift operators, as specified by their respective subclauses.
2129 49) The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2130 50) The remaindering operation performed when a value of integer type is converted to unsigned type
2131 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2132 range of portable real floating values is (-1, Utype_MAX+1).
2134 [<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
2136 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2137 in an implementation-defined manner. If the value being converted is outside the range of
2138 values that can be represented, the behavior is undefined.
2139 <a name="6.3.1.5" href="#6.3.1.5"><b> 6.3.1.5 Real floating types</b></a>
2140 1 When a float is promoted to double or long double, or a double is promoted
2141 to long double, its value is unchanged (if the source value is represented in the
2142 precision and range of its type).
2143 2 When a double is demoted to float, a long double is demoted to double or
2144 float, or a value being represented in greater precision and range than required by its
2145 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
2146 being converted can be represented exactly in the new type, it is unchanged. If the value
2147 being converted is in the range of values that can be represented but cannot be
2148 represented exactly, the result is either the nearest higher or nearest lower representable
2149 value, chosen in an implementation-defined manner. If the value being converted is
2150 outside the range of values that can be represented, the behavior is undefined.
2151 <a name="6.3.1.6" href="#6.3.1.6"><b> 6.3.1.6 Complex types</b></a>
2152 1 When a value of complex type is converted to another complex type, both the real and
2153 imaginary parts follow the conversion rules for the corresponding real types.
2154 <a name="6.3.1.7" href="#6.3.1.7"><b> 6.3.1.7 Real and complex</b></a>
2155 1 When a value of real type is converted to a complex type, the real part of the complex
2156 result value is determined by the rules of conversion to the corresponding real type and
2157 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2158 2 When a value of complex type is converted to a real type, the imaginary part of the
2159 complex value is discarded and the value of the real part is converted according to the
2160 conversion rules for the corresponding real type.
2161 <a name="6.3.1.8" href="#6.3.1.8"><b> 6.3.1.8 Usual arithmetic conversions</b></a>
2162 1 Many operators that expect operands of arithmetic type cause conversions and yield result
2163 types in a similar way. The purpose is to determine a common real type for the operands
2164 and result. For the specified operands, each operand is converted, without change of type
2165 domain, to a type whose corresponding real type is the common real type. Unless
2166 explicitly stated otherwise, the common real type is also the corresponding real type of
2167 the result, whose type domain is the type domain of the operands if they are the same,
2168 and complex otherwise. This pattern is called the usual arithmetic conversions:
2169 First, if the corresponding real type of either operand is long double, the other
2170 operand is converted, without change of type domain, to a type whose
2171 corresponding real type is long double.
2173 [<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
2175 Otherwise, if the corresponding real type of either operand is double, the other
2176 operand is converted, without change of type domain, to a type whose
2177 corresponding real type is double.
2178 Otherwise, if the corresponding real type of either operand is float, the other
2179 operand is converted, without change of type domain, to a type whose
2180 corresponding real type is float.51)
2181 Otherwise, the integer promotions are performed on both operands. Then the
2182 following rules are applied to the promoted operands:
2183 If both operands have the same type, then no further conversion is needed.
2184 Otherwise, if both operands have signed integer types or both have unsigned
2185 integer types, the operand with the type of lesser integer conversion rank is
2186 converted to the type of the operand with greater rank.
2187 Otherwise, if the operand that has unsigned integer type has rank greater or
2188 equal to the rank of the type of the other operand, then the operand with
2189 signed integer type is converted to the type of the operand with unsigned
2190 integer type.
2191 Otherwise, if the type of the operand with signed integer type can represent
2192 all of the values of the type of the operand with unsigned integer type, then
2193 the operand with unsigned integer type is converted to the type of the
2194 operand with signed integer type.
2195 Otherwise, both operands are converted to the unsigned integer type
2196 corresponding to the type of the operand with signed integer type.
2197 2 The values of floating operands and of the results of floating expressions may be
2198 represented in greater precision and range than that required by the type; the types are not
2199 changed thereby.52)
2204 51) For example, addition of a double _Complex and a float entails just the conversion of the
2205 float operand to double (and yields a double _Complex result).
2206 52) The cast and assignment operators are still required to perform their specified conversions as
2207 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>.
2209 [<a name="p45" href="#p45">page 45</a>] (<a href="#Contents">Contents</a>)
2211 <a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
2212 <a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
2213 1 An lvalue is an expression with an object type or an incomplete type other than void;53)
2214 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
2215 When an object is said to have a particular type, the type is specified by the lvalue used to
2216 designate the object. A modifiable lvalue is an lvalue that does not have array type, does
2217 not have an incomplete type, does not have a const-qualified type, and if it is a structure
2218 or union, does not have any member (including, recursively, any member or element of
2219 all contained aggregates or unions) with a const-qualified type.
2220 2 Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++
2221 operator, the -- operator, or the left operand of the . operator or an assignment operator,
2222 an lvalue that does not have array type is converted to the value stored in the designated
2223 object (and is no longer an lvalue). If the lvalue has qualified type, the value has the
2224 unqualified version of the type of the lvalue; otherwise, the value has the type of the
2225 lvalue. If the lvalue has an incomplete type and does not have array type, the behavior is
2226 undefined.
2227 3 Except when it is the operand of the sizeof operator or the unary &amp; operator, or is a
2228 string literal used to initialize an array, an expression that has type ''array of type'' is
2229 converted to an expression with type ''pointer to type'' that points to the initial element of
2230 the array object and is not an lvalue. If the array object has register storage class, the
2231 behavior is undefined.
2232 4 A function designator is an expression that has function type. Except when it is the
2233 operand of the sizeof operator54) or the unary &amp; operator, a function designator with
2234 type ''function returning type'' is converted to an expression that has type ''pointer to
2235 function returning type''.
2236 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2237 (<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
2238 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2239 (<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>).
2242 53) The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2243 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2244 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2245 as the ''value of an expression''.
2246 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2247 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2248 54) Because this conversion does not occur, the operand of the sizeof operator remains a function
2249 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
2251 [<a name="p46" href="#p46">page 46</a>] (<a href="#Contents">Contents</a>)
2253 <a href="#6.3.2.2">6.3.2.2</a> void
2254 1 The (nonexistent) value of a void expression (an expression that has type void) shall not
2255 be used in any way, and implicit or explicit conversions (except to void) shall not be
2256 applied to such an expression. If an expression of any other type is evaluated as a void
2257 expression, its value or designator is discarded. (A void expression is evaluated for its
2258 side effects.)
2259 <a name="6.3.2.3" href="#6.3.2.3"><b> 6.3.2.3 Pointers</b></a>
2260 1 A pointer to void may be converted to or from a pointer to any incomplete or object
2261 type. A pointer to any incomplete or object type may be converted to a pointer to void
2262 and back again; the result shall compare equal to the original pointer.
2263 2 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2264 the q-qualified version of the type; the values stored in the original and converted pointers
2265 shall compare equal.
2266 3 An integer constant expression with the value 0, or such an expression cast to type
2267 void *, is called a null pointer constant.55) If a null pointer constant is converted to a
2268 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2269 to a pointer to any object or function.
2270 4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2271 Any two null pointers shall compare equal.
2272 5 An integer may be converted to any pointer type. Except as previously specified, the
2273 result is implementation-defined, might not be correctly aligned, might not point to an
2274 entity of the referenced type, and might be a trap representation.56)
2275 6 Any pointer type may be converted to an integer type. Except as previously specified, the
2276 result is implementation-defined. If the result cannot be represented in the integer type,
2277 the behavior is undefined. The result need not be in the range of values of any integer
2278 type.
2279 7 A pointer to an object or incomplete type may be converted to a pointer to a different
2280 object or incomplete type. If the resulting pointer is not correctly aligned57) for the
2281 pointed-to type, the behavior is undefined. Otherwise, when converted back again, the
2282 result shall compare equal to the original pointer. When a pointer to an object is
2285 55) 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>.
2286 56) The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2287 be consistent with the addressing structure of the execution environment.
2288 57) In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2289 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2290 correctly aligned for a pointer to type C.
2292 [<a name="p47" href="#p47">page 47</a>] (<a href="#Contents">Contents</a>)
2294 converted to a pointer to a character type, the result points to the lowest addressed byte of
2295 the object. Successive increments of the result, up to the size of the object, yield pointers
2296 to the remaining bytes of the object.
2297 8 A pointer to a function of one type may be converted to a pointer to a function of another
2298 type and back again; the result shall compare equal to the original pointer. If a converted
2299 pointer is used to call a function whose type is not compatible with the pointed-to type,
2300 the behavior is undefined.
2301 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>), equality operators (<a href="#6.5.9">6.5.9</a>), integer types
2302 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>).
2307 [<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
2309 <a name="6.4" href="#6.4"><b> 6.4 Lexical elements</b></a>
2310 Syntax
2311 1 token:
2312 keyword
2313 identifier
2314 constant
2315 string-literal
2316 punctuator
2317 preprocessing-token:
2318 header-name
2319 identifier
2320 pp-number
2321 character-constant
2322 string-literal
2323 punctuator
2324 each non-white-space character that cannot be one of the above
2325 Constraints
2326 2 Each preprocessing token that is converted to a token shall have the lexical form of a
2327 keyword, an identifier, a constant, a string literal, or a punctuator.
2328 Semantics
2329 3 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2330 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2331 A preprocessing token is the minimal lexical element of the language in translation
2332 phases 3 through 6. The categories of preprocessing tokens are: header names,
2333 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2334 single non-white-space characters that do not lexically match the other preprocessing
2335 token categories.58) If a ' or a " character matches the last category, the behavior is
2336 undefined. Preprocessing tokens can be separated by white space; this consists of
2337 comments (described later), or white-space characters (space, horizontal tab, new-line,
2338 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2339 during translation phase 4, white space (or the absence thereof) serves as more than
2340 preprocessing token separation. White space may appear within a preprocessing token
2341 only as part of a header name or between the quotation characters in a character constant
2342 or string literal.
2346 58) 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
2347 occur in source files.
2349 [<a name="p49" href="#p49">page 49</a>] (<a href="#Contents">Contents</a>)
2351 4 If the input stream has been parsed into preprocessing tokens up to a given character, the
2352 next preprocessing token is the longest sequence of characters that could constitute a
2353 preprocessing token. There is one exception to this rule: header name preprocessing
2354 tokens are recognized only within #include preprocessing directives and in
2355 implementation-defined locations within #pragma directives. In such contexts, a
2356 sequence of characters that could be either a header name or a string literal is recognized
2357 as the former.
2358 5 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2359 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2360 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2361 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2362 not E is a macro name.
2364 6 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2365 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2367 Forward references: character constants (<a href="#6.4.4.4">6.4.4.4</a>), comments (<a href="#6.4.9">6.4.9</a>), expressions (<a href="#6.5">6.5</a>),
2368 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
2369 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2370 (<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
2371 (<a href="#6.4.5">6.4.5</a>).
2372 <a name="6.4.1" href="#6.4.1"><b> 6.4.1 Keywords</b></a>
2373 Syntax
2374 1 keyword: one of
2375 auto enum restrict unsigned
2376 break extern return void
2377 case float short volatile
2378 char for signed while
2379 const goto sizeof _Bool
2380 continue if static _Complex
2381 default inline struct _Imaginary
2382 do int switch
2383 double long typedef
2384 else register union
2385 Semantics
2386 2 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
2387 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
2388 specifying imaginary types.59)
2392 59) One possible specification for imaginary types appears in <a href="#G">annex G</a>.
2394 [<a name="p50" href="#p50">page 50</a>] (<a href="#Contents">Contents</a>)
2396 <a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
2397 <a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
2398 Syntax
2399 1 identifier:
2400 identifier-nondigit
2401 identifier identifier-nondigit
2402 identifier digit
2403 identifier-nondigit:
2404 nondigit
2405 universal-character-name
2406 other implementation-defined characters
2407 nondigit: one of
2408 _ a b c d e f g h i j k l m
2409 n o p q r s t u v w x y z
2410 A B C D E F G H I J K L M
2411 N O P Q R S T U V W X Y Z
2412 digit: one of
2413 0 1 2 3 4 5 6 7 8 9
2414 Semantics
2415 2 An identifier is a sequence of nondigit characters (including the underscore _, the
2416 lowercase and uppercase Latin letters, and other characters) and digits, which designates
2417 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
2418 There is no specific limit on the maximum length of an identifier.
2419 3 Each universal character name in an identifier shall designate a character whose encoding
2420 in ISO/IEC 10646 falls into one of the ranges specified in <a href="#D">annex D</a>.60) The initial
2421 character shall not be a universal character name designating a digit. An implementation
2422 may allow multibyte characters that are not part of the basic source character set to
2423 appear in identifiers; which characters and their correspondence to universal character
2424 names is implementation-defined.
2425 4 When preprocessing tokens are converted to tokens during translation phase 7, if a
2426 preprocessing token could be converted to either a keyword or an identifier, it is converted
2427 to a keyword.
2430 60) On systems in which linkers cannot accept extended characters, an encoding of the universal character
2431 name may be used in forming valid external identifiers. For example, some otherwise unused
2432 character or sequence of characters may be used to encode the \u in a universal character name.
2433 Extended characters may produce a long external identifier.
2435 [<a name="p51" href="#p51">page 51</a>] (<a href="#Contents">Contents</a>)
2437 Implementation limits
2438 5 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
2439 characters in an identifier; the limit for an external name (an identifier that has external
2440 linkage) may be more restrictive than that for an internal name (a macro name or an
2441 identifier that does not have external linkage). The number of significant characters in an
2442 identifier is implementation-defined.
2443 6 Any identifiers that differ in a significant character are different identifiers. If two
2444 identifiers differ only in nonsignificant characters, the behavior is undefined.
2445 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), macro replacement (<a href="#6.10.3">6.10.3</a>).
2446 <a name="6.4.2.2" href="#6.4.2.2"><b> 6.4.2.2 Predefined identifiers</b></a>
2447 Semantics
2448 1 The identifier __func__ shall be implicitly declared by the translator as if,
2449 immediately following the opening brace of each function definition, the declaration
2450 static const char __func__[] = "function-name";
2451 appeared, where function-name is the name of the lexically-enclosing function.61)
2452 2 This name is encoded as if the implicit declaration had been written in the source
2453 character set and then translated into the execution character set as indicated in translation
2454 phase 5.
2455 3 EXAMPLE Consider the code fragment:
2456 #include <a href="#7.19">&lt;stdio.h&gt;</a>
2457 void myfunc(void)
2459 printf("%s\n", __func__);
2460 /* ... */
2462 Each time the function is called, it will print to the standard output stream:
2463 myfunc
2465 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
2470 61) Since the name __func__ is reserved for any use by the implementation (<a href="#7.1.3">7.1.3</a>), if any other
2471 identifier is explicitly declared using the name __func__, the behavior is undefined.
2473 [<a name="p52" href="#p52">page 52</a>] (<a href="#Contents">Contents</a>)
2475 <a name="6.4.3" href="#6.4.3"><b> 6.4.3 Universal character names</b></a>
2476 Syntax
2477 1 universal-character-name:
2478 \u hex-quad
2479 \U hex-quad hex-quad
2480 hex-quad:
2481 hexadecimal-digit hexadecimal-digit
2482 hexadecimal-digit hexadecimal-digit
2483 Constraints
2484 2 A universal character name shall not specify a character whose short identifier is less than
2485 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
2486 DFFF inclusive.62)
2487 Description
2488 3 Universal character names may be used in identifiers, character constants, and string
2489 literals to designate characters that are not in the basic character set.
2490 Semantics
2491 4 The universal character name \Unnnnnnnn designates the character whose eight-digit
2492 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.63) Similarly, the universal
2493 character name \unnnn designates the character whose four-digit short identifier is nnnn
2494 (and whose eight-digit short identifier is 0000nnnn).
2499 62) The disallowed characters are the characters in the basic character set and the code positions reserved
2500 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
2501 UTF-16).
2502 63) Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
2504 [<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
2506 <a name="6.4.4" href="#6.4.4"><b> 6.4.4 Constants</b></a>
2507 Syntax
2508 1 constant:
2509 integer-constant
2510 floating-constant
2511 enumeration-constant
2512 character-constant
2513 Constraints
2514 2 Each constant shall have a type and the value of a constant shall be in the range of
2515 representable values for its type.
2516 Semantics
2517 3 Each constant has a type, determined by its form and value, as detailed later.
2518 <a name="6.4.4.1" href="#6.4.4.1"><b> 6.4.4.1 Integer constants</b></a>
2519 Syntax
2520 1 integer-constant:
2521 decimal-constant integer-suffixopt
2522 octal-constant integer-suffixopt
2523 hexadecimal-constant integer-suffixopt
2524 decimal-constant:
2525 nonzero-digit
2526 decimal-constant digit
2527 octal-constant:
2529 octal-constant octal-digit
2530 hexadecimal-constant:
2531 hexadecimal-prefix hexadecimal-digit
2532 hexadecimal-constant hexadecimal-digit
2533 hexadecimal-prefix: one of
2534 0x 0X
2535 nonzero-digit: one of
2536 1 2 3 4 5 6 7 8 9
2537 octal-digit: one of
2538 0 1 2 3 4 5 6 7
2543 [<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
2545 hexadecimal-digit: one of
2546 0 1 2 3 4 5 6 7 8 9
2547 a b c d e f
2548 A B C D E F
2549 integer-suffix:
2550 unsigned-suffix long-suffixopt
2551 unsigned-suffix long-long-suffix
2552 long-suffix unsigned-suffixopt
2553 long-long-suffix unsigned-suffixopt
2554 unsigned-suffix: one of
2556 long-suffix: one of
2558 long-long-suffix: one of
2559 ll LL
2560 Description
2561 2 An integer constant begins with a digit, but has no period or exponent part. It may have a
2562 prefix that specifies its base and a suffix that specifies its type.
2563 3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
2564 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
2565 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
2566 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
2567 10 through 15 respectively.
2568 Semantics
2569 4 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
2570 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
2571 5 The type of an integer constant is the first of the corresponding list in which its value can
2572 be represented.
2577 [<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
2579 Octal or Hexadecimal
2580 Suffix Decimal Constant Constant
2582 none int int
2583 long int unsigned int
2584 long long int long int
2585 unsigned long int
2586 long long int
2587 unsigned long long int
2589 u or U unsigned int unsigned int
2590 unsigned long int unsigned long int
2591 unsigned long long int unsigned long long int
2593 l or L long int long int
2594 long long int unsigned long int
2595 long long int
2596 unsigned long long int
2598 Both u or U unsigned long int unsigned long int
2599 and l or L unsigned long long int unsigned long long int
2601 ll or LL long long int long long int
2602 unsigned long long int
2604 Both u or U unsigned long long int unsigned long long int
2605 and ll or LL
2606 6 If an integer constant cannot be represented by any type in its list, it may have an
2607 extended integer type, if the extended integer type can represent its value. If all of the
2608 types in the list for the constant are signed, the extended integer type shall be signed. If
2609 all of the types in the list for the constant are unsigned, the extended integer type shall be
2610 unsigned. If the list contains both signed and unsigned types, the extended integer type
2611 may be signed or unsigned. If an integer constant cannot be represented by any type in
2612 its list and has no extended integer type, then the integer constant has no type.
2617 [<a name="p56" href="#p56">page 56</a>] (<a href="#Contents">Contents</a>)
2619 <a name="6.4.4.2" href="#6.4.4.2"><b> 6.4.4.2 Floating constants</b></a>
2620 Syntax
2621 1 floating-constant:
2622 decimal-floating-constant
2623 hexadecimal-floating-constant
2624 decimal-floating-constant:
2625 fractional-constant exponent-partopt floating-suffixopt
2626 digit-sequence exponent-part floating-suffixopt
2627 hexadecimal-floating-constant:
2628 hexadecimal-prefix hexadecimal-fractional-constant
2629 binary-exponent-part floating-suffixopt
2630 hexadecimal-prefix hexadecimal-digit-sequence
2631 binary-exponent-part floating-suffixopt
2632 fractional-constant:
2633 digit-sequenceopt . digit-sequence
2634 digit-sequence .
2635 exponent-part:
2636 e signopt digit-sequence
2637 E signopt digit-sequence
2638 sign: one of
2640 digit-sequence:
2641 digit
2642 digit-sequence digit
2643 hexadecimal-fractional-constant:
2644 hexadecimal-digit-sequenceopt .
2645 hexadecimal-digit-sequence
2646 hexadecimal-digit-sequence .
2647 binary-exponent-part:
2648 p signopt digit-sequence
2649 P signopt digit-sequence
2650 hexadecimal-digit-sequence:
2651 hexadecimal-digit
2652 hexadecimal-digit-sequence hexadecimal-digit
2653 floating-suffix: one of
2654 f l F L
2656 [<a name="p57" href="#p57">page 57</a>] (<a href="#Contents">Contents</a>)
2658 Description
2659 2 A floating constant has a significand part that may be followed by an exponent part and a
2660 suffix that specifies its type. The components of the significand part may include a digit
2661 sequence representing the whole-number part, followed by a period (.), followed by a
2662 digit sequence representing the fraction part. The components of the exponent part are an
2663 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
2664 Either the whole-number part or the fraction part has to be present; for decimal floating
2665 constants, either the period or the exponent part has to be present.
2666 Semantics
2667 3 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
2668 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
2669 floating constants, the exponent indicates the power of 10 by which the significand part is
2670 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
2671 by which the significand part is to be scaled. For decimal floating constants, and also for
2672 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
2673 the nearest representable value, or the larger or smaller representable value immediately
2674 adjacent to the nearest representable value, chosen in an implementation-defined manner.
2675 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
2676 correctly rounded.
2677 4 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
2678 type float. If suffixed by the letter l or L, it has type long double.
2679 5 Floating constants are converted to internal format as if at translation-time. The
2680 conversion of a floating constant shall not raise an exceptional condition or a floating-
2681 point exception at execution time.
2682 Recommended practice
2683 6 The implementation should produce a diagnostic message if a hexadecimal constant
2684 cannot be represented exactly in its evaluation format; the implementation should then
2685 proceed with the translation of the program.
2686 7 The translation-time conversion of floating constants should match the execution-time
2687 conversion of character strings by library functions, such as strtod, given matching
2688 inputs suitable for both conversions, the same result format, and default execution-time
2689 rounding.64)
2694 64) The specification for the library functions recommends more accurate conversion than required for
2695 floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
2697 [<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
2699 <a name="6.4.4.3" href="#6.4.4.3"><b> 6.4.4.3 Enumeration constants</b></a>
2700 Syntax
2701 1 enumeration-constant:
2702 identifier
2703 Semantics
2704 2 An identifier declared as an enumeration constant has type int.
2705 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
2706 <a name="6.4.4.4" href="#6.4.4.4"><b> 6.4.4.4 Character constants</b></a>
2707 Syntax
2708 1 character-constant:
2709 ' c-char-sequence '
2710 L' c-char-sequence '
2711 c-char-sequence:
2712 c-char
2713 c-char-sequence c-char
2714 c-char:
2715 any member of the source character set except
2716 the single-quote ', backslash \, or new-line character
2717 escape-sequence
2718 escape-sequence:
2719 simple-escape-sequence
2720 octal-escape-sequence
2721 hexadecimal-escape-sequence
2722 universal-character-name
2723 simple-escape-sequence: one of
2724 \' \" \? \\
2725 \a \b \f \n \r \t \v
2726 octal-escape-sequence:
2727 \ octal-digit
2728 \ octal-digit octal-digit
2729 \ octal-digit octal-digit octal-digit
2730 hexadecimal-escape-sequence:
2731 \x hexadecimal-digit
2732 hexadecimal-escape-sequence hexadecimal-digit
2736 [<a name="p59" href="#p59">page 59</a>] (<a href="#Contents">Contents</a>)
2738 Description
2739 2 An integer character constant is a sequence of one or more multibyte characters enclosed
2740 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
2741 letter L. With a few exceptions detailed later, the elements of the sequence are any
2742 members of the source character set; they are mapped in an implementation-defined
2743 manner to members of the execution character set.
2744 3 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
2745 arbitrary integer values are representable according to the following table of escape
2746 sequences:
2747 single quote ' \'
2748 double quote " \"
2749 question mark ? \?
2750 backslash \ \\
2751 octal character \octal digits
2752 hexadecimal character \x hexadecimal digits
2753 4 The double-quote " and question-mark ? are representable either by themselves or by the
2754 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
2755 shall be represented, respectively, by the escape sequences \' and \\.
2756 5 The octal digits that follow the backslash in an octal escape sequence are taken to be part
2757 of the construction of a single character for an integer character constant or of a single
2758 wide character for a wide character constant. The numerical value of the octal integer so
2759 formed specifies the value of the desired character or wide character.
2760 6 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
2761 sequence are taken to be part of the construction of a single character for an integer
2762 character constant or of a single wide character for a wide character constant. The
2763 numerical value of the hexadecimal integer so formed specifies the value of the desired
2764 character or wide character.
2765 7 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
2766 constitute the escape sequence.
2767 8 In addition, characters not in the basic character set are representable by universal
2768 character names and certain nongraphic characters are representable by escape sequences
2769 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
2770 and \v.65)
2775 65) The semantics of these characters were discussed in <a href="#5.2.2">5.2.2</a>. If any other character follows a backslash,
2776 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
2778 [<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
2780 Constraints
2781 9 The value of an octal or hexadecimal escape sequence shall be in the range of
2782 representable values for the type unsigned char for an integer character constant, or
2783 the unsigned type corresponding to wchar_t for a wide character constant.
2784 Semantics
2785 10 An integer character constant has type int. The value of an integer character constant
2786 containing a single character that maps to a single-byte execution character is the
2787 numerical value of the representation of the mapped character interpreted as an integer.
2788 The value of an integer character constant containing more than one character (e.g.,
2789 'ab'), or containing a character or escape sequence that does not map to a single-byte
2790 execution character, is implementation-defined. If an integer character constant contains
2791 a single character or escape sequence, its value is the one that results when an object with
2792 type char whose value is that of the single character or escape sequence is converted to
2793 type int.
2794 11 A wide character constant has type wchar_t, an integer type defined in the
2795 <a href="#7.17">&lt;stddef.h&gt;</a> header. The value of a wide character constant containing a single
2796 multibyte character that maps to a member of the extended execution character set is the
2797 wide character corresponding to that multibyte character, as defined by the mbtowc
2798 function, with an implementation-defined current locale. The value of a wide character
2799 constant containing more than one multibyte character, or containing a multibyte
2800 character or escape sequence not represented in the extended execution character set, is
2801 implementation-defined.
2802 12 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
2804 13 EXAMPLE 2 Consider implementations that use two's-complement representation for integers and eight
2805 bits for objects that have type char. In an implementation in which type char has the same range of
2806 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
2807 same range of values as unsigned char, the character constant '\xFF' has the value +255.
2809 14 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
2810 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
2811 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
2812 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
2813 escape sequence is terminated after three octal digits. (The value of this two-character integer character
2814 constant is implementation-defined.)
2816 15 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
2817 L'\1234' specifies the implementation-defined value that results from the combination of the values
2818 0123 and '4'.
2820 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbtowc function
2821 (<a href="#7.20.7.2">7.20.7.2</a>).
2826 [<a name="p61" href="#p61">page 61</a>] (<a href="#Contents">Contents</a>)
2828 <a name="6.4.5" href="#6.4.5"><b> 6.4.5 String literals</b></a>
2829 Syntax
2830 1 string-literal:
2831 " s-char-sequenceopt "
2832 L" s-char-sequenceopt "
2833 s-char-sequence:
2834 s-char
2835 s-char-sequence s-char
2836 s-char:
2837 any member of the source character set except
2838 the double-quote ", backslash \, or new-line character
2839 escape-sequence
2840 Description
2841 2 A character string literal is a sequence of zero or more multibyte characters enclosed in
2842 double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
2843 letter L.
2844 3 The same considerations apply to each element of the sequence in a character string
2845 literal or a wide string literal as if it were in an integer character constant or a wide
2846 character constant, except that the single-quote ' is representable either by itself or by the
2847 escape sequence \', but the double-quote " shall be represented by the escape sequence
2849 Semantics
2850 4 In translation phase 6, the multibyte character sequences specified by any sequence of
2851 adjacent character and wide string literal tokens are concatenated into a single multibyte
2852 character sequence. If any of the tokens are wide string literal tokens, the resulting
2853 multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a
2854 character string literal.
2855 5 In translation phase 7, a byte or code of value zero is appended to each multibyte
2856 character sequence that results from a string literal or literals.66) The multibyte character
2857 sequence is then used to initialize an array of static storage duration and length just
2858 sufficient to contain the sequence. For character string literals, the array elements have
2859 type char, and are initialized with the individual bytes of the multibyte character
2860 sequence; for wide string literals, the array elements have type wchar_t, and are
2861 initialized with the sequence of wide characters corresponding to the multibyte character
2863 66) 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
2864 it by a \0 escape sequence.
2866 [<a name="p62" href="#p62">page 62</a>] (<a href="#Contents">Contents</a>)
2868 sequence, as defined by the mbstowcs function with an implementation-defined current
2869 locale. The value of a string literal containing a multibyte character or escape sequence
2870 not represented in the execution character set is implementation-defined.
2871 6 It is unspecified whether these arrays are distinct provided their elements have the
2872 appropriate values. If the program attempts to modify such an array, the behavior is
2873 undefined.
2874 7 EXAMPLE This pair of adjacent character string literals
2875 "\x12" "3"
2876 produces a single character string literal containing the two characters whose values are '\x12' and '3',
2877 because escape sequences are converted into single members of the execution character set just prior to
2878 adjacent string literal concatenation.
2880 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbstowcs
2881 function (<a href="#7.20.8.1">7.20.8.1</a>).
2882 <a name="6.4.6" href="#6.4.6"><b> 6.4.6 Punctuators</b></a>
2883 Syntax
2884 1 punctuator: one of
2885 [ ] ( ) { } . -&gt;
2886 ++ -- &amp; * + - ~ !
2887 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
2888 ? : ; ...
2889 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
2890 , # ##
2891 &lt;: :&gt; &lt;% %&gt; %: %:%:
2892 Semantics
2893 2 A punctuator is a symbol that has independent syntactic and semantic significance.
2894 Depending on context, it may specify an operation to be performed (which in turn may
2895 yield a value or a function designator, produce a side effect, or some combination thereof)
2896 in which case it is known as an operator (other forms of operator also exist in some
2897 contexts). An operand is an entity on which an operator acts.
2902 [<a name="p63" href="#p63">page 63</a>] (<a href="#Contents">Contents</a>)
2904 3 In all aspects of the language, the six tokens67)
2905 &lt;: :&gt; &lt;% %&gt; %: %:%:
2906 behave, respectively, the same as the six tokens
2907 [ ] { } # ##
2908 except for their spelling.68)
2909 Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
2910 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
2911 <a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
2912 Syntax
2913 1 header-name:
2914 &lt; h-char-sequence &gt;
2915 " q-char-sequence "
2916 h-char-sequence:
2917 h-char
2918 h-char-sequence h-char
2919 h-char:
2920 any member of the source character set except
2921 the new-line character and &gt;
2922 q-char-sequence:
2923 q-char
2924 q-char-sequence q-char
2925 q-char:
2926 any member of the source character set except
2927 the new-line character and "
2928 Semantics
2929 2 The sequences in both forms of header names are mapped in an implementation-defined
2930 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
2931 3 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
2932 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
2937 67) These tokens are sometimes called ''digraphs''.
2938 68) Thus [ and &lt;: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
2939 interchanged.
2941 [<a name="p64" href="#p64">page 64</a>] (<a href="#Contents">Contents</a>)
2943 sequence between the " delimiters, the behavior is undefined.69) Header name
2944 preprocessing tokens are recognized only within #include preprocessing directives and
2945 in implementation-defined locations within #pragma directives.70)
2946 4 EXAMPLE The following sequence of characters:
2947 0x3&lt;1/a.h&gt;1e2
2948 #include &lt;1/a.h&gt;
2949 #define const.member@$
2950 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
2951 by a { on the left and a } on the right).
2952 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
2953 {#}{include} {&lt;1/a.h&gt;}
2954 {#}{define} {const}{.}{member}{@}{$}
2956 Forward references: source file inclusion (<a href="#6.10.2">6.10.2</a>).
2957 <a name="6.4.8" href="#6.4.8"><b> 6.4.8 Preprocessing numbers</b></a>
2958 Syntax
2959 1 pp-number:
2960 digit
2961 . digit
2962 pp-number digit
2963 pp-number identifier-nondigit
2964 pp-number e sign
2965 pp-number E sign
2966 pp-number p sign
2967 pp-number P sign
2968 pp-number .
2969 Description
2970 2 A preprocessing number begins with a digit optionally preceded by a period (.) and may
2971 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
2972 p+, p-, P+, or P-.
2973 3 Preprocessing number tokens lexically include all floating and integer constant tokens.
2974 Semantics
2975 4 A preprocessing number does not have type or a value; it acquires both after a successful
2976 conversion (as part of translation phase 7) to a floating constant token or an integer
2977 constant token.
2980 69) Thus, sequences of characters that resemble escape sequences cause undefined behavior.
2981 70) For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
2983 [<a name="p65" href="#p65">page 65</a>] (<a href="#Contents">Contents</a>)
2985 <a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
2986 1 Except within a character constant, a string literal, or a comment, the characters /*
2987 introduce a comment. The contents of such a comment are examined only to identify
2988 multibyte characters and to find the characters */ that terminate it.71)
2989 2 Except within a character constant, a string literal, or a comment, the characters //
2990 introduce a comment that includes all multibyte characters up to, but not including, the
2991 next new-line character. The contents of such a comment are examined only to identify
2992 multibyte characters and to find the terminating new-line character.
2993 3 EXAMPLE
2994 "a//b" // four-character string literal
2995 #include "//e" // undefined behavior
2996 // */ // comment, not syntax error
2997 f = g/**//h; // equivalent to f = g / h;
2999 i(); // part of a two-line comment
3001 / j(); // part of a two-line comment
3002 #define glue(x,y) x##y
3003 glue(/,/) k(); // syntax error, not comment
3004 /*//*/ l(); // equivalent to l();
3005 m = n//**/o
3006 + p; // equivalent to m = n + p;
3011 71) Thus, /* ... */ comments do not nest.
3013 [<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
3015 <a name="6.5" href="#6.5"><b> 6.5 Expressions</b></a>
3016 1 An expression is a sequence of operators and operands that specifies computation of a
3017 value, or that designates an object or a function, or that generates side effects, or that
3018 performs a combination thereof.
3019 2 Between the previous and next sequence point an object shall have its stored value
3020 modified at most once by the evaluation of an expression.72) Furthermore, the prior value
3021 shall be read only to determine the value to be stored.73)
3022 3 The grouping of operators and operands is indicated by the syntax.74) Except as specified
3023 later (for the function-call (), &amp;&amp;, ||, ?:, and comma operators), the order of evaluation
3024 of subexpressions and the order in which side effects take place are both unspecified.
3025 4 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
3026 collectively described as bitwise operators) are required to have operands that have
3027 integer type. These operators yield values that depend on the internal representations of
3028 integers, and have implementation-defined and undefined aspects for signed types.
3029 5 If an exceptional condition occurs during the evaluation of an expression (that is, if the
3030 result is not mathematically defined or not in the range of representable values for its
3031 type), the behavior is undefined.
3032 6 The effective type of an object for an access to its stored value is the declared type of the
3033 object, if any.75) If a value is stored into an object having no declared type through an
3034 lvalue having a type that is not a character type, then the type of the lvalue becomes the
3037 72) A floating-point status flag is not an object and can be set more than once within an expression.
3038 73) This paragraph renders undefined statement expressions such as
3039 i = ++i + 1;
3040 a[i++] = i;
3041 while allowing
3042 i = i + 1;
3043 a[i] = i;
3045 74) The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
3046 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
3047 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
3048 <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
3049 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
3050 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
3051 the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
3052 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3053 indicated in each subclause by the syntax for the expressions discussed therein.
3054 75) Allocated objects have no declared type.
3056 [<a name="p67" href="#p67">page 67</a>] (<a href="#Contents">Contents</a>)
3058 effective type of the object for that access and for subsequent accesses that do not modify
3059 the stored value. If a value is copied into an object having no declared type using
3060 memcpy or memmove, or is copied as an array of character type, then the effective type
3061 of the modified object for that access and for subsequent accesses that do not modify the
3062 value is the effective type of the object from which the value is copied, if it has one. For
3063 all other accesses to an object having no declared type, the effective type of the object is
3064 simply the type of the lvalue used for the access.
3065 7 An object shall have its stored value accessed only by an lvalue expression that has one of
3066 the following types:76)
3067 -- a type compatible with the effective type of the object,
3068 -- a qualified version of a type compatible with the effective type of the object,
3069 -- a type that is the signed or unsigned type corresponding to the effective type of the
3070 object,
3071 -- a type that is the signed or unsigned type corresponding to a qualified version of the
3072 effective type of the object,
3073 -- an aggregate or union type that includes one of the aforementioned types among its
3074 members (including, recursively, a member of a subaggregate or contained union), or
3075 -- a character type.
3076 8 A floating expression may be contracted, that is, evaluated as though it were an atomic
3077 operation, thereby omitting rounding errors implied by the source code and the
3078 expression evaluation method.77) The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
3079 way to disallow contracted expressions. Otherwise, whether and how expressions are
3080 contracted is implementation-defined.78)
3081 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.21.2">7.21.2</a>).
3086 76) The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3087 77) A contracted expression might also omit the raising of floating-point exceptions.
3088 78) This license is specifically intended to allow implementations to exploit fast machine instructions that
3089 combine multiple C operators. As contractions potentially undermine predictability, and can even
3090 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3091 documented.
3093 [<a name="p68" href="#p68">page 68</a>] (<a href="#Contents">Contents</a>)
3095 <a name="6.5.1" href="#6.5.1"><b> 6.5.1 Primary expressions</b></a>
3096 Syntax
3097 1 primary-expression:
3098 identifier
3099 constant
3100 string-literal
3101 ( expression )
3102 Semantics
3103 2 An identifier is a primary expression, provided it has been declared as designating an
3104 object (in which case it is an lvalue) or a function (in which case it is a function
3105 designator).79)
3106 3 A constant is a primary expression. Its type depends on its form and value, as detailed in
3107 <a name="6.4.4" href="#6.4.4"><b> 6.4.4.</b></a>
3108 4 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>.
3109 5 A parenthesized expression is a primary expression. Its type and value are identical to
3110 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3111 expression if the unparenthesized expression is, respectively, an lvalue, a function
3112 designator, or a void expression.
3113 Forward references: declarations (<a href="#6.7">6.7</a>).
3114 <a name="6.5.2" href="#6.5.2"><b> 6.5.2 Postfix operators</b></a>
3115 Syntax
3116 1 postfix-expression:
3117 primary-expression
3118 postfix-expression [ expression ]
3119 postfix-expression ( argument-expression-listopt )
3120 postfix-expression . identifier
3121 postfix-expression -&gt; identifier
3122 postfix-expression ++
3123 postfix-expression --
3124 ( type-name ) { initializer-list }
3125 ( type-name ) { initializer-list , }
3130 79) Thus, an undeclared identifier is a violation of the syntax.
3132 [<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
3134 argument-expression-list:
3135 assignment-expression
3136 argument-expression-list , assignment-expression
3137 <a name="6.5.2.1" href="#6.5.2.1"><b> 6.5.2.1 Array subscripting</b></a>
3138 Constraints
3139 1 One of the expressions shall have type ''pointer to object type'', the other expression shall
3140 have integer type, and the result has type ''type''.
3141 Semantics
3142 2 A postfix expression followed by an expression in square brackets [] is a subscripted
3143 designation of an element of an array object. The definition of the subscript operator []
3144 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3145 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3146 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3147 element of E1 (counting from zero).
3148 3 Successive subscript operators designate an element of a multidimensional array object.
3149 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
3150 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3151 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3152 implicitly as a result of subscripting, the result is the pointed-to (n - 1)-dimensional array,
3153 which itself is converted into a pointer if used as other than an lvalue. It follows from this
3154 that arrays are stored in row-major order (last subscript varies fastest).
3155 4 EXAMPLE Consider the array object defined by the declaration
3156 int x[3][5];
3157 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
3158 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3159 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3160 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
3161 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
3162 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
3163 yields an int.
3165 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
3166 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
3171 [<a name="p70" href="#p70">page 70</a>] (<a href="#Contents">Contents</a>)
3173 <a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
3174 Constraints
3175 1 The expression that denotes the called function80) shall have type pointer to function
3176 returning void or returning an object type other than an array type.
3177 2 If the expression that denotes the called function has a type that includes a prototype, the
3178 number of arguments shall agree with the number of parameters. Each argument shall
3179 have a type such that its value may be assigned to an object with the unqualified version
3180 of the type of its corresponding parameter.
3181 Semantics
3182 3 A postfix expression followed by parentheses () containing a possibly empty, comma-
3183 separated list of expressions is a function call. The postfix expression denotes the called
3184 function. The list of expressions specifies the arguments to the function.
3185 4 An argument may be an expression of any object type. In preparing for the call to a
3186 function, the arguments are evaluated, and each parameter is assigned the value of the
3187 corresponding argument.81)
3188 5 If the expression that denotes the called function has type pointer to function returning an
3189 object type, the function call expression has the same type as that object type, and has the
3190 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. If
3191 an attempt is made to modify the result of a function call or to access it after the next
3192 sequence point, the behavior is undefined.
3193 6 If the expression that denotes the called function has a type that does not include a
3194 prototype, the integer promotions are performed on each argument, and arguments that
3195 have type float are promoted to double. These are called the default argument
3196 promotions. If the number of arguments does not equal the number of parameters, the
3197 behavior is undefined. If the function is defined with a type that includes a prototype, and
3198 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
3199 promotion are not compatible with the types of the parameters, the behavior is undefined.
3200 If the function is defined with a type that does not include a prototype, and the types of
3201 the arguments after promotion are not compatible with those of the parameters after
3202 promotion, the behavior is undefined, except for the following cases:
3207 80) Most often, this is the result of converting an identifier that is a function designator.
3208 81) A function may change the values of its parameters, but these changes cannot affect the values of the
3209 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
3210 change the value of the object pointed to. A parameter declared to have array or function type is
3211 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
3213 [<a name="p71" href="#p71">page 71</a>] (<a href="#Contents">Contents</a>)
3215 -- one promoted type is a signed integer type, the other promoted type is the
3216 corresponding unsigned integer type, and the value is representable in both types;
3217 -- both types are pointers to qualified or unqualified versions of a character type or
3218 void.
3219 7 If the expression that denotes the called function has a type that does include a prototype,
3220 the arguments are implicitly converted, as if by assignment, to the types of the
3221 corresponding parameters, taking the type of each parameter to be the unqualified version
3222 of its declared type. The ellipsis notation in a function prototype declarator causes
3223 argument type conversion to stop after the last declared parameter. The default argument
3224 promotions are performed on trailing arguments.
3225 8 No other conversions are performed implicitly; in particular, the number and types of
3226 arguments are not compared with those of the parameters in a function definition that
3227 does not include a function prototype declarator.
3228 9 If the function is defined with a type that is not compatible with the type (of the
3229 expression) pointed to by the expression that denotes the called function, the behavior is
3230 undefined.
3231 10 The order of evaluation of the function designator, the actual arguments, and
3232 subexpressions within the actual arguments is unspecified, but there is a sequence point
3233 before the actual call.
3234 11 Recursive function calls shall be permitted, both directly and indirectly through any chain
3235 of other functions.
3236 12 EXAMPLE In the function call
3237 (*pf[f1()]) (f2(), f3() + f4())
3238 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
3239 the function pointed to by pf[f1()] is called.
3241 Forward references: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
3242 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>).
3243 <a name="6.5.2.3" href="#6.5.2.3"><b> 6.5.2.3 Structure and union members</b></a>
3244 Constraints
3245 1 The first operand of the . operator shall have a qualified or unqualified structure or union
3246 type, and the second operand shall name a member of that type.
3247 2 The first operand of the -&gt; operator shall have type ''pointer to qualified or unqualified
3248 structure'' or ''pointer to qualified or unqualified union'', and the second operand shall
3249 name a member of the type pointed to.
3254 [<a name="p72" href="#p72">page 72</a>] (<a href="#Contents">Contents</a>)
3256 Semantics
3257 3 A postfix expression followed by the . operator and an identifier designates a member of
3258 a structure or union object. The value is that of the named member,82) and is an lvalue if
3259 the first expression is an lvalue. If the first expression has qualified type, the result has
3260 the so-qualified version of the type of the designated member.
3261 4 A postfix expression followed by the -&gt; operator and an identifier designates a member
3262 of a structure or union object. The value is that of the named member of the object to
3263 which the first expression points, and is an lvalue.83) If the first expression is a pointer to
3264 a qualified type, the result has the so-qualified version of the type of the designated
3265 member.
3266 5 One special guarantee is made in order to simplify the use of unions: if a union contains
3267 several structures that share a common initial sequence (see below), and if the union
3268 object currently contains one of these structures, it is permitted to inspect the common
3269 initial part of any of them anywhere that a declaration of the complete type of the union is
3270 visible. Two structures share a common initial sequence if corresponding members have
3271 compatible types (and, for bit-fields, the same widths) for a sequence of one or more
3272 initial members.
3273 6 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
3274 union, f().x is a valid postfix expression but is not an lvalue.
3276 7 EXAMPLE 2 In:
3277 struct s { int i; const int ci; };
3278 struct s s;
3279 const struct s cs;
3280 volatile struct s vs;
3281 the various members have the types:
3282 s.i int
3283 s.ci const int
3284 cs.i const int
3285 cs.ci const int
3286 vs.i volatile int
3287 vs.ci volatile const int
3292 82) If the member used to access the contents of a union object is not the same as the member last used to
3293 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
3294 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
3295 punning"). This might be a trap representation.
3296 83) If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
3297 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
3299 [<a name="p73" href="#p73">page 73</a>] (<a href="#Contents">Contents</a>)
3301 8 EXAMPLE 3 The following is a valid fragment:
3302 union {
3303 struct {
3304 int alltypes;
3305 } n;
3306 struct {
3307 int type;
3308 int intnode;
3309 } ni;
3310 struct {
3311 int type;
3312 double doublenode;
3313 } nf;
3314 } u;
3315 u.nf.type = 1;
3316 u.nf.doublenode = <a href="#3.14">3.14</a>;
3317 /* ... */
3318 if (u.n.alltypes == 1)
3319 if (sin(u.nf.doublenode) == 0.0)
3320 /* ... */
3321 The following is not a valid fragment (because the union type is not visible within function f):
3322 struct t1 { int m; };
3323 struct t2 { int m; };
3324 int f(struct t1 *p1, struct t2 *p2)
3326 if (p1-&gt;m &lt; 0)
3327 p2-&gt;m = -p2-&gt;m;
3328 return p1-&gt;m;
3330 int g()
3332 union {
3333 struct t1 s1;
3334 struct t2 s2;
3335 } u;
3336 /* ... */
3337 return f(&amp;u.s1, &amp;u.s2);
3340 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
3341 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
3346 [<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
3348 <a name="6.5.2.4" href="#6.5.2.4"><b> 6.5.2.4 Postfix increment and decrement operators</b></a>
3349 Constraints
3350 1 The operand of the postfix increment or decrement operator shall have qualified or
3351 unqualified real or pointer type and shall be a modifiable lvalue.
3352 Semantics
3353 2 The result of the postfix ++ operator is the value of the operand. After the result is
3354 obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
3355 type is added to it.) See the discussions of additive operators and compound assignment
3356 for information on constraints, types, and conversions and the effects of operations on
3357 pointers. The side effect of updating the stored value of the operand shall occur between
3358 the previous and the next sequence point.
3359 3 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
3360 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
3361 it).
3362 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
3363 <a name="6.5.2.5" href="#6.5.2.5"><b> 6.5.2.5 Compound literals</b></a>
3364 Constraints
3365 1 The type name shall specify an object type or an array of unknown size, but not a variable
3366 length array type.
3367 2 No initializer shall attempt to provide a value for an object not contained within the entire
3368 unnamed object specified by the compound literal.
3369 3 If the compound literal occurs outside the body of a function, the initializer list shall
3370 consist of constant expressions.
3371 Semantics
3372 4 A postfix expression that consists of a parenthesized type name followed by a brace-
3373 enclosed list of initializers is a compound literal. It provides an unnamed object whose
3374 value is given by the initializer list.84)
3375 5 If the type name specifies an array of unknown size, the size is determined by the
3376 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
3377 completed array type. Otherwise (when the type name specifies an object type), the type
3378 of the compound literal is that specified by the type name. In either case, the result is an
3379 lvalue.
3382 84) Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
3383 or void only, and the result of a cast expression is not an lvalue.
3385 [<a name="p75" href="#p75">page 75</a>] (<a href="#Contents">Contents</a>)
3387 6 The value of the compound literal is that of an unnamed object initialized by the
3388 initializer list. If the compound literal occurs outside the body of a function, the object
3389 has static storage duration; otherwise, it has automatic storage duration associated with
3390 the enclosing block.
3391 7 All the semantic rules and constraints for initializer lists in <a href="#6.7.8">6.7.8</a> are applicable to
3392 compound literals.85)
3393 8 String literals, and compound literals with const-qualified types, need not designate
3394 distinct objects.86)
3395 9 EXAMPLE 1 The file scope definition
3396 int *p = (int []){2, 4};
3397 initializes p to point to the first element of an array of two ints, the first having the value two and the
3398 second, four. The expressions in this compound literal are required to be constant. The unnamed object
3399 has static storage duration.
3401 10 EXAMPLE 2 In contrast, in
3402 void f(void)
3404 int *p;
3405 /*...*/
3406 p = (int [2]){*p};
3407 /*...*/
3409 p is assigned the address of the first element of an array of two ints, the first having the value previously
3410 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
3411 unnamed object has automatic storage duration.
3413 11 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
3414 created using compound literals can be passed to functions without depending on member order:
3415 drawline((struct point){.x=1, .y=1},
3416 (struct point){.x=3, .y=4});
3417 Or, if drawline instead expected pointers to struct point:
3418 drawline(&amp;(struct point){.x=1, .y=1},
3419 &amp;(struct point){.x=3, .y=4});
3421 12 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
3422 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
3427 85) For example, subobjects without explicit initializers are initialized to zero.
3428 86) This allows implementations to share storage for string literals and constant compound literals with
3429 the same or overlapping representations.
3431 [<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
3433 13 EXAMPLE 5 The following three expressions have different meanings:
3434 "/tmp/fileXXXXXX"
3435 (char []){"/tmp/fileXXXXXX"}
3436 (const char []){"/tmp/fileXXXXXX"}
3437 The first always has static storage duration and has type array of char, but need not be modifiable; the last
3438 two have automatic storage duration when they occur within the body of a function, and the first of these
3439 two is modifiable.
3441 14 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
3442 and can even be shared. For example,
3443 (const char []){"abc"} == "abc"
3444 might yield 1 if the literals' storage is shared.
3446 15 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
3447 linked object. For example, there is no way to write a self-referential compound literal that could be used
3448 as the function argument in place of the named object endless_zeros below:
3449 struct int_list { int car; struct int_list *cdr; };
3450 struct int_list endless_zeros = {0, &amp;endless_zeros};
3451 eval(endless_zeros);
3453 16 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
3454 struct s { int i; };
3455 int f (void)
3457 struct s *p = 0, *q;
3458 int j = 0;
3459 again:
3460 q = p, p = &amp;((struct s){ j++ });
3461 if (j &lt; 2) goto again;
3462 return p == q &amp;&amp; q-&gt;i == 1;
3464 The function f() always returns the value 1.
3465 17 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
3466 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
3467 have an indeterminate value, which would result in undefined behavior.
3469 Forward references: type names (<a href="#6.7.6">6.7.6</a>), initialization (<a href="#6.7.8">6.7.8</a>).
3474 [<a name="p77" href="#p77">page 77</a>] (<a href="#Contents">Contents</a>)
3476 <a name="6.5.3" href="#6.5.3"><b> 6.5.3 Unary operators</b></a>
3477 Syntax
3478 1 unary-expression:
3479 postfix-expression
3480 ++ unary-expression
3481 -- unary-expression
3482 unary-operator cast-expression
3483 sizeof unary-expression
3484 sizeof ( type-name )
3485 unary-operator: one of
3486 &amp; * + - ~ !
3487 <a name="6.5.3.1" href="#6.5.3.1"><b> 6.5.3.1 Prefix increment and decrement operators</b></a>
3488 Constraints
3489 1 The operand of the prefix increment or decrement operator shall have qualified or
3490 unqualified real or pointer type and shall be a modifiable lvalue.
3491 Semantics
3492 2 The value of the operand of the prefix ++ operator is incremented. The result is the new
3493 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
3494 See the discussions of additive operators and compound assignment for information on
3495 constraints, types, side effects, and conversions and the effects of operations on pointers.
3496 3 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
3497 operand is decremented.
3498 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), compound assignment (<a href="#6.5.16.2">6.5.16.2</a>).
3499 <a name="6.5.3.2" href="#6.5.3.2"><b> 6.5.3.2 Address and indirection operators</b></a>
3500 Constraints
3501 1 The operand of the unary &amp; operator shall be either a function designator, the result of a
3502 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
3503 not declared with the register storage-class specifier.
3504 2 The operand of the unary * operator shall have pointer type.
3505 Semantics
3506 3 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
3507 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
3508 neither that operator nor the &amp; operator is evaluated and the result is as if both were
3509 omitted, except that the constraints on the operators still apply and the result is not an
3510 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
3512 [<a name="p78" href="#p78">page 78</a>] (<a href="#Contents">Contents</a>)
3514 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
3515 were removed and the [] operator were changed to a + operator. Otherwise, the result is
3516 a pointer to the object or function designated by its operand.
3517 4 The unary * operator denotes indirection. If the operand points to a function, the result is
3518 a function designator; if it points to an object, the result is an lvalue designating the
3519 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
3520 invalid value has been assigned to the pointer, the behavior of the unary * operator is
3521 undefined.87)
3522 Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
3523 (<a href="#6.7.2.1">6.7.2.1</a>).
3524 <a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
3525 Constraints
3526 1 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
3527 integer type; of the ! operator, scalar type.
3528 Semantics
3529 2 The result of the unary + operator is the value of its (promoted) operand. The integer
3530 promotions are performed on the operand, and the result has the promoted type.
3531 3 The result of the unary - operator is the negative of its (promoted) operand. The integer
3532 promotions are performed on the operand, and the result has the promoted type.
3533 4 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
3534 each bit in the result is set if and only if the corresponding bit in the converted operand is
3535 not set). The integer promotions are performed on the operand, and the result has the
3536 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
3537 to the maximum value representable in that type minus E.
3538 5 The result of the logical negation operator ! is 0 if the value of its operand compares
3539 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
3540 The expression !E is equivalent to (0==E).
3545 87) Thus, &amp;*E is equivalent to E (even if E is a null pointer), and &amp;(E1[E2]) to ((E1)+(E2)). It is
3546 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
3547 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
3548 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
3549 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
3550 address inappropriately aligned for the type of object pointed to, and the address of an object after the
3551 end of its lifetime.
3553 [<a name="p79" href="#p79">page 79</a>] (<a href="#Contents">Contents</a>)
3555 <a name="6.5.3.4" href="#6.5.3.4"><b> 6.5.3.4 The sizeof operator</b></a>
3556 Constraints
3557 1 The sizeof operator shall not be applied to an expression that has function type or an
3558 incomplete type, to the parenthesized name of such a type, or to an expression that
3559 designates a bit-field member.
3560 Semantics
3561 2 The sizeof operator yields the size (in bytes) of its operand, which may be an
3562 expression or the parenthesized name of a type. The size is determined from the type of
3563 the operand. The result is an integer. If the type of the operand is a variable length array
3564 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
3565 integer constant.
3566 3 When applied to an operand that has type char, unsigned char, or signed char,
3567 (or a qualified version thereof) the result is 1. When applied to an operand that has array
3568 type, the result is the total number of bytes in the array.88) When applied to an operand
3569 that has structure or union type, the result is the total number of bytes in such an object,
3570 including internal and trailing padding.
3571 4 The value of the result is implementation-defined, and its type (an unsigned integer type)
3572 is size_t, defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers).
3573 5 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
3574 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
3575 allocate and return a pointer to void. For example:
3576 extern void *alloc(size_t);
3577 double *dp = alloc(sizeof *dp);
3578 The implementation of the alloc function should ensure that its return value is aligned suitably for
3579 conversion to a pointer to double.
3581 6 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
3582 sizeof array / sizeof array[0]
3584 7 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
3585 function:
3586 #include <a href="#7.17">&lt;stddef.h&gt;</a>
3587 size_t fsize3(int n)
3589 char b[n+3]; // variable length array
3590 return sizeof b; // execution time sizeof
3595 88) When applied to a parameter declared to have array or function type, the sizeof operator yields the
3596 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
3598 [<a name="p80" href="#p80">page 80</a>] (<a href="#Contents">Contents</a>)
3600 int main()
3602 size_t size;
3603 size = fsize3(10); // fsize3 returns 13
3604 return 0;
3607 Forward references: 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>),
3608 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>).
3609 <a name="6.5.4" href="#6.5.4"><b> 6.5.4 Cast operators</b></a>
3610 Syntax
3611 1 cast-expression:
3612 unary-expression
3613 ( type-name ) cast-expression
3614 Constraints
3615 2 Unless the type name specifies a void type, the type name shall specify qualified or
3616 unqualified scalar type and the operand shall have scalar type.
3617 3 Conversions that involve pointers, other than where permitted by the constraints of
3618 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
3619 Semantics
3620 4 Preceding an expression by a parenthesized type name converts the value of the
3621 expression to the named type. This construction is called a cast.89) A cast that specifies
3622 no conversion has no effect on the type or value of an expression.
3623 5 If the value of the expression is represented with greater precision or range than required
3624 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
3625 type of the expression is the same as the named type.
3626 Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
3627 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>).
3632 89) A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
3633 unqualified version of the type.
3635 [<a name="p81" href="#p81">page 81</a>] (<a href="#Contents">Contents</a>)
3637 <a name="6.5.5" href="#6.5.5"><b> 6.5.5 Multiplicative operators</b></a>
3638 Syntax
3639 1 multiplicative-expression:
3640 cast-expression
3641 multiplicative-expression * cast-expression
3642 multiplicative-expression / cast-expression
3643 multiplicative-expression % cast-expression
3644 Constraints
3645 2 Each of the operands shall have arithmetic type. The operands of the % operator shall
3646 have integer type.
3647 Semantics
3648 3 The usual arithmetic conversions are performed on the operands.
3649 4 The result of the binary * operator is the product of the operands.
3650 5 The result of the / operator is the quotient from the division of the first operand by the
3651 second; the result of the % operator is the remainder. In both operations, if the value of
3652 the second operand is zero, the behavior is undefined.
3653 6 When integers are divided, the result of the / operator is the algebraic quotient with any
3654 fractional part discarded.90) If the quotient a/b is representable, the expression
3655 (a/b)*b + a%b shall equal a.
3656 <a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
3657 Syntax
3658 1 additive-expression:
3659 multiplicative-expression
3660 additive-expression + multiplicative-expression
3661 additive-expression - multiplicative-expression
3662 Constraints
3663 2 For addition, either both operands shall have arithmetic type, or one operand shall be a
3664 pointer to an object type and the other shall have integer type. (Incrementing is
3665 equivalent to adding 1.)
3666 3 For subtraction, one of the following shall hold:
3667 -- both operands have arithmetic type;
3671 90) This is often called ''truncation toward zero''.
3673 [<a name="p82" href="#p82">page 82</a>] (<a href="#Contents">Contents</a>)
3675 -- both operands are pointers to qualified or unqualified versions of compatible object
3676 types; or
3677 -- the left operand is a pointer to an object type and the right operand has integer type.
3678 (Decrementing is equivalent to subtracting 1.)
3679 Semantics
3680 4 If both operands have arithmetic type, the usual arithmetic conversions are performed on
3681 them.
3682 5 The result of the binary + operator is the sum of the operands.
3683 6 The result of the binary - operator is the difference resulting from the subtraction of the
3684 second operand from the first.
3685 7 For the purposes of these operators, a pointer to an object that is not an element of an
3686 array behaves the same as a pointer to the first element of an array of length one with the
3687 type of the object as its element type.
3688 8 When an expression that has integer type is added to or subtracted from a pointer, the
3689 result has the type of the pointer operand. If the pointer operand points to an element of
3690 an array object, and the array is large enough, the result points to an element offset from
3691 the original element such that the difference of the subscripts of the resulting and original
3692 array elements equals the integer expression. In other words, if the expression P points to
3693 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
3694 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
3695 the array object, provided they exist. Moreover, if the expression P points to the last
3696 element of an array object, the expression (P)+1 points one past the last element of the
3697 array object, and if the expression Q points one past the last element of an array object,
3698 the expression (Q)-1 points to the last element of the array object. If both the pointer
3699 operand and the result point to elements of the same array object, or one past the last
3700 element of the array object, the evaluation shall not produce an overflow; otherwise, the
3701 behavior is undefined. If the result points one past the last element of the array object, it
3702 shall not be used as the operand of a unary * operator that is evaluated.
3703 9 When two pointers are subtracted, both shall point to elements of the same array object,
3704 or one past the last element of the array object; the result is the difference of the
3705 subscripts of the two array elements. The size of the result is implementation-defined,
3706 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.17">&lt;stddef.h&gt;</a> header.
3707 If the result is not representable in an object of that type, the behavior is undefined. In
3708 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
3709 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
3710 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
3711 an array object or one past the last element of an array object, and the expression Q points
3712 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
3713 [<a name="p83" href="#p83">page 83</a>] (<a href="#Contents">Contents</a>)
3715 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
3716 expression P points one past the last element of the array object, even though the
3717 expression (Q)+1 does not point to an element of the array object.91)
3718 10 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
3720 int n = 4, m = 3;
3721 int a[n][m];
3722 int (*p)[m] = a; // p == &amp;a[0]
3723 p += 1; // p == &amp;a[1]
3724 (*p)[2] = 99; // a[1][2] == 99
3725 n = p - a; // n == 1
3727 11 If array a in the above example were declared to be an array of known constant size, and pointer p were
3728 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
3729 the same.
3731 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), common definitions <a href="#7.17">&lt;stddef.h&gt;</a>
3732 (<a href="#7.17">7.17</a>).
3733 <a name="6.5.7" href="#6.5.7"><b> 6.5.7 Bitwise shift operators</b></a>
3734 Syntax
3735 1 shift-expression:
3736 additive-expression
3737 shift-expression &lt;&lt; additive-expression
3738 shift-expression &gt;&gt; additive-expression
3739 Constraints
3740 2 Each of the operands shall have integer type.
3741 Semantics
3742 3 The integer promotions are performed on each of the operands. The type of the result is
3743 that of the promoted left operand. If the value of the right operand is negative or is
3744 greater than or equal to the width of the promoted left operand, the behavior is undefined.
3749 91) Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
3750 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
3751 by the size of the object originally pointed to, and the resulting pointer is converted back to the
3752 original type. For pointer subtraction, the result of the difference between the character pointers is
3753 similarly divided by the size of the object originally pointed to.
3754 When viewed in this way, an implementation need only provide one extra byte (which may overlap
3755 another object in the program) just after the end of the object in order to satisfy the ''one past the last
3756 element'' requirements.
3758 [<a name="p84" href="#p84">page 84</a>] (<a href="#Contents">Contents</a>)
3760 4 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
3761 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
3762 one more than the maximum value representable in the result type. If E1 has a signed
3763 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
3764 the resulting value; otherwise, the behavior is undefined.
3765 5 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
3766 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
3767 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
3768 resulting value is implementation-defined.
3769 <a name="6.5.8" href="#6.5.8"><b> 6.5.8 Relational operators</b></a>
3770 Syntax
3771 1 relational-expression:
3772 shift-expression
3773 relational-expression &lt; shift-expression
3774 relational-expression &gt; shift-expression
3775 relational-expression &lt;= shift-expression
3776 relational-expression &gt;= shift-expression
3777 Constraints
3778 2 One of the following shall hold:
3779 -- both operands have real type;
3780 -- both operands are pointers to qualified or unqualified versions of compatible object
3781 types; or
3782 -- both operands are pointers to qualified or unqualified versions of compatible
3783 incomplete types.
3784 Semantics
3785 3 If both of the operands have arithmetic type, the usual arithmetic conversions are
3786 performed.
3787 4 For the purposes of these operators, a pointer to an object that is not an element of an
3788 array behaves the same as a pointer to the first element of an array of length one with the
3789 type of the object as its element type.
3790 5 When two pointers are compared, the result depends on the relative locations in the
3791 address space of the objects pointed to. If two pointers to object or incomplete types both
3792 point to the same object, or both point one past the last element of the same array object,
3793 they compare equal. If the objects pointed to are members of the same aggregate object,
3794 pointers to structure members declared later compare greater than pointers to members
3795 declared earlier in the structure, and pointers to array elements with larger subscript
3797 [<a name="p85" href="#p85">page 85</a>] (<a href="#Contents">Contents</a>)
3799 values compare greater than pointers to elements of the same array with lower subscript
3800 values. All pointers to members of the same union object compare equal. If the
3801 expression P points to an element of an array object and the expression Q points to the
3802 last element of the same array object, the pointer expression Q+1 compares greater than
3803 P. In all other cases, the behavior is undefined.
3804 6 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
3805 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.92)
3806 The result has type int.
3807 <a name="6.5.9" href="#6.5.9"><b> 6.5.9 Equality operators</b></a>
3808 Syntax
3809 1 equality-expression:
3810 relational-expression
3811 equality-expression == relational-expression
3812 equality-expression != relational-expression
3813 Constraints
3814 2 One of the following shall hold:
3815 -- both operands have arithmetic type;
3816 -- both operands are pointers to qualified or unqualified versions of compatible types;
3817 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
3818 qualified or unqualified version of void; or
3819 -- one operand is a pointer and the other is a null pointer constant.
3820 Semantics
3821 3 The == (equal to) and != (not equal to) operators are analogous to the relational
3822 operators except for their lower precedence.93) Each of the operators yields 1 if the
3823 specified relation is true and 0 if it is false. The result has type int. For any pair of
3824 operands, exactly one of the relations is true.
3825 4 If both of the operands have arithmetic type, the usual arithmetic conversions are
3826 performed. Values of complex types are equal if and only if both their real parts are equal
3827 and also their imaginary parts are equal. Any two values of arithmetic types from
3828 different type domains are equal if and only if the results of their conversions to the
3829 (complex) result type determined by the usual arithmetic conversions are equal.
3832 92) The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
3833 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
3834 93) 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.
3836 [<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
3838 5 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
3839 null pointer constant, the null pointer constant is converted to the type of the pointer. If
3840 one operand is a pointer to an object or incomplete type and the other is a pointer to a
3841 qualified or unqualified version of void, the former is converted to the type of the latter.
3842 6 Two pointers compare equal if and only if both are null pointers, both are pointers to the
3843 same object (including a pointer to an object and a subobject at its beginning) or function,
3844 both are pointers to one past the last element of the same array object, or one is a pointer
3845 to one past the end of one array object and the other is a pointer to the start of a different
3846 array object that happens to immediately follow the first array object in the address
3847 space.94)
3848 7 For the purposes of these operators, a pointer to an object that is not an element of an
3849 array behaves the same as a pointer to the first element of an array of length one with the
3850 type of the object as its element type.
3851 <a name="6.5.10" href="#6.5.10"><b> 6.5.10 Bitwise AND operator</b></a>
3852 Syntax
3853 1 AND-expression:
3854 equality-expression
3855 AND-expression &amp; equality-expression
3856 Constraints
3857 2 Each of the operands shall have integer type.
3858 Semantics
3859 3 The usual arithmetic conversions are performed on the operands.
3860 4 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
3861 the result is set if and only if each of the corresponding bits in the converted operands is
3862 set).
3867 94) Two objects may be adjacent in memory because they are adjacent elements of a larger array or
3868 adjacent members of a structure with no padding between them, or because the implementation chose
3869 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
3870 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
3871 behavior.
3873 [<a name="p87" href="#p87">page 87</a>] (<a href="#Contents">Contents</a>)
3875 <a name="6.5.11" href="#6.5.11"><b> 6.5.11 Bitwise exclusive OR operator</b></a>
3876 Syntax
3877 1 exclusive-OR-expression:
3878 AND-expression
3879 exclusive-OR-expression ^ AND-expression
3880 Constraints
3881 2 Each of the operands shall have integer type.
3882 Semantics
3883 3 The usual arithmetic conversions are performed on the operands.
3884 4 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
3885 in the result is set if and only if exactly one of the corresponding bits in the converted
3886 operands is set).
3887 <a name="6.5.12" href="#6.5.12"><b> 6.5.12 Bitwise inclusive OR operator</b></a>
3888 Syntax
3889 1 inclusive-OR-expression:
3890 exclusive-OR-expression
3891 inclusive-OR-expression | exclusive-OR-expression
3892 Constraints
3893 2 Each of the operands shall have integer type.
3894 Semantics
3895 3 The usual arithmetic conversions are performed on the operands.
3896 4 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
3897 the result is set if and only if at least one of the corresponding bits in the converted
3898 operands is set).
3903 [<a name="p88" href="#p88">page 88</a>] (<a href="#Contents">Contents</a>)
3905 <a name="6.5.13" href="#6.5.13"><b> 6.5.13 Logical AND operator</b></a>
3906 Syntax
3907 1 logical-AND-expression:
3908 inclusive-OR-expression
3909 logical-AND-expression &amp;&amp; inclusive-OR-expression
3910 Constraints
3911 2 Each of the operands shall have scalar type.
3912 Semantics
3913 3 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
3914 yields 0. The result has type int.
3915 4 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
3916 there is a sequence point after the evaluation of the first operand. If the first operand
3917 compares equal to 0, the second operand is not evaluated.
3918 <a name="6.5.14" href="#6.5.14"><b> 6.5.14 Logical OR operator</b></a>
3919 Syntax
3920 1 logical-OR-expression:
3921 logical-AND-expression
3922 logical-OR-expression || logical-AND-expression
3923 Constraints
3924 2 Each of the operands shall have scalar type.
3925 Semantics
3926 3 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
3927 yields 0. The result has type int.
3928 4 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
3929 a sequence point after the evaluation of the first operand. If the first operand compares
3930 unequal to 0, the second operand is not evaluated.
3935 [<a name="p89" href="#p89">page 89</a>] (<a href="#Contents">Contents</a>)
3937 <a name="6.5.15" href="#6.5.15"><b> 6.5.15 Conditional operator</b></a>
3938 Syntax
3939 1 conditional-expression:
3940 logical-OR-expression
3941 logical-OR-expression ? expression : conditional-expression
3942 Constraints
3943 2 The first operand shall have scalar type.
3944 3 One of the following shall hold for the second and third operands:
3945 -- both operands have arithmetic type;
3946 -- both operands have the same structure or union type;
3947 -- both operands have void type;
3948 -- both operands are pointers to qualified or unqualified versions of compatible types;
3949 -- one operand is a pointer and the other is a null pointer constant; or
3950 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
3951 qualified or unqualified version of void.
3952 Semantics
3953 4 The first operand is evaluated; there is a sequence point after its evaluation. The second
3954 operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
3955 only if the first compares equal to 0; the result is the value of the second or third operand
3956 (whichever is evaluated), converted to the type described below.95) If an attempt is made
3957 to modify the result of a conditional operator or to access it after the next sequence point,
3958 the behavior is undefined.
3959 5 If both the second and third operands have arithmetic type, the result type that would be
3960 determined by the usual arithmetic conversions, were they applied to those two operands,
3961 is the type of the result. If both the operands have structure or union type, the result has
3962 that type. If both operands have void type, the result has void type.
3963 6 If both the second and third operands are pointers or one is a null pointer constant and the
3964 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
3965 of the types pointed-to by both operands. Furthermore, if both operands are pointers to
3966 compatible types or to differently qualified versions of compatible types, the result type is
3967 a pointer to an appropriately qualified version of the composite type; if one operand is a
3968 null pointer constant, the result has the type of the other operand; otherwise, one operand
3969 is a pointer to void or a qualified version of void, in which case the result type is a
3971 95) A conditional expression does not yield an lvalue.
3973 [<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
3975 pointer to an appropriately qualified version of void.
3976 7 EXAMPLE The common type that results when the second and third operands are pointers is determined
3977 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
3978 pointers have compatible types.
3979 8 Given the declarations
3980 const void *c_vp;
3981 void *vp;
3982 const int *c_ip;
3983 volatile int *v_ip;
3984 int *ip;
3985 const char *c_cp;
3986 the third column in the following table is the common type that is the result of a conditional expression in
3987 which the first two columns are the second and third operands (in either order):
3988 c_vp c_ip const void *
3989 v_ip 0 volatile int *
3990 c_ip v_ip const volatile int *
3991 vp c_cp const void *
3992 ip c_ip const int *
3993 vp ip void *
3995 <a name="6.5.16" href="#6.5.16"><b> 6.5.16 Assignment operators</b></a>
3996 Syntax
3997 1 assignment-expression:
3998 conditional-expression
3999 unary-expression assignment-operator assignment-expression
4000 assignment-operator: one of
4001 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
4002 Constraints
4003 2 An assignment operator shall have a modifiable lvalue as its left operand.
4004 Semantics
4005 3 An assignment operator stores a value in the object designated by the left operand. An
4006 assignment expression has the value of the left operand after the assignment, but is not an
4007 lvalue. The type of an assignment expression is the type of the left operand unless the
4008 left operand has qualified type, in which case it is the unqualified version of the type of
4009 the left operand. The side effect of updating the stored value of the left operand shall
4010 occur between the previous and the next sequence point.
4011 4 The order of evaluation of the operands is unspecified. If an attempt is made to modify
4012 the result of an assignment operator or to access it after the next sequence point, the
4013 behavior is undefined.
4016 [<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
4018 <a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
4019 Constraints
4020 1 One of the following shall hold:96)
4021 -- the left operand has qualified or unqualified arithmetic type and the right has
4022 arithmetic type;
4023 -- the left operand has a qualified or unqualified version of a structure or union type
4024 compatible with the type of the right;
4025 -- both operands are pointers to qualified or unqualified versions of compatible types,
4026 and the type pointed to by the left has all the qualifiers of the type pointed to by the
4027 right;
4028 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
4029 qualified or unqualified version of void, and the type pointed to by the left has all
4030 the qualifiers of the type pointed to by the right;
4031 -- the left operand is a pointer and the right is a null pointer constant; or
4032 -- the left operand has type _Bool and the right is a pointer.
4033 Semantics
4034 2 In simple assignment (=), the value of the right operand is converted to the type of the
4035 assignment expression and replaces the value stored in the object designated by the left
4036 operand.
4037 3 If the value being stored in an object is read from another object that overlaps in any way
4038 the storage of the first object, then the overlap shall be exact and the two objects shall
4039 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
4040 undefined.
4041 4 EXAMPLE 1 In the program fragment
4042 int f(void);
4043 char c;
4044 /* ... */
4045 if ((c = f()) == -1)
4046 /* ... */
4047 the int value returned by the function may be truncated when stored in the char, and then converted back
4048 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
4049 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
4053 96) The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
4054 (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
4055 qualifiers that were applied to the type category of the expression (for example, it removes const but
4056 not volatile from the type int volatile * const).
4058 [<a name="p92" href="#p92">page 92</a>] (<a href="#Contents">Contents</a>)
4060 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
4061 variable c should be declared as int.
4063 5 EXAMPLE 2 In the fragment:
4064 char c;
4065 int i;
4066 long l;
4067 l = (c = i);
4068 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
4069 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
4070 that is, long int type.
4072 6 EXAMPLE 3 Consider the fragment:
4073 const char **cpp;
4074 char *p;
4075 const char c = 'A';
4076 cpp = &amp;p; // constraint violation
4077 *cpp = &amp;c; // valid
4078 *p = 0; // valid
4079 The first assignment is unsafe because it would allow the following valid code to attempt to change the
4080 value of the const object c.
4082 <a name="6.5.16.2" href="#6.5.16.2"><b> 6.5.16.2 Compound assignment</b></a>
4083 Constraints
4084 1 For the operators += and -= only, either the left operand shall be a pointer to an object
4085 type and the right shall have integer type, or the left operand shall have qualified or
4086 unqualified arithmetic type and the right shall have arithmetic type.
4087 2 For the other operators, each operand shall have arithmetic type consistent with those
4088 allowed by the corresponding binary operator.
4089 Semantics
4090 3 A compound assignment of the form E1 op = E2 differs from the simple assignment
4091 expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
4096 [<a name="p93" href="#p93">page 93</a>] (<a href="#Contents">Contents</a>)
4098 <a name="6.5.17" href="#6.5.17"><b> 6.5.17 Comma operator</b></a>
4099 Syntax
4100 1 expression:
4101 assignment-expression
4102 expression , assignment-expression
4103 Semantics
4104 2 The left operand of a comma operator is evaluated as a void expression; there is a
4105 sequence point after its evaluation. Then the right operand is evaluated; the result has its
4106 type and value.97) If an attempt is made to modify the result of a comma operator or to
4107 access it after the next sequence point, the behavior is undefined.
4108 3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
4109 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
4110 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
4111 expression of a conditional operator in such contexts. In the function call
4112 f(a, (t=3, t+2), c)
4113 the function has three arguments, the second of which has the value 5.
4115 Forward references: initialization (<a href="#6.7.8">6.7.8</a>).
4120 97) A comma operator does not yield an lvalue.
4122 [<a name="p94" href="#p94">page 94</a>] (<a href="#Contents">Contents</a>)
4124 <a name="6.6" href="#6.6"><b> 6.6 Constant expressions</b></a>
4125 Syntax
4126 1 constant-expression:
4127 conditional-expression
4128 Description
4129 2 A constant expression can be evaluated during translation rather than runtime, and
4130 accordingly may be used in any place that a constant may be.
4131 Constraints
4132 3 Constant expressions shall not contain assignment, increment, decrement, function-call,
4133 or comma operators, except when they are contained within a subexpression that is not
4134 evaluated.98)
4135 4 Each constant expression shall evaluate to a constant that is in the range of representable
4136 values for its type.
4137 Semantics
4138 5 An expression that evaluates to a constant is required in several contexts. If a floating
4139 expression is evaluated in the translation environment, the arithmetic precision and range
4140 shall be at least as great as if the expression were being evaluated in the execution
4141 environment.
4142 6 An integer constant expression99) shall have integer type and shall only have operands
4143 that are integer constants, enumeration constants, character constants, sizeof
4144 expressions whose results are integer constants, and floating constants that are the
4145 immediate operands of casts. Cast operators in an integer constant expression shall only
4146 convert arithmetic types to integer types, except as part of an operand to the sizeof
4147 operator.
4148 7 More latitude is permitted for constant expressions in initializers. Such a constant
4149 expression shall be, or evaluate to, one of the following:
4150 -- an arithmetic constant expression,
4151 -- a null pointer constant,
4156 98) The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
4157 99) An integer constant expression is used to specify the size of a bit-field member of a structure, the
4158 value of an enumeration constant, the size of an array, or the value of a case constant. Further
4159 constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
4160 directives are discussed in <a href="#6.10.1">6.10.1</a>.
4162 [<a name="p95" href="#p95">page 95</a>] (<a href="#Contents">Contents</a>)
4164 -- an address constant, or
4165 -- an address constant for an object type plus or minus an integer constant expression.
4166 8 An arithmetic constant expression shall have arithmetic type and shall only have
4167 operands that are integer constants, floating constants, enumeration constants, character
4168 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
4169 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
4170 sizeof operator whose result is an integer constant.
4171 9 An address constant is a null pointer, a pointer to an lvalue designating an object of static
4172 storage duration, or a pointer to a function designator; it shall be created explicitly using
4173 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
4174 an expression of array or function type. The array-subscript [] and member-access .
4175 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
4176 be used in the creation of an address constant, but the value of an object shall not be
4177 accessed by use of these operators.
4178 10 An implementation may accept other forms of constant expressions.
4179 11 The semantic rules for the evaluation of a constant expression are the same as for
4180 nonconstant expressions.100)
4181 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
4186 100) Thus, in the following initialization,
4187 static int i = 2 || 1 / 0;
4188 the expression is a valid integer constant expression with value one.
4190 [<a name="p96" href="#p96">page 96</a>] (<a href="#Contents">Contents</a>)
4192 <a name="6.7" href="#6.7"><b> 6.7 Declarations</b></a>
4193 Syntax
4194 1 declaration:
4195 declaration-specifiers init-declarator-listopt ;
4196 declaration-specifiers:
4197 storage-class-specifier declaration-specifiersopt
4198 type-specifier declaration-specifiersopt
4199 type-qualifier declaration-specifiersopt
4200 function-specifier declaration-specifiersopt
4201 init-declarator-list:
4202 init-declarator
4203 init-declarator-list , init-declarator
4204 init-declarator:
4205 declarator
4206 declarator = initializer
4207 Constraints
4208 2 A declaration shall declare at least a declarator (other than the parameters of a function or
4209 the members of a structure or union), a tag, or the members of an enumeration.
4210 3 If an identifier has no linkage, there shall be no more than one declaration of the identifier
4211 (in a declarator or type specifier) with the same scope and in the same name space, except
4212 for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
4213 4 All declarations in the same scope that refer to the same object or function shall specify
4214 compatible types.
4215 Semantics
4216 5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
4217 of an identifier is a declaration for that identifier that:
4218 -- for an object, causes storage to be reserved for that object;
4219 -- for a function, includes the function body;101)
4220 -- for an enumeration constant or typedef name, is the (only) declaration of the
4221 identifier.
4222 6 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
4223 storage duration, and part of the type of the entities that the declarators denote. The init-
4224 declarator-list is a comma-separated sequence of declarators, each of which may have
4226 101) Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
4228 [<a name="p97" href="#p97">page 97</a>] (<a href="#Contents">Contents</a>)
4230 additional type information, or an initializer, or both. The declarators contain the
4231 identifiers (if any) being declared.
4232 7 If an identifier for an object is declared with no linkage, the type for the object shall be
4233 complete by the end of its declarator, or by the end of its init-declarator if it has an
4234 initializer; in the case of function parameters (including in prototypes), it is the adjusted
4235 type (see <a href="#6.7.5.3">6.7.5.3</a>) that is required to be complete.
4236 Forward references: declarators (<a href="#6.7.5">6.7.5</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
4237 (<a href="#6.7.8">6.7.8</a>).
4238 <a name="6.7.1" href="#6.7.1"><b> 6.7.1 Storage-class specifiers</b></a>
4239 Syntax
4240 1 storage-class-specifier:
4241 typedef
4242 extern
4243 static
4244 auto
4245 register
4246 Constraints
4247 2 At most, one storage-class specifier may be given in the declaration specifiers in a
4248 declaration.102)
4249 Semantics
4250 3 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
4251 only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
4252 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
4253 4 A declaration of an identifier for an object with storage-class specifier register
4254 suggests that access to the object be as fast as possible. The extent to which such
4255 suggestions are effective is implementation-defined.103)
4256 5 The declaration of an identifier for a function that has block scope shall have no explicit
4257 storage-class specifier other than extern.
4261 102) See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
4262 103) The implementation may treat any register declaration simply as an auto declaration. However,
4263 whether or not addressable storage is actually used, the address of any part of an object declared with
4264 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
4265 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
4266 <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
4267 register is sizeof.
4269 [<a name="p98" href="#p98">page 98</a>] (<a href="#Contents">Contents</a>)
4271 6 If an aggregate or union object is declared with a storage-class specifier other than
4272 typedef, the properties resulting from the storage-class specifier, except with respect to
4273 linkage, also apply to the members of the object, and so on recursively for any aggregate
4274 or union member objects.
4275 Forward references: type definitions (<a href="#6.7.7">6.7.7</a>).
4276 <a name="6.7.2" href="#6.7.2"><b> 6.7.2 Type specifiers</b></a>
4277 Syntax
4278 1 type-specifier:
4279 void
4280 char
4281 short
4283 long
4284 float
4285 double
4286 signed
4287 unsigned
4288 _Bool
4289 _Complex
4290 struct-or-union-specifier *
4291 enum-specifier
4292 typedef-name
4293 Constraints
4294 2 At least one type specifier shall be given in the declaration specifiers in each declaration,
4295 and in the specifier-qualifier list in each struct declaration and type name. Each list of
4296 type specifiers shall be one of the following sets (delimited by commas, when there is
4297 more than one set on a line); the type specifiers may occur in any order, possibly
4298 intermixed with the other declaration specifiers.
4299 -- void
4300 -- char
4301 -- signed char
4302 -- unsigned char
4303 -- short, signed short, short int, or signed short int
4304 -- unsigned short, or unsigned short int
4305 -- int, signed, or signed int
4308 [<a name="p99" href="#p99">page 99</a>] (<a href="#Contents">Contents</a>)
4310 -- unsigned, or unsigned int
4311 -- long, signed long, long int, or signed long int
4312 -- unsigned long, or unsigned long int
4313 -- long long, signed long long, long long int, or
4314 signed long long int
4315 -- unsigned long long, or unsigned long long int
4316 -- float
4317 -- double
4318 -- long double
4319 -- _Bool
4320 -- float _Complex
4321 -- double _Complex
4322 -- long double _Complex
4323 -- struct or union specifier *
4324 -- enum specifier
4325 -- typedef name
4326 3 The type specifier _Complex shall not be used if the implementation does not provide
4327 complex types.104)
4328 Semantics
4329 4 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
4330 <a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3. Declarations of typedef names are discussed in 6.7.7. The characteristics of the</b></a>
4331 other types are discussed in <a href="#6.2.5">6.2.5</a>.
4332 5 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
4333 implementation-defined whether the specifier int designates the same type as signed
4334 int or the same type as unsigned int.
4335 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
4336 (<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>).
4341 104) Freestanding implementations are not required to provide complex types. *
4343 [<a name="p100" href="#p100">page 100</a>] (<a href="#Contents">Contents</a>)
4345 <a name="6.7.2.1" href="#6.7.2.1"><b> 6.7.2.1 Structure and union specifiers</b></a>
4346 Syntax
4347 1 struct-or-union-specifier:
4348 struct-or-union identifieropt { struct-declaration-list }
4349 struct-or-union identifier
4350 struct-or-union:
4351 struct
4352 union
4353 struct-declaration-list:
4354 struct-declaration
4355 struct-declaration-list struct-declaration
4356 struct-declaration:
4357 specifier-qualifier-list struct-declarator-list ;
4358 specifier-qualifier-list:
4359 type-specifier specifier-qualifier-listopt
4360 type-qualifier specifier-qualifier-listopt
4361 struct-declarator-list:
4362 struct-declarator
4363 struct-declarator-list , struct-declarator
4364 struct-declarator:
4365 declarator
4366 declaratoropt : constant-expression
4367 Constraints
4368 2 A structure or union shall not contain a member with incomplete or function type (hence,
4369 a structure shall not contain an instance of itself, but may contain a pointer to an instance
4370 of itself), except that the last member of a structure with more than one named member
4371 may have incomplete array type; such a structure (and any union containing, possibly
4372 recursively, a member that is such a structure) shall not be a member of a structure or an
4373 element of an array.
4374 3 The expression that specifies the width of a bit-field shall be an integer constant
4375 expression with a nonnegative value that does not exceed the width of an object of the
4376 type that would be specified were the colon and expression omitted. If the value is zero,
4377 the declaration shall have no declarator.
4378 4 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
4379 int, unsigned int, or some other implementation-defined type.
4382 [<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
4384 Semantics
4385 5 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
4386 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
4387 of members whose storage overlap.
4388 6 Structure and union specifiers have the same form. The keywords struct and union
4389 indicate that the type being specified is, respectively, a structure type or a union type.
4390 7 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
4391 within a translation unit. The struct-declaration-list is a sequence of declarations for the
4392 members of the structure or union. If the struct-declaration-list contains no named
4393 members, the behavior is undefined. The type is incomplete until after the } that
4394 terminates the list.
4395 8 A member of a structure or union may have any object type other than a variably
4396 modified type.105) In addition, a member may be declared to consist of a specified
4397 number of bits (including a sign bit, if any). Such a member is called a bit-field;106) its
4398 width is preceded by a colon.
4399 9 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified
4400 number of bits.107) If the value 0 or 1 is stored into a nonzero-width bit-field of type
4401 _Bool, the value of the bit-field shall compare equal to the value stored.
4402 10 An implementation may allocate any addressable storage unit large enough to hold a bit-
4403 field. If enough space remains, a bit-field that immediately follows another bit-field in a
4404 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
4405 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
4406 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
4407 low-order or low-order to high-order) is implementation-defined. The alignment of the
4408 addressable storage unit is unspecified.
4409 11 A bit-field declaration with no declarator, but only a colon and a width, indicates an
4410 unnamed bit-field.108) As a special case, a bit-field structure member with a width of 0
4411 indicates that no further bit-field is to be packed into the unit in which the previous bit-
4412 field, if any, was placed.
4415 105) A structure or union can not contain a member with a variably modified type because member names
4416 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
4417 106) The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
4418 or arrays of bit-field objects.
4419 107) 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,
4420 then it is implementation-defined whether the bit-field is signed or unsigned.
4421 108) An unnamed bit-field structure member is useful for padding to conform to externally imposed
4422 layouts.
4424 [<a name="p102" href="#p102">page 102</a>] (<a href="#Contents">Contents</a>)
4426 12 Each non-bit-field member of a structure or union object is aligned in an implementation-
4427 defined manner appropriate to its type.
4428 13 Within a structure object, the non-bit-field members and the units in which bit-fields
4429 reside have addresses that increase in the order in which they are declared. A pointer to a
4430 structure object, suitably converted, points to its initial member (or if that member is a
4431 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
4432 padding within a structure object, but not at its beginning.
4433 14 The size of a union is sufficient to contain the largest of its members. The value of at
4434 most one of the members can be stored in a union object at any time. A pointer to a
4435 union object, suitably converted, points to each of its members (or if a member is a bit-
4436 field, then to the unit in which it resides), and vice versa.
4437 15 There may be unnamed padding at the end of a structure or union.
4438 16 As a special case, the last element of a structure with more than one named member may
4439 have an incomplete array type; this is called a flexible array member. In most situations,
4440 the flexible array member is ignored. In particular, the size of the structure is as if the
4441 flexible array member were omitted except that it may have more trailing padding than
4442 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
4443 (a pointer to) a structure with a flexible array member and the right operand names that
4444 member, it behaves as if that member were replaced with the longest array (with the same
4445 element type) that would not make the structure larger than the object being accessed; the
4446 offset of the array shall remain that of the flexible array member, even if this would differ
4447 from that of the replacement array. If this array would have no elements, it behaves as if
4448 it had one element but the behavior is undefined if any attempt is made to access that
4449 element or to generate a pointer one past it.
4450 17 EXAMPLE After the declaration:
4451 struct s { int n; double d[]; };
4452 the structure struct s has a flexible array member d. A typical way to use this is:
4453 int m = /* some value */;
4454 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
4455 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
4456 p had been declared as:
4457 struct { int n; double d[m]; } *p;
4458 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
4459 not be the same).
4460 18 Following the above declaration:
4465 [<a name="p103" href="#p103">page 103</a>] (<a href="#Contents">Contents</a>)
4467 struct s t1 = { 0 }; // valid
4468 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
4469 t1.n = 4; // valid
4470 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
4471 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
4472 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
4473 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
4474 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
4475 code.
4476 19 After the further declaration:
4477 struct ss { int n; };
4478 the expressions:
4479 sizeof (struct s) &gt;= sizeof (struct ss)
4480 sizeof (struct s) &gt;= offsetof(struct s, d)
4481 are always equal to 1.
4482 20 If sizeof (double) is 8, then after the following code is executed:
4483 struct s *s1;
4484 struct s *s2;
4485 s1 = malloc(sizeof (struct s) + 64);
4486 s2 = malloc(sizeof (struct s) + 46);
4487 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
4488 purposes, as if the identifiers had been declared as:
4489 struct { int n; double d[8]; } *s1;
4490 struct { int n; double d[5]; } *s2;
4491 21 Following the further successful assignments:
4492 s1 = malloc(sizeof (struct s) + 10);
4493 s2 = malloc(sizeof (struct s) + 6);
4494 they then behave as if the declarations were:
4495 struct { int n; double d[1]; } *s1, *s2;
4496 and:
4497 double *dp;
4498 dp = &amp;(s1-&gt;d[0]); // valid
4499 *dp = 42; // valid
4500 dp = &amp;(s2-&gt;d[0]); // valid
4501 *dp = 42; // undefined behavior
4502 22 The assignment:
4503 *s1 = *s2;
4504 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
4505 of the structure, they might be copied or simply overwritten with indeterminate values.
4507 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
4509 [<a name="p104" href="#p104">page 104</a>] (<a href="#Contents">Contents</a>)
4511 <a name="6.7.2.2" href="#6.7.2.2"><b> 6.7.2.2 Enumeration specifiers</b></a>
4512 Syntax
4513 1 enum-specifier:
4514 enum identifieropt { enumerator-list }
4515 enum identifieropt { enumerator-list , }
4516 enum identifier
4517 enumerator-list:
4518 enumerator
4519 enumerator-list , enumerator
4520 enumerator:
4521 enumeration-constant
4522 enumeration-constant = constant-expression
4523 Constraints
4524 2 The expression that defines the value of an enumeration constant shall be an integer
4525 constant expression that has a value representable as an int.
4526 Semantics
4527 3 The identifiers in an enumerator list are declared as constants that have type int and
4528 may appear wherever such are permitted.109) An enumerator with = defines its
4529 enumeration constant as the value of the constant expression. If the first enumerator has
4530 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
4531 defines its enumeration constant as the value of the constant expression obtained by
4532 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
4533 = may produce enumeration constants with values that duplicate other values in the same
4534 enumeration.) The enumerators of an enumeration are also known as its members.
4535 4 Each enumerated type shall be compatible with char, a signed integer type, or an
4536 unsigned integer type. The choice of type is implementation-defined,110) but shall be
4537 capable of representing the values of all the members of the enumeration. The
4538 enumerated type is incomplete until after the } that terminates the list of enumerator
4539 declarations.
4544 109) Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
4545 each other and from other identifiers declared in ordinary declarators.
4546 110) An implementation may delay the choice of which integer type until all enumeration constants have
4547 been seen.
4549 [<a name="p105" href="#p105">page 105</a>] (<a href="#Contents">Contents</a>)
4551 5 EXAMPLE The following fragment:
4552 enum hue { chartreuse, burgundy, claret=20, winedark };
4553 enum hue col, *cp;
4554 col = claret;
4555 cp = &amp;col;
4556 if (*cp != burgundy)
4557 /* ... */
4558 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
4559 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
4561 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
4562 <a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3 Tags</b></a>
4563 Constraints
4564 1 A specific type shall have its content defined at most once.
4565 2 Where two declarations that use the same tag declare the same type, they shall both use
4566 the same choice of struct, union, or enum.
4567 3 A type specifier of the form
4568 enum identifier
4569 without an enumerator list shall only appear after the type it specifies is complete.
4570 Semantics
4571 4 All declarations of structure, union, or enumerated types that have the same scope and
4572 use the same tag declare the same type. The type is incomplete111) until the closing brace
4573 of the list defining the content, and complete thereafter.
4574 5 Two declarations of structure, union, or enumerated types which are in different scopes or
4575 use different tags declare distinct types. Each declaration of a structure, union, or
4576 enumerated type which does not include a tag declares a distinct type.
4577 6 A type specifier of the form
4578 struct-or-union identifieropt { struct-declaration-list }
4580 enum identifier { enumerator-list }
4582 enum identifier { enumerator-list , }
4583 declares a structure, union, or enumerated type. The list defines the structure content,
4585 111) An incomplete type may only by used when the size of an object of that type is not needed. It is not
4586 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
4587 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
4588 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
4590 [<a name="p106" href="#p106">page 106</a>] (<a href="#Contents">Contents</a>)
4592 union content, or enumeration content. If an identifier is provided,112) the type specifier
4593 also declares the identifier to be the tag of that type.
4594 7 A declaration of the form
4595 struct-or-union identifier ;
4596 specifies a structure or union type and declares the identifier as a tag of that type.113)
4597 8 If a type specifier of the form
4598 struct-or-union identifier
4599 occurs other than as part of one of the above forms, and no other declaration of the
4600 identifier as a tag is visible, then it declares an incomplete structure or union type, and
4601 declares the identifier as the tag of that type.113)
4602 9 If a type specifier of the form
4603 struct-or-union identifier
4605 enum identifier
4606 occurs other than as part of one of the above forms, and a declaration of the identifier as a
4607 tag is visible, then it specifies the same type as that other declaration, and does not
4608 redeclare the tag.
4609 10 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
4610 struct tnode {
4611 int count;
4612 struct tnode *left, *right;
4614 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
4615 declaration has been given, the declaration
4616 struct tnode s, *sp;
4617 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
4618 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
4619 which sp points; the expression s.right-&gt;count designates the count member of the right struct
4620 tnode pointed to from s.
4621 11 The following alternative formulation uses the typedef mechanism:
4626 112) If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
4627 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
4628 can make use of that typedef name to declare objects having the specified structure, union, or
4629 enumerated type.
4630 113) A similar construction with enum does not exist.
4632 [<a name="p107" href="#p107">page 107</a>] (<a href="#Contents">Contents</a>)
4634 typedef struct tnode TNODE;
4635 struct tnode {
4636 int count;
4637 TNODE *left, *right;
4639 TNODE s, *sp;
4641 12 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
4642 structures, the declarations
4643 struct s1 { struct s2 *s2p; /* ... */ }; // D1
4644 struct s2 { struct s1 *s1p; /* ... */ }; // D2
4645 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
4646 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
4647 D2. To eliminate this context sensitivity, the declaration
4648 struct s2;
4649 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
4650 completes the specification of the new type.
4652 Forward references: declarators (<a href="#6.7.5">6.7.5</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions
4653 (<a href="#6.7.7">6.7.7</a>).
4654 <a name="6.7.3" href="#6.7.3"><b> 6.7.3 Type qualifiers</b></a>
4655 Syntax
4656 1 type-qualifier:
4657 const
4658 restrict
4659 volatile
4660 Constraints
4661 2 Types other than pointer types derived from object or incomplete types shall not be
4662 restrict-qualified.
4663 Semantics
4664 3 The properties associated with qualified types are meaningful only for expressions that
4665 are lvalues.114)
4666 4 If the same qualifier appears more than once in the same specifier-qualifier-list, either
4667 directly or via one or more typedefs, the behavior is the same as if it appeared only
4668 once.
4673 114) The implementation may place a const object that is not volatile in a read-only region of
4674 storage. Moreover, the implementation need not allocate storage for such an object if its address is
4675 never used.
4677 [<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
4679 5 If an attempt is made to modify an object defined with a const-qualified type through use
4680 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
4681 made to refer to an object defined with a volatile-qualified type through use of an lvalue
4682 with non-volatile-qualified type, the behavior is undefined.115)
4683 6 An object that has volatile-qualified type may be modified in ways unknown to the
4684 implementation or have other unknown side effects. Therefore any expression referring
4685 to such an object shall be evaluated strictly according to the rules of the abstract machine,
4686 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
4687 object shall agree with that prescribed by the abstract machine, except as modified by the
4688 unknown factors mentioned previously.116) What constitutes an access to an object that
4689 has volatile-qualified type is implementation-defined.
4690 7 An object that is accessed through a restrict-qualified pointer has a special association
4691 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
4692 that object use, directly or indirectly, the value of that particular pointer.117) The intended
4693 use of the restrict qualifier (like the register storage class) is to promote
4694 optimization, and deleting all instances of the qualifier from all preprocessing translation
4695 units composing a conforming program does not change its meaning (i.e., observable
4696 behavior).
4697 8 If the specification of an array type includes any type qualifiers, the element type is so-
4698 qualified, not the array type. If the specification of a function type includes any type
4699 qualifiers, the behavior is undefined.118)
4700 9 For two qualified types to be compatible, both shall have the identically qualified version
4701 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
4702 does not affect the specified type.
4703 10 EXAMPLE 1 An object declared
4704 extern const volatile int real_time_clock;
4705 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
4710 115) This applies to those objects that behave as if they were defined with qualified types, even if they are
4711 never actually defined as objects in the program (such as an object at a memory-mapped input/output
4712 address).
4713 116) A volatile declaration may be used to describe an object corresponding to a memory-mapped
4714 input/output port or an object accessed by an asynchronously interrupting function. Actions on
4715 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
4716 permitted by the rules for evaluating expressions.
4717 117) For example, a statement that assigns a value returned by malloc to a single pointer establishes this
4718 association between the allocated object and the pointer.
4719 118) Both of these can occur through the use of typedefs.
4721 [<a name="p109" href="#p109">page 109</a>] (<a href="#Contents">Contents</a>)
4723 11 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
4724 modify an aggregate type:
4725 const struct s { int mem; } cs = { 1 };
4726 struct s ncs; // the object ncs is modifiable
4727 typedef int A[2][3];
4728 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
4729 int *pi;
4730 const int *pci;
4731 ncs = cs; // valid
4732 cs = ncs; // violates modifiable lvalue constraint for =
4733 pi = &amp;ncs.mem; // valid
4734 pi = &amp;cs.mem; // violates type constraints for =
4735 pci = &amp;cs.mem; // valid
4736 pi = a[0]; // invalid: a[0] has type ''const int *''
4738 <a name="6.7.3.1" href="#6.7.3.1"><b> 6.7.3.1 Formal definition of restrict</b></a>
4739 1 Let D be a declaration of an ordinary identifier that provides a means of designating an
4740 object P as a restrict-qualified pointer to type T.
4741 2 If D appears inside a block and does not have storage class extern, let B denote the
4742 block. If D appears in the list of parameter declarations of a function definition, let B
4743 denote the associated block. Otherwise, let B denote the block of main (or the block of
4744 whatever function is called at program startup in a freestanding environment).
4745 3 In what follows, a pointer expression E is said to be based on object P if (at some
4746 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
4747 a copy of the array object into which it formerly pointed would change the value of E.119)
4748 Note that ''based'' is defined only for expressions with pointer types.
4749 4 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
4750 access the value of the object X that it designates, and X is also modified (by any means),
4751 then the following requirements apply: T shall not be const-qualified. Every other lvalue
4752 used to access the value of X shall also have its address based on P. Every access that
4753 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
4754 is assigned the value of a pointer expression E that is based on another restricted pointer
4755 object P2, associated with block B2, then either the execution of B2 shall begin before
4756 the execution of B, or the execution of B2 shall end prior to the assignment. If these
4757 requirements are not met, then the behavior is undefined.
4758 5 Here an execution of B means that portion of the execution of the program that would
4759 correspond to the lifetime of an object with scalar type and automatic storage duration
4761 119) In other words, E depends on the value of P itself rather than on the value of an object referenced
4762 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
4763 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
4764 expressions *p and p[1] are not.
4766 [<a name="p110" href="#p110">page 110</a>] (<a href="#Contents">Contents</a>)
4768 associated with B.
4769 6 A translator is free to ignore any or all aliasing implications of uses of restrict.
4770 7 EXAMPLE 1 The file scope declarations
4771 int * restrict a;
4772 int * restrict b;
4773 extern int c[];
4774 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
4775 program, then it is never accessed using either of the other two.
4777 8 EXAMPLE 2 The function parameter declarations in the following example
4778 void f(int n, int * restrict p, int * restrict q)
4780 while (n-- &gt; 0)
4781 *p++ = *q++;
4783 assert that, during each execution of the function, if an object is accessed through one of the pointer
4784 parameters, then it is not also accessed through the other.
4785 9 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
4786 analysis of function f without examining any of the calls of f in the program. The cost is that the
4787 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
4788 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
4789 both p and q.
4790 void g(void)
4792 extern int d[100];
4793 f(50, d + 50, d); // valid
4794 f(50, d + 1, d); // undefined behavior
4797 10 EXAMPLE 3 The function parameter declarations
4798 void h(int n, int * restrict p, int * restrict q, int * restrict r)
4800 int i;
4801 for (i = 0; i &lt; n; i++)
4802 p[i] = q[i] + r[i];
4804 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
4805 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
4806 modified within function h.
4808 11 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
4809 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
4810 between restricted pointers declared in nested blocks have defined behavior.
4815 [<a name="p111" href="#p111">page 111</a>] (<a href="#Contents">Contents</a>)
4818 int * restrict p1;
4819 int * restrict q1;
4820 p1 = q1; // undefined behavior
4822 int * restrict p2 = p1; // valid
4823 int * restrict q2 = q1; // valid
4824 p1 = q2; // undefined behavior
4825 p2 = q2; // undefined behavior
4828 12 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
4829 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
4830 example, this permits new_vector to return a vector.
4831 typedef struct { int n; float * restrict v; } vector;
4832 vector new_vector(int n)
4834 vector t;
4835 t.n = n;
4836 t.v = malloc(n * sizeof (float));
4837 return t;
4840 <a name="6.7.4" href="#6.7.4"><b> 6.7.4 Function specifiers</b></a>
4841 Syntax
4842 1 function-specifier:
4843 inline
4844 Constraints
4845 2 Function specifiers shall be used only in the declaration of an identifier for a function.
4846 3 An inline definition of a function with external linkage shall not contain a definition of a
4847 modifiable object with static storage duration, and shall not contain a reference to an
4848 identifier with internal linkage.
4849 4 In a hosted environment, the inline function specifier shall not appear in a declaration
4850 of main.
4851 Semantics
4852 5 A function declared with an inline function specifier is an inline function. The
4853 function specifier may appear more than once; the behavior is the same as if it appeared
4854 only once. Making a function an inline function suggests that calls to the function be as
4855 fast as possible.120) The extent to which such suggestions are effective is
4856 implementation-defined.121)
4857 6 Any function with internal linkage can be an inline function. For a function with external
4858 linkage, the following restrictions apply: If a function is declared with an inline
4859 [<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
4861 function specifier, then it shall also be defined in the same translation unit. If all of the
4862 file scope declarations for a function in a translation unit include the inline function
4863 specifier without extern, then the definition in that translation unit is an inline
4864 definition. An inline definition does not provide an external definition for the function,
4865 and does not forbid an external definition in another translation unit. An inline definition
4866 provides an alternative to an external definition, which a translator may use to implement
4867 any call to the function in the same translation unit. It is unspecified whether a call to the
4868 function uses the inline definition or the external definition.122)
4869 7 EXAMPLE The declaration of an inline function with external linkage can result in either an external
4870 definition, or a definition available for use only within the translation unit. A file scope declaration with
4871 extern creates an external definition. The following example shows an entire translation unit.
4872 inline double fahr(double t)
4874 return (<a href="#9.0">9.0</a> * t) / <a href="#5.0">5.0</a> + 32.0;
4876 inline double cels(double t)
4878 return (<a href="#5.0">5.0</a> * (t - 32.0)) / <a href="#9.0">9.0</a>;
4880 extern double fahr(double); // creates an external definition
4881 double convert(int is_fahr, double temp)
4883 /* A translator may perform inline substitutions */
4884 return is_fahr ? cels(temp) : fahr(temp);
4886 8 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
4887 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
4888 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
4889 definition are distinct and either may be used for the call.
4891 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
4894 120) By using, for example, an alternative to the usual function call mechanism, such as ''inline
4895 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
4896 Therefore, for example, the expansion of a macro used within the body of the function uses the
4897 definition it had at the point the function body appears, and not where the function is called; and
4898 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
4899 single address, regardless of the number of inline definitions that occur in addition to the external
4900 definition.
4901 121) For example, an implementation might never perform inline substitution, or might only perform inline
4902 substitutions to calls in the scope of an inline declaration.
4903 122) Since an inline definition is distinct from the corresponding external definition and from any other
4904 corresponding inline definitions in other translation units, all corresponding objects with static storage
4905 duration are also distinct in each of the definitions.
4907 [<a name="p113" href="#p113">page 113</a>] (<a href="#Contents">Contents</a>)
4909 <a name="6.7.5" href="#6.7.5"><b> 6.7.5 Declarators</b></a>
4910 Syntax
4911 1 declarator:
4912 pointeropt direct-declarator
4913 direct-declarator:
4914 identifier
4915 ( declarator )
4916 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
4917 direct-declarator [ static type-qualifier-listopt assignment-expression ]
4918 direct-declarator [ type-qualifier-list static assignment-expression ]
4919 direct-declarator [ type-qualifier-listopt * ]
4920 direct-declarator ( parameter-type-list )
4921 direct-declarator ( identifier-listopt )
4922 pointer:
4923 * type-qualifier-listopt
4924 * type-qualifier-listopt pointer
4925 type-qualifier-list:
4926 type-qualifier
4927 type-qualifier-list type-qualifier
4928 parameter-type-list:
4929 parameter-list
4930 parameter-list , ...
4931 parameter-list:
4932 parameter-declaration
4933 parameter-list , parameter-declaration
4934 parameter-declaration:
4935 declaration-specifiers declarator
4936 declaration-specifiers abstract-declaratoropt
4937 identifier-list:
4938 identifier
4939 identifier-list , identifier
4940 Semantics
4941 2 Each declarator declares one identifier, and asserts that when an operand of the same
4942 form as the declarator appears in an expression, it designates a function or object with the
4943 scope, storage duration, and type indicated by the declaration specifiers.
4944 3 A full declarator is a declarator that is not part of another declarator. The end of a full
4945 declarator is a sequence point. If, in the nested sequence of declarators in a full
4946 [<a name="p114" href="#p114">page 114</a>] (<a href="#Contents">Contents</a>)
4948 declarator, there is a declarator specifying a variable length array type, the type specified
4949 by the full declarator is said to be variably modified. Furthermore, any type derived by
4950 declarator type derivation from a variably modified type is itself variably modified.
4951 4 In the following subclauses, consider a declaration
4952 T D1
4953 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
4954 a declarator that contains an identifier ident. The type specified for the identifier ident in
4955 the various forms of declarator is described inductively using this notation.
4956 5 If, in the declaration ''T D1'', D1 has the form
4957 identifier
4958 then the type specified for ident is T .
4959 6 If, in the declaration ''T D1'', D1 has the form
4960 ( D )
4961 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
4962 parentheses is identical to the unparenthesized declarator, but the binding of complicated
4963 declarators may be altered by parentheses.
4964 Implementation limits
4965 7 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
4966 function declarators that modify an arithmetic, structure, union, or incomplete type, either
4967 directly or via one or more typedefs.
4968 Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
4969 <a name="6.7.5.1" href="#6.7.5.1"><b> 6.7.5.1 Pointer declarators</b></a>
4970 Semantics
4971 1 If, in the declaration ''T D1'', D1 has the form
4972 * type-qualifier-listopt D
4973 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
4974 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
4975 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
4976 2 For two pointer types to be compatible, both shall be identically qualified and both shall
4977 be pointers to compatible types.
4978 3 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
4979 to a constant value'' and a ''constant pointer to a variable value''.
4984 [<a name="p115" href="#p115">page 115</a>] (<a href="#Contents">Contents</a>)
4986 const int *ptr_to_constant;
4987 int *const constant_ptr;
4988 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
4989 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
4990 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
4991 same location.
4992 4 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
4993 type ''pointer to int''.
4994 typedef int *int_ptr;
4995 const int_ptr constant_ptr;
4996 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
4998 <a name="6.7.5.2" href="#6.7.5.2"><b> 6.7.5.2 Array declarators</b></a>
4999 Constraints
5000 1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
5001 an expression or *. If they delimit an expression (which specifies the size of an array), the
5002 expression shall have an integer type. If the expression is a constant expression, it shall
5003 have a value greater than zero. The element type shall not be an incomplete or function
5004 type. The optional type qualifiers and the keyword static shall appear only in a
5005 declaration of a function parameter with an array type, and then only in the outermost
5006 array type derivation.
5007 2 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
5008 either block scope and no linkage or function prototype scope. If an identifier is declared
5009 to be an object with static storage duration, it shall not have a variable length array type.
5010 Semantics
5011 3 If, in the declaration ''T D1'', D1 has one of the forms:
5012 D[ type-qualifier-listopt assignment-expressionopt ]
5013 D[ static type-qualifier-listopt assignment-expression ]
5014 D[ type-qualifier-list static assignment-expression ]
5015 D[ type-qualifier-listopt * ]
5016 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5017 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.123)
5018 (See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
5019 4 If the size is not present, the array type is an incomplete type. If the size is * instead of
5020 being an expression, the array type is a variable length array type of unspecified size,
5021 which can only be used in declarations with function prototype scope;124) such arrays are
5022 nonetheless complete types. If the size is an integer constant expression and the element
5024 123) When several ''array of'' specifications are adjacent, a multidimensional array is declared.
5026 [<a name="p116" href="#p116">page 116</a>] (<a href="#Contents">Contents</a>)
5028 type has a known constant size, the array type is not a variable length array type;
5029 otherwise, the array type is a variable length array type.
5030 5 If the size is an expression that is not an integer constant expression: if it occurs in a
5031 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
5032 each time it is evaluated it shall have a value greater than zero. The size of each instance
5033 of a variable length array type does not change during its lifetime. Where a size
5034 expression is part of the operand of a sizeof operator and changing the value of the
5035 size expression would not affect the result of the operator, it is unspecified whether or not
5036 the size expression is evaluated.
5037 6 For two array types to be compatible, both shall have compatible element types, and if
5038 both size specifiers are present, and are integer constant expressions, then both size
5039 specifiers shall have the same constant value. If the two array types are used in a context
5040 which requires them to be compatible, it is undefined behavior if the two size specifiers
5041 evaluate to unequal values.
5042 7 EXAMPLE 1
5043 float fa[11], *afp[17];
5044 declares an array of float numbers and an array of pointers to float numbers.
5046 8 EXAMPLE 2 Note the distinction between the declarations
5047 extern int *x;
5048 extern int y[];
5049 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
5050 (an incomplete type), the storage for which is defined elsewhere.
5052 9 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
5053 extern int n;
5054 extern int m;
5055 void fcompat(void)
5057 int a[n][6][m];
5058 int (*p)[4][n+1];
5059 int c[n][n][6][m];
5060 int (*r)[n][n][n+1];
5061 p = a; // invalid: not compatible because 4 != 6
5062 r = c; // compatible, but defined behavior only if
5063 // n == 6 and m == n+1
5069 124) Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.5.3">6.7.5.3</a>).
5071 [<a name="p117" href="#p117">page 117</a>] (<a href="#Contents">Contents</a>)
5073 10 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
5074 function prototype scope. Array objects declared with the static or extern storage-class specifier
5075 cannot have a variable length array (VLA) type. However, an object declared with the static storage-
5076 class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all identifiers declared with a
5077 VM type have to be ordinary identifiers and cannot, therefore, be members of structures or unions.
5078 extern int n;
5079 int A[n]; // invalid: file scope VLA
5080 extern int (*p2)[n]; // invalid: file scope VM
5081 int B[100]; // valid: file scope but not VM
5082 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
5083 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
5085 typedef int VLA[m][m]; // valid: block scope typedef VLA
5086 struct tag {
5087 int (*y)[n]; // invalid: y not ordinary identifier
5088 int z[n]; // invalid: z not ordinary identifier
5090 int D[m]; // valid: auto VLA
5091 static int E[m]; // invalid: static block scope VLA
5092 extern int F[m]; // invalid: F has linkage and is VLA
5093 int (*s)[m]; // valid: auto pointer to VLA
5094 extern int (*r)[m]; // invalid: r has linkage and points to VLA
5095 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
5098 Forward references: function declarators (<a href="#6.7.5.3">6.7.5.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
5099 initialization (<a href="#6.7.8">6.7.8</a>).
5100 <a name="6.7.5.3" href="#6.7.5.3"><b> 6.7.5.3 Function declarators (including prototypes)</b></a>
5101 Constraints
5102 1 A function declarator shall not specify a return type that is a function type or an array
5103 type.
5104 2 The only storage-class specifier that shall occur in a parameter declaration is register.
5105 3 An identifier list in a function declarator that is not part of a definition of that function
5106 shall be empty.
5107 4 After adjustment, the parameters in a parameter type list in a function declarator that is
5108 part of a definition of that function shall not have incomplete type.
5109 Semantics
5110 5 If, in the declaration ''T D1'', D1 has the form
5111 D( parameter-type-list )
5113 D( identifier-listopt )
5115 [<a name="p118" href="#p118">page 118</a>] (<a href="#Contents">Contents</a>)
5117 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5118 T '', then the type specified for ident is ''derived-declarator-type-list function returning
5119 T ''.
5120 6 A parameter type list specifies the types of, and may declare identifiers for, the
5121 parameters of the function.
5122 7 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
5123 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
5124 array type derivation. If the keyword static also appears within the [ and ] of the
5125 array type derivation, then for each call to the function, the value of the corresponding
5126 actual argument shall provide access to the first element of an array with at least as many
5127 elements as specified by the size expression.
5128 8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
5129 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
5130 9 If the list terminates with an ellipsis (, ...), no information about the number or types
5131 of the parameters after the comma is supplied.125)
5132 10 The special case of an unnamed parameter of type void as the only item in the list
5133 specifies that the function has no parameters.
5134 11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
5135 parameter name, it shall be taken as a typedef name.
5136 12 If the function declarator is not part of a definition of that function, parameters may have
5137 incomplete type and may use the [*] notation in their sequences of declarator specifiers
5138 to specify variable length array types.
5139 13 The storage-class specifier in the declaration specifiers for a parameter declaration, if
5140 present, is ignored unless the declared parameter is one of the members of the parameter
5141 type list for a function definition.
5142 14 An identifier list declares only the identifiers of the parameters of the function. An empty
5143 list in a function declarator that is part of a definition of that function specifies that the
5144 function has no parameters. The empty list in a function declarator that is not part of a
5145 definition of that function specifies that no information about the number or types of the
5146 parameters is supplied.126)
5147 15 For two function types to be compatible, both shall specify compatible return types.127)
5150 125) 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
5151 correspond to the ellipsis.
5152 126) See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
5153 127) If both function types are ''old style'', parameter types are not compared.
5155 [<a name="p119" href="#p119">page 119</a>] (<a href="#Contents">Contents</a>)
5157 Moreover, the parameter type lists, if both are present, shall agree in the number of
5158 parameters and in use of the ellipsis terminator; corresponding parameters shall have
5159 compatible types. If one type has a parameter type list and the other type is specified by a
5160 function declarator that is not part of a function definition and that contains an empty
5161 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
5162 parameter shall be compatible with the type that results from the application of the
5163 default argument promotions. If one type has a parameter type list and the other type is
5164 specified by a function definition that contains a (possibly empty) identifier list, both shall
5165 agree in the number of parameters, and the type of each prototype parameter shall be
5166 compatible with the type that results from the application of the default argument
5167 promotions to the type of the corresponding identifier. (In the determination of type
5168 compatibility and of a composite type, each parameter declared with function or array
5169 type is taken as having the adjusted type and each parameter declared with qualified type
5170 is taken as having the unqualified version of its declared type.)
5171 16 EXAMPLE 1 The declaration
5172 int f(void), *fip(), (*pfi)();
5173 declares a function f with no parameters returning an int, a function fip with no parameter specification
5174 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
5175 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
5176 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
5177 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
5178 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
5179 designator, which is then used to call the function; it returns an int.
5180 17 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
5181 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
5182 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
5183 the identifier of the pointer pfi has block scope and no linkage.
5185 18 EXAMPLE 2 The declaration
5186 int (*apfi[3])(int *x, int *y);
5187 declares an array apfi of three pointers to functions returning int. Each of these functions has two
5188 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
5189 go out of scope at the end of the declaration of apfi.
5191 19 EXAMPLE 3 The declaration
5192 int (*fpfi(int (*)(long), int))(int, ...);
5193 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
5194 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
5195 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
5196 additional arguments of any type.
5201 [<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
5203 20 EXAMPLE 4 The following prototype has a variably modified parameter.
5204 void addscalar(int n, int m,
5205 double a[n][n*m+300], double x);
5206 int main()
5208 double b[4][308];
5209 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
5210 return 0;
5212 void addscalar(int n, int m,
5213 double a[n][n*m+300], double x)
5215 for (int i = 0; i &lt; n; i++)
5216 for (int j = 0, k = n*m+300; j &lt; k; j++)
5217 // a is a pointer to a VLA with n*m+300 elements
5218 a[i][j] += x;
5221 21 EXAMPLE 5 The following are all compatible function prototype declarators.
5222 double maximum(int n, int m, double a[n][m]);
5223 double maximum(int n, int m, double a[*][*]);
5224 double maximum(int n, int m, double a[ ][*]);
5225 double maximum(int n, int m, double a[ ][m]);
5226 as are:
5227 void f(double (* restrict a)[5]);
5228 void f(double a[restrict][5]);
5229 void f(double a[restrict 3][5]);
5230 void f(double a[restrict static 3][5]);
5231 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
5232 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
5234 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
5239 [<a name="p121" href="#p121">page 121</a>] (<a href="#Contents">Contents</a>)
5241 <a name="6.7.6" href="#6.7.6"><b> 6.7.6 Type names</b></a>
5242 Syntax
5243 1 type-name:
5244 specifier-qualifier-list abstract-declaratoropt
5245 abstract-declarator:
5246 pointer
5247 pointeropt direct-abstract-declarator
5248 direct-abstract-declarator:
5249 ( abstract-declarator )
5250 direct-abstract-declaratoropt [ type-qualifier-listopt
5251 assignment-expressionopt ]
5252 direct-abstract-declaratoropt [ static type-qualifier-listopt
5253 assignment-expression ]
5254 direct-abstract-declaratoropt [ type-qualifier-list static
5255 assignment-expression ]
5256 direct-abstract-declaratoropt [ * ]
5257 direct-abstract-declaratoropt ( parameter-type-listopt )
5258 Semantics
5259 2 In several contexts, it is necessary to specify a type. This is accomplished using a type
5260 name, which is syntactically a declaration for a function or an object of that type that
5261 omits the identifier.128)
5262 3 EXAMPLE The constructions
5263 (a) int
5264 (b) int *
5265 (c) int *[3]
5266 (d) int (*)[3]
5267 (e) int (*)[*]
5268 (f) int *()
5269 (g) int (*)(void)
5270 (h) int (*const [])(unsigned int, ...)
5271 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
5272 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
5273 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
5274 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
5275 parameter that has type unsigned int and an unspecified number of other parameters, returning an
5276 int.
5281 128) As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
5282 parameter specification'', rather than redundant parentheses around the omitted identifier.
5284 [<a name="p122" href="#p122">page 122</a>] (<a href="#Contents">Contents</a>)
5286 <a name="6.7.7" href="#6.7.7"><b> 6.7.7 Type definitions</b></a>
5287 Syntax
5288 1 typedef-name:
5289 identifier
5290 Constraints
5291 2 If a typedef name specifies a variably modified type then it shall have block scope.
5292 Semantics
5293 3 In a declaration whose storage-class specifier is typedef, each declarator defines an
5294 identifier to be a typedef name that denotes the type specified for the identifier in the way
5295 described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
5296 declarators are evaluated each time the declaration of the typedef name is reached in the
5297 order of execution. A typedef declaration does not introduce a new type, only a
5298 synonym for the type so specified. That is, in the following declarations:
5299 typedef T type_ident;
5300 type_ident D;
5301 type_ident is defined as a typedef name with the type specified by the declaration
5302 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
5303 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
5304 typedef name shares the same name space as other identifiers declared in ordinary
5305 declarators.
5306 4 EXAMPLE 1 After
5307 typedef int MILES, KLICKSP();
5308 typedef struct { double hi, lo; } range;
5309 the constructions
5310 MILES distance;
5311 extern KLICKSP *metricp;
5312 range x;
5313 range z, *zp;
5314 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
5315 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
5316 such a structure. The object distance has a type compatible with any other int object.
5318 5 EXAMPLE 2 After the declarations
5319 typedef struct s1 { int x; } t1, *tp1;
5320 typedef struct s2 { int x; } t2, *tp2;
5321 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
5322 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
5327 [<a name="p123" href="#p123">page 123</a>] (<a href="#Contents">Contents</a>)
5329 6 EXAMPLE 3 The following obscure constructions
5330 typedef signed int t;
5331 typedef int plain;
5332 struct tag {
5333 unsigned t:4;
5334 const t:5;
5335 plain r:5;
5337 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
5338 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
5339 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
5340 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
5341 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
5342 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
5343 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
5344 in an inner scope by
5345 t f(t (t));
5346 long t;
5347 then a function f is declared with type ''function returning signed int with one unnamed parameter
5348 with type pointer to function returning signed int with one unnamed parameter with type signed
5349 int'', and an identifier t with type long int.
5351 7 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
5352 following declarations of the signal function specify exactly the same type, the first without making use
5353 of any typedef names.
5354 typedef void fv(int), (*pfv)(int);
5355 void (*signal(int, void (*)(int)))(int);
5356 fv *signal(int, fv *);
5357 pfv signal(int, pfv);
5359 8 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
5360 time the typedef name is defined, not each time it is used:
5361 void copyt(int n)
5363 typedef int B[n]; // B is n ints, n evaluated now
5364 n += 1;
5365 B a; // a is n ints, n without += 1
5366 int b[n]; // a and b are different sizes
5367 for (int i = 1; i &lt; n; i++)
5368 a[i-1] = b[i];
5374 [<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
5376 <a name="6.7.8" href="#6.7.8"><b> 6.7.8 Initialization</b></a>
5377 Syntax
5378 1 initializer:
5379 assignment-expression
5380 { initializer-list }
5381 { initializer-list , }
5382 initializer-list:
5383 designationopt initializer
5384 initializer-list , designationopt initializer
5385 designation:
5386 designator-list =
5387 designator-list:
5388 designator
5389 designator-list designator
5390 designator:
5391 [ constant-expression ]
5392 . identifier
5393 Constraints
5394 2 No initializer shall attempt to provide a value for an object not contained within the entity
5395 being initialized.
5396 3 The type of the entity to be initialized shall be an array of unknown size or an object type
5397 that is not a variable length array type.
5398 4 All the expressions in an initializer for an object that has static storage duration shall be
5399 constant expressions or string literals.
5400 5 If the declaration of an identifier has block scope, and the identifier has external or
5401 internal linkage, the declaration shall have no initializer for the identifier.
5402 6 If a designator has the form
5403 [ constant-expression ]
5404 then the current object (defined below) shall have array type and the expression shall be
5405 an integer constant expression. If the array is of unknown size, any nonnegative value is
5406 valid.
5407 7 If a designator has the form
5408 . identifier
5409 then the current object (defined below) shall have structure or union type and the
5410 identifier shall be the name of a member of that type.
5411 [<a name="p125" href="#p125">page 125</a>] (<a href="#Contents">Contents</a>)
5413 Semantics
5414 8 An initializer specifies the initial value stored in an object.
5415 9 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
5416 members of objects of structure and union type do not participate in initialization.
5417 Unnamed members of structure objects have indeterminate value even after initialization.
5418 10 If an object that has automatic storage duration is not initialized explicitly, its value is
5419 indeterminate. If an object that has static storage duration is not initialized explicitly,
5420 then:
5421 -- if it has pointer type, it is initialized to a null pointer;
5422 -- if it has arithmetic type, it is initialized to (positive or unsigned) zero;
5423 -- if it is an aggregate, every member is initialized (recursively) according to these rules;
5424 -- if it is a union, the first named member is initialized (recursively) according to these
5425 rules.
5426 11 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
5427 initial value of the object is that of the expression (after conversion); the same type
5428 constraints and conversions as for simple assignment apply, taking the type of the scalar
5429 to be the unqualified version of its declared type.
5430 12 The rest of this subclause deals with initializers for objects that have aggregate or union
5431 type.
5432 13 The initializer for a structure or union object that has automatic storage duration shall be
5433 either an initializer list as described below, or a single expression that has compatible
5434 structure or union type. In the latter case, the initial value of the object, including
5435 unnamed members, is that of the expression.
5436 14 An array of character type may be initialized by a character string literal, optionally
5437 enclosed in braces. Successive characters of the character string literal (including the
5438 terminating null character if there is room or if the array is of unknown size) initialize the
5439 elements of the array.
5440 15 An array with element type compatible with wchar_t may be initialized by a wide
5441 string literal, optionally enclosed in braces. Successive wide characters of the wide string
5442 literal (including the terminating null wide character if there is room or if the array is of
5443 unknown size) initialize the elements of the array.
5444 16 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
5445 enclosed list of initializers for the elements or named members.
5446 17 Each brace-enclosed initializer list has an associated current object. When no
5447 designations are present, subobjects of the current object are initialized in order according
5448 to the type of the current object: array elements in increasing subscript order, structure
5449 [<a name="p126" href="#p126">page 126</a>] (<a href="#Contents">Contents</a>)
5451 members in declaration order, and the first named member of a union.129) In contrast, a
5452 designation causes the following initializer to begin initialization of the subobject
5453 described by the designator. Initialization then continues forward in order, beginning
5454 with the next subobject after that described by the designator.130)
5455 18 Each designator list begins its description with the current object associated with the
5456 closest surrounding brace pair. Each item in the designator list (in order) specifies a
5457 particular member of its current object and changes the current object for the next
5458 designator (if any) to be that member.131) The current object that results at the end of the
5459 designator list is the subobject to be initialized by the following initializer.
5460 19 The initialization shall occur in initializer list order, each initializer provided for a
5461 particular subobject overriding any previously listed initializer for the same subobject;132)
5462 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
5463 objects that have static storage duration.
5464 20 If the aggregate or union contains elements or members that are aggregates or unions,
5465 these rules apply recursively to the subaggregates or contained unions. If the initializer of
5466 a subaggregate or contained union begins with a left brace, the initializers enclosed by
5467 that brace and its matching right brace initialize the elements or members of the
5468 subaggregate or the contained union. Otherwise, only enough initializers from the list are
5469 taken to account for the elements or members of the subaggregate or the first member of
5470 the contained union; any remaining initializers are left to initialize the next element or
5471 member of the aggregate of which the current subaggregate or contained union is a part.
5472 21 If there are fewer initializers in a brace-enclosed list than there are elements or members
5473 of an aggregate, or fewer characters in a string literal used to initialize an array of known
5474 size than there are elements in the array, the remainder of the aggregate shall be
5475 initialized implicitly the same as objects that have static storage duration.
5476 22 If an array of unknown size is initialized, its size is determined by the largest indexed
5477 element with an explicit initializer. At the end of its initializer list, the array no longer
5478 has incomplete type.
5482 129) If the initializer list for a subaggregate or contained union does not begin with a left brace, its
5483 subobjects are initialized as usual, but the subaggregate or contained union does not become the
5484 current object: current objects are associated only with brace-enclosed initializer lists.
5485 130) After a union member is initialized, the next object is not the next member of the union; instead, it is
5486 the next subobject of an object containing the union.
5487 131) Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
5488 the surrounding brace pair. Note, too, that each separate designator list is independent.
5489 132) Any initializer for the subobject which is overridden and so not used to initialize that subobject might
5490 not be evaluated at all.
5492 [<a name="p127" href="#p127">page 127</a>] (<a href="#Contents">Contents</a>)
5494 23 The order in which any side effects occur among the initialization list expressions is
5495 unspecified.133)
5496 24 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
5497 int i = <a href="#3.5">3.5</a>;
5498 double complex c = 5 + 3 * I;
5499 define and initialize i with the value 3 and c with the value <a href="#5.0">5.0</a> + i3.0.
5501 25 EXAMPLE 2 The declaration
5502 int x[] = { 1, 3, 5 };
5503 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
5504 and there are three initializers.
5506 26 EXAMPLE 3 The declaration
5507 int y[4][3] = {
5508 { 1, 3, 5 },
5509 { 2, 4, 6 },
5510 { 3, 5, 7 },
5512 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
5513 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
5514 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
5515 been achieved by
5516 int y[4][3] = {
5517 1, 3, 5, 2, 4, 6, 3, 5, 7
5519 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
5520 next three are taken successively for y[1] and y[2].
5522 27 EXAMPLE 4 The declaration
5523 int z[4][3] = {
5524 { 1 }, { 2 }, { 3 }, { 4 }
5526 initializes the first column of z as specified and initializes the rest with zeros.
5528 28 EXAMPLE 5 The declaration
5529 struct { int a[3], b; } w[] = { { 1 }, 2 };
5530 is a definition with an inconsistently bracketed initialization. It defines an array with two element
5531 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
5536 133) In particular, the evaluation order need not be the same as the order of subobject initialization.
5538 [<a name="p128" href="#p128">page 128</a>] (<a href="#Contents">Contents</a>)
5540 29 EXAMPLE 6 The declaration
5541 short q[4][3][2] = {
5542 { 1 },
5543 { 2, 3 },
5544 { 4, 5, 6 }
5546 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
5547 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
5548 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
5549 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
5550 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
5551 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
5552 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
5553 diagnostic message would have been issued. The same initialization result could have been achieved by:
5554 short q[4][3][2] = {
5555 1, 0, 0, 0, 0, 0,
5556 2, 3, 0, 0, 0, 0,
5557 4, 5, 6
5559 or by:
5560 short q[4][3][2] = {
5562 { 1 },
5565 { 2, 3 },
5568 { 4, 5 },
5569 { 6 },
5572 in a fully bracketed form.
5573 30 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
5574 cause confusion.
5576 31 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
5577 declaration
5578 typedef int A[]; // OK - declared with block scope
5579 the declaration
5580 A a = { 1, 2 }, b = { 3, 4, 5 };
5581 is identical to
5582 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
5583 due to the rules for incomplete types.
5587 [<a name="p129" href="#p129">page 129</a>] (<a href="#Contents">Contents</a>)
5589 32 EXAMPLE 8 The declaration
5590 char s[] = "abc", t[3] = "abc";
5591 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
5592 This declaration is identical to
5593 char s[] = { 'a', 'b', 'c', '\0' },
5594 t[] = { 'a', 'b', 'c' };
5595 The contents of the arrays are modifiable. On the other hand, the declaration
5596 char *p = "abc";
5597 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
5598 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
5599 modify the contents of the array, the behavior is undefined.
5601 33 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
5602 designators:
5603 enum { member_one, member_two };
5604 const char *nm[] = {
5605 [member_two] = "member two",
5606 [member_one] = "member one",
5609 34 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
5610 div_t answer = { .quot = 2, .rem = -1 };
5612 35 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
5613 might be misunderstood:
5614 struct { int a[3], b; } w[] =
5615 { [0].a = {1}, [1].a[0] = 2 };
5617 36 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
5618 int a[MAX] = {
5619 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
5621 37 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
5622 than ten, some of the values provided by the first five initializers will be overridden by the second five.
5624 38 EXAMPLE 13 Any member of a union can be initialized:
5625 union { /* ... */ } u = { .any_member = 42 };
5627 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>).
5632 [<a name="p130" href="#p130">page 130</a>] (<a href="#Contents">Contents</a>)
5634 <a name="6.8" href="#6.8"><b> 6.8 Statements and blocks</b></a>
5635 Syntax
5636 1 statement:
5637 labeled-statement
5638 compound-statement
5639 expression-statement
5640 selection-statement
5641 iteration-statement
5642 jump-statement
5643 Semantics
5644 2 A statement specifies an action to be performed. Except as indicated, statements are
5645 executed in sequence.
5646 3 A block allows a set of declarations and statements to be grouped into one syntactic unit.
5647 The initializers of objects that have automatic storage duration, and the variable length
5648 array declarators of ordinary identifiers with block scope, are evaluated and the values are
5649 stored in the objects (including storing an indeterminate value in objects without an
5650 initializer) each time the declaration is reached in the order of execution, as if it were a
5651 statement, and within each declaration in the order that declarators appear.
5652 4 A full expression is an expression that is not part of another expression or of a declarator.
5653 Each of the following is a full expression: an initializer; the expression in an expression
5654 statement; the controlling expression of a selection statement (if or switch); the
5655 controlling expression of a while or do statement; each of the (optional) expressions of
5656 a for statement; the (optional) expression in a return statement. The end of a full
5657 expression is a sequence point.
5658 Forward references: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
5659 (<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>).
5660 <a name="6.8.1" href="#6.8.1"><b> 6.8.1 Labeled statements</b></a>
5661 Syntax
5662 1 labeled-statement:
5663 identifier : statement
5664 case constant-expression : statement
5665 default : statement
5666 Constraints
5667 2 A case or default label shall appear only in a switch statement. Further
5668 constraints on such labels are discussed under the switch statement.
5671 [<a name="p131" href="#p131">page 131</a>] (<a href="#Contents">Contents</a>)
5673 3 Label names shall be unique within a function.
5674 Semantics
5675 4 Any statement may be preceded by a prefix that declares an identifier as a label name.
5676 Labels in themselves do not alter the flow of control, which continues unimpeded across
5677 them.
5678 Forward references: the goto statement (<a href="#6.8.6.1">6.8.6.1</a>), the switch statement (<a href="#6.8.4.2">6.8.4.2</a>).
5679 <a name="6.8.2" href="#6.8.2"><b> 6.8.2 Compound statement</b></a>
5680 Syntax
5681 1 compound-statement:
5682 { block-item-listopt }
5683 block-item-list:
5684 block-item
5685 block-item-list block-item
5686 block-item:
5687 declaration
5688 statement
5689 Semantics
5690 2 A compound statement is a block.
5691 <a name="6.8.3" href="#6.8.3"><b> 6.8.3 Expression and null statements</b></a>
5692 Syntax
5693 1 expression-statement:
5694 expressionopt ;
5695 Semantics
5696 2 The expression in an expression statement is evaluated as a void expression for its side
5697 effects.134)
5698 3 A null statement (consisting of just a semicolon) performs no operations.
5699 4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
5700 discarding of its value may be made explicit by converting the expression to a void expression by means of
5701 a cast:
5702 int p(int);
5703 /* ... */
5704 (void)p(0);
5708 134) Such as assignments, and function calls which have side effects.
5710 [<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
5712 5 EXAMPLE 2 In the program fragment
5713 char *s;
5714 /* ... */
5715 while (*s++ != '\0')
5717 a null statement is used to supply an empty loop body to the iteration statement.
5719 6 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
5720 statement.
5721 while (loop1) {
5722 /* ... */
5723 while (loop2) {
5724 /* ... */
5725 if (want_out)
5726 goto end_loop1;
5727 /* ... */
5729 /* ... */
5730 end_loop1: ;
5733 Forward references: iteration statements (<a href="#6.8.5">6.8.5</a>).
5734 <a name="6.8.4" href="#6.8.4"><b> 6.8.4 Selection statements</b></a>
5735 Syntax
5736 1 selection-statement:
5737 if ( expression ) statement
5738 if ( expression ) statement else statement
5739 switch ( expression ) statement
5740 Semantics
5741 2 A selection statement selects among a set of statements depending on the value of a
5742 controlling expression.
5743 3 A selection statement is a block whose scope is a strict subset of the scope of its
5744 enclosing block. Each associated substatement is also a block whose scope is a strict
5745 subset of the scope of the selection statement.
5746 <a name="6.8.4.1" href="#6.8.4.1"><b> 6.8.4.1 The if statement</b></a>
5747 Constraints
5748 1 The controlling expression of an if statement shall have scalar type.
5749 Semantics
5750 2 In both forms, the first substatement is executed if the expression compares unequal to 0.
5751 In the else form, the second substatement is executed if the expression compares equal
5753 [<a name="p133" href="#p133">page 133</a>] (<a href="#Contents">Contents</a>)
5755 to 0. If the first substatement is reached via a label, the second substatement is not
5756 executed.
5757 3 An else is associated with the lexically nearest preceding if that is allowed by the
5758 syntax.
5759 <a name="6.8.4.2" href="#6.8.4.2"><b> 6.8.4.2 The switch statement</b></a>
5760 Constraints
5761 1 The controlling expression of a switch statement shall have integer type.
5762 2 If a switch statement has an associated case or default label within the scope of an
5763 identifier with a variably modified type, the entire switch statement shall be within the
5764 scope of that identifier.135)
5765 3 The expression of each case label shall be an integer constant expression and no two of
5766 the case constant expressions in the same switch statement shall have the same value
5767 after conversion. There may be at most one default label in a switch statement.
5768 (Any enclosed switch statement may have a default label or case constant
5769 expressions with values that duplicate case constant expressions in the enclosing
5770 switch statement.)
5771 Semantics
5772 4 A switch statement causes control to jump to, into, or past the statement that is the
5773 switch body, depending on the value of a controlling expression, and on the presence of a
5774 default label and the values of any case labels on or in the switch body. A case or
5775 default label is accessible only within the closest enclosing switch statement.
5776 5 The integer promotions are performed on the controlling expression. The constant
5777 expression in each case label is converted to the promoted type of the controlling
5778 expression. If a converted value matches that of the promoted controlling expression,
5779 control jumps to the statement following the matched case label. Otherwise, if there is
5780 a default label, control jumps to the labeled statement. If no converted case constant
5781 expression matches and there is no default label, no part of the switch body is
5782 executed.
5783 Implementation limits
5784 6 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
5785 switch statement.
5790 135) That is, the declaration either precedes the switch statement, or it follows the last case or
5791 default label associated with the switch that is in the block containing the declaration.
5793 [<a name="p134" href="#p134">page 134</a>] (<a href="#Contents">Contents</a>)
5795 7 EXAMPLE In the artificial program fragment
5796 switch (expr)
5798 int i = 4;
5799 f(i);
5800 case 0:
5801 i = 17;
5802 /* falls through into default code */
5803 default:
5804 printf("%d\n", i);
5806 the object whose identifier is i exists with automatic storage duration (within the block) but is never
5807 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
5808 access an indeterminate value. Similarly, the call to the function f cannot be reached.
5810 <a name="6.8.5" href="#6.8.5"><b> 6.8.5 Iteration statements</b></a>
5811 Syntax
5812 1 iteration-statement:
5813 while ( expression ) statement
5814 do statement while ( expression ) ;
5815 for ( expressionopt ; expressionopt ; expressionopt ) statement
5816 for ( declaration expressionopt ; expressionopt ) statement
5817 Constraints
5818 2 The controlling expression of an iteration statement shall have scalar type.
5819 3 The declaration part of a for statement shall only declare identifiers for objects having
5820 storage class auto or register.
5821 Semantics
5822 4 An iteration statement causes a statement called the loop body to be executed repeatedly
5823 until the controlling expression compares equal to 0. The repetition occurs regardless of
5824 whether the loop body is entered from the iteration statement or by a jump.136)
5825 5 An iteration statement is a block whose scope is a strict subset of the scope of its
5826 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
5827 of the iteration statement.
5832 136) Code jumped over is not executed. In particular, the controlling expression of a for or while
5833 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
5835 [<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
5837 <a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
5838 1 The evaluation of the controlling expression takes place before each execution of the loop
5839 body.
5840 <a name="6.8.5.2" href="#6.8.5.2"><b> 6.8.5.2 The do statement</b></a>
5841 1 The evaluation of the controlling expression takes place after each execution of the loop
5842 body.
5843 <a name="6.8.5.3" href="#6.8.5.3"><b> 6.8.5.3 The for statement</b></a>
5844 1 The statement
5845 for ( clause-1 ; expression-2 ; expression-3 ) statement
5846 behaves as follows: The expression expression-2 is the controlling expression that is
5847 evaluated before each execution of the loop body. The expression expression-3 is
5848 evaluated as a void expression after each execution of the loop body. If clause-1 is a
5849 declaration, the scope of any identifiers it declares is the remainder of the declaration and
5850 the entire loop, including the other two expressions; it is reached in the order of execution
5851 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
5852 evaluated as a void expression before the first evaluation of the controlling expression.137)
5853 2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
5854 nonzero constant.
5855 <a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
5856 Syntax
5857 1 jump-statement:
5858 goto identifier ;
5859 continue ;
5860 break ;
5861 return expressionopt ;
5862 Semantics
5863 2 A jump statement causes an unconditional jump to another place.
5868 137) Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
5869 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
5870 such that execution of the loop continues until the expression compares equal to 0; and expression-3
5871 specifies an operation (such as incrementing) that is performed after each iteration.
5873 [<a name="p136" href="#p136">page 136</a>] (<a href="#Contents">Contents</a>)
5875 <a name="6.8.6.1" href="#6.8.6.1"><b> 6.8.6.1 The goto statement</b></a>
5876 Constraints
5877 1 The identifier in a goto statement shall name a label located somewhere in the enclosing
5878 function. A goto statement shall not jump from outside the scope of an identifier having
5879 a variably modified type to inside the scope of that identifier.
5880 Semantics
5881 2 A goto statement causes an unconditional jump to the statement prefixed by the named
5882 label in the enclosing function.
5883 3 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
5884 following outline presents one possible approach to a problem based on these three assumptions:
5885 1. The general initialization code accesses objects only visible to the current function.
5886 2. The general initialization code is too large to warrant duplication.
5887 3. The code to determine the next operation is at the head of the loop. (To allow it to be reached by
5888 continue statements, for example.)
5889 /* ... */
5890 goto first_time;
5891 for (;;) {
5892 // determine next operation
5893 /* ... */
5894 if (need to reinitialize) {
5895 // reinitialize-only code
5896 /* ... */
5897 first_time:
5898 // general initialization code
5899 /* ... */
5900 continue;
5902 // handle other operations
5903 /* ... */
5909 [<a name="p137" href="#p137">page 137</a>] (<a href="#Contents">Contents</a>)
5911 4 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
5912 modified types. A jump within the scope, however, is permitted.
5913 goto lab3; // invalid: going INTO scope of VLA.
5915 double a[n];
5916 a[j] = <a href="#4.4">4.4</a>;
5917 lab3:
5918 a[j] = <a href="#3.3">3.3</a>;
5919 goto lab4; // valid: going WITHIN scope of VLA.
5920 a[j] = <a href="#5.5">5.5</a>;
5921 lab4:
5922 a[j] = <a href="#6.6">6.6</a>;
5924 goto lab4; // invalid: going INTO scope of VLA.
5926 <a name="6.8.6.2" href="#6.8.6.2"><b> 6.8.6.2 The continue statement</b></a>
5927 Constraints
5928 1 A continue statement shall appear only in or as a loop body.
5929 Semantics
5930 2 A continue statement causes a jump to the loop-continuation portion of the smallest
5931 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
5932 of the statements
5933 while (/* ... */) { do { for (/* ... */) {
5934 /* ... */ /* ... */ /* ... */
5935 continue; continue; continue;
5936 /* ... */ /* ... */ /* ... */
5937 contin: ; contin: ; contin: ;
5938 } } while (/* ... */); }
5939 unless the continue statement shown is in an enclosed iteration statement (in which
5940 case it is interpreted within that statement), it is equivalent to goto contin;.138)
5941 <a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
5942 Constraints
5943 1 A break statement shall appear only in or as a switch body or loop body.
5944 Semantics
5945 2 A break statement terminates execution of the smallest enclosing switch or iteration
5946 statement.
5950 138) Following the contin: label is a null statement.
5952 [<a name="p138" href="#p138">page 138</a>] (<a href="#Contents">Contents</a>)
5954 <a name="6.8.6.4" href="#6.8.6.4"><b> 6.8.6.4 The return statement</b></a>
5955 Constraints
5956 1 A return statement with an expression shall not appear in a function whose return type
5957 is void. A return statement without an expression shall only appear in a function
5958 whose return type is void.
5959 Semantics
5960 2 A return statement terminates execution of the current function and returns control to
5961 its caller. A function may have any number of return statements.
5962 3 If a return statement with an expression is executed, the value of the expression is
5963 returned to the caller as the value of the function call expression. If the expression has a
5964 type different from the return type of the function in which it appears, the value is
5965 converted as if by assignment to an object having the return type of the function.139)
5966 4 EXAMPLE In:
5967 struct s { double i; } f(void);
5968 union {
5969 struct {
5970 int f1;
5971 struct s f2;
5972 } u1;
5973 struct {
5974 struct s f3;
5975 int f4;
5976 } u2;
5977 } g;
5978 struct s f(void)
5980 return g.u1.f2;
5982 /* ... */
5983 g.u2.f3 = f();
5984 there is no undefined behavior, although there would be if the assignment were done directly (without using
5985 a function call to fetch the value).
5990 139) 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
5991 apply to the case of function return. The representation of floating-point values may have wider range
5992 or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
5993 range and precision.
5995 [<a name="p139" href="#p139">page 139</a>] (<a href="#Contents">Contents</a>)
5997 <a name="6.9" href="#6.9"><b> 6.9 External definitions</b></a>
5998 Syntax
5999 1 translation-unit:
6000 external-declaration
6001 translation-unit external-declaration
6002 external-declaration:
6003 function-definition
6004 declaration
6005 Constraints
6006 2 The storage-class specifiers auto and register shall not appear in the declaration
6007 specifiers in an external declaration.
6008 3 There shall be no more than one external definition for each identifier declared with
6009 internal linkage in a translation unit. Moreover, if an identifier declared with internal
6010 linkage is used in an expression (other than as a part of the operand of a sizeof
6011 operator whose result is an integer constant), there shall be exactly one external definition
6012 for the identifier in the translation unit.
6013 Semantics
6014 4 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,
6015 which consists of a sequence of external declarations. These are described as ''external''
6016 because they appear outside any function (and hence have file scope). As discussed in
6017 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
6018 by the identifier is a definition.
6019 5 An external definition is an external declaration that is also a definition of a function
6020 (other than an inline definition) or an object. If an identifier declared with external
6021 linkage is used in an expression (other than as part of the operand of a sizeof operator
6022 whose result is an integer constant), somewhere in the entire program there shall be
6023 exactly one external definition for the identifier; otherwise, there shall be no more than
6024 one.140)
6029 140) Thus, if an identifier declared with external linkage is not used in an expression, there need be no
6030 external definition for it.
6032 [<a name="p140" href="#p140">page 140</a>] (<a href="#Contents">Contents</a>)
6034 <a name="6.9.1" href="#6.9.1"><b> 6.9.1 Function definitions</b></a>
6035 Syntax
6036 1 function-definition:
6037 declaration-specifiers declarator declaration-listopt compound-statement
6038 declaration-list:
6039 declaration
6040 declaration-list declaration
6041 Constraints
6042 2 The identifier declared in a function definition (which is the name of the function) shall
6043 have a function type, as specified by the declarator portion of the function definition.141)
6044 3 The return type of a function shall be void or an object type other than array type.
6045 4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
6046 static.
6047 5 If the declarator includes a parameter type list, the declaration of each parameter shall
6048 include an identifier, except for the special case of a parameter list consisting of a single
6049 parameter of type void, in which case there shall not be an identifier. No declaration list
6050 shall follow.
6051 6 If the declarator includes an identifier list, each declaration in the declaration list shall
6052 have at least one declarator, those declarators shall declare only identifiers from the
6053 identifier list, and every identifier in the identifier list shall be declared. An identifier
6054 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
6055 declaration list shall contain no storage-class specifier other than register and no
6056 initializations.
6061 141) The intent is that the type category in a function definition cannot be inherited from a typedef:
6062 typedef int F(void); // type F is ''function with no parameters
6063 // returning int''
6064 F f, g; // f and g both have type compatible with F
6065 F f { /* ... */ } // WRONG: syntax/constraint error
6066 F g() { /* ... */ } // WRONG: declares that g returns a function
6067 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
6068 int g() { /* ... */ } // RIGHT: g has type compatible with F
6069 F *e(void) { /* ... */ } // e returns a pointer to a function
6070 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
6071 int (*fp)(void); // fp points to a function that has type F
6072 F *Fp; // Fp points to a function that has type F
6075 [<a name="p141" href="#p141">page 141</a>] (<a href="#Contents">Contents</a>)
6077 Semantics
6078 7 The declarator in a function definition specifies the name of the function being defined
6079 and the identifiers of its parameters. If the declarator includes a parameter type list, the
6080 list also specifies the types of all the parameters; such a declarator also serves as a
6081 function prototype for later calls to the same function in the same translation unit. If the
6082 declarator includes an identifier list,142) the types of the parameters shall be declared in a
6083 following declaration list. In either case, the type of each parameter is adjusted as
6084 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.
6085 8 If a function that accepts a variable number of arguments is defined without a parameter
6086 type list that ends with the ellipsis notation, the behavior is undefined.
6087 9 Each parameter has automatic storage duration. Its identifier is an lvalue, which is in
6088 effect declared at the head of the compound statement that constitutes the function body
6089 (and therefore cannot be redeclared in the function body except in an enclosed block).
6090 The layout of the storage for parameters is unspecified.
6091 10 On entry to the function, the size expressions of each variably modified parameter are
6092 evaluated and the value of each argument expression is converted to the type of the
6093 corresponding parameter as if by assignment. (Array expressions and function
6094 designators as arguments were converted to pointers before the call.)
6095 11 After all parameters have been assigned, the compound statement that constitutes the
6096 body of the function definition is executed.
6097 12 If the } that terminates a function is reached, and the value of the function call is used by
6098 the caller, the behavior is undefined.
6099 13 EXAMPLE 1 In the following:
6100 extern int max(int a, int b)
6102 return a &gt; b ? a : b;
6104 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
6105 function declarator; and
6106 { return a &gt; b ? a : b; }
6107 is the function body. The following similar definition uses the identifier-list form for the parameter
6108 declarations:
6113 142) See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
6115 [<a name="p142" href="#p142">page 142</a>] (<a href="#Contents">Contents</a>)
6117 extern int max(a, b)
6118 int a, b;
6120 return a &gt; b ? a : b;
6122 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
6123 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
6124 to the function, whereas the second form does not.
6126 14 EXAMPLE 2 To pass one function to another, one might say
6127 int f(void);
6128 /* ... */
6129 g(f);
6130 Then the definition of g might read
6131 void g(int (*funcp)(void))
6133 /* ... */
6134 (*funcp)(); /* or funcp(); ... */
6136 or, equivalently,
6137 void g(int func(void))
6139 /* ... */
6140 func(); /* or (*func)(); ... */
6143 <a name="6.9.2" href="#6.9.2"><b> 6.9.2 External object definitions</b></a>
6144 Semantics
6145 1 If the declaration of an identifier for an object has file scope and an initializer, the
6146 declaration is an external definition for the identifier.
6147 2 A declaration of an identifier for an object that has file scope without an initializer, and
6148 without a storage-class specifier or with the storage-class specifier static, constitutes a
6149 tentative definition. If a translation unit contains one or more tentative definitions for an
6150 identifier, and the translation unit contains no external definition for that identifier, then
6151 the behavior is exactly as if the translation unit contains a file scope declaration of that
6152 identifier, with the composite type as of the end of the translation unit, with an initializer
6153 equal to 0.
6154 3 If the declaration of an identifier for an object is a tentative definition and has internal
6155 linkage, the declared type shall not be an incomplete type.
6160 [<a name="p143" href="#p143">page 143</a>] (<a href="#Contents">Contents</a>)
6162 4 EXAMPLE 1
6163 int i1 = 1; // definition, external linkage
6164 static int i2 = 2; // definition, internal linkage
6165 extern int i3 = 3; // definition, external linkage
6166 int i4; // tentative definition, external linkage
6167 static int i5; // tentative definition, internal linkage
6168 int i1; // valid tentative definition, refers to previous
6169 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6170 int i3; // valid tentative definition, refers to previous
6171 int i4; // valid tentative definition, refers to previous
6172 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6173 extern int i1; // refers to previous, whose linkage is external
6174 extern int i2; // refers to previous, whose linkage is internal
6175 extern int i3; // refers to previous, whose linkage is external
6176 extern int i4; // refers to previous, whose linkage is external
6177 extern int i5; // refers to previous, whose linkage is internal
6179 5 EXAMPLE 2 If at the end of the translation unit containing
6180 int i[];
6181 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
6182 zero on program startup.
6187 [<a name="p144" href="#p144">page 144</a>] (<a href="#Contents">Contents</a>)
6189 <a name="6.10" href="#6.10"><b> 6.10 Preprocessing directives</b></a>
6190 Syntax
6191 1 preprocessing-file:
6192 groupopt
6193 group:
6194 group-part
6195 group group-part
6196 group-part:
6197 if-section
6198 control-line
6199 text-line
6200 # non-directive
6201 if-section:
6202 if-group elif-groupsopt else-groupopt endif-line
6203 if-group:
6204 # if constant-expression new-line groupopt
6205 # ifdef identifier new-line groupopt
6206 # ifndef identifier new-line groupopt
6207 elif-groups:
6208 elif-group
6209 elif-groups elif-group
6210 elif-group:
6211 # elif constant-expression new-line groupopt
6212 else-group:
6213 # else new-line groupopt
6214 endif-line:
6215 # endif new-line
6220 [<a name="p145" href="#p145">page 145</a>] (<a href="#Contents">Contents</a>)
6222 control-line:
6223 # include pp-tokens new-line
6224 # define identifier replacement-list new-line
6225 # define identifier lparen identifier-listopt )
6226 replacement-list new-line
6227 # define identifier lparen ... ) replacement-list new-line
6228 # define identifier lparen identifier-list , ... )
6229 replacement-list new-line
6230 # undef identifier new-line
6231 # line pp-tokens new-line
6232 # error pp-tokensopt new-line
6233 # pragma pp-tokensopt new-line
6234 # new-line
6235 text-line:
6236 pp-tokensopt new-line
6237 non-directive:
6238 pp-tokens new-line
6239 lparen:
6240 a ( character not immediately preceded by white-space
6241 replacement-list:
6242 pp-tokensopt
6243 pp-tokens:
6244 preprocessing-token
6245 pp-tokens preprocessing-token
6246 new-line:
6247 the new-line character
6248 Description
6249 2 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
6250 following constraints: The first token in the sequence is a # preprocessing token that (at
6251 the start of translation phase 4) is either the first character in the source file (optionally
6252 after white space containing no new-line characters) or that follows white space
6253 containing at least one new-line character. The last token in the sequence is the first new-
6254 line character that follows the first token in the sequence.143) A new-line character ends
6255 the preprocessing directive even if it occurs within what would otherwise be an
6257 143) Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
6258 significance, as all white space is equivalent except in certain situations during preprocessing (see the
6259 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
6261 [<a name="p146" href="#p146">page 146</a>] (<a href="#Contents">Contents</a>)
6263 invocation of a function-like macro.
6264 3 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
6265 with any of the directive names appearing in the syntax.
6266 4 When in a group that is skipped (<a href="#6.10.1">6.10.1</a>), the directive syntax is relaxed to allow any
6267 sequence of preprocessing tokens to occur between the directive name and the following
6268 new-line character.
6269 Constraints
6270 5 The only white-space characters that shall appear between preprocessing tokens within a
6271 preprocessing directive (from just after the introducing # preprocessing token through
6272 just before the terminating new-line character) are space and horizontal-tab (including
6273 spaces that have replaced comments or possibly other white-space characters in
6274 translation phase 3).
6275 Semantics
6276 6 The implementation can process and skip sections of source files conditionally, include
6277 other source files, and replace macros. These capabilities are called preprocessing,
6278 because conceptually they occur before translation of the resulting translation unit.
6279 7 The preprocessing tokens within a preprocessing directive are not subject to macro
6280 expansion unless otherwise stated.
6281 8 EXAMPLE In:
6282 #define EMPTY
6283 EMPTY # include &lt;file.h&gt;
6284 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
6285 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
6286 replaced.
6288 <a name="6.10.1" href="#6.10.1"><b> 6.10.1 Conditional inclusion</b></a>
6289 Constraints
6290 1 The expression that controls conditional inclusion shall be an integer constant expression
6291 except that: it shall not contain a cast; identifiers (including those lexically identical to
6292 keywords) are interpreted as described below;144) and it may contain unary operator
6293 expressions of the form
6298 144) Because the controlling constant expression is evaluated during translation phase 4, all identifiers
6299 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
6301 [<a name="p147" href="#p147">page 147</a>] (<a href="#Contents">Contents</a>)
6303 defined identifier
6305 defined ( identifier )
6306 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
6307 predefined or if it has been the subject of a #define preprocessing directive without an
6308 intervening #undef directive with the same subject identifier), 0 if it is not.
6309 2 Each preprocessing token that remains (in the list of preprocessing tokens that will
6310 become the controlling expression) after all macro replacements have occurred shall be in
6311 the lexical form of a token (<a href="#6.4">6.4</a>).
6312 Semantics
6313 3 Preprocessing directives of the forms
6314 # if constant-expression new-line groupopt
6315 # elif constant-expression new-line groupopt
6316 check whether the controlling constant expression evaluates to nonzero.
6317 4 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
6318 the controlling constant expression are replaced (except for those macro names modified
6319 by the defined unary operator), just as in normal text. If the token defined is
6320 generated as a result of this replacement process or use of the defined unary operator
6321 does not match one of the two specified forms prior to macro replacement, the behavior is
6322 undefined. After all replacements due to macro expansion and the defined unary
6323 operator have been performed, all remaining identifiers (including those lexically
6324 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
6325 token is converted into a token. The resulting tokens compose the controlling constant
6326 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
6327 token conversion and evaluation, all signed integer types and all unsigned integer types
6328 act as if they have the same representation as, respectively, the types intmax_t and
6329 uintmax_t defined in the header <a href="#7.18">&lt;stdint.h&gt;</a>.145) This includes interpreting
6330 character constants, which may involve converting escape sequences into execution
6331 character set members. Whether the numeric value for these character constants matches
6332 the value obtained when an identical character constant occurs in an expression (other
6333 than within a #if or #elif directive) is implementation-defined.146) Also, whether a
6334 single-character character constant may have a negative value is implementation-defined.
6335 5 Preprocessing directives of the forms
6339 145) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
6340 0x8000 is signed and positive within a #if expression even though it would be unsigned in
6341 translation phase 7.
6343 [<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
6345 # ifdef identifier new-line groupopt
6346 # ifndef identifier new-line groupopt
6347 check whether the identifier is or is not currently defined as a macro name. Their
6348 conditions are equivalent to #if defined identifier and #if !defined identifier
6349 respectively.
6350 6 Each directive's condition is checked in order. If it evaluates to false (zero), the group
6351 that it controls is skipped: directives are processed only through the name that determines
6352 the directive in order to keep track of the level of nested conditionals; the rest of the
6353 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
6354 group. Only the first group whose control condition evaluates to true (nonzero) is
6355 processed. If none of the conditions evaluates to true, and there is a #else directive, the
6356 group controlled by the #else is processed; lacking a #else directive, all the groups
6357 until the #endif are skipped.147)
6358 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>), source file inclusion (<a href="#6.10.2">6.10.2</a>), largest
6359 integer types (<a href="#7.18.1.5">7.18.1.5</a>).
6360 <a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
6361 Constraints
6362 1 A #include directive shall identify a header or source file that can be processed by the
6363 implementation.
6364 Semantics
6365 2 A preprocessing directive of the form
6366 # include &lt;h-char-sequence&gt; new-line
6367 searches a sequence of implementation-defined places for a header identified uniquely by
6368 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
6369 directive by the entire contents of the header. How the places are specified or the header
6370 identified is implementation-defined.
6371 3 A preprocessing directive of the form
6375 146) Thus, the constant expression in the following #if directive and if statement is not guaranteed to
6376 evaluate to the same value in these two contexts.
6377 #if 'z' - 'a' == 25
6378 if ('z' - 'a' == 25)
6380 147) As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
6381 before the terminating new-line character. However, comments may appear anywhere in a source file,
6382 including within a preprocessing directive.
6384 [<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
6386 # include "q-char-sequence" new-line
6387 causes the replacement of that directive by the entire contents of the source file identified
6388 by the specified sequence between the " delimiters. The named source file is searched
6389 for in an implementation-defined manner. If this search is not supported, or if the search
6390 fails, the directive is reprocessed as if it read
6391 # include &lt;h-char-sequence&gt; new-line
6392 with the identical contained sequence (including &gt; characters, if any) from the original
6393 directive.
6394 4 A preprocessing directive of the form
6395 # include pp-tokens new-line
6396 (that does not match one of the two previous forms) is permitted. The preprocessing
6397 tokens after include in the directive are processed just as in normal text. (Each
6398 identifier currently defined as a macro name is replaced by its replacement list of
6399 preprocessing tokens.) The directive resulting after all replacements shall match one of
6400 the two previous forms.148) The method by which a sequence of preprocessing tokens
6401 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
6402 single header name preprocessing token is implementation-defined.
6403 5 The implementation shall provide unique mappings for sequences consisting of one or
6404 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
6405 first character shall not be a digit. The implementation may ignore distinctions of
6406 alphabetical case and restrict the mapping to eight significant characters before the
6407 period.
6408 6 A #include preprocessing directive may appear in a source file that has been read
6409 because of a #include directive in another file, up to an implementation-defined
6410 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
6411 7 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
6412 #include <a href="#7.19">&lt;stdio.h&gt;</a>
6413 #include "myprog.h"
6415 8 EXAMPLE 2 This illustrates macro-replaced #include directives:
6420 148) Note that adjacent string literals are not concatenated into a single string literal (see the translation
6421 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.
6423 [<a name="p150" href="#p150">page 150</a>] (<a href="#Contents">Contents</a>)
6425 #if VERSION == 1
6426 #define INCFILE "vers1.h"
6427 #elif VERSION == 2
6428 #define INCFILE "vers2.h" // and so on
6429 #else
6430 #define INCFILE "versN.h"
6431 #endif
6432 #include INCFILE
6434 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>).
6435 <a name="6.10.3" href="#6.10.3"><b> 6.10.3 Macro replacement</b></a>
6436 Constraints
6437 1 Two replacement lists are identical if and only if the preprocessing tokens in both have
6438 the same number, ordering, spelling, and white-space separation, where all white-space
6439 separations are considered identical.
6440 2 An identifier currently defined as an object-like macro shall not be redefined by another
6441 #define preprocessing directive unless the second definition is an object-like macro
6442 definition and the two replacement lists are identical. Likewise, an identifier currently
6443 defined as a function-like macro shall not be redefined by another #define
6444 preprocessing directive unless the second definition is a function-like macro definition
6445 that has the same number and spelling of parameters, and the two replacement lists are
6446 identical.
6447 3 There shall be white-space between the identifier and the replacement list in the definition
6448 of an object-like macro.
6449 4 If the identifier-list in the macro definition does not end with an ellipsis, the number of
6450 arguments (including those arguments consisting of no preprocessing tokens) in an
6451 invocation of a function-like macro shall equal the number of parameters in the macro
6452 definition. Otherwise, there shall be more arguments in the invocation than there are
6453 parameters in the macro definition (excluding the ...). There shall exist a )
6454 preprocessing token that terminates the invocation.
6455 5 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
6456 macro that uses the ellipsis notation in the parameters.
6457 6 A parameter identifier in a function-like macro shall be uniquely declared within its
6458 scope.
6459 Semantics
6460 7 The identifier immediately following the define is called the macro name. There is one
6461 name space for macro names. Any white-space characters preceding or following the
6462 replacement list of preprocessing tokens are not considered part of the replacement list
6463 for either form of macro.
6465 [<a name="p151" href="#p151">page 151</a>] (<a href="#Contents">Contents</a>)
6467 8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
6468 a preprocessing directive could begin, the identifier is not subject to macro replacement.
6469 9 A preprocessing directive of the form
6470 # define identifier replacement-list new-line
6471 defines an object-like macro that causes each subsequent instance of the macro name149)
6472 to be replaced by the replacement list of preprocessing tokens that constitute the
6473 remainder of the directive. The replacement list is then rescanned for more macro names
6474 as specified below.
6475 10 A preprocessing directive of the form
6476 # define identifier lparen identifier-listopt ) replacement-list new-line
6477 # define identifier lparen ... ) replacement-list new-line
6478 # define identifier lparen identifier-list , ... ) replacement-list new-line
6479 defines a function-like macro with parameters, whose use is similar syntactically to a
6480 function call. The parameters are specified by the optional list of identifiers, whose scope
6481 extends from their declaration in the identifier list until the new-line character that
6482 terminates the #define preprocessing directive. Each subsequent instance of the
6483 function-like macro name followed by a ( as the next preprocessing token introduces the
6484 sequence of preprocessing tokens that is replaced by the replacement list in the definition
6485 (an invocation of the macro). The replaced sequence of preprocessing tokens is
6486 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
6487 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
6488 tokens making up an invocation of a function-like macro, new-line is considered a normal
6489 white-space character.
6490 11 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
6491 forms the list of arguments for the function-like macro. The individual arguments within
6492 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
6493 between matching inner parentheses do not separate arguments. If there are sequences of
6494 preprocessing tokens within the list of arguments that would otherwise act as
6495 preprocessing directives,150) the behavior is undefined.
6496 12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
6497 including any separating comma preprocessing tokens, are merged to form a single item:
6498 the variable arguments. The number of arguments so combined is such that, following
6501 149) Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
6502 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
6503 are never scanned for macro names or parameters.
6504 150) Despite the name, a non-directive is a preprocessing directive.
6506 [<a name="p152" href="#p152">page 152</a>] (<a href="#Contents">Contents</a>)
6508 merger, the number of arguments is one more than the number of parameters in the macro
6509 definition (excluding the ...).
6510 <a name="6.10.3.1" href="#6.10.3.1"><b> 6.10.3.1 Argument substitution</b></a>
6511 1 After the arguments for the invocation of a function-like macro have been identified,
6512 argument substitution takes place. A parameter in the replacement list, unless preceded
6513 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
6514 replaced by the corresponding argument after all macros contained therein have been
6515 expanded. Before being substituted, each argument's preprocessing tokens are
6516 completely macro replaced as if they formed the rest of the preprocessing file; no other
6517 preprocessing tokens are available.
6518 2 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
6519 were a parameter, and the variable arguments shall form the preprocessing tokens used to
6520 replace it.
6521 <a name="6.10.3.2" href="#6.10.3.2"><b> 6.10.3.2 The # operator</b></a>
6522 Constraints
6523 1 Each # preprocessing token in the replacement list for a function-like macro shall be
6524 followed by a parameter as the next preprocessing token in the replacement list.
6525 Semantics
6526 2 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
6527 token, both are replaced by a single character string literal preprocessing token that
6528 contains the spelling of the preprocessing token sequence for the corresponding
6529 argument. Each occurrence of white space between the argument's preprocessing tokens
6530 becomes a single space character in the character string literal. White space before the
6531 first preprocessing token and after the last preprocessing token composing the argument
6532 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
6533 is retained in the character string literal, except for special handling for producing the
6534 spelling of string literals and character constants: a \ character is inserted before each "
6535 and \ character of a character constant or string literal (including the delimiting "
6536 characters), except that it is implementation-defined whether a \ character is inserted
6537 before the \ character beginning a universal character name. If the replacement that
6538 results is not a valid character string literal, the behavior is undefined. The character
6539 string literal corresponding to an empty argument is "". The order of evaluation of # and
6540 ## operators is unspecified.
6545 [<a name="p153" href="#p153">page 153</a>] (<a href="#Contents">Contents</a>)
6547 <a name="6.10.3.3" href="#6.10.3.3"><b> 6.10.3.3 The ## operator</b></a>
6548 Constraints
6549 1 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
6550 list for either form of macro definition.
6551 Semantics
6552 2 If, in the replacement list of a function-like macro, a parameter is immediately preceded
6553 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
6554 argument's preprocessing token sequence; however, if an argument consists of no
6555 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
6556 instead.151)
6557 3 For both object-like and function-like macro invocations, before the replacement list is
6558 reexamined for more macro names to replace, each instance of a ## preprocessing token
6559 in the replacement list (not from an argument) is deleted and the preceding preprocessing
6560 token is concatenated with the following preprocessing token. Placemarker
6561 preprocessing tokens are handled specially: concatenation of two placemarkers results in
6562 a single placemarker preprocessing token, and concatenation of a placemarker with a
6563 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
6564 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
6565 token is available for further macro replacement. The order of evaluation of ## operators
6566 is unspecified.
6567 4 EXAMPLE In the following fragment:
6568 #define hash_hash # ## #
6569 #define mkstr(a) # a
6570 #define in_between(a) mkstr(a)
6571 #define join(c, d) in_between(c hash_hash d)
6572 char p[] = join(x, y); // equivalent to
6573 // char p[] = "x ## y";
6574 The expansion produces, at various stages:
6575 join(x, y)
6576 in_between(x hash_hash y)
6577 in_between(x ## y)
6578 mkstr(x ## y)
6579 "x ## y"
6580 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
6581 this new token is not the ## operator.
6584 151) Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
6585 exist only within translation phase 4.
6587 [<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
6589 <a name="6.10.3.4" href="#6.10.3.4"><b> 6.10.3.4 Rescanning and further replacement</b></a>
6590 1 After all parameters in the replacement list have been substituted and # and ##
6591 processing has taken place, all placemarker preprocessing tokens are removed. Then, the
6592 resulting preprocessing token sequence is rescanned, along with all subsequent
6593 preprocessing tokens of the source file, for more macro names to replace.
6594 2 If the name of the macro being replaced is found during this scan of the replacement list
6595 (not including the rest of the source file's preprocessing tokens), it is not replaced.
6596 Furthermore, if any nested replacements encounter the name of the macro being replaced,
6597 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
6598 available for further replacement even if they are later (re)examined in contexts in which
6599 that macro name preprocessing token would otherwise have been replaced.
6600 3 The resulting completely macro-replaced preprocessing token sequence is not processed
6601 as a preprocessing directive even if it resembles one, but all pragma unary operator
6602 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
6603 <a name="6.10.3.5" href="#6.10.3.5"><b> 6.10.3.5 Scope of macro definitions</b></a>
6604 1 A macro definition lasts (independent of block structure) until a corresponding #undef
6605 directive is encountered or (if none is encountered) until the end of the preprocessing
6606 translation unit. Macro definitions have no significance after translation phase 4.
6607 2 A preprocessing directive of the form
6608 # undef identifier new-line
6609 causes the specified identifier no longer to be defined as a macro name. It is ignored if
6610 the specified identifier is not currently defined as a macro name.
6611 3 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
6612 #define TABSIZE 100
6613 int table[TABSIZE];
6615 4 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
6616 It has the advantages of working for any compatible types of the arguments and of generating in-line code
6617 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
6618 arguments a second time (including side effects) and generating more code than a function if invoked
6619 several times. It also cannot have its address taken, as it has none.
6620 #define max(a, b) ((a) &gt; (b) ? (a) : (b))
6621 The parentheses ensure that the arguments and the resulting expression are bound properly.
6626 [<a name="p155" href="#p155">page 155</a>] (<a href="#Contents">Contents</a>)
6628 5 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
6629 #define x 3
6630 #define f(a) f(x * (a))
6631 #undef x
6632 #define x 2
6633 #define g f
6634 #define z z[0]
6635 #define h g(~
6636 #define m(a) a(w)
6637 #define w 0,1
6638 #define t(a) a
6639 #define p() int
6640 #define q(x) x
6641 #define r(x,y) x ## y
6642 #define str(x) # x
6643 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
6644 g(x+(3,4)-w) | h 5) &amp; m
6645 (f)^m(m);
6646 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
6647 char c[2][6] = { str(hello), str() };
6648 results in
6649 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
6650 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
6651 int i[] = { 1, 23, 4, 5, };
6652 char c[2][6] = { "hello", "" };
6654 6 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
6655 sequence
6656 #define str(s) # s
6657 #define xstr(s) str(s)
6658 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
6659 x ## s, x ## t)
6660 #define INCFILE(n) vers ## n
6661 #define glue(a, b) a ## b
6662 #define xglue(a, b) glue(a, b)
6663 #define HIGHLOW "hello"
6664 #define LOW LOW ", world"
6665 debug(1, 2);
6666 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
6667 == 0) str(: @\n), s);
6668 #include xstr(INCFILE(2).h)
6669 glue(HIGH, LOW);
6670 xglue(HIGH, LOW)
6671 results in
6676 [<a name="p156" href="#p156">page 156</a>] (<a href="#Contents">Contents</a>)
6678 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
6679 fputs(
6680 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
6682 #include "vers2.h" (after macro replacement, before file access)
6683 "hello";
6684 "hello" ", world"
6685 or, after concatenation of the character string literals,
6686 printf("x1= %d, x2= %s", x1, x2);
6687 fputs(
6688 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
6690 #include "vers2.h" (after macro replacement, before file access)
6691 "hello";
6692 "hello, world"
6693 Space around the # and ## tokens in the macro definition is optional.
6695 7 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
6696 #define t(x,y,z) x ## y ## z
6697 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
6698 t(10,,), t(,11,), t(,,12), t(,,) };
6699 results in
6700 int j[] = { 123, 45, 67, 89,
6701 10, 11, 12, };
6703 8 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
6704 #define OBJ_LIKE (1-1)
6705 #define OBJ_LIKE /* white space */ (1-1) /* other */
6706 #define FUNC_LIKE(a) ( a )
6707 #define FUNC_LIKE( a )( /* note the white space */ \
6708 a /* other stuff on this line
6709 */ )
6710 But the following redefinitions are invalid:
6711 #define OBJ_LIKE (0) // different token sequence
6712 #define OBJ_LIKE (1 - 1) // different white space
6713 #define FUNC_LIKE(b) ( a ) // different parameter usage
6714 #define FUNC_LIKE(b) ( b ) // different parameter spelling
6716 9 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
6717 #define debug(...) fprintf(stderr, __VA_ARGS__)
6718 #define showlist(...) puts(#__VA_ARGS__)
6719 #define report(test, ...) ((test)?puts(#test):\
6720 printf(__VA_ARGS__))
6721 debug("Flag");
6722 debug("X = %d\n", x);
6723 showlist(The first, second, and third items.);
6724 report(x&gt;y, "x is %d but y is %d", x, y);
6727 [<a name="p157" href="#p157">page 157</a>] (<a href="#Contents">Contents</a>)
6729 results in
6730 fprintf(stderr, "Flag" );
6731 fprintf(stderr, "X = %d\n", x );
6732 puts( "The first, second, and third items." );
6733 ((x&gt;y)?puts("x&gt;y"):
6734 printf("x is %d but y is %d", x, y));
6736 <a name="6.10.4" href="#6.10.4"><b> 6.10.4 Line control</b></a>
6737 Constraints
6738 1 The string literal of a #line directive, if present, shall be a character string literal.
6739 Semantics
6740 2 The line number of the current source line is one greater than the number of new-line
6741 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
6742 file to the current token.
6743 3 A preprocessing directive of the form
6744 # line digit-sequence new-line
6745 causes the implementation to behave as if the following sequence of source lines begins
6746 with a source line that has a line number as specified by the digit sequence (interpreted as
6747 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
6748 2147483647.
6749 4 A preprocessing directive of the form
6750 # line digit-sequence "s-char-sequenceopt" new-line
6751 sets the presumed line number similarly and changes the presumed name of the source
6752 file to be the contents of the character string literal.
6753 5 A preprocessing directive of the form
6754 # line pp-tokens new-line
6755 (that does not match one of the two previous forms) is permitted. The preprocessing
6756 tokens after line on the directive are processed just as in normal text (each identifier
6757 currently defined as a macro name is replaced by its replacement list of preprocessing
6758 tokens). The directive resulting after all replacements shall match one of the two
6759 previous forms and is then processed as appropriate.
6764 [<a name="p158" href="#p158">page 158</a>] (<a href="#Contents">Contents</a>)
6766 <a name="6.10.5" href="#6.10.5"><b> 6.10.5 Error directive</b></a>
6767 Semantics
6768 1 A preprocessing directive of the form
6769 # error pp-tokensopt new-line
6770 causes the implementation to produce a diagnostic message that includes the specified
6771 sequence of preprocessing tokens.
6772 <a name="6.10.6" href="#6.10.6"><b> 6.10.6 Pragma directive</b></a>
6773 Semantics
6774 1 A preprocessing directive of the form
6775 # pragma pp-tokensopt new-line
6776 where the preprocessing token STDC does not immediately follow pragma in the
6777 directive (prior to any macro replacement)152) causes the implementation to behave in an
6778 implementation-defined manner. The behavior might cause translation to fail or cause the
6779 translator or the resulting program to behave in a non-conforming manner. Any such
6780 pragma that is not recognized by the implementation is ignored.
6781 2 If the preprocessing token STDC does immediately follow pragma in the directive (prior
6782 to any macro replacement), then no macro replacement is performed on the directive, and
6783 the directive shall have one of the following forms153) whose meanings are described
6784 elsewhere:
6785 #pragma STDC FP_CONTRACT on-off-switch
6786 #pragma STDC FENV_ACCESS on-off-switch
6787 #pragma STDC CX_LIMITED_RANGE on-off-switch
6788 on-off-switch: one of
6789 ON OFF DEFAULT
6790 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
6791 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
6796 152) An implementation is not required to perform macro replacement in pragmas, but it is permitted
6797 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
6798 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
6799 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
6800 but is not required to.
6801 153) See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
6803 [<a name="p159" href="#p159">page 159</a>] (<a href="#Contents">Contents</a>)
6805 <a name="6.10.7" href="#6.10.7"><b> 6.10.7 Null directive</b></a>
6806 Semantics
6807 1 A preprocessing directive of the form
6808 # new-line
6809 has no effect.
6810 <a name="6.10.8" href="#6.10.8"><b> 6.10.8 Predefined macro names</b></a>
6811 1 The following macro names154) shall be defined by the implementation:
6812 __DATE__ The date of translation of the preprocessing translation unit: a character
6813 string literal of the form "Mmm dd yyyy", where the names of the
6814 months are the same as those generated by the asctime function, and the
6815 first character of dd is a space character if the value is less than 10. If the
6816 date of translation is not available, an implementation-defined valid date
6817 shall be supplied.
6818 __FILE__ The presumed name of the current source file (a character string literal).155)
6819 __LINE__ The presumed line number (within the current source file) of the current
6820 source line (an integer constant).155)
6821 __STDC__ The integer constant 1, intended to indicate a conforming implementation.
6822 __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
6823 implementation or the integer constant 0 if it is not.
6824 __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
6825 the encoding for wchar_t, a member of the basic character set need not
6826 have a code value equal to its value when used as the lone character in an
6827 integer character constant.
6828 __STDC_VERSION__ The integer constant 199901L.156)
6829 __TIME__ The time of translation of the preprocessing translation unit: a character
6830 string literal of the form "hh:mm:ss" as in the time generated by the
6831 asctime function. If the time of translation is not available, an
6832 implementation-defined valid time shall be supplied.
6836 154) See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
6837 155) The presumed source file name and line number can be changed by the #line directive.
6838 156) This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
6839 ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
6840 int that is increased with each revision of this International Standard.
6842 [<a name="p160" href="#p160">page 160</a>] (<a href="#Contents">Contents</a>)
6844 2 The following macro names are conditionally defined by the implementation:
6845 __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
6846 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
6847 __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
6848 adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
6849 compatible complex arithmetic).
6850 __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
6851 199712L). If this symbol is defined, then every character in the Unicode
6852 required set, when stored in an object of type wchar_t, has the same
6853 value as the short identifier of that character. The Unicode required set
6854 consists of all the characters that are defined by ISO/IEC 10646, along with
6855 all amendments and technical corrigenda, as of the specified year and
6856 month.
6857 3 The values of the predefined macros (except for __FILE__ and __LINE__) remain
6858 constant throughout the translation unit.
6859 4 None of these macro names, nor the identifier defined, shall be the subject of a
6860 #define or a #undef preprocessing directive. Any other predefined macro names
6861 shall begin with a leading underscore followed by an uppercase letter or a second
6862 underscore.
6863 5 The implementation shall not predefine the macro __cplusplus, nor shall it define it
6864 in any standard header.
6865 Forward references: the asctime function (<a href="#7.23.3.1">7.23.3.1</a>), standard headers (<a href="#7.1.2">7.1.2</a>).
6866 <a name="6.10.9" href="#6.10.9"><b> 6.10.9 Pragma operator</b></a>
6867 Semantics
6868 1 A unary operator expression of the form:
6869 _Pragma ( string-literal )
6870 is processed as follows: The string literal is destringized by deleting the L prefix, if
6871 present, deleting the leading and trailing double-quotes, replacing each escape sequence
6872 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
6873 resulting sequence of characters is processed through translation phase 3 to produce
6874 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
6875 directive. The original four preprocessing tokens in the unary operator expression are
6876 removed.
6877 2 EXAMPLE A directive of the form:
6878 #pragma listing on "..\listing.dir"
6879 can also be expressed as:
6880 [<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
6882 _Pragma ( "listing on \"..\\listing.dir\"" )
6883 The latter form is processed in the same way whether it appears literally as shown, or results from macro
6884 replacement, as in:
6885 #define LISTING(x) PRAGMA(listing on #x)
6886 #define PRAGMA(x) _Pragma(#x)
6887 LISTING ( ..\listing.dir )
6892 [<a name="p162" href="#p162">page 162</a>] (<a href="#Contents">Contents</a>)
6894 <a name="6.11" href="#6.11"><b> 6.11 Future language directions</b></a>
6895 <a name="6.11.1" href="#6.11.1"><b> 6.11.1 Floating types</b></a>
6896 1 Future standardization may include additional floating-point types, including those with
6897 greater range, precision, or both than long double.
6898 <a name="6.11.2" href="#6.11.2"><b> 6.11.2 Linkages of identifiers</b></a>
6899 1 Declaring an identifier with internal linkage at file scope without the static storage-
6900 class specifier is an obsolescent feature.
6901 <a name="6.11.3" href="#6.11.3"><b> 6.11.3 External names</b></a>
6902 1 Restriction of the significance of an external name to fewer than 255 characters
6903 (considering each universal character name or extended source character as a single
6904 character) is an obsolescent feature that is a concession to existing implementations.
6905 <a name="6.11.4" href="#6.11.4"><b> 6.11.4 Character escape sequences</b></a>
6906 1 Lowercase letters as escape sequences are reserved for future standardization. Other
6907 characters may be used in extensions.
6908 <a name="6.11.5" href="#6.11.5"><b> 6.11.5 Storage-class specifiers</b></a>
6909 1 The placement of a storage-class specifier other than at the beginning of the declaration
6910 specifiers in a declaration is an obsolescent feature.
6911 <a name="6.11.6" href="#6.11.6"><b> 6.11.6 Function declarators</b></a>
6912 1 The use of function declarators with empty parentheses (not prototype-format parameter
6913 type declarators) is an obsolescent feature.
6914 <a name="6.11.7" href="#6.11.7"><b> 6.11.7 Function definitions</b></a>
6915 1 The use of function definitions with separate parameter identifier and declaration lists
6916 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
6917 <a name="6.11.8" href="#6.11.8"><b> 6.11.8 Pragma directives</b></a>
6918 1 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
6919 <a name="6.11.9" href="#6.11.9"><b> 6.11.9 Predefined macro names</b></a>
6920 1 Macro names beginning with __STDC_ are reserved for future standardization.
6925 [<a name="p163" href="#p163">page 163</a>] (<a href="#Contents">Contents</a>)
6928 <a name="7" href="#7"><b> 7. Library</b></a>
6930 <a name="7.1" href="#7.1"><b> 7.1 Introduction</b></a>
6931 <a name="7.1.1" href="#7.1.1"><b> 7.1.1 Definitions of terms</b></a>
6932 1 A string is a contiguous sequence of characters terminated by and including the first null
6933 character. The term multibyte string is sometimes used instead to emphasize special
6934 processing given to multibyte characters contained in the string or to avoid confusion
6935 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
6936 character. The length of a string is the number of bytes preceding the null character and
6937 the value of a string is the sequence of the values of the contained characters, in order.
6938 2 The decimal-point character is the character used by functions that convert floating-point
6939 numbers to or from character sequences to denote the beginning of the fractional part of
6940 such character sequences.157) It is represented in the text and examples by a period, but
6941 may be changed by the setlocale function.
6942 3 A null wide character is a wide character with code value zero.
6943 4 A wide string is a contiguous sequence of wide characters terminated by and including
6944 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
6945 addressed) wide character. The length of a wide string is the number of wide characters
6946 preceding the null wide character and the value of a wide string is the sequence of code
6947 values of the contained wide characters, in order.
6948 5 A shift sequence is a contiguous sequence of bytes within a multibyte string that
6949 (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
6950 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
6951 character.158)
6952 Forward references: character handling (<a href="#7.4">7.4</a>), the setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
6957 157) The functions that make use of the decimal-point character are the numeric conversion functions
6958 (<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>).
6959 158) For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
6960 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
6961 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
6962 implementation's choice.
6964 [<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
6966 <a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
6967 1 Each library function is declared, with a type that includes a prototype, in a header,159)
6968 whose contents are made available by the #include preprocessing directive. The
6969 header declares a set of related functions, plus any necessary types and additional macros
6970 needed to facilitate their use. Declarations of types described in this clause shall not
6971 include type qualifiers, unless explicitly stated otherwise.
6972 2 The standard headers are
6973 <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>
6974 <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>
6975 <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>
6976 <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>
6977 <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>
6978 <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>
6979 3 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
6980 provided as part of the implementation, is placed in any of the standard places that are
6981 searched for included source files, the behavior is undefined.
6982 4 Standard headers may be included in any order; each may be included more than once in
6983 a given scope, with no effect different from being included only once, except that the
6984 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
6985 used, a header shall be included outside of any external declaration or definition, and it
6986 shall first be included before the first reference to any of the functions or objects it
6987 declares, or to any of the types or macros it defines. However, if an identifier is declared
6988 or defined in more than one header, the second and subsequent associated headers may be
6989 included after the initial reference to the identifier. The program shall not have any
6990 macros with names lexically identical to keywords currently defined prior to the
6991 inclusion.
6992 5 Any definition of an object-like macro described in this clause shall expand to code that is
6993 fully protected by parentheses where necessary, so that it groups in an arbitrary
6994 expression as if it were a single identifier.
6995 6 Any declaration of a library function shall have external linkage.
6996 7 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
6997 Forward references: diagnostics (<a href="#7.2">7.2</a>).
7002 159) A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
7003 necessarily valid source file names.
7005 [<a name="p165" href="#p165">page 165</a>] (<a href="#Contents">Contents</a>)
7007 <a name="7.1.3" href="#7.1.3"><b> 7.1.3 Reserved identifiers</b></a>
7008 1 Each header declares or defines all identifiers listed in its associated subclause, and
7009 optionally declares or defines identifiers listed in its associated future library directions
7010 subclause and identifiers which are always reserved either for any use or for use as file
7011 scope identifiers.
7012 -- All identifiers that begin with an underscore and either an uppercase letter or another
7013 underscore are always reserved for any use.
7014 -- All identifiers that begin with an underscore are always reserved for use as identifiers
7015 with file scope in both the ordinary and tag name spaces.
7016 -- Each macro name in any of the following subclauses (including the future library
7017 directions) is reserved for use as specified if any of its associated headers is included;
7018 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
7019 -- All identifiers with external linkage in any of the following subclauses (including the
7020 future library directions) are always reserved for use as identifiers with external
7021 linkage.160)
7022 -- Each identifier with file scope listed in any of the following subclauses (including the
7023 future library directions) is reserved for use as a macro name and as an identifier with
7024 file scope in the same name space if any of its associated headers is included.
7025 2 No other identifiers are reserved. If the program declares or defines an identifier in a
7026 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
7027 identifier as a macro name, the behavior is undefined.
7028 3 If the program removes (with #undef) any macro definition of an identifier in the first
7029 group listed above, the behavior is undefined.
7030 <a name="7.1.4" href="#7.1.4"><b> 7.1.4 Use of library functions</b></a>
7031 1 Each of the following statements applies unless explicitly stated otherwise in the detailed
7032 descriptions that follow: If an argument to a function has an invalid value (such as a value
7033 outside the domain of the function, or a pointer outside the address space of the program,
7034 or a null pointer, or a pointer to non-modifiable storage when the corresponding
7035 parameter is not const-qualified) or a type (after promotion) not expected by a function
7036 with variable number of arguments, the behavior is undefined. If a function argument is
7037 described as being an array, the pointer actually passed to the function shall have a value
7038 such that all address computations and accesses to objects (that would be valid if the
7039 pointer did point to the first element of such an array) are in fact valid. Any function
7040 declared in a header may be additionally implemented as a function-like macro defined in
7042 160) The list of reserved identifiers with external linkage includes errno, math_errhandling,
7043 setjmp, and va_end.
7045 [<a name="p166" href="#p166">page 166</a>] (<a href="#Contents">Contents</a>)
7047 the header, so if a library function is declared explicitly when its header is included, one
7048 of the techniques shown below can be used to ensure the declaration is not affected by
7049 such a macro. Any macro definition of a function can be suppressed locally by enclosing
7050 the name of the function in parentheses, because the name is then not followed by the left
7051 parenthesis that indicates expansion of a macro function name. For the same syntactic
7052 reason, it is permitted to take the address of a library function even if it is also defined as
7053 a macro.161) The use of #undef to remove any macro definition will also ensure that an
7054 actual function is referred to. Any invocation of a library function that is implemented as
7055 a macro shall expand to code that evaluates each of its arguments exactly once, fully
7056 protected by parentheses where necessary, so it is generally safe to use arbitrary
7057 expressions as arguments.162) Likewise, those function-like macros described in the
7058 following subclauses may be invoked in an expression anywhere a function with a
7059 compatible return type could be called.163) All object-like macros listed as expanding to
7060 integer constant expressions shall additionally be suitable for use in #if preprocessing
7061 directives.
7062 2 Provided that a library function can be declared without reference to any type defined in a
7063 header, it is also permissible to declare the function and use it without including its
7064 associated header.
7065 3 There is a sequence point immediately before a library function returns.
7066 4 The functions in the standard library are not guaranteed to be reentrant and may modify
7067 objects with static storage duration.164)
7071 161) This means that an implementation shall provide an actual function for each library function, even if it
7072 also provides a macro for that function.
7073 162) Such macros might not contain the sequence points that the corresponding function calls do.
7074 163) Because external identifiers and some macro names beginning with an underscore are reserved,
7075 implementations may provide special semantics for such names. For example, the identifier
7076 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
7077 appropriate header could specify
7078 #define abs(x) _BUILTIN_abs(x)
7079 for a compiler whose code generator will accept it.
7080 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
7081 function may write
7082 #undef abs
7083 whether the implementation's header provides a macro implementation of abs or a built-in
7084 implementation. The prototype for the function, which precedes and is hidden by any macro
7085 definition, is thereby revealed also.
7086 164) Thus, a signal handler cannot, in general, call standard library functions.
7088 [<a name="p167" href="#p167">page 167</a>] (<a href="#Contents">Contents</a>)
7090 5 EXAMPLE The function atoi may be used in any of several ways:
7091 -- by use of its associated header (possibly generating a macro expansion)
7092 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
7093 const char *str;
7094 /* ... */
7095 i = atoi(str);
7096 -- by use of its associated header (assuredly generating a true function reference)
7097 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
7098 #undef atoi
7099 const char *str;
7100 /* ... */
7101 i = atoi(str);
7103 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
7104 const char *str;
7105 /* ... */
7106 i = (atoi)(str);
7107 -- by explicit declaration
7108 extern int atoi(const char *);
7109 const char *str;
7110 /* ... */
7111 i = atoi(str);
7116 [<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
7118 <a name="7.2" href="#7.2"><b> 7.2 Diagnostics &lt;assert.h&gt;</b></a>
7119 1 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert macro and refers to another macro,
7120 NDEBUG
7121 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
7122 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
7123 simply as
7124 #define assert(ignore) ((void)0)
7125 The assert macro is redefined according to the current state of NDEBUG each time that
7126 <a href="#7.2">&lt;assert.h&gt;</a> is included.
7127 2 The assert macro shall be implemented as a macro, not as an actual function. If the
7128 macro definition is suppressed in order to access an actual function, the behavior is
7129 undefined.
7130 <a name="7.2.1" href="#7.2.1"><b> 7.2.1 Program diagnostics</b></a>
7131 <a name="7.2.1.1" href="#7.2.1.1"><b> 7.2.1.1 The assert macro</b></a>
7132 Synopsis
7133 1 #include <a href="#7.2">&lt;assert.h&gt;</a>
7134 void assert(scalar expression);
7135 Description
7136 2 The assert macro puts diagnostic tests into programs; it expands to a void expression.
7137 When it is executed, if expression (which shall have a scalar type) is false (that is,
7138 compares equal to 0), the assert macro writes information about the particular call that
7139 failed (including the text of the argument, the name of the source file, the source line
7140 number, and the name of the enclosing function -- the latter are respectively the values of
7141 the preprocessing macros __FILE__ and __LINE__ and of the identifier
7142 __func__) on the standard error stream in an implementation-defined format.165) It
7143 then calls the abort function.
7144 Returns
7145 3 The assert macro returns no value.
7146 Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
7151 165) The message written might be of the form:
7152 Assertion failed: expression, function abc, file xyz, line nnn.
7155 [<a name="p169" href="#p169">page 169</a>] (<a href="#Contents">Contents</a>)
7157 <a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic &lt;complex.h&gt;</b></a>
7158 <a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
7159 1 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
7160 arithmetic.166) Each synopsis specifies a family of functions consisting of a principal
7161 function with one or more double complex parameters and a double complex or
7162 double return value; and other functions with the same name but with f and l suffixes
7163 which are corresponding functions with float and long double parameters and
7164 return values.
7165 2 The macro
7166 complex
7167 expands to _Complex; the macro
7168 _Complex_I
7169 expands to a constant expression of type const float _Complex, with the value of
7170 the imaginary unit.167)
7171 3 The macros
7172 imaginary
7174 _Imaginary_I
7175 are defined if and only if the implementation supports imaginary types;168) if defined,
7176 they expand to _Imaginary and a constant expression of type const float
7177 _Imaginary with the value of the imaginary unit.
7178 4 The macro
7180 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
7181 defined, I shall expand to _Complex_I.
7182 5 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
7183 redefine the macros complex, imaginary, and I.
7184 Forward references: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
7188 166) See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
7189 167) The imaginary unit is a number i such that i 2 = -1.
7190 168) A specification for imaginary types is in informative <a href="#G">annex G</a>.
7192 [<a name="p170" href="#p170">page 170</a>] (<a href="#Contents">Contents</a>)
7194 <a name="7.3.2" href="#7.3.2"><b> 7.3.2 Conventions</b></a>
7195 1 Values are interpreted as radians, not degrees. An implementation may set errno but is
7196 not required to.
7197 <a name="7.3.3" href="#7.3.3"><b> 7.3.3 Branch cuts</b></a>
7198 1 Some of the functions below have branch cuts, across which the function is
7199 discontinuous. For implementations with a signed zero (including all IEC 60559
7200 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
7201 one side of a cut from another so the function is continuous (except for format
7202 limitations) as the cut is approached from either side. For example, for the square root
7203 function, which has a branch cut along the negative real axis, the top of the cut, with
7204 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
7205 imaginary part -0, maps to the negative imaginary axis.
7206 2 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
7207 sides of branch cuts. These implementations shall map a cut so the function is continuous
7208 as the cut is approached coming around the finite endpoint of the cut in a counter
7209 clockwise direction. (Branch cuts for the functions specified here have just one finite
7210 endpoint.) For example, for the square root function, coming counter clockwise around
7211 the finite endpoint of the cut along the negative real axis approaches the cut from above,
7212 so the cut maps to the positive imaginary axis.
7213 <a name="7.3.4" href="#7.3.4"><b> 7.3.4 The CX_LIMITED_RANGE pragma</b></a>
7214 Synopsis
7215 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7216 #pragma STDC CX_LIMITED_RANGE on-off-switch
7217 Description
7218 2 The usual mathematical formulas for complex multiply, divide, and absolute value are
7219 problematic because of their treatment of infinities and because of undue overflow and
7220 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
7221 implementation that (where the state is ''on'') the usual mathematical formulas are
7222 acceptable.169) The pragma can occur either outside external declarations or preceding all
7223 explicit declarations and statements inside a compound statement. When outside external
7225 169) The purpose of the pragma is to allow the implementation to use the formulas:
7226 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
7227 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
7228 | x + iy | = sqrt: x 2 + y 2
7229 ???????????????
7230 where the programmer can determine they are safe.
7232 [<a name="p171" href="#p171">page 171</a>] (<a href="#Contents">Contents</a>)
7234 declarations, the pragma takes effect from its occurrence until another
7235 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
7236 When inside a compound statement, the pragma takes effect from its occurrence until
7237 another CX_LIMITED_RANGE pragma is encountered (including within a nested
7238 compound statement), or until the end of the compound statement; at the end of a
7239 compound statement the state for the pragma is restored to its condition just before the
7240 compound statement. If this pragma is used in any other context, the behavior is
7241 undefined. The default state for the pragma is ''off''.
7242 <a name="7.3.5" href="#7.3.5"><b> 7.3.5 Trigonometric functions</b></a>
7243 <a name="7.3.5.1" href="#7.3.5.1"><b> 7.3.5.1 The cacos functions</b></a>
7244 Synopsis
7245 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7246 double complex cacos(double complex z);
7247 float complex cacosf(float complex z);
7248 long double complex cacosl(long double complex z);
7249 Description
7250 2 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
7251 interval [-1, +1] along the real axis.
7252 Returns
7253 3 The cacos functions return the complex arc cosine value, in the range of a strip
7254 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
7255 real axis.
7256 <a name="7.3.5.2" href="#7.3.5.2"><b> 7.3.5.2 The casin functions</b></a>
7257 Synopsis
7258 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7259 double complex casin(double complex z);
7260 float complex casinf(float complex z);
7261 long double complex casinl(long double complex z);
7262 Description
7263 2 The casin functions compute the complex arc sine of z, with branch cuts outside the
7264 interval [-1, +1] along the real axis.
7265 Returns
7266 3 The casin functions return the complex arc sine value, in the range of a strip
7267 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
7268 along the real axis.
7270 [<a name="p172" href="#p172">page 172</a>] (<a href="#Contents">Contents</a>)
7272 <a name="7.3.5.3" href="#7.3.5.3"><b> 7.3.5.3 The catan functions</b></a>
7273 Synopsis
7274 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7275 double complex catan(double complex z);
7276 float complex catanf(float complex z);
7277 long double complex catanl(long double complex z);
7278 Description
7279 2 The catan functions compute the complex arc tangent of z, with branch cuts outside the
7280 interval [-i, +i] along the imaginary axis.
7281 Returns
7282 3 The catan functions return the complex arc tangent value, in the range of a strip
7283 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
7284 along the real axis.
7285 <a name="7.3.5.4" href="#7.3.5.4"><b> 7.3.5.4 The ccos functions</b></a>
7286 Synopsis
7287 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7288 double complex ccos(double complex z);
7289 float complex ccosf(float complex z);
7290 long double complex ccosl(long double complex z);
7291 Description
7292 2 The ccos functions compute the complex cosine of z.
7293 Returns
7294 3 The ccos functions return the complex cosine value.
7295 <a name="7.3.5.5" href="#7.3.5.5"><b> 7.3.5.5 The csin functions</b></a>
7296 Synopsis
7297 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7298 double complex csin(double complex z);
7299 float complex csinf(float complex z);
7300 long double complex csinl(long double complex z);
7301 Description
7302 2 The csin functions compute the complex sine of z.
7303 Returns
7304 3 The csin functions return the complex sine value.
7306 [<a name="p173" href="#p173">page 173</a>] (<a href="#Contents">Contents</a>)
7308 <a name="7.3.5.6" href="#7.3.5.6"><b> 7.3.5.6 The ctan functions</b></a>
7309 Synopsis
7310 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7311 double complex ctan(double complex z);
7312 float complex ctanf(float complex z);
7313 long double complex ctanl(long double complex z);
7314 Description
7315 2 The ctan functions compute the complex tangent of z.
7316 Returns
7317 3 The ctan functions return the complex tangent value.
7318 <a name="7.3.6" href="#7.3.6"><b> 7.3.6 Hyperbolic functions</b></a>
7319 <a name="7.3.6.1" href="#7.3.6.1"><b> 7.3.6.1 The cacosh functions</b></a>
7320 Synopsis
7321 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7322 double complex cacosh(double complex z);
7323 float complex cacoshf(float complex z);
7324 long double complex cacoshl(long double complex z);
7325 Description
7326 2 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
7327 cut at values less than 1 along the real axis.
7328 Returns
7329 3 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
7330 half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
7331 the imaginary axis.
7332 <a name="7.3.6.2" href="#7.3.6.2"><b> 7.3.6.2 The casinh functions</b></a>
7333 Synopsis
7334 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7335 double complex casinh(double complex z);
7336 float complex casinhf(float complex z);
7337 long double complex casinhl(long double complex z);
7338 Description
7339 2 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
7340 outside the interval [-i, +i] along the imaginary axis.
7343 [<a name="p174" href="#p174">page 174</a>] (<a href="#Contents">Contents</a>)
7345 Returns
7346 3 The casinh functions return the complex arc hyperbolic sine value, in the range of a
7347 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
7348 along the imaginary axis.
7349 <a name="7.3.6.3" href="#7.3.6.3"><b> 7.3.6.3 The catanh functions</b></a>
7350 Synopsis
7351 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7352 double complex catanh(double complex z);
7353 float complex catanhf(float complex z);
7354 long double complex catanhl(long double complex z);
7355 Description
7356 2 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
7357 cuts outside the interval [-1, +1] along the real axis.
7358 Returns
7359 3 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
7360 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
7361 along the imaginary axis.
7362 <a name="7.3.6.4" href="#7.3.6.4"><b> 7.3.6.4 The ccosh functions</b></a>
7363 Synopsis
7364 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7365 double complex ccosh(double complex z);
7366 float complex ccoshf(float complex z);
7367 long double complex ccoshl(long double complex z);
7368 Description
7369 2 The ccosh functions compute the complex hyperbolic cosine of z.
7370 Returns
7371 3 The ccosh functions return the complex hyperbolic cosine value.
7372 <a name="7.3.6.5" href="#7.3.6.5"><b> 7.3.6.5 The csinh functions</b></a>
7373 Synopsis
7374 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7375 double complex csinh(double complex z);
7376 float complex csinhf(float complex z);
7377 long double complex csinhl(long double complex z);
7380 [<a name="p175" href="#p175">page 175</a>] (<a href="#Contents">Contents</a>)
7382 Description
7383 2 The csinh functions compute the complex hyperbolic sine of z.
7384 Returns
7385 3 The csinh functions return the complex hyperbolic sine value.
7386 <a name="7.3.6.6" href="#7.3.6.6"><b> 7.3.6.6 The ctanh functions</b></a>
7387 Synopsis
7388 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7389 double complex ctanh(double complex z);
7390 float complex ctanhf(float complex z);
7391 long double complex ctanhl(long double complex z);
7392 Description
7393 2 The ctanh functions compute the complex hyperbolic tangent of z.
7394 Returns
7395 3 The ctanh functions return the complex hyperbolic tangent value.
7396 <a name="7.3.7" href="#7.3.7"><b> 7.3.7 Exponential and logarithmic functions</b></a>
7397 <a name="7.3.7.1" href="#7.3.7.1"><b> 7.3.7.1 The cexp functions</b></a>
7398 Synopsis
7399 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7400 double complex cexp(double complex z);
7401 float complex cexpf(float complex z);
7402 long double complex cexpl(long double complex z);
7403 Description
7404 2 The cexp functions compute the complex base-e exponential of z.
7405 Returns
7406 3 The cexp functions return the complex base-e exponential value.
7407 <a name="7.3.7.2" href="#7.3.7.2"><b> 7.3.7.2 The clog functions</b></a>
7408 Synopsis
7409 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7410 double complex clog(double complex z);
7411 float complex clogf(float complex z);
7412 long double complex clogl(long double complex z);
7416 [<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
7418 Description
7419 2 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
7420 cut along the negative real axis.
7421 Returns
7422 3 The clog functions return the complex natural logarithm value, in the range of a strip
7423 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
7424 imaginary axis.
7425 <a name="7.3.8" href="#7.3.8"><b> 7.3.8 Power and absolute-value functions</b></a>
7426 <a name="7.3.8.1" href="#7.3.8.1"><b> 7.3.8.1 The cabs functions</b></a>
7427 Synopsis
7428 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7429 double cabs(double complex z);
7430 float cabsf(float complex z);
7431 long double cabsl(long double complex z);
7432 Description
7433 2 The cabs functions compute the complex absolute value (also called norm, modulus, or
7434 magnitude) of z.
7435 Returns
7436 3 The cabs functions return the complex absolute value.
7437 <a name="7.3.8.2" href="#7.3.8.2"><b> 7.3.8.2 The cpow functions</b></a>
7438 Synopsis
7439 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7440 double complex cpow(double complex x, double complex y);
7441 float complex cpowf(float complex x, float complex y);
7442 long double complex cpowl(long double complex x,
7443 long double complex y);
7444 Description
7445 2 The cpow functions compute the complex power function xy , with a branch cut for the
7446 first parameter along the negative real axis.
7447 Returns
7448 3 The cpow functions return the complex power function value.
7453 [<a name="p177" href="#p177">page 177</a>] (<a href="#Contents">Contents</a>)
7455 <a name="7.3.8.3" href="#7.3.8.3"><b> 7.3.8.3 The csqrt functions</b></a>
7456 Synopsis
7457 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7458 double complex csqrt(double complex z);
7459 float complex csqrtf(float complex z);
7460 long double complex csqrtl(long double complex z);
7461 Description
7462 2 The csqrt functions compute the complex square root of z, with a branch cut along the
7463 negative real axis.
7464 Returns
7465 3 The csqrt functions return the complex square root value, in the range of the right half-
7466 plane (including the imaginary axis).
7467 <a name="7.3.9" href="#7.3.9"><b> 7.3.9 Manipulation functions</b></a>
7468 <a name="7.3.9.1" href="#7.3.9.1"><b> 7.3.9.1 The carg functions</b></a>
7469 Synopsis
7470 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7471 double carg(double complex z);
7472 float cargf(float complex z);
7473 long double cargl(long double complex z);
7474 Description
7475 2 The carg functions compute the argument (also called phase angle) of z, with a branch
7476 cut along the negative real axis.
7477 Returns
7478 3 The carg functions return the value of the argument in the interval [-pi , +pi ].
7479 <a name="7.3.9.2" href="#7.3.9.2"><b> 7.3.9.2 The cimag functions</b></a>
7480 Synopsis
7481 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7482 double cimag(double complex z);
7483 float cimagf(float complex z);
7484 long double cimagl(long double complex z);
7489 [<a name="p178" href="#p178">page 178</a>] (<a href="#Contents">Contents</a>)
7491 Description
7492 2 The cimag functions compute the imaginary part of z.170)
7493 Returns
7494 3 The cimag functions return the imaginary part value (as a real).
7495 <a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The conj functions</b></a>
7496 Synopsis
7497 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7498 double complex conj(double complex z);
7499 float complex conjf(float complex z);
7500 long double complex conjl(long double complex z);
7501 Description
7502 2 The conj functions compute the complex conjugate of z, by reversing the sign of its
7503 imaginary part.
7504 Returns
7505 3 The conj functions return the complex conjugate value.
7506 <a name="7.3.9.4" href="#7.3.9.4"><b> 7.3.9.4 The cproj functions</b></a>
7507 Synopsis
7508 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7509 double complex cproj(double complex z);
7510 float complex cprojf(float complex z);
7511 long double complex cprojl(long double complex z);
7512 Description
7513 2 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
7514 z except that all complex infinities (even those with one infinite part and one NaN part)
7515 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
7516 equivalent to
7517 INFINITY + I * copysign(0.0, cimag(z))
7518 Returns
7519 3 The cproj functions return the value of the projection onto the Riemann sphere.
7524 170) For a variable z of complex type, z == creal(z) + cimag(z)*I.
7526 [<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
7528 <a name="7.3.9.5" href="#7.3.9.5"><b> 7.3.9.5 The creal functions</b></a>
7529 Synopsis
7530 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7531 double creal(double complex z);
7532 float crealf(float complex z);
7533 long double creall(long double complex z);
7534 Description
7535 2 The creal functions compute the real part of z.171)
7536 Returns
7537 3 The creal functions return the real part value.
7542 171) For a variable z of complex type, z == creal(z) + cimag(z)*I.
7544 [<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
7546 <a name="7.4" href="#7.4"><b> 7.4 Character handling &lt;ctype.h&gt;</b></a>
7547 1 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
7548 characters.172) In all cases the argument is an int, the value of which shall be
7549 representable as an unsigned char or shall equal the value of the macro EOF. If the
7550 argument has any other value, the behavior is undefined.
7551 2 The behavior of these functions is affected by the current locale. Those functions that
7552 have locale-specific aspects only when not in the "C" locale are noted below.
7553 3 The term printing character refers to a member of a locale-specific set of characters, each
7554 of which occupies one printing position on a display device; the term control character
7555 refers to a member of a locale-specific set of characters that are not printing
7556 characters.173) All letters and digits are printing characters.
7557 Forward references: EOF (<a href="#7.19.1">7.19.1</a>), localization (<a href="#7.11">7.11</a>).
7558 <a name="7.4.1" href="#7.4.1"><b> 7.4.1 Character classification functions</b></a>
7559 1 The functions in this subclause return nonzero (true) if and only if the value of the
7560 argument c conforms to that in the description of the function.
7561 <a name="7.4.1.1" href="#7.4.1.1"><b> 7.4.1.1 The isalnum function</b></a>
7562 Synopsis
7563 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7564 int isalnum(int c);
7565 Description
7566 2 The isalnum function tests for any character for which isalpha or isdigit is true.
7567 <a name="7.4.1.2" href="#7.4.1.2"><b> 7.4.1.2 The isalpha function</b></a>
7568 Synopsis
7569 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7570 int isalpha(int c);
7571 Description
7572 2 The isalpha function tests for any character for which isupper or islower is true,
7573 or any character that is one of a locale-specific set of alphabetic characters for which
7577 172) See ''future library directions'' (<a href="#7.26.2">7.26.2</a>).
7578 173) In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
7579 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
7580 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
7582 [<a name="p181" href="#p181">page 181</a>] (<a href="#Contents">Contents</a>)
7584 none of iscntrl, isdigit, ispunct, or isspace is true.174) In the "C" locale,
7585 isalpha returns true only for the characters for which isupper or islower is true.
7586 <a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
7587 Synopsis
7588 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7589 int isblank(int c);
7590 Description
7591 2 The isblank function tests for any character that is a standard blank character or is one
7592 of a locale-specific set of characters for which isspace is true and that is used to
7593 separate words within a line of text. The standard blank characters are the following:
7594 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
7595 for the standard blank characters.
7596 <a name="7.4.1.4" href="#7.4.1.4"><b> 7.4.1.4 The iscntrl function</b></a>
7597 Synopsis
7598 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7599 int iscntrl(int c);
7600 Description
7601 2 The iscntrl function tests for any control character.
7602 <a name="7.4.1.5" href="#7.4.1.5"><b> 7.4.1.5 The isdigit function</b></a>
7603 Synopsis
7604 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7605 int isdigit(int c);
7606 Description
7607 2 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
7608 <a name="7.4.1.6" href="#7.4.1.6"><b> 7.4.1.6 The isgraph function</b></a>
7609 Synopsis
7610 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7611 int isgraph(int c);
7616 174) The functions islower and isupper test true or false separately for each of these additional
7617 characters; all four combinations are possible.
7619 [<a name="p182" href="#p182">page 182</a>] (<a href="#Contents">Contents</a>)
7621 Description
7622 2 The isgraph function tests for any printing character except space (' ').
7623 <a name="7.4.1.7" href="#7.4.1.7"><b> 7.4.1.7 The islower function</b></a>
7624 Synopsis
7625 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7626 int islower(int c);
7627 Description
7628 2 The islower function tests for any character that is a lowercase letter or is one of a
7629 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
7630 isspace is true. In the "C" locale, islower returns true only for the lowercase
7631 letters (as defined in <a href="#5.2.1">5.2.1</a>).
7632 <a name="7.4.1.8" href="#7.4.1.8"><b> 7.4.1.8 The isprint function</b></a>
7633 Synopsis
7634 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7635 int isprint(int c);
7636 Description
7637 2 The isprint function tests for any printing character including space (' ').
7638 <a name="7.4.1.9" href="#7.4.1.9"><b> 7.4.1.9 The ispunct function</b></a>
7639 Synopsis
7640 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7641 int ispunct(int c);
7642 Description
7643 2 The ispunct function tests for any printing character that is one of a locale-specific set
7644 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
7645 locale, ispunct returns true for every printing character for which neither isspace
7646 nor isalnum is true.
7647 <a name="7.4.1.10" href="#7.4.1.10"><b> 7.4.1.10 The isspace function</b></a>
7648 Synopsis
7649 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7650 int isspace(int c);
7651 Description
7652 2 The isspace function tests for any character that is a standard white-space character or
7653 is one of a locale-specific set of characters for which isalnum is false. The standard
7655 [<a name="p183" href="#p183">page 183</a>] (<a href="#Contents">Contents</a>)
7657 white-space characters are the following: space (' '), form feed ('\f'), new-line
7658 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
7659 "C" locale, isspace returns true only for the standard white-space characters.
7660 <a name="7.4.1.11" href="#7.4.1.11"><b> 7.4.1.11 The isupper function</b></a>
7661 Synopsis
7662 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7663 int isupper(int c);
7664 Description
7665 2 The isupper function tests for any character that is an uppercase letter or is one of a
7666 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
7667 isspace is true. In the "C" locale, isupper returns true only for the uppercase
7668 letters (as defined in <a href="#5.2.1">5.2.1</a>).
7669 <a name="7.4.1.12" href="#7.4.1.12"><b> 7.4.1.12 The isxdigit function</b></a>
7670 Synopsis
7671 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7672 int isxdigit(int c);
7673 Description
7674 2 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
7675 <a name="7.4.2" href="#7.4.2"><b> 7.4.2 Character case mapping functions</b></a>
7676 <a name="7.4.2.1" href="#7.4.2.1"><b> 7.4.2.1 The tolower function</b></a>
7677 Synopsis
7678 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7679 int tolower(int c);
7680 Description
7681 2 The tolower function converts an uppercase letter to a corresponding lowercase letter.
7682 Returns
7683 3 If the argument is a character for which isupper is true and there are one or more
7684 corresponding characters, as specified by the current locale, for which islower is true,
7685 the tolower function returns one of the corresponding characters (always the same one
7686 for any given locale); otherwise, the argument is returned unchanged.
7691 [<a name="p184" href="#p184">page 184</a>] (<a href="#Contents">Contents</a>)
7693 <a name="7.4.2.2" href="#7.4.2.2"><b> 7.4.2.2 The toupper function</b></a>
7694 Synopsis
7695 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7696 int toupper(int c);
7697 Description
7698 2 The toupper function converts a lowercase letter to a corresponding uppercase letter.
7699 Returns
7700 3 If the argument is a character for which islower is true and there are one or more
7701 corresponding characters, as specified by the current locale, for which isupper is true,
7702 the toupper function returns one of the corresponding characters (always the same one
7703 for any given locale); otherwise, the argument is returned unchanged.
7708 [<a name="p185" href="#p185">page 185</a>] (<a href="#Contents">Contents</a>)
7710 <a name="7.5" href="#7.5"><b> 7.5 Errors &lt;errno.h&gt;</b></a>
7711 1 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
7712 conditions.
7713 2 The macros are
7714 EDOM
7715 EILSEQ
7716 ERANGE
7717 which expand to integer constant expressions with type int, distinct positive values, and
7718 which are suitable for use in #if preprocessing directives; and
7719 errno
7720 which expands to a modifiable lvalue175) that has type int, the value of which is set to a
7721 positive error number by several library functions. It is unspecified whether errno is a
7722 macro or an identifier declared with external linkage. If a macro definition is suppressed
7723 in order to access an actual object, or a program defines an identifier with the name
7724 errno, the behavior is undefined.
7725 3 The value of errno is zero at program startup, but is never set to zero by any library
7726 function.176) The value of errno may be set to nonzero by a library function call
7727 whether or not there is an error, provided the use of errno is not documented in the
7728 description of the function in this International Standard.
7729 4 Additional macro definitions, beginning with E and a digit or E and an uppercase
7730 letter,177) may also be specified by the implementation.
7735 175) The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
7736 resulting from a function call (for example, *errno()).
7737 176) Thus, a program that uses errno for error checking should set it to zero before a library function call,
7738 then inspect it before a subsequent library function call. Of course, a library function can save the
7739 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
7740 value is still zero just before the return.
7741 177) See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
7743 [<a name="p186" href="#p186">page 186</a>] (<a href="#Contents">Contents</a>)
7745 <a name="7.6" href="#7.6"><b> 7.6 Floating-point environment &lt;fenv.h&gt;</b></a>
7746 1 The header <a href="#7.6">&lt;fenv.h&gt;</a> declares two types and several macros and functions to provide
7747 access to the floating-point environment. The floating-point environment refers
7748 collectively to any floating-point status flags and control modes supported by the
7749 implementation.178) A floating-point status flag is a system variable whose value is set
7750 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
7751 of exceptional floating-point arithmetic to provide auxiliary information.179) A floating-
7752 point control mode is a system variable whose value may be set by the user to affect the
7753 subsequent behavior of floating-point arithmetic.
7754 2 Certain programming conventions support the intended model of use for the floating-
7755 point environment:180)
7756 -- a function call does not alter its caller's floating-point control modes, clear its caller's
7757 floating-point status flags, nor depend on the state of its caller's floating-point status
7758 flags unless the function is so documented;
7759 -- a function call is assumed to require default floating-point control modes, unless its
7760 documentation promises otherwise;
7761 -- a function call is assumed to have the potential for raising floating-point exceptions,
7762 unless its documentation promises otherwise.
7763 3 The type
7764 fenv_t
7765 represents the entire floating-point environment.
7766 4 The type
7767 fexcept_t
7768 represents the floating-point status flags collectively, including any status the
7769 implementation associates with the flags.
7774 178) This header is designed to support the floating-point exception status flags and directed-rounding
7775 control modes required by IEC 60559, and other similar floating-point state information. Also it is
7776 designed to facilitate code portability among all systems.
7777 179) A floating-point status flag is not an object and can be set more than once within an expression.
7778 180) With these conventions, a programmer can safely assume default floating-point control modes (or be
7779 unaware of them). The responsibilities associated with accessing the floating-point environment fall
7780 on the programmer or program that does so explicitly.
7782 [<a name="p187" href="#p187">page 187</a>] (<a href="#Contents">Contents</a>)
7784 5 Each of the macros
7785 FE_DIVBYZERO
7786 FE_INEXACT
7787 FE_INVALID
7788 FE_OVERFLOW
7789 FE_UNDERFLOW
7790 is defined if and only if the implementation supports the floating-point exception by
7791 means of the functions in 7.6.2.181) Additional implementation-defined floating-point
7792 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
7793 be specified by the implementation. The defined macros expand to integer constant
7794 expressions with values such that bitwise ORs of all combinations of the macros result in
7795 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
7796 zero.182)
7797 6 The macro
7798 FE_ALL_EXCEPT
7799 is simply the bitwise OR of all floating-point exception macros defined by the
7800 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
7801 7 Each of the macros
7802 FE_DOWNWARD
7803 FE_TONEAREST
7804 FE_TOWARDZERO
7805 FE_UPWARD
7806 is defined if and only if the implementation supports getting and setting the represented
7807 rounding direction by means of the fegetround and fesetround functions.
7808 Additional implementation-defined rounding directions, with macro definitions beginning
7809 with FE_ and an uppercase letter, may also be specified by the implementation. The
7810 defined macros expand to integer constant expressions whose values are distinct
7811 nonnegative values.183)
7812 8 The macro
7816 181) The implementation supports an exception if there are circumstances where a call to at least one of the
7817 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
7818 all the functions to succeed all the time.
7819 182) The macros should be distinct powers of two.
7820 183) Even though the rounding direction macros may expand to constants corresponding to the values of
7821 FLT_ROUNDS, they are not required to do so.
7823 [<a name="p188" href="#p188">page 188</a>] (<a href="#Contents">Contents</a>)
7825 FE_DFL_ENV
7826 represents the default floating-point environment -- the one installed at program startup
7827 -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
7828 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
7829 9 Additional implementation-defined environments, with macro definitions beginning with
7830 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
7831 also be specified by the implementation.
7832 <a name="7.6.1" href="#7.6.1"><b> 7.6.1 The FENV_ACCESS pragma</b></a>
7833 Synopsis
7834 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7835 #pragma STDC FENV_ACCESS on-off-switch
7836 Description
7837 2 The FENV_ACCESS pragma provides a means to inform the implementation when a
7838 program might access the floating-point environment to test floating-point status flags or
7839 run under non-default floating-point control modes.184) The pragma shall occur either
7840 outside external declarations or preceding all explicit declarations and statements inside a
7841 compound statement. When outside external declarations, the pragma takes effect from
7842 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
7843 the translation unit. When inside a compound statement, the pragma takes effect from its
7844 occurrence until another FENV_ACCESS pragma is encountered (including within a
7845 nested compound statement), or until the end of the compound statement; at the end of a
7846 compound statement the state for the pragma is restored to its condition just before the
7847 compound statement. If this pragma is used in any other context, the behavior is
7848 undefined. If part of a program tests floating-point status flags, sets floating-point control
7849 modes, or runs under non-default mode settings, but was translated with the state for the
7850 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
7851 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
7852 the program translated with FENV_ACCESS ''off'' to a part translated with
7853 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
7854 floating-point control modes have their default settings.)
7859 184) The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
7860 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
7861 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
7862 modes are in effect and the flags are not tested.
7864 [<a name="p189" href="#p189">page 189</a>] (<a href="#Contents">Contents</a>)
7866 3 EXAMPLE
7867 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7868 void f(double x)
7870 #pragma STDC FENV_ACCESS ON
7871 void g(double);
7872 void h(double);
7873 /* ... */
7874 g(x + 1);
7875 h(x + 1);
7876 /* ... */
7878 4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
7879 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
7880 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.185)
7882 <a name="7.6.2" href="#7.6.2"><b> 7.6.2 Floating-point exceptions</b></a>
7883 1 The following functions provide access to the floating-point status flags.186) The int
7884 input argument for the functions represents a subset of floating-point exceptions, and can
7885 be zero or the bitwise OR of one or more floating-point exception macros, for example
7886 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
7887 functions is undefined.
7888 <a name="7.6.2.1" href="#7.6.2.1"><b> 7.6.2.1 The feclearexcept function</b></a>
7889 Synopsis
7890 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7891 int feclearexcept(int excepts);
7892 Description
7893 2 The feclearexcept function attempts to clear the supported floating-point exceptions
7894 represented by its argument.
7895 Returns
7896 3 The feclearexcept function returns zero if the excepts argument is zero or if all
7897 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
7900 185) The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
7901 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
7902 ''off'', just one evaluation of x + 1 would suffice.
7903 186) The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
7904 abstraction of flags that are either set or clear. An implementation may endow floating-point status
7905 flags with more information -- for example, the address of the code which first raised the floating-
7906 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
7907 content of flags.
7909 [<a name="p190" href="#p190">page 190</a>] (<a href="#Contents">Contents</a>)
7911 <a name="7.6.2.2" href="#7.6.2.2"><b> 7.6.2.2 The fegetexceptflag function</b></a>
7912 Synopsis
7913 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7914 int fegetexceptflag(fexcept_t *flagp,
7915 int excepts);
7916 Description
7917 2 The fegetexceptflag function attempts to store an implementation-defined
7918 representation of the states of the floating-point status flags indicated by the argument
7919 excepts in the object pointed to by the argument flagp.
7920 Returns
7921 3 The fegetexceptflag function returns zero if the representation was successfully
7922 stored. Otherwise, it returns a nonzero value.
7923 <a name="7.6.2.3" href="#7.6.2.3"><b> 7.6.2.3 The feraiseexcept function</b></a>
7924 Synopsis
7925 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7926 int feraiseexcept(int excepts);
7927 Description
7928 2 The feraiseexcept function attempts to raise the supported floating-point exceptions
7929 represented by its argument.187) The order in which these floating-point exceptions are
7930 raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
7931 additionally raises the ''inexact'' floating-point exception whenever it raises the
7932 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
7933 Returns
7934 3 The feraiseexcept function returns zero if the excepts argument is zero or if all
7935 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
7940 187) The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
7941 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
7942 in <a href="#F.7.6">F.7.6</a> is in the same spirit.
7944 [<a name="p191" href="#p191">page 191</a>] (<a href="#Contents">Contents</a>)
7946 <a name="7.6.2.4" href="#7.6.2.4"><b> 7.6.2.4 The fesetexceptflag function</b></a>
7947 Synopsis
7948 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7949 int fesetexceptflag(const fexcept_t *flagp,
7950 int excepts);
7951 Description
7952 2 The fesetexceptflag function attempts to set the floating-point status flags
7953 indicated by the argument excepts to the states stored in the object pointed to by
7954 flagp. The value of *flagp shall have been set by a previous call to
7955 fegetexceptflag whose second argument represented at least those floating-point
7956 exceptions represented by the argument excepts. This function does not raise floating-
7957 point exceptions, but only sets the state of the flags.
7958 Returns
7959 3 The fesetexceptflag function returns zero if the excepts argument is zero or if
7960 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
7961 a nonzero value.
7962 <a name="7.6.2.5" href="#7.6.2.5"><b> 7.6.2.5 The fetestexcept function</b></a>
7963 Synopsis
7964 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7965 int fetestexcept(int excepts);
7966 Description
7967 2 The fetestexcept function determines which of a specified subset of the floating-
7968 point exception flags are currently set. The excepts argument specifies the floating-
7969 point status flags to be queried.188)
7970 Returns
7971 3 The fetestexcept function returns the value of the bitwise OR of the floating-point
7972 exception macros corresponding to the currently set floating-point exceptions included in
7973 excepts.
7974 4 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
7979 188) This mechanism allows testing several floating-point exceptions with just one function call.
7981 [<a name="p192" href="#p192">page 192</a>] (<a href="#Contents">Contents</a>)
7983 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7984 /* ... */
7986 #pragma STDC FENV_ACCESS ON
7987 int set_excepts;
7988 feclearexcept(FE_INVALID | FE_OVERFLOW);
7989 // maybe raise exceptions
7990 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
7991 if (set_excepts &amp; FE_INVALID) f();
7992 if (set_excepts &amp; FE_OVERFLOW) g();
7993 /* ... */
7996 <a name="7.6.3" href="#7.6.3"><b> 7.6.3 Rounding</b></a>
7997 1 The fegetround and fesetround functions provide control of rounding direction
7998 modes.
7999 <a name="7.6.3.1" href="#7.6.3.1"><b> 7.6.3.1 The fegetround function</b></a>
8000 Synopsis
8001 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8002 int fegetround(void);
8003 Description
8004 2 The fegetround function gets the current rounding direction.
8005 Returns
8006 3 The fegetround function returns the value of the rounding direction macro
8007 representing the current rounding direction or a negative value if there is no such
8008 rounding direction macro or the current rounding direction is not determinable.
8009 <a name="7.6.3.2" href="#7.6.3.2"><b> 7.6.3.2 The fesetround function</b></a>
8010 Synopsis
8011 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8012 int fesetround(int round);
8013 Description
8014 2 The fesetround function establishes the rounding direction represented by its
8015 argument round. If the argument is not equal to the value of a rounding direction macro,
8016 the rounding direction is not changed.
8017 Returns
8018 3 The fesetround function returns zero if and only if the requested rounding direction
8019 was established.
8022 [<a name="p193" href="#p193">page 193</a>] (<a href="#Contents">Contents</a>)
8024 4 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
8025 rounding direction fails.
8026 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8027 #include <a href="#7.2">&lt;assert.h&gt;</a>
8028 void f(int round_dir)
8030 #pragma STDC FENV_ACCESS ON
8031 int save_round;
8032 int setround_ok;
8033 save_round = fegetround();
8034 setround_ok = fesetround(round_dir);
8035 assert(setround_ok == 0);
8036 /* ... */
8037 fesetround(save_round);
8038 /* ... */
8041 <a name="7.6.4" href="#7.6.4"><b> 7.6.4 Environment</b></a>
8042 1 The functions in this section manage the floating-point environment -- status flags and
8043 control modes -- as one entity.
8044 <a name="7.6.4.1" href="#7.6.4.1"><b> 7.6.4.1 The fegetenv function</b></a>
8045 Synopsis
8046 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8047 int fegetenv(fenv_t *envp);
8048 Description
8049 2 The fegetenv function attempts to store the current floating-point environment in the
8050 object pointed to by envp.
8051 Returns
8052 3 The fegetenv function returns zero if the environment was successfully stored.
8053 Otherwise, it returns a nonzero value.
8054 <a name="7.6.4.2" href="#7.6.4.2"><b> 7.6.4.2 The feholdexcept function</b></a>
8055 Synopsis
8056 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8057 int feholdexcept(fenv_t *envp);
8058 Description
8059 2 The feholdexcept function saves the current floating-point environment in the object
8060 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
8061 (continue on floating-point exceptions) mode, if available, for all floating-point
8062 exceptions.189)
8064 [<a name="p194" href="#p194">page 194</a>] (<a href="#Contents">Contents</a>)
8066 Returns
8067 3 The feholdexcept function returns zero if and only if non-stop floating-point
8068 exception handling was successfully installed.
8069 <a name="7.6.4.3" href="#7.6.4.3"><b> 7.6.4.3 The fesetenv function</b></a>
8070 Synopsis
8071 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8072 int fesetenv(const fenv_t *envp);
8073 Description
8074 2 The fesetenv function attempts to establish the floating-point environment represented
8075 by the object pointed to by envp. The argument envp shall point to an object set by a
8076 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
8077 Note that fesetenv merely installs the state of the floating-point status flags
8078 represented through its argument, and does not raise these floating-point exceptions.
8079 Returns
8080 3 The fesetenv function returns zero if the environment was successfully established.
8081 Otherwise, it returns a nonzero value.
8082 <a name="7.6.4.4" href="#7.6.4.4"><b> 7.6.4.4 The feupdateenv function</b></a>
8083 Synopsis
8084 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8085 int feupdateenv(const fenv_t *envp);
8086 Description
8087 2 The feupdateenv function attempts to save the currently raised floating-point
8088 exceptions in its automatic storage, install the floating-point environment represented by
8089 the object pointed to by envp, and then raise the saved floating-point exceptions. The
8090 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
8091 or equal a floating-point environment macro.
8092 Returns
8093 3 The feupdateenv function returns zero if all the actions were successfully carried out.
8094 Otherwise, it returns a nonzero value.
8099 189) IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
8100 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
8101 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
8102 function to write routines that hide spurious floating-point exceptions from their callers.
8104 [<a name="p195" href="#p195">page 195</a>] (<a href="#Contents">Contents</a>)
8106 4 EXAMPLE Hide spurious underflow floating-point exceptions:
8107 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8108 double f(double x)
8110 #pragma STDC FENV_ACCESS ON
8111 double result;
8112 fenv_t save_env;
8113 if (feholdexcept(&amp;save_env))
8114 return /* indication of an environmental problem */;
8115 // compute result
8116 if (/* test spurious underflow */)
8117 if (feclearexcept(FE_UNDERFLOW))
8118 return /* indication of an environmental problem */;
8119 if (feupdateenv(&amp;save_env))
8120 return /* indication of an environmental problem */;
8121 return result;
8127 [<a name="p196" href="#p196">page 196</a>] (<a href="#Contents">Contents</a>)
8129 <a name="7.7" href="#7.7"><b> 7.7 Characteristics of floating types &lt;float.h&gt;</b></a>
8130 1 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
8131 parameters of the standard floating-point types.
8132 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
8133 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
8138 [<a name="p197" href="#p197">page 197</a>] (<a href="#Contents">Contents</a>)
8140 <a name="7.8" href="#7.8"><b> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
8141 1 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
8142 additional facilities provided by hosted implementations.
8143 2 It declares functions for manipulating greatest-width integers and converting numeric
8144 character strings to greatest-width integers, and it declares the type
8145 imaxdiv_t
8146 which is a structure type that is the type of the value returned by the imaxdiv function.
8147 For each type declared in <a href="#7.18">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
8148 specifiers for use with the formatted input/output functions.190)
8149 Forward references: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>), formatted input/output
8150 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>).
8151 <a name="7.8.1" href="#7.8.1"><b> 7.8.1 Macros for format specifiers</b></a>
8152 1 Each of the following object-like macros191) expands to a character string literal
8153 containing a conversion specifier, possibly modified by a length modifier, suitable for use
8154 within the format argument of a formatted input/output function when converting the
8155 corresponding integer type. These macro names have the general form of PRI (character
8156 string literals for the fprintf and fwprintf family) or SCN (character string literals
8157 for the fscanf and fwscanf family),192) followed by the conversion specifier,
8158 followed by a name corresponding to a similar type name in <a href="#7.18.1">7.18.1</a>. In these names, N
8159 represents the width of the type as described in <a href="#7.18.1">7.18.1</a>. For example, PRIdFAST32 can
8160 be used in a format string to print the value of an integer of type int_fast32_t.
8161 2 The fprintf macros for signed integers are:
8162 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
8163 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
8168 190) See ''future library directions'' (<a href="#7.26.4">7.26.4</a>).
8169 191) C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined
8170 before <a href="#7.8">&lt;inttypes.h&gt;</a> is included.
8171 192) Separate macros are given for use with fprintf and fscanf functions because, in the general case,
8172 different format specifiers may be required for fprintf and fscanf, even when the type is the
8173 same.
8175 [<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
8177 3 The fprintf macros for unsigned integers are:
8178 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
8179 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
8180 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
8181 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
8182 4 The fscanf macros for signed integers are:
8183 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
8184 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
8185 5 The fscanf macros for unsigned integers are:
8186 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
8187 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
8188 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
8189 6 For each type that the implementation provides in <a href="#7.18">&lt;stdint.h&gt;</a>, the corresponding
8190 fprintf macros shall be defined and the corresponding fscanf macros shall be
8191 defined unless the implementation does not have a suitable fscanf length modifier for
8192 the type.
8193 7 EXAMPLE
8194 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8195 #include <a href="#7.24">&lt;wchar.h&gt;</a>
8196 int main(void)
8198 uintmax_t i = UINTMAX_MAX; // this type always exists
8199 wprintf(L"The largest integer value is %020"
8200 PRIxMAX "\n", i);
8201 return 0;
8204 <a name="7.8.2" href="#7.8.2"><b> 7.8.2 Functions for greatest-width integer types</b></a>
8205 <a name="7.8.2.1" href="#7.8.2.1"><b> 7.8.2.1 The imaxabs function</b></a>
8206 Synopsis
8207 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8208 intmax_t imaxabs(intmax_t j);
8209 Description
8210 2 The imaxabs function computes the absolute value of an integer j. If the result cannot
8211 be represented, the behavior is undefined.193)
8215 193) The absolute value of the most negative number cannot be represented in two's complement.
8217 [<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
8219 Returns
8220 3 The imaxabs function returns the absolute value.
8221 <a name="7.8.2.2" href="#7.8.2.2"><b> 7.8.2.2 The imaxdiv function</b></a>
8222 Synopsis
8223 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8224 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
8225 Description
8226 2 The imaxdiv function computes numer / denom and numer % denom in a single
8227 operation.
8228 Returns
8229 3 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
8230 quotient and the remainder. The structure shall contain (in either order) the members
8231 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
8232 either part of the result cannot be represented, the behavior is undefined.
8233 <a name="7.8.2.3" href="#7.8.2.3"><b> 7.8.2.3 The strtoimax and strtoumax functions</b></a>
8234 Synopsis
8235 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8236 intmax_t strtoimax(const char * restrict nptr,
8237 char ** restrict endptr, int base);
8238 uintmax_t strtoumax(const char * restrict nptr,
8239 char ** restrict endptr, int base);
8240 Description
8241 2 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
8242 strtoul, and strtoull functions, except that the initial portion of the string is
8243 converted to intmax_t and uintmax_t representation, respectively.
8244 Returns
8245 3 The strtoimax and strtoumax functions return the converted value, if any. If no
8246 conversion could be performed, zero is returned. If the correct value is outside the range
8247 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
8248 (according to the return type and sign of the value, if any), and the value of the macro
8249 ERANGE is stored in errno.
8250 Forward references: the strtol, strtoll, strtoul, and strtoull functions
8251 (<a href="#7.20.1.4">7.20.1.4</a>).
8255 [<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
8257 <a name="7.8.2.4" href="#7.8.2.4"><b> 7.8.2.4 The wcstoimax and wcstoumax functions</b></a>
8258 Synopsis
8259 1 #include <a href="#7.17">&lt;stddef.h&gt;</a> // for wchar_t
8260 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8261 intmax_t wcstoimax(const wchar_t * restrict nptr,
8262 wchar_t ** restrict endptr, int base);
8263 uintmax_t wcstoumax(const wchar_t * restrict nptr,
8264 wchar_t ** restrict endptr, int base);
8265 Description
8266 2 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
8267 wcstoul, and wcstoull functions except that the initial portion of the wide string is
8268 converted to intmax_t and uintmax_t representation, respectively.
8269 Returns
8270 3 The wcstoimax function returns the converted value, if any. If no conversion could be
8271 performed, zero is returned. If the correct value is outside the range of representable
8272 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
8273 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
8274 errno.
8275 Forward references: the wcstol, wcstoll, wcstoul, and wcstoull functions
8276 (<a href="#7.24.4.1.2">7.24.4.1.2</a>).
8281 [<a name="p201" href="#p201">page 201</a>] (<a href="#Contents">Contents</a>)
8283 <a name="7.9" href="#7.9"><b> 7.9 Alternative spellings &lt;iso646.h&gt;</b></a>
8284 1 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
8285 to the corresponding tokens (on the right):
8286 and &amp;&amp;
8287 and_eq &amp;=
8288 bitand &amp;
8289 bitor |
8290 compl ~
8291 not !
8292 not_eq !=
8293 or ||
8294 or_eq |=
8295 xor ^
8296 xor_eq ^=
8301 [<a name="p202" href="#p202">page 202</a>] (<a href="#Contents">Contents</a>)
8303 <a name="7.10" href="#7.10"><b> 7.10 Sizes of integer types &lt;limits.h&gt;</b></a>
8304 1 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
8305 parameters of the standard integer types.
8306 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
8307 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
8312 [<a name="p203" href="#p203">page 203</a>] (<a href="#Contents">Contents</a>)
8314 <a name="7.11" href="#7.11"><b> 7.11 Localization &lt;locale.h&gt;</b></a>
8315 1 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
8316 2 The type is
8317 struct lconv
8318 which contains members related to the formatting of numeric values. The structure shall
8319 contain at least the following members, in any order. The semantics of the members and
8320 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
8321 the values specified in the comments.
8322 char *decimal_point; // "."
8323 char *thousands_sep; // ""
8324 char *grouping; // ""
8325 char *mon_decimal_point; // ""
8326 char *mon_thousands_sep; // ""
8327 char *mon_grouping; // ""
8328 char *positive_sign; // ""
8329 char *negative_sign; // ""
8330 char *currency_symbol; // ""
8331 char frac_digits; // CHAR_MAX
8332 char p_cs_precedes; // CHAR_MAX
8333 char n_cs_precedes; // CHAR_MAX
8334 char p_sep_by_space; // CHAR_MAX
8335 char n_sep_by_space; // CHAR_MAX
8336 char p_sign_posn; // CHAR_MAX
8337 char n_sign_posn; // CHAR_MAX
8338 char *int_curr_symbol; // ""
8339 char int_frac_digits; // CHAR_MAX
8340 char int_p_cs_precedes; // CHAR_MAX
8341 char int_n_cs_precedes; // CHAR_MAX
8342 char int_p_sep_by_space; // CHAR_MAX
8343 char int_n_sep_by_space; // CHAR_MAX
8344 char int_p_sign_posn; // CHAR_MAX
8345 char int_n_sign_posn; // CHAR_MAX
8350 [<a name="p204" href="#p204">page 204</a>] (<a href="#Contents">Contents</a>)
8352 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
8353 LC_ALL
8354 LC_COLLATE
8355 LC_CTYPE
8356 LC_MONETARY
8357 LC_NUMERIC
8358 LC_TIME
8359 which expand to integer constant expressions with distinct values, suitable for use as the
8360 first argument to the setlocale function.194) Additional macro definitions, beginning
8361 with the characters LC_ and an uppercase letter,195) may also be specified by the
8362 implementation.
8363 <a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
8364 <a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
8365 Synopsis
8366 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
8367 char *setlocale(int category, const char *locale);
8368 Description
8369 2 The setlocale function selects the appropriate portion of the program's locale as
8370 specified by the category and locale arguments. The setlocale function may be
8371 used to change or query the program's entire current locale or portions thereof. The value
8372 LC_ALL for category names the program's entire locale; the other values for
8373 category name only a portion of the program's locale. LC_COLLATE affects the
8374 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
8375 the character handling functions196) and the multibyte and wide character functions.
8376 LC_MONETARY affects the monetary formatting information returned by the
8377 localeconv function. LC_NUMERIC affects the decimal-point character for the
8378 formatted input/output functions and the string conversion functions, as well as the
8379 nonmonetary formatting information returned by the localeconv function. LC_TIME
8380 affects the behavior of the strftime and wcsftime functions.
8381 3 A value of "C" for locale specifies the minimal environment for C translation; a value
8382 of "" for locale specifies the locale-specific native environment. Other
8383 implementation-defined strings may be passed as the second argument to setlocale.
8385 194) ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
8386 195) See ''future library directions'' (<a href="#7.26.5">7.26.5</a>).
8387 196) The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
8388 isxdigit.
8390 [<a name="p205" href="#p205">page 205</a>] (<a href="#Contents">Contents</a>)
8392 4 At program startup, the equivalent of
8393 setlocale(LC_ALL, "C");
8394 is executed.
8395 5 The implementation shall behave as if no library function calls the setlocale function.
8396 Returns
8397 6 If a pointer to a string is given for locale and the selection can be honored, the
8398 setlocale function returns a pointer to the string associated with the specified
8399 category for the new locale. If the selection cannot be honored, the setlocale
8400 function returns a null pointer and the program's locale is not changed.
8401 7 A null pointer for locale causes the setlocale function to return a pointer to the
8402 string associated with the category for the program's current locale; the program's
8403 locale is not changed.197)
8404 8 The pointer to string returned by the setlocale function is such that a subsequent call
8405 with that string value and its associated category will restore that part of the program's
8406 locale. The string pointed to shall not be modified by the program, but may be
8407 overwritten by a subsequent call to the setlocale function.
8408 Forward references: formatted input/output functions (<a href="#7.19.6">7.19.6</a>), multibyte/wide
8409 character conversion functions (<a href="#7.20.7">7.20.7</a>), multibyte/wide string conversion functions
8410 (<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
8411 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>).
8412 <a name="7.11.2" href="#7.11.2"><b> 7.11.2 Numeric formatting convention inquiry</b></a>
8413 <a name="7.11.2.1" href="#7.11.2.1"><b> 7.11.2.1 The localeconv function</b></a>
8414 Synopsis
8415 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
8416 struct lconv *localeconv(void);
8417 Description
8418 2 The localeconv function sets the components of an object with type struct lconv
8419 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
8420 according to the rules of the current locale.
8421 3 The members of the structure with type char * are pointers to strings, any of which
8422 (except decimal_point) can point to "", to indicate that the value is not available in
8423 the current locale or is of zero length. Apart from grouping and mon_grouping, the
8425 197) The implementation shall arrange to encode in a string the various categories due to a heterogeneous
8426 locale when category has the value LC_ALL.
8428 [<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
8430 strings shall start and end in the initial shift state. The members with type char are
8431 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
8432 available in the current locale. The members include the following:
8433 char *decimal_point
8434 The decimal-point character used to format nonmonetary quantities.
8435 char *thousands_sep
8436 The character used to separate groups of digits before the decimal-point
8437 character in formatted nonmonetary quantities.
8438 char *grouping
8439 A string whose elements indicate the size of each group of digits in
8440 formatted nonmonetary quantities.
8441 char *mon_decimal_point
8442 The decimal-point used to format monetary quantities.
8443 char *mon_thousands_sep
8444 The separator for groups of digits before the decimal-point in formatted
8445 monetary quantities.
8446 char *mon_grouping
8447 A string whose elements indicate the size of each group of digits in
8448 formatted monetary quantities.
8449 char *positive_sign
8450 The string used to indicate a nonnegative-valued formatted monetary
8451 quantity.
8452 char *negative_sign
8453 The string used to indicate a negative-valued formatted monetary quantity.
8454 char *currency_symbol
8455 The local currency symbol applicable to the current locale.
8456 char frac_digits
8457 The number of fractional digits (those after the decimal-point) to be
8458 displayed in a locally formatted monetary quantity.
8459 char p_cs_precedes
8460 Set to 1 or 0 if the currency_symbol respectively precedes or
8461 succeeds the value for a nonnegative locally formatted monetary quantity.
8462 char n_cs_precedes
8463 Set to 1 or 0 if the currency_symbol respectively precedes or
8464 succeeds the value for a negative locally formatted monetary quantity.
8467 [<a name="p207" href="#p207">page 207</a>] (<a href="#Contents">Contents</a>)
8469 char p_sep_by_space
8470 Set to a value indicating the separation of the currency_symbol, the
8471 sign string, and the value for a nonnegative locally formatted monetary
8472 quantity.
8473 char n_sep_by_space
8474 Set to a value indicating the separation of the currency_symbol, the
8475 sign string, and the value for a negative locally formatted monetary
8476 quantity.
8477 char p_sign_posn
8478 Set to a value indicating the positioning of the positive_sign for a
8479 nonnegative locally formatted monetary quantity.
8480 char n_sign_posn
8481 Set to a value indicating the positioning of the negative_sign for a
8482 negative locally formatted monetary quantity.
8483 char *int_curr_symbol
8484 The international currency symbol applicable to the current locale. The
8485 first three characters contain the alphabetic international currency symbol
8486 in accordance with those specified in ISO 4217. The fourth character
8487 (immediately preceding the null character) is the character used to separate
8488 the international currency symbol from the monetary quantity.
8489 char int_frac_digits
8490 The number of fractional digits (those after the decimal-point) to be
8491 displayed in an internationally formatted monetary quantity.
8492 char int_p_cs_precedes
8493 Set to 1 or 0 if the int_curr_symbol respectively precedes or
8494 succeeds the value for a nonnegative internationally formatted monetary
8495 quantity.
8496 char int_n_cs_precedes
8497 Set to 1 or 0 if the int_curr_symbol respectively precedes or
8498 succeeds the value for a negative internationally formatted monetary
8499 quantity.
8500 char int_p_sep_by_space
8501 Set to a value indicating the separation of the int_curr_symbol, the
8502 sign string, and the value for a nonnegative internationally formatted
8503 monetary quantity.
8508 [<a name="p208" href="#p208">page 208</a>] (<a href="#Contents">Contents</a>)
8510 char int_n_sep_by_space
8511 Set to a value indicating the separation of the int_curr_symbol, the
8512 sign string, and the value for a negative internationally formatted monetary
8513 quantity.
8514 char int_p_sign_posn
8515 Set to a value indicating the positioning of the positive_sign for a
8516 nonnegative internationally formatted monetary quantity.
8517 char int_n_sign_posn
8518 Set to a value indicating the positioning of the negative_sign for a
8519 negative internationally formatted monetary quantity.
8520 4 The elements of grouping and mon_grouping are interpreted according to the
8521 following:
8522 CHAR_MAX No further grouping is to be performed.
8523 0 The previous element is to be repeatedly used for the remainder of the
8524 digits.
8525 other The integer value is the number of digits that compose the current group.
8526 The next element is examined to determine the size of the next group of
8527 digits before the current group.
8528 5 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
8529 and int_n_sep_by_space are interpreted according to the following:
8530 0 No space separates the currency symbol and value.
8531 1 If the currency symbol and sign string are adjacent, a space separates them from the
8532 value; otherwise, a space separates the currency symbol from the value.
8533 2 If the currency symbol and sign string are adjacent, a space separates them;
8534 otherwise, a space separates the sign string from the value.
8535 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
8536 int_curr_symbol is used instead of a space.
8537 6 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
8538 int_n_sign_posn are interpreted according to the following:
8539 0 Parentheses surround the quantity and currency symbol.
8540 1 The sign string precedes the quantity and currency symbol.
8541 2 The sign string succeeds the quantity and currency symbol.
8542 3 The sign string immediately precedes the currency symbol.
8543 4 The sign string immediately succeeds the currency symbol.
8546 [<a name="p209" href="#p209">page 209</a>] (<a href="#Contents">Contents</a>)
8548 7 The implementation shall behave as if no library function calls the localeconv
8549 function.
8550 Returns
8551 8 The localeconv function returns a pointer to the filled-in object. The structure
8552 pointed to by the return value shall not be modified by the program, but may be
8553 overwritten by a subsequent call to the localeconv function. In addition, calls to the
8554 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
8555 overwrite the contents of the structure.
8556 9 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
8557 monetary quantities.
8558 Local format International format
8560 Country Positive Negative Positive Negative
8562 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
8563 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
8564 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
8565 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
8566 10 For these four countries, the respective values for the monetary members of the structure returned by
8567 localeconv could be:
8568 Country1 Country2 Country3 Country4
8570 mon_decimal_point "," "" "," "."
8571 mon_thousands_sep "." "." "." ","
8572 mon_grouping "\3" "\3" "\3" "\3"
8573 positive_sign "" "" "" ""
8574 negative_sign "-" "-" "-" "C"
8575 currency_symbol "mk" "L." "\u0192" "SFrs."
8576 frac_digits 2 0 2 2
8577 p_cs_precedes 0 1 1 1
8578 n_cs_precedes 0 1 1 1
8579 p_sep_by_space 1 0 1 0
8580 n_sep_by_space 1 0 2 0
8581 p_sign_posn 1 1 1 1
8582 n_sign_posn 1 1 4 2
8583 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
8584 int_frac_digits 2 0 2 2
8585 int_p_cs_precedes 1 1 1 1
8586 int_n_cs_precedes 1 1 1 1
8587 int_p_sep_by_space 1 1 1 1
8588 int_n_sep_by_space 2 1 2 1
8589 int_p_sign_posn 1 1 1 1
8590 int_n_sign_posn 4 1 4 2
8595 [<a name="p210" href="#p210">page 210</a>] (<a href="#Contents">Contents</a>)
8597 11 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
8598 affect the formatted value.
8599 p_sep_by_space
8601 p_cs_precedes p_sign_posn 0 1 2
8603 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
8604 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
8605 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
8606 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
8607 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
8609 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
8610 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
8611 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
8612 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
8613 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25
8618 [<a name="p211" href="#p211">page 211</a>] (<a href="#Contents">Contents</a>)
8620 <a name="7.12" href="#7.12"><b> 7.12 Mathematics &lt;math.h&gt;</b></a>
8621 1 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
8622 several macros. Most synopses specify a family of functions consisting of a principal
8623 function with one or more double parameters, a double return value, or both; and
8624 other functions with the same name but with f and l suffixes, which are corresponding
8625 functions with float and long double parameters, return values, or both.198)
8626 Integer arithmetic functions and conversion functions are discussed later.
8627 2 The types
8628 float_t
8629 double_t
8630 are floating types at least as wide as float and double, respectively, and such that
8631 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
8632 float_t and double_t are float and double, respectively; if
8633 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
8634 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
8635 otherwise implementation-defined.199)
8636 3 The macro
8637 HUGE_VAL
8638 expands to a positive double constant expression, not necessarily representable as a
8639 float. The macros
8640 HUGE_VALF
8641 HUGE_VALL
8642 are respectively float and long double analogs of HUGE_VAL.200)
8643 4 The macro
8644 INFINITY
8645 expands to a constant expression of type float representing positive or unsigned
8646 infinity, if available; else to a positive constant of type float that overflows at
8650 198) Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
8651 and return values in wider format than the synopsis prototype indicates.
8652 199) The types float_t and double_t are intended to be the implementation's most efficient types at
8653 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
8654 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
8655 200) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
8656 supports infinities.
8658 [<a name="p212" href="#p212">page 212</a>] (<a href="#Contents">Contents</a>)
8660 translation time.201)
8661 5 The macro
8663 is defined if and only if the implementation supports quiet NaNs for the float type. It
8664 expands to a constant expression of type float representing a quiet NaN.
8665 6 The number classification macros
8666 FP_INFINITE
8667 FP_NAN
8668 FP_NORMAL
8669 FP_SUBNORMAL
8670 FP_ZERO
8671 represent the mutually exclusive kinds of floating-point values. They expand to integer
8672 constant expressions with distinct values. Additional implementation-defined floating-
8673 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
8674 may also be specified by the implementation.
8675 7 The macro
8676 FP_FAST_FMA
8677 is optionally defined. If defined, it indicates that the fma function generally executes
8678 about as fast as, or faster than, a multiply and an add of double operands.202) The
8679 macros
8680 FP_FAST_FMAF
8681 FP_FAST_FMAL
8682 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
8683 these macros expand to the integer constant 1.
8684 8 The macros
8685 FP_ILOGB0
8686 FP_ILOGBNAN
8687 expand to integer constant expressions whose values are returned by ilogb(x) if x is
8688 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
8689 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
8692 201) In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
8693 202) Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
8694 directly with a hardware multiply-add instruction. Software implementations are expected to be
8695 substantially slower.
8697 [<a name="p213" href="#p213">page 213</a>] (<a href="#Contents">Contents</a>)
8699 9 The macros
8700 MATH_ERRNO
8701 MATH_ERREXCEPT
8702 expand to the integer constants 1 and 2, respectively; the macro
8703 math_errhandling
8704 expands to an expression that has type int and the value MATH_ERRNO,
8705 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
8706 constant for the duration of the program. It is unspecified whether
8707 math_errhandling is a macro or an identifier with external linkage. If a macro
8708 definition is suppressed or a program defines an identifier with the name
8709 math_errhandling, the behavior is undefined. If the expression
8710 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
8711 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
8712 <a href="#7.6">&lt;fenv.h&gt;</a>.
8713 <a name="7.12.1" href="#7.12.1"><b> 7.12.1 Treatment of error conditions</b></a>
8714 1 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
8715 values of its input arguments, except where stated otherwise. Each function shall execute
8716 as if it were a single operation without generating any externally visible exceptional
8717 conditions.
8718 2 For all functions, a domain error occurs if an input argument is outside the domain over
8719 which the mathematical function is defined. The description of each function lists any
8720 required domain errors; an implementation may define additional domain errors, provided
8721 that such errors are consistent with the mathematical definition of the function.203) On a
8722 domain error, the function returns an implementation-defined value; if the integer
8723 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
8724 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
8725 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
8726 3 Similarly, a range error occurs if the mathematical result of the function cannot be
8727 represented in an object of the specified type, due to extreme magnitude.
8728 4 A floating result overflows if the magnitude of the mathematical result is finite but so
8729 large that the mathematical result cannot be represented without extraordinary roundoff
8730 error in an object of the specified type. If a floating result overflows and default rounding
8731 is in effect, or if the mathematical result is an exact infinity from finite arguments (for
8732 example log(0.0)), then the function returns the value of the macro HUGE_VAL,
8735 203) In an implementation that supports infinities, this allows an infinity as an argument to be a domain
8736 error if the mathematical domain of the function does not include the infinity.
8738 [<a name="p214" href="#p214">page 214</a>] (<a href="#Contents">Contents</a>)
8740 HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
8741 correct value of the function; if the integer expression math_errhandling &amp;
8742 MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if
8743 the integer expression math_errhandling &amp; MATH_ERREXCEPT is nonzero, the
8744 ''divide-by-zero'' floating-point exception is raised if the mathematical result is an exact
8745 infinity and the ''overflow'' floating-point exception is raised otherwise.
8746 5 The result underflows if the magnitude of the mathematical result is so small that the
8747 mathematical result cannot be represented, without extraordinary roundoff error, in an
8748 object of the specified type.204) If the result underflows, the function returns an
8749 implementation-defined value whose magnitude is no greater than the smallest
8750 normalized positive number in the specified type; if the integer expression
8751 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
8752 value ERANGE is implementation-defined; if the integer expression
8753 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
8754 floating-point exception is raised is implementation-defined.
8755 <a name="7.12.2" href="#7.12.2"><b> 7.12.2 The FP_CONTRACT pragma</b></a>
8756 Synopsis
8757 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8758 #pragma STDC FP_CONTRACT on-off-switch
8759 Description
8760 2 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
8761 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
8762 either outside external declarations or preceding all explicit declarations and statements
8763 inside a compound statement. When outside external declarations, the pragma takes
8764 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
8765 the end of the translation unit. When inside a compound statement, the pragma takes
8766 effect from its occurrence until another FP_CONTRACT pragma is encountered
8767 (including within a nested compound statement), or until the end of the compound
8768 statement; at the end of a compound statement the state for the pragma is restored to its
8769 condition just before the compound statement. If this pragma is used in any other
8770 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
8771 implementation-defined.
8776 204) The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
8777 also ''flush-to-zero'' underflow.
8779 [<a name="p215" href="#p215">page 215</a>] (<a href="#Contents">Contents</a>)
8781 <a name="7.12.3" href="#7.12.3"><b> 7.12.3 Classification macros</b></a>
8782 1 In the synopses in this subclause, real-floating indicates that the argument shall be an
8783 expression of real floating type.
8784 <a name="7.12.3.1" href="#7.12.3.1"><b> 7.12.3.1 The fpclassify macro</b></a>
8785 Synopsis
8786 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8787 int fpclassify(real-floating x);
8788 Description
8789 2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
8790 subnormal, zero, or into another implementation-defined category. First, an argument
8791 represented in a format wider than its semantic type is converted to its semantic type.
8792 Then classification is based on the type of the argument.205)
8793 Returns
8794 3 The fpclassify macro returns the value of the number classification macro
8795 appropriate to the value of its argument.
8796 4 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
8797 #define fpclassify(x) \
8798 ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : \
8799 (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) : \
8800 __fpclassifyl(x))
8802 <a name="7.12.3.2" href="#7.12.3.2"><b> 7.12.3.2 The isfinite macro</b></a>
8803 Synopsis
8804 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8805 int isfinite(real-floating x);
8806 Description
8807 2 The isfinite macro determines whether its argument has a finite value (zero,
8808 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
8809 format wider than its semantic type is converted to its semantic type. Then determination
8810 is based on the type of the argument.
8815 205) Since an expression can be evaluated with more range and precision than its type has, it is important to
8816 know the type that classification is based on. For example, a normal long double value might
8817 become subnormal when converted to double, and zero when converted to float.
8819 [<a name="p216" href="#p216">page 216</a>] (<a href="#Contents">Contents</a>)
8821 Returns
8822 3 The isfinite macro returns a nonzero value if and only if its argument has a finite
8823 value.
8824 <a name="7.12.3.3" href="#7.12.3.3"><b> 7.12.3.3 The isinf macro</b></a>
8825 Synopsis
8826 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8827 int isinf(real-floating x);
8828 Description
8829 2 The isinf macro determines whether its argument value is an infinity (positive or
8830 negative). First, an argument represented in a format wider than its semantic type is
8831 converted to its semantic type. Then determination is based on the type of the argument.
8832 Returns
8833 3 The isinf macro returns a nonzero value if and only if its argument has an infinite
8834 value.
8835 <a name="7.12.3.4" href="#7.12.3.4"><b> 7.12.3.4 The isnan macro</b></a>
8836 Synopsis
8837 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8838 int isnan(real-floating x);
8839 Description
8840 2 The isnan macro determines whether its argument value is a NaN. First, an argument
8841 represented in a format wider than its semantic type is converted to its semantic type.
8842 Then determination is based on the type of the argument.206)
8843 Returns
8844 3 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
8845 <a name="7.12.3.5" href="#7.12.3.5"><b> 7.12.3.5 The isnormal macro</b></a>
8846 Synopsis
8847 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8848 int isnormal(real-floating x);
8853 206) For the isnan macro, the type for determination does not matter unless the implementation supports
8854 NaNs in the evaluation type but not in the semantic type.
8856 [<a name="p217" href="#p217">page 217</a>] (<a href="#Contents">Contents</a>)
8858 Description
8859 2 The isnormal macro determines whether its argument value is normal (neither zero,
8860 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
8861 semantic type is converted to its semantic type. Then determination is based on the type
8862 of the argument.
8863 Returns
8864 3 The isnormal macro returns a nonzero value if and only if its argument has a normal
8865 value.
8866 <a name="7.12.3.6" href="#7.12.3.6"><b> 7.12.3.6 The signbit macro</b></a>
8867 Synopsis
8868 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8869 int signbit(real-floating x);
8870 Description
8871 2 The signbit macro determines whether the sign of its argument value is negative.207)
8872 Returns
8873 3 The signbit macro returns a nonzero value if and only if the sign of its argument value
8874 is negative.
8875 <a name="7.12.4" href="#7.12.4"><b> 7.12.4 Trigonometric functions</b></a>
8876 <a name="7.12.4.1" href="#7.12.4.1"><b> 7.12.4.1 The acos functions</b></a>
8877 Synopsis
8878 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8879 double acos(double x);
8880 float acosf(float x);
8881 long double acosl(long double x);
8882 Description
8883 2 The acos functions compute the principal value of the arc cosine of x. A domain error
8884 occurs for arguments not in the interval [-1, +1].
8885 Returns
8886 3 The acos functions return arccos x in the interval [0, pi ] radians.
8891 207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
8892 unsigned, it is treated as positive.
8894 [<a name="p218" href="#p218">page 218</a>] (<a href="#Contents">Contents</a>)
8896 <a name="7.12.4.2" href="#7.12.4.2"><b> 7.12.4.2 The asin functions</b></a>
8897 Synopsis
8898 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8899 double asin(double x);
8900 float asinf(float x);
8901 long double asinl(long double x);
8902 Description
8903 2 The asin functions compute the principal value of the arc sine of x. A domain error
8904 occurs for arguments not in the interval [-1, +1].
8905 Returns
8906 3 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
8907 <a name="7.12.4.3" href="#7.12.4.3"><b> 7.12.4.3 The atan functions</b></a>
8908 Synopsis
8909 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8910 double atan(double x);
8911 float atanf(float x);
8912 long double atanl(long double x);
8913 Description
8914 2 The atan functions compute the principal value of the arc tangent of x.
8915 Returns
8916 3 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
8917 <a name="7.12.4.4" href="#7.12.4.4"><b> 7.12.4.4 The atan2 functions</b></a>
8918 Synopsis
8919 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8920 double atan2(double y, double x);
8921 float atan2f(float y, float x);
8922 long double atan2l(long double y, long double x);
8923 Description
8924 2 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
8925 arguments to determine the quadrant of the return value. A domain error may occur if
8926 both arguments are zero.
8927 Returns
8928 3 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
8931 [<a name="p219" href="#p219">page 219</a>] (<a href="#Contents">Contents</a>)
8933 <a name="7.12.4.5" href="#7.12.4.5"><b> 7.12.4.5 The cos functions</b></a>
8934 Synopsis
8935 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8936 double cos(double x);
8937 float cosf(float x);
8938 long double cosl(long double x);
8939 Description
8940 2 The cos functions compute the cosine of x (measured in radians).
8941 Returns
8942 3 The cos functions return cos x.
8943 <a name="7.12.4.6" href="#7.12.4.6"><b> 7.12.4.6 The sin functions</b></a>
8944 Synopsis
8945 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8946 double sin(double x);
8947 float sinf(float x);
8948 long double sinl(long double x);
8949 Description
8950 2 The sin functions compute the sine of x (measured in radians).
8951 Returns
8952 3 The sin functions return sin x.
8953 <a name="7.12.4.7" href="#7.12.4.7"><b> 7.12.4.7 The tan functions</b></a>
8954 Synopsis
8955 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8956 double tan(double x);
8957 float tanf(float x);
8958 long double tanl(long double x);
8959 Description
8960 2 The tan functions return the tangent of x (measured in radians).
8961 Returns
8962 3 The tan functions return tan x.
8967 [<a name="p220" href="#p220">page 220</a>] (<a href="#Contents">Contents</a>)
8969 <a name="7.12.5" href="#7.12.5"><b> 7.12.5 Hyperbolic functions</b></a>
8970 <a name="7.12.5.1" href="#7.12.5.1"><b> 7.12.5.1 The acosh functions</b></a>
8971 Synopsis
8972 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8973 double acosh(double x);
8974 float acoshf(float x);
8975 long double acoshl(long double x);
8976 Description
8977 2 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
8978 error occurs for arguments less than 1.
8979 Returns
8980 3 The acosh functions return arcosh x in the interval [0, +(inf)].
8981 <a name="7.12.5.2" href="#7.12.5.2"><b> 7.12.5.2 The asinh functions</b></a>
8982 Synopsis
8983 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8984 double asinh(double x);
8985 float asinhf(float x);
8986 long double asinhl(long double x);
8987 Description
8988 2 The asinh functions compute the arc hyperbolic sine of x.
8989 Returns
8990 3 The asinh functions return arsinh x.
8991 <a name="7.12.5.3" href="#7.12.5.3"><b> 7.12.5.3 The atanh functions</b></a>
8992 Synopsis
8993 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8994 double atanh(double x);
8995 float atanhf(float x);
8996 long double atanhl(long double x);
8997 Description
8998 2 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
8999 for arguments not in the interval [-1, +1]. A range error may occur if the argument
9000 equals -1 or +1.
9004 [<a name="p221" href="#p221">page 221</a>] (<a href="#Contents">Contents</a>)
9006 Returns
9007 3 The atanh functions return artanh x.
9008 <a name="7.12.5.4" href="#7.12.5.4"><b> 7.12.5.4 The cosh functions</b></a>
9009 Synopsis
9010 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9011 double cosh(double x);
9012 float coshf(float x);
9013 long double coshl(long double x);
9014 Description
9015 2 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
9016 magnitude of x is too large.
9017 Returns
9018 3 The cosh functions return cosh x.
9019 <a name="7.12.5.5" href="#7.12.5.5"><b> 7.12.5.5 The sinh functions</b></a>
9020 Synopsis
9021 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9022 double sinh(double x);
9023 float sinhf(float x);
9024 long double sinhl(long double x);
9025 Description
9026 2 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
9027 magnitude of x is too large.
9028 Returns
9029 3 The sinh functions return sinh x.
9030 <a name="7.12.5.6" href="#7.12.5.6"><b> 7.12.5.6 The tanh functions</b></a>
9031 Synopsis
9032 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9033 double tanh(double x);
9034 float tanhf(float x);
9035 long double tanhl(long double x);
9036 Description
9037 2 The tanh functions compute the hyperbolic tangent of x.
9041 [<a name="p222" href="#p222">page 222</a>] (<a href="#Contents">Contents</a>)
9043 Returns
9044 3 The tanh functions return tanh x.
9045 <a name="7.12.6" href="#7.12.6"><b> 7.12.6 Exponential and logarithmic functions</b></a>
9046 <a name="7.12.6.1" href="#7.12.6.1"><b> 7.12.6.1 The exp functions</b></a>
9047 Synopsis
9048 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9049 double exp(double x);
9050 float expf(float x);
9051 long double expl(long double x);
9052 Description
9053 2 The exp functions compute the base-e exponential of x. A range error occurs if the
9054 magnitude of x is too large.
9055 Returns
9056 3 The exp functions return ex .
9057 <a name="7.12.6.2" href="#7.12.6.2"><b> 7.12.6.2 The exp2 functions</b></a>
9058 Synopsis
9059 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9060 double exp2(double x);
9061 float exp2f(float x);
9062 long double exp2l(long double x);
9063 Description
9064 2 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
9065 magnitude of x is too large.
9066 Returns
9067 3 The exp2 functions return 2x .
9068 <a name="7.12.6.3" href="#7.12.6.3"><b> 7.12.6.3 The expm1 functions</b></a>
9069 Synopsis
9070 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9071 double expm1(double x);
9072 float expm1f(float x);
9073 long double expm1l(long double x);
9078 [<a name="p223" href="#p223">page 223</a>] (<a href="#Contents">Contents</a>)
9080 Description
9081 2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
9082 error occurs if x is too large.208)
9083 Returns
9084 3 The expm1 functions return ex - 1.
9085 <a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
9086 Synopsis
9087 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9088 double frexp(double value, int *exp);
9089 float frexpf(float value, int *exp);
9090 long double frexpl(long double value, int *exp);
9091 Description
9092 2 The frexp functions break a floating-point number into a normalized fraction and an
9093 integral power of 2. They store the integer in the int object pointed to by exp.
9094 Returns
9095 3 If value is not a floating-point number, the results are unspecified. Otherwise, the
9096 frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
9097 zero, and value equals x x 2*exp . If value is zero, both parts of the result are zero.
9098 <a name="7.12.6.5" href="#7.12.6.5"><b> 7.12.6.5 The ilogb functions</b></a>
9099 Synopsis
9100 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9101 int ilogb(double x);
9102 int ilogbf(float x);
9103 int ilogbl(long double x);
9104 Description
9105 2 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
9106 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
9107 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
9108 the corresponding logb function and casting the returned value to type int. A domain
9109 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
9110 the range of the return type, the numeric result is unspecified.
9115 208) For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
9117 [<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
9119 Returns
9120 3 The ilogb functions return the exponent of x as a signed int value.
9121 Forward references: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
9122 <a name="7.12.6.6" href="#7.12.6.6"><b> 7.12.6.6 The ldexp functions</b></a>
9123 Synopsis
9124 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9125 double ldexp(double x, int exp);
9126 float ldexpf(float x, int exp);
9127 long double ldexpl(long double x, int exp);
9128 Description
9129 2 The ldexp functions multiply a floating-point number by an integral power of 2. A
9130 range error may occur.
9131 Returns
9132 3 The ldexp functions return x x 2exp .
9133 <a name="7.12.6.7" href="#7.12.6.7"><b> 7.12.6.7 The log functions</b></a>
9134 Synopsis
9135 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9136 double log(double x);
9137 float logf(float x);
9138 long double logl(long double x);
9139 Description
9140 2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
9141 the argument is negative. A range error may occur if the argument is zero.
9142 Returns
9143 3 The log functions return loge x.
9144 <a name="7.12.6.8" href="#7.12.6.8"><b> 7.12.6.8 The log10 functions</b></a>
9145 Synopsis
9146 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9147 double log10(double x);
9148 float log10f(float x);
9149 long double log10l(long double x);
9154 [<a name="p225" href="#p225">page 225</a>] (<a href="#Contents">Contents</a>)
9156 Description
9157 2 The log10 functions compute the base-10 (common) logarithm of x. A domain error
9158 occurs if the argument is negative. A range error may occur if the argument is zero.
9159 Returns
9160 3 The log10 functions return log10 x.
9161 <a name="7.12.6.9" href="#7.12.6.9"><b> 7.12.6.9 The log1p functions</b></a>
9162 Synopsis
9163 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9164 double log1p(double x);
9165 float log1pf(float x);
9166 long double log1pl(long double x);
9167 Description
9168 2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.209)
9169 A domain error occurs if the argument is less than -1. A range error may occur if the
9170 argument equals -1.
9171 Returns
9172 3 The log1p functions return loge (1 + x).
9173 <a name="7.12.6.10" href="#7.12.6.10"><b> 7.12.6.10 The log2 functions</b></a>
9174 Synopsis
9175 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9176 double log2(double x);
9177 float log2f(float x);
9178 long double log2l(long double x);
9179 Description
9180 2 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
9181 argument is less than zero. A range error may occur if the argument is zero.
9182 Returns
9183 3 The log2 functions return log2 x.
9188 209) For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
9190 [<a name="p226" href="#p226">page 226</a>] (<a href="#Contents">Contents</a>)
9192 <a name="7.12.6.11" href="#7.12.6.11"><b> 7.12.6.11 The logb functions</b></a>
9193 Synopsis
9194 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9195 double logb(double x);
9196 float logbf(float x);
9197 long double logbl(long double x);
9198 Description
9199 2 The logb functions extract the exponent of x, as a signed integer value in floating-point
9200 format. If x is subnormal it is treated as though it were normalized; thus, for positive
9201 finite x,
9202 1 &lt;= x x FLT_RADIX-logb(x) &lt; FLT_RADIX
9203 A domain error or range error may occur if the argument is zero.
9204 Returns
9205 3 The logb functions return the signed exponent of x.
9206 <a name="7.12.6.12" href="#7.12.6.12"><b> 7.12.6.12 The modf functions</b></a>
9207 Synopsis
9208 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9209 double modf(double value, double *iptr);
9210 float modff(float value, float *iptr);
9211 long double modfl(long double value, long double *iptr);
9212 Description
9213 2 The modf functions break the argument value into integral and fractional parts, each of
9214 which has the same type and sign as the argument. They store the integral part (in
9215 floating-point format) in the object pointed to by iptr.
9216 Returns
9217 3 The modf functions return the signed fractional part of value.
9222 [<a name="p227" href="#p227">page 227</a>] (<a href="#Contents">Contents</a>)
9224 <a name="7.12.6.13" href="#7.12.6.13"><b> 7.12.6.13 The scalbn and scalbln functions</b></a>
9225 Synopsis
9226 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9227 double scalbn(double x, int n);
9228 float scalbnf(float x, int n);
9229 long double scalbnl(long double x, int n);
9230 double scalbln(double x, long int n);
9231 float scalblnf(float x, long int n);
9232 long double scalblnl(long double x, long int n);
9233 Description
9234 2 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
9235 normally by computing FLT_RADIXn explicitly. A range error may occur.
9236 Returns
9237 3 The scalbn and scalbln functions return x x FLT_RADIXn .
9238 <a name="7.12.7" href="#7.12.7"><b> 7.12.7 Power and absolute-value functions</b></a>
9239 <a name="7.12.7.1" href="#7.12.7.1"><b> 7.12.7.1 The cbrt functions</b></a>
9240 Synopsis
9241 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9242 double cbrt(double x);
9243 float cbrtf(float x);
9244 long double cbrtl(long double x);
9245 Description
9246 2 The cbrt functions compute the real cube root of x.
9247 Returns
9248 3 The cbrt functions return x1/3 .
9249 <a name="7.12.7.2" href="#7.12.7.2"><b> 7.12.7.2 The fabs functions</b></a>
9250 Synopsis
9251 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9252 double fabs(double x);
9253 float fabsf(float x);
9254 long double fabsl(long double x);
9255 Description
9256 2 The fabs functions compute the absolute value of a floating-point number x.
9259 [<a name="p228" href="#p228">page 228</a>] (<a href="#Contents">Contents</a>)
9261 Returns
9262 3 The fabs functions return | x |.
9263 <a name="7.12.7.3" href="#7.12.7.3"><b> 7.12.7.3 The hypot functions</b></a>
9264 Synopsis
9265 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9266 double hypot(double x, double y);
9267 float hypotf(float x, float y);
9268 long double hypotl(long double x, long double y);
9269 Description
9270 2 The hypot functions compute the square root of the sum of the squares of x and y,
9271 without undue overflow or underflow. A range error may occur.
9272 3 Returns
9273 4 The hypot functions return sqrt:x2 + y2 .
9275 ???????????????
9276 <a name="7.12.7.4" href="#7.12.7.4"><b> 7.12.7.4 The pow functions</b></a>
9277 Synopsis
9278 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9279 double pow(double x, double y);
9280 float powf(float x, float y);
9281 long double powl(long double x, long double y);
9282 Description
9283 2 The pow functions compute x raised to the power y. A domain error occurs if x is finite
9284 and negative and y is finite and not an integer value. A range error may occur. A domain
9285 error may occur if x is zero and y is zero. A domain error or range error may occur if x
9286 is zero and y is less than zero.
9287 Returns
9288 3 The pow functions return xy .
9289 <a name="7.12.7.5" href="#7.12.7.5"><b> 7.12.7.5 The sqrt functions</b></a>
9290 Synopsis
9291 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9292 double sqrt(double x);
9293 float sqrtf(float x);
9294 long double sqrtl(long double x);
9299 [<a name="p229" href="#p229">page 229</a>] (<a href="#Contents">Contents</a>)
9301 Description
9302 2 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
9303 the argument is less than zero.
9304 Returns
9305 3 The sqrt functions return sqrt:x.
9308 <a name="7.12.8" href="#7.12.8"><b> 7.12.8 Error and gamma functions</b></a>
9309 <a name="7.12.8.1" href="#7.12.8.1"><b> 7.12.8.1 The erf functions</b></a>
9310 Synopsis
9311 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9312 double erf(double x);
9313 float erff(float x);
9314 long double erfl(long double x);
9315 Description
9316 2 The erf functions compute the error function of x.
9317 Returns
9319 (integral)
9321 The erf functions return erf x = e-t dt.
9325 sqrt:pi
9327 ??? 0
9329 <a name="7.12.8.2" href="#7.12.8.2"><b> 7.12.8.2 The erfc functions</b></a>
9330 Synopsis
9331 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9332 double erfc(double x);
9333 float erfcf(float x);
9334 long double erfcl(long double x);
9335 Description
9336 2 The erfc functions compute the complementary error function of x. A range error
9337 occurs if x is too large.
9338 Returns
9339 2 (inf)
9340 (integral)
9342 The erfc functions return erfc x = 1 - erf x = e-t dt.
9346 sqrt:pi
9348 ??? x
9353 [<a name="p230" href="#p230">page 230</a>] (<a href="#Contents">Contents</a>)
9355 <a name="7.12.8.3" href="#7.12.8.3"><b> 7.12.8.3 The lgamma functions</b></a>
9356 Synopsis
9357 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9358 double lgamma(double x);
9359 float lgammaf(float x);
9360 long double lgammal(long double x);
9361 Description
9362 2 The lgamma functions compute the natural logarithm of the absolute value of gamma of
9363 x. A range error occurs if x is too large. A range error may occur if x is a negative
9364 integer or zero.
9365 Returns
9366 3 The lgamma functions return loge | (Gamma)(x) |.
9367 <a name="7.12.8.4" href="#7.12.8.4"><b> 7.12.8.4 The tgamma functions</b></a>
9368 Synopsis
9369 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9370 double tgamma(double x);
9371 float tgammaf(float x);
9372 long double tgammal(long double x);
9373 Description
9374 2 The tgamma functions compute the gamma function of x. A domain error or range error
9375 may occur if x is a negative integer or zero. A range error may occur if the magnitude of
9376 x is too large or too small.
9377 Returns
9378 3 The tgamma functions return (Gamma)(x).
9379 <a name="7.12.9" href="#7.12.9"><b> 7.12.9 Nearest integer functions</b></a>
9380 <a name="7.12.9.1" href="#7.12.9.1"><b> 7.12.9.1 The ceil functions</b></a>
9381 Synopsis
9382 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9383 double ceil(double x);
9384 float ceilf(float x);
9385 long double ceill(long double x);
9386 Description
9387 2 The ceil functions compute the smallest integer value not less than x.
9390 [<a name="p231" href="#p231">page 231</a>] (<a href="#Contents">Contents</a>)
9392 Returns
9393 3 The ceil functions return ???x???, expressed as a floating-point number.
9394 <a name="7.12.9.2" href="#7.12.9.2"><b> 7.12.9.2 The floor functions</b></a>
9395 Synopsis
9396 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9397 double floor(double x);
9398 float floorf(float x);
9399 long double floorl(long double x);
9400 Description
9401 2 The floor functions compute the largest integer value not greater than x.
9402 Returns
9403 3 The floor functions return ???x???, expressed as a floating-point number.
9404 <a name="7.12.9.3" href="#7.12.9.3"><b> 7.12.9.3 The nearbyint functions</b></a>
9405 Synopsis
9406 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9407 double nearbyint(double x);
9408 float nearbyintf(float x);
9409 long double nearbyintl(long double x);
9410 Description
9411 2 The nearbyint functions round their argument to an integer value in floating-point
9412 format, using the current rounding direction and without raising the ''inexact'' floating-
9413 point exception.
9414 Returns
9415 3 The nearbyint functions return the rounded integer value.
9416 <a name="7.12.9.4" href="#7.12.9.4"><b> 7.12.9.4 The rint functions</b></a>
9417 Synopsis
9418 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9419 double rint(double x);
9420 float rintf(float x);
9421 long double rintl(long double x);
9422 Description
9423 2 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
9424 rint functions may raise the ''inexact'' floating-point exception if the result differs in
9425 value from the argument.
9426 [<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
9428 Returns
9429 3 The rint functions return the rounded integer value.
9430 <a name="7.12.9.5" href="#7.12.9.5"><b> 7.12.9.5 The lrint and llrint functions</b></a>
9431 Synopsis
9432 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9433 long int lrint(double x);
9434 long int lrintf(float x);
9435 long int lrintl(long double x);
9436 long long int llrint(double x);
9437 long long int llrintf(float x);
9438 long long int llrintl(long double x);
9439 Description
9440 2 The lrint and llrint functions round their argument to the nearest integer value,
9441 rounding according to the current rounding direction. If the rounded value is outside the
9442 range of the return type, the numeric result is unspecified and a domain error or range
9443 error may occur. *
9444 Returns
9445 3 The lrint and llrint functions return the rounded integer value.
9446 <a name="7.12.9.6" href="#7.12.9.6"><b> 7.12.9.6 The round functions</b></a>
9447 Synopsis
9448 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9449 double round(double x);
9450 float roundf(float x);
9451 long double roundl(long double x);
9452 Description
9453 2 The round functions round their argument to the nearest integer value in floating-point
9454 format, rounding halfway cases away from zero, regardless of the current rounding
9455 direction.
9456 Returns
9457 3 The round functions return the rounded integer value.
9462 [<a name="p233" href="#p233">page 233</a>] (<a href="#Contents">Contents</a>)
9464 <a name="7.12.9.7" href="#7.12.9.7"><b> 7.12.9.7 The lround and llround functions</b></a>
9465 Synopsis
9466 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9467 long int lround(double x);
9468 long int lroundf(float x);
9469 long int lroundl(long double x);
9470 long long int llround(double x);
9471 long long int llroundf(float x);
9472 long long int llroundl(long double x);
9473 Description
9474 2 The lround and llround functions round their argument to the nearest integer value,
9475 rounding halfway cases away from zero, regardless of the current rounding direction. If
9476 the rounded value is outside the range of the return type, the numeric result is unspecified
9477 and a domain error or range error may occur.
9478 Returns
9479 3 The lround and llround functions return the rounded integer value.
9480 <a name="7.12.9.8" href="#7.12.9.8"><b> 7.12.9.8 The trunc functions</b></a>
9481 Synopsis
9482 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9483 double trunc(double x);
9484 float truncf(float x);
9485 long double truncl(long double x);
9486 Description
9487 2 The trunc functions round their argument to the integer value, in floating format,
9488 nearest to but no larger in magnitude than the argument.
9489 Returns
9490 3 The trunc functions return the truncated integer value.
9495 [<a name="p234" href="#p234">page 234</a>] (<a href="#Contents">Contents</a>)
9497 <a name="7.12.10" href="#7.12.10"><b> 7.12.10 Remainder functions</b></a>
9498 <a name="7.12.10.1" href="#7.12.10.1"><b> 7.12.10.1 The fmod functions</b></a>
9499 Synopsis
9500 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9501 double fmod(double x, double y);
9502 float fmodf(float x, float y);
9503 long double fmodl(long double x, long double y);
9504 Description
9505 2 The fmod functions compute the floating-point remainder of x/y.
9506 Returns
9507 3 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
9508 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
9509 whether a domain error occurs or the fmod functions return zero is implementation-
9510 defined.
9511 <a name="7.12.10.2" href="#7.12.10.2"><b> 7.12.10.2 The remainder functions</b></a>
9512 Synopsis
9513 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9514 double remainder(double x, double y);
9515 float remainderf(float x, float y);
9516 long double remainderl(long double x, long double y);
9517 Description
9518 2 The remainder functions compute the remainder x REM y required by IEC 60559.210)
9519 Returns
9520 3 The remainder functions return x REM y. If y is zero, whether a domain error occurs
9521 or the functions return zero is implementation defined.
9526 210) ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
9527 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
9528 | n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
9529 x.'' This definition is applicable for all implementations.
9531 [<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
9533 <a name="7.12.10.3" href="#7.12.10.3"><b> 7.12.10.3 The remquo functions</b></a>
9534 Synopsis
9535 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9536 double remquo(double x, double y, int *quo);
9537 float remquof(float x, float y, int *quo);
9538 long double remquol(long double x, long double y,
9539 int *quo);
9540 Description
9541 2 The remquo functions compute the same remainder as the remainder functions. In
9542 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
9543 magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
9544 n is an implementation-defined integer greater than or equal to 3.
9545 Returns
9546 3 The remquo functions return x REM y. If y is zero, the value stored in the object
9547 pointed to by quo is unspecified and whether a domain error occurs or the functions
9548 return zero is implementation defined.
9549 <a name="7.12.11" href="#7.12.11"><b> 7.12.11 Manipulation functions</b></a>
9550 <a name="7.12.11.1" href="#7.12.11.1"><b> 7.12.11.1 The copysign functions</b></a>
9551 Synopsis
9552 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9553 double copysign(double x, double y);
9554 float copysignf(float x, float y);
9555 long double copysignl(long double x, long double y);
9556 Description
9557 2 The copysign functions produce a value with the magnitude of x and the sign of y.
9558 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
9559 represent a signed zero but do not treat negative zero consistently in arithmetic
9560 operations, the copysign functions regard the sign of zero as positive.
9561 Returns
9562 3 The copysign functions return a value with the magnitude of x and the sign of y.
9567 [<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
9569 <a name="7.12.11.2" href="#7.12.11.2"><b> 7.12.11.2 The nan functions</b></a>
9570 Synopsis
9571 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9572 double nan(const char *tagp);
9573 float nanf(const char *tagp);
9574 long double nanl(const char *tagp);
9575 Description
9576 2 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
9577 sequence)", (char**) NULL); the call nan("") is equivalent to
9578 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
9579 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
9580 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
9581 and strtold.
9582 Returns
9583 3 The nan functions return a quiet NaN, if available, with content indicated through tagp.
9584 If the implementation does not support quiet NaNs, the functions return zero.
9585 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
9586 <a name="7.12.11.3" href="#7.12.11.3"><b> 7.12.11.3 The nextafter functions</b></a>
9587 Synopsis
9588 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9589 double nextafter(double x, double y);
9590 float nextafterf(float x, float y);
9591 long double nextafterl(long double x, long double y);
9592 Description
9593 2 The nextafter functions determine the next representable value, in the type of the
9594 function, after x in the direction of y, where x and y are first converted to the type of the
9595 function.211) The nextafter functions return y if x equals y. A range error may occur
9596 if the magnitude of x is the largest finite value representable in the type and the result is
9597 infinite or not representable in the type.
9598 Returns
9599 3 The nextafter functions return the next representable value in the specified format
9600 after x in the direction of y.
9603 211) The argument values are converted to the type of the function, even by a macro implementation of the
9604 function.
9606 [<a name="p237" href="#p237">page 237</a>] (<a href="#Contents">Contents</a>)
9608 <a name="7.12.11.4" href="#7.12.11.4"><b> 7.12.11.4 The nexttoward functions</b></a>
9609 Synopsis
9610 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9611 double nexttoward(double x, long double y);
9612 float nexttowardf(float x, long double y);
9613 long double nexttowardl(long double x, long double y);
9614 Description
9615 2 The nexttoward functions are equivalent to the nextafter functions except that the
9616 second parameter has type long double and the functions return y converted to the
9617 type of the function if x equals y.212)
9618 <a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
9619 <a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
9620 Synopsis
9621 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9622 double fdim(double x, double y);
9623 float fdimf(float x, float y);
9624 long double fdiml(long double x, long double y);
9625 Description
9626 2 The fdim functions determine the positive difference between their arguments:
9627 ???x - y if x &gt; y
9629 ???+0 if x &lt;= y
9630 A range error may occur.
9631 Returns
9632 3 The fdim functions return the positive difference value.
9633 <a name="7.12.12.2" href="#7.12.12.2"><b> 7.12.12.2 The fmax functions</b></a>
9634 Synopsis
9635 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9636 double fmax(double x, double y);
9637 float fmaxf(float x, float y);
9638 long double fmaxl(long double x, long double y);
9642 212) The result of the nexttoward functions is determined in the type of the function, without loss of
9643 range or precision in a floating second argument.
9645 [<a name="p238" href="#p238">page 238</a>] (<a href="#Contents">Contents</a>)
9647 Description
9648 2 The fmax functions determine the maximum numeric value of their arguments.213)
9649 Returns
9650 3 The fmax functions return the maximum numeric value of their arguments.
9651 <a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
9652 Synopsis
9653 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9654 double fmin(double x, double y);
9655 float fminf(float x, float y);
9656 long double fminl(long double x, long double y);
9657 Description
9658 2 The fmin functions determine the minimum numeric value of their arguments.214)
9659 Returns
9660 3 The fmin functions return the minimum numeric value of their arguments.
9661 <a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
9662 <a name="7.12.13.1" href="#7.12.13.1"><b> 7.12.13.1 The fma functions</b></a>
9663 Synopsis
9664 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9665 double fma(double x, double y, double z);
9666 float fmaf(float x, float y, float z);
9667 long double fmal(long double x, long double y,
9668 long double z);
9669 Description
9670 2 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
9671 the value (as if) to infinite precision and round once to the result format, according to the
9672 current rounding mode. A range error may occur.
9673 Returns
9674 3 The fma functions return (x x y) + z, rounded as one ternary operation.
9679 213) NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
9680 fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
9681 214) The fmin functions are analogous to the fmax functions in their treatment of NaNs.
9683 [<a name="p239" href="#p239">page 239</a>] (<a href="#Contents">Contents</a>)
9685 <a name="7.12.14" href="#7.12.14"><b> 7.12.14 Comparison macros</b></a>
9686 1 The relational and equality operators support the usual mathematical relationships
9687 between numeric values. For any ordered pair of numeric values exactly one of the
9688 relationships -- less, greater, and equal -- is true. Relational operators may raise the
9689 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
9690 numeric value, or for two NaNs, just the unordered relationship is true.215) The following
9691 subclauses provide macros that are quiet (non floating-point exception raising) versions
9692 of the relational operators, and other comparison macros that facilitate writing efficient
9693 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
9694 the synopses in this subclause, real-floating indicates that the argument shall be an
9695 expression of real floating type.
9696 <a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
9697 Synopsis
9698 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9699 int isgreater(real-floating x, real-floating y);
9700 Description
9701 2 The isgreater macro determines whether its first argument is greater than its second
9702 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
9703 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
9704 exception when x and y are unordered.
9705 Returns
9706 3 The isgreater macro returns the value of (x) &gt; (y).
9707 <a name="7.12.14.2" href="#7.12.14.2"><b> 7.12.14.2 The isgreaterequal macro</b></a>
9708 Synopsis
9709 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9710 int isgreaterequal(real-floating x, real-floating y);
9711 Description
9712 2 The isgreaterequal macro determines whether its first argument is greater than or
9713 equal to its second argument. The value of isgreaterequal(x, y) is always equal
9714 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
9715 not raise the ''invalid'' floating-point exception when x and y are unordered.
9719 215) IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
9720 the operands compare unordered, as an error indicator for programs written without consideration of
9721 NaNs; the result in these cases is false.
9723 [<a name="p240" href="#p240">page 240</a>] (<a href="#Contents">Contents</a>)
9725 Returns
9726 3 The isgreaterequal macro returns the value of (x) &gt;= (y).
9727 <a name="7.12.14.3" href="#7.12.14.3"><b> 7.12.14.3 The isless macro</b></a>
9728 Synopsis
9729 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9730 int isless(real-floating x, real-floating y);
9731 Description
9732 2 The isless macro determines whether its first argument is less than its second
9733 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
9734 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
9735 exception when x and y are unordered.
9736 Returns
9737 3 The isless macro returns the value of (x) &lt; (y).
9738 <a name="7.12.14.4" href="#7.12.14.4"><b> 7.12.14.4 The islessequal macro</b></a>
9739 Synopsis
9740 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9741 int islessequal(real-floating x, real-floating y);
9742 Description
9743 2 The islessequal macro determines whether its first argument is less than or equal to
9744 its second argument. The value of islessequal(x, y) is always equal to
9745 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
9746 the ''invalid'' floating-point exception when x and y are unordered.
9747 Returns
9748 3 The islessequal macro returns the value of (x) &lt;= (y).
9749 <a name="7.12.14.5" href="#7.12.14.5"><b> 7.12.14.5 The islessgreater macro</b></a>
9750 Synopsis
9751 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9752 int islessgreater(real-floating x, real-floating y);
9753 Description
9754 2 The islessgreater macro determines whether its first argument is less than or
9755 greater than its second argument. The islessgreater(x, y) macro is similar to
9756 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
9757 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
9758 and y twice).
9759 [<a name="p241" href="#p241">page 241</a>] (<a href="#Contents">Contents</a>)
9761 Returns
9762 3 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
9763 <a name="7.12.14.6" href="#7.12.14.6"><b> 7.12.14.6 The isunordered macro</b></a>
9764 Synopsis
9765 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9766 int isunordered(real-floating x, real-floating y);
9767 Description
9768 2 The isunordered macro determines whether its arguments are unordered.
9769 Returns
9770 3 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
9775 [<a name="p242" href="#p242">page 242</a>] (<a href="#Contents">Contents</a>)
9777 <a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
9778 1 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
9779 one type, for bypassing the normal function call and return discipline.216)
9780 2 The type declared is
9781 jmp_buf
9782 which is an array type suitable for holding the information needed to restore a calling
9783 environment. The environment of a call to the setjmp macro consists of information
9784 sufficient for a call to the longjmp function to return execution to the correct block and
9785 invocation of that block, were it called recursively. It does not include the state of the
9786 floating-point status flags, of open files, or of any other component of the abstract
9787 machine.
9788 3 It is unspecified whether setjmp is a macro or an identifier declared with external
9789 linkage. If a macro definition is suppressed in order to access an actual function, or a
9790 program defines an external identifier with the name setjmp, the behavior is undefined.
9791 <a name="7.13.1" href="#7.13.1"><b> 7.13.1 Save calling environment</b></a>
9792 <a name="7.13.1.1" href="#7.13.1.1"><b> 7.13.1.1 The setjmp macro</b></a>
9793 Synopsis
9794 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9795 int setjmp(jmp_buf env);
9796 Description
9797 2 The setjmp macro saves its calling environment in its jmp_buf argument for later use
9798 by the longjmp function.
9799 Returns
9800 3 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
9801 return is from a call to the longjmp function, the setjmp macro returns a nonzero
9802 value.
9803 Environmental limits
9804 4 An invocation of the setjmp macro shall appear only in one of the following contexts:
9805 -- the entire controlling expression of a selection or iteration statement;
9806 -- one operand of a relational or equality operator with the other operand an integer
9807 constant expression, with the resulting expression being the entire controlling
9810 216) These functions are useful for dealing with unusual conditions encountered in a low-level function of
9811 a program.
9813 [<a name="p243" href="#p243">page 243</a>] (<a href="#Contents">Contents</a>)
9815 expression of a selection or iteration statement;
9816 -- the operand of a unary ! operator with the resulting expression being the entire
9817 controlling expression of a selection or iteration statement; or
9818 -- the entire expression of an expression statement (possibly cast to void).
9819 5 If the invocation appears in any other context, the behavior is undefined.
9820 <a name="7.13.2" href="#7.13.2"><b> 7.13.2 Restore calling environment</b></a>
9821 <a name="7.13.2.1" href="#7.13.2.1"><b> 7.13.2.1 The longjmp function</b></a>
9822 Synopsis
9823 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9824 void longjmp(jmp_buf env, int val);
9825 Description
9826 2 The longjmp function restores the environment saved by the most recent invocation of
9827 the setjmp macro in the same invocation of the program with the corresponding
9828 jmp_buf argument. If there has been no such invocation, or if the function containing
9829 the invocation of the setjmp macro has terminated execution217) in the interim, or if the
9830 invocation of the setjmp macro was within the scope of an identifier with variably
9831 modified type and execution has left that scope in the interim, the behavior is undefined.
9832 3 All accessible objects have values, and all other components of the abstract machine218)
9833 have state, as of the time the longjmp function was called, except that the values of
9834 objects of automatic storage duration that are local to the function containing the
9835 invocation of the corresponding setjmp macro that do not have volatile-qualified type
9836 and have been changed between the setjmp invocation and longjmp call are
9837 indeterminate.
9838 Returns
9839 4 After longjmp is completed, program execution continues as if the corresponding
9840 invocation of the setjmp macro had just returned the value specified by val. The
9841 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
9842 the setjmp macro returns the value 1.
9843 5 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
9844 might cause memory associated with a variable length array object to be squandered.
9849 217) For example, by executing a return statement or because another longjmp call has caused a
9850 transfer to a setjmp invocation in a function earlier in the set of nested calls.
9851 218) This includes, but is not limited to, the floating-point status flags and the state of open files.
9853 [<a name="p244" href="#p244">page 244</a>] (<a href="#Contents">Contents</a>)
9855 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9856 jmp_buf buf;
9857 void g(int n);
9858 void h(int n);
9859 int n = 6;
9860 void f(void)
9862 int x[n]; // valid: f is not terminated
9863 setjmp(buf);
9864 g(n);
9866 void g(int n)
9868 int a[n]; // a may remain allocated
9869 h(n);
9871 void h(int n)
9873 int b[n]; // b may remain allocated
9874 longjmp(buf, 2); // might cause memory loss
9880 [<a name="p245" href="#p245">page 245</a>] (<a href="#Contents">Contents</a>)
9882 <a name="7.14" href="#7.14"><b> 7.14 Signal handling &lt;signal.h&gt;</b></a>
9883 1 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
9884 for handling various signals (conditions that may be reported during program execution).
9885 2 The type defined is
9886 sig_atomic_t
9887 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
9888 an atomic entity, even in the presence of asynchronous interrupts.
9889 3 The macros defined are
9890 SIG_DFL
9891 SIG_ERR
9892 SIG_IGN
9893 which expand to constant expressions with distinct values that have type compatible with
9894 the second argument to, and the return value of, the signal function, and whose values
9895 compare unequal to the address of any declarable function; and the following, which
9896 expand to positive integer constant expressions with type int and distinct values that are
9897 the signal numbers, each corresponding to the specified condition:
9898 SIGABRT abnormal termination, such as is initiated by the abort function
9899 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
9900 resulting in overflow
9901 SIGILL detection of an invalid function image, such as an invalid instruction
9902 SIGINT receipt of an interactive attention signal
9903 SIGSEGV an invalid access to storage
9904 SIGTERM a termination request sent to the program
9905 4 An implementation need not generate any of these signals, except as a result of explicit
9906 calls to the raise function. Additional signals and pointers to undeclarable functions,
9907 with macro definitions beginning, respectively, with the letters SIG and an uppercase
9908 letter or with SIG_ and an uppercase letter,219) may also be specified by the
9909 implementation. The complete set of signals, their semantics, and their default handling
9910 is implementation-defined; all signal numbers shall be positive.
9915 219) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>). The names of the signal numbers reflect the following terms
9916 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
9917 and termination.
9919 [<a name="p246" href="#p246">page 246</a>] (<a href="#Contents">Contents</a>)
9921 <a name="7.14.1" href="#7.14.1"><b> 7.14.1 Specify signal handling</b></a>
9922 <a name="7.14.1.1" href="#7.14.1.1"><b> 7.14.1.1 The signal function</b></a>
9923 Synopsis
9924 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
9925 void (*signal(int sig, void (*func)(int)))(int);
9926 Description
9927 2 The signal function chooses one of three ways in which receipt of the signal number
9928 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
9929 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
9930 Otherwise, func shall point to a function to be called when that signal occurs. An
9931 invocation of such a function because of a signal, or (recursively) of any further functions
9932 called by that invocation (other than functions in the standard library), is called a signal
9933 handler.
9934 3 When a signal occurs and func points to a function, it is implementation-defined
9935 whether the equivalent of signal(sig, SIG_DFL); is executed or the
9936 implementation prevents some implementation-defined set of signals (at least including
9937 sig) from occurring until the current signal handling has completed; in the case of
9938 SIGILL, the implementation may alternatively define that no action is taken. Then the
9939 equivalent of (*func)(sig); is executed. If and when the function returns, if the
9940 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
9941 value corresponding to a computational exception, the behavior is undefined; otherwise
9942 the program will resume execution at the point it was interrupted.
9943 4 If the signal occurs as the result of calling the abort or raise function, the signal
9944 handler shall not call the raise function.
9945 5 If the signal occurs other than as the result of calling the abort or raise function, the
9946 behavior is undefined if the signal handler refers to any object with static storage duration
9947 other than by assigning a value to an object declared as volatile sig_atomic_t, or
9948 the signal handler calls any function in the standard library other than the abort
9949 function, the _Exit function, or the signal function with the first argument equal to
9950 the signal number corresponding to the signal that caused the invocation of the handler.
9951 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
9952 value of errno is indeterminate.220)
9953 6 At program startup, the equivalent of
9954 signal(sig, SIG_IGN);
9957 220) If any signal is generated by an asynchronous signal handler, the behavior is undefined.
9959 [<a name="p247" href="#p247">page 247</a>] (<a href="#Contents">Contents</a>)
9961 may be executed for some signals selected in an implementation-defined manner; the
9962 equivalent of
9963 signal(sig, SIG_DFL);
9964 is executed for all other signals defined by the implementation.
9965 7 The implementation shall behave as if no library function calls the signal function.
9966 Returns
9967 8 If the request can be honored, the signal function returns the value of func for the
9968 most recent successful call to signal for the specified signal sig. Otherwise, a value of
9969 SIG_ERR is returned and a positive value is stored in errno.
9970 Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>), the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the
9971 _Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
9972 <a name="7.14.2" href="#7.14.2"><b> 7.14.2 Send signal</b></a>
9973 <a name="7.14.2.1" href="#7.14.2.1"><b> 7.14.2.1 The raise function</b></a>
9974 Synopsis
9975 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
9976 int raise(int sig);
9977 Description
9978 2 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
9979 signal handler is called, the raise function shall not return until after the signal handler
9980 does.
9981 Returns
9982 3 The raise function returns zero if successful, nonzero if unsuccessful.
9987 [<a name="p248" href="#p248">page 248</a>] (<a href="#Contents">Contents</a>)
9989 <a name="7.15" href="#7.15"><b> 7.15 Variable arguments &lt;stdarg.h&gt;</b></a>
9990 1 The header <a href="#7.15">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
9991 through a list of arguments whose number and types are not known to the called function
9992 when it is translated.
9993 2 A function may be called with a variable number of arguments of varying types. As
9994 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
9995 parameter plays a special role in the access mechanism, and will be designated parmN in
9996 this description.
9997 3 The type declared is
9998 va_list
9999 which is an object type suitable for holding information needed by the macros
10000 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
10001 desired, the called function shall declare an object (generally referred to as ap in this
10002 subclause) having type va_list. The object ap may be passed as an argument to
10003 another function; if that function invokes the va_arg macro with parameter ap, the
10004 value of ap in the calling function is indeterminate and shall be passed to the va_end
10005 macro prior to any further reference to ap.221)
10006 <a name="7.15.1" href="#7.15.1"><b> 7.15.1 Variable argument list access macros</b></a>
10007 1 The va_start and va_arg macros described in this subclause shall be implemented
10008 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
10009 identifiers declared with external linkage. If a macro definition is suppressed in order to
10010 access an actual function, or a program defines an external identifier with the same name,
10011 the behavior is undefined. Each invocation of the va_start and va_copy macros
10012 shall be matched by a corresponding invocation of the va_end macro in the same
10013 function.
10014 <a name="7.15.1.1" href="#7.15.1.1"><b> 7.15.1.1 The va_arg macro</b></a>
10015 Synopsis
10016 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10017 type va_arg(va_list ap, type);
10018 Description
10019 2 The va_arg macro expands to an expression that has the specified type and the value of
10020 the next argument in the call. The parameter ap shall have been initialized by the
10021 va_start or va_copy macro (without an intervening invocation of the va_end
10023 221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
10024 case the original function may make further use of the original list after the other function returns.
10026 [<a name="p249" href="#p249">page 249</a>] (<a href="#Contents">Contents</a>)
10028 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
10029 values of successive arguments are returned in turn. The parameter type shall be a type
10030 name specified such that the type of a pointer to an object that has the specified type can
10031 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
10032 type is not compatible with the type of the actual next argument (as promoted according
10033 to the default argument promotions), the behavior is undefined, except for the following
10034 cases:
10035 -- one type is a signed integer type, the other type is the corresponding unsigned integer
10036 type, and the value is representable in both types;
10037 -- one type is pointer to void and the other is a pointer to a character type.
10038 Returns
10039 3 The first invocation of the va_arg macro after that of the va_start macro returns the
10040 value of the argument after that specified by parmN . Successive invocations return the
10041 values of the remaining arguments in succession.
10042 <a name="7.15.1.2" href="#7.15.1.2"><b> 7.15.1.2 The va_copy macro</b></a>
10043 Synopsis
10044 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10045 void va_copy(va_list dest, va_list src);
10046 Description
10047 2 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
10048 been applied to dest followed by the same sequence of uses of the va_arg macro as
10049 had previously been used to reach the present state of src. Neither the va_copy nor
10050 va_start macro shall be invoked to reinitialize dest without an intervening
10051 invocation of the va_end macro for the same dest.
10052 Returns
10053 3 The va_copy macro returns no value.
10054 <a name="7.15.1.3" href="#7.15.1.3"><b> 7.15.1.3 The va_end macro</b></a>
10055 Synopsis
10056 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10057 void va_end(va_list ap);
10058 Description
10059 2 The va_end macro facilitates a normal return from the function whose variable
10060 argument list was referred to by the expansion of the va_start macro, or the function
10061 containing the expansion of the va_copy macro, that initialized the va_list ap. The
10062 va_end macro may modify ap so that it is no longer usable (without being reinitialized
10064 [<a name="p250" href="#p250">page 250</a>] (<a href="#Contents">Contents</a>)
10066 by the va_start or va_copy macro). If there is no corresponding invocation of the
10067 va_start or va_copy macro, or if the va_end macro is not invoked before the
10068 return, the behavior is undefined.
10069 Returns
10070 3 The va_end macro returns no value.
10071 <a name="7.15.1.4" href="#7.15.1.4"><b> 7.15.1.4 The va_start macro</b></a>
10072 Synopsis
10073 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10074 void va_start(va_list ap, parmN);
10075 Description
10076 2 The va_start macro shall be invoked before any access to the unnamed arguments.
10077 3 The va_start macro initializes ap for subsequent use by the va_arg and va_end
10078 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
10079 without an intervening invocation of the va_end macro for the same ap.
10080 4 The parameter parmN is the identifier of the rightmost parameter in the variable
10081 parameter list in the function definition (the one just before the , ...). If the parameter
10082 parmN is declared with the register storage class, with a function or array type, or
10083 with a type that is not compatible with the type that results after application of the default
10084 argument promotions, the behavior is undefined.
10085 Returns
10086 5 The va_start macro returns no value.
10087 6 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
10088 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
10089 pointers is specified by the first argument to f1.
10090 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10091 #define MAXARGS 31
10092 void f1(int n_ptrs, ...)
10094 va_list ap;
10095 char *array[MAXARGS];
10096 int ptr_no = 0;
10101 [<a name="p251" href="#p251">page 251</a>] (<a href="#Contents">Contents</a>)
10103 if (n_ptrs &gt; MAXARGS)
10104 n_ptrs = MAXARGS;
10105 va_start(ap, n_ptrs);
10106 while (ptr_no &lt; n_ptrs)
10107 array[ptr_no++] = va_arg(ap, char *);
10108 va_end(ap);
10109 f2(n_ptrs, array);
10111 Each call to f1 is required to have visible the definition of the function or a declaration such as
10112 void f1(int, ...);
10114 7 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
10115 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
10116 is gathered again and passed to function f4.
10117 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
10118 #define MAXARGS 31
10119 void f3(int n_ptrs, int f4_after, ...)
10121 va_list ap, ap_save;
10122 char *array[MAXARGS];
10123 int ptr_no = 0;
10124 if (n_ptrs &gt; MAXARGS)
10125 n_ptrs = MAXARGS;
10126 va_start(ap, f4_after);
10127 while (ptr_no &lt; n_ptrs) {
10128 array[ptr_no++] = va_arg(ap, char *);
10129 if (ptr_no == f4_after)
10130 va_copy(ap_save, ap);
10132 va_end(ap);
10133 f2(n_ptrs, array);
10134 // Now process the saved copy.
10135 n_ptrs -= f4_after;
10136 ptr_no = 0;
10137 while (ptr_no &lt; n_ptrs)
10138 array[ptr_no++] = va_arg(ap_save, char *);
10139 va_end(ap_save);
10140 f4(n_ptrs, array);
10146 [<a name="p252" href="#p252">page 252</a>] (<a href="#Contents">Contents</a>)
10148 <a name="7.16" href="#7.16"><b> 7.16 Boolean type and values &lt;stdbool.h&gt;</b></a>
10149 1 The header <a href="#7.16">&lt;stdbool.h&gt;</a> defines four macros.
10150 2 The macro
10151 bool
10152 expands to _Bool.
10153 3 The remaining three macros are suitable for use in #if preprocessing directives. They
10155 true
10156 which expands to the integer constant 1,
10157 false
10158 which expands to the integer constant 0, and
10159 __bool_true_false_are_defined
10160 which expands to the integer constant 1.
10161 4 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
10162 redefine the macros bool, true, and false.222)
10167 222) See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
10169 [<a name="p253" href="#p253">page 253</a>] (<a href="#Contents">Contents</a>)
10171 <a name="7.17" href="#7.17"><b> 7.17 Common definitions &lt;stddef.h&gt;</b></a>
10172 1 The following types and macros are defined in the standard header <a href="#7.17">&lt;stddef.h&gt;</a>. Some
10173 are also defined in other headers, as noted in their respective subclauses.
10174 2 The types are
10175 ptrdiff_t
10176 which is the signed integer type of the result of subtracting two pointers;
10177 size_t
10178 which is the unsigned integer type of the result of the sizeof operator; and
10179 wchar_t
10180 which is an integer type whose range of values can represent distinct codes for all
10181 members of the largest extended character set specified among the supported locales; the
10182 null character shall have the code value zero. Each member of the basic character set
10183 shall have a code value equal to its value when used as the lone character in an integer
10184 character constant if an implementation does not define
10185 __STDC_MB_MIGHT_NEQ_WC__.
10186 3 The macros are
10187 NULL
10188 which expands to an implementation-defined null pointer constant; and
10189 offsetof(type, member-designator)
10190 which expands to an integer constant expression that has type size_t, the value of
10191 which is the offset in bytes, to the structure member (designated by member-designator),
10192 from the beginning of its structure (designated by type). The type and member designator
10193 shall be such that given
10194 static type t;
10195 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
10196 specified member is a bit-field, the behavior is undefined.)
10197 Recommended practice
10198 4 The types used for size_t and ptrdiff_t should not have an integer conversion rank
10199 greater than that of signed long int unless the implementation supports objects
10200 large enough to make this necessary.
10201 Forward references: localization (<a href="#7.11">7.11</a>).
10206 [<a name="p254" href="#p254">page 254</a>] (<a href="#Contents">Contents</a>)
10208 <a name="7.18" href="#7.18"><b> 7.18 Integer types &lt;stdint.h&gt;</b></a>
10209 1 The header <a href="#7.18">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
10210 defines corresponding sets of macros.223) It also defines macros that specify limits of
10211 integer types corresponding to types defined in other standard headers.
10212 2 Types are defined in the following categories:
10213 -- integer types having certain exact widths;
10214 -- integer types having at least certain specified widths;
10215 -- fastest integer types having at least certain specified widths;
10216 -- integer types wide enough to hold pointers to objects;
10217 -- integer types having greatest width.
10218 (Some of these types may denote the same type.)
10219 3 Corresponding macros specify limits of the declared types and construct suitable
10220 constants.
10221 4 For each type described herein that the implementation provides,224) <a href="#7.18">&lt;stdint.h&gt;</a> shall
10222 declare that typedef name and define the associated macros. Conversely, for each type
10223 described herein that the implementation does not provide, <a href="#7.18">&lt;stdint.h&gt;</a> shall not
10224 declare that typedef name nor shall it define the associated macros. An implementation
10225 shall provide those types described as ''required'', but need not provide any of the others
10226 (described as ''optional'').
10227 <a name="7.18.1" href="#7.18.1"><b> 7.18.1 Integer types</b></a>
10228 1 When typedef names differing only in the absence or presence of the initial u are defined,
10229 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
10230 implementation providing one of these corresponding types shall also provide the other.
10231 2 In the following descriptions, the symbol N represents an unsigned decimal integer with
10232 no leading zeros (e.g., 8 or 24, but not 04 or 048).
10237 223) See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
10238 224) Some of these types may denote implementation-defined extended integer types.
10240 [<a name="p255" href="#p255">page 255</a>] (<a href="#Contents">Contents</a>)
10242 <a name="7.18.1.1" href="#7.18.1.1"><b> 7.18.1.1 Exact-width integer types</b></a>
10243 1 The typedef name intN_t designates a signed integer type with width N , no padding
10244 bits, and a two's complement representation. Thus, int8_t denotes a signed integer
10245 type with a width of exactly 8 bits.
10246 2 The typedef name uintN_t designates an unsigned integer type with width N . Thus,
10247 uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
10248 3 These types are optional. However, if an implementation provides integer types with
10249 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
10250 two's complement representation, it shall define the corresponding typedef names.
10251 <a name="7.18.1.2" href="#7.18.1.2"><b> 7.18.1.2 Minimum-width integer types</b></a>
10252 1 The typedef name int_leastN_t designates a signed integer type with a width of at
10253 least N , such that no signed integer type with lesser size has at least the specified width.
10254 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
10255 2 The typedef name uint_leastN_t designates an unsigned integer type with a width
10256 of at least N , such that no unsigned integer type with lesser size has at least the specified
10257 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
10258 least 16 bits.
10259 3 The following types are required:
10260 int_least8_t uint_least8_t
10261 int_least16_t uint_least16_t
10262 int_least32_t uint_least32_t
10263 int_least64_t uint_least64_t
10264 All other types of this form are optional.
10265 <a name="7.18.1.3" href="#7.18.1.3"><b> 7.18.1.3 Fastest minimum-width integer types</b></a>
10266 1 Each of the following types designates an integer type that is usually fastest225) to operate
10267 with among all integer types that have at least the specified width.
10268 2 The typedef name int_fastN_t designates the fastest signed integer type with a width
10269 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
10270 type with a width of at least N .
10275 225) The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
10276 grounds for choosing one type over another, it will simply pick some integer type satisfying the
10277 signedness and width requirements.
10279 [<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
10281 3 The following types are required:
10282 int_fast8_t uint_fast8_t
10283 int_fast16_t uint_fast16_t
10284 int_fast32_t uint_fast32_t
10285 int_fast64_t uint_fast64_t
10286 All other types of this form are optional.
10287 <a name="7.18.1.4" href="#7.18.1.4"><b> 7.18.1.4 Integer types capable of holding object pointers</b></a>
10288 1 The following type designates a signed integer type with the property that any valid
10289 pointer to void can be converted to this type, then converted back to pointer to void,
10290 and the result will compare equal to the original pointer:
10291 intptr_t
10292 The following type designates an unsigned integer type with the property that any valid
10293 pointer to void can be converted to this type, then converted back to pointer to void,
10294 and the result will compare equal to the original pointer:
10295 uintptr_t
10296 These types are optional.
10297 <a name="7.18.1.5" href="#7.18.1.5"><b> 7.18.1.5 Greatest-width integer types</b></a>
10298 1 The following type designates a signed integer type capable of representing any value of
10299 any signed integer type:
10300 intmax_t
10301 The following type designates an unsigned integer type capable of representing any value
10302 of any unsigned integer type:
10303 uintmax_t
10304 These types are required.
10305 <a name="7.18.2" href="#7.18.2"><b> 7.18.2 Limits of specified-width integer types</b></a>
10306 1 The following object-like macros226) specify the minimum and maximum limits of the
10307 types declared in <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
10308 <a name="7.18.1" href="#7.18.1"><b> 7.18.1.</b></a>
10309 2 Each instance of any defined macro shall be replaced by a constant expression suitable
10310 for use in #if preprocessing directives, and this expression shall have the same type as
10311 would an expression that is an object of the corresponding type converted according to
10313 226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
10314 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10316 [<a name="p257" href="#p257">page 257</a>] (<a href="#Contents">Contents</a>)
10318 the integer promotions. Its implementation-defined value shall be equal to or greater in
10319 magnitude (absolute value) than the corresponding value given below, with the same sign,
10320 except where stated to be exactly the given value.
10321 <a name="7.18.2.1" href="#7.18.2.1"><b> 7.18.2.1 Limits of exact-width integer types</b></a>
10322 1 -- minimum values of exact-width signed integer types
10323 INTN_MIN exactly -(2 N -1 )
10324 -- maximum values of exact-width signed integer types
10325 INTN_MAX exactly 2 N -1 - 1
10326 -- maximum values of exact-width unsigned integer types
10327 UINTN_MAX exactly 2 N - 1
10328 <a name="7.18.2.2" href="#7.18.2.2"><b> 7.18.2.2 Limits of minimum-width integer types</b></a>
10329 1 -- minimum values of minimum-width signed integer types
10330 INT_LEASTN_MIN -(2 N -1 - 1)
10331 -- maximum values of minimum-width signed integer types
10332 INT_LEASTN_MAX 2 N -1 - 1
10333 -- maximum values of minimum-width unsigned integer types
10334 UINT_LEASTN_MAX 2N - 1
10335 <a name="7.18.2.3" href="#7.18.2.3"><b> 7.18.2.3 Limits of fastest minimum-width integer types</b></a>
10336 1 -- minimum values of fastest minimum-width signed integer types
10337 INT_FASTN_MIN -(2 N -1 - 1)
10338 -- maximum values of fastest minimum-width signed integer types
10339 INT_FASTN_MAX 2 N -1 - 1
10340 -- maximum values of fastest minimum-width unsigned integer types
10341 UINT_FASTN_MAX 2N - 1
10342 <a name="7.18.2.4" href="#7.18.2.4"><b> 7.18.2.4 Limits of integer types capable of holding object pointers</b></a>
10343 1 -- minimum value of pointer-holding signed integer type
10344 INTPTR_MIN -(215 - 1)
10345 -- maximum value of pointer-holding signed integer type
10346 INTPTR_MAX 215 - 1
10350 [<a name="p258" href="#p258">page 258</a>] (<a href="#Contents">Contents</a>)
10352 -- maximum value of pointer-holding unsigned integer type
10353 UINTPTR_MAX 216 - 1
10354 <a name="7.18.2.5" href="#7.18.2.5"><b> 7.18.2.5 Limits of greatest-width integer types</b></a>
10355 1 -- minimum value of greatest-width signed integer type
10356 INTMAX_MIN -(263 - 1)
10357 -- maximum value of greatest-width signed integer type
10358 INTMAX_MAX 263 - 1
10359 -- maximum value of greatest-width unsigned integer type
10360 UINTMAX_MAX 264 - 1
10361 <a name="7.18.3" href="#7.18.3"><b> 7.18.3 Limits of other integer types</b></a>
10362 1 The following object-like macros227) specify the minimum and maximum limits of
10363 integer types corresponding to types defined in other standard headers.
10364 2 Each instance of these macros shall be replaced by a constant expression suitable for use
10365 in #if preprocessing directives, and this expression shall have the same type as would an
10366 expression that is an object of the corresponding type converted according to the integer
10367 promotions. Its implementation-defined value shall be equal to or greater in magnitude
10368 (absolute value) than the corresponding value given below, with the same sign. An
10369 implementation shall define only the macros corresponding to those typedef names it
10370 actually provides.228)
10371 -- limits of ptrdiff_t
10372 PTRDIFF_MIN -65535
10373 PTRDIFF_MAX +65535
10374 -- limits of sig_atomic_t
10375 SIG_ATOMIC_MIN see below
10376 SIG_ATOMIC_MAX see below
10377 -- limit of size_t
10378 SIZE_MAX 65535
10379 -- limits of wchar_t
10383 227) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
10384 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10385 228) A freestanding implementation need not provide all of these types.
10387 [<a name="p259" href="#p259">page 259</a>] (<a href="#Contents">Contents</a>)
10389 WCHAR_MIN see below
10390 WCHAR_MAX see below
10391 -- limits of wint_t
10392 WINT_MIN see below
10393 WINT_MAX see below
10394 3 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
10395 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
10396 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
10397 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
10398 SIG_ATOMIC_MAX shall be no less than 255.
10399 4 If wchar_t (see <a href="#7.17">7.17</a>) is defined as a signed integer type, the value of WCHAR_MIN
10400 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
10401 otherwise, wchar_t is defined as an unsigned integer type, and the value of
10402 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.229)
10403 5 If wint_t (see <a href="#7.24">7.24</a>) is defined as a signed integer type, the value of WINT_MIN shall
10404 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
10405 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
10406 shall be 0 and the value of WINT_MAX shall be no less than 65535.
10407 <a name="7.18.4" href="#7.18.4"><b> 7.18.4 Macros for integer constants</b></a>
10408 1 The following function-like macros230) expand to integer constants suitable for
10409 initializing objects that have integer types corresponding to types defined in
10410 <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
10411 <a name="7.18.1.5" href="#7.18.1.5"><b> 7.18.1.5.</b></a>
10412 2 The argument in any instance of these macros shall be an unsuffixed integer constant (as
10413 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.
10414 3 Each invocation of one of these macros shall expand to an integer constant expression
10415 suitable for use in #if preprocessing directives. The type of the expression shall have
10416 the same type as would an expression of the corresponding type converted according to
10417 the integer promotions. The value of the expression shall be that of the argument.
10422 229) The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
10423 character set.
10424 230) C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
10425 defined before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10427 [<a name="p260" href="#p260">page 260</a>] (<a href="#Contents">Contents</a>)
10429 <a name="7.18.4.1" href="#7.18.4.1"><b> 7.18.4.1 Macros for minimum-width integer constants</b></a>
10430 1 The macro INTN_C(value) shall expand to an integer constant expression
10431 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
10432 to an integer constant expression corresponding to the type uint_leastN_t. For
10433 example, if uint_least64_t is a name for the type unsigned long long int,
10434 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
10435 <a name="7.18.4.2" href="#7.18.4.2"><b> 7.18.4.2 Macros for greatest-width integer constants</b></a>
10436 1 The following macro expands to an integer constant expression having the value specified
10437 by its argument and the type intmax_t:
10438 INTMAX_C(value)
10439 The following macro expands to an integer constant expression having the value specified
10440 by its argument and the type uintmax_t:
10441 UINTMAX_C(value)
10446 [<a name="p261" href="#p261">page 261</a>] (<a href="#Contents">Contents</a>)
10448 <a name="7.19" href="#7.19"><b> 7.19 Input/output &lt;stdio.h&gt;</b></a>
10449 <a name="7.19.1" href="#7.19.1"><b> 7.19.1 Introduction</b></a>
10450 1 The header <a href="#7.19">&lt;stdio.h&gt;</a> declares three types, several macros, and many functions for
10451 performing input and output.
10452 2 The types declared are size_t (described in <a href="#7.17">7.17</a>);
10453 FILE
10454 which is an object type capable of recording all the information needed to control a
10455 stream, including its file position indicator, a pointer to its associated buffer (if any), an
10456 error indicator that records whether a read/write error has occurred, and an end-of-file
10457 indicator that records whether the end of the file has been reached; and
10458 fpos_t
10459 which is an object type other than an array type capable of recording all the information
10460 needed to specify uniquely every position within a file.
10461 3 The macros are NULL (described in <a href="#7.17">7.17</a>);
10462 _IOFBF
10463 _IOLBF
10464 _IONBF
10465 which expand to integer constant expressions with distinct values, suitable for use as the
10466 third argument to the setvbuf function;
10467 BUFSIZ
10468 which expands to an integer constant expression that is the size of the buffer used by the
10469 setbuf function;
10471 which expands to an integer constant expression, with type int and a negative value, that
10472 is returned by several functions to indicate end-of-file, that is, no more input from a
10473 stream;
10474 FOPEN_MAX
10475 which expands to an integer constant expression that is the minimum number of files that
10476 the implementation guarantees can be open simultaneously;
10477 FILENAME_MAX
10478 which expands to an integer constant expression that is the size needed for an array of
10479 char large enough to hold the longest file name string that the implementation
10483 [<a name="p262" href="#p262">page 262</a>] (<a href="#Contents">Contents</a>)
10485 guarantees can be opened;231)
10486 L_tmpnam
10487 which expands to an integer constant expression that is the size needed for an array of
10488 char large enough to hold a temporary file name string generated by the tmpnam
10489 function;
10490 SEEK_CUR
10491 SEEK_END
10492 SEEK_SET
10493 which expand to integer constant expressions with distinct values, suitable for use as the
10494 third argument to the fseek function;
10495 TMP_MAX
10496 which expands to an integer constant expression that is the maximum number of unique
10497 file names that can be generated by the tmpnam function;
10498 stderr
10499 stdin
10500 stdout
10501 which are expressions of type ''pointer to FILE'' that point to the FILE objects
10502 associated, respectively, with the standard error, input, and output streams.
10503 4 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
10504 and output. The wide character input/output functions described in that subclause
10505 provide operations analogous to most of those described here, except that the
10506 fundamental units internal to the program are wide characters. The external
10507 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
10508 described further in <a href="#7.19.3">7.19.3</a>.
10509 5 The input/output functions are given the following collective terms:
10510 -- The wide character input functions -- those functions described in <a href="#7.24">7.24</a> that perform
10511 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
10512 fwscanf, wscanf, vfwscanf, and vwscanf.
10513 -- The wide character output functions -- those functions described in <a href="#7.24">7.24</a> that perform
10514 output from wide characters and wide strings: fputwc, fputws, putwc,
10515 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
10518 231) If the implementation imposes no practical limit on the length of file name strings, the value of
10519 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
10520 string. Of course, file name string contents are subject to other system-specific constraints; therefore
10521 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
10523 [<a name="p263" href="#p263">page 263</a>] (<a href="#Contents">Contents</a>)
10525 -- The wide character input/output functions -- the union of the ungetwc function, the
10526 wide character input functions, and the wide character output functions.
10527 -- The byte input/output functions -- those functions described in this subclause that
10528 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
10529 fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts,
10530 scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
10531 Forward references: files (<a href="#7.19.3">7.19.3</a>), the fseek function (<a href="#7.19.9.2">7.19.9.2</a>), streams (<a href="#7.19.2">7.19.2</a>), the
10532 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>).
10533 <a name="7.19.2" href="#7.19.2"><b> 7.19.2 Streams</b></a>
10534 1 Input and output, whether to or from physical devices such as terminals and tape drives,
10535 or whether to or from files supported on structured storage devices, are mapped into
10536 logical data streams, whose properties are more uniform than their various inputs and
10537 outputs. Two forms of mapping are supported, for text streams and for binary
10538 streams.232)
10539 2 A text stream is an ordered sequence of characters composed into lines, each line
10540 consisting of zero or more characters plus a terminating new-line character. Whether the
10541 last line requires a terminating new-line character is implementation-defined. Characters
10542 may have to be added, altered, or deleted on input and output to conform to differing
10543 conventions for representing text in the host environment. Thus, there need not be a one-
10544 to-one correspondence between the characters in a stream and those in the external
10545 representation. Data read in from a text stream will necessarily compare equal to the data
10546 that were earlier written out to that stream only if: the data consist only of printing
10547 characters and the control characters horizontal tab and new-line; no new-line character is
10548 immediately preceded by space characters; and the last character is a new-line character.
10549 Whether space characters that are written out immediately before a new-line character
10550 appear when read in is implementation-defined.
10551 3 A binary stream is an ordered sequence of characters that can transparently record
10552 internal data. Data read in from a binary stream shall compare equal to the data that were
10553 earlier written out to that stream, under the same implementation. Such a stream may,
10554 however, have an implementation-defined number of null characters appended to the end
10555 of the stream.
10556 4 Each stream has an orientation. After a stream is associated with an external file, but
10557 before any operations are performed on it, the stream is without orientation. Once a wide
10558 character input/output function has been applied to a stream without orientation, the
10561 232) An implementation need not distinguish between text streams and binary streams. In such an
10562 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
10563 line.
10565 [<a name="p264" href="#p264">page 264</a>] (<a href="#Contents">Contents</a>)
10567 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
10568 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
10569 Only a call to the freopen function or the fwide function can otherwise alter the
10570 orientation of a stream. (A successful call to freopen removes any orientation.)233)
10571 5 Byte input/output functions shall not be applied to a wide-oriented stream and wide
10572 character input/output functions shall not be applied to a byte-oriented stream. The
10573 remaining stream operations do not affect, and are not affected by, a stream's orientation,
10574 except for the following additional restrictions:
10575 -- Binary wide-oriented streams have the file-positioning restrictions ascribed to both
10576 text and binary streams.
10577 -- For wide-oriented streams, after a successful call to a file-positioning function that
10578 leaves the file position indicator prior to the end-of-file, a wide character output
10579 function can overwrite a partial multibyte character; any file contents beyond the
10580 byte(s) written are henceforth indeterminate.
10581 6 Each wide-oriented stream has an associated mbstate_t object that stores the current
10582 parse state of the stream. A successful call to fgetpos stores a representation of the
10583 value of this mbstate_t object as part of the value of the fpos_t object. A later
10584 successful call to fsetpos using the same stored fpos_t value restores the value of
10585 the associated mbstate_t object as well as the position within the controlled stream.
10586 Environmental limits
10587 7 An implementation shall support text files with lines containing at least 254 characters,
10588 including the terminating new-line character. The value of the macro BUFSIZ shall be at
10589 least 256.
10590 Forward references: the freopen function (<a href="#7.19.5.4">7.19.5.4</a>), the fwide function (<a href="#7.24.3.5">7.24.3.5</a>),
10591 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
10592 (<a href="#7.19.9.3">7.19.9.3</a>).
10597 233) The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
10599 [<a name="p265" href="#p265">page 265</a>] (<a href="#Contents">Contents</a>)
10601 <a name="7.19.3" href="#7.19.3"><b> 7.19.3 Files</b></a>
10602 1 A stream is associated with an external file (which may be a physical device) by opening
10603 a file, which may involve creating a new file. Creating an existing file causes its former
10604 contents to be discarded, if necessary. If a file can support positioning requests (such as a
10605 disk file, as opposed to a terminal), then a file position indicator associated with the
10606 stream is positioned at the start (character number zero) of the file, unless the file is
10607 opened with append mode in which case it is implementation-defined whether the file
10608 position indicator is initially positioned at the beginning or the end of the file. The file
10609 position indicator is maintained by subsequent reads, writes, and positioning requests, to
10610 facilitate an orderly progression through the file.
10611 2 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
10612 stream causes the associated file to be truncated beyond that point is implementation-
10613 defined.
10614 3 When a stream is unbuffered, characters are intended to appear from the source or at the
10615 destination as soon as possible. Otherwise characters may be accumulated and
10616 transmitted to or from the host environment as a block. When a stream is fully buffered,
10617 characters are intended to be transmitted to or from the host environment as a block when
10618 a buffer is filled. When a stream is line buffered, characters are intended to be
10619 transmitted to or from the host environment as a block when a new-line character is
10620 encountered. Furthermore, characters are intended to be transmitted as a block to the host
10621 environment when a buffer is filled, when input is requested on an unbuffered stream, or
10622 when input is requested on a line buffered stream that requires the transmission of
10623 characters from the host environment. Support for these characteristics is
10624 implementation-defined, and may be affected via the setbuf and setvbuf functions.
10625 4 A file may be disassociated from a controlling stream by closing the file. Output streams
10626 are flushed (any unwritten buffer contents are transmitted to the host environment) before
10627 the stream is disassociated from the file. The value of a pointer to a FILE object is
10628 indeterminate after the associated file is closed (including the standard text streams).
10629 Whether a file of zero length (on which no characters have been written by an output
10630 stream) actually exists is implementation-defined.
10631 5 The file may be subsequently reopened, by the same or another program execution, and
10632 its contents reclaimed or modified (if it can be repositioned at its start). If the main
10633 function returns to its original caller, or if the exit function is called, all open files are
10634 closed (hence all output streams are flushed) before program termination. Other paths to
10635 program termination, such as calling the abort function, need not close all files
10636 properly.
10637 6 The address of the FILE object used to control a stream may be significant; a copy of a
10638 FILE object need not serve in place of the original.
10640 [<a name="p266" href="#p266">page 266</a>] (<a href="#Contents">Contents</a>)
10642 7 At program startup, three text streams are predefined and need not be opened explicitly
10643 -- standard input (for reading conventional input), standard output (for writing
10644 conventional output), and standard error (for writing diagnostic output). As initially
10645 opened, the standard error stream is not fully buffered; the standard input and standard
10646 output streams are fully buffered if and only if the stream can be determined not to refer
10647 to an interactive device.
10648 8 Functions that open additional (nontemporary) files require a file name, which is a string.
10649 The rules for composing valid file names are implementation-defined. Whether the same
10650 file can be simultaneously open multiple times is also implementation-defined.
10651 9 Although both text and binary wide-oriented streams are conceptually sequences of wide
10652 characters, the external file associated with a wide-oriented stream is a sequence of
10653 multibyte characters, generalized as follows:
10654 -- Multibyte encodings within files may contain embedded null bytes (unlike multibyte
10655 encodings valid for use internal to the program).
10656 -- A file need not begin nor end in the initial shift state.234)
10657 10 Moreover, the encodings used for multibyte characters may differ among files. Both the
10658 nature and choice of such encodings are implementation-defined.
10659 11 The wide character input functions read multibyte characters from the stream and convert
10660 them to wide characters as if they were read by successive calls to the fgetwc function.
10661 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
10662 described by the stream's own mbstate_t object. The byte input functions read
10663 characters from the stream as if by successive calls to the fgetc function.
10664 12 The wide character output functions convert wide characters to multibyte characters and
10665 write them to the stream as if they were written by successive calls to the fputwc
10666 function. Each conversion occurs as if by a call to the wcrtomb function, with the
10667 conversion state described by the stream's own mbstate_t object. The byte output
10668 functions write characters to the stream as if by successive calls to the fputc function.
10669 13 In some cases, some of the byte input/output functions also perform conversions between
10670 multibyte characters and wide characters. These conversions also occur as if by calls to
10671 the mbrtowc and wcrtomb functions.
10672 14 An encoding error occurs if the character sequence presented to the underlying
10673 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
10674 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
10677 234) Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
10678 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
10679 with state-dependent encoding that does not assuredly end in the initial shift state.
10681 [<a name="p267" href="#p267">page 267</a>] (<a href="#Contents">Contents</a>)
10683 multibyte character. The wide character input/output functions and the byte input/output
10684 functions store the value of the macro EILSEQ in errno if and only if an encoding error
10685 occurs.
10686 Environmental limits
10687 15 The value of FOPEN_MAX shall be at least eight, including the three standard text
10688 streams.
10689 Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>), the fgetc function (<a href="#7.19.7.1">7.19.7.1</a>), the
10690 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
10691 (<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
10692 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
10693 (<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>).
10694 <a name="7.19.4" href="#7.19.4"><b> 7.19.4 Operations on files</b></a>
10695 <a name="7.19.4.1" href="#7.19.4.1"><b> 7.19.4.1 The remove function</b></a>
10696 Synopsis
10697 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10698 int remove(const char *filename);
10699 Description
10700 2 The remove function causes the file whose name is the string pointed to by filename
10701 to be no longer accessible by that name. A subsequent attempt to open that file using that
10702 name will fail, unless it is created anew. If the file is open, the behavior of the remove
10703 function is implementation-defined.
10704 Returns
10705 3 The remove function returns zero if the operation succeeds, nonzero if it fails.
10706 <a name="7.19.4.2" href="#7.19.4.2"><b> 7.19.4.2 The rename function</b></a>
10707 Synopsis
10708 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10709 int rename(const char *old, const char *new);
10710 Description
10711 2 The rename function causes the file whose name is the string pointed to by old to be
10712 henceforth known by the name given by the string pointed to by new. The file named
10713 old is no longer accessible by that name. If a file named by the string pointed to by new
10714 exists prior to the call to the rename function, the behavior is implementation-defined.
10719 [<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
10721 Returns
10722 3 The rename function returns zero if the operation succeeds, nonzero if it fails,235) in
10723 which case if the file existed previously it is still known by its original name.
10724 <a name="7.19.4.3" href="#7.19.4.3"><b> 7.19.4.3 The tmpfile function</b></a>
10725 Synopsis
10726 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10727 FILE *tmpfile(void);
10728 Description
10729 2 The tmpfile function creates a temporary binary file that is different from any other
10730 existing file and that will automatically be removed when it is closed or at program
10731 termination. If the program terminates abnormally, whether an open temporary file is
10732 removed is implementation-defined. The file is opened for update with "wb+" mode.
10733 Recommended practice
10734 3 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
10735 program (this limit may be shared with tmpnam) and there should be no limit on the
10736 number simultaneously open other than this limit and any limit on the number of open
10737 files (FOPEN_MAX).
10738 Returns
10739 4 The tmpfile function returns a pointer to the stream of the file that it created. If the file
10740 cannot be created, the tmpfile function returns a null pointer.
10741 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
10742 <a name="7.19.4.4" href="#7.19.4.4"><b> 7.19.4.4 The tmpnam function</b></a>
10743 Synopsis
10744 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10745 char *tmpnam(char *s);
10746 Description
10747 2 The tmpnam function generates a string that is a valid file name and that is not the same
10748 as the name of an existing file.236) The function is potentially capable of generating
10751 235) Among the reasons the implementation may cause the rename function to fail are that the file is open
10752 or that it is necessary to copy its contents to effectuate its renaming.
10753 236) Files created using strings generated by the tmpnam function are temporary only in the sense that
10754 their names should not collide with those generated by conventional naming rules for the
10755 implementation. It is still necessary to use the remove function to remove such files when their use
10756 is ended, and before program termination.
10758 [<a name="p269" href="#p269">page 269</a>] (<a href="#Contents">Contents</a>)
10760 TMP_MAX different strings, but any or all of them may already be in use by existing files
10761 and thus not be suitable return values.
10762 3 The tmpnam function generates a different string each time it is called.
10763 4 The implementation shall behave as if no library function calls the tmpnam function.
10764 Returns
10765 5 If no suitable string can be generated, the tmpnam function returns a null pointer.
10766 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
10767 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
10768 function may modify the same object). If the argument is not a null pointer, it is assumed
10769 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
10770 in that array and returns the argument as its value.
10771 Environmental limits
10772 6 The value of the macro TMP_MAX shall be at least 25.
10773 <a name="7.19.5" href="#7.19.5"><b> 7.19.5 File access functions</b></a>
10774 <a name="7.19.5.1" href="#7.19.5.1"><b> 7.19.5.1 The fclose function</b></a>
10775 Synopsis
10776 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10777 int fclose(FILE *stream);
10778 Description
10779 2 A successful call to the fclose function causes the stream pointed to by stream to be
10780 flushed and the associated file to be closed. Any unwritten buffered data for the stream
10781 are delivered to the host environment to be written to the file; any unread buffered data
10782 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
10783 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
10784 (and deallocated if it was automatically allocated).
10785 Returns
10786 3 The fclose function returns zero if the stream was successfully closed, or EOF if any
10787 errors were detected.
10788 <a name="7.19.5.2" href="#7.19.5.2"><b> 7.19.5.2 The fflush function</b></a>
10789 Synopsis
10790 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10791 int fflush(FILE *stream);
10796 [<a name="p270" href="#p270">page 270</a>] (<a href="#Contents">Contents</a>)
10798 Description
10799 2 If stream points to an output stream or an update stream in which the most recent
10800 operation was not input, the fflush function causes any unwritten data for that stream
10801 to be delivered to the host environment to be written to the file; otherwise, the behavior is
10802 undefined.
10803 3 If stream is a null pointer, the fflush function performs this flushing action on all
10804 streams for which the behavior is defined above.
10805 Returns
10806 4 The fflush function sets the error indicator for the stream and returns EOF if a write
10807 error occurs, otherwise it returns zero.
10808 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
10809 <a name="7.19.5.3" href="#7.19.5.3"><b> 7.19.5.3 The fopen function</b></a>
10810 Synopsis
10811 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10812 FILE *fopen(const char * restrict filename,
10813 const char * restrict mode);
10814 Description
10815 2 The fopen function opens the file whose name is the string pointed to by filename,
10816 and associates a stream with it.
10817 3 The argument mode points to a string. If the string is one of the following, the file is
10818 open in the indicated mode. Otherwise, the behavior is undefined.237)
10819 r open text file for reading
10820 w truncate to zero length or create text file for writing
10821 a append; open or create text file for writing at end-of-file
10822 rb open binary file for reading
10823 wb truncate to zero length or create binary file for writing
10824 ab append; open or create binary file for writing at end-of-file
10825 r+ open text file for update (reading and writing)
10826 w+ truncate to zero length or create text file for update
10827 a+ append; open or create text file for update, writing at end-of-file
10832 237) If the string begins with one of the above sequences, the implementation might choose to ignore the
10833 remaining characters, or it might use them to select different kinds of a file (some of which might not
10834 conform to the properties in <a href="#7.19.2">7.19.2</a>).
10836 [<a name="p271" href="#p271">page 271</a>] (<a href="#Contents">Contents</a>)
10838 r+b or rb+ open binary file for update (reading and writing)
10839 w+b or wb+ truncate to zero length or create binary file for update
10840 a+b or ab+ append; open or create binary file for update, writing at end-of-file
10841 4 Opening a file with read mode ('r' as the first character in the mode argument) fails if
10842 the file does not exist or cannot be read.
10843 5 Opening a file with append mode ('a' as the first character in the mode argument)
10844 causes all subsequent writes to the file to be forced to the then current end-of-file,
10845 regardless of intervening calls to the fseek function. In some implementations, opening
10846 a binary file with append mode ('b' as the second or third character in the above list of
10847 mode argument values) may initially position the file position indicator for the stream
10848 beyond the last data written, because of null character padding.
10849 6 When a file is opened with update mode ('+' as the second or third character in the
10850 above list of mode argument values), both input and output may be performed on the
10851 associated stream. However, output shall not be directly followed by input without an
10852 intervening call to the fflush function or to a file positioning function (fseek,
10853 fsetpos, or rewind), and input shall not be directly followed by output without an
10854 intervening call to a file positioning function, unless the input operation encounters end-
10855 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
10856 binary stream in some implementations.
10857 7 When opened, a stream is fully buffered if and only if it can be determined not to refer to
10858 an interactive device. The error and end-of-file indicators for the stream are cleared.
10859 Returns
10860 8 The fopen function returns a pointer to the object controlling the stream. If the open
10861 operation fails, fopen returns a null pointer.
10862 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
10863 <a name="7.19.5.4" href="#7.19.5.4"><b> 7.19.5.4 The freopen function</b></a>
10864 Synopsis
10865 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10866 FILE *freopen(const char * restrict filename,
10867 const char * restrict mode,
10868 FILE * restrict stream);
10869 Description
10870 2 The freopen function opens the file whose name is the string pointed to by filename
10871 and associates the stream pointed to by stream with it. The mode argument is used just
10876 [<a name="p272" href="#p272">page 272</a>] (<a href="#Contents">Contents</a>)
10878 as in the fopen function.238)
10879 3 If filename is a null pointer, the freopen function attempts to change the mode of
10880 the stream to that specified by mode, as if the name of the file currently associated with
10881 the stream had been used. It is implementation-defined which changes of mode are
10882 permitted (if any), and under what circumstances.
10883 4 The freopen function first attempts to close any file that is associated with the specified
10884 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
10885 stream are cleared.
10886 Returns
10887 5 The freopen function returns a null pointer if the open operation fails. Otherwise,
10888 freopen returns the value of stream.
10889 <a name="7.19.5.5" href="#7.19.5.5"><b> 7.19.5.5 The setbuf function</b></a>
10890 Synopsis
10891 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10892 void setbuf(FILE * restrict stream,
10893 char * restrict buf);
10894 Description
10895 2 Except that it returns no value, the setbuf function is equivalent to the setvbuf
10896 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
10897 is a null pointer), with the value _IONBF for mode.
10898 Returns
10899 3 The setbuf function returns no value.
10900 Forward references: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
10901 <a name="7.19.5.6" href="#7.19.5.6"><b> 7.19.5.6 The setvbuf function</b></a>
10902 Synopsis
10903 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10904 int setvbuf(FILE * restrict stream,
10905 char * restrict buf,
10906 int mode, size_t size);
10911 238) The primary use of the freopen function is to change the file associated with a standard text stream
10912 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
10913 returned by the fopen function may be assigned.
10915 [<a name="p273" href="#p273">page 273</a>] (<a href="#Contents">Contents</a>)
10917 Description
10918 2 The setvbuf function may be used only after the stream pointed to by stream has
10919 been associated with an open file and before any other operation (other than an
10920 unsuccessful call to setvbuf) is performed on the stream. The argument mode
10921 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
10922 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
10923 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
10924 used instead of a buffer allocated by the setvbuf function239) and the argument size
10925 specifies the size of the array; otherwise, size may determine the size of a buffer
10926 allocated by the setvbuf function. The contents of the array at any time are
10927 indeterminate.
10928 Returns
10929 3 The setvbuf function returns zero on success, or nonzero if an invalid value is given
10930 for mode or if the request cannot be honored.
10931 <a name="7.19.6" href="#7.19.6"><b> 7.19.6 Formatted input/output functions</b></a>
10932 1 The formatted input/output functions shall behave as if there is a sequence point after the
10933 actions associated with each specifier.240)
10934 <a name="7.19.6.1" href="#7.19.6.1"><b> 7.19.6.1 The fprintf function</b></a>
10935 Synopsis
10936 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10937 int fprintf(FILE * restrict stream,
10938 const char * restrict format, ...);
10939 Description
10940 2 The fprintf function writes output to the stream pointed to by stream, under control
10941 of the string pointed to by format that specifies how subsequent arguments are
10942 converted for output. If there are insufficient arguments for the format, the behavior is
10943 undefined. If the format is exhausted while arguments remain, the excess arguments are
10944 evaluated (as always) but are otherwise ignored. The fprintf function returns when
10945 the end of the format string is encountered.
10946 3 The format shall be a multibyte character sequence, beginning and ending in its initial
10947 shift state. The format is composed of zero or more directives: ordinary multibyte
10948 characters (not %), which are copied unchanged to the output stream; and conversion
10951 239) The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
10952 before a buffer that has automatic storage duration is deallocated upon block exit.
10953 240) The fprintf functions perform writes to memory for the %n specifier.
10955 [<a name="p274" href="#p274">page 274</a>] (<a href="#Contents">Contents</a>)
10957 specifications, each of which results in fetching zero or more subsequent arguments,
10958 converting them, if applicable, according to the corresponding conversion specifier, and
10959 then writing the result to the output stream.
10960 4 Each conversion specification is introduced by the character %. After the %, the following
10961 appear in sequence:
10962 -- Zero or more flags (in any order) that modify the meaning of the conversion
10963 specification.
10964 -- An optional minimum field width. If the converted value has fewer characters than the
10965 field width, it is padded with spaces (by default) on the left (or right, if the left
10966 adjustment flag, described later, has been given) to the field width. The field width
10967 takes the form of an asterisk * (described later) or a nonnegative decimal integer.241)
10968 -- An optional precision that gives the minimum number of digits to appear for the d, i,
10969 o, u, x, and X conversions, the number of digits to appear after the decimal-point
10970 character for a, A, e, E, f, and F conversions, the maximum number of significant
10971 digits for the g and G conversions, or the maximum number of bytes to be written for
10972 s conversions. The precision takes the form of a period (.) followed either by an
10973 asterisk * (described later) or by an optional decimal integer; if only the period is
10974 specified, the precision is taken as zero. If a precision appears with any other
10975 conversion specifier, the behavior is undefined.
10976 -- An optional length modifier that specifies the size of the argument.
10977 -- A conversion specifier character that specifies the type of conversion to be applied.
10978 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
10979 this case, an int argument supplies the field width or precision. The arguments
10980 specifying field width, or precision, or both, shall appear (in that order) before the
10981 argument (if any) to be converted. A negative field width argument is taken as a - flag
10982 followed by a positive field width. A negative precision argument is taken as if the
10983 precision were omitted.
10984 6 The flag characters and their meanings are:
10985 - The result of the conversion is left-justified within the field. (It is right-justified if
10986 this flag is not specified.)
10987 + The result of a signed conversion always begins with a plus or minus sign. (It
10988 begins with a sign only when a negative value is converted if this flag is not
10993 241) Note that 0 is taken as a flag, not as the beginning of a field width.
10995 [<a name="p275" href="#p275">page 275</a>] (<a href="#Contents">Contents</a>)
10997 specified.)242)
10998 space If the first character of a signed conversion is not a sign, or if a signed conversion
10999 results in no characters, a space is prefixed to the result. If the space and + flags
11000 both appear, the space flag is ignored.
11001 # The result is converted to an ''alternative form''. For o conversion, it increases
11002 the precision, if and only if necessary, to force the first digit of the result to be a
11003 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
11004 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
11005 and G conversions, the result of converting a floating-point number always
11006 contains a decimal-point character, even if no digits follow it. (Normally, a
11007 decimal-point character appears in the result of these conversions only if a digit
11008 follows it.) For g and G conversions, trailing zeros are not removed from the
11009 result. For other conversions, the behavior is undefined.
11010 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
11011 (following any indication of sign or base) are used to pad to the field width rather
11012 than performing space padding, except when converting an infinity or NaN. If the
11013 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
11014 conversions, if a precision is specified, the 0 flag is ignored. For other
11015 conversions, the behavior is undefined.
11016 7 The length modifiers and their meanings are:
11017 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11018 signed char or unsigned char argument (the argument will have
11019 been promoted according to the integer promotions, but its value shall be
11020 converted to signed char or unsigned char before printing); or that
11021 a following n conversion specifier applies to a pointer to a signed char
11022 argument.
11023 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11024 short int or unsigned short int argument (the argument will
11025 have been promoted according to the integer promotions, but its value shall
11026 be converted to short int or unsigned short int before printing);
11027 or that a following n conversion specifier applies to a pointer to a short
11028 int argument.
11029 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11030 long int or unsigned long int argument; that a following n
11031 conversion specifier applies to a pointer to a long int argument; that a
11033 242) The results of all floating conversions of a negative zero, and of negative values that round to zero,
11034 include a minus sign.
11036 [<a name="p276" href="#p276">page 276</a>] (<a href="#Contents">Contents</a>)
11038 following c conversion specifier applies to a wint_t argument; that a
11039 following s conversion specifier applies to a pointer to a wchar_t
11040 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
11041 specifier.
11042 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11043 long long int or unsigned long long int argument; or that a
11044 following n conversion specifier applies to a pointer to a long long int
11045 argument.
11046 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
11047 an intmax_t or uintmax_t argument; or that a following n conversion
11048 specifier applies to a pointer to an intmax_t argument.
11049 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11050 size_t or the corresponding signed integer type argument; or that a
11051 following n conversion specifier applies to a pointer to a signed integer type
11052 corresponding to size_t argument.
11053 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
11054 ptrdiff_t or the corresponding unsigned integer type argument; or that a
11055 following n conversion specifier applies to a pointer to a ptrdiff_t
11056 argument.
11057 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
11058 applies to a long double argument.
11059 If a length modifier appears with any conversion specifier other than as specified above,
11060 the behavior is undefined.
11061 8 The conversion specifiers and their meanings are:
11062 d,i The int argument is converted to signed decimal in the style [-]dddd. The
11063 precision specifies the minimum number of digits to appear; if the value
11064 being converted can be represented in fewer digits, it is expanded with
11065 leading zeros. The default precision is 1. The result of converting a zero
11066 value with a precision of zero is no characters.
11067 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
11068 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
11069 letters abcdef are used for x conversion and the letters ABCDEF for X
11070 conversion. The precision specifies the minimum number of digits to appear;
11071 if the value being converted can be represented in fewer digits, it is expanded
11072 with leading zeros. The default precision is 1. The result of converting a
11073 zero value with a precision of zero is no characters.
11076 [<a name="p277" href="#p277">page 277</a>] (<a href="#Contents">Contents</a>)
11078 f,F A double argument representing a floating-point number is converted to
11079 decimal notation in the style [-]ddd.ddd, where the number of digits after
11080 the decimal-point character is equal to the precision specification. If the
11081 precision is missing, it is taken as 6; if the precision is zero and the # flag is
11082 not specified, no decimal-point character appears. If a decimal-point
11083 character appears, at least one digit appears before it. The value is rounded to
11084 the appropriate number of digits.
11085 A double argument representing an infinity is converted in one of the styles
11086 [-]inf or [-]infinity -- which style is implementation-defined. A
11087 double argument representing a NaN is converted in one of the styles
11088 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
11089 any n-char-sequence, is implementation-defined. The F conversion specifier
11090 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
11091 respectively.243)
11092 e,E A double argument representing a floating-point number is converted in the
11093 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
11094 argument is nonzero) before the decimal-point character and the number of
11095 digits after it is equal to the precision; if the precision is missing, it is taken as
11096 6; if the precision is zero and the # flag is not specified, no decimal-point
11097 character appears. The value is rounded to the appropriate number of digits.
11098 The E conversion specifier produces a number with E instead of e
11099 introducing the exponent. The exponent always contains at least two digits,
11100 and only as many more digits as necessary to represent the exponent. If the
11101 value is zero, the exponent is zero.
11102 A double argument representing an infinity or NaN is converted in the style
11103 of an f or F conversion specifier.
11104 g,G A double argument representing a floating-point number is converted in
11105 style f or e (or in style F or E in the case of a G conversion specifier),
11106 depending on the value converted and the precision. Let P equal the
11107 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
11108 Then, if a conversion with style E would have an exponent of X :
11109 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
11110 P - (X + 1).
11111 -- otherwise, the conversion is with style e (or E) and precision P - 1.
11112 Finally, unless the # flag is used, any trailing zeros are removed from the
11114 243) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
11115 the # and 0 flag characters have no effect.
11117 [<a name="p278" href="#p278">page 278</a>] (<a href="#Contents">Contents</a>)
11119 fractional portion of the result and the decimal-point character is removed if
11120 there is no fractional portion remaining.
11121 A double argument representing an infinity or NaN is converted in the style
11122 of an f or F conversion specifier.
11123 a,A A double argument representing a floating-point number is converted in the
11124 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
11125 nonzero if the argument is a normalized floating-point number and is
11126 otherwise unspecified) before the decimal-point character244) and the number
11127 of hexadecimal digits after it is equal to the precision; if the precision is
11128 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
11129 an exact representation of the value; if the precision is missing and
11130 FLT_RADIX is not a power of 2, then the precision is sufficient to
11131 distinguish245) values of type double, except that trailing zeros may be
11132 omitted; if the precision is zero and the # flag is not specified, no decimal-
11133 point character appears. The letters abcdef are used for a conversion and
11134 the letters ABCDEF for A conversion. The A conversion specifier produces a
11135 number with X and P instead of x and p. The exponent always contains at
11136 least one digit, and only as many more digits as necessary to represent the
11137 decimal exponent of 2. If the value is zero, the exponent is zero.
11138 A double argument representing an infinity or NaN is converted in the style
11139 of an f or F conversion specifier.
11140 c If no l length modifier is present, the int argument is converted to an
11141 unsigned char, and the resulting character is written.
11142 If an l length modifier is present, the wint_t argument is converted as if by
11143 an ls conversion specification with no precision and an argument that points
11144 to the initial element of a two-element array of wchar_t, the first element
11145 containing the wint_t argument to the lc conversion specification and the
11146 second a null wide character.
11147 s If no l length modifier is present, the argument shall be a pointer to the initial
11148 element of an array of character type.246) Characters from the array are
11151 244) Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
11152 that subsequent digits align to nibble (4-bit) boundaries.
11153 245) The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
11154 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
11155 might suffice depending on the implementation's scheme for determining the digit to the left of the
11156 decimal-point character.
11157 246) No special provisions are made for multibyte characters.
11159 [<a name="p279" href="#p279">page 279</a>] (<a href="#Contents">Contents</a>)
11161 written up to (but not including) the terminating null character. If the
11162 precision is specified, no more than that many bytes are written. If the
11163 precision is not specified or is greater than the size of the array, the array shall
11164 contain a null character.
11165 If an l length modifier is present, the argument shall be a pointer to the initial
11166 element of an array of wchar_t type. Wide characters from the array are
11167 converted to multibyte characters (each as if by a call to the wcrtomb
11168 function, with the conversion state described by an mbstate_t object
11169 initialized to zero before the first wide character is converted) up to and
11170 including a terminating null wide character. The resulting multibyte
11171 characters are written up to (but not including) the terminating null character
11172 (byte). If no precision is specified, the array shall contain a null wide
11173 character. If a precision is specified, no more than that many bytes are
11174 written (including shift sequences, if any), and the array shall contain a null
11175 wide character if, to equal the multibyte character sequence length given by
11176 the precision, the function would need to access a wide character one past the
11177 end of the array. In no case is a partial multibyte character written.247)
11178 p The argument shall be a pointer to void. The value of the pointer is
11179 converted to a sequence of printing characters, in an implementation-defined
11180 manner.
11181 n The argument shall be a pointer to signed integer into which is written the
11182 number of characters written to the output stream so far by this call to
11183 fprintf. No argument is converted, but one is consumed. If the conversion
11184 specification includes any flags, a field width, or a precision, the behavior is
11185 undefined.
11186 % A % character is written. No argument is converted. The complete
11187 conversion specification shall be %%.
11188 9 If a conversion specification is invalid, the behavior is undefined.248) If any argument is
11189 not the correct type for the corresponding conversion specification, the behavior is
11190 undefined.
11191 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
11192 of a conversion is wider than the field width, the field is expanded to contain the
11193 conversion result.
11198 247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
11199 248) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
11201 [<a name="p280" href="#p280">page 280</a>] (<a href="#Contents">Contents</a>)
11203 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
11204 to a hexadecimal floating number with the given precision.
11205 Recommended practice
11206 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
11207 representable in the given precision, the result should be one of the two adjacent numbers
11208 in hexadecimal floating style with the given precision, with the extra stipulation that the
11209 error should have a correct sign for the current rounding direction.
11210 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
11211 DECIMAL_DIG, then the result should be correctly rounded.249) If the number of
11212 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
11213 representable with DECIMAL_DIG digits, then the result should be an exact
11214 representation with trailing zeros. Otherwise, the source value is bounded by two
11215 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
11216 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
11217 the error should have a correct sign for the current rounding direction.
11218 Returns
11219 14 The fprintf function returns the number of characters transmitted, or a negative value
11220 if an output or encoding error occurred.
11221 Environmental limits
11222 15 The number of characters that can be produced by any single conversion shall be at least
11223 4095.
11224 16 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
11225 places:
11226 #include <a href="#7.12">&lt;math.h&gt;</a>
11227 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11228 /* ... */
11229 char *weekday, *month; // pointers to strings
11230 int day, hour, min;
11231 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
11232 weekday, month, day, hour, min);
11233 fprintf(stdout, "pi = %.5f\n", 4 * atan(<a href="#1.0">1.0</a>));
11235 17 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
11236 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
11237 the first of which is denoted here by a and the second by an uppercase letter.
11242 249) For binary-to-decimal conversion, the result format's values are the numbers representable with the
11243 given format specifier. The number of significant digits is determined by the format specifier, and in
11244 the case of fixed-point conversion by the source value as well.
11246 [<a name="p281" href="#p281">page 281</a>] (<a href="#Contents">Contents</a>)
11248 18 Given the following wide string with length seven,
11249 static wchar_t wstr[] = L" X Yabc Z W";
11250 the seven calls
11251 fprintf(stdout, "|1234567890123|\n");
11252 fprintf(stdout, "|%13ls|\n", wstr);
11253 fprintf(stdout, "|%-13.9ls|\n", wstr);
11254 fprintf(stdout, "|%13.10ls|\n", wstr);
11255 fprintf(stdout, "|%13.11ls|\n", wstr);
11256 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
11257 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
11258 will print the following seven lines:
11259 |1234567890123|
11260 | X Yabc Z W|
11261 | X Yabc Z |
11262 | X Yabc Z|
11263 | X Yabc Z W|
11264 | abc Z W|
11265 | Z|
11267 Forward references: conversion state (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
11268 <a name="7.19.6.2" href="#7.19.6.2"><b> 7.19.6.2 The fscanf function</b></a>
11269 Synopsis
11270 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11271 int fscanf(FILE * restrict stream,
11272 const char * restrict format, ...);
11273 Description
11274 2 The fscanf function reads input from the stream pointed to by stream, under control
11275 of the string pointed to by format that specifies the admissible input sequences and how
11276 they are to be converted for assignment, using subsequent arguments as pointers to the
11277 objects to receive the converted input. If there are insufficient arguments for the format,
11278 the behavior is undefined. If the format is exhausted while arguments remain, the excess
11279 arguments are evaluated (as always) but are otherwise ignored.
11280 3 The format shall be a multibyte character sequence, beginning and ending in its initial
11281 shift state. The format is composed of zero or more directives: one or more white-space
11282 characters, an ordinary multibyte character (neither % nor a white-space character), or a
11283 conversion specification. Each conversion specification is introduced by the character %.
11284 After the %, the following appear in sequence:
11285 -- An optional assignment-suppressing character *.
11286 -- An optional decimal integer greater than zero that specifies the maximum field width
11287 (in characters).
11289 [<a name="p282" href="#p282">page 282</a>] (<a href="#Contents">Contents</a>)
11291 -- An optional length modifier that specifies the size of the receiving object.
11292 -- A conversion specifier character that specifies the type of conversion to be applied.
11293 4 The fscanf function executes each directive of the format in turn. If a directive fails, as
11294 detailed below, the function returns. Failures are described as input failures (due to the
11295 occurrence of an encoding error or the unavailability of input characters), or matching
11296 failures (due to inappropriate input).
11297 5 A directive composed of white-space character(s) is executed by reading input up to the
11298 first non-white-space character (which remains unread), or until no more characters can
11299 be read.
11300 6 A directive that is an ordinary multibyte character is executed by reading the next
11301 characters of the stream. If any of those characters differ from the ones composing the
11302 directive, the directive fails and the differing and subsequent characters remain unread.
11303 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
11304 read, the directive fails.
11305 7 A directive that is a conversion specification defines a set of matching input sequences, as
11306 described below for each specifier. A conversion specification is executed in the
11307 following steps:
11308 8 Input white-space characters (as specified by the isspace function) are skipped, unless
11309 the specification includes a [, c, or n specifier.250)
11310 9 An input item is read from the stream, unless the specification includes an n specifier. An
11311 input item is defined as the longest sequence of input characters which does not exceed
11312 any specified field width and which is, or is a prefix of, a matching input sequence.251)
11313 The first character, if any, after the input item remains unread. If the length of the input
11314 item is zero, the execution of the directive fails; this condition is a matching failure unless
11315 end-of-file, an encoding error, or a read error prevented input from the stream, in which
11316 case it is an input failure.
11317 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
11318 count of input characters) is converted to a type appropriate to the conversion specifier. If
11319 the input item is not a matching sequence, the execution of the directive fails: this
11320 condition is a matching failure. Unless assignment suppression was indicated by a *, the
11321 result of the conversion is placed in the object pointed to by the first argument following
11322 the format argument that has not already received a conversion result. If this object
11323 does not have an appropriate type, or if the result of the conversion cannot be represented
11326 250) These white-space characters are not counted against a specified field width.
11327 251) fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
11328 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
11330 [<a name="p283" href="#p283">page 283</a>] (<a href="#Contents">Contents</a>)
11332 in the object, the behavior is undefined.
11333 11 The length modifiers and their meanings are:
11334 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11335 to an argument with type pointer to signed char or unsigned char.
11336 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11337 to an argument with type pointer to short int or unsigned short
11338 int.
11339 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11340 to an argument with type pointer to long int or unsigned long
11341 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
11342 an argument with type pointer to double; or that a following c, s, or [
11343 conversion specifier applies to an argument with type pointer to wchar_t.
11344 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11345 to an argument with type pointer to long long int or unsigned
11346 long long int.
11347 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11348 to an argument with type pointer to intmax_t or uintmax_t.
11349 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11350 to an argument with type pointer to size_t or the corresponding signed
11351 integer type.
11352 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11353 to an argument with type pointer to ptrdiff_t or the corresponding
11354 unsigned integer type.
11355 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
11356 applies to an argument with type pointer to long double.
11357 If a length modifier appears with any conversion specifier other than as specified above,
11358 the behavior is undefined.
11359 12 The conversion specifiers and their meanings are:
11360 d Matches an optionally signed decimal integer, whose format is the same as
11361 expected for the subject sequence of the strtol function with the value 10
11362 for the base argument. The corresponding argument shall be a pointer to
11363 signed integer.
11364 i Matches an optionally signed integer, whose format is the same as expected
11365 for the subject sequence of the strtol function with the value 0 for the
11366 base argument. The corresponding argument shall be a pointer to signed
11367 integer.
11368 [<a name="p284" href="#p284">page 284</a>] (<a href="#Contents">Contents</a>)
11370 o Matches an optionally signed octal integer, whose format is the same as
11371 expected for the subject sequence of the strtoul function with the value 8
11372 for the base argument. The corresponding argument shall be a pointer to
11373 unsigned integer.
11374 u Matches an optionally signed decimal integer, whose format is the same as
11375 expected for the subject sequence of the strtoul function with the value 10
11376 for the base argument. The corresponding argument shall be a pointer to
11377 unsigned integer.
11378 x Matches an optionally signed hexadecimal integer, whose format is the same
11379 as expected for the subject sequence of the strtoul function with the value
11380 16 for the base argument. The corresponding argument shall be a pointer to
11381 unsigned integer.
11382 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
11383 format is the same as expected for the subject sequence of the strtod
11384 function. The corresponding argument shall be a pointer to floating.
11385 c Matches a sequence of characters of exactly the number specified by the field
11386 width (1 if no field width is present in the directive).252)
11387 If no l length modifier is present, the corresponding argument shall be a
11388 pointer to the initial element of a character array large enough to accept the
11389 sequence. No null character is added.
11390 If an l length modifier is present, the input shall be a sequence of multibyte
11391 characters that begins in the initial shift state. Each multibyte character in the
11392 sequence is converted to a wide character as if by a call to the mbrtowc
11393 function, with the conversion state described by an mbstate_t object
11394 initialized to zero before the first multibyte character is converted. The
11395 corresponding argument shall be a pointer to the initial element of an array of
11396 wchar_t large enough to accept the resulting sequence of wide characters.
11397 No null wide character is added.
11398 s Matches a sequence of non-white-space characters.252)
11399 If no l length modifier is present, the corresponding argument shall be a
11400 pointer to the initial element of a character array large enough to accept the
11401 sequence and a terminating null character, which will be added automatically.
11402 If an l length modifier is present, the input shall be a sequence of multibyte
11405 252) No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
11406 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
11407 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
11409 [<a name="p285" href="#p285">page 285</a>] (<a href="#Contents">Contents</a>)
11411 characters that begins in the initial shift state. Each multibyte character is
11412 converted to a wide character as if by a call to the mbrtowc function, with
11413 the conversion state described by an mbstate_t object initialized to zero
11414 before the first multibyte character is converted. The corresponding argument
11415 shall be a pointer to the initial element of an array of wchar_t large enough
11416 to accept the sequence and the terminating null wide character, which will be
11417 added automatically.
11418 [ Matches a nonempty sequence of characters from a set of expected characters
11419 (the scanset).252)
11420 If no l length modifier is present, the corresponding argument shall be a
11421 pointer to the initial element of a character array large enough to accept the
11422 sequence and a terminating null character, which will be added automatically.
11423 If an l length modifier is present, the input shall be a sequence of multibyte
11424 characters that begins in the initial shift state. Each multibyte character is
11425 converted to a wide character as if by a call to the mbrtowc function, with
11426 the conversion state described by an mbstate_t object initialized to zero
11427 before the first multibyte character is converted. The corresponding argument
11428 shall be a pointer to the initial element of an array of wchar_t large enough
11429 to accept the sequence and the terminating null wide character, which will be
11430 added automatically.
11431 The conversion specifier includes all subsequent characters in the format
11432 string, up to and including the matching right bracket (]). The characters
11433 between the brackets (the scanlist) compose the scanset, unless the character
11434 after the left bracket is a circumflex (^), in which case the scanset contains all
11435 characters that do not appear in the scanlist between the circumflex and the
11436 right bracket. If the conversion specifier begins with [] or [^], the right
11437 bracket character is in the scanlist and the next following right bracket
11438 character is the matching right bracket that ends the specification; otherwise
11439 the first following right bracket character is the one that ends the
11440 specification. If a - character is in the scanlist and is not the first, nor the
11441 second where the first character is a ^, nor the last character, the behavior is
11442 implementation-defined.
11443 p Matches an implementation-defined set of sequences, which should be the
11444 same as the set of sequences that may be produced by the %p conversion of
11445 the fprintf function. The corresponding argument shall be a pointer to a
11446 pointer to void. The input item is converted to a pointer value in an
11447 implementation-defined manner. If the input item is a value converted earlier
11448 during the same program execution, the pointer that results shall compare
11449 equal to that value; otherwise the behavior of the %p conversion is undefined.
11451 [<a name="p286" href="#p286">page 286</a>] (<a href="#Contents">Contents</a>)
11453 n No input is consumed. The corresponding argument shall be a pointer to
11454 signed integer into which is to be written the number of characters read from
11455 the input stream so far by this call to the fscanf function. Execution of a
11456 %n directive does not increment the assignment count returned at the
11457 completion of execution of the fscanf function. No argument is converted,
11458 but one is consumed. If the conversion specification includes an assignment-
11459 suppressing character or a field width, the behavior is undefined.
11460 % Matches a single % character; no conversion or assignment occurs. The
11461 complete conversion specification shall be %%.
11462 13 If a conversion specification is invalid, the behavior is undefined.253)
11463 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
11464 respectively, a, e, f, g, and x.
11465 15 Trailing white space (including new-line characters) is left unread unless matched by a
11466 directive. The success of literal matches and suppressed assignments is not directly
11467 determinable other than via the %n directive.
11468 Returns
11469 16 The fscanf function returns the value of the macro EOF if an input failure occurs
11470 before any conversion. Otherwise, the function returns the number of input items
11471 assigned, which can be fewer than provided for, or even zero, in the event of an early
11472 matching failure.
11473 17 EXAMPLE 1 The call:
11474 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11475 /* ... */
11476 int n, i; float x; char name[50];
11477 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
11478 with the input line:
11479 25 54.32E-1 thompson
11480 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
11481 thompson\0.
11483 18 EXAMPLE 2 The call:
11484 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11485 /* ... */
11486 int i; float x; char name[50];
11487 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
11488 with input:
11492 253) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
11494 [<a name="p287" href="#p287">page 287</a>] (<a href="#Contents">Contents</a>)
11496 56789 0123 56a72
11497 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
11498 sequence 56\0. The next character read from the input stream will be a.
11500 19 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
11501 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11502 /* ... */
11503 int count; float quant; char units[21], item[21];
11504 do {
11505 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
11506 fscanf(stdin,"%*[^\n]");
11507 } while (!feof(stdin) &amp;&amp; !ferror(stdin));
11508 20 If the stdin stream contains the following lines:
11509 2 quarts of oil
11510 -12.8degrees Celsius
11511 lots of luck
11512 10.0LBS of
11513 dirt
11514 100ergs of energy
11515 the execution of the above example will be analogous to the following assignments:
11516 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
11517 count = 3;
11518 quant = -12.8; strcpy(units, "degrees");
11519 count = 2; // "C" fails to match "o"
11520 count = 0; // "l" fails to match "%f"
11521 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
11522 count = 3;
11523 count = 0; // "100e" fails to match "%f"
11524 count = EOF;
11526 21 EXAMPLE 4 In:
11527 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11528 /* ... */
11529 int d1, d2, n1, n2, i;
11530 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
11531 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
11532 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
11534 22 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
11535 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
11536 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
11537 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
11538 entry into the alternate shift state.
11539 23 After the call:
11544 [<a name="p288" href="#p288">page 288</a>] (<a href="#Contents">Contents</a>)
11546 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11547 /* ... */
11548 char str[50];
11549 fscanf(stdin, "a%s", str);
11550 with the input line:
11551 a(uparrow) X Y(downarrow) bc
11552 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
11553 characters, in the more general case) appears to be a single-byte white-space character.
11554 24 In contrast, after the call:
11555 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11556 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11557 /* ... */
11558 wchar_t wstr[50];
11559 fscanf(stdin, "a%ls", wstr);
11560 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
11561 terminating null wide character.
11562 25 However, the call:
11563 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11564 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11565 /* ... */
11566 wchar_t wstr[50];
11567 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
11568 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
11569 string.
11570 26 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
11571 character Y, after the call:
11572 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11573 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11574 /* ... */
11575 wchar_t wstr[50];
11576 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
11577 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
11578 multibyte character.
11580 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>), the
11581 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.20.1.4">7.20.1.4</a>), conversion state
11582 (<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>).
11587 [<a name="p289" href="#p289">page 289</a>] (<a href="#Contents">Contents</a>)
11589 <a name="7.19.6.3" href="#7.19.6.3"><b> 7.19.6.3 The printf function</b></a>
11590 Synopsis
11591 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11592 int printf(const char * restrict format, ...);
11593 Description
11594 2 The printf function is equivalent to fprintf with the argument stdout interposed
11595 before the arguments to printf.
11596 Returns
11597 3 The printf function returns the number of characters transmitted, or a negative value if
11598 an output or encoding error occurred.
11599 <a name="7.19.6.4" href="#7.19.6.4"><b> 7.19.6.4 The scanf function</b></a>
11600 Synopsis
11601 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11602 int scanf(const char * restrict format, ...);
11603 Description
11604 2 The scanf function is equivalent to fscanf with the argument stdin interposed
11605 before the arguments to scanf.
11606 Returns
11607 3 The scanf function returns the value of the macro EOF if an input failure occurs before
11608 any conversion. Otherwise, the scanf function returns the number of input items
11609 assigned, which can be fewer than provided for, or even zero, in the event of an early
11610 matching failure.
11611 <a name="7.19.6.5" href="#7.19.6.5"><b> 7.19.6.5 The snprintf function</b></a>
11612 Synopsis
11613 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11614 int snprintf(char * restrict s, size_t n,
11615 const char * restrict format, ...);
11616 Description
11617 2 The snprintf function is equivalent to fprintf, except that the output is written into
11618 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
11619 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
11620 discarded rather than being written to the array, and a null character is written at the end
11621 of the characters actually written into the array. If copying takes place between objects
11622 that overlap, the behavior is undefined.
11624 [<a name="p290" href="#p290">page 290</a>] (<a href="#Contents">Contents</a>)
11626 Returns
11627 3 The snprintf function returns the number of characters that would have been written
11628 had n been sufficiently large, not counting the terminating null character, or a negative
11629 value if an encoding error occurred. Thus, the null-terminated output has been
11630 completely written if and only if the returned value is nonnegative and less than n.
11631 <a name="7.19.6.6" href="#7.19.6.6"><b> 7.19.6.6 The sprintf function</b></a>
11632 Synopsis
11633 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11634 int sprintf(char * restrict s,
11635 const char * restrict format, ...);
11636 Description
11637 2 The sprintf function is equivalent to fprintf, except that the output is written into
11638 an array (specified by the argument s) rather than to a stream. A null character is written
11639 at the end of the characters written; it is not counted as part of the returned value. If
11640 copying takes place between objects that overlap, the behavior is undefined.
11641 Returns
11642 3 The sprintf function returns the number of characters written in the array, not
11643 counting the terminating null character, or a negative value if an encoding error occurred.
11644 <a name="7.19.6.7" href="#7.19.6.7"><b> 7.19.6.7 The sscanf function</b></a>
11645 Synopsis
11646 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11647 int sscanf(const char * restrict s,
11648 const char * restrict format, ...);
11649 Description
11650 2 The sscanf function is equivalent to fscanf, except that input is obtained from a
11651 string (specified by the argument s) rather than from a stream. Reaching the end of the
11652 string is equivalent to encountering end-of-file for the fscanf function. If copying
11653 takes place between objects that overlap, the behavior is undefined.
11654 Returns
11655 3 The sscanf function returns the value of the macro EOF if an input failure occurs
11656 before any conversion. Otherwise, the sscanf function returns the number of input
11657 items assigned, which can be fewer than provided for, or even zero, in the event of an
11658 early matching failure.
11663 [<a name="p291" href="#p291">page 291</a>] (<a href="#Contents">Contents</a>)
11665 <a name="7.19.6.8" href="#7.19.6.8"><b> 7.19.6.8 The vfprintf function</b></a>
11666 Synopsis
11667 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11668 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11669 int vfprintf(FILE * restrict stream,
11670 const char * restrict format,
11671 va_list arg);
11672 Description
11673 2 The vfprintf function is equivalent to fprintf, with the variable argument list
11674 replaced by arg, which shall have been initialized by the va_start macro (and
11675 possibly subsequent va_arg calls). The vfprintf function does not invoke the
11676 va_end macro.254)
11677 Returns
11678 3 The vfprintf function returns the number of characters transmitted, or a negative
11679 value if an output or encoding error occurred.
11680 4 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
11681 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11682 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11683 void error(char *function_name, char *format, ...)
11685 va_list args;
11686 va_start(args, format);
11687 // print out name of function causing error
11688 fprintf(stderr, "ERROR in %s: ", function_name);
11689 // print out remainder of message
11690 vfprintf(stderr, format, args);
11691 va_end(args);
11697 254) As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
11698 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
11700 [<a name="p292" href="#p292">page 292</a>] (<a href="#Contents">Contents</a>)
11702 <a name="7.19.6.9" href="#7.19.6.9"><b> 7.19.6.9 The vfscanf function</b></a>
11703 Synopsis
11704 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11705 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11706 int vfscanf(FILE * restrict stream,
11707 const char * restrict format,
11708 va_list arg);
11709 Description
11710 2 The vfscanf function is equivalent to fscanf, with the variable argument list
11711 replaced by arg, which shall have been initialized by the va_start macro (and
11712 possibly subsequent va_arg calls). The vfscanf function does not invoke the
11713 va_end macro.254)
11714 Returns
11715 3 The vfscanf function returns the value of the macro EOF if an input failure occurs
11716 before any conversion. Otherwise, the vfscanf function returns the number of input
11717 items assigned, which can be fewer than provided for, or even zero, in the event of an
11718 early matching failure.
11719 <a name="7.19.6.10" href="#7.19.6.10"><b> 7.19.6.10 The vprintf function</b></a>
11720 Synopsis
11721 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11722 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11723 int vprintf(const char * restrict format,
11724 va_list arg);
11725 Description
11726 2 The vprintf function is equivalent to printf, with the variable argument list
11727 replaced by arg, which shall have been initialized by the va_start macro (and
11728 possibly subsequent va_arg calls). The vprintf function does not invoke the
11729 va_end macro.254)
11730 Returns
11731 3 The vprintf function returns the number of characters transmitted, or a negative value
11732 if an output or encoding error occurred.
11737 [<a name="p293" href="#p293">page 293</a>] (<a href="#Contents">Contents</a>)
11739 <a name="7.19.6.11" href="#7.19.6.11"><b> 7.19.6.11 The vscanf function</b></a>
11740 Synopsis
11741 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11742 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11743 int vscanf(const char * restrict format,
11744 va_list arg);
11745 Description
11746 2 The vscanf function is equivalent to scanf, with the variable argument list replaced
11747 by arg, which shall have been initialized by the va_start macro (and possibly
11748 subsequent va_arg calls). The vscanf function does not invoke the va_end
11749 macro.254)
11750 Returns
11751 3 The vscanf function returns the value of the macro EOF if an input failure occurs
11752 before any conversion. Otherwise, the vscanf function returns the number of input
11753 items assigned, which can be fewer than provided for, or even zero, in the event of an
11754 early matching failure.
11755 <a name="7.19.6.12" href="#7.19.6.12"><b> 7.19.6.12 The vsnprintf function</b></a>
11756 Synopsis
11757 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11758 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11759 int vsnprintf(char * restrict s, size_t n,
11760 const char * restrict format,
11761 va_list arg);
11762 Description
11763 2 The vsnprintf function is equivalent to snprintf, with the variable argument list
11764 replaced by arg, which shall have been initialized by the va_start macro (and
11765 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
11766 va_end macro.254) If copying takes place between objects that overlap, the behavior is
11767 undefined.
11768 Returns
11769 3 The vsnprintf function returns the number of characters that would have been written
11770 had n been sufficiently large, not counting the terminating null character, or a negative
11771 value if an encoding error occurred. Thus, the null-terminated output has been
11772 completely written if and only if the returned value is nonnegative and less than n.
11777 [<a name="p294" href="#p294">page 294</a>] (<a href="#Contents">Contents</a>)
11779 <a name="7.19.6.13" href="#7.19.6.13"><b> 7.19.6.13 The vsprintf function</b></a>
11780 Synopsis
11781 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11782 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11783 int vsprintf(char * restrict s,
11784 const char * restrict format,
11785 va_list arg);
11786 Description
11787 2 The vsprintf function is equivalent to sprintf, with the variable argument list
11788 replaced by arg, which shall have been initialized by the va_start macro (and
11789 possibly subsequent va_arg calls). The vsprintf function does not invoke the
11790 va_end macro.254) If copying takes place between objects that overlap, the behavior is
11791 undefined.
11792 Returns
11793 3 The vsprintf function returns the number of characters written in the array, not
11794 counting the terminating null character, or a negative value if an encoding error occurred.
11795 <a name="7.19.6.14" href="#7.19.6.14"><b> 7.19.6.14 The vsscanf function</b></a>
11796 Synopsis
11797 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11798 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11799 int vsscanf(const char * restrict s,
11800 const char * restrict format,
11801 va_list arg);
11802 Description
11803 2 The vsscanf function is equivalent to sscanf, with the variable argument list
11804 replaced by arg, which shall have been initialized by the va_start macro (and
11805 possibly subsequent va_arg calls). The vsscanf function does not invoke the
11806 va_end macro.254)
11807 Returns
11808 3 The vsscanf function returns the value of the macro EOF if an input failure occurs
11809 before any conversion. Otherwise, the vsscanf function returns the number of input
11810 items assigned, which can be fewer than provided for, or even zero, in the event of an
11811 early matching failure.
11816 [<a name="p295" href="#p295">page 295</a>] (<a href="#Contents">Contents</a>)
11818 <a name="7.19.7" href="#7.19.7"><b> 7.19.7 Character input/output functions</b></a>
11819 <a name="7.19.7.1" href="#7.19.7.1"><b> 7.19.7.1 The fgetc function</b></a>
11820 Synopsis
11821 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11822 int fgetc(FILE *stream);
11823 Description
11824 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
11825 next character is present, the fgetc function obtains that character as an unsigned
11826 char converted to an int and advances the associated file position indicator for the
11827 stream (if defined).
11828 Returns
11829 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
11830 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
11831 fgetc function returns the next character from the input stream pointed to by stream.
11832 If a read error occurs, the error indicator for the stream is set and the fgetc function
11833 returns EOF.255)
11834 <a name="7.19.7.2" href="#7.19.7.2"><b> 7.19.7.2 The fgets function</b></a>
11835 Synopsis
11836 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11837 char *fgets(char * restrict s, int n,
11838 FILE * restrict stream);
11839 Description
11840 2 The fgets function reads at most one less than the number of characters specified by n
11841 from the stream pointed to by stream into the array pointed to by s. No additional
11842 characters are read after a new-line character (which is retained) or after end-of-file. A
11843 null character is written immediately after the last character read into the array.
11844 Returns
11845 3 The fgets function returns s if successful. If end-of-file is encountered and no
11846 characters have been read into the array, the contents of the array remain unchanged and a
11847 null pointer is returned. If a read error occurs during the operation, the array contents are
11848 indeterminate and a null pointer is returned.
11853 255) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
11855 [<a name="p296" href="#p296">page 296</a>] (<a href="#Contents">Contents</a>)
11857 <a name="7.19.7.3" href="#7.19.7.3"><b> 7.19.7.3 The fputc function</b></a>
11858 Synopsis
11859 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11860 int fputc(int c, FILE *stream);
11861 Description
11862 2 The fputc function writes the character specified by c (converted to an unsigned
11863 char) to the output stream pointed to by stream, at the position indicated by the
11864 associated file position indicator for the stream (if defined), and advances the indicator
11865 appropriately. If the file cannot support positioning requests, or if the stream was opened
11866 with append mode, the character is appended to the output stream.
11867 Returns
11868 3 The fputc function returns the character written. If a write error occurs, the error
11869 indicator for the stream is set and fputc returns EOF.
11870 <a name="7.19.7.4" href="#7.19.7.4"><b> 7.19.7.4 The fputs function</b></a>
11871 Synopsis
11872 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11873 int fputs(const char * restrict s,
11874 FILE * restrict stream);
11875 Description
11876 2 The fputs function writes the string pointed to by s to the stream pointed to by
11877 stream. The terminating null character is not written.
11878 Returns
11879 3 The fputs function returns EOF if a write error occurs; otherwise it returns a
11880 nonnegative value.
11881 <a name="7.19.7.5" href="#7.19.7.5"><b> 7.19.7.5 The getc function</b></a>
11882 Synopsis
11883 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11884 int getc(FILE *stream);
11885 Description
11886 2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
11887 may evaluate stream more than once, so the argument should never be an expression
11888 with side effects.
11893 [<a name="p297" href="#p297">page 297</a>] (<a href="#Contents">Contents</a>)
11895 Returns
11896 3 The getc function returns the next character from the input stream pointed to by
11897 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
11898 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
11899 getc returns EOF.
11900 <a name="7.19.7.6" href="#7.19.7.6"><b> 7.19.7.6 The getchar function</b></a>
11901 Synopsis
11902 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11903 int getchar(void);
11904 Description
11905 2 The getchar function is equivalent to getc with the argument stdin.
11906 Returns
11907 3 The getchar function returns the next character from the input stream pointed to by
11908 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
11909 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
11910 getchar returns EOF.
11911 <a name="7.19.7.7" href="#7.19.7.7"><b> 7.19.7.7 The gets function</b></a>
11912 Synopsis
11913 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11914 char *gets(char *s);
11915 Description
11916 2 The gets function reads characters from the input stream pointed to by stdin, into the
11917 array pointed to by s, until end-of-file is encountered or a new-line character is read.
11918 Any new-line character is discarded, and a null character is written immediately after the
11919 last character read into the array.
11920 Returns
11921 3 The gets function returns s if successful. If end-of-file is encountered and no
11922 characters have been read into the array, the contents of the array remain unchanged and a
11923 null pointer is returned. If a read error occurs during the operation, the array contents are
11924 indeterminate and a null pointer is returned.
11925 Forward references: future library directions (<a href="#7.26.9">7.26.9</a>).
11930 [<a name="p298" href="#p298">page 298</a>] (<a href="#Contents">Contents</a>)
11932 <a name="7.19.7.8" href="#7.19.7.8"><b> 7.19.7.8 The putc function</b></a>
11933 Synopsis
11934 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11935 int putc(int c, FILE *stream);
11936 Description
11937 2 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
11938 may evaluate stream more than once, so that argument should never be an expression
11939 with side effects.
11940 Returns
11941 3 The putc function returns the character written. If a write error occurs, the error
11942 indicator for the stream is set and putc returns EOF.
11943 <a name="7.19.7.9" href="#7.19.7.9"><b> 7.19.7.9 The putchar function</b></a>
11944 Synopsis
11945 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11946 int putchar(int c);
11947 Description
11948 2 The putchar function is equivalent to putc with the second argument stdout.
11949 Returns
11950 3 The putchar function returns the character written. If a write error occurs, the error
11951 indicator for the stream is set and putchar returns EOF.
11952 <a name="7.19.7.10" href="#7.19.7.10"><b> 7.19.7.10 The puts function</b></a>
11953 Synopsis
11954 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11955 int puts(const char *s);
11956 Description
11957 2 The puts function writes the string pointed to by s to the stream pointed to by stdout,
11958 and appends a new-line character to the output. The terminating null character is not
11959 written.
11960 Returns
11961 3 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
11962 value.
11967 [<a name="p299" href="#p299">page 299</a>] (<a href="#Contents">Contents</a>)
11969 <a name="7.19.7.11" href="#7.19.7.11"><b> 7.19.7.11 The ungetc function</b></a>
11970 Synopsis
11971 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11972 int ungetc(int c, FILE *stream);
11973 Description
11974 2 The ungetc function pushes the character specified by c (converted to an unsigned
11975 char) back onto the input stream pointed to by stream. Pushed-back characters will be
11976 returned by subsequent reads on that stream in the reverse order of their pushing. A
11977 successful intervening call (with the stream pointed to by stream) to a file positioning
11978 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
11979 stream. The external storage corresponding to the stream is unchanged.
11980 3 One character of pushback is guaranteed. If the ungetc function is called too many
11981 times on the same stream without an intervening read or file positioning operation on that
11982 stream, the operation may fail.
11983 4 If the value of c equals that of the macro EOF, the operation fails and the input stream is
11984 unchanged.
11985 5 A successful call to the ungetc function clears the end-of-file indicator for the stream.
11986 The value of the file position indicator for the stream after reading or discarding all
11987 pushed-back characters shall be the same as it was before the characters were pushed
11988 back. For a text stream, the value of its file position indicator after a successful call to the
11989 ungetc function is unspecified until all pushed-back characters are read or discarded.
11990 For a binary stream, its file position indicator is decremented by each successful call to
11991 the ungetc function; if its value was zero before a call, it is indeterminate after the
11992 call.256)
11993 Returns
11994 6 The ungetc function returns the character pushed back after conversion, or EOF if the
11995 operation fails.
11996 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
12001 256) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
12003 [<a name="p300" href="#p300">page 300</a>] (<a href="#Contents">Contents</a>)
12005 <a name="7.19.8" href="#7.19.8"><b> 7.19.8 Direct input/output functions</b></a>
12006 <a name="7.19.8.1" href="#7.19.8.1"><b> 7.19.8.1 The fread function</b></a>
12007 Synopsis
12008 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12009 size_t fread(void * restrict ptr,
12010 size_t size, size_t nmemb,
12011 FILE * restrict stream);
12012 Description
12013 2 The fread function reads, into the array pointed to by ptr, up to nmemb elements
12014 whose size is specified by size, from the stream pointed to by stream. For each
12015 object, size calls are made to the fgetc function and the results stored, in the order
12016 read, in an array of unsigned char exactly overlaying the object. The file position
12017 indicator for the stream (if defined) is advanced by the number of characters successfully
12018 read. If an error occurs, the resulting value of the file position indicator for the stream is
12019 indeterminate. If a partial element is read, its value is indeterminate.
12020 Returns
12021 3 The fread function returns the number of elements successfully read, which may be
12022 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
12023 fread returns zero and the contents of the array and the state of the stream remain
12024 unchanged.
12025 <a name="7.19.8.2" href="#7.19.8.2"><b> 7.19.8.2 The fwrite function</b></a>
12026 Synopsis
12027 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12028 size_t fwrite(const void * restrict ptr,
12029 size_t size, size_t nmemb,
12030 FILE * restrict stream);
12031 Description
12032 2 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
12033 whose size is specified by size, to the stream pointed to by stream. For each object,
12034 size calls are made to the fputc function, taking the values (in order) from an array of
12035 unsigned char exactly overlaying the object. The file position indicator for the
12036 stream (if defined) is advanced by the number of characters successfully written. If an
12037 error occurs, the resulting value of the file position indicator for the stream is
12038 indeterminate.
12043 [<a name="p301" href="#p301">page 301</a>] (<a href="#Contents">Contents</a>)
12045 Returns
12046 3 The fwrite function returns the number of elements successfully written, which will be
12047 less than nmemb only if a write error is encountered. If size or nmemb is zero,
12048 fwrite returns zero and the state of the stream remains unchanged.
12049 <a name="7.19.9" href="#7.19.9"><b> 7.19.9 File positioning functions</b></a>
12050 <a name="7.19.9.1" href="#7.19.9.1"><b> 7.19.9.1 The fgetpos function</b></a>
12051 Synopsis
12052 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12053 int fgetpos(FILE * restrict stream,
12054 fpos_t * restrict pos);
12055 Description
12056 2 The fgetpos function stores the current values of the parse state (if any) and file
12057 position indicator for the stream pointed to by stream in the object pointed to by pos.
12058 The values stored contain unspecified information usable by the fsetpos function for
12059 repositioning the stream to its position at the time of the call to the fgetpos function.
12060 Returns
12061 3 If successful, the fgetpos function returns zero; on failure, the fgetpos function
12062 returns nonzero and stores an implementation-defined positive value in errno.
12063 Forward references: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
12064 <a name="7.19.9.2" href="#7.19.9.2"><b> 7.19.9.2 The fseek function</b></a>
12065 Synopsis
12066 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12067 int fseek(FILE *stream, long int offset, int whence);
12068 Description
12069 2 The fseek function sets the file position indicator for the stream pointed to by stream.
12070 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
12071 3 For a binary stream, the new position, measured in characters from the beginning of the
12072 file, is obtained by adding offset to the position specified by whence. The specified
12073 position is the beginning of the file if whence is SEEK_SET, the current value of the file
12074 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
12075 meaningfully support fseek calls with a whence value of SEEK_END.
12076 4 For a text stream, either offset shall be zero, or offset shall be a value returned by
12077 an earlier successful call to the ftell function on a stream associated with the same file
12078 and whence shall be SEEK_SET.
12080 [<a name="p302" href="#p302">page 302</a>] (<a href="#Contents">Contents</a>)
12082 5 After determining the new position, a successful call to the fseek function undoes any
12083 effects of the ungetc function on the stream, clears the end-of-file indicator for the
12084 stream, and then establishes the new position. After a successful fseek call, the next
12085 operation on an update stream may be either input or output.
12086 Returns
12087 6 The fseek function returns nonzero only for a request that cannot be satisfied.
12088 Forward references: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
12089 <a name="7.19.9.3" href="#7.19.9.3"><b> 7.19.9.3 The fsetpos function</b></a>
12090 Synopsis
12091 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12092 int fsetpos(FILE *stream, const fpos_t *pos);
12093 Description
12094 2 The fsetpos function sets the mbstate_t object (if any) and file position indicator
12095 for the stream pointed to by stream according to the value of the object pointed to by
12096 pos, which shall be a value obtained from an earlier successful call to the fgetpos
12097 function on a stream associated with the same file. If a read or write error occurs, the
12098 error indicator for the stream is set and fsetpos fails.
12099 3 A successful call to the fsetpos function undoes any effects of the ungetc function
12100 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
12101 parse state and position. After a successful fsetpos call, the next operation on an
12102 update stream may be either input or output.
12103 Returns
12104 4 If successful, the fsetpos function returns zero; on failure, the fsetpos function
12105 returns nonzero and stores an implementation-defined positive value in errno.
12106 <a name="7.19.9.4" href="#7.19.9.4"><b> 7.19.9.4 The ftell function</b></a>
12107 Synopsis
12108 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12109 long int ftell(FILE *stream);
12110 Description
12111 2 The ftell function obtains the current value of the file position indicator for the stream
12112 pointed to by stream. For a binary stream, the value is the number of characters from
12113 the beginning of the file. For a text stream, its file position indicator contains unspecified
12114 information, usable by the fseek function for returning the file position indicator for the
12115 stream to its position at the time of the ftell call; the difference between two such
12116 return values is not necessarily a meaningful measure of the number of characters written
12118 [<a name="p303" href="#p303">page 303</a>] (<a href="#Contents">Contents</a>)
12120 or read.
12121 Returns
12122 3 If successful, the ftell function returns the current value of the file position indicator
12123 for the stream. On failure, the ftell function returns -1L and stores an
12124 implementation-defined positive value in errno.
12125 <a name="7.19.9.5" href="#7.19.9.5"><b> 7.19.9.5 The rewind function</b></a>
12126 Synopsis
12127 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12128 void rewind(FILE *stream);
12129 Description
12130 2 The rewind function sets the file position indicator for the stream pointed to by
12131 stream to the beginning of the file. It is equivalent to
12132 (void)fseek(stream, 0L, SEEK_SET)
12133 except that the error indicator for the stream is also cleared.
12134 Returns
12135 3 The rewind function returns no value.
12136 <a name="7.19.10" href="#7.19.10"><b> 7.19.10 Error-handling functions</b></a>
12137 <a name="7.19.10.1" href="#7.19.10.1"><b> 7.19.10.1 The clearerr function</b></a>
12138 Synopsis
12139 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12140 void clearerr(FILE *stream);
12141 Description
12142 2 The clearerr function clears the end-of-file and error indicators for the stream pointed
12143 to by stream.
12144 Returns
12145 3 The clearerr function returns no value.
12150 [<a name="p304" href="#p304">page 304</a>] (<a href="#Contents">Contents</a>)
12152 <a name="7.19.10.2" href="#7.19.10.2"><b> 7.19.10.2 The feof function</b></a>
12153 Synopsis
12154 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12155 int feof(FILE *stream);
12156 Description
12157 2 The feof function tests the end-of-file indicator for the stream pointed to by stream.
12158 Returns
12159 3 The feof function returns nonzero if and only if the end-of-file indicator is set for
12160 stream.
12161 <a name="7.19.10.3" href="#7.19.10.3"><b> 7.19.10.3 The ferror function</b></a>
12162 Synopsis
12163 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12164 int ferror(FILE *stream);
12165 Description
12166 2 The ferror function tests the error indicator for the stream pointed to by stream.
12167 Returns
12168 3 The ferror function returns nonzero if and only if the error indicator is set for
12169 stream.
12170 <a name="7.19.10.4" href="#7.19.10.4"><b> 7.19.10.4 The perror function</b></a>
12171 Synopsis
12172 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
12173 void perror(const char *s);
12174 Description
12175 2 The perror function maps the error number in the integer expression errno to an
12176 error message. It writes a sequence of characters to the standard error stream thus: first
12177 (if s is not a null pointer and the character pointed to by s is not the null character), the
12178 string pointed to by s followed by a colon (:) and a space; then an appropriate error
12179 message string followed by a new-line character. The contents of the error message
12180 strings are the same as those returned by the strerror function with argument errno.
12181 Returns
12182 3 The perror function returns no value.
12183 Forward references: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
12186 [<a name="p305" href="#p305">page 305</a>] (<a href="#Contents">Contents</a>)
12188 <a name="7.20" href="#7.20"><b> 7.20 General utilities &lt;stdlib.h&gt;</b></a>
12189 1 The header <a href="#7.20">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
12190 defines several macros.257)
12191 2 The types declared are size_t and wchar_t (both described in <a href="#7.17">7.17</a>),
12192 div_t
12193 which is a structure type that is the type of the value returned by the div function,
12194 ldiv_t
12195 which is a structure type that is the type of the value returned by the ldiv function, and
12196 lldiv_t
12197 which is a structure type that is the type of the value returned by the lldiv function.
12198 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>);
12199 EXIT_FAILURE
12201 EXIT_SUCCESS
12202 which expand to integer constant expressions that can be used as the argument to the
12203 exit function to return unsuccessful or successful termination status, respectively, to the
12204 host environment;
12205 RAND_MAX
12206 which expands to an integer constant expression that is the maximum value returned by
12207 the rand function; and
12208 MB_CUR_MAX
12209 which expands to a positive integer expression with type size_t that is the maximum
12210 number of bytes in a multibyte character for the extended character set specified by the
12211 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
12216 257) See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
12218 [<a name="p306" href="#p306">page 306</a>] (<a href="#Contents">Contents</a>)
12220 <a name="7.20.1" href="#7.20.1"><b> 7.20.1 Numeric conversion functions</b></a>
12221 1 The functions atof, atoi, atol, and atoll need not affect the value of the integer
12222 expression errno on an error. If the value of the result cannot be represented, the
12223 behavior is undefined.
12224 <a name="7.20.1.1" href="#7.20.1.1"><b> 7.20.1.1 The atof function</b></a>
12225 Synopsis
12226 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12227 double atof(const char *nptr);
12228 Description
12229 2 The atof function converts the initial portion of the string pointed to by nptr to
12230 double representation. Except for the behavior on error, it is equivalent to
12231 strtod(nptr, (char **)NULL)
12232 Returns
12233 3 The atof function returns the converted value.
12234 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
12235 <a name="7.20.1.2" href="#7.20.1.2"><b> 7.20.1.2 The atoi, atol, and atoll functions</b></a>
12236 Synopsis
12237 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12238 int atoi(const char *nptr);
12239 long int atol(const char *nptr);
12240 long long int atoll(const char *nptr);
12241 Description
12242 2 The atoi, atol, and atoll functions convert the initial portion of the string pointed
12243 to by nptr to int, long int, and long long int representation, respectively.
12244 Except for the behavior on error, they are equivalent to
12245 atoi: (int)strtol(nptr, (char **)NULL, 10)
12246 atol: strtol(nptr, (char **)NULL, 10)
12247 atoll: strtoll(nptr, (char **)NULL, 10)
12248 Returns
12249 3 The atoi, atol, and atoll functions return the converted value.
12250 Forward references: the strtol, strtoll, strtoul, and strtoull functions
12251 (<a href="#7.20.1.4">7.20.1.4</a>).
12255 [<a name="p307" href="#p307">page 307</a>] (<a href="#Contents">Contents</a>)
12257 <a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 The strtod, strtof, and strtold functions</b></a>
12258 Synopsis
12259 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12260 double strtod(const char * restrict nptr,
12261 char ** restrict endptr);
12262 float strtof(const char * restrict nptr,
12263 char ** restrict endptr);
12264 long double strtold(const char * restrict nptr,
12265 char ** restrict endptr);
12266 Description
12267 2 The strtod, strtof, and strtold functions convert the initial portion of the string
12268 pointed to by nptr to double, float, and long double representation,
12269 respectively. First, they decompose the input string into three parts: an initial, possibly
12270 empty, sequence of white-space characters (as specified by the isspace function), a
12271 subject sequence resembling a floating-point constant or representing an infinity or NaN;
12272 and a final string of one or more unrecognized characters, including the terminating null
12273 character of the input string. Then, they attempt to convert the subject sequence to a
12274 floating-point number, and return the result.
12275 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
12276 the following:
12277 -- a nonempty sequence of decimal digits optionally containing a decimal-point
12278 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
12279 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
12280 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
12281 -- INF or INFINITY, ignoring case
12282 -- NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
12283 n-char-sequence:
12284 digit
12285 nondigit
12286 n-char-sequence digit
12287 n-char-sequence nondigit
12288 The subject sequence is defined as the longest initial subsequence of the input string,
12289 starting with the first non-white-space character, that is of the expected form. The subject
12290 sequence contains no characters if the input string is not of the expected form.
12291 4 If the subject sequence has the expected form for a floating-point number, the sequence of
12292 characters starting with the first digit or the decimal-point character (whichever occurs
12293 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
12294 [<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
12296 decimal-point character is used in place of a period, and that if neither an exponent part
12297 nor a decimal-point character appears in a decimal floating point number, or if a binary
12298 exponent part does not appear in a hexadecimal floating point number, an exponent part
12299 of the appropriate type with value zero is assumed to follow the last digit in the string. If
12300 the subject sequence begins with a minus sign, the sequence is interpreted as negated.258)
12301 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
12302 the return type, else like a floating constant that is too large for the range of the return
12303 type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
12304 NaN, if supported in the return type, else like a subject sequence part that does not have
12305 the expected form; the meaning of the n-char sequences is implementation-defined.259) A
12306 pointer to the final string is stored in the object pointed to by endptr, provided that
12307 endptr is not a null pointer.
12308 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
12309 value resulting from the conversion is correctly rounded.
12310 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
12311 accepted.
12312 7 If the subject sequence is empty or does not have the expected form, no conversion is
12313 performed; the value of nptr is stored in the object pointed to by endptr, provided
12314 that endptr is not a null pointer.
12315 Recommended practice
12316 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
12317 the result is not exactly representable, the result should be one of the two numbers in the
12318 appropriate internal format that are adjacent to the hexadecimal floating source value,
12319 with the extra stipulation that the error should have a correct sign for the current rounding
12320 direction.
12321 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
12322 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
12323 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
12324 consider the two bounding, adjacent decimal strings L and U, both having
12325 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
12326 The result should be one of the (equal or adjacent) values that would be obtained by
12327 correctly rounding L and U according to the current rounding direction, with the extra
12329 258) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
12330 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
12331 methods may yield different results if rounding is toward positive or negative infinity. In either case,
12332 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
12333 259) An implementation may use the n-char sequence to determine extra information to be represented in
12334 the NaN's significand.
12336 [<a name="p309" href="#p309">page 309</a>] (<a href="#Contents">Contents</a>)
12338 stipulation that the error with respect to D should have a correct sign for the current
12339 rounding direction.260)
12340 Returns
12341 10 The functions return the converted value, if any. If no conversion could be performed,
12342 zero is returned. If the correct value is outside the range of representable values, plus or
12343 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
12344 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
12345 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
12346 than the smallest normalized positive number in the return type; whether errno acquires
12347 the value ERANGE is implementation-defined.
12348 <a name="7.20.1.4" href="#7.20.1.4"><b> 7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions</b></a>
12349 Synopsis
12350 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12351 long int strtol(
12352 const char * restrict nptr,
12353 char ** restrict endptr,
12354 int base);
12355 long long int strtoll(
12356 const char * restrict nptr,
12357 char ** restrict endptr,
12358 int base);
12359 unsigned long int strtoul(
12360 const char * restrict nptr,
12361 char ** restrict endptr,
12362 int base);
12363 unsigned long long int strtoull(
12364 const char * restrict nptr,
12365 char ** restrict endptr,
12366 int base);
12367 Description
12368 2 The strtol, strtoll, strtoul, and strtoull functions convert the initial
12369 portion of the string pointed to by nptr to long int, long long int, unsigned
12370 long int, and unsigned long long int representation, respectively. First,
12371 they decompose the input string into three parts: an initial, possibly empty, sequence of
12372 white-space characters (as specified by the isspace function), a subject sequence
12375 260) DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
12376 to the same internal floating value, but if not will round to adjacent values.
12378 [<a name="p310" href="#p310">page 310</a>] (<a href="#Contents">Contents</a>)
12380 resembling an integer represented in some radix determined by the value of base, and a
12381 final string of one or more unrecognized characters, including the terminating null
12382 character of the input string. Then, they attempt to convert the subject sequence to an
12383 integer, and return the result.
12384 3 If the value of base is zero, the expected form of the subject sequence is that of an
12385 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
12386 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
12387 expected form of the subject sequence is a sequence of letters and digits representing an
12388 integer with the radix specified by base, optionally preceded by a plus or minus sign,
12389 but not including an integer suffix. The letters from a (or A) through z (or Z) are
12390 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
12391 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
12392 optionally precede the sequence of letters and digits, following the sign if present.
12393 4 The subject sequence is defined as the longest initial subsequence of the input string,
12394 starting with the first non-white-space character, that is of the expected form. The subject
12395 sequence contains no characters if the input string is empty or consists entirely of white
12396 space, or if the first non-white-space character is other than a sign or a permissible letter
12397 or digit.
12398 5 If the subject sequence has the expected form and the value of base is zero, the sequence
12399 of characters starting with the first digit is interpreted as an integer constant according to
12400 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
12401 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
12402 as given above. If the subject sequence begins with a minus sign, the value resulting from
12403 the conversion is negated (in the return type). A pointer to the final string is stored in the
12404 object pointed to by endptr, provided that endptr is not a null pointer.
12405 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
12406 accepted.
12407 7 If the subject sequence is empty or does not have the expected form, no conversion is
12408 performed; the value of nptr is stored in the object pointed to by endptr, provided
12409 that endptr is not a null pointer.
12410 Returns
12411 8 The strtol, strtoll, strtoul, and strtoull functions return the converted
12412 value, if any. If no conversion could be performed, zero is returned. If the correct value
12413 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
12414 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
12415 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
12420 [<a name="p311" href="#p311">page 311</a>] (<a href="#Contents">Contents</a>)
12422 <a name="7.20.2" href="#7.20.2"><b> 7.20.2 Pseudo-random sequence generation functions</b></a>
12423 <a name="7.20.2.1" href="#7.20.2.1"><b> 7.20.2.1 The rand function</b></a>
12424 Synopsis
12425 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12426 int rand(void);
12427 Description
12428 2 The rand function computes a sequence of pseudo-random integers in the range 0 to
12429 RAND_MAX.
12430 3 The implementation shall behave as if no library function calls the rand function.
12431 Returns
12432 4 The rand function returns a pseudo-random integer.
12433 Environmental limits
12434 5 The value of the RAND_MAX macro shall be at least 32767.
12435 <a name="7.20.2.2" href="#7.20.2.2"><b> 7.20.2.2 The srand function</b></a>
12436 Synopsis
12437 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12438 void srand(unsigned int seed);
12439 Description
12440 2 The srand function uses the argument as a seed for a new sequence of pseudo-random
12441 numbers to be returned by subsequent calls to rand. If srand is then called with the
12442 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
12443 called before any calls to srand have been made, the same sequence shall be generated
12444 as when srand is first called with a seed value of 1.
12445 3 The implementation shall behave as if no library function calls the srand function.
12446 Returns
12447 4 The srand function returns no value.
12448 5 EXAMPLE The following functions define a portable implementation of rand and srand.
12449 static unsigned long int next = 1;
12450 int rand(void) // RAND_MAX assumed to be 32767
12452 next = next * 1103515245 + 12345;
12453 return (unsigned int)(next/65536) % 32768;
12458 [<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
12460 void srand(unsigned int seed)
12462 next = seed;
12465 <a name="7.20.3" href="#7.20.3"><b> 7.20.3 Memory management functions</b></a>
12466 1 The order and contiguity of storage allocated by successive calls to the calloc,
12467 malloc, and realloc functions is unspecified. The pointer returned if the allocation
12468 succeeds is suitably aligned so that it may be assigned to a pointer to any type of object
12469 and then used to access such an object or an array of such objects in the space allocated
12470 (until the space is explicitly deallocated). The lifetime of an allocated object extends
12471 from the allocation until the deallocation. Each such allocation shall yield a pointer to an
12472 object disjoint from any other object. The pointer returned points to the start (lowest byte
12473 address) of the allocated space. If the space cannot be allocated, a null pointer is
12474 returned. If the size of the space requested is zero, the behavior is implementation-
12475 defined: either a null pointer is returned, or the behavior is as if the size were some
12476 nonzero value, except that the returned pointer shall not be used to access an object.
12477 <a name="7.20.3.1" href="#7.20.3.1"><b> 7.20.3.1 The calloc function</b></a>
12478 Synopsis
12479 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12480 void *calloc(size_t nmemb, size_t size);
12481 Description
12482 2 The calloc function allocates space for an array of nmemb objects, each of whose size
12483 is size. The space is initialized to all bits zero.261)
12484 Returns
12485 3 The calloc function returns either a null pointer or a pointer to the allocated space.
12486 <a name="7.20.3.2" href="#7.20.3.2"><b> 7.20.3.2 The free function</b></a>
12487 Synopsis
12488 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12489 void free(void *ptr);
12490 Description
12491 2 The free function causes the space pointed to by ptr to be deallocated, that is, made
12492 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
12493 the argument does not match a pointer earlier returned by the calloc, malloc, or
12496 261) Note that this need not be the same as the representation of floating-point zero or a null pointer
12497 constant.
12499 [<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
12501 realloc function, or if the space has been deallocated by a call to free or realloc,
12502 the behavior is undefined.
12503 Returns
12504 3 The free function returns no value.
12505 <a name="7.20.3.3" href="#7.20.3.3"><b> 7.20.3.3 The malloc function</b></a>
12506 Synopsis
12507 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12508 void *malloc(size_t size);
12509 Description
12510 2 The malloc function allocates space for an object whose size is specified by size and
12511 whose value is indeterminate.
12512 Returns
12513 3 The malloc function returns either a null pointer or a pointer to the allocated space.
12514 <a name="7.20.3.4" href="#7.20.3.4"><b> 7.20.3.4 The realloc function</b></a>
12515 Synopsis
12516 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12517 void *realloc(void *ptr, size_t size);
12518 Description
12519 2 The realloc function deallocates the old object pointed to by ptr and returns a
12520 pointer to a new object that has the size specified by size. The contents of the new
12521 object shall be the same as that of the old object prior to deallocation, up to the lesser of
12522 the new and old sizes. Any bytes in the new object beyond the size of the old object have
12523 indeterminate values.
12524 3 If ptr is a null pointer, the realloc function behaves like the malloc function for the
12525 specified size. Otherwise, if ptr does not match a pointer earlier returned by the
12526 calloc, malloc, or realloc function, or if the space has been deallocated by a call
12527 to the free or realloc function, the behavior is undefined. If memory for the new
12528 object cannot be allocated, the old object is not deallocated and its value is unchanged.
12529 Returns
12530 4 The realloc function returns a pointer to the new object (which may have the same
12531 value as a pointer to the old object), or a null pointer if the new object could not be
12532 allocated.
12537 [<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
12539 <a name="7.20.4" href="#7.20.4"><b> 7.20.4 Communication with the environment</b></a>
12540 <a name="7.20.4.1" href="#7.20.4.1"><b> 7.20.4.1 The abort function</b></a>
12541 Synopsis
12542 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12543 void abort(void);
12544 Description
12545 2 The abort function causes abnormal program termination to occur, unless the signal
12546 SIGABRT is being caught and the signal handler does not return. Whether open streams
12547 with unwritten buffered data are flushed, open streams are closed, or temporary files are
12548 removed is implementation-defined. An implementation-defined form of the status
12549 unsuccessful termination is returned to the host environment by means of the function
12550 call raise(SIGABRT).
12551 Returns
12552 3 The abort function does not return to its caller.
12553 <a name="7.20.4.2" href="#7.20.4.2"><b> 7.20.4.2 The atexit function</b></a>
12554 Synopsis
12555 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12556 int atexit(void (*func)(void));
12557 Description
12558 2 The atexit function registers the function pointed to by func, to be called without
12559 arguments at normal program termination.
12560 Environmental limits
12561 3 The implementation shall support the registration of at least 32 functions.
12562 Returns
12563 4 The atexit function returns zero if the registration succeeds, nonzero if it fails.
12564 Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
12565 <a name="7.20.4.3" href="#7.20.4.3"><b> 7.20.4.3 The exit function</b></a>
12566 Synopsis
12567 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12568 void exit(int status);
12569 Description
12570 2 The exit function causes normal program termination to occur. If more than one call to
12571 the exit function is executed by a program, the behavior is undefined.
12572 [<a name="p315" href="#p315">page 315</a>] (<a href="#Contents">Contents</a>)
12574 3 First, all functions registered by the atexit function are called, in the reverse order of
12575 their registration,262) except that a function is called after any previously registered
12576 functions that had already been called at the time it was registered. If, during the call to
12577 any such function, a call to the longjmp function is made that would terminate the call
12578 to the registered function, the behavior is undefined.
12579 4 Next, all open streams with unwritten buffered data are flushed, all open streams are
12580 closed, and all files created by the tmpfile function are removed.
12581 5 Finally, control is returned to the host environment. If the value of status is zero or
12582 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
12583 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
12584 of the status unsuccessful termination is returned. Otherwise the status returned is
12585 implementation-defined.
12586 Returns
12587 6 The exit function cannot return to its caller.
12588 <a name="7.20.4.4" href="#7.20.4.4"><b> 7.20.4.4 The _Exit function</b></a>
12589 Synopsis
12590 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12591 void _Exit(int status);
12592 Description
12593 2 The _Exit function causes normal program termination to occur and control to be
12594 returned to the host environment. No functions registered by the atexit function or
12595 signal handlers registered by the signal function are called. The status returned to the
12596 host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
12597 Whether open streams with unwritten buffered data are flushed, open streams are closed,
12598 or temporary files are removed is implementation-defined.
12599 Returns
12600 3 The _Exit function cannot return to its caller.
12605 262) Each function is called as many times as it was registered, and in the correct order with respect to
12606 other registered functions.
12608 [<a name="p316" href="#p316">page 316</a>] (<a href="#Contents">Contents</a>)
12610 <a name="7.20.4.5" href="#7.20.4.5"><b> 7.20.4.5 The getenv function</b></a>
12611 Synopsis
12612 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12613 char *getenv(const char *name);
12614 Description
12615 2 The getenv function searches an environment list, provided by the host environment,
12616 for a string that matches the string pointed to by name. The set of environment names
12617 and the method for altering the environment list are implementation-defined.
12618 3 The implementation shall behave as if no library function calls the getenv function.
12619 Returns
12620 4 The getenv function returns a pointer to a string associated with the matched list
12621 member. The string pointed to shall not be modified by the program, but may be
12622 overwritten by a subsequent call to the getenv function. If the specified name cannot
12623 be found, a null pointer is returned.
12624 <a name="7.20.4.6" href="#7.20.4.6"><b> 7.20.4.6 The system function</b></a>
12625 Synopsis
12626 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12627 int system(const char *string);
12628 Description
12629 2 If string is a null pointer, the system function determines whether the host
12630 environment has a command processor. If string is not a null pointer, the system
12631 function passes the string pointed to by string to that command processor to be
12632 executed in a manner which the implementation shall document; this might then cause the
12633 program calling system to behave in a non-conforming manner or to terminate.
12634 Returns
12635 3 If the argument is a null pointer, the system function returns nonzero only if a
12636 command processor is available. If the argument is not a null pointer, and the system
12637 function does return, it returns an implementation-defined value.
12642 [<a name="p317" href="#p317">page 317</a>] (<a href="#Contents">Contents</a>)
12644 <a name="7.20.5" href="#7.20.5"><b> 7.20.5 Searching and sorting utilities</b></a>
12645 1 These utilities make use of a comparison function to search or sort arrays of unspecified
12646 type. Where an argument declared as size_t nmemb specifies the length of the array
12647 for a function, nmemb can have the value zero on a call to that function; the comparison
12648 function is not called, a search finds no matching element, and sorting performs no
12649 rearrangement. Pointer arguments on such a call shall still have valid values, as described
12650 in <a href="#7.1.4">7.1.4</a>.
12651 2 The implementation shall ensure that the second argument of the comparison function
12652 (when called from bsearch), or both arguments (when called from qsort), are
12653 pointers to elements of the array.263) The first argument when called from bsearch
12654 shall equal key.
12655 3 The comparison function shall not alter the contents of the array. The implementation
12656 may reorder elements of the array between calls to the comparison function, but shall not
12657 alter the contents of any individual element.
12658 4 When the same objects (consisting of size bytes, irrespective of their current positions
12659 in the array) are passed more than once to the comparison function, the results shall be
12660 consistent with one another. That is, for qsort they shall define a total ordering on the
12661 array, and for bsearch the same object shall always compare the same way with the
12662 key.
12663 5 A sequence point occurs immediately before and immediately after each call to the
12664 comparison function, and also between any call to the comparison function and any
12665 movement of the objects passed as arguments to that call.
12666 <a name="7.20.5.1" href="#7.20.5.1"><b> 7.20.5.1 The bsearch function</b></a>
12667 Synopsis
12668 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12669 void *bsearch(const void *key, const void *base,
12670 size_t nmemb, size_t size,
12671 int (*compar)(const void *, const void *));
12672 Description
12673 2 The bsearch function searches an array of nmemb objects, the initial element of which
12674 is pointed to by base, for an element that matches the object pointed to by key. The
12677 263) That is, if the value passed is p, then the following expressions are always nonzero:
12678 ((char *)p - (char *)base) % size == 0
12679 (char *)p &gt;= (char *)base
12680 (char *)p &lt; (char *)base + nmemb * size
12683 [<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
12685 size of each element of the array is specified by size.
12686 3 The comparison function pointed to by compar is called with two arguments that point
12687 to the key object and to an array element, in that order. The function shall return an
12688 integer less than, equal to, or greater than zero if the key object is considered,
12689 respectively, to be less than, to match, or to be greater than the array element. The array
12690 shall consist of: all the elements that compare less than, all the elements that compare
12691 equal to, and all the elements that compare greater than the key object, in that order.264)
12692 Returns
12693 4 The bsearch function returns a pointer to a matching element of the array, or a null
12694 pointer if no match is found. If two elements compare as equal, which element is
12695 matched is unspecified.
12696 <a name="7.20.5.2" href="#7.20.5.2"><b> 7.20.5.2 The qsort function</b></a>
12697 Synopsis
12698 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12699 void qsort(void *base, size_t nmemb, size_t size,
12700 int (*compar)(const void *, const void *));
12701 Description
12702 2 The qsort function sorts an array of nmemb objects, the initial element of which is
12703 pointed to by base. The size of each object is specified by size.
12704 3 The contents of the array are sorted into ascending order according to a comparison
12705 function pointed to by compar, which is called with two arguments that point to the
12706 objects being compared. The function shall return an integer less than, equal to, or
12707 greater than zero if the first argument is considered to be respectively less than, equal to,
12708 or greater than the second.
12709 4 If two elements compare as equal, their order in the resulting sorted array is unspecified.
12710 Returns
12711 5 The qsort function returns no value.
12716 264) In practice, the entire array is sorted according to the comparison function.
12718 [<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
12720 <a name="7.20.6" href="#7.20.6"><b> 7.20.6 Integer arithmetic functions</b></a>
12721 <a name="7.20.6.1" href="#7.20.6.1"><b> 7.20.6.1 The abs, labs and llabs functions</b></a>
12722 Synopsis
12723 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12724 int abs(int j);
12725 long int labs(long int j);
12726 long long int llabs(long long int j);
12727 Description
12728 2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
12729 result cannot be represented, the behavior is undefined.265)
12730 Returns
12731 3 The abs, labs, and llabs, functions return the absolute value.
12732 <a name="7.20.6.2" href="#7.20.6.2"><b> 7.20.6.2 The div, ldiv, and lldiv functions</b></a>
12733 Synopsis
12734 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12735 div_t div(int numer, int denom);
12736 ldiv_t ldiv(long int numer, long int denom);
12737 lldiv_t lldiv(long long int numer, long long int denom);
12738 Description
12739 2 The div, ldiv, and lldiv, functions compute numer / denom and numer %
12740 denom in a single operation.
12741 Returns
12742 3 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
12743 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
12744 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
12745 each of which has the same type as the arguments numer and denom. If either part of
12746 the result cannot be represented, the behavior is undefined.
12751 265) The absolute value of the most negative number cannot be represented in two's complement.
12753 [<a name="p320" href="#p320">page 320</a>] (<a href="#Contents">Contents</a>)
12755 <a name="7.20.7" href="#7.20.7"><b> 7.20.7 Multibyte/wide character conversion functions</b></a>
12756 1 The behavior of the multibyte character functions is affected by the LC_CTYPE category
12757 of the current locale. For a state-dependent encoding, each function is placed into its
12758 initial conversion state by a call for which its character pointer argument, s, is a null
12759 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
12760 state of the function to be altered as necessary. A call with s as a null pointer causes
12761 these functions to return a nonzero value if encodings have state dependency, and zero
12762 otherwise.266) Changing the LC_CTYPE category causes the conversion state of these
12763 functions to be indeterminate.
12764 <a name="7.20.7.1" href="#7.20.7.1"><b> 7.20.7.1 The mblen function</b></a>
12765 Synopsis
12766 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12767 int mblen(const char *s, size_t n);
12768 Description
12769 2 If s is not a null pointer, the mblen function determines the number of bytes contained
12770 in the multibyte character pointed to by s. Except that the conversion state of the
12771 mbtowc function is not affected, it is equivalent to
12772 mbtowc((wchar_t *)0, s, n);
12773 3 The implementation shall behave as if no library function calls the mblen function.
12774 Returns
12775 4 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
12776 character encodings, respectively, do or do not have state-dependent encodings. If s is
12777 not a null pointer, the mblen function either returns 0 (if s points to the null character),
12778 or returns the number of bytes that are contained in the multibyte character (if the next n
12779 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
12780 multibyte character).
12781 Forward references: the mbtowc function (<a href="#7.20.7.2">7.20.7.2</a>).
12786 266) If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
12787 character codes, but are grouped with an adjacent multibyte character.
12789 [<a name="p321" href="#p321">page 321</a>] (<a href="#Contents">Contents</a>)
12791 <a name="7.20.7.2" href="#7.20.7.2"><b> 7.20.7.2 The mbtowc function</b></a>
12792 Synopsis
12793 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12794 int mbtowc(wchar_t * restrict pwc,
12795 const char * restrict s,
12796 size_t n);
12797 Description
12798 2 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
12799 the byte pointed to by s to determine the number of bytes needed to complete the next
12800 multibyte character (including any shift sequences). If the function determines that the
12801 next multibyte character is complete and valid, it determines the value of the
12802 corresponding wide character and then, if pwc is not a null pointer, stores that value in
12803 the object pointed to by pwc. If the corresponding wide character is the null wide
12804 character, the function is left in the initial conversion state.
12805 3 The implementation shall behave as if no library function calls the mbtowc function.
12806 Returns
12807 4 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
12808 character encodings, respectively, do or do not have state-dependent encodings. If s is
12809 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
12810 or returns the number of bytes that are contained in the converted multibyte character (if
12811 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
12812 form a valid multibyte character).
12813 5 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
12814 macro.
12815 <a name="7.20.7.3" href="#7.20.7.3"><b> 7.20.7.3 The wctomb function</b></a>
12816 Synopsis
12817 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12818 int wctomb(char *s, wchar_t wc);
12819 Description
12820 2 The wctomb function determines the number of bytes needed to represent the multibyte
12821 character corresponding to the wide character given by wc (including any shift
12822 sequences), and stores the multibyte character representation in the array whose first
12823 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
12824 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
12825 sequence needed to restore the initial shift state, and the function is left in the initial
12826 conversion state.
12828 [<a name="p322" href="#p322">page 322</a>] (<a href="#Contents">Contents</a>)
12830 3 The implementation shall behave as if no library function calls the wctomb function.
12831 Returns
12832 4 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
12833 character encodings, respectively, do or do not have state-dependent encodings. If s is
12834 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
12835 to a valid multibyte character, or returns the number of bytes that are contained in the
12836 multibyte character corresponding to the value of wc.
12837 5 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
12838 <a name="7.20.8" href="#7.20.8"><b> 7.20.8 Multibyte/wide string conversion functions</b></a>
12839 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
12840 the current locale.
12841 <a name="7.20.8.1" href="#7.20.8.1"><b> 7.20.8.1 The mbstowcs function</b></a>
12842 Synopsis
12843 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12844 size_t mbstowcs(wchar_t * restrict pwcs,
12845 const char * restrict s,
12846 size_t n);
12847 Description
12848 2 The mbstowcs function converts a sequence of multibyte characters that begins in the
12849 initial shift state from the array pointed to by s into a sequence of corresponding wide
12850 characters and stores not more than n wide characters into the array pointed to by pwcs.
12851 No multibyte characters that follow a null character (which is converted into a null wide
12852 character) will be examined or converted. Each multibyte character is converted as if by
12853 a call to the mbtowc function, except that the conversion state of the mbtowc function is
12854 not affected.
12855 3 No more than n elements will be modified in the array pointed to by pwcs. If copying
12856 takes place between objects that overlap, the behavior is undefined.
12857 Returns
12858 4 If an invalid multibyte character is encountered, the mbstowcs function returns
12859 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
12860 elements modified, not including a terminating null wide character, if any.267)
12865 267) The array will not be null-terminated if the value returned is n.
12867 [<a name="p323" href="#p323">page 323</a>] (<a href="#Contents">Contents</a>)
12869 <a name="7.20.8.2" href="#7.20.8.2"><b> 7.20.8.2 The wcstombs function</b></a>
12870 Synopsis
12871 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12872 size_t wcstombs(char * restrict s,
12873 const wchar_t * restrict pwcs,
12874 size_t n);
12875 Description
12876 2 The wcstombs function converts a sequence of wide characters from the array pointed
12877 to by pwcs into a sequence of corresponding multibyte characters that begins in the
12878 initial shift state, and stores these multibyte characters into the array pointed to by s,
12879 stopping if a multibyte character would exceed the limit of n total bytes or if a null
12880 character is stored. Each wide character is converted as if by a call to the wctomb
12881 function, except that the conversion state of the wctomb function is not affected.
12882 3 No more than n bytes will be modified in the array pointed to by s. If copying takes place
12883 between objects that overlap, the behavior is undefined.
12884 Returns
12885 4 If a wide character is encountered that does not correspond to a valid multibyte character,
12886 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
12887 returns the number of bytes modified, not including a terminating null character, if
12888 any.267)
12893 [<a name="p324" href="#p324">page 324</a>] (<a href="#Contents">Contents</a>)
12895 <a name="7.21" href="#7.21"><b> 7.21 String handling &lt;string.h&gt;</b></a>
12896 <a name="7.21.1" href="#7.21.1"><b> 7.21.1 String function conventions</b></a>
12897 1 The header <a href="#7.21">&lt;string.h&gt;</a> declares one type and several functions, and defines one
12898 macro useful for manipulating arrays of character type and other objects treated as arrays
12899 of character type.268) The type is size_t and the macro is NULL (both described in
12900 <a name="7.17)" href="#7.17)"><b> 7.17). Various methods are used for determining the lengths of the arrays, but in all cases</b></a>
12901 a char * or void * argument points to the initial (lowest addressed) character of the
12902 array. If an array is accessed beyond the end of an object, the behavior is undefined.
12903 2 Where an argument declared as size_t n specifies the length of the array for a
12904 function, n can have the value zero on a call to that function. Unless explicitly stated
12905 otherwise in the description of a particular function in this subclause, pointer arguments
12906 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
12907 function that locates a character finds no occurrence, a function that compares two
12908 character sequences returns zero, and a function that copies characters copies zero
12909 characters.
12910 3 For all functions in this subclause, each character shall be interpreted as if it had the type
12911 unsigned char (and therefore every possible object representation is valid and has a
12912 different value).
12913 <a name="7.21.2" href="#7.21.2"><b> 7.21.2 Copying functions</b></a>
12914 <a name="7.21.2.1" href="#7.21.2.1"><b> 7.21.2.1 The memcpy function</b></a>
12915 Synopsis
12916 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12917 void *memcpy(void * restrict s1,
12918 const void * restrict s2,
12919 size_t n);
12920 Description
12921 2 The memcpy function copies n characters from the object pointed to by s2 into the
12922 object pointed to by s1. If copying takes place between objects that overlap, the behavior
12923 is undefined.
12924 Returns
12925 3 The memcpy function returns the value of s1.
12930 268) See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
12932 [<a name="p325" href="#p325">page 325</a>] (<a href="#Contents">Contents</a>)
12934 <a name="7.21.2.2" href="#7.21.2.2"><b> 7.21.2.2 The memmove function</b></a>
12935 Synopsis
12936 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12937 void *memmove(void *s1, const void *s2, size_t n);
12938 Description
12939 2 The memmove function copies n characters from the object pointed to by s2 into the
12940 object pointed to by s1. Copying takes place as if the n characters from the object
12941 pointed to by s2 are first copied into a temporary array of n characters that does not
12942 overlap the objects pointed to by s1 and s2, and then the n characters from the
12943 temporary array are copied into the object pointed to by s1.
12944 Returns
12945 3 The memmove function returns the value of s1.
12946 <a name="7.21.2.3" href="#7.21.2.3"><b> 7.21.2.3 The strcpy function</b></a>
12947 Synopsis
12948 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12949 char *strcpy(char * restrict s1,
12950 const char * restrict s2);
12951 Description
12952 2 The strcpy function copies the string pointed to by s2 (including the terminating null
12953 character) into the array pointed to by s1. If copying takes place between objects that
12954 overlap, the behavior is undefined.
12955 Returns
12956 3 The strcpy function returns the value of s1.
12957 <a name="7.21.2.4" href="#7.21.2.4"><b> 7.21.2.4 The strncpy function</b></a>
12958 Synopsis
12959 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12960 char *strncpy(char * restrict s1,
12961 const char * restrict s2,
12962 size_t n);
12963 Description
12964 2 The strncpy function copies not more than n characters (characters that follow a null
12965 character are not copied) from the array pointed to by s2 to the array pointed to by
12970 [<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
12972 s1.269) If copying takes place between objects that overlap, the behavior is undefined.
12973 3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
12974 are appended to the copy in the array pointed to by s1, until n characters in all have been
12975 written.
12976 Returns
12977 4 The strncpy function returns the value of s1.
12978 <a name="7.21.3" href="#7.21.3"><b> 7.21.3 Concatenation functions</b></a>
12979 <a name="7.21.3.1" href="#7.21.3.1"><b> 7.21.3.1 The strcat function</b></a>
12980 Synopsis
12981 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12982 char *strcat(char * restrict s1,
12983 const char * restrict s2);
12984 Description
12985 2 The strcat function appends a copy of the string pointed to by s2 (including the
12986 terminating null character) to the end of the string pointed to by s1. The initial character
12987 of s2 overwrites the null character at the end of s1. If copying takes place between
12988 objects that overlap, the behavior is undefined.
12989 Returns
12990 3 The strcat function returns the value of s1.
12991 <a name="7.21.3.2" href="#7.21.3.2"><b> 7.21.3.2 The strncat function</b></a>
12992 Synopsis
12993 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12994 char *strncat(char * restrict s1,
12995 const char * restrict s2,
12996 size_t n);
12997 Description
12998 2 The strncat function appends not more than n characters (a null character and
12999 characters that follow it are not appended) from the array pointed to by s2 to the end of
13000 the string pointed to by s1. The initial character of s2 overwrites the null character at the
13001 end of s1. A terminating null character is always appended to the result.270) If copying
13003 269) Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
13004 not be null-terminated.
13005 270) Thus, the maximum number of characters that can end up in the array pointed to by s1 is
13006 strlen(s1)+n+1.
13008 [<a name="p327" href="#p327">page 327</a>] (<a href="#Contents">Contents</a>)
13010 takes place between objects that overlap, the behavior is undefined.
13011 Returns
13012 3 The strncat function returns the value of s1.
13013 Forward references: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
13014 <a name="7.21.4" href="#7.21.4"><b> 7.21.4 Comparison functions</b></a>
13015 1 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
13016 and strncmp is determined by the sign of the difference between the values of the first
13017 pair of characters (both interpreted as unsigned char) that differ in the objects being
13018 compared.
13019 <a name="7.21.4.1" href="#7.21.4.1"><b> 7.21.4.1 The memcmp function</b></a>
13020 Synopsis
13021 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13022 int memcmp(const void *s1, const void *s2, size_t n);
13023 Description
13024 2 The memcmp function compares the first n characters of the object pointed to by s1 to
13025 the first n characters of the object pointed to by s2.271)
13026 Returns
13027 3 The memcmp function returns an integer greater than, equal to, or less than zero,
13028 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
13029 pointed to by s2.
13030 <a name="7.21.4.2" href="#7.21.4.2"><b> 7.21.4.2 The strcmp function</b></a>
13031 Synopsis
13032 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13033 int strcmp(const char *s1, const char *s2);
13034 Description
13035 2 The strcmp function compares the string pointed to by s1 to the string pointed to by
13037 Returns
13038 3 The strcmp function returns an integer greater than, equal to, or less than zero,
13039 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
13041 271) The contents of ''holes'' used as padding for purposes of alignment within structure objects are
13042 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
13043 comparison.
13045 [<a name="p328" href="#p328">page 328</a>] (<a href="#Contents">Contents</a>)
13047 pointed to by s2.
13048 <a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The strcoll function</b></a>
13049 Synopsis
13050 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13051 int strcoll(const char *s1, const char *s2);
13052 Description
13053 2 The strcoll function compares the string pointed to by s1 to the string pointed to by
13054 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
13055 Returns
13056 3 The strcoll function returns an integer greater than, equal to, or less than zero,
13057 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
13058 pointed to by s2 when both are interpreted as appropriate to the current locale.
13059 <a name="7.21.4.4" href="#7.21.4.4"><b> 7.21.4.4 The strncmp function</b></a>
13060 Synopsis
13061 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13062 int strncmp(const char *s1, const char *s2, size_t n);
13063 Description
13064 2 The strncmp function compares not more than n characters (characters that follow a
13065 null character are not compared) from the array pointed to by s1 to the array pointed to
13066 by s2.
13067 Returns
13068 3 The strncmp function returns an integer greater than, equal to, or less than zero,
13069 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
13070 to, or less than the possibly null-terminated array pointed to by s2.
13071 <a name="7.21.4.5" href="#7.21.4.5"><b> 7.21.4.5 The strxfrm function</b></a>
13072 Synopsis
13073 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13074 size_t strxfrm(char * restrict s1,
13075 const char * restrict s2,
13076 size_t n);
13077 Description
13078 2 The strxfrm function transforms the string pointed to by s2 and places the resulting
13079 string into the array pointed to by s1. The transformation is such that if the strcmp
13080 function is applied to two transformed strings, it returns a value greater than, equal to, or
13082 [<a name="p329" href="#p329">page 329</a>] (<a href="#Contents">Contents</a>)
13084 less than zero, corresponding to the result of the strcoll function applied to the same
13085 two original strings. No more than n characters are placed into the resulting array
13086 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
13087 be a null pointer. If copying takes place between objects that overlap, the behavior is
13088 undefined.
13089 Returns
13090 3 The strxfrm function returns the length of the transformed string (not including the
13091 terminating null character). If the value returned is n or more, the contents of the array
13092 pointed to by s1 are indeterminate.
13093 4 EXAMPLE The value of the following expression is the size of the array needed to hold the
13094 transformation of the string pointed to by s.
13095 1 + strxfrm(NULL, s, 0)
13097 <a name="7.21.5" href="#7.21.5"><b> 7.21.5 Search functions</b></a>
13098 <a name="7.21.5.1" href="#7.21.5.1"><b> 7.21.5.1 The memchr function</b></a>
13099 Synopsis
13100 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13101 void *memchr(const void *s, int c, size_t n);
13102 Description
13103 2 The memchr function locates the first occurrence of c (converted to an unsigned
13104 char) in the initial n characters (each interpreted as unsigned char) of the object
13105 pointed to by s.
13106 Returns
13107 3 The memchr function returns a pointer to the located character, or a null pointer if the
13108 character does not occur in the object.
13109 <a name="7.21.5.2" href="#7.21.5.2"><b> 7.21.5.2 The strchr function</b></a>
13110 Synopsis
13111 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13112 char *strchr(const char *s, int c);
13113 Description
13114 2 The strchr function locates the first occurrence of c (converted to a char) in the
13115 string pointed to by s. The terminating null character is considered to be part of the
13116 string.
13117 Returns
13118 3 The strchr function returns a pointer to the located character, or a null pointer if the
13119 character does not occur in the string.
13120 [<a name="p330" href="#p330">page 330</a>] (<a href="#Contents">Contents</a>)
13122 <a name="7.21.5.3" href="#7.21.5.3"><b> 7.21.5.3 The strcspn function</b></a>
13123 Synopsis
13124 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13125 size_t strcspn(const char *s1, const char *s2);
13126 Description
13127 2 The strcspn function computes the length of the maximum initial segment of the string
13128 pointed to by s1 which consists entirely of characters not from the string pointed to by
13130 Returns
13131 3 The strcspn function returns the length of the segment.
13132 <a name="7.21.5.4" href="#7.21.5.4"><b> 7.21.5.4 The strpbrk function</b></a>
13133 Synopsis
13134 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13135 char *strpbrk(const char *s1, const char *s2);
13136 Description
13137 2 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
13138 character from the string pointed to by s2.
13139 Returns
13140 3 The strpbrk function returns a pointer to the character, or a null pointer if no character
13141 from s2 occurs in s1.
13142 <a name="7.21.5.5" href="#7.21.5.5"><b> 7.21.5.5 The strrchr function</b></a>
13143 Synopsis
13144 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13145 char *strrchr(const char *s, int c);
13146 Description
13147 2 The strrchr function locates the last occurrence of c (converted to a char) in the
13148 string pointed to by s. The terminating null character is considered to be part of the
13149 string.
13150 Returns
13151 3 The strrchr function returns a pointer to the character, or a null pointer if c does not
13152 occur in the string.
13157 [<a name="p331" href="#p331">page 331</a>] (<a href="#Contents">Contents</a>)
13159 <a name="7.21.5.6" href="#7.21.5.6"><b> 7.21.5.6 The strspn function</b></a>
13160 Synopsis
13161 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13162 size_t strspn(const char *s1, const char *s2);
13163 Description
13164 2 The strspn function computes the length of the maximum initial segment of the string
13165 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
13166 Returns
13167 3 The strspn function returns the length of the segment.
13168 <a name="7.21.5.7" href="#7.21.5.7"><b> 7.21.5.7 The strstr function</b></a>
13169 Synopsis
13170 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13171 char *strstr(const char *s1, const char *s2);
13172 Description
13173 2 The strstr function locates the first occurrence in the string pointed to by s1 of the
13174 sequence of characters (excluding the terminating null character) in the string pointed to
13175 by s2.
13176 Returns
13177 3 The strstr function returns a pointer to the located string, or a null pointer if the string
13178 is not found. If s2 points to a string with zero length, the function returns s1.
13179 <a name="7.21.5.8" href="#7.21.5.8"><b> 7.21.5.8 The strtok function</b></a>
13180 Synopsis
13181 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13182 char *strtok(char * restrict s1,
13183 const char * restrict s2);
13184 Description
13185 2 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
13186 sequence of tokens, each of which is delimited by a character from the string pointed to
13187 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
13188 sequence have a null first argument. The separator string pointed to by s2 may be
13189 different from call to call.
13190 3 The first call in the sequence searches the string pointed to by s1 for the first character
13191 that is not contained in the current separator string pointed to by s2. If no such character
13192 is found, then there are no tokens in the string pointed to by s1 and the strtok function
13194 [<a name="p332" href="#p332">page 332</a>] (<a href="#Contents">Contents</a>)
13196 returns a null pointer. If such a character is found, it is the start of the first token.
13197 4 The strtok function then searches from there for a character that is contained in the
13198 current separator string. If no such character is found, the current token extends to the
13199 end of the string pointed to by s1, and subsequent searches for a token will return a null
13200 pointer. If such a character is found, it is overwritten by a null character, which
13201 terminates the current token. The strtok function saves a pointer to the following
13202 character, from which the next search for a token will start.
13203 5 Each subsequent call, with a null pointer as the value of the first argument, starts
13204 searching from the saved pointer and behaves as described above.
13205 6 The implementation shall behave as if no library function calls the strtok function.
13206 Returns
13207 7 The strtok function returns a pointer to the first character of a token, or a null pointer
13208 if there is no token.
13209 8 EXAMPLE
13210 #include <a href="#7.21">&lt;string.h&gt;</a>
13211 static char str[] = "?a???b,,,#c";
13212 char *t;
13213 t = strtok(str, "?"); // t points to the token "a"
13214 t = strtok(NULL, ","); // t points to the token "??b"
13215 t = strtok(NULL, "#,"); // t points to the token "c"
13216 t = strtok(NULL, "?"); // t is a null pointer
13218 <a name="7.21.6" href="#7.21.6"><b> 7.21.6 Miscellaneous functions</b></a>
13219 <a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The memset function</b></a>
13220 Synopsis
13221 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13222 void *memset(void *s, int c, size_t n);
13223 Description
13224 2 The memset function copies the value of c (converted to an unsigned char) into
13225 each of the first n characters of the object pointed to by s.
13226 Returns
13227 3 The memset function returns the value of s.
13232 [<a name="p333" href="#p333">page 333</a>] (<a href="#Contents">Contents</a>)
13234 <a name="7.21.6.2" href="#7.21.6.2"><b> 7.21.6.2 The strerror function</b></a>
13235 Synopsis
13236 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13237 char *strerror(int errnum);
13238 Description
13239 2 The strerror function maps the number in errnum to a message string. Typically,
13240 the values for errnum come from errno, but strerror shall map any value of type
13241 int to a message.
13242 3 The implementation shall behave as if no library function calls the strerror function.
13243 Returns
13244 4 The strerror function returns a pointer to the string, the contents of which are locale-
13245 specific. The array pointed to shall not be modified by the program, but may be
13246 overwritten by a subsequent call to the strerror function.
13247 <a name="7.21.6.3" href="#7.21.6.3"><b> 7.21.6.3 The strlen function</b></a>
13248 Synopsis
13249 1 #include <a href="#7.21">&lt;string.h&gt;</a>
13250 size_t strlen(const char *s);
13251 Description
13252 2 The strlen function computes the length of the string pointed to by s.
13253 Returns
13254 3 The strlen function returns the number of characters that precede the terminating null
13255 character.
13260 [<a name="p334" href="#p334">page 334</a>] (<a href="#Contents">Contents</a>)
13262 <a name="7.22" href="#7.22"><b> 7.22 Type-generic math &lt;tgmath.h&gt;</b></a>
13263 1 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
13264 defines several type-generic macros.
13265 2 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
13266 double) suffix, several have one or more parameters whose corresponding real type is
13267 double. For each such function, except modf, there is a corresponding type-generic
13268 macro.272) The parameters whose corresponding real type is double in the function
13269 synopsis are generic parameters. Use of the macro invokes a function whose
13270 corresponding real type and type domain are determined by the arguments for the generic
13271 parameters.273)
13272 3 Use of the macro invokes a function whose generic parameters have the corresponding
13273 real type determined as follows:
13274 -- First, if any argument for generic parameters has type long double, the type
13275 determined is long double.
13276 -- Otherwise, if any argument for generic parameters has type double or is of integer
13277 type, the type determined is double.
13278 -- Otherwise, the type determined is float.
13279 4 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
13280 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
13281 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
13282 corresponding type-generic macro for fabs and cabs is fabs.
13287 272) Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
13288 make available the corresponding ordinary function.
13289 273) If the type of the argument is not compatible with the type of the parameter for the selected function,
13290 the behavior is undefined.
13292 [<a name="p335" href="#p335">page 335</a>] (<a href="#Contents">Contents</a>)
13294 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
13295 function function macro
13296 acos cacos acos
13297 asin casin asin
13298 atan catan atan
13299 acosh cacosh acosh
13300 asinh casinh asinh
13301 atanh catanh atanh
13302 cos ccos cos
13303 sin csin sin
13304 tan ctan tan
13305 cosh ccosh cosh
13306 sinh csinh sinh
13307 tanh ctanh tanh
13308 exp cexp exp
13309 log clog log
13310 pow cpow pow
13311 sqrt csqrt sqrt
13312 fabs cabs fabs
13313 If at least one argument for a generic parameter is complex, then use of the macro invokes
13314 a complex function; otherwise, use of the macro invokes a real function.
13315 5 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
13316 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
13317 name as the function. These type-generic macros are:
13318 atan2 fma llround remainder
13319 cbrt fmax log10 remquo
13320 ceil fmin log1p rint
13321 copysign fmod log2 round
13322 erf frexp logb scalbn
13323 erfc hypot lrint scalbln
13324 exp2 ilogb lround tgamma
13325 expm1 ldexp nearbyint trunc
13326 fdim lgamma nextafter
13327 floor llrint nexttoward
13328 If all arguments for generic parameters are real, then use of the macro invokes a real
13329 function; otherwise, use of the macro results in undefined behavior.
13330 6 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
13331 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
13332 function. These type-generic macros are:
13334 [<a name="p336" href="#p336">page 336</a>] (<a href="#Contents">Contents</a>)
13336 carg conj creal
13337 cimag cproj
13338 Use of the macro with any real or complex argument invokes a complex function.
13339 7 EXAMPLE With the declarations
13340 #include <a href="#7.22">&lt;tgmath.h&gt;</a>
13341 int n;
13342 float f;
13343 double d;
13344 long double ld;
13345 float complex fc;
13346 double complex dc;
13347 long double complex ldc;
13348 functions invoked by use of type-generic macros are shown in the following table:
13349 macro use invokes
13350 exp(n) exp(n), the function
13351 acosh(f) acoshf(f)
13352 sin(d) sin(d), the function
13353 atan(ld) atanl(ld)
13354 log(fc) clogf(fc)
13355 sqrt(dc) csqrt(dc)
13356 pow(ldc, f) cpowl(ldc, f)
13357 remainder(n, n) remainder(n, n), the function
13358 nextafter(d, f) nextafter(d, f), the function
13359 nexttoward(f, ld) nexttowardf(f, ld)
13360 copysign(n, ld) copysignl(n, ld)
13361 ceil(fc) undefined behavior
13362 rint(dc) undefined behavior
13363 fmax(ldc, ld) undefined behavior
13364 carg(n) carg(n), the function
13365 cproj(f) cprojf(f)
13366 creal(d) creal(d), the function
13367 cimag(ld) cimagl(ld)
13368 fabs(fc) cabsf(fc)
13369 carg(dc) carg(dc), the function
13370 cproj(ldc) cprojl(ldc)
13375 [<a name="p337" href="#p337">page 337</a>] (<a href="#Contents">Contents</a>)
13377 <a name="7.23" href="#7.23"><b> 7.23 Date and time &lt;time.h&gt;</b></a>
13378 <a name="7.23.1" href="#7.23.1"><b> 7.23.1 Components of time</b></a>
13379 1 The header <a href="#7.23">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
13380 manipulating time. Many functions deal with a calendar time that represents the current
13381 date (according to the Gregorian calendar) and time. Some functions deal with local
13382 time, which is the calendar time expressed for some specific time zone, and with Daylight
13383 Saving Time, which is a temporary change in the algorithm for determining local time.
13384 The local time zone and Daylight Saving Time are implementation-defined.
13385 2 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
13386 CLOCKS_PER_SEC
13387 which expands to an expression with type clock_t (described below) that is the
13388 number per second of the value returned by the clock function.
13389 3 The types declared are size_t (described in <a href="#7.17">7.17</a>);
13390 clock_t
13392 time_t
13393 which are arithmetic types capable of representing times; and
13394 struct tm
13395 which holds the components of a calendar time, called the broken-down time.
13396 4 The range and precision of times representable in clock_t and time_t are
13397 implementation-defined. The tm structure shall contain at least the following members,
13398 in any order. The semantics of the members and their normal ranges are expressed in the
13399 comments.274)
13400 int tm_sec; // seconds after the minute -- [0, 60]
13401 int tm_min; // minutes after the hour -- [0, 59]
13402 int tm_hour; // hours since midnight -- [0, 23]
13403 int tm_mday; // day of the month -- [1, 31]
13404 int tm_mon; // months since January -- [0, 11]
13405 int tm_year; // years since 1900
13406 int tm_wday; // days since Sunday -- [0, 6]
13407 int tm_yday; // days since January 1 -- [0, 365]
13408 int tm_isdst; // Daylight Saving Time flag
13412 274) The range [0, 60] for tm_sec allows for a positive leap second.
13414 [<a name="p338" href="#p338">page 338</a>] (<a href="#Contents">Contents</a>)
13416 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
13417 Saving Time is not in effect, and negative if the information is not available.
13418 <a name="7.23.2" href="#7.23.2"><b> 7.23.2 Time manipulation functions</b></a>
13419 <a name="7.23.2.1" href="#7.23.2.1"><b> 7.23.2.1 The clock function</b></a>
13420 Synopsis
13421 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13422 clock_t clock(void);
13423 Description
13424 2 The clock function determines the processor time used.
13425 Returns
13426 3 The clock function returns the implementation's best approximation to the processor
13427 time used by the program since the beginning of an implementation-defined era related
13428 only to the program invocation. To determine the time in seconds, the value returned by
13429 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
13430 the processor time used is not available or its value cannot be represented, the function
13431 returns the value (clock_t)(-1).275)
13432 <a name="7.23.2.2" href="#7.23.2.2"><b> 7.23.2.2 The difftime function</b></a>
13433 Synopsis
13434 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13435 double difftime(time_t time1, time_t time0);
13436 Description
13437 2 The difftime function computes the difference between two calendar times: time1 -
13438 time0.
13439 Returns
13440 3 The difftime function returns the difference expressed in seconds as a double.
13445 275) In order to measure the time spent in a program, the clock function should be called at the start of
13446 the program and its return value subtracted from the value returned by subsequent calls.
13448 [<a name="p339" href="#p339">page 339</a>] (<a href="#Contents">Contents</a>)
13450 <a name="7.23.2.3" href="#7.23.2.3"><b> 7.23.2.3 The mktime function</b></a>
13451 Synopsis
13452 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13453 time_t mktime(struct tm *timeptr);
13454 Description
13455 2 The mktime function converts the broken-down time, expressed as local time, in the
13456 structure pointed to by timeptr into a calendar time value with the same encoding as
13457 that of the values returned by the time function. The original values of the tm_wday
13458 and tm_yday components of the structure are ignored, and the original values of the
13459 other components are not restricted to the ranges indicated above.276) On successful
13460 completion, the values of the tm_wday and tm_yday components of the structure are
13461 set appropriately, and the other components are set to represent the specified calendar
13462 time, but with their values forced to the ranges indicated above; the final value of
13463 tm_mday is not set until tm_mon and tm_year are determined.
13464 Returns
13465 3 The mktime function returns the specified calendar time encoded as a value of type
13466 time_t. If the calendar time cannot be represented, the function returns the value
13467 (time_t)(-1).
13468 4 EXAMPLE What day of the week is July 4, 2001?
13469 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13470 #include <a href="#7.23">&lt;time.h&gt;</a>
13471 static const char *const wday[] = {
13472 "Sunday", "Monday", "Tuesday", "Wednesday",
13473 "Thursday", "Friday", "Saturday", "-unknown-"
13475 struct tm time_str;
13476 /* ... */
13481 276) Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
13482 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
13483 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
13485 [<a name="p340" href="#p340">page 340</a>] (<a href="#Contents">Contents</a>)
13487 time_str.tm_year = 2001 - 1900;
13488 time_str.tm_mon = 7 - 1;
13489 time_str.tm_mday = 4;
13490 time_str.tm_hour = 0;
13491 time_str.tm_min = 0;
13492 time_str.tm_sec = 1;
13493 time_str.tm_isdst = -1;
13494 if (mktime(&amp;time_str) == (time_t)(-1))
13495 time_str.tm_wday = 7;
13496 printf("%s\n", wday[time_str.tm_wday]);
13498 <a name="7.23.2.4" href="#7.23.2.4"><b> 7.23.2.4 The time function</b></a>
13499 Synopsis
13500 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13501 time_t time(time_t *timer);
13502 Description
13503 2 The time function determines the current calendar time. The encoding of the value is
13504 unspecified.
13505 Returns
13506 3 The time function returns the implementation's best approximation to the current
13507 calendar time. The value (time_t)(-1) is returned if the calendar time is not
13508 available. If timer is not a null pointer, the return value is also assigned to the object it
13509 points to.
13510 <a name="7.23.3" href="#7.23.3"><b> 7.23.3 Time conversion functions</b></a>
13511 1 Except for the strftime function, these functions each return a pointer to one of two
13512 types of static objects: a broken-down time structure or an array of char. Execution of
13513 any of the functions that return a pointer to one of these object types may overwrite the
13514 information in any object of the same type pointed to by the value returned from any
13515 previous call to any of them. The implementation shall behave as if no other library
13516 functions call these functions.
13517 <a name="7.23.3.1" href="#7.23.3.1"><b> 7.23.3.1 The asctime function</b></a>
13518 Synopsis
13519 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13520 char *asctime(const struct tm *timeptr);
13521 Description
13522 2 The asctime function converts the broken-down time in the structure pointed to by
13523 timeptr into a string in the form
13524 Sun Sep 16 01:03:52 1973\n\0
13526 [<a name="p341" href="#p341">page 341</a>] (<a href="#Contents">Contents</a>)
13528 using the equivalent of the following algorithm.
13529 char *asctime(const struct tm *timeptr)
13531 static const char wday_name[7][3] = {
13532 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
13534 static const char mon_name[12][3] = {
13535 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
13536 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
13538 static char result[26];
13539 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
13540 wday_name[timeptr-&gt;tm_wday],
13541 mon_name[timeptr-&gt;tm_mon],
13542 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
13543 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
13544 1900 + timeptr-&gt;tm_year);
13545 return result;
13547 Returns
13548 3 The asctime function returns a pointer to the string.
13549 <a name="7.23.3.2" href="#7.23.3.2"><b> 7.23.3.2 The ctime function</b></a>
13550 Synopsis
13551 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13552 char *ctime(const time_t *timer);
13553 Description
13554 2 The ctime function converts the calendar time pointed to by timer to local time in the
13555 form of a string. It is equivalent to
13556 asctime(localtime(timer))
13557 Returns
13558 3 The ctime function returns the pointer returned by the asctime function with that
13559 broken-down time as argument.
13560 Forward references: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
13565 [<a name="p342" href="#p342">page 342</a>] (<a href="#Contents">Contents</a>)
13567 <a name="7.23.3.3" href="#7.23.3.3"><b> 7.23.3.3 The gmtime function</b></a>
13568 Synopsis
13569 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13570 struct tm *gmtime(const time_t *timer);
13571 Description
13572 2 The gmtime function converts the calendar time pointed to by timer into a broken-
13573 down time, expressed as UTC.
13574 Returns
13575 3 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
13576 specified time cannot be converted to UTC.
13577 <a name="7.23.3.4" href="#7.23.3.4"><b> 7.23.3.4 The localtime function</b></a>
13578 Synopsis
13579 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13580 struct tm *localtime(const time_t *timer);
13581 Description
13582 2 The localtime function converts the calendar time pointed to by timer into a
13583 broken-down time, expressed as local time.
13584 Returns
13585 3 The localtime function returns a pointer to the broken-down time, or a null pointer if
13586 the specified time cannot be converted to local time.
13587 <a name="7.23.3.5" href="#7.23.3.5"><b> 7.23.3.5 The strftime function</b></a>
13588 Synopsis
13589 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13590 size_t strftime(char * restrict s,
13591 size_t maxsize,
13592 const char * restrict format,
13593 const struct tm * restrict timeptr);
13594 Description
13595 2 The strftime function places characters into the array pointed to by s as controlled by
13596 the string pointed to by format. The format shall be a multibyte character sequence,
13597 beginning and ending in its initial shift state. The format string consists of zero or
13598 more conversion specifiers and ordinary multibyte characters. A conversion specifier
13599 consists of a % character, possibly followed by an E or O modifier character (described
13600 below), followed by a character that determines the behavior of the conversion specifier.
13601 All ordinary multibyte characters (including the terminating null character) are copied
13602 [<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
13604 unchanged into the array. If copying takes place between objects that overlap, the
13605 behavior is undefined. No more than maxsize characters are placed into the array.
13606 3 Each conversion specifier is replaced by appropriate characters as described in the
13607 following list. The appropriate characters are determined using the LC_TIME category
13608 of the current locale and by the values of zero or more members of the broken-down time
13609 structure pointed to by timeptr, as specified in brackets in the description. If any of
13610 the specified values is outside the normal range, the characters stored are unspecified.
13611 %a is replaced by the locale's abbreviated weekday name. [tm_wday]
13612 %A is replaced by the locale's full weekday name. [tm_wday]
13613 %b is replaced by the locale's abbreviated month name. [tm_mon]
13614 %B is replaced by the locale's full month name. [tm_mon]
13615 %c is replaced by the locale's appropriate date and time representation. [all specified
13616 in <a href="#7.23.1">7.23.1</a>]
13617 %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
13618 number (00-99). [tm_year]
13619 %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
13620 %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
13621 %e is replaced by the day of the month as a decimal number (1-31); a single digit is
13622 preceded by a space. [tm_mday]
13623 %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
13624 tm_mday]
13625 %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
13626 number (00-99). [tm_year, tm_wday, tm_yday]
13627 %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
13628 [tm_year, tm_wday, tm_yday]
13629 %h is equivalent to ''%b''. [tm_mon]
13630 %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
13631 %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
13632 %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
13633 %m is replaced by the month as a decimal number (01-12). [tm_mon]
13634 %M is replaced by the minute as a decimal number (00-59). [tm_min]
13635 %n is replaced by a new-line character.
13636 %p is replaced by the locale's equivalent of the AM/PM designations associated with a
13637 12-hour clock. [tm_hour]
13638 %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
13639 %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
13640 %S is replaced by the second as a decimal number (00-60). [tm_sec]
13641 %t is replaced by a horizontal-tab character.
13642 %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
13643 tm_sec]
13645 [<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
13647 %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
13648 is 1. [tm_wday]
13649 %U is replaced by the week number of the year (the first Sunday as the first day of week
13650 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
13651 %V is replaced by the ISO 8601 week number (see below) as a decimal number
13652 (01-53). [tm_year, tm_wday, tm_yday]
13653 %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
13654 [tm_wday]
13655 %W is replaced by the week number of the year (the first Monday as the first day of
13656 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
13657 %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
13658 %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
13659 %y is replaced by the last 2 digits of the year as a decimal number (00-99).
13660 [tm_year]
13661 %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
13662 %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
13663 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
13664 zone is determinable. [tm_isdst]
13665 %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
13666 time zone is determinable. [tm_isdst]
13667 %% is replaced by %.
13668 4 Some conversion specifiers can be modified by the inclusion of an E or O modifier
13669 character to indicate an alternative format or specification. If the alternative format or
13670 specification does not exist for the current locale, the modifier is ignored.
13671 %Ec is replaced by the locale's alternative date and time representation.
13672 %EC is replaced by the name of the base year (period) in the locale's alternative
13673 representation.
13674 %Ex is replaced by the locale's alternative date representation.
13675 %EX is replaced by the locale's alternative time representation.
13676 %Ey is replaced by the offset from %EC (year only) in the locale's alternative
13677 representation.
13678 %EY is replaced by the locale's full alternative year representation.
13679 %Od is replaced by the day of the month, using the locale's alternative numeric symbols
13680 (filled as needed with leading zeros, or with leading spaces if there is no alternative
13681 symbol for zero).
13682 %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
13683 (filled as needed with leading spaces).
13684 %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
13685 symbols.
13688 [<a name="p345" href="#p345">page 345</a>] (<a href="#Contents">Contents</a>)
13690 %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
13691 symbols.
13692 %Om is replaced by the month, using the locale's alternative numeric symbols.
13693 %OM is replaced by the minutes, using the locale's alternative numeric symbols.
13694 %OS is replaced by the seconds, using the locale's alternative numeric symbols.
13695 %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
13696 representation, where Monday is 1.
13697 %OU is replaced by the week number, using the locale's alternative numeric symbols.
13698 %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
13699 symbols.
13700 %Ow is replaced by the weekday as a number, using the locale's alternative numeric
13701 symbols.
13702 %OW is replaced by the week number of the year, using the locale's alternative numeric
13703 symbols.
13704 %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
13705 symbols.
13706 5 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
13707 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
13708 which is also the week that includes the first Thursday of the year, and is also the first
13709 week that contains at least four days in the year. If the first Monday of January is the
13710 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
13711 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
13712 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
13713 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
13714 %V is replaced by 01.
13715 6 If a conversion specifier is not one of the above, the behavior is undefined.
13716 7 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
13717 following specifiers are:
13718 %a the first three characters of %A.
13719 %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
13720 %b the first three characters of %B.
13721 %B one of ''January'', ''February'', ... , ''December''.
13722 %c equivalent to ''%a %b %e %T %Y''.
13723 %p one of ''AM'' or ''PM''.
13724 %r equivalent to ''%I:%M:%S %p''.
13725 %x equivalent to ''%m/%d/%y''.
13726 %X equivalent to %T.
13727 %Z implementation-defined.
13730 [<a name="p346" href="#p346">page 346</a>] (<a href="#Contents">Contents</a>)
13732 Returns
13733 8 If the total number of resulting characters including the terminating null character is not
13734 more than maxsize, the strftime function returns the number of characters placed
13735 into the array pointed to by s not including the terminating null character. Otherwise,
13736 zero is returned and the contents of the array are indeterminate.
13741 [<a name="p347" href="#p347">page 347</a>] (<a href="#Contents">Contents</a>)
13743 <a name="7.24" href="#7.24"><b> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
13744 <a name="7.24.1" href="#7.24.1"><b> 7.24.1 Introduction</b></a>
13745 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares four data types, one tag, four macros, and many
13746 functions.277)
13747 2 The types declared are wchar_t and size_t (both described in <a href="#7.17">7.17</a>);
13748 mbstate_t
13749 which is an object type other than an array type that can hold the conversion state
13750 information necessary to convert between sequences of multibyte characters and wide
13751 characters;
13752 wint_t
13753 which is an integer type unchanged by default argument promotions that can hold any
13754 value corresponding to members of the extended character set, as well as at least one
13755 value that does not correspond to any member of the extended character set (see WEOF
13756 below);278) and
13757 struct tm
13758 which is declared as an incomplete structure type (the contents are described in <a href="#7.23.1">7.23.1</a>).
13759 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>); WCHAR_MIN and WCHAR_MAX
13760 (described in <a href="#7.18.3">7.18.3</a>); and
13761 WEOF
13762 which expands to a constant expression of type wint_t whose value does not
13763 correspond to any member of the extended character set.279) It is accepted (and returned)
13764 by several functions in this subclause to indicate end-of-file, that is, no more input from a
13765 stream. It is also used as a wide character value that does not correspond to any member
13766 of the extended character set.
13767 4 The functions declared are grouped as follows:
13768 -- Functions that perform input and output of wide characters, or multibyte characters,
13769 or both;
13770 -- Functions that provide wide string numeric conversion;
13771 -- Functions that perform general wide string manipulation;
13774 277) See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
13775 278) wchar_t and wint_t can be the same integer type.
13776 279) The value of the macro WEOF may differ from that of EOF and need not be negative.
13778 [<a name="p348" href="#p348">page 348</a>] (<a href="#Contents">Contents</a>)
13780 -- Functions for wide string date and time conversion; and
13781 -- Functions that provide extended capabilities for conversion between multibyte and
13782 wide character sequences.
13783 5 Unless explicitly stated otherwise, if the execution of a function described in this
13784 subclause causes copying to take place between objects that overlap, the behavior is
13785 undefined.
13786 <a name="7.24.2" href="#7.24.2"><b> 7.24.2 Formatted wide character input/output functions</b></a>
13787 1 The formatted wide character input/output functions shall behave as if there is a sequence
13788 point after the actions associated with each specifier.280)
13789 <a name="7.24.2.1" href="#7.24.2.1"><b> 7.24.2.1 The fwprintf function</b></a>
13790 Synopsis
13791 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13792 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13793 int fwprintf(FILE * restrict stream,
13794 const wchar_t * restrict format, ...);
13795 Description
13796 2 The fwprintf function writes output to the stream pointed to by stream, under
13797 control of the wide string pointed to by format that specifies how subsequent arguments
13798 are converted for output. If there are insufficient arguments for the format, the behavior
13799 is undefined. If the format is exhausted while arguments remain, the excess arguments
13800 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
13801 when the end of the format string is encountered.
13802 3 The format is composed of zero or more directives: ordinary wide characters (not %),
13803 which are copied unchanged to the output stream; and conversion specifications, each of
13804 which results in fetching zero or more subsequent arguments, converting them, if
13805 applicable, according to the corresponding conversion specifier, and then writing the
13806 result to the output stream.
13807 4 Each conversion specification is introduced by the wide character %. After the %, the
13808 following appear in sequence:
13809 -- Zero or more flags (in any order) that modify the meaning of the conversion
13810 specification.
13811 -- An optional minimum field width. If the converted value has fewer wide characters
13812 than the field width, it is padded with spaces (by default) on the left (or right, if the
13815 280) The fwprintf functions perform writes to memory for the %n specifier.
13817 [<a name="p349" href="#p349">page 349</a>] (<a href="#Contents">Contents</a>)
13819 left adjustment flag, described later, has been given) to the field width. The field
13820 width takes the form of an asterisk * (described later) or a nonnegative decimal
13821 integer.281)
13822 -- An optional precision that gives the minimum number of digits to appear for the d, i,
13823 o, u, x, and X conversions, the number of digits to appear after the decimal-point
13824 wide character for a, A, e, E, f, and F conversions, the maximum number of
13825 significant digits for the g and G conversions, or the maximum number of wide
13826 characters to be written for s conversions. The precision takes the form of a period
13827 (.) followed either by an asterisk * (described later) or by an optional decimal
13828 integer; if only the period is specified, the precision is taken as zero. If a precision
13829 appears with any other conversion specifier, the behavior is undefined.
13830 -- An optional length modifier that specifies the size of the argument.
13831 -- A conversion specifier wide character that specifies the type of conversion to be
13832 applied.
13833 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
13834 this case, an int argument supplies the field width or precision. The arguments
13835 specifying field width, or precision, or both, shall appear (in that order) before the
13836 argument (if any) to be converted. A negative field width argument is taken as a - flag
13837 followed by a positive field width. A negative precision argument is taken as if the
13838 precision were omitted.
13839 6 The flag wide characters and their meanings are:
13840 - The result of the conversion is left-justified within the field. (It is right-justified if
13841 this flag is not specified.)
13842 + The result of a signed conversion always begins with a plus or minus sign. (It
13843 begins with a sign only when a negative value is converted if this flag is not
13844 specified.)282)
13845 space If the first wide character of a signed conversion is not a sign, or if a signed
13846 conversion results in no wide characters, a space is prefixed to the result. If the
13847 space and + flags both appear, the space flag is ignored.
13848 # The result is converted to an ''alternative form''. For o conversion, it increases
13849 the precision, if and only if necessary, to force the first digit of the result to be a
13850 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
13851 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
13853 281) Note that 0 is taken as a flag, not as the beginning of a field width.
13854 282) The results of all floating conversions of a negative zero, and of negative values that round to zero,
13855 include a minus sign.
13857 [<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
13859 and G conversions, the result of converting a floating-point number always
13860 contains a decimal-point wide character, even if no digits follow it. (Normally, a
13861 decimal-point wide character appears in the result of these conversions only if a
13862 digit follows it.) For g and G conversions, trailing zeros are not removed from the
13863 result. For other conversions, the behavior is undefined.
13864 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
13865 (following any indication of sign or base) are used to pad to the field width rather
13866 than performing space padding, except when converting an infinity or NaN. If the
13867 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
13868 conversions, if a precision is specified, the 0 flag is ignored. For other
13869 conversions, the behavior is undefined.
13870 7 The length modifiers and their meanings are:
13871 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13872 signed char or unsigned char argument (the argument will have
13873 been promoted according to the integer promotions, but its value shall be
13874 converted to signed char or unsigned char before printing); or that
13875 a following n conversion specifier applies to a pointer to a signed char
13876 argument.
13877 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13878 short int or unsigned short int argument (the argument will
13879 have been promoted according to the integer promotions, but its value shall
13880 be converted to short int or unsigned short int before printing);
13881 or that a following n conversion specifier applies to a pointer to a short
13882 int argument.
13883 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13884 long int or unsigned long int argument; that a following n
13885 conversion specifier applies to a pointer to a long int argument; that a
13886 following c conversion specifier applies to a wint_t argument; that a
13887 following s conversion specifier applies to a pointer to a wchar_t
13888 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
13889 specifier.
13890 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13891 long long int or unsigned long long int argument; or that a
13892 following n conversion specifier applies to a pointer to a long long int
13893 argument.
13894 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
13895 an intmax_t or uintmax_t argument; or that a following n conversion
13896 specifier applies to a pointer to an intmax_t argument.
13898 [<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
13900 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13901 size_t or the corresponding signed integer type argument; or that a
13902 following n conversion specifier applies to a pointer to a signed integer type
13903 corresponding to size_t argument.
13904 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13905 ptrdiff_t or the corresponding unsigned integer type argument; or that a
13906 following n conversion specifier applies to a pointer to a ptrdiff_t
13907 argument.
13908 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13909 applies to a long double argument.
13910 If a length modifier appears with any conversion specifier other than as specified above,
13911 the behavior is undefined.
13912 8 The conversion specifiers and their meanings are:
13913 d,i The int argument is converted to signed decimal in the style [-]dddd. The
13914 precision specifies the minimum number of digits to appear; if the value
13915 being converted can be represented in fewer digits, it is expanded with
13916 leading zeros. The default precision is 1. The result of converting a zero
13917 value with a precision of zero is no wide characters.
13918 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
13919 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
13920 letters abcdef are used for x conversion and the letters ABCDEF for X
13921 conversion. The precision specifies the minimum number of digits to appear;
13922 if the value being converted can be represented in fewer digits, it is expanded
13923 with leading zeros. The default precision is 1. The result of converting a
13924 zero value with a precision of zero is no wide characters.
13925 f,F A double argument representing a floating-point number is converted to
13926 decimal notation in the style [-]ddd.ddd, where the number of digits after
13927 the decimal-point wide character is equal to the precision specification. If the
13928 precision is missing, it is taken as 6; if the precision is zero and the # flag is
13929 not specified, no decimal-point wide character appears. If a decimal-point
13930 wide character appears, at least one digit appears before it. The value is
13931 rounded to the appropriate number of digits.
13932 A double argument representing an infinity is converted in one of the styles
13933 [-]inf or [-]infinity -- which style is implementation-defined. A
13934 double argument representing a NaN is converted in one of the styles
13935 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
13936 any n-wchar-sequence, is implementation-defined. The F conversion
13937 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
13938 [<a name="p352" href="#p352">page 352</a>] (<a href="#Contents">Contents</a>)
13940 nan, respectively.283)
13941 e,E A double argument representing a floating-point number is converted in the
13942 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
13943 argument is nonzero) before the decimal-point wide character and the number
13944 of digits after it is equal to the precision; if the precision is missing, it is taken
13945 as 6; if the precision is zero and the # flag is not specified, no decimal-point
13946 wide character appears. The value is rounded to the appropriate number of
13947 digits. The E conversion specifier produces a number with E instead of e
13948 introducing the exponent. The exponent always contains at least two digits,
13949 and only as many more digits as necessary to represent the exponent. If the
13950 value is zero, the exponent is zero.
13951 A double argument representing an infinity or NaN is converted in the style
13952 of an f or F conversion specifier.
13953 g,G A double argument representing a floating-point number is converted in
13954 style f or e (or in style F or E in the case of a G conversion specifier),
13955 depending on the value converted and the precision. Let P equal the
13956 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
13957 Then, if a conversion with style E would have an exponent of X :
13958 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
13959 P - (X + 1).
13960 -- otherwise, the conversion is with style e (or E) and precision P - 1.
13961 Finally, unless the # flag is used, any trailing zeros are removed from the
13962 fractional portion of the result and the decimal-point wide character is
13963 removed if there is no fractional portion remaining.
13964 A double argument representing an infinity or NaN is converted in the style
13965 of an f or F conversion specifier.
13966 a,A A double argument representing a floating-point number is converted in the
13967 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
13968 nonzero if the argument is a normalized floating-point number and is
13969 otherwise unspecified) before the decimal-point wide character284) and the
13970 number of hexadecimal digits after it is equal to the precision; if the precision
13971 is missing and FLT_RADIX is a power of 2, then the precision is sufficient
13974 283) When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
13975 meaning; the # and 0 flag wide characters have no effect.
13976 284) Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
13977 character so that subsequent digits align to nibble (4-bit) boundaries.
13979 [<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
13981 for an exact representation of the value; if the precision is missing and
13982 FLT_RADIX is not a power of 2, then the precision is sufficient to
13983 distinguish285) values of type double, except that trailing zeros may be
13984 omitted; if the precision is zero and the # flag is not specified, no decimal-
13985 point wide character appears. The letters abcdef are used for a conversion
13986 and the letters ABCDEF for A conversion. The A conversion specifier
13987 produces a number with X and P instead of x and p. The exponent always
13988 contains at least one digit, and only as many more digits as necessary to
13989 represent the decimal exponent of 2. If the value is zero, the exponent is
13990 zero.
13991 A double argument representing an infinity or NaN is converted in the style
13992 of an f or F conversion specifier.
13993 c If no l length modifier is present, the int argument is converted to a wide
13994 character as if by calling btowc and the resulting wide character is written.
13995 If an l length modifier is present, the wint_t argument is converted to
13996 wchar_t and written.
13997 s If no l length modifier is present, the argument shall be a pointer to the initial
13998 element of a character array containing a multibyte character sequence
13999 beginning in the initial shift state. Characters from the array are converted as
14000 if by repeated calls to the mbrtowc function, with the conversion state
14001 described by an mbstate_t object initialized to zero before the first
14002 multibyte character is converted, and written up to (but not including) the
14003 terminating null wide character. If the precision is specified, no more than
14004 that many wide characters are written. If the precision is not specified or is
14005 greater than the size of the converted array, the converted array shall contain a
14006 null wide character.
14007 If an l length modifier is present, the argument shall be a pointer to the initial
14008 element of an array of wchar_t type. Wide characters from the array are
14009 written up to (but not including) a terminating null wide character. If the
14010 precision is specified, no more than that many wide characters are written. If
14011 the precision is not specified or is greater than the size of the array, the array
14012 shall contain a null wide character.
14013 p The argument shall be a pointer to void. The value of the pointer is
14014 converted to a sequence of printing wide characters, in an implementation-
14016 285) The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
14017 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
14018 might suffice depending on the implementation's scheme for determining the digit to the left of the
14019 decimal-point wide character.
14021 [<a name="p354" href="#p354">page 354</a>] (<a href="#Contents">Contents</a>)
14023 defined manner.
14024 n The argument shall be a pointer to signed integer into which is written the
14025 number of wide characters written to the output stream so far by this call to
14026 fwprintf. No argument is converted, but one is consumed. If the
14027 conversion specification includes any flags, a field width, or a precision, the
14028 behavior is undefined.
14029 % A % wide character is written. No argument is converted. The complete
14030 conversion specification shall be %%.
14031 9 If a conversion specification is invalid, the behavior is undefined.286) If any argument is
14032 not the correct type for the corresponding conversion specification, the behavior is
14033 undefined.
14034 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
14035 of a conversion is wider than the field width, the field is expanded to contain the
14036 conversion result.
14037 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
14038 to a hexadecimal floating number with the given precision.
14039 Recommended practice
14040 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
14041 representable in the given precision, the result should be one of the two adjacent numbers
14042 in hexadecimal floating style with the given precision, with the extra stipulation that the
14043 error should have a correct sign for the current rounding direction.
14044 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
14045 DECIMAL_DIG, then the result should be correctly rounded.287) If the number of
14046 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
14047 representable with DECIMAL_DIG digits, then the result should be an exact
14048 representation with trailing zeros. Otherwise, the source value is bounded by two
14049 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
14050 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
14051 the error should have a correct sign for the current rounding direction.
14052 Returns
14053 14 The fwprintf function returns the number of wide characters transmitted, or a negative
14054 value if an output or encoding error occurred.
14056 286) See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
14057 287) For binary-to-decimal conversion, the result format's values are the numbers representable with the
14058 given format specifier. The number of significant digits is determined by the format specifier, and in
14059 the case of fixed-point conversion by the source value as well.
14061 [<a name="p355" href="#p355">page 355</a>] (<a href="#Contents">Contents</a>)
14063 Environmental limits
14064 15 The number of wide characters that can be produced by any single conversion shall be at
14065 least 4095.
14066 16 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
14067 places:
14068 #include <a href="#7.12">&lt;math.h&gt;</a>
14069 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14070 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14071 /* ... */
14072 wchar_t *weekday, *month; // pointers to wide strings
14073 int day, hour, min;
14074 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
14075 weekday, month, day, hour, min);
14076 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(<a href="#1.0">1.0</a>));
14078 Forward references: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
14079 (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
14080 <a name="7.24.2.2" href="#7.24.2.2"><b> 7.24.2.2 The fwscanf function</b></a>
14081 Synopsis
14082 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14083 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14084 int fwscanf(FILE * restrict stream,
14085 const wchar_t * restrict format, ...);
14086 Description
14087 2 The fwscanf function reads input from the stream pointed to by stream, under
14088 control of the wide string pointed to by format that specifies the admissible input
14089 sequences and how they are to be converted for assignment, using subsequent arguments
14090 as pointers to the objects to receive the converted input. If there are insufficient
14091 arguments for the format, the behavior is undefined. If the format is exhausted while
14092 arguments remain, the excess arguments are evaluated (as always) but are otherwise
14093 ignored.
14094 3 The format is composed of zero or more directives: one or more white-space wide
14095 characters, an ordinary wide character (neither % nor a white-space wide character), or a
14096 conversion specification. Each conversion specification is introduced by the wide
14097 character %. After the %, the following appear in sequence:
14098 -- An optional assignment-suppressing wide character *.
14099 -- An optional decimal integer greater than zero that specifies the maximum field width
14100 (in wide characters).
14104 [<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
14106 -- An optional length modifier that specifies the size of the receiving object.
14107 -- A conversion specifier wide character that specifies the type of conversion to be
14108 applied.
14109 4 The fwscanf function executes each directive of the format in turn. If a directive fails,
14110 as detailed below, the function returns. Failures are described as input failures (due to the
14111 occurrence of an encoding error or the unavailability of input characters), or matching
14112 failures (due to inappropriate input).
14113 5 A directive composed of white-space wide character(s) is executed by reading input up to
14114 the first non-white-space wide character (which remains unread), or until no more wide
14115 characters can be read.
14116 6 A directive that is an ordinary wide character is executed by reading the next wide
14117 character of the stream. If that wide character differs from the directive, the directive
14118 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
14119 of-file, an encoding error, or a read error prevents a wide character from being read, the
14120 directive fails.
14121 7 A directive that is a conversion specification defines a set of matching input sequences, as
14122 described below for each specifier. A conversion specification is executed in the
14123 following steps:
14124 8 Input white-space wide characters (as specified by the iswspace function) are skipped,
14125 unless the specification includes a [, c, or n specifier.288)
14126 9 An input item is read from the stream, unless the specification includes an n specifier. An
14127 input item is defined as the longest sequence of input wide characters which does not
14128 exceed any specified field width and which is, or is a prefix of, a matching input
14129 sequence.289) The first wide character, if any, after the input item remains unread. If the
14130 length of the input item is zero, the execution of the directive fails; this condition is a
14131 matching failure unless end-of-file, an encoding error, or a read error prevented input
14132 from the stream, in which case it is an input failure.
14133 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
14134 count of input wide characters) is converted to a type appropriate to the conversion
14135 specifier. If the input item is not a matching sequence, the execution of the directive fails:
14136 this condition is a matching failure. Unless assignment suppression was indicated by a *,
14137 the result of the conversion is placed in the object pointed to by the first argument
14138 following the format argument that has not already received a conversion result. If this
14141 288) These white-space wide characters are not counted against a specified field width.
14142 289) fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
14143 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
14145 [<a name="p357" href="#p357">page 357</a>] (<a href="#Contents">Contents</a>)
14147 object does not have an appropriate type, or if the result of the conversion cannot be
14148 represented in the object, the behavior is undefined.
14149 11 The length modifiers and their meanings are:
14150 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14151 to an argument with type pointer to signed char or unsigned char.
14152 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14153 to an argument with type pointer to short int or unsigned short
14154 int.
14155 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14156 to an argument with type pointer to long int or unsigned long
14157 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
14158 an argument with type pointer to double; or that a following c, s, or [
14159 conversion specifier applies to an argument with type pointer to wchar_t.
14160 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14161 to an argument with type pointer to long long int or unsigned
14162 long long int.
14163 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14164 to an argument with type pointer to intmax_t or uintmax_t.
14165 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14166 to an argument with type pointer to size_t or the corresponding signed
14167 integer type.
14168 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
14169 to an argument with type pointer to ptrdiff_t or the corresponding
14170 unsigned integer type.
14171 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
14172 applies to an argument with type pointer to long double.
14173 If a length modifier appears with any conversion specifier other than as specified above,
14174 the behavior is undefined.
14175 12 The conversion specifiers and their meanings are:
14176 d Matches an optionally signed decimal integer, whose format is the same as
14177 expected for the subject sequence of the wcstol function with the value 10
14178 for the base argument. The corresponding argument shall be a pointer to
14179 signed integer.
14180 i Matches an optionally signed integer, whose format is the same as expected
14181 for the subject sequence of the wcstol function with the value 0 for the
14182 base argument. The corresponding argument shall be a pointer to signed
14183 [<a name="p358" href="#p358">page 358</a>] (<a href="#Contents">Contents</a>)
14185 integer.
14186 o Matches an optionally signed octal integer, whose format is the same as
14187 expected for the subject sequence of the wcstoul function with the value 8
14188 for the base argument. The corresponding argument shall be a pointer to
14189 unsigned integer.
14190 u Matches an optionally signed decimal integer, whose format is the same as
14191 expected for the subject sequence of the wcstoul function with the value 10
14192 for the base argument. The corresponding argument shall be a pointer to
14193 unsigned integer.
14194 x Matches an optionally signed hexadecimal integer, whose format is the same
14195 as expected for the subject sequence of the wcstoul function with the value
14196 16 for the base argument. The corresponding argument shall be a pointer to
14197 unsigned integer.
14198 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
14199 format is the same as expected for the subject sequence of the wcstod
14200 function. The corresponding argument shall be a pointer to floating.
14201 c Matches a sequence of wide characters of exactly the number specified by the
14202 field width (1 if no field width is present in the directive).
14203 If no l length modifier is present, characters from the input field are
14204 converted as if by repeated calls to the wcrtomb function, with the
14205 conversion state described by an mbstate_t object initialized to zero
14206 before the first wide character is converted. The corresponding argument
14207 shall be a pointer to the initial element of a character array large enough to
14208 accept the sequence. No null character is added.
14209 If an l length modifier is present, the corresponding argument shall be a
14210 pointer to the initial element of an array of wchar_t large enough to accept
14211 the sequence. No null wide character is added.
14212 s Matches a sequence of non-white-space wide characters.
14213 If no l length modifier is present, characters from the input field are
14214 converted as if by repeated calls to the wcrtomb function, with the
14215 conversion state described by an mbstate_t object initialized to zero
14216 before the first wide character is converted. The corresponding argument
14217 shall be a pointer to the initial element of a character array large enough to
14218 accept the sequence and a terminating null character, which will be added
14219 automatically.
14220 If an l length modifier is present, the corresponding argument shall be a
14221 pointer to the initial element of an array of wchar_t large enough to accept
14223 [<a name="p359" href="#p359">page 359</a>] (<a href="#Contents">Contents</a>)
14225 the sequence and the terminating null wide character, which will be added
14226 automatically.
14227 [ Matches a nonempty sequence of wide characters from a set of expected
14228 characters (the scanset).
14229 If no l length modifier is present, characters from the input field are
14230 converted as if by repeated calls to the wcrtomb function, with the
14231 conversion state described by an mbstate_t object initialized to zero
14232 before the first wide character is converted. The corresponding argument
14233 shall be a pointer to the initial element of a character array large enough to
14234 accept the sequence and a terminating null character, which will be added
14235 automatically.
14236 If an l length modifier is present, the corresponding argument shall be a
14237 pointer to the initial element of an array of wchar_t large enough to accept
14238 the sequence and the terminating null wide character, which will be added
14239 automatically.
14240 The conversion specifier includes all subsequent wide characters in the
14241 format string, up to and including the matching right bracket (]). The wide
14242 characters between the brackets (the scanlist) compose the scanset, unless the
14243 wide character after the left bracket is a circumflex (^), in which case the
14244 scanset contains all wide characters that do not appear in the scanlist between
14245 the circumflex and the right bracket. If the conversion specifier begins with
14246 [] or [^], the right bracket wide character is in the scanlist and the next
14247 following right bracket wide character is the matching right bracket that ends
14248 the specification; otherwise the first following right bracket wide character is
14249 the one that ends the specification. If a - wide character is in the scanlist and
14250 is not the first, nor the second where the first wide character is a ^, nor the
14251 last character, the behavior is implementation-defined.
14252 p Matches an implementation-defined set of sequences, which should be the
14253 same as the set of sequences that may be produced by the %p conversion of
14254 the fwprintf function. The corresponding argument shall be a pointer to a
14255 pointer to void. The input item is converted to a pointer value in an
14256 implementation-defined manner. If the input item is a value converted earlier
14257 during the same program execution, the pointer that results shall compare
14258 equal to that value; otherwise the behavior of the %p conversion is undefined.
14259 n No input is consumed. The corresponding argument shall be a pointer to
14260 signed integer into which is to be written the number of wide characters read
14261 from the input stream so far by this call to the fwscanf function. Execution
14262 of a %n directive does not increment the assignment count returned at the
14263 completion of execution of the fwscanf function. No argument is
14264 [<a name="p360" href="#p360">page 360</a>] (<a href="#Contents">Contents</a>)
14266 converted, but one is consumed. If the conversion specification includes an
14267 assignment-suppressing wide character or a field width, the behavior is
14268 undefined.
14269 % Matches a single % wide character; no conversion or assignment occurs. The
14270 complete conversion specification shall be %%.
14271 13 If a conversion specification is invalid, the behavior is undefined.290)
14272 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
14273 respectively, a, e, f, g, and x.
14274 15 Trailing white space (including new-line wide characters) is left unread unless matched
14275 by a directive. The success of literal matches and suppressed assignments is not directly
14276 determinable other than via the %n directive.
14277 Returns
14278 16 The fwscanf function returns the value of the macro EOF if an input failure occurs
14279 before any conversion. Otherwise, the function returns the number of input items
14280 assigned, which can be fewer than provided for, or even zero, in the event of an early
14281 matching failure.
14282 17 EXAMPLE 1 The call:
14283 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14284 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14285 /* ... */
14286 int n, i; float x; wchar_t name[50];
14287 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
14288 with the input line:
14289 25 54.32E-1 thompson
14290 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
14291 thompson\0.
14293 18 EXAMPLE 2 The call:
14294 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14295 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14296 /* ... */
14297 int i; float x; double y;
14298 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
14299 with input:
14300 56789 0123 56a72
14301 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
14302 56.0. The next wide character read from the input stream will be a.
14305 290) See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
14307 [<a name="p361" href="#p361">page 361</a>] (<a href="#Contents">Contents</a>)
14309 Forward references: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
14310 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
14311 function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
14312 <a name="7.24.2.3" href="#7.24.2.3"><b> 7.24.2.3 The swprintf function</b></a>
14313 Synopsis
14314 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14315 int swprintf(wchar_t * restrict s,
14316 size_t n,
14317 const wchar_t * restrict format, ...);
14318 Description
14319 2 The swprintf function is equivalent to fwprintf, except that the argument s
14320 specifies an array of wide characters into which the generated output is to be written,
14321 rather than written to a stream. No more than n wide characters are written, including a
14322 terminating null wide character, which is always added (unless n is zero).
14323 Returns
14324 3 The swprintf function returns the number of wide characters written in the array, not
14325 counting the terminating null wide character, or a negative value if an encoding error
14326 occurred or if n or more wide characters were requested to be written.
14327 <a name="7.24.2.4" href="#7.24.2.4"><b> 7.24.2.4 The swscanf function</b></a>
14328 Synopsis
14329 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14330 int swscanf(const wchar_t * restrict s,
14331 const wchar_t * restrict format, ...);
14332 Description
14333 2 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
14334 wide string from which the input is to be obtained, rather than from a stream. Reaching
14335 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
14336 function.
14337 Returns
14338 3 The swscanf function returns the value of the macro EOF if an input failure occurs
14339 before any conversion. Otherwise, the swscanf function returns the number of input
14340 items assigned, which can be fewer than provided for, or even zero, in the event of an
14341 early matching failure.
14346 [<a name="p362" href="#p362">page 362</a>] (<a href="#Contents">Contents</a>)
14348 <a name="7.24.2.5" href="#7.24.2.5"><b> 7.24.2.5 The vfwprintf function</b></a>
14349 Synopsis
14350 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14351 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14352 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14353 int vfwprintf(FILE * restrict stream,
14354 const wchar_t * restrict format,
14355 va_list arg);
14356 Description
14357 2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
14358 replaced by arg, which shall have been initialized by the va_start macro (and
14359 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
14360 va_end macro.291)
14361 Returns
14362 3 The vfwprintf function returns the number of wide characters transmitted, or a
14363 negative value if an output or encoding error occurred.
14364 4 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
14365 routine.
14366 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14367 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14368 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14369 void error(char *function_name, wchar_t *format, ...)
14371 va_list args;
14372 va_start(args, format);
14373 // print out name of function causing error
14374 fwprintf(stderr, L"ERROR in %s: ", function_name);
14375 // print out remainder of message
14376 vfwprintf(stderr, format, args);
14377 va_end(args);
14383 291) As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
14384 invoke the va_arg macro, the value of arg after the return is indeterminate.
14386 [<a name="p363" href="#p363">page 363</a>] (<a href="#Contents">Contents</a>)
14388 <a name="7.24.2.6" href="#7.24.2.6"><b> 7.24.2.6 The vfwscanf function</b></a>
14389 Synopsis
14390 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14391 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14392 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14393 int vfwscanf(FILE * restrict stream,
14394 const wchar_t * restrict format,
14395 va_list arg);
14396 Description
14397 2 The vfwscanf function is equivalent to fwscanf, with the variable argument list
14398 replaced by arg, which shall have been initialized by the va_start macro (and
14399 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
14400 va_end macro.291)
14401 Returns
14402 3 The vfwscanf function returns the value of the macro EOF if an input failure occurs
14403 before any conversion. Otherwise, the vfwscanf function returns the number of input
14404 items assigned, which can be fewer than provided for, or even zero, in the event of an
14405 early matching failure.
14406 <a name="7.24.2.7" href="#7.24.2.7"><b> 7.24.2.7 The vswprintf function</b></a>
14407 Synopsis
14408 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14409 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14410 int vswprintf(wchar_t * restrict s,
14411 size_t n,
14412 const wchar_t * restrict format,
14413 va_list arg);
14414 Description
14415 2 The vswprintf function is equivalent to swprintf, with the variable argument list
14416 replaced by arg, which shall have been initialized by the va_start macro (and
14417 possibly subsequent va_arg calls). The vswprintf function does not invoke the
14418 va_end macro.291)
14419 Returns
14420 3 The vswprintf function returns the number of wide characters written in the array, not
14421 counting the terminating null wide character, or a negative value if an encoding error
14422 occurred or if n or more wide characters were requested to be generated.
14425 [<a name="p364" href="#p364">page 364</a>] (<a href="#Contents">Contents</a>)
14427 <a name="7.24.2.8" href="#7.24.2.8"><b> 7.24.2.8 The vswscanf function</b></a>
14428 Synopsis
14429 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14430 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14431 int vswscanf(const wchar_t * restrict s,
14432 const wchar_t * restrict format,
14433 va_list arg);
14434 Description
14435 2 The vswscanf function is equivalent to swscanf, with the variable argument list
14436 replaced by arg, which shall have been initialized by the va_start macro (and
14437 possibly subsequent va_arg calls). The vswscanf function does not invoke the
14438 va_end macro.291)
14439 Returns
14440 3 The vswscanf function returns the value of the macro EOF if an input failure occurs
14441 before any conversion. Otherwise, the vswscanf function returns the number of input
14442 items assigned, which can be fewer than provided for, or even zero, in the event of an
14443 early matching failure.
14444 <a name="7.24.2.9" href="#7.24.2.9"><b> 7.24.2.9 The vwprintf function</b></a>
14445 Synopsis
14446 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14447 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14448 int vwprintf(const wchar_t * restrict format,
14449 va_list arg);
14450 Description
14451 2 The vwprintf function is equivalent to wprintf, with the variable argument list
14452 replaced by arg, which shall have been initialized by the va_start macro (and
14453 possibly subsequent va_arg calls). The vwprintf function does not invoke the
14454 va_end macro.291)
14455 Returns
14456 3 The vwprintf function returns the number of wide characters transmitted, or a negative
14457 value if an output or encoding error occurred.
14462 [<a name="p365" href="#p365">page 365</a>] (<a href="#Contents">Contents</a>)
14464 <a name="7.24.2.10" href="#7.24.2.10"><b> 7.24.2.10 The vwscanf function</b></a>
14465 Synopsis
14466 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14467 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14468 int vwscanf(const wchar_t * restrict format,
14469 va_list arg);
14470 Description
14471 2 The vwscanf function is equivalent to wscanf, with the variable argument list
14472 replaced by arg, which shall have been initialized by the va_start macro (and
14473 possibly subsequent va_arg calls). The vwscanf function does not invoke the
14474 va_end macro.291)
14475 Returns
14476 3 The vwscanf function returns the value of the macro EOF if an input failure occurs
14477 before any conversion. Otherwise, the vwscanf function returns the number of input
14478 items assigned, which can be fewer than provided for, or even zero, in the event of an
14479 early matching failure.
14480 <a name="7.24.2.11" href="#7.24.2.11"><b> 7.24.2.11 The wprintf function</b></a>
14481 Synopsis
14482 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14483 int wprintf(const wchar_t * restrict format, ...);
14484 Description
14485 2 The wprintf function is equivalent to fwprintf with the argument stdout
14486 interposed before the arguments to wprintf.
14487 Returns
14488 3 The wprintf function returns the number of wide characters transmitted, or a negative
14489 value if an output or encoding error occurred.
14490 <a name="7.24.2.12" href="#7.24.2.12"><b> 7.24.2.12 The wscanf function</b></a>
14491 Synopsis
14492 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14493 int wscanf(const wchar_t * restrict format, ...);
14494 Description
14495 2 The wscanf function is equivalent to fwscanf with the argument stdin interposed
14496 before the arguments to wscanf.
14499 [<a name="p366" href="#p366">page 366</a>] (<a href="#Contents">Contents</a>)
14501 Returns
14502 3 The wscanf function returns the value of the macro EOF if an input failure occurs
14503 before any conversion. Otherwise, the wscanf function returns the number of input
14504 items assigned, which can be fewer than provided for, or even zero, in the event of an
14505 early matching failure.
14506 <a name="7.24.3" href="#7.24.3"><b> 7.24.3 Wide character input/output functions</b></a>
14507 <a name="7.24.3.1" href="#7.24.3.1"><b> 7.24.3.1 The fgetwc function</b></a>
14508 Synopsis
14509 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14510 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14511 wint_t fgetwc(FILE *stream);
14512 Description
14513 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
14514 next wide character is present, the fgetwc function obtains that wide character as a
14515 wchar_t converted to a wint_t and advances the associated file position indicator for
14516 the stream (if defined).
14517 Returns
14518 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
14519 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
14520 the fgetwc function returns the next wide character from the input stream pointed to by
14521 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
14522 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
14523 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.292)
14524 <a name="7.24.3.2" href="#7.24.3.2"><b> 7.24.3.2 The fgetws function</b></a>
14525 Synopsis
14526 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14527 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14528 wchar_t *fgetws(wchar_t * restrict s,
14529 int n, FILE * restrict stream);
14530 Description
14531 2 The fgetws function reads at most one less than the number of wide characters
14532 specified by n from the stream pointed to by stream into the array pointed to by s. No
14535 292) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
14536 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
14538 [<a name="p367" href="#p367">page 367</a>] (<a href="#Contents">Contents</a>)
14540 additional wide characters are read after a new-line wide character (which is retained) or
14541 after end-of-file. A null wide character is written immediately after the last wide
14542 character read into the array.
14543 Returns
14544 3 The fgetws function returns s if successful. If end-of-file is encountered and no
14545 characters have been read into the array, the contents of the array remain unchanged and a
14546 null pointer is returned. If a read or encoding error occurs during the operation, the array
14547 contents are indeterminate and a null pointer is returned.
14548 <a name="7.24.3.3" href="#7.24.3.3"><b> 7.24.3.3 The fputwc function</b></a>
14549 Synopsis
14550 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14551 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14552 wint_t fputwc(wchar_t c, FILE *stream);
14553 Description
14554 2 The fputwc function writes the wide character specified by c to the output stream
14555 pointed to by stream, at the position indicated by the associated file position indicator
14556 for the stream (if defined), and advances the indicator appropriately. If the file cannot
14557 support positioning requests, or if the stream was opened with append mode, the
14558 character is appended to the output stream.
14559 Returns
14560 3 The fputwc function returns the wide character written. If a write error occurs, the
14561 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
14562 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
14563 <a name="7.24.3.4" href="#7.24.3.4"><b> 7.24.3.4 The fputws function</b></a>
14564 Synopsis
14565 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14566 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14567 int fputws(const wchar_t * restrict s,
14568 FILE * restrict stream);
14569 Description
14570 2 The fputws function writes the wide string pointed to by s to the stream pointed to by
14571 stream. The terminating null wide character is not written.
14572 Returns
14573 3 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
14574 returns a nonnegative value.
14576 [<a name="p368" href="#p368">page 368</a>] (<a href="#Contents">Contents</a>)
14578 <a name="7.24.3.5" href="#7.24.3.5"><b> 7.24.3.5 The fwide function</b></a>
14579 Synopsis
14580 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14581 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14582 int fwide(FILE *stream, int mode);
14583 Description
14584 2 The fwide function determines the orientation of the stream pointed to by stream. If
14585 mode is greater than zero, the function first attempts to make the stream wide oriented. If
14586 mode is less than zero, the function first attempts to make the stream byte oriented.293)
14587 Otherwise, mode is zero and the function does not alter the orientation of the stream.
14588 Returns
14589 3 The fwide function returns a value greater than zero if, after the call, the stream has
14590 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
14591 stream has no orientation.
14592 <a name="7.24.3.6" href="#7.24.3.6"><b> 7.24.3.6 The getwc function</b></a>
14593 Synopsis
14594 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14595 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14596 wint_t getwc(FILE *stream);
14597 Description
14598 2 The getwc function is equivalent to fgetwc, except that if it is implemented as a
14599 macro, it may evaluate stream more than once, so the argument should never be an
14600 expression with side effects.
14601 Returns
14602 3 The getwc function returns the next wide character from the input stream pointed to by
14603 stream, or WEOF.
14604 <a name="7.24.3.7" href="#7.24.3.7"><b> 7.24.3.7 The getwchar function</b></a>
14605 Synopsis
14606 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14607 wint_t getwchar(void);
14612 293) If the orientation of the stream has already been determined, fwide does not change it.
14614 [<a name="p369" href="#p369">page 369</a>] (<a href="#Contents">Contents</a>)
14616 Description
14617 2 The getwchar function is equivalent to getwc with the argument stdin.
14618 Returns
14619 3 The getwchar function returns the next wide character from the input stream pointed to
14620 by stdin, or WEOF.
14621 <a name="7.24.3.8" href="#7.24.3.8"><b> 7.24.3.8 The putwc function</b></a>
14622 Synopsis
14623 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14624 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14625 wint_t putwc(wchar_t c, FILE *stream);
14626 Description
14627 2 The putwc function is equivalent to fputwc, except that if it is implemented as a
14628 macro, it may evaluate stream more than once, so that argument should never be an
14629 expression with side effects.
14630 Returns
14631 3 The putwc function returns the wide character written, or WEOF.
14632 <a name="7.24.3.9" href="#7.24.3.9"><b> 7.24.3.9 The putwchar function</b></a>
14633 Synopsis
14634 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14635 wint_t putwchar(wchar_t c);
14636 Description
14637 2 The putwchar function is equivalent to putwc with the second argument stdout.
14638 Returns
14639 3 The putwchar function returns the character written, or WEOF.
14640 <a name="7.24.3.10" href="#7.24.3.10"><b> 7.24.3.10 The ungetwc function</b></a>
14641 Synopsis
14642 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14643 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14644 wint_t ungetwc(wint_t c, FILE *stream);
14645 Description
14646 2 The ungetwc function pushes the wide character specified by c back onto the input
14647 stream pointed to by stream. Pushed-back wide characters will be returned by
14648 subsequent reads on that stream in the reverse order of their pushing. A successful
14650 [<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
14652 intervening call (with the stream pointed to by stream) to a file positioning function
14653 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
14654 stream. The external storage corresponding to the stream is unchanged.
14655 3 One wide character of pushback is guaranteed, even if the call to the ungetwc function
14656 follows just after a call to a formatted wide character input function fwscanf,
14657 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
14658 on the same stream without an intervening read or file positioning operation on that
14659 stream, the operation may fail.
14660 4 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
14661 unchanged.
14662 5 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
14663 The value of the file position indicator for the stream after reading or discarding all
14664 pushed-back wide characters is the same as it was before the wide characters were pushed
14665 back. For a text or binary stream, the value of its file position indicator after a successful
14666 call to the ungetwc function is unspecified until all pushed-back wide characters are
14667 read or discarded.
14668 Returns
14669 6 The ungetwc function returns the wide character pushed back, or WEOF if the operation
14670 fails.
14671 <a name="7.24.4" href="#7.24.4"><b> 7.24.4 General wide string utilities</b></a>
14672 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
14673 manipulation. Various methods are used for determining the lengths of the arrays, but in
14674 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
14675 array. If an array is accessed beyond the end of an object, the behavior is undefined.
14676 2 Where an argument declared as size_t n determines the length of the array for a
14677 function, n can have the value zero on a call to that function. Unless explicitly stated
14678 otherwise in the description of a particular function in this subclause, pointer arguments
14679 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
14680 function that locates a wide character finds no occurrence, a function that compares two
14681 wide character sequences returns zero, and a function that copies wide characters copies
14682 zero wide characters.
14687 [<a name="p371" href="#p371">page 371</a>] (<a href="#Contents">Contents</a>)
14689 <a name="7.24.4.1" href="#7.24.4.1"><b> 7.24.4.1 Wide string numeric conversion functions</b></a>
14690 <a name="7.24.4.1.1" href="#7.24.4.1.1"><b> 7.24.4.1.1 The wcstod, wcstof, and wcstold functions</b></a>
14691 Synopsis
14692 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14693 double wcstod(const wchar_t * restrict nptr,
14694 wchar_t ** restrict endptr);
14695 float wcstof(const wchar_t * restrict nptr,
14696 wchar_t ** restrict endptr);
14697 long double wcstold(const wchar_t * restrict nptr,
14698 wchar_t ** restrict endptr);
14699 Description
14700 2 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
14701 string pointed to by nptr to double, float, and long double representation,
14702 respectively. First, they decompose the input string into three parts: an initial, possibly
14703 empty, sequence of white-space wide characters (as specified by the iswspace
14704 function), a subject sequence resembling a floating-point constant or representing an
14705 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
14706 including the terminating null wide character of the input wide string. Then, they attempt
14707 to convert the subject sequence to a floating-point number, and return the result.
14708 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
14709 the following:
14710 -- a nonempty sequence of decimal digits optionally containing a decimal-point wide
14711 character, then an optional exponent part as defined for the corresponding single-byte
14712 characters in <a href="#6.4.4.2">6.4.4.2</a>;
14713 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
14714 decimal-point wide character, then an optional binary exponent part as defined in
14715 <a href="#6.4.4.2">6.4.4.2</a>;
14716 -- INF or INFINITY, or any other wide string equivalent except for case
14717 -- NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
14718 case in the NAN part, where:
14719 n-wchar-sequence:
14720 digit
14721 nondigit
14722 n-wchar-sequence digit
14723 n-wchar-sequence nondigit
14724 The subject sequence is defined as the longest initial subsequence of the input wide
14725 string, starting with the first non-white-space wide character, that is of the expected form.
14726 [<a name="p372" href="#p372">page 372</a>] (<a href="#Contents">Contents</a>)
14728 The subject sequence contains no wide characters if the input wide string is not of the
14729 expected form.
14730 4 If the subject sequence has the expected form for a floating-point number, the sequence of
14731 wide characters starting with the first digit or the decimal-point wide character
14732 (whichever occurs first) is interpreted as a floating constant according to the rules of
14733 <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
14734 if neither an exponent part nor a decimal-point wide character appears in a decimal
14735 floating point number, or if a binary exponent part does not appear in a hexadecimal
14736 floating point number, an exponent part of the appropriate type with value zero is
14737 assumed to follow the last digit in the string. If the subject sequence begins with a minus
14738 sign, the sequence is interpreted as negated.294) A wide character sequence INF or
14739 INFINITY is interpreted as an infinity, if representable in the return type, else like a
14740 floating constant that is too large for the range of the return type. A wide character
14741 sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
14742 in the return type, else like a subject sequence part that does not have the expected form;
14743 the meaning of the n-wchar sequences is implementation-defined.295) A pointer to the
14744 final wide string is stored in the object pointed to by endptr, provided that endptr is
14745 not a null pointer.
14746 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
14747 value resulting from the conversion is correctly rounded.
14748 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
14749 accepted.
14750 7 If the subject sequence is empty or does not have the expected form, no conversion is
14751 performed; the value of nptr is stored in the object pointed to by endptr, provided
14752 that endptr is not a null pointer.
14753 Recommended practice
14754 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
14755 the result is not exactly representable, the result should be one of the two numbers in the
14756 appropriate internal format that are adjacent to the hexadecimal floating source value,
14757 with the extra stipulation that the error should have a correct sign for the current rounding
14758 direction.
14762 294) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
14763 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
14764 methods may yield different results if rounding is toward positive or negative infinity. In either case,
14765 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
14766 295) An implementation may use the n-wchar sequence to determine extra information to be represented in
14767 the NaN's significand.
14769 [<a name="p373" href="#p373">page 373</a>] (<a href="#Contents">Contents</a>)
14771 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
14772 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
14773 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
14774 consider the two bounding, adjacent decimal strings L and U, both having
14775 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
14776 The result should be one of the (equal or adjacent) values that would be obtained by
14777 correctly rounding L and U according to the current rounding direction, with the extra
14778 stipulation that the error with respect to D should have a correct sign for the current
14779 rounding direction.296)
14780 Returns
14781 10 The functions return the converted value, if any. If no conversion could be performed,
14782 zero is returned. If the correct value is outside the range of representable values, plus or
14783 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
14784 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
14785 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
14786 than the smallest normalized positive number in the return type; whether errno acquires
14787 the value ERANGE is implementation-defined.
14792 296) DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
14793 to the same internal floating value, but if not will round to adjacent values.
14795 [<a name="p374" href="#p374">page 374</a>] (<a href="#Contents">Contents</a>)
14797 <a name="7.24.4.1.2" href="#7.24.4.1.2"><b> 7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</b></a>
14798 Synopsis
14799 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14800 long int wcstol(
14801 const wchar_t * restrict nptr,
14802 wchar_t ** restrict endptr,
14803 int base);
14804 long long int wcstoll(
14805 const wchar_t * restrict nptr,
14806 wchar_t ** restrict endptr,
14807 int base);
14808 unsigned long int wcstoul(
14809 const wchar_t * restrict nptr,
14810 wchar_t ** restrict endptr,
14811 int base);
14812 unsigned long long int wcstoull(
14813 const wchar_t * restrict nptr,
14814 wchar_t ** restrict endptr,
14815 int base);
14816 Description
14817 2 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
14818 portion of the wide string pointed to by nptr to long int, long long int,
14819 unsigned long int, and unsigned long long int representation,
14820 respectively. First, they decompose the input string into three parts: an initial, possibly
14821 empty, sequence of white-space wide characters (as specified by the iswspace
14822 function), a subject sequence resembling an integer represented in some radix determined
14823 by the value of base, and a final wide string of one or more unrecognized wide
14824 characters, including the terminating null wide character of the input wide string. Then,
14825 they attempt to convert the subject sequence to an integer, and return the result.
14826 3 If the value of base is zero, the expected form of the subject sequence is that of an
14827 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
14828 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
14829 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
14830 is a sequence of letters and digits representing an integer with the radix specified by
14831 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
14832 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
14833 letters and digits whose ascribed values are less than that of base are permitted. If the
14834 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
14835 of letters and digits, following the sign if present.
14837 [<a name="p375" href="#p375">page 375</a>] (<a href="#Contents">Contents</a>)
14839 4 The subject sequence is defined as the longest initial subsequence of the input wide
14840 string, starting with the first non-white-space wide character, that is of the expected form.
14841 The subject sequence contains no wide characters if the input wide string is empty or
14842 consists entirely of white space, or if the first non-white-space wide character is other
14843 than a sign or a permissible letter or digit.
14844 5 If the subject sequence has the expected form and the value of base is zero, the sequence
14845 of wide characters starting with the first digit is interpreted as an integer constant
14846 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
14847 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
14848 letter its value as given above. If the subject sequence begins with a minus sign, the value
14849 resulting from the conversion is negated (in the return type). A pointer to the final wide
14850 string is stored in the object pointed to by endptr, provided that endptr is not a null
14851 pointer.
14852 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
14853 accepted.
14854 7 If the subject sequence is empty or does not have the expected form, no conversion is
14855 performed; the value of nptr is stored in the object pointed to by endptr, provided
14856 that endptr is not a null pointer.
14857 Returns
14858 8 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
14859 value, if any. If no conversion could be performed, zero is returned. If the correct value
14860 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
14861 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
14862 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
14863 <a name="7.24.4.2" href="#7.24.4.2"><b> 7.24.4.2 Wide string copying functions</b></a>
14864 <a name="7.24.4.2.1" href="#7.24.4.2.1"><b> 7.24.4.2.1 The wcscpy function</b></a>
14865 Synopsis
14866 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14867 wchar_t *wcscpy(wchar_t * restrict s1,
14868 const wchar_t * restrict s2);
14869 Description
14870 2 The wcscpy function copies the wide string pointed to by s2 (including the terminating
14871 null wide character) into the array pointed to by s1.
14872 Returns
14873 3 The wcscpy function returns the value of s1.
14876 [<a name="p376" href="#p376">page 376</a>] (<a href="#Contents">Contents</a>)
14878 <a name="7.24.4.2.2" href="#7.24.4.2.2"><b> 7.24.4.2.2 The wcsncpy function</b></a>
14879 Synopsis
14880 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14881 wchar_t *wcsncpy(wchar_t * restrict s1,
14882 const wchar_t * restrict s2,
14883 size_t n);
14884 Description
14885 2 The wcsncpy function copies not more than n wide characters (those that follow a null
14886 wide character are not copied) from the array pointed to by s2 to the array pointed to by
14887 s1.297)
14888 3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
14889 wide characters are appended to the copy in the array pointed to by s1, until n wide
14890 characters in all have been written.
14891 Returns
14892 4 The wcsncpy function returns the value of s1.
14893 <a name="7.24.4.2.3" href="#7.24.4.2.3"><b> 7.24.4.2.3 The wmemcpy function</b></a>
14894 Synopsis
14895 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14896 wchar_t *wmemcpy(wchar_t * restrict s1,
14897 const wchar_t * restrict s2,
14898 size_t n);
14899 Description
14900 2 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
14901 object pointed to by s1.
14902 Returns
14903 3 The wmemcpy function returns the value of s1.
14908 297) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
14909 result will not be null-terminated.
14911 [<a name="p377" href="#p377">page 377</a>] (<a href="#Contents">Contents</a>)
14913 <a name="7.24.4.2.4" href="#7.24.4.2.4"><b> 7.24.4.2.4 The wmemmove function</b></a>
14914 Synopsis
14915 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14916 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
14917 size_t n);
14918 Description
14919 2 The wmemmove function copies n wide characters from the object pointed to by s2 to
14920 the object pointed to by s1. Copying takes place as if the n wide characters from the
14921 object pointed to by s2 are first copied into a temporary array of n wide characters that
14922 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
14923 the temporary array are copied into the object pointed to by s1.
14924 Returns
14925 3 The wmemmove function returns the value of s1.
14926 <a name="7.24.4.3" href="#7.24.4.3"><b> 7.24.4.3 Wide string concatenation functions</b></a>
14927 <a name="7.24.4.3.1" href="#7.24.4.3.1"><b> 7.24.4.3.1 The wcscat function</b></a>
14928 Synopsis
14929 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14930 wchar_t *wcscat(wchar_t * restrict s1,
14931 const wchar_t * restrict s2);
14932 Description
14933 2 The wcscat function appends a copy of the wide string pointed to by s2 (including the
14934 terminating null wide character) to the end of the wide string pointed to by s1. The initial
14935 wide character of s2 overwrites the null wide character at the end of s1.
14936 Returns
14937 3 The wcscat function returns the value of s1.
14938 <a name="7.24.4.3.2" href="#7.24.4.3.2"><b> 7.24.4.3.2 The wcsncat function</b></a>
14939 Synopsis
14940 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14941 wchar_t *wcsncat(wchar_t * restrict s1,
14942 const wchar_t * restrict s2,
14943 size_t n);
14944 Description
14945 2 The wcsncat function appends not more than n wide characters (a null wide character
14946 and those that follow it are not appended) from the array pointed to by s2 to the end of
14948 [<a name="p378" href="#p378">page 378</a>] (<a href="#Contents">Contents</a>)
14950 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
14951 wide character at the end of s1. A terminating null wide character is always appended to
14952 the result.298)
14953 Returns
14954 3 The wcsncat function returns the value of s1.
14955 <a name="7.24.4.4" href="#7.24.4.4"><b> 7.24.4.4 Wide string comparison functions</b></a>
14956 1 Unless explicitly stated otherwise, the functions described in this subclause order two
14957 wide characters the same way as two integers of the underlying integer type designated
14958 by wchar_t.
14959 <a name="7.24.4.4.1" href="#7.24.4.4.1"><b> 7.24.4.4.1 The wcscmp function</b></a>
14960 Synopsis
14961 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14962 int wcscmp(const wchar_t *s1, const wchar_t *s2);
14963 Description
14964 2 The wcscmp function compares the wide string pointed to by s1 to the wide string
14965 pointed to by s2.
14966 Returns
14967 3 The wcscmp function returns an integer greater than, equal to, or less than zero,
14968 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
14969 wide string pointed to by s2.
14970 <a name="7.24.4.4.2" href="#7.24.4.4.2"><b> 7.24.4.4.2 The wcscoll function</b></a>
14971 Synopsis
14972 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14973 int wcscoll(const wchar_t *s1, const wchar_t *s2);
14974 Description
14975 2 The wcscoll function compares the wide string pointed to by s1 to the wide string
14976 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
14977 current locale.
14978 Returns
14979 3 The wcscoll function returns an integer greater than, equal to, or less than zero,
14980 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
14983 298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
14984 wcslen(s1)+n+1.
14986 [<a name="p379" href="#p379">page 379</a>] (<a href="#Contents">Contents</a>)
14988 wide string pointed to by s2 when both are interpreted as appropriate to the current
14989 locale.
14990 <a name="7.24.4.4.3" href="#7.24.4.4.3"><b> 7.24.4.4.3 The wcsncmp function</b></a>
14991 Synopsis
14992 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14993 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
14994 size_t n);
14995 Description
14996 2 The wcsncmp function compares not more than n wide characters (those that follow a
14997 null wide character are not compared) from the array pointed to by s1 to the array
14998 pointed to by s2.
14999 Returns
15000 3 The wcsncmp function returns an integer greater than, equal to, or less than zero,
15001 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
15002 to, or less than the possibly null-terminated array pointed to by s2.
15003 <a name="7.24.4.4.4" href="#7.24.4.4.4"><b> 7.24.4.4.4 The wcsxfrm function</b></a>
15004 Synopsis
15005 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15006 size_t wcsxfrm(wchar_t * restrict s1,
15007 const wchar_t * restrict s2,
15008 size_t n);
15009 Description
15010 2 The wcsxfrm function transforms the wide string pointed to by s2 and places the
15011 resulting wide string into the array pointed to by s1. The transformation is such that if
15012 the wcscmp function is applied to two transformed wide strings, it returns a value greater
15013 than, equal to, or less than zero, corresponding to the result of the wcscoll function
15014 applied to the same two original wide strings. No more than n wide characters are placed
15015 into the resulting array pointed to by s1, including the terminating null wide character. If
15016 n is zero, s1 is permitted to be a null pointer.
15017 Returns
15018 3 The wcsxfrm function returns the length of the transformed wide string (not including
15019 the terminating null wide character). If the value returned is n or greater, the contents of
15020 the array pointed to by s1 are indeterminate.
15021 4 EXAMPLE The value of the following expression is the length of the array needed to hold the
15022 transformation of the wide string pointed to by s:
15025 [<a name="p380" href="#p380">page 380</a>] (<a href="#Contents">Contents</a>)
15027 1 + wcsxfrm(NULL, s, 0)
15029 <a name="7.24.4.4.5" href="#7.24.4.4.5"><b> 7.24.4.4.5 The wmemcmp function</b></a>
15030 Synopsis
15031 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15032 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
15033 size_t n);
15034 Description
15035 2 The wmemcmp function compares the first n wide characters of the object pointed to by
15036 s1 to the first n wide characters of the object pointed to by s2.
15037 Returns
15038 3 The wmemcmp function returns an integer greater than, equal to, or less than zero,
15039 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
15040 pointed to by s2.
15041 <a name="7.24.4.5" href="#7.24.4.5"><b> 7.24.4.5 Wide string search functions</b></a>
15042 <a name="7.24.4.5.1" href="#7.24.4.5.1"><b> 7.24.4.5.1 The wcschr function</b></a>
15043 Synopsis
15044 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15045 wchar_t *wcschr(const wchar_t *s, wchar_t c);
15046 Description
15047 2 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
15048 The terminating null wide character is considered to be part of the wide string.
15049 Returns
15050 3 The wcschr function returns a pointer to the located wide character, or a null pointer if
15051 the wide character does not occur in the wide string.
15052 <a name="7.24.4.5.2" href="#7.24.4.5.2"><b> 7.24.4.5.2 The wcscspn function</b></a>
15053 Synopsis
15054 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15055 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
15056 Description
15057 2 The wcscspn function computes the length of the maximum initial segment of the wide
15058 string pointed to by s1 which consists entirely of wide characters not from the wide
15059 string pointed to by s2.
15063 [<a name="p381" href="#p381">page 381</a>] (<a href="#Contents">Contents</a>)
15065 Returns
15066 3 The wcscspn function returns the length of the segment.
15067 <a name="7.24.4.5.3" href="#7.24.4.5.3"><b> 7.24.4.5.3 The wcspbrk function</b></a>
15068 Synopsis
15069 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15070 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
15071 Description
15072 2 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
15073 any wide character from the wide string pointed to by s2.
15074 Returns
15075 3 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
15076 no wide character from s2 occurs in s1.
15077 <a name="7.24.4.5.4" href="#7.24.4.5.4"><b> 7.24.4.5.4 The wcsrchr function</b></a>
15078 Synopsis
15079 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15080 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
15081 Description
15082 2 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
15083 s. The terminating null wide character is considered to be part of the wide string.
15084 Returns
15085 3 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
15086 not occur in the wide string.
15087 <a name="7.24.4.5.5" href="#7.24.4.5.5"><b> 7.24.4.5.5 The wcsspn function</b></a>
15088 Synopsis
15089 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15090 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
15091 Description
15092 2 The wcsspn function computes the length of the maximum initial segment of the wide
15093 string pointed to by s1 which consists entirely of wide characters from the wide string
15094 pointed to by s2.
15095 Returns
15096 3 The wcsspn function returns the length of the segment.
15099 [<a name="p382" href="#p382">page 382</a>] (<a href="#Contents">Contents</a>)
15101 <a name="7.24.4.5.6" href="#7.24.4.5.6"><b> 7.24.4.5.6 The wcsstr function</b></a>
15102 Synopsis
15103 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15104 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
15105 Description
15106 2 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
15107 the sequence of wide characters (excluding the terminating null wide character) in the
15108 wide string pointed to by s2.
15109 Returns
15110 3 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
15111 wide string is not found. If s2 points to a wide string with zero length, the function
15112 returns s1.
15113 <a name="7.24.4.5.7" href="#7.24.4.5.7"><b> 7.24.4.5.7 The wcstok function</b></a>
15114 Synopsis
15115 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15116 wchar_t *wcstok(wchar_t * restrict s1,
15117 const wchar_t * restrict s2,
15118 wchar_t ** restrict ptr);
15119 Description
15120 2 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
15121 a sequence of tokens, each of which is delimited by a wide character from the wide string
15122 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
15123 which the wcstok function stores information necessary for it to continue scanning the
15124 same wide string.
15125 3 The first call in a sequence has a non-null first argument and stores an initial value in the
15126 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
15127 the object pointed to by ptr is required to have the value stored by the previous call in
15128 the sequence, which is then updated. The separator wide string pointed to by s2 may be
15129 different from call to call.
15130 4 The first call in the sequence searches the wide string pointed to by s1 for the first wide
15131 character that is not contained in the current separator wide string pointed to by s2. If no
15132 such wide character is found, then there are no tokens in the wide string pointed to by s1
15133 and the wcstok function returns a null pointer. If such a wide character is found, it is
15134 the start of the first token.
15135 5 The wcstok function then searches from there for a wide character that is contained in
15136 the current separator wide string. If no such wide character is found, the current token
15137 [<a name="p383" href="#p383">page 383</a>] (<a href="#Contents">Contents</a>)
15139 extends to the end of the wide string pointed to by s1, and subsequent searches in the
15140 same wide string for a token return a null pointer. If such a wide character is found, it is
15141 overwritten by a null wide character, which terminates the current token.
15142 6 In all cases, the wcstok function stores sufficient information in the pointer pointed to
15143 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
15144 value for ptr, shall start searching just past the element overwritten by a null wide
15145 character (if any).
15146 Returns
15147 7 The wcstok function returns a pointer to the first wide character of a token, or a null
15148 pointer if there is no token.
15149 8 EXAMPLE
15150 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15151 static wchar_t str1[] = L"?a???b,,,#c";
15152 static wchar_t str2[] = L"\t \t";
15153 wchar_t *t, *ptr1, *ptr2;
15154 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
15155 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
15156 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
15157 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
15158 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer
15160 <a name="7.24.4.5.8" href="#7.24.4.5.8"><b> 7.24.4.5.8 The wmemchr function</b></a>
15161 Synopsis
15162 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15163 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
15164 size_t n);
15165 Description
15166 2 The wmemchr function locates the first occurrence of c in the initial n wide characters of
15167 the object pointed to by s.
15168 Returns
15169 3 The wmemchr function returns a pointer to the located wide character, or a null pointer if
15170 the wide character does not occur in the object.
15175 [<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
15177 <a name="7.24.4.6" href="#7.24.4.6"><b> 7.24.4.6 Miscellaneous functions</b></a>
15178 <a name="7.24.4.6.1" href="#7.24.4.6.1"><b> 7.24.4.6.1 The wcslen function</b></a>
15179 Synopsis
15180 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15181 size_t wcslen(const wchar_t *s);
15182 Description
15183 2 The wcslen function computes the length of the wide string pointed to by s.
15184 Returns
15185 3 The wcslen function returns the number of wide characters that precede the terminating
15186 null wide character.
15187 <a name="7.24.4.6.2" href="#7.24.4.6.2"><b> 7.24.4.6.2 The wmemset function</b></a>
15188 Synopsis
15189 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15190 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
15191 Description
15192 2 The wmemset function copies the value of c into each of the first n wide characters of
15193 the object pointed to by s.
15194 Returns
15195 3 The wmemset function returns the value of s.
15196 <a name="7.24.5" href="#7.24.5"><b> 7.24.5 Wide character time conversion functions</b></a>
15197 <a name="7.24.5.1" href="#7.24.5.1"><b> 7.24.5.1 The wcsftime function</b></a>
15198 Synopsis
15199 1 #include <a href="#7.23">&lt;time.h&gt;</a>
15200 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15201 size_t wcsftime(wchar_t * restrict s,
15202 size_t maxsize,
15203 const wchar_t * restrict format,
15204 const struct tm * restrict timeptr);
15205 Description
15206 2 The wcsftime function is equivalent to the strftime function, except that:
15207 -- The argument s points to the initial element of an array of wide characters into which
15208 the generated output is to be placed.
15211 [<a name="p385" href="#p385">page 385</a>] (<a href="#Contents">Contents</a>)
15213 -- The argument maxsize indicates the limiting number of wide characters.
15214 -- The argument format is a wide string and the conversion specifiers are replaced by
15215 corresponding sequences of wide characters.
15216 -- The return value indicates the number of wide characters.
15217 Returns
15218 3 If the total number of resulting wide characters including the terminating null wide
15219 character is not more than maxsize, the wcsftime function returns the number of
15220 wide characters placed into the array pointed to by s not including the terminating null
15221 wide character. Otherwise, zero is returned and the contents of the array are
15222 indeterminate.
15223 <a name="7.24.6" href="#7.24.6"><b> 7.24.6 Extended multibyte/wide character conversion utilities</b></a>
15224 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
15225 between multibyte characters and wide characters.
15226 2 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.24.6.3">7.24.6.3</a> and
15227 <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
15228 to describe the current conversion state from a particular multibyte character sequence to
15229 a wide character sequence (or the reverse) under the rules of a particular setting for the
15230 LC_CTYPE category of the current locale.
15231 3 The initial conversion state corresponds, for a conversion in either direction, to the
15232 beginning of a new multibyte character in the initial shift state. A zero-valued
15233 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
15234 valued mbstate_t object can be used to initiate conversion involving any multibyte
15235 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
15236 been altered by any of the functions described in this subclause, and is then used with a
15237 different multibyte character sequence, or in the other conversion direction, or with a
15238 different LC_CTYPE category setting than on earlier function calls, the behavior is
15239 undefined.299)
15240 4 On entry, each function takes the described conversion state (either internal or pointed to
15241 by an argument) as current. The conversion state described by the pointed-to object is
15242 altered as needed to track the shift state, and the position within a multibyte character, for
15243 the associated multibyte character sequence.
15248 299) Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
15249 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
15250 character string.
15252 [<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
15254 <a name="7.24.6.1" href="#7.24.6.1"><b> 7.24.6.1 Single-byte/wide character conversion functions</b></a>
15255 <a name="7.24.6.1.1" href="#7.24.6.1.1"><b> 7.24.6.1.1 The btowc function</b></a>
15256 Synopsis
15257 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15258 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15259 wint_t btowc(int c);
15260 Description
15261 2 The btowc function determines whether c constitutes a valid single-byte character in the
15262 initial shift state.
15263 Returns
15264 3 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
15265 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
15266 returns the wide character representation of that character.
15267 <a name="7.24.6.1.2" href="#7.24.6.1.2"><b> 7.24.6.1.2 The wctob function</b></a>
15268 Synopsis
15269 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
15270 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15271 int wctob(wint_t c);
15272 Description
15273 2 The wctob function determines whether c corresponds to a member of the extended
15274 character set whose multibyte character representation is a single byte when in the initial
15275 shift state.
15276 Returns
15277 3 The wctob function returns EOF if c does not correspond to a multibyte character with
15278 length one in the initial shift state. Otherwise, it returns the single-byte representation of
15279 that character as an unsigned char converted to an int.
15280 <a name="7.24.6.2" href="#7.24.6.2"><b> 7.24.6.2 Conversion state functions</b></a>
15281 <a name="7.24.6.2.1" href="#7.24.6.2.1"><b> 7.24.6.2.1 The mbsinit function</b></a>
15282 Synopsis
15283 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15284 int mbsinit(const mbstate_t *ps);
15285 Description
15286 2 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
15287 mbstate_t object describes an initial conversion state.
15288 [<a name="p387" href="#p387">page 387</a>] (<a href="#Contents">Contents</a>)
15290 Returns
15291 3 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
15292 describes an initial conversion state; otherwise, it returns zero.
15293 <a name="7.24.6.3" href="#7.24.6.3"><b> 7.24.6.3 Restartable multibyte/wide character conversion functions</b></a>
15294 1 These functions differ from the corresponding multibyte character functions of <a href="#7.20.7">7.20.7</a>
15295 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
15296 pointer to mbstate_t that points to an object that can completely describe the current
15297 conversion state of the associated multibyte character sequence. If ps is a null pointer,
15298 each function uses its own internal mbstate_t object instead, which is initialized at
15299 program startup to the initial conversion state. The implementation behaves as if no
15300 library function calls these functions with a null pointer for ps.
15301 2 Also unlike their corresponding functions, the return value does not represent whether the
15302 encoding is state-dependent.
15303 <a name="7.24.6.3.1" href="#7.24.6.3.1"><b> 7.24.6.3.1 The mbrlen function</b></a>
15304 Synopsis
15305 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15306 size_t mbrlen(const char * restrict s,
15307 size_t n,
15308 mbstate_t * restrict ps);
15309 Description
15310 2 The mbrlen function is equivalent to the call:
15311 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
15312 where internal is the mbstate_t object for the mbrlen function, except that the
15313 expression designated by ps is evaluated only once.
15314 Returns
15315 3 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
15316 or (size_t)(-1).
15317 Forward references: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
15322 [<a name="p388" href="#p388">page 388</a>] (<a href="#Contents">Contents</a>)
15324 <a name="7.24.6.3.2" href="#7.24.6.3.2"><b> 7.24.6.3.2 The mbrtowc function</b></a>
15325 Synopsis
15326 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15327 size_t mbrtowc(wchar_t * restrict pwc,
15328 const char * restrict s,
15329 size_t n,
15330 mbstate_t * restrict ps);
15331 Description
15332 2 If s is a null pointer, the mbrtowc function is equivalent to the call:
15333 mbrtowc(NULL, "", 1, ps)
15334 In this case, the values of the parameters pwc and n are ignored.
15335 3 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
15336 the byte pointed to by s to determine the number of bytes needed to complete the next
15337 multibyte character (including any shift sequences). If the function determines that the
15338 next multibyte character is complete and valid, it determines the value of the
15339 corresponding wide character and then, if pwc is not a null pointer, stores that value in
15340 the object pointed to by pwc. If the corresponding wide character is the null wide
15341 character, the resulting state described is the initial conversion state.
15342 Returns
15343 4 The mbrtowc function returns the first of the following that applies (given the current
15344 conversion state):
15345 0 if the next n or fewer bytes complete the multibyte character that
15346 corresponds to the null wide character (which is the value stored).
15347 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
15348 character (which is the value stored); the value returned is the number
15349 of bytes that complete the multibyte character.
15350 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
15351 multibyte character, and all n bytes have been processed (no value is
15352 stored).300)
15353 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
15354 do not contribute to a complete and valid multibyte character (no
15355 value is stored); the value of the macro EILSEQ is stored in errno,
15356 and the conversion state is unspecified.
15358 300) When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
15359 sequence of redundant shift sequences (for implementations with state-dependent encodings).
15361 [<a name="p389" href="#p389">page 389</a>] (<a href="#Contents">Contents</a>)
15363 <a name="7.24.6.3.3" href="#7.24.6.3.3"><b> 7.24.6.3.3 The wcrtomb function</b></a>
15364 Synopsis
15365 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15366 size_t wcrtomb(char * restrict s,
15367 wchar_t wc,
15368 mbstate_t * restrict ps);
15369 Description
15370 2 If s is a null pointer, the wcrtomb function is equivalent to the call
15371 wcrtomb(buf, L'\0', ps)
15372 where buf is an internal buffer.
15373 3 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
15374 to represent the multibyte character that corresponds to the wide character given by wc
15375 (including any shift sequences), and stores the multibyte character representation in the
15376 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
15377 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
15378 to restore the initial shift state; the resulting state described is the initial conversion state.
15379 Returns
15380 4 The wcrtomb function returns the number of bytes stored in the array object (including
15381 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
15382 the function stores the value of the macro EILSEQ in errno and returns
15383 (size_t)(-1); the conversion state is unspecified.
15384 <a name="7.24.6.4" href="#7.24.6.4"><b> 7.24.6.4 Restartable multibyte/wide string conversion functions</b></a>
15385 1 These functions differ from the corresponding multibyte string functions of <a href="#7.20.8">7.20.8</a>
15386 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
15387 mbstate_t that points to an object that can completely describe the current conversion
15388 state of the associated multibyte character sequence. If ps is a null pointer, each function
15389 uses its own internal mbstate_t object instead, which is initialized at program startup
15390 to the initial conversion state. The implementation behaves as if no library function calls
15391 these functions with a null pointer for ps.
15392 2 Also unlike their corresponding functions, the conversion source parameter, src, has a
15393 pointer-to-pointer type. When the function is storing the results of conversions (that is,
15394 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
15395 to reflect the amount of the source processed by that invocation.
15400 [<a name="p390" href="#p390">page 390</a>] (<a href="#Contents">Contents</a>)
15402 <a name="7.24.6.4.1" href="#7.24.6.4.1"><b> 7.24.6.4.1 The mbsrtowcs function</b></a>
15403 Synopsis
15404 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15405 size_t mbsrtowcs(wchar_t * restrict dst,
15406 const char ** restrict src,
15407 size_t len,
15408 mbstate_t * restrict ps);
15409 Description
15410 2 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
15411 conversion state described by the object pointed to by ps, from the array indirectly
15412 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
15413 pointer, the converted characters are stored into the array pointed to by dst. Conversion
15414 continues up to and including a terminating null character, which is also stored.
15415 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
15416 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
15417 characters have been stored into the array pointed to by dst.301) Each conversion takes
15418 place as if by a call to the mbrtowc function.
15419 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
15420 pointer (if conversion stopped due to reaching a terminating null character) or the address
15421 just past the last multibyte character converted (if any). If conversion stopped due to
15422 reaching a terminating null character and if dst is not a null pointer, the resulting state
15423 described is the initial conversion state.
15424 Returns
15425 4 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
15426 character, an encoding error occurs: the mbsrtowcs function stores the value of the
15427 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
15428 unspecified. Otherwise, it returns the number of multibyte characters successfully
15429 converted, not including the terminating null character (if any).
15434 301) Thus, the value of len is ignored if dst is a null pointer.
15436 [<a name="p391" href="#p391">page 391</a>] (<a href="#Contents">Contents</a>)
15438 <a name="7.24.6.4.2" href="#7.24.6.4.2"><b> 7.24.6.4.2 The wcsrtombs function</b></a>
15439 Synopsis
15440 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15441 size_t wcsrtombs(char * restrict dst,
15442 const wchar_t ** restrict src,
15443 size_t len,
15444 mbstate_t * restrict ps);
15445 Description
15446 2 The wcsrtombs function converts a sequence of wide characters from the array
15447 indirectly pointed to by src into a sequence of corresponding multibyte characters that
15448 begins in the conversion state described by the object pointed to by ps. If dst is not a
15449 null pointer, the converted characters are then stored into the array pointed to by dst.
15450 Conversion continues up to and including a terminating null wide character, which is also
15451 stored. Conversion stops earlier in two cases: when a wide character is reached that does
15452 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
15453 next multibyte character would exceed the limit of len total bytes to be stored into the
15454 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
15455 function.302)
15456 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
15457 pointer (if conversion stopped due to reaching a terminating null wide character) or the
15458 address just past the last wide character converted (if any). If conversion stopped due to
15459 reaching a terminating null wide character, the resulting state described is the initial
15460 conversion state.
15461 Returns
15462 4 If conversion stops because a wide character is reached that does not correspond to a
15463 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
15464 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
15465 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
15466 character sequence, not including the terminating null character (if any).
15471 302) If conversion stops because a terminating null wide character has been reached, the bytes stored
15472 include those necessary to reach the initial shift state immediately before the null byte.
15474 [<a name="p392" href="#p392">page 392</a>] (<a href="#Contents">Contents</a>)
15476 <a name="7.25" href="#7.25"><b> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
15477 <a name="7.25.1" href="#7.25.1"><b> 7.25.1 Introduction</b></a>
15478 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares three data types, one macro, and many functions.303)
15479 2 The types declared are
15480 wint_t
15481 described in <a href="#7.24.1">7.24.1</a>;
15482 wctrans_t
15483 which is a scalar type that can hold values which represent locale-specific character
15484 mappings; and
15485 wctype_t
15486 which is a scalar type that can hold values which represent locale-specific character
15487 classifications.
15488 3 The macro defined is WEOF (described in <a href="#7.24.1">7.24.1</a>).
15489 4 The functions declared are grouped as follows:
15490 -- Functions that provide wide character classification;
15491 -- Extensible functions that provide wide character classification;
15492 -- Functions that provide wide character case mapping;
15493 -- Extensible functions that provide wide character mapping.
15494 5 For all functions described in this subclause that accept an argument of type wint_t, the
15495 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
15496 this argument has any other value, the behavior is undefined.
15497 6 The behavior of these functions is affected by the LC_CTYPE category of the current
15498 locale.
15503 303) See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
15505 [<a name="p393" href="#p393">page 393</a>] (<a href="#Contents">Contents</a>)
15507 <a name="7.25.2" href="#7.25.2"><b> 7.25.2 Wide character classification utilities</b></a>
15508 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
15509 characters.
15510 2 The term printing wide character refers to a member of a locale-specific set of wide
15511 characters, each of which occupies at least one printing position on a display device. The
15512 term control wide character refers to a member of a locale-specific set of wide characters
15513 that are not printing wide characters.
15514 <a name="7.25.2.1" href="#7.25.2.1"><b> 7.25.2.1 Wide character classification functions</b></a>
15515 1 The functions in this subclause return nonzero (true) if and only if the value of the
15516 argument wc conforms to that in the description of the function.
15517 2 Each of the following functions returns true for each wide character that corresponds (as
15518 if by a call to the wctob function) to a single-byte character for which the corresponding
15519 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
15520 iswpunct functions may differ with respect to wide characters other than L' ' that are
15521 both printing and white-space wide characters.304)
15522 Forward references: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
15523 <a name="7.25.2.1.1" href="#7.25.2.1.1"><b> 7.25.2.1.1 The iswalnum function</b></a>
15524 Synopsis
15525 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15526 int iswalnum(wint_t wc);
15527 Description
15528 2 The iswalnum function tests for any wide character for which iswalpha or
15529 iswdigit is true.
15530 <a name="7.25.2.1.2" href="#7.25.2.1.2"><b> 7.25.2.1.2 The iswalpha function</b></a>
15531 Synopsis
15532 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15533 int iswalpha(wint_t wc);
15534 Description
15535 2 The iswalpha function tests for any wide character for which iswupper or
15536 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
15538 304) For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
15539 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
15540 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
15541 &amp;&amp; iswspace(wc) is true, but not both.
15543 [<a name="p394" href="#p394">page 394</a>] (<a href="#Contents">Contents</a>)
15545 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
15546 is true.305)
15547 <a name="7.25.2.1.3" href="#7.25.2.1.3"><b> 7.25.2.1.3 The iswblank function</b></a>
15548 Synopsis
15549 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15550 int iswblank(wint_t wc);
15551 Description
15552 2 The iswblank function tests for any wide character that is a standard blank wide
15553 character or is one of a locale-specific set of wide characters for which iswspace is true
15554 and that is used to separate words within a line of text. The standard blank wide
15555 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
15556 locale, iswblank returns true only for the standard blank characters.
15557 <a name="7.25.2.1.4" href="#7.25.2.1.4"><b> 7.25.2.1.4 The iswcntrl function</b></a>
15558 Synopsis
15559 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15560 int iswcntrl(wint_t wc);
15561 Description
15562 2 The iswcntrl function tests for any control wide character.
15563 <a name="7.25.2.1.5" href="#7.25.2.1.5"><b> 7.25.2.1.5 The iswdigit function</b></a>
15564 Synopsis
15565 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15566 int iswdigit(wint_t wc);
15567 Description
15568 2 The iswdigit function tests for any wide character that corresponds to a decimal-digit
15569 character (as defined in <a href="#5.2.1">5.2.1</a>).
15570 <a name="7.25.2.1.6" href="#7.25.2.1.6"><b> 7.25.2.1.6 The iswgraph function</b></a>
15571 Synopsis
15572 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15573 int iswgraph(wint_t wc);
15578 305) The functions iswlower and iswupper test true or false separately for each of these additional
15579 wide characters; all four combinations are possible.
15581 [<a name="p395" href="#p395">page 395</a>] (<a href="#Contents">Contents</a>)
15583 Description
15584 2 The iswgraph function tests for any wide character for which iswprint is true and
15585 iswspace is false.306)
15586 <a name="7.25.2.1.7" href="#7.25.2.1.7"><b> 7.25.2.1.7 The iswlower function</b></a>
15587 Synopsis
15588 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15589 int iswlower(wint_t wc);
15590 Description
15591 2 The iswlower function tests for any wide character that corresponds to a lowercase
15592 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
15593 iswdigit, iswpunct, or iswspace is true.
15594 <a name="7.25.2.1.8" href="#7.25.2.1.8"><b> 7.25.2.1.8 The iswprint function</b></a>
15595 Synopsis
15596 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15597 int iswprint(wint_t wc);
15598 Description
15599 2 The iswprint function tests for any printing wide character.
15600 <a name="7.25.2.1.9" href="#7.25.2.1.9"><b> 7.25.2.1.9 The iswpunct function</b></a>
15601 Synopsis
15602 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15603 int iswpunct(wint_t wc);
15604 Description
15605 2 The iswpunct function tests for any printing wide character that is one of a locale-
15606 specific set of punctuation wide characters for which neither iswspace nor iswalnum
15607 is true.306)
15608 <a name="7.25.2.1.10" href="#7.25.2.1.10"><b> 7.25.2.1.10 The iswspace function</b></a>
15609 Synopsis
15610 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15611 int iswspace(wint_t wc);
15615 306) Note that the behavior of the iswgraph and iswpunct functions may differ from their
15616 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
15617 characters other than ' '.
15619 [<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
15621 Description
15622 2 The iswspace function tests for any wide character that corresponds to a locale-specific
15623 set of white-space wide characters for which none of iswalnum, iswgraph, or
15624 iswpunct is true.
15625 <a name="7.25.2.1.11" href="#7.25.2.1.11"><b> 7.25.2.1.11 The iswupper function</b></a>
15626 Synopsis
15627 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15628 int iswupper(wint_t wc);
15629 Description
15630 2 The iswupper function tests for any wide character that corresponds to an uppercase
15631 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
15632 iswdigit, iswpunct, or iswspace is true.
15633 <a name="7.25.2.1.12" href="#7.25.2.1.12"><b> 7.25.2.1.12 The iswxdigit function</b></a>
15634 Synopsis
15635 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15636 int iswxdigit(wint_t wc);
15637 Description
15638 2 The iswxdigit function tests for any wide character that corresponds to a
15639 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
15640 <a name="7.25.2.2" href="#7.25.2.2"><b> 7.25.2.2 Extensible wide character classification functions</b></a>
15641 1 The functions wctype and iswctype provide extensible wide character classification
15642 as well as testing equivalent to that performed by the functions described in the previous
15643 subclause (<a href="#7.25.2.1">7.25.2.1</a>).
15644 <a name="7.25.2.2.1" href="#7.25.2.2.1"><b> 7.25.2.2.1 The iswctype function</b></a>
15645 Synopsis
15646 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15647 int iswctype(wint_t wc, wctype_t desc);
15648 Description
15649 2 The iswctype function determines whether the wide character wc has the property
15650 described by desc. The current setting of the LC_CTYPE category shall be the same as
15651 during the call to wctype that returned the value desc.
15652 3 Each of the following expressions has a truth-value equivalent to the call to the wide
15653 character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
15656 [<a name="p397" href="#p397">page 397</a>] (<a href="#Contents">Contents</a>)
15658 iswctype(wc, wctype("alnum")) // iswalnum(wc)
15659 iswctype(wc, wctype("alpha")) // iswalpha(wc)
15660 iswctype(wc, wctype("blank")) // iswblank(wc)
15661 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
15662 iswctype(wc, wctype("digit")) // iswdigit(wc)
15663 iswctype(wc, wctype("graph")) // iswgraph(wc)
15664 iswctype(wc, wctype("lower")) // iswlower(wc)
15665 iswctype(wc, wctype("print")) // iswprint(wc)
15666 iswctype(wc, wctype("punct")) // iswpunct(wc)
15667 iswctype(wc, wctype("space")) // iswspace(wc)
15668 iswctype(wc, wctype("upper")) // iswupper(wc)
15669 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
15670 Returns
15671 4 The iswctype function returns nonzero (true) if and only if the value of the wide
15672 character wc has the property described by desc.
15673 Forward references: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
15674 <a name="7.25.2.2.2" href="#7.25.2.2.2"><b> 7.25.2.2.2 The wctype function</b></a>
15675 Synopsis
15676 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15677 wctype_t wctype(const char *property);
15678 Description
15679 2 The wctype function constructs a value with type wctype_t that describes a class of
15680 wide characters identified by the string argument property.
15681 3 The strings listed in the description of the iswctype function shall be valid in all
15682 locales as property arguments to the wctype function.
15683 Returns
15684 4 If property identifies a valid class of wide characters according to the LC_CTYPE
15685 category of the current locale, the wctype function returns a nonzero value that is valid
15686 as the second argument to the iswctype function; otherwise, it returns zero. *
15691 [<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
15693 <a name="7.25.3" href="#7.25.3"><b> 7.25.3 Wide character case mapping utilities</b></a>
15694 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
15695 <a name="7.25.3.1" href="#7.25.3.1"><b> 7.25.3.1 Wide character case mapping functions</b></a>
15696 <a name="7.25.3.1.1" href="#7.25.3.1.1"><b> 7.25.3.1.1 The towlower function</b></a>
15697 Synopsis
15698 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15699 wint_t towlower(wint_t wc);
15700 Description
15701 2 The towlower function converts an uppercase letter to a corresponding lowercase letter.
15702 Returns
15703 3 If the argument is a wide character for which iswupper is true and there are one or
15704 more corresponding wide characters, as specified by the current locale, for which
15705 iswlower is true, the towlower function returns one of the corresponding wide
15706 characters (always the same one for any given locale); otherwise, the argument is
15707 returned unchanged.
15708 <a name="7.25.3.1.2" href="#7.25.3.1.2"><b> 7.25.3.1.2 The towupper function</b></a>
15709 Synopsis
15710 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15711 wint_t towupper(wint_t wc);
15712 Description
15713 2 The towupper function converts a lowercase letter to a corresponding uppercase letter.
15714 Returns
15715 3 If the argument is a wide character for which iswlower is true and there are one or
15716 more corresponding wide characters, as specified by the current locale, for which
15717 iswupper is true, the towupper function returns one of the corresponding wide
15718 characters (always the same one for any given locale); otherwise, the argument is
15719 returned unchanged.
15720 <a name="7.25.3.2" href="#7.25.3.2"><b> 7.25.3.2 Extensible wide character case mapping functions</b></a>
15721 1 The functions wctrans and towctrans provide extensible wide character mapping as
15722 well as case mapping equivalent to that performed by the functions described in the
15723 previous subclause (<a href="#7.25.3.1">7.25.3.1</a>).
15728 [<a name="p399" href="#p399">page 399</a>] (<a href="#Contents">Contents</a>)
15730 <a name="7.25.3.2.1" href="#7.25.3.2.1"><b> 7.25.3.2.1 The towctrans function</b></a>
15731 Synopsis
15732 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15733 wint_t towctrans(wint_t wc, wctrans_t desc);
15734 Description
15735 2 The towctrans function maps the wide character wc using the mapping described by
15736 desc. The current setting of the LC_CTYPE category shall be the same as during the call
15737 to wctrans that returned the value desc.
15738 3 Each of the following expressions behaves the same as the call to the wide character case
15739 mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
15740 towctrans(wc, wctrans("tolower")) // towlower(wc)
15741 towctrans(wc, wctrans("toupper")) // towupper(wc)
15742 Returns
15743 4 The towctrans function returns the mapped value of wc using the mapping described
15744 by desc.
15745 <a name="7.25.3.2.2" href="#7.25.3.2.2"><b> 7.25.3.2.2 The wctrans function</b></a>
15746 Synopsis
15747 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15748 wctrans_t wctrans(const char *property);
15749 Description
15750 2 The wctrans function constructs a value with type wctrans_t that describes a
15751 mapping between wide characters identified by the string argument property.
15752 3 The strings listed in the description of the towctrans function shall be valid in all
15753 locales as property arguments to the wctrans function.
15754 Returns
15755 4 If property identifies a valid mapping of wide characters according to the LC_CTYPE
15756 category of the current locale, the wctrans function returns a nonzero value that is valid
15757 as the second argument to the towctrans function; otherwise, it returns zero.
15762 [<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
15764 <a name="7.26" href="#7.26"><b> 7.26 Future library directions</b></a>
15765 1 The following names are grouped under individual headers for convenience. All external
15766 names described below are reserved no matter what headers are included by the program.
15767 <a name="7.26.1" href="#7.26.1"><b> 7.26.1 Complex arithmetic &lt;complex.h&gt;</b></a>
15768 1 The function names
15769 cerf cexpm1 clog2
15770 cerfc clog10 clgamma
15771 cexp2 clog1p ctgamma
15772 and the same names suffixed with f or l may be added to the declarations in the
15773 <a href="#7.3">&lt;complex.h&gt;</a> header.
15774 <a name="7.26.2" href="#7.26.2"><b> 7.26.2 Character handling &lt;ctype.h&gt;</b></a>
15775 1 Function names that begin with either is or to, and a lowercase letter may be added to
15776 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
15777 <a name="7.26.3" href="#7.26.3"><b> 7.26.3 Errors &lt;errno.h&gt;</b></a>
15778 1 Macros that begin with E and a digit or E and an uppercase letter may be added to the
15779 declarations in the <a href="#7.5">&lt;errno.h&gt;</a> header.
15780 <a name="7.26.4" href="#7.26.4"><b> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
15781 1 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
15782 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
15783 <a name="7.26.5" href="#7.26.5"><b> 7.26.5 Localization &lt;locale.h&gt;</b></a>
15784 1 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
15785 the <a href="#7.11">&lt;locale.h&gt;</a> header.
15786 <a name="7.26.6" href="#7.26.6"><b> 7.26.6 Signal handling &lt;signal.h&gt;</b></a>
15787 1 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
15788 letter may be added to the definitions in the <a href="#7.14">&lt;signal.h&gt;</a> header.
15789 <a name="7.26.7" href="#7.26.7"><b> 7.26.7 Boolean type and values &lt;stdbool.h&gt;</b></a>
15790 1 The ability to undefine and perhaps then redefine the macros bool, true, and false is
15791 an obsolescent feature.
15792 <a name="7.26.8" href="#7.26.8"><b> 7.26.8 Integer types &lt;stdint.h&gt;</b></a>
15793 1 Typedef names beginning with int or uint and ending with _t may be added to the
15794 types defined in the <a href="#7.18">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
15795 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
15796 <a href="#7.18">&lt;stdint.h&gt;</a> header.
15797 [<a name="p401" href="#p401">page 401</a>] (<a href="#Contents">Contents</a>)
15799 <a name="7.26.9" href="#7.26.9"><b> 7.26.9 Input/output &lt;stdio.h&gt;</b></a>
15800 1 Lowercase letters may be added to the conversion specifiers and length modifiers in
15801 fprintf and fscanf. Other characters may be used in extensions.
15802 2 The gets function is obsolescent, and is deprecated.
15803 3 The use of ungetc on a binary stream where the file position indicator is zero prior to
15804 the call is an obsolescent feature.
15805 <a name="7.26.10" href="#7.26.10"><b> 7.26.10 General utilities &lt;stdlib.h&gt;</b></a>
15806 1 Function names that begin with str and a lowercase letter may be added to the
15807 declarations in the <a href="#7.20">&lt;stdlib.h&gt;</a> header.
15808 <a name="7.26.11" href="#7.26.11"><b> 7.26.11 String handling &lt;string.h&gt;</b></a>
15809 1 Function names that begin with str, mem, or wcs and a lowercase letter may be added
15810 to the declarations in the <a href="#7.21">&lt;string.h&gt;</a> header.
15811 <a name="7.26.12" href="#7.26.12"><b> 7.26.12 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
15812 1 Function names that begin with wcs and a lowercase letter may be added to the
15813 declarations in the <a href="#7.24">&lt;wchar.h&gt;</a> header.
15814 2 Lowercase letters may be added to the conversion specifiers and length modifiers in
15815 fwprintf and fwscanf. Other characters may be used in extensions.
15816 <a name="7.26.13" href="#7.26.13"><b> 7.26.13 Wide character classification and mapping utilities</b></a>
15817 <a href="#7.25">&lt;wctype.h&gt;</a>
15818 1 Function names that begin with is or to and a lowercase letter may be added to the
15819 declarations in the <a href="#7.25">&lt;wctype.h&gt;</a> header.
15824 [<a name="p402" href="#p402">page 402</a>] (<a href="#Contents">Contents</a>)
15826 <a name="A" href="#A"><b> Annex A</b></a>
15827 (informative)
15828 Language syntax summary
15829 1 NOTE The notation is described in <a href="#6.1">6.1</a>.
15831 <a name="A.1" href="#A.1"><b> A.1 Lexical grammar</b></a>
15832 <a name="A.1.1" href="#A.1.1"><b> A.1.1 Lexical elements</b></a>
15833 (<a href="#6.4">6.4</a>) token:
15834 keyword
15835 identifier
15836 constant
15837 string-literal
15838 punctuator
15839 (<a href="#6.4">6.4</a>) preprocessing-token:
15840 header-name
15841 identifier
15842 pp-number
15843 character-constant
15844 string-literal
15845 punctuator
15846 each non-white-space character that cannot be one of the above
15847 <a name="A.1.2" href="#A.1.2"><b> A.1.2 Keywords</b></a>
15848 (<a href="#6.4.1">6.4.1</a>) keyword: one of
15849 auto enum restrict unsigned
15850 break extern return void
15851 case float short volatile
15852 char for signed while
15853 const goto sizeof _Bool
15854 continue if static _Complex
15855 default inline struct _Imaginary
15856 do int switch
15857 double long typedef
15858 else register union
15863 [<a name="p403" href="#p403">page 403</a>] (<a href="#Contents">Contents</a>)
15865 <a name="A.1.3" href="#A.1.3"><b>A.1.3 Identifiers</b></a>
15866 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
15867 identifier-nondigit
15868 identifier identifier-nondigit
15869 identifier digit
15870 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
15871 nondigit
15872 universal-character-name
15873 other implementation-defined characters
15874 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
15875 _ a b c d e f g h i j k l m
15876 n o p q r s t u v w x y z
15877 A B C D E F G H I J K L M
15878 N O P Q R S T U V W X Y Z
15879 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
15880 0 1 2 3 4 5 6 7 8 9
15881 <a name="A.1.4" href="#A.1.4"><b>A.1.4 Universal character names</b></a>
15882 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
15883 \u hex-quad
15884 \U hex-quad hex-quad
15885 (<a href="#6.4.3">6.4.3</a>) hex-quad:
15886 hexadecimal-digit hexadecimal-digit
15887 hexadecimal-digit hexadecimal-digit
15888 <a name="A.1.5" href="#A.1.5"><b>A.1.5 Constants</b></a>
15889 (<a href="#6.4.4">6.4.4</a>) constant:
15890 integer-constant
15891 floating-constant
15892 enumeration-constant
15893 character-constant
15894 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
15895 decimal-constant integer-suffixopt
15896 octal-constant integer-suffixopt
15897 hexadecimal-constant integer-suffixopt
15898 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
15899 nonzero-digit
15900 decimal-constant digit
15901 [<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
15903 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
15905 octal-constant octal-digit
15906 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
15907 hexadecimal-prefix hexadecimal-digit
15908 hexadecimal-constant hexadecimal-digit
15909 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
15910 0x 0X
15911 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
15912 1 2 3 4 5 6 7 8 9
15913 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
15914 0 1 2 3 4 5 6 7
15915 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
15916 0 1 2 3 4 5 6 7 8 9
15917 a b c d e f
15918 A B C D E F
15919 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
15920 unsigned-suffix long-suffixopt
15921 unsigned-suffix long-long-suffix
15922 long-suffix unsigned-suffixopt
15923 long-long-suffix unsigned-suffixopt
15924 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
15926 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
15928 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
15929 ll LL
15930 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
15931 decimal-floating-constant
15932 hexadecimal-floating-constant
15933 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
15934 fractional-constant exponent-partopt floating-suffixopt
15935 digit-sequence exponent-part floating-suffixopt
15940 [<a name="p405" href="#p405">page 405</a>] (<a href="#Contents">Contents</a>)
15942 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
15943 hexadecimal-prefix hexadecimal-fractional-constant
15944 binary-exponent-part floating-suffixopt
15945 hexadecimal-prefix hexadecimal-digit-sequence
15946 binary-exponent-part floating-suffixopt
15947 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
15948 digit-sequenceopt . digit-sequence
15949 digit-sequence .
15950 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
15951 e signopt digit-sequence
15952 E signopt digit-sequence
15953 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
15955 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
15956 digit
15957 digit-sequence digit
15958 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
15959 hexadecimal-digit-sequenceopt .
15960 hexadecimal-digit-sequence
15961 hexadecimal-digit-sequence .
15962 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
15963 p signopt digit-sequence
15964 P signopt digit-sequence
15965 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
15966 hexadecimal-digit
15967 hexadecimal-digit-sequence hexadecimal-digit
15968 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
15969 f l F L
15970 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
15971 identifier
15972 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
15973 ' c-char-sequence '
15974 L' c-char-sequence '
15979 [<a name="p406" href="#p406">page 406</a>] (<a href="#Contents">Contents</a>)
15981 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
15982 c-char
15983 c-char-sequence c-char
15984 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
15985 any member of the source character set except
15986 the single-quote ', backslash \, or new-line character
15987 escape-sequence
15988 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
15989 simple-escape-sequence
15990 octal-escape-sequence
15991 hexadecimal-escape-sequence
15992 universal-character-name
15993 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
15994 \' \" \? \\
15995 \a \b \f \n \r \t \v
15996 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
15997 \ octal-digit
15998 \ octal-digit octal-digit
15999 \ octal-digit octal-digit octal-digit
16000 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
16001 \x hexadecimal-digit
16002 hexadecimal-escape-sequence hexadecimal-digit
16003 <a name="A.1.6" href="#A.1.6"><b>A.1.6 String literals</b></a>
16004 (<a href="#6.4.5">6.4.5</a>) string-literal:
16005 " s-char-sequenceopt "
16006 L" s-char-sequenceopt "
16007 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
16008 s-char
16009 s-char-sequence s-char
16010 (<a href="#6.4.5">6.4.5</a>) s-char:
16011 any member of the source character set except
16012 the double-quote ", backslash \, or new-line character
16013 escape-sequence
16018 [<a name="p407" href="#p407">page 407</a>] (<a href="#Contents">Contents</a>)
16020 <a name="A.1.7" href="#A.1.7"><b>A.1.7 Punctuators</b></a>
16021 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
16022 [ ] ( ) { } . -&gt;
16023 ++ -- &amp; * + - ~ !
16024 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
16025 ? : ; ...
16026 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
16027 , # ##
16028 &lt;: :&gt; &lt;% %&gt; %: %:%:
16029 <a name="A.1.8" href="#A.1.8"><b>A.1.8 Header names</b></a>
16030 (<a href="#6.4.7">6.4.7</a>) header-name:
16031 &lt; h-char-sequence &gt;
16032 " q-char-sequence "
16033 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
16034 h-char
16035 h-char-sequence h-char
16036 (<a href="#6.4.7">6.4.7</a>) h-char:
16037 any member of the source character set except
16038 the new-line character and &gt;
16039 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
16040 q-char
16041 q-char-sequence q-char
16042 (<a href="#6.4.7">6.4.7</a>) q-char:
16043 any member of the source character set except
16044 the new-line character and "
16045 <a name="A.1.9" href="#A.1.9"><b>A.1.9 Preprocessing numbers</b></a>
16046 (<a href="#6.4.8">6.4.8</a>) pp-number:
16047 digit
16048 . digit
16049 pp-number digit
16050 pp-number identifier-nondigit
16051 pp-number e sign
16052 pp-number E sign
16053 pp-number p sign
16054 pp-number P sign
16055 pp-number .
16058 [<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
16060 <a name="A.2" href="#A.2"><b>A.2 Phrase structure grammar</b></a>
16061 <a name="A.2.1" href="#A.2.1"><b>A.2.1 Expressions</b></a>
16062 (<a href="#6.5.1">6.5.1</a>) primary-expression:
16063 identifier
16064 constant
16065 string-literal
16066 ( expression )
16067 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
16068 primary-expression
16069 postfix-expression [ expression ]
16070 postfix-expression ( argument-expression-listopt )
16071 postfix-expression . identifier
16072 postfix-expression -&gt; identifier
16073 postfix-expression ++
16074 postfix-expression --
16075 ( type-name ) { initializer-list }
16076 ( type-name ) { initializer-list , }
16077 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
16078 assignment-expression
16079 argument-expression-list , assignment-expression
16080 (<a href="#6.5.3">6.5.3</a>) unary-expression:
16081 postfix-expression
16082 ++ unary-expression
16083 -- unary-expression
16084 unary-operator cast-expression
16085 sizeof unary-expression
16086 sizeof ( type-name )
16087 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
16088 &amp; * + - ~ !
16089 (<a href="#6.5.4">6.5.4</a>) cast-expression:
16090 unary-expression
16091 ( type-name ) cast-expression
16092 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
16093 cast-expression
16094 multiplicative-expression * cast-expression
16095 multiplicative-expression / cast-expression
16096 multiplicative-expression % cast-expression
16098 [<a name="p409" href="#p409">page 409</a>] (<a href="#Contents">Contents</a>)
16100 (<a href="#6.5.6">6.5.6</a>) additive-expression:
16101 multiplicative-expression
16102 additive-expression + multiplicative-expression
16103 additive-expression - multiplicative-expression
16104 (<a href="#6.5.7">6.5.7</a>) shift-expression:
16105 additive-expression
16106 shift-expression &lt;&lt; additive-expression
16107 shift-expression &gt;&gt; additive-expression
16108 (<a href="#6.5.8">6.5.8</a>) relational-expression:
16109 shift-expression
16110 relational-expression &lt; shift-expression
16111 relational-expression &gt; shift-expression
16112 relational-expression &lt;= shift-expression
16113 relational-expression &gt;= shift-expression
16114 (<a href="#6.5.9">6.5.9</a>) equality-expression:
16115 relational-expression
16116 equality-expression == relational-expression
16117 equality-expression != relational-expression
16118 (<a href="#6.5.10">6.5.10</a>) AND-expression:
16119 equality-expression
16120 AND-expression &amp; equality-expression
16121 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
16122 AND-expression
16123 exclusive-OR-expression ^ AND-expression
16124 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
16125 exclusive-OR-expression
16126 inclusive-OR-expression | exclusive-OR-expression
16127 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
16128 inclusive-OR-expression
16129 logical-AND-expression &amp;&amp; inclusive-OR-expression
16130 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
16131 logical-AND-expression
16132 logical-OR-expression || logical-AND-expression
16133 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
16134 logical-OR-expression
16135 logical-OR-expression ? expression : conditional-expression
16137 [<a name="p410" href="#p410">page 410</a>] (<a href="#Contents">Contents</a>)
16139 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
16140 conditional-expression
16141 unary-expression assignment-operator assignment-expression
16142 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
16143 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
16144 (<a href="#6.5.17">6.5.17</a>) expression:
16145 assignment-expression
16146 expression , assignment-expression
16147 (<a href="#6.6">6.6</a>) constant-expression:
16148 conditional-expression
16149 <a name="A.2.2" href="#A.2.2"><b>A.2.2 Declarations</b></a>
16150 (<a href="#6.7">6.7</a>) declaration:
16151 declaration-specifiers init-declarator-listopt ;
16152 (<a href="#6.7">6.7</a>) declaration-specifiers:
16153 storage-class-specifier declaration-specifiersopt
16154 type-specifier declaration-specifiersopt
16155 type-qualifier declaration-specifiersopt
16156 function-specifier declaration-specifiersopt
16157 (<a href="#6.7">6.7</a>) init-declarator-list:
16158 init-declarator
16159 init-declarator-list , init-declarator
16160 (<a href="#6.7">6.7</a>) init-declarator:
16161 declarator
16162 declarator = initializer
16163 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
16164 typedef
16165 extern
16166 static
16167 auto
16168 register
16173 [<a name="p411" href="#p411">page 411</a>] (<a href="#Contents">Contents</a>)
16175 (<a href="#6.7.2">6.7.2</a>) type-specifier:
16176 void
16177 char
16178 short
16180 long
16181 float
16182 double
16183 signed
16184 unsigned
16185 _Bool
16186 _Complex
16187 struct-or-union-specifier *
16188 enum-specifier
16189 typedef-name
16190 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
16191 struct-or-union identifieropt { struct-declaration-list }
16192 struct-or-union identifier
16193 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
16194 struct
16195 union
16196 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
16197 struct-declaration
16198 struct-declaration-list struct-declaration
16199 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
16200 specifier-qualifier-list struct-declarator-list ;
16201 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
16202 type-specifier specifier-qualifier-listopt
16203 type-qualifier specifier-qualifier-listopt
16204 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
16205 struct-declarator
16206 struct-declarator-list , struct-declarator
16207 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
16208 declarator
16209 declaratoropt : constant-expression
16214 [<a name="p412" href="#p412">page 412</a>] (<a href="#Contents">Contents</a>)
16216 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
16217 enum identifieropt { enumerator-list }
16218 enum identifieropt { enumerator-list , }
16219 enum identifier
16220 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
16221 enumerator
16222 enumerator-list , enumerator
16223 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
16224 enumeration-constant
16225 enumeration-constant = constant-expression
16226 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
16227 const
16228 restrict
16229 volatile
16230 (<a href="#6.7.4">6.7.4</a>) function-specifier:
16231 inline
16232 (<a href="#6.7.5">6.7.5</a>) declarator:
16233 pointeropt direct-declarator
16234 (<a href="#6.7.5">6.7.5</a>) direct-declarator:
16235 identifier
16236 ( declarator )
16237 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
16238 direct-declarator [ static type-qualifier-listopt assignment-expression ]
16239 direct-declarator [ type-qualifier-list static assignment-expression ]
16240 direct-declarator [ type-qualifier-listopt * ]
16241 direct-declarator ( parameter-type-list )
16242 direct-declarator ( identifier-listopt )
16243 (<a href="#6.7.5">6.7.5</a>) pointer:
16244 * type-qualifier-listopt
16245 * type-qualifier-listopt pointer
16246 (<a href="#6.7.5">6.7.5</a>) type-qualifier-list:
16247 type-qualifier
16248 type-qualifier-list type-qualifier
16249 (<a href="#6.7.5">6.7.5</a>) parameter-type-list:
16250 parameter-list
16251 parameter-list , ...
16253 [<a name="p413" href="#p413">page 413</a>] (<a href="#Contents">Contents</a>)
16255 (<a href="#6.7.5">6.7.5</a>) parameter-list:
16256 parameter-declaration
16257 parameter-list , parameter-declaration
16258 (<a href="#6.7.5">6.7.5</a>) parameter-declaration:
16259 declaration-specifiers declarator
16260 declaration-specifiers abstract-declaratoropt
16261 (<a href="#6.7.5">6.7.5</a>) identifier-list:
16262 identifier
16263 identifier-list , identifier
16264 (<a href="#6.7.6">6.7.6</a>) type-name:
16265 specifier-qualifier-list abstract-declaratoropt
16266 (<a href="#6.7.6">6.7.6</a>) abstract-declarator:
16267 pointer
16268 pointeropt direct-abstract-declarator
16269 (<a href="#6.7.6">6.7.6</a>) direct-abstract-declarator:
16270 ( abstract-declarator )
16271 direct-abstract-declaratoropt [ type-qualifier-listopt
16272 assignment-expressionopt ]
16273 direct-abstract-declaratoropt [ static type-qualifier-listopt
16274 assignment-expression ]
16275 direct-abstract-declaratoropt [ type-qualifier-list static
16276 assignment-expression ]
16277 direct-abstract-declaratoropt [ * ]
16278 direct-abstract-declaratoropt ( parameter-type-listopt )
16279 (<a href="#6.7.7">6.7.7</a>) typedef-name:
16280 identifier
16281 (<a href="#6.7.8">6.7.8</a>) initializer:
16282 assignment-expression
16283 { initializer-list }
16284 { initializer-list , }
16285 (<a href="#6.7.8">6.7.8</a>) initializer-list:
16286 designationopt initializer
16287 initializer-list , designationopt initializer
16288 (<a href="#6.7.8">6.7.8</a>) designation:
16289 designator-list =
16293 [<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
16295 (<a href="#6.7.8">6.7.8</a>) designator-list:
16296 designator
16297 designator-list designator
16298 (<a href="#6.7.8">6.7.8</a>) designator:
16299 [ constant-expression ]
16300 . identifier
16301 <a name="A.2.3" href="#A.2.3"><b>A.2.3 Statements</b></a>
16302 (<a href="#6.8">6.8</a>) statement:
16303 labeled-statement
16304 compound-statement
16305 expression-statement
16306 selection-statement
16307 iteration-statement
16308 jump-statement
16309 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
16310 identifier : statement
16311 case constant-expression : statement
16312 default : statement
16313 (<a href="#6.8.2">6.8.2</a>) compound-statement:
16314 { block-item-listopt }
16315 (<a href="#6.8.2">6.8.2</a>) block-item-list:
16316 block-item
16317 block-item-list block-item
16318 (<a href="#6.8.2">6.8.2</a>) block-item:
16319 declaration
16320 statement
16321 (<a href="#6.8.3">6.8.3</a>) expression-statement:
16322 expressionopt ;
16323 (<a href="#6.8.4">6.8.4</a>) selection-statement:
16324 if ( expression ) statement
16325 if ( expression ) statement else statement
16326 switch ( expression ) statement
16331 [<a name="p415" href="#p415">page 415</a>] (<a href="#Contents">Contents</a>)
16333 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
16334 while ( expression ) statement
16335 do statement while ( expression ) ;
16336 for ( expressionopt ; expressionopt ; expressionopt ) statement
16337 for ( declaration expressionopt ; expressionopt ) statement
16338 (<a href="#6.8.6">6.8.6</a>) jump-statement:
16339 goto identifier ;
16340 continue ;
16341 break ;
16342 return expressionopt ;
16343 <a name="A.2.4" href="#A.2.4"><b>A.2.4 External definitions</b></a>
16344 (<a href="#6.9">6.9</a>) translation-unit:
16345 external-declaration
16346 translation-unit external-declaration
16347 (<a href="#6.9">6.9</a>) external-declaration:
16348 function-definition
16349 declaration
16350 (<a href="#6.9.1">6.9.1</a>) function-definition:
16351 declaration-specifiers declarator declaration-listopt compound-statement
16352 (<a href="#6.9.1">6.9.1</a>) declaration-list:
16353 declaration
16354 declaration-list declaration
16355 <a name="A.3" href="#A.3"><b>A.3 Preprocessing directives</b></a>
16356 (<a href="#6.10">6.10</a>) preprocessing-file:
16357 groupopt
16358 (<a href="#6.10">6.10</a>) group:
16359 group-part
16360 group group-part
16361 (<a href="#6.10">6.10</a>) group-part:
16362 if-section
16363 control-line
16364 text-line
16365 # non-directive
16366 (<a href="#6.10">6.10</a>) if-section:
16367 if-group elif-groupsopt else-groupopt endif-line
16370 [<a name="p416" href="#p416">page 416</a>] (<a href="#Contents">Contents</a>)
16372 (<a href="#6.10">6.10</a>) if-group:
16373 # if constant-expression new-line groupopt
16374 # ifdef identifier new-line groupopt
16375 # ifndef identifier new-line groupopt
16376 (<a href="#6.10">6.10</a>) elif-groups:
16377 elif-group
16378 elif-groups elif-group
16379 (<a href="#6.10">6.10</a>) elif-group:
16380 # elif constant-expression new-line groupopt
16381 (<a href="#6.10">6.10</a>) else-group:
16382 # else new-line groupopt
16383 (<a href="#6.10">6.10</a>) endif-line:
16384 # endif new-line
16385 (<a href="#6.10">6.10</a>) control-line:
16386 # include pp-tokens new-line
16387 # define identifier replacement-list new-line
16388 # define identifier lparen identifier-listopt )
16389 replacement-list new-line
16390 # define identifier lparen ... ) replacement-list new-line
16391 # define identifier lparen identifier-list , ... )
16392 replacement-list new-line
16393 # undef identifier new-line
16394 # line pp-tokens new-line
16395 # error pp-tokensopt new-line
16396 # pragma pp-tokensopt new-line
16397 # new-line
16398 (<a href="#6.10">6.10</a>) text-line:
16399 pp-tokensopt new-line
16400 (<a href="#6.10">6.10</a>) non-directive:
16401 pp-tokens new-line
16402 (<a href="#6.10">6.10</a>) lparen:
16403 a ( character not immediately preceded by white-space
16404 (<a href="#6.10">6.10</a>) replacement-list:
16405 pp-tokensopt
16410 [<a name="p417" href="#p417">page 417</a>] (<a href="#Contents">Contents</a>)
16412 (<a href="#6.10">6.10</a>) pp-tokens:
16413 preprocessing-token
16414 pp-tokens preprocessing-token
16415 (<a href="#6.10">6.10</a>) new-line:
16416 the new-line character
16421 [<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
16423 <a name="B" href="#B"><b> Annex B</b></a>
16424 (informative)
16425 Library summary
16426 <a name="B.1" href="#B.1"><b>B.1 Diagnostics &lt;assert.h&gt;</b></a>
16427 NDEBUG
16428 void assert(scalar expression);
16429 <a name="B.2" href="#B.2"><b>B.2 Complex &lt;complex.h&gt;</b></a>
16430 complex imaginary I
16431 _Complex_I _Imaginary_I
16432 #pragma STDC CX_LIMITED_RANGE on-off-switch
16433 double complex cacos(double complex z);
16434 float complex cacosf(float complex z);
16435 long double complex cacosl(long double complex z);
16436 double complex casin(double complex z);
16437 float complex casinf(float complex z);
16438 long double complex casinl(long double complex z);
16439 double complex catan(double complex z);
16440 float complex catanf(float complex z);
16441 long double complex catanl(long double complex z);
16442 double complex ccos(double complex z);
16443 float complex ccosf(float complex z);
16444 long double complex ccosl(long double complex z);
16445 double complex csin(double complex z);
16446 float complex csinf(float complex z);
16447 long double complex csinl(long double complex z);
16448 double complex ctan(double complex z);
16449 float complex ctanf(float complex z);
16450 long double complex ctanl(long double complex z);
16451 double complex cacosh(double complex z);
16452 float complex cacoshf(float complex z);
16453 long double complex cacoshl(long double complex z);
16454 double complex casinh(double complex z);
16455 float complex casinhf(float complex z);
16456 long double complex casinhl(long double complex z);
16457 double complex catanh(double complex z);
16458 float complex catanhf(float complex z);
16459 long double complex catanhl(long double complex z);
16460 [<a name="p419" href="#p419">page 419</a>] (<a href="#Contents">Contents</a>)
16462 double complex ccosh(double complex z);
16463 float complex ccoshf(float complex z);
16464 long double complex ccoshl(long double complex z);
16465 double complex csinh(double complex z);
16466 float complex csinhf(float complex z);
16467 long double complex csinhl(long double complex z);
16468 double complex ctanh(double complex z);
16469 float complex ctanhf(float complex z);
16470 long double complex ctanhl(long double complex z);
16471 double complex cexp(double complex z);
16472 float complex cexpf(float complex z);
16473 long double complex cexpl(long double complex z);
16474 double complex clog(double complex z);
16475 float complex clogf(float complex z);
16476 long double complex clogl(long double complex z);
16477 double cabs(double complex z);
16478 float cabsf(float complex z);
16479 long double cabsl(long double complex z);
16480 double complex cpow(double complex x, double complex y);
16481 float complex cpowf(float complex x, float complex y);
16482 long double complex cpowl(long double complex x,
16483 long double complex y);
16484 double complex csqrt(double complex z);
16485 float complex csqrtf(float complex z);
16486 long double complex csqrtl(long double complex z);
16487 double carg(double complex z);
16488 float cargf(float complex z);
16489 long double cargl(long double complex z);
16490 double cimag(double complex z);
16491 float cimagf(float complex z);
16492 long double cimagl(long double complex z);
16493 double complex conj(double complex z);
16494 float complex conjf(float complex z);
16495 long double complex conjl(long double complex z);
16496 double complex cproj(double complex z);
16497 float complex cprojf(float complex z);
16498 long double complex cprojl(long double complex z);
16499 double creal(double complex z);
16500 float crealf(float complex z);
16501 long double creall(long double complex z);
16504 [<a name="p420" href="#p420">page 420</a>] (<a href="#Contents">Contents</a>)
16506 <a name="B.3" href="#B.3"><b>B.3 Character handling &lt;ctype.h&gt;</b></a>
16507 int isalnum(int c);
16508 int isalpha(int c);
16509 int isblank(int c);
16510 int iscntrl(int c);
16511 int isdigit(int c);
16512 int isgraph(int c);
16513 int islower(int c);
16514 int isprint(int c);
16515 int ispunct(int c);
16516 int isspace(int c);
16517 int isupper(int c);
16518 int isxdigit(int c);
16519 int tolower(int c);
16520 int toupper(int c);
16521 <a name="B.4" href="#B.4"><b>B.4 Errors &lt;errno.h&gt;</b></a>
16522 EDOM EILSEQ ERANGE errno
16523 <a name="B.5" href="#B.5"><b>B.5 Floating-point environment &lt;fenv.h&gt;</b></a>
16524 fenv_t FE_OVERFLOW FE_TOWARDZERO
16525 fexcept_t FE_UNDERFLOW FE_UPWARD
16526 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
16527 FE_INEXACT FE_DOWNWARD
16528 FE_INVALID FE_TONEAREST
16529 #pragma STDC FENV_ACCESS on-off-switch
16530 int feclearexcept(int excepts);
16531 int fegetexceptflag(fexcept_t *flagp, int excepts);
16532 int feraiseexcept(int excepts);
16533 int fesetexceptflag(const fexcept_t *flagp,
16534 int excepts);
16535 int fetestexcept(int excepts);
16536 int fegetround(void);
16537 int fesetround(int round);
16538 int fegetenv(fenv_t *envp);
16539 int feholdexcept(fenv_t *envp);
16540 int fesetenv(const fenv_t *envp);
16541 int feupdateenv(const fenv_t *envp);
16545 [<a name="p421" href="#p421">page 421</a>] (<a href="#Contents">Contents</a>)
16547 <a name="B.6" href="#B.6"><b>B.6 Characteristics of floating types &lt;float.h&gt;</b></a>
16548 FLT_ROUNDS DBL_MIN_EXP FLT_MAX
16549 FLT_EVAL_METHOD LDBL_MIN_EXP DBL_MAX
16550 FLT_RADIX FLT_MIN_10_EXP LDBL_MAX
16551 FLT_MANT_DIG DBL_MIN_10_EXP FLT_EPSILON
16552 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_EPSILON
16553 LDBL_MANT_DIG FLT_MAX_EXP LDBL_EPSILON
16554 DECIMAL_DIG DBL_MAX_EXP FLT_MIN
16555 FLT_DIG LDBL_MAX_EXP DBL_MIN
16556 DBL_DIG FLT_MAX_10_EXP LDBL_MIN
16557 LDBL_DIG DBL_MAX_10_EXP
16558 FLT_MIN_EXP LDBL_MAX_10_EXP
16559 <a name="B.7" href="#B.7"><b>B.7 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
16560 imaxdiv_t
16561 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
16562 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
16563 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
16564 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
16565 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
16566 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
16567 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
16568 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
16569 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
16570 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
16571 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
16572 intmax_t imaxabs(intmax_t j);
16573 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
16574 intmax_t strtoimax(const char * restrict nptr,
16575 char ** restrict endptr, int base);
16576 uintmax_t strtoumax(const char * restrict nptr,
16577 char ** restrict endptr, int base);
16578 intmax_t wcstoimax(const wchar_t * restrict nptr,
16579 wchar_t ** restrict endptr, int base);
16580 uintmax_t wcstoumax(const wchar_t * restrict nptr,
16581 wchar_t ** restrict endptr, int base);
16586 [<a name="p422" href="#p422">page 422</a>] (<a href="#Contents">Contents</a>)
16588 <a name="B.8" href="#B.8"><b>B.8 Alternative spellings &lt;iso646.h&gt;</b></a>
16589 and bitor not_eq xor
16590 and_eq compl or xor_eq
16591 bitand not or_eq
16592 <a name="B.9" href="#B.9"><b>B.9 Sizes of integer types &lt;limits.h&gt;</b></a>
16593 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
16594 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
16595 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
16596 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
16597 CHAR_MIN USHRT_MAX LONG_MAX
16598 <a name="B.10" href="#B.10"><b>B.10 Localization &lt;locale.h&gt;</b></a>
16599 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
16600 NULL LC_COLLATE LC_MONETARY LC_TIME
16601 char *setlocale(int category, const char *locale);
16602 struct lconv *localeconv(void);
16603 <a name="B.11" href="#B.11"><b>B.11 Mathematics &lt;math.h&gt;</b></a>
16604 float_t FP_INFINITE FP_FAST_FMAL
16605 double_t FP_NAN FP_ILOGB0
16606 HUGE_VAL FP_NORMAL FP_ILOGBNAN
16607 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
16608 HUGE_VALL FP_ZERO MATH_ERREXCEPT
16609 INFINITY FP_FAST_FMA math_errhandling
16610 NAN FP_FAST_FMAF
16611 #pragma STDC FP_CONTRACT on-off-switch
16612 int fpclassify(real-floating x);
16613 int isfinite(real-floating x);
16614 int isinf(real-floating x);
16615 int isnan(real-floating x);
16616 int isnormal(real-floating x);
16617 int signbit(real-floating x);
16618 double acos(double x);
16619 float acosf(float x);
16620 long double acosl(long double x);
16621 double asin(double x);
16622 float asinf(float x);
16623 long double asinl(long double x);
16624 double atan(double x);
16625 [<a name="p423" href="#p423">page 423</a>] (<a href="#Contents">Contents</a>)
16627 float atanf(float x);
16628 long double atanl(long double x);
16629 double atan2(double y, double x);
16630 float atan2f(float y, float x);
16631 long double atan2l(long double y, long double x);
16632 double cos(double x);
16633 float cosf(float x);
16634 long double cosl(long double x);
16635 double sin(double x);
16636 float sinf(float x);
16637 long double sinl(long double x);
16638 double tan(double x);
16639 float tanf(float x);
16640 long double tanl(long double x);
16641 double acosh(double x);
16642 float acoshf(float x);
16643 long double acoshl(long double x);
16644 double asinh(double x);
16645 float asinhf(float x);
16646 long double asinhl(long double x);
16647 double atanh(double x);
16648 float atanhf(float x);
16649 long double atanhl(long double x);
16650 double cosh(double x);
16651 float coshf(float x);
16652 long double coshl(long double x);
16653 double sinh(double x);
16654 float sinhf(float x);
16655 long double sinhl(long double x);
16656 double tanh(double x);
16657 float tanhf(float x);
16658 long double tanhl(long double x);
16659 double exp(double x);
16660 float expf(float x);
16661 long double expl(long double x);
16662 double exp2(double x);
16663 float exp2f(float x);
16664 long double exp2l(long double x);
16665 double expm1(double x);
16666 float expm1f(float x);
16667 long double expm1l(long double x);
16669 [<a name="p424" href="#p424">page 424</a>] (<a href="#Contents">Contents</a>)
16671 double frexp(double value, int *exp);
16672 float frexpf(float value, int *exp);
16673 long double frexpl(long double value, int *exp);
16674 int ilogb(double x);
16675 int ilogbf(float x);
16676 int ilogbl(long double x);
16677 double ldexp(double x, int exp);
16678 float ldexpf(float x, int exp);
16679 long double ldexpl(long double x, int exp);
16680 double log(double x);
16681 float logf(float x);
16682 long double logl(long double x);
16683 double log10(double x);
16684 float log10f(float x);
16685 long double log10l(long double x);
16686 double log1p(double x);
16687 float log1pf(float x);
16688 long double log1pl(long double x);
16689 double log2(double x);
16690 float log2f(float x);
16691 long double log2l(long double x);
16692 double logb(double x);
16693 float logbf(float x);
16694 long double logbl(long double x);
16695 double modf(double value, double *iptr);
16696 float modff(float value, float *iptr);
16697 long double modfl(long double value, long double *iptr);
16698 double scalbn(double x, int n);
16699 float scalbnf(float x, int n);
16700 long double scalbnl(long double x, int n);
16701 double scalbln(double x, long int n);
16702 float scalblnf(float x, long int n);
16703 long double scalblnl(long double x, long int n);
16704 double cbrt(double x);
16705 float cbrtf(float x);
16706 long double cbrtl(long double x);
16707 double fabs(double x);
16708 float fabsf(float x);
16709 long double fabsl(long double x);
16710 double hypot(double x, double y);
16711 float hypotf(float x, float y);
16713 [<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
16715 long double hypotl(long double x, long double y);
16716 double pow(double x, double y);
16717 float powf(float x, float y);
16718 long double powl(long double x, long double y);
16719 double sqrt(double x);
16720 float sqrtf(float x);
16721 long double sqrtl(long double x);
16722 double erf(double x);
16723 float erff(float x);
16724 long double erfl(long double x);
16725 double erfc(double x);
16726 float erfcf(float x);
16727 long double erfcl(long double x);
16728 double lgamma(double x);
16729 float lgammaf(float x);
16730 long double lgammal(long double x);
16731 double tgamma(double x);
16732 float tgammaf(float x);
16733 long double tgammal(long double x);
16734 double ceil(double x);
16735 float ceilf(float x);
16736 long double ceill(long double x);
16737 double floor(double x);
16738 float floorf(float x);
16739 long double floorl(long double x);
16740 double nearbyint(double x);
16741 float nearbyintf(float x);
16742 long double nearbyintl(long double x);
16743 double rint(double x);
16744 float rintf(float x);
16745 long double rintl(long double x);
16746 long int lrint(double x);
16747 long int lrintf(float x);
16748 long int lrintl(long double x);
16749 long long int llrint(double x);
16750 long long int llrintf(float x);
16751 long long int llrintl(long double x);
16752 double round(double x);
16753 float roundf(float x);
16754 long double roundl(long double x);
16755 long int lround(double x);
16757 [<a name="p426" href="#p426">page 426</a>] (<a href="#Contents">Contents</a>)
16759 long int lroundf(float x);
16760 long int lroundl(long double x);
16761 long long int llround(double x);
16762 long long int llroundf(float x);
16763 long long int llroundl(long double x);
16764 double trunc(double x);
16765 float truncf(float x);
16766 long double truncl(long double x);
16767 double fmod(double x, double y);
16768 float fmodf(float x, float y);
16769 long double fmodl(long double x, long double y);
16770 double remainder(double x, double y);
16771 float remainderf(float x, float y);
16772 long double remainderl(long double x, long double y);
16773 double remquo(double x, double y, int *quo);
16774 float remquof(float x, float y, int *quo);
16775 long double remquol(long double x, long double y,
16776 int *quo);
16777 double copysign(double x, double y);
16778 float copysignf(float x, float y);
16779 long double copysignl(long double x, long double y);
16780 double nan(const char *tagp);
16781 float nanf(const char *tagp);
16782 long double nanl(const char *tagp);
16783 double nextafter(double x, double y);
16784 float nextafterf(float x, float y);
16785 long double nextafterl(long double x, long double y);
16786 double nexttoward(double x, long double y);
16787 float nexttowardf(float x, long double y);
16788 long double nexttowardl(long double x, long double y);
16789 double fdim(double x, double y);
16790 float fdimf(float x, float y);
16791 long double fdiml(long double x, long double y);
16792 double fmax(double x, double y);
16793 float fmaxf(float x, float y);
16794 long double fmaxl(long double x, long double y);
16795 double fmin(double x, double y);
16796 float fminf(float x, float y);
16797 long double fminl(long double x, long double y);
16798 double fma(double x, double y, double z);
16799 float fmaf(float x, float y, float z);
16801 [<a name="p427" href="#p427">page 427</a>] (<a href="#Contents">Contents</a>)
16803 long double fmal(long double x, long double y,
16804 long double z);
16805 int isgreater(real-floating x, real-floating y);
16806 int isgreaterequal(real-floating x, real-floating y);
16807 int isless(real-floating x, real-floating y);
16808 int islessequal(real-floating x, real-floating y);
16809 int islessgreater(real-floating x, real-floating y);
16810 int isunordered(real-floating x, real-floating y);
16811 <a name="B.12" href="#B.12"><b>B.12 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
16812 jmp_buf
16813 int setjmp(jmp_buf env);
16814 void longjmp(jmp_buf env, int val);
16815 <a name="B.13" href="#B.13"><b>B.13 Signal handling &lt;signal.h&gt;</b></a>
16816 sig_atomic_t SIG_IGN SIGILL SIGTERM
16817 SIG_DFL SIGABRT SIGINT
16818 SIG_ERR SIGFPE SIGSEGV
16819 void (*signal(int sig, void (*func)(int)))(int);
16820 int raise(int sig);
16821 <a name="B.14" href="#B.14"><b>B.14 Variable arguments &lt;stdarg.h&gt;</b></a>
16822 va_list
16823 type va_arg(va_list ap, type);
16824 void va_copy(va_list dest, va_list src);
16825 void va_end(va_list ap);
16826 void va_start(va_list ap, parmN);
16827 <a name="B.15" href="#B.15"><b>B.15 Boolean type and values &lt;stdbool.h&gt;</b></a>
16828 bool
16829 true
16830 false
16831 __bool_true_false_are_defined
16836 [<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
16838 <a name="B.16" href="#B.16"><b>B.16 Common definitions &lt;stddef.h&gt;</b></a>
16839 ptrdiff_t size_t wchar_t NULL
16840 offsetof(type, member-designator)
16841 <a name="B.17" href="#B.17"><b>B.17 Integer types &lt;stdint.h&gt;</b></a>
16842 intN_t INT_LEASTN_MIN PTRDIFF_MAX
16843 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
16844 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
16845 uint_leastN_t INT_FASTN_MIN SIZE_MAX
16846 int_fastN_t INT_FASTN_MAX WCHAR_MIN
16847 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
16848 intptr_t INTPTR_MIN WINT_MIN
16849 uintptr_t INTPTR_MAX WINT_MAX
16850 intmax_t UINTPTR_MAX INTN_C(value)
16851 uintmax_t INTMAX_MIN UINTN_C(value)
16852 INTN_MIN INTMAX_MAX INTMAX_C(value)
16853 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
16854 UINTN_MAX PTRDIFF_MIN
16855 <a name="B.18" href="#B.18"><b>B.18 Input/output &lt;stdio.h&gt;</b></a>
16856 size_t _IOLBF FILENAME_MAX TMP_MAX
16857 FILE _IONBF L_tmpnam stderr
16858 fpos_t BUFSIZ SEEK_CUR stdin
16859 NULL EOF SEEK_END stdout
16860 _IOFBF FOPEN_MAX SEEK_SET
16861 int remove(const char *filename);
16862 int rename(const char *old, const char *new);
16863 FILE *tmpfile(void);
16864 char *tmpnam(char *s);
16865 int fclose(FILE *stream);
16866 int fflush(FILE *stream);
16867 FILE *fopen(const char * restrict filename,
16868 const char * restrict mode);
16869 FILE *freopen(const char * restrict filename,
16870 const char * restrict mode,
16871 FILE * restrict stream);
16872 void setbuf(FILE * restrict stream,
16873 char * restrict buf);
16876 [<a name="p429" href="#p429">page 429</a>] (<a href="#Contents">Contents</a>)
16878 int setvbuf(FILE * restrict stream,
16879 char * restrict buf,
16880 int mode, size_t size);
16881 int fprintf(FILE * restrict stream,
16882 const char * restrict format, ...);
16883 int fscanf(FILE * restrict stream,
16884 const char * restrict format, ...);
16885 int printf(const char * restrict format, ...);
16886 int scanf(const char * restrict format, ...);
16887 int snprintf(char * restrict s, size_t n,
16888 const char * restrict format, ...);
16889 int sprintf(char * restrict s,
16890 const char * restrict format, ...);
16891 int sscanf(const char * restrict s,
16892 const char * restrict format, ...);
16893 int vfprintf(FILE * restrict stream,
16894 const char * restrict format, va_list arg);
16895 int vfscanf(FILE * restrict stream,
16896 const char * restrict format, va_list arg);
16897 int vprintf(const char * restrict format, va_list arg);
16898 int vscanf(const char * restrict format, va_list arg);
16899 int vsnprintf(char * restrict s, size_t n,
16900 const char * restrict format, va_list arg);
16901 int vsprintf(char * restrict s,
16902 const char * restrict format, va_list arg);
16903 int vsscanf(const char * restrict s,
16904 const char * restrict format, va_list arg);
16905 int fgetc(FILE *stream);
16906 char *fgets(char * restrict s, int n,
16907 FILE * restrict stream);
16908 int fputc(int c, FILE *stream);
16909 int fputs(const char * restrict s,
16910 FILE * restrict stream);
16911 int getc(FILE *stream);
16912 int getchar(void);
16913 char *gets(char *s);
16914 int putc(int c, FILE *stream);
16915 int putchar(int c);
16916 int puts(const char *s);
16917 int ungetc(int c, FILE *stream);
16920 [<a name="p430" href="#p430">page 430</a>] (<a href="#Contents">Contents</a>)
16922 size_t fread(void * restrict ptr,
16923 size_t size, size_t nmemb,
16924 FILE * restrict stream);
16925 size_t fwrite(const void * restrict ptr,
16926 size_t size, size_t nmemb,
16927 FILE * restrict stream);
16928 int fgetpos(FILE * restrict stream,
16929 fpos_t * restrict pos);
16930 int fseek(FILE *stream, long int offset, int whence);
16931 int fsetpos(FILE *stream, const fpos_t *pos);
16932 long int ftell(FILE *stream);
16933 void rewind(FILE *stream);
16934 void clearerr(FILE *stream);
16935 int feof(FILE *stream);
16936 int ferror(FILE *stream);
16937 void perror(const char *s);
16938 <a name="B.19" href="#B.19"><b>B.19 General utilities &lt;stdlib.h&gt;</b></a>
16939 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
16940 wchar_t lldiv_t EXIT_SUCCESS
16941 div_t NULL RAND_MAX
16942 double atof(const char *nptr);
16943 int atoi(const char *nptr);
16944 long int atol(const char *nptr);
16945 long long int atoll(const char *nptr);
16946 double strtod(const char * restrict nptr,
16947 char ** restrict endptr);
16948 float strtof(const char * restrict nptr,
16949 char ** restrict endptr);
16950 long double strtold(const char * restrict nptr,
16951 char ** restrict endptr);
16952 long int strtol(const char * restrict nptr,
16953 char ** restrict endptr, int base);
16954 long long int strtoll(const char * restrict nptr,
16955 char ** restrict endptr, int base);
16956 unsigned long int strtoul(
16957 const char * restrict nptr,
16958 char ** restrict endptr, int base);
16963 [<a name="p431" href="#p431">page 431</a>] (<a href="#Contents">Contents</a>)
16965 unsigned long long int strtoull(
16966 const char * restrict nptr,
16967 char ** restrict endptr, int base);
16968 int rand(void);
16969 void srand(unsigned int seed);
16970 void *calloc(size_t nmemb, size_t size);
16971 void free(void *ptr);
16972 void *malloc(size_t size);
16973 void *realloc(void *ptr, size_t size);
16974 void abort(void);
16975 int atexit(void (*func)(void));
16976 void exit(int status);
16977 void _Exit(int status);
16978 char *getenv(const char *name);
16979 int system(const char *string);
16980 void *bsearch(const void *key, const void *base,
16981 size_t nmemb, size_t size,
16982 int (*compar)(const void *, const void *));
16983 void qsort(void *base, size_t nmemb, size_t size,
16984 int (*compar)(const void *, const void *));
16985 int abs(int j);
16986 long int labs(long int j);
16987 long long int llabs(long long int j);
16988 div_t div(int numer, int denom);
16989 ldiv_t ldiv(long int numer, long int denom);
16990 lldiv_t lldiv(long long int numer,
16991 long long int denom);
16992 int mblen(const char *s, size_t n);
16993 int mbtowc(wchar_t * restrict pwc,
16994 const char * restrict s, size_t n);
16995 int wctomb(char *s, wchar_t wchar);
16996 size_t mbstowcs(wchar_t * restrict pwcs,
16997 const char * restrict s, size_t n);
16998 size_t wcstombs(char * restrict s,
16999 const wchar_t * restrict pwcs, size_t n);
17004 [<a name="p432" href="#p432">page 432</a>] (<a href="#Contents">Contents</a>)
17006 <a name="B.20" href="#B.20"><b>B.20 String handling &lt;string.h&gt;</b></a>
17007 size_t
17008 NULL
17009 void *memcpy(void * restrict s1,
17010 const void * restrict s2, size_t n);
17011 void *memmove(void *s1, const void *s2, size_t n);
17012 char *strcpy(char * restrict s1,
17013 const char * restrict s2);
17014 char *strncpy(char * restrict s1,
17015 const char * restrict s2, size_t n);
17016 char *strcat(char * restrict s1,
17017 const char * restrict s2);
17018 char *strncat(char * restrict s1,
17019 const char * restrict s2, size_t n);
17020 int memcmp(const void *s1, const void *s2, size_t n);
17021 int strcmp(const char *s1, const char *s2);
17022 int strcoll(const char *s1, const char *s2);
17023 int strncmp(const char *s1, const char *s2, size_t n);
17024 size_t strxfrm(char * restrict s1,
17025 const char * restrict s2, size_t n);
17026 void *memchr(const void *s, int c, size_t n);
17027 char *strchr(const char *s, int c);
17028 size_t strcspn(const char *s1, const char *s2);
17029 char *strpbrk(const char *s1, const char *s2);
17030 char *strrchr(const char *s, int c);
17031 size_t strspn(const char *s1, const char *s2);
17032 char *strstr(const char *s1, const char *s2);
17033 char *strtok(char * restrict s1,
17034 const char * restrict s2);
17035 void *memset(void *s, int c, size_t n);
17036 char *strerror(int errnum);
17037 size_t strlen(const char *s);
17042 [<a name="p433" href="#p433">page 433</a>] (<a href="#Contents">Contents</a>)
17044 <a name="B.21" href="#B.21"><b>B.21 Type-generic math &lt;tgmath.h&gt;</b></a>
17045 acos sqrt fmod nextafter
17046 asin fabs frexp nexttoward
17047 atan atan2 hypot remainder
17048 acosh cbrt ilogb remquo
17049 asinh ceil ldexp rint
17050 atanh copysign lgamma round
17051 cos erf llrint scalbn
17052 sin erfc llround scalbln
17053 tan exp2 log10 tgamma
17054 cosh expm1 log1p trunc
17055 sinh fdim log2 carg
17056 tanh floor logb cimag
17057 exp fma lrint conj
17058 log fmax lround cproj
17059 pow fmin nearbyint creal
17060 <a name="B.22" href="#B.22"><b>B.22 Date and time &lt;time.h&gt;</b></a>
17061 NULL size_t time_t
17062 CLOCKS_PER_SEC clock_t struct tm
17063 clock_t clock(void);
17064 double difftime(time_t time1, time_t time0);
17065 time_t mktime(struct tm *timeptr);
17066 time_t time(time_t *timer);
17067 char *asctime(const struct tm *timeptr);
17068 char *ctime(const time_t *timer);
17069 struct tm *gmtime(const time_t *timer);
17070 struct tm *localtime(const time_t *timer);
17071 size_t strftime(char * restrict s,
17072 size_t maxsize,
17073 const char * restrict format,
17074 const struct tm * restrict timeptr);
17079 [<a name="p434" href="#p434">page 434</a>] (<a href="#Contents">Contents</a>)
17081 <a name="B.23" href="#B.23"><b>B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt;</b></a>
17082 wchar_t wint_t WCHAR_MAX
17083 size_t struct tm WCHAR_MIN
17084 mbstate_t NULL WEOF
17085 int fwprintf(FILE * restrict stream,
17086 const wchar_t * restrict format, ...);
17087 int fwscanf(FILE * restrict stream,
17088 const wchar_t * restrict format, ...);
17089 int swprintf(wchar_t * restrict s, size_t n,
17090 const wchar_t * restrict format, ...);
17091 int swscanf(const wchar_t * restrict s,
17092 const wchar_t * restrict format, ...);
17093 int vfwprintf(FILE * restrict stream,
17094 const wchar_t * restrict format, va_list arg);
17095 int vfwscanf(FILE * restrict stream,
17096 const wchar_t * restrict format, va_list arg);
17097 int vswprintf(wchar_t * restrict s, size_t n,
17098 const wchar_t * restrict format, va_list arg);
17099 int vswscanf(const wchar_t * restrict s,
17100 const wchar_t * restrict format, va_list arg);
17101 int vwprintf(const wchar_t * restrict format,
17102 va_list arg);
17103 int vwscanf(const wchar_t * restrict format,
17104 va_list arg);
17105 int wprintf(const wchar_t * restrict format, ...);
17106 int wscanf(const wchar_t * restrict format, ...);
17107 wint_t fgetwc(FILE *stream);
17108 wchar_t *fgetws(wchar_t * restrict s, int n,
17109 FILE * restrict stream);
17110 wint_t fputwc(wchar_t c, FILE *stream);
17111 int fputws(const wchar_t * restrict s,
17112 FILE * restrict stream);
17113 int fwide(FILE *stream, int mode);
17114 wint_t getwc(FILE *stream);
17115 wint_t getwchar(void);
17116 wint_t putwc(wchar_t c, FILE *stream);
17117 wint_t putwchar(wchar_t c);
17118 wint_t ungetwc(wint_t c, FILE *stream);
17122 [<a name="p435" href="#p435">page 435</a>] (<a href="#Contents">Contents</a>)
17124 double wcstod(const wchar_t * restrict nptr,
17125 wchar_t ** restrict endptr);
17126 float wcstof(const wchar_t * restrict nptr,
17127 wchar_t ** restrict endptr);
17128 long double wcstold(const wchar_t * restrict nptr,
17129 wchar_t ** restrict endptr);
17130 long int wcstol(const wchar_t * restrict nptr,
17131 wchar_t ** restrict endptr, int base);
17132 long long int wcstoll(const wchar_t * restrict nptr,
17133 wchar_t ** restrict endptr, int base);
17134 unsigned long int wcstoul(const wchar_t * restrict nptr,
17135 wchar_t ** restrict endptr, int base);
17136 unsigned long long int wcstoull(
17137 const wchar_t * restrict nptr,
17138 wchar_t ** restrict endptr, int base);
17139 wchar_t *wcscpy(wchar_t * restrict s1,
17140 const wchar_t * restrict s2);
17141 wchar_t *wcsncpy(wchar_t * restrict s1,
17142 const wchar_t * restrict s2, size_t n);
17143 wchar_t *wmemcpy(wchar_t * restrict s1,
17144 const wchar_t * restrict s2, size_t n);
17145 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
17146 size_t n);
17147 wchar_t *wcscat(wchar_t * restrict s1,
17148 const wchar_t * restrict s2);
17149 wchar_t *wcsncat(wchar_t * restrict s1,
17150 const wchar_t * restrict s2, size_t n);
17151 int wcscmp(const wchar_t *s1, const wchar_t *s2);
17152 int wcscoll(const wchar_t *s1, const wchar_t *s2);
17153 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
17154 size_t n);
17155 size_t wcsxfrm(wchar_t * restrict s1,
17156 const wchar_t * restrict s2, size_t n);
17157 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
17158 size_t n);
17159 wchar_t *wcschr(const wchar_t *s, wchar_t c);
17160 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
17161 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); *
17162 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
17163 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
17164 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
17166 [<a name="p436" href="#p436">page 436</a>] (<a href="#Contents">Contents</a>)
17168 wchar_t *wcstok(wchar_t * restrict s1,
17169 const wchar_t * restrict s2,
17170 wchar_t ** restrict ptr);
17171 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
17172 size_t wcslen(const wchar_t *s);
17173 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
17174 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
17175 const wchar_t * restrict format,
17176 const struct tm * restrict timeptr);
17177 wint_t btowc(int c);
17178 int wctob(wint_t c);
17179 int mbsinit(const mbstate_t *ps);
17180 size_t mbrlen(const char * restrict s, size_t n,
17181 mbstate_t * restrict ps);
17182 size_t mbrtowc(wchar_t * restrict pwc,
17183 const char * restrict s, size_t n,
17184 mbstate_t * restrict ps);
17185 size_t wcrtomb(char * restrict s, wchar_t wc,
17186 mbstate_t * restrict ps);
17187 size_t mbsrtowcs(wchar_t * restrict dst,
17188 const char ** restrict src, size_t len,
17189 mbstate_t * restrict ps);
17190 size_t wcsrtombs(char * restrict dst,
17191 const wchar_t ** restrict src, size_t len,
17192 mbstate_t * restrict ps);
17193 <a name="B.24" href="#B.24"><b>B.24 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
17194 wint_t wctrans_t wctype_t WEOF
17195 int iswalnum(wint_t wc);
17196 int iswalpha(wint_t wc);
17197 int iswblank(wint_t wc);
17198 int iswcntrl(wint_t wc);
17199 int iswdigit(wint_t wc);
17200 int iswgraph(wint_t wc);
17201 int iswlower(wint_t wc);
17202 int iswprint(wint_t wc);
17203 int iswpunct(wint_t wc);
17204 int iswspace(wint_t wc);
17205 int iswupper(wint_t wc);
17206 int iswxdigit(wint_t wc);
17207 int iswctype(wint_t wc, wctype_t desc);
17208 [<a name="p437" href="#p437">page 437</a>] (<a href="#Contents">Contents</a>)
17210 wctype_t wctype(const char *property);
17211 wint_t towlower(wint_t wc);
17212 wint_t towupper(wint_t wc);
17213 wint_t towctrans(wint_t wc, wctrans_t desc);
17214 wctrans_t wctrans(const char *property);
17219 [<a name="p438" href="#p438">page 438</a>] (<a href="#Contents">Contents</a>)
17221 <a name="C" href="#C"><b> Annex C</b></a>
17222 (informative)
17223 Sequence points
17224 1 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
17225 -- The call to a function, after the arguments have been evaluated (<a href="#6.5.2.2">6.5.2.2</a>).
17226 -- The end of the first operand of the following operators: logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>);
17227 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>).
17228 -- The end of a full declarator: declarators (<a href="#6.7.5">6.7.5</a>);
17229 -- The end of a full expression: an initializer (<a href="#6.7.8">6.7.8</a>); the expression in an expression
17230 statement (<a href="#6.8.3">6.8.3</a>); the controlling expression of a selection statement (if or switch)
17231 (<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
17232 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the expression in a return statement
17233 (<a href="#6.8.6.4">6.8.6.4</a>).
17234 -- Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
17235 -- After the actions associated with each formatted input/output function conversion
17236 specifier (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
17237 -- Immediately before and immediately after each call to a comparison function, and
17238 also between any call to a comparison function and any movement of the objects
17239 passed as arguments to that call (<a href="#7.20.5">7.20.5</a>).
17244 [<a name="p439" href="#p439">page 439</a>] (<a href="#Contents">Contents</a>)
17246 <a name="D" href="#D"><b> Annex D</b></a>
17247 (normative)
17248 Universal character names for identifiers
17249 1 This clause lists the hexadecimal code values that are valid in universal character names
17250 in identifiers.
17251 2 This table is reproduced unchanged from ISO/IEC TR 10176:1998, produced by ISO/IEC
17252 JTC 1/SC 22/WG 20, except for the omission of ranges that are part of the basic character
17253 sets.
17254 Latin: 00AA, 00BA, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217,
17255 0250-02A8, 1E00-1E9B, 1EA0-1EF9, 207F
17256 Greek: 0386, 0388-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6,
17257 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 1F00-1F15, 1F18-1F1D,
17258 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D,
17259 1F5F-1F7D, 1F80-1FB4, 1FB6-1FBC, 1FC2-1FC4, 1FC6-1FCC,
17260 1FD0-1FD3, 1FD6-1FDB, 1FE0-1FEC, 1FF2-1FF4, 1FF6-1FFC
17261 Cyrillic: 0401-040C, 040E-044F, 0451-045C, 045E-0481, 0490-04C4,
17262 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9
17263 Armenian: 0531-0556, 0561-0587
17264 Hebrew: 05B0-05B9, 05BB-05BD, 05BF, 05C1-05C2, 05D0-05EA,
17265 05F0-05F2
17266 Arabic: 0621-063A, 0640-0652, 0670-06B7, 06BA-06BE, 06C0-06CE,
17267 06D0-06DC, 06E5-06E8, 06EA-06ED
17268 Devanagari: 0901-0903, 0905-0939, 093E-094D, 0950-0952, 0958-0963
17269 Bengali: 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0,
17270 09B2, 09B6-09B9, 09BE-09C4, 09C7-09C8, 09CB-09CD,
17271 09DC-09DD, 09DF-09E3, 09F0-09F1
17272 Gurmukhi: 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30,
17273 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3E-0A42, 0A47-0A48,
17274 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A74
17275 Gujarati: 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8,
17276 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABD-0AC5,
17277 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0
17278 Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
17279 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
17280 [<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
17282 0B5C-0B5D, 0B5F-0B61
17283 Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
17284 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5,
17285 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD
17286 Telugu: 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33,
17287 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C60-0C61
17288 Kannada: 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3,
17289 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CDE,
17290 0CE0-0CE1
17291 Malayalam: 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39,
17292 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D60-0D61
17293 Thai: 0E01-0E3A, 0E40-0E5B
17294 Lao: 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97,
17295 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB,
17296 0EAD-0EAE, 0EB0-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6,
17297 0EC8-0ECD, 0EDC-0EDD
17298 Tibetan: 0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 0F49-0F69,
17299 0F71-0F84, 0F86-0F8B, 0F90-0F95, 0F97, 0F99-0FAD,
17300 0FB1-0FB7, 0FB9
17301 Georgian: 10A0-10C5, 10D0-10F6
17302 Hiragana: 3041-3093, 309B-309C
17303 Katakana: 30A1-30F6, 30FB-30FC
17304 Bopomofo: 3105-312C
17305 CJK Unified Ideographs: 4E00-9FA5
17306 Hangul: AC00-D7A3
17307 Digits: 0660-0669, 06F0-06F9, 0966-096F, 09E6-09EF, 0A66-0A6F,
17308 0AE6-0AEF, 0B66-0B6F, 0BE7-0BEF, 0C66-0C6F, 0CE6-0CEF,
17309 0D66-0D6F, 0E50-0E59, 0ED0-0ED9, 0F20-0F33
17310 Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1,
17311 02E0-02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F-2040, 2102,
17312 2107, 210A-2113, 2115, 2118-211D, 2124, 2126, 2128, 212A-2131,
17313 2133-2138, 2160-2182, 3005-3007, 3021-3029
17318 [<a name="p441" href="#p441">page 441</a>] (<a href="#Contents">Contents</a>)
17320 <a name="E" href="#E"><b> Annex E</b></a>
17321 (informative)
17322 Implementation limits
17323 1 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
17324 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
17325 with the same sign. The values shall all be constant expressions suitable for use in #if
17326 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
17327 #define CHAR_BIT 8
17328 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
17329 #define CHAR_MIN 0 or SCHAR_MIN
17330 #define INT_MAX +32767
17331 #define INT_MIN -32767
17332 #define LONG_MAX +2147483647
17333 #define LONG_MIN -2147483647
17334 #define LLONG_MAX +9223372036854775807
17335 #define LLONG_MIN -9223372036854775807
17336 #define MB_LEN_MAX 1
17337 #define SCHAR_MAX +127
17338 #define SCHAR_MIN -127
17339 #define SHRT_MAX +32767
17340 #define SHRT_MIN -32767
17341 #define UCHAR_MAX 255
17342 #define USHRT_MAX 65535
17343 #define UINT_MAX 65535
17344 #define ULONG_MAX 4294967295
17345 #define ULLONG_MAX 18446744073709551615
17346 2 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
17347 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
17348 directives; all floating values shall be constant expressions. The components are
17349 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
17350 3 The values given in the following list shall be replaced by implementation-defined
17351 expressions:
17352 #define FLT_EVAL_METHOD
17353 #define FLT_ROUNDS
17354 4 The values given in the following list shall be replaced by implementation-defined
17355 constant expressions that are greater or equal in magnitude (absolute value) to those
17356 shown, with the same sign:
17357 [<a name="p442" href="#p442">page 442</a>] (<a href="#Contents">Contents</a>)
17359 #define DBL_DIG 10
17360 #define DBL_MANT_DIG
17361 #define DBL_MAX_10_EXP +37
17362 #define DBL_MAX_EXP
17363 #define DBL_MIN_10_EXP -37
17364 #define DBL_MIN_EXP
17365 #define DECIMAL_DIG 10
17366 #define FLT_DIG 6
17367 #define FLT_MANT_DIG
17368 #define FLT_MAX_10_EXP +37
17369 #define FLT_MAX_EXP
17370 #define FLT_MIN_10_EXP -37
17371 #define FLT_MIN_EXP
17372 #define FLT_RADIX 2
17373 #define LDBL_DIG 10
17374 #define LDBL_MANT_DIG
17375 #define LDBL_MAX_10_EXP +37
17376 #define LDBL_MAX_EXP
17377 #define LDBL_MIN_10_EXP -37
17378 #define LDBL_MIN_EXP
17379 5 The values given in the following list shall be replaced by implementation-defined
17380 constant expressions with values that are greater than or equal to those shown:
17381 #define DBL_MAX 1E+37
17382 #define FLT_MAX 1E+37
17383 #define LDBL_MAX 1E+37
17384 6 The values given in the following list shall be replaced by implementation-defined
17385 constant expressions with (positive) values that are less than or equal to those shown:
17386 #define DBL_EPSILON 1E-9
17387 #define DBL_MIN 1E-37
17388 #define FLT_EPSILON 1E-5
17389 #define FLT_MIN 1E-37
17390 #define LDBL_EPSILON 1E-9
17391 #define LDBL_MIN 1E-37
17396 [<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
17398 <a name="F" href="#F"><b> Annex F</b></a>
17399 (normative)
17400 IEC 60559 floating-point arithmetic
17401 <a name="F.1" href="#F.1"><b> F.1 Introduction</b></a>
17402 1 This annex specifies C language support for the IEC 60559 floating-point standard. The
17403 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
17404 microprocessor systems, second edition (IEC 60559:1989), previously designated
17405 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
17406 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
17407 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
17408 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
17409 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
17410 defines __STDC_IEC_559__ shall conform to the specifications in this annex. Where
17411 a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified
17412 behavior is adopted by reference, unless stated otherwise.
17413 <a name="F.2" href="#F.2"><b> F.2 Types</b></a>
17414 1 The C floating types match the IEC 60559 formats as follows:
17415 -- The float type matches the IEC 60559 single format.
17416 -- The double type matches the IEC 60559 double format.
17417 -- The long double type matches an IEC 60559 extended format,307) else a
17418 non-IEC 60559 extended format, else the IEC 60559 double format.
17419 Any non-IEC 60559 extended format used for the long double type shall have more
17420 precision than IEC 60559 double and at least the range of IEC 60559 double.308)
17421 Recommended practice
17422 2 The long double type should match an IEC 60559 extended format.
17427 307) ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
17428 and quadruple 128-bit IEC 60559 formats.
17429 308) A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
17430 all double values.
17432 [<a name="p444" href="#p444">page 444</a>] (<a href="#Contents">Contents</a>)
17434 <a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
17435 1 This specification does not define the behavior of signaling NaNs.309) It generally uses
17436 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
17437 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
17438 <a name="F.3" href="#F.3"><b> F.3 Operators and functions</b></a>
17439 1 C operators and functions provide IEC 60559 required and recommended facilities as
17440 listed below.
17441 -- The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
17442 divide operations.
17443 -- The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
17444 -- The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
17445 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
17446 with additional information.
17447 -- The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
17448 floating-point number to an integer value (in the same precision). The nearbyint
17449 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
17450 Appendix to ANSI/IEEE 854.
17451 -- The conversions for floating types provide the IEC 60559 conversions between
17452 floating-point precisions.
17453 -- The conversions from integer to floating types provide the IEC 60559 conversions
17454 from integer to floating point.
17455 -- The conversions from floating to integer types provide IEC 60559-like conversions
17456 but always round toward zero.
17457 -- The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
17458 conversions, which honor the directed rounding mode, from floating point to the
17459 long int and long long int integer formats. The lrint and llrint
17460 functions can be used to implement IEC 60559 conversions from floating to other
17461 integer formats.
17462 -- The translation time conversion of floating constants and the strtod, strtof,
17463 strtold, fprintf, fscanf, and related library functions in <a href="#7.20">&lt;stdlib.h&gt;</a>,
17464 <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
17465 strtold function in <a href="#7.20">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
17466 Appendix to ANSI/IEEE 854.
17468 309) Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
17469 sufficient for closure of the arithmetic.
17471 [<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
17473 -- The relational and equality operators provide IEC 60559 comparisons. IEC 60559
17474 identifies a need for additional comparison predicates to facilitate writing code that
17475 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
17476 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
17477 supplement the language operators to address this need. The islessgreater and
17478 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
17479 the unordered predicate recommended in the Appendix to IEC 60559.
17480 -- The feclearexcept, feraiseexcept, and fetestexcept functions in
17481 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
17482 exception status flags. The fegetexceptflag and fesetexceptflag
17483 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
17484 one time. These functions are used in conjunction with the type fexcept_t and the
17485 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
17486 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
17487 -- The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
17488 to select among the IEC 60559 directed rounding modes represented by the rounding
17489 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
17490 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
17491 IEC 60559 directed rounding modes.
17492 -- The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
17493 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
17494 the IEC 60559 status flags and control modes.
17495 -- The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
17496 recommended in the Appendix to IEC 60559.
17497 -- The unary minus (-) operator provides the minus (-) operation recommended in the
17498 Appendix to IEC 60559.
17499 -- The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
17500 recommended in the Appendix to IEC 60559.
17501 -- The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
17502 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
17503 -- The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
17504 function recommended in the Appendix to IEC 60559 (but with a minor change to
17505 better handle signed zeros).
17506 -- The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
17507 the Appendix to IEC 60559.
17508 -- The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
17509 Appendix to IEC 60559.
17511 [<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
17513 -- The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
17514 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
17515 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
17516 function recommended in the Appendix to IEC 60559 (except that the classification
17517 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
17518 <a name="F.4" href="#F.4"><b> F.4 Floating to integer conversion</b></a>
17519 1 If the floating value is infinite or NaN or if the integral part of the floating value exceeds
17520 the range of the integer type, then the ''invalid'' floating-point exception is raised and the
17521 resulting value is unspecified. Whether conversion of non-integer floating values whose
17522 integral part is within the range of the integer type raises the ''inexact'' floating-point
17523 exception is unspecified.310)
17524 <a name="F.5" href="#F.5"><b> F.5 Binary-decimal conversion</b></a>
17525 1 Conversion from the widest supported IEC 60559 format to decimal with
17526 DECIMAL_DIG digits and back is the identity function.311)
17527 2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
17528 particular, conversion between any supported IEC 60559 format and decimal with
17529 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
17530 rounding mode), which assures that conversion from the widest supported IEC 60559
17531 format to decimal with DECIMAL_DIG digits and back is the identity function.
17532 3 Functions such as strtod that convert character sequences to floating types honor the
17533 rounding direction. Hence, if the rounding direction might be upward or downward, the
17534 implementation cannot convert a minus-signed sequence by negating the converted
17535 unsigned sequence.
17540 310) ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
17541 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
17542 cases where it matters, library functions can be used to effect such conversions with or without raising
17543 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
17544 <a href="#7.12">&lt;math.h&gt;</a>.
17545 311) If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
17546 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
17547 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
17548 DBL_DIG are 18 and 15, respectively, for these formats.)
17550 [<a name="p447" href="#p447">page 447</a>] (<a href="#Contents">Contents</a>)
17552 <a name="F.6" href="#F.6"><b> F.6 Contracted expressions</b></a>
17553 1 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
17554 rounding directions in a manner consistent with the basic arithmetic operations covered
17555 by IEC 60559.
17556 Recommended practice
17557 2 A contracted expression should raise floating-point exceptions in a manner generally
17558 consistent with the basic arithmetic operations. A contracted expression should deliver
17559 the same value as its uncontracted counterpart, else should be correctly rounded (once).
17560 <a name="F.7" href="#F.7"><b> F.7 Floating-point environment</b></a>
17561 1 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
17562 point exception status flags and directed-rounding control modes. It includes also
17563 IEC 60559 dynamic rounding precision and trap enablement modes, if the
17564 implementation supports them.312)
17565 <a name="F.7.1" href="#F.7.1"><b> F.7.1 Environment management</b></a>
17566 1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
17567 status flags, and that rounding control modes can be set explicitly to affect result values of
17568 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
17569 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
17570 which respect sequence points.313)
17571 <a name="F.7.2" href="#F.7.2"><b> F.7.2 Translation</b></a>
17572 1 During translation the IEC 60559 default modes are in effect:
17573 -- The rounding direction mode is rounding to nearest.
17574 -- The rounding precision mode (if supported) is set so that results are not shortened.
17575 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
17576 Recommended practice
17577 2 The implementation should produce a diagnostic message for each translation-time
17582 312) This specification does not require dynamic rounding precision nor trap enablement modes.
17583 313) If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
17584 point control modes will be the default ones and the floating-point status flags will not be tested,
17585 which allows certain optimizations (see <a href="#F.8">F.8</a>).
17587 [<a name="p448" href="#p448">page 448</a>] (<a href="#Contents">Contents</a>)
17589 floating-point exception, other than ''inexact'';314) the implementation should then
17590 proceed with the translation of the program.
17591 <a name="F.7.3" href="#F.7.3"><b> F.7.3 Execution</b></a>
17592 1 At program startup the floating-point environment is initialized as prescribed by
17593 IEC 60559:
17594 -- All floating-point exception status flags are cleared.
17595 -- The rounding direction mode is rounding to nearest.
17596 -- The dynamic rounding precision mode (if supported) is set so that results are not
17597 shortened.
17598 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
17599 <a name="F.7.4" href="#F.7.4"><b> F.7.4 Constant expressions</b></a>
17600 1 An arithmetic constant expression of floating type, other than one in an initializer for an
17601 object that has static storage duration, is evaluated (as if) during execution; thus, it is
17602 affected by any operative floating-point control modes and raises floating-point
17603 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
17604 is ''on'').315)
17605 2 EXAMPLE
17606 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17607 #pragma STDC FENV_ACCESS ON
17608 void f(void)
17610 float w[] = { 0.0/0.0 }; // raises an exception
17611 static float x = 0.0/0.0; // does not raise an exception
17612 float y = 0.0/0.0; // raises an exception
17613 double z = 0.0/0.0; // raises an exception
17614 /* ... */
17616 3 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
17617 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
17620 314) As floating constants are converted to appropriate internal representations at translation time, their
17621 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
17622 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
17623 strtod, provide execution-time conversion of numeric strings.
17624 315) Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like <a href="#1.0">1.0</a>/3.0
17625 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
17626 <a href="#1.0">1.0</a>/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
17627 efficiency of translation-time evaluation through static initialization, such as
17628 const static double one_third = <a href="#1.0">1.0</a>/3.0;
17631 [<a name="p449" href="#p449">page 449</a>] (<a href="#Contents">Contents</a>)
17633 execution time.
17635 <a name="F.7.5" href="#F.7.5"><b> F.7.5 Initialization</b></a>
17636 1 All computation for automatic initialization is done (as if) at execution time; thus, it is
17637 affected by any operative modes and raises floating-point exceptions as required by
17638 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
17639 for initialization of objects that have static storage duration is done (as if) at translation
17640 time.
17641 2 EXAMPLE
17642 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17643 #pragma STDC FENV_ACCESS ON
17644 void f(void)
17646 float u[] = { 1.1e75 }; // raises exceptions
17647 static float v = 1.1e75; // does not raise exceptions
17648 float w = 1.1e75; // raises exceptions
17649 double x = 1.1e75; // may raise exceptions
17650 float y = 1.1e75f; // may raise exceptions
17651 long double z = 1.1e75; // does not raise exceptions
17652 /* ... */
17654 3 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
17655 done at translation time. The automatic initialization of u and w require an execution-time conversion to
17656 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
17657 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
17658 conversions is not to a narrower format, in which case no floating-point exception is raised.316) The
17659 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
17660 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
17661 their internal representations occur at translation time in all cases.
17666 316) Use of float_t and double_t variables increases the likelihood of translation-time computation.
17667 For example, the automatic initialization
17668 double_t x = 1.1e75;
17669 could be done at translation time, regardless of the expression evaluation method.
17671 [<a name="p450" href="#p450">page 450</a>] (<a href="#Contents">Contents</a>)
17673 <a name="F.7.6" href="#F.7.6"><b> F.7.6 Changing the environment</b></a>
17674 1 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
17675 change floating-point status flags and control modes just as indicated by their
17676 specifications (including conformance to IEC 60559). They do not change flags or modes
17677 (so as to be detectable by the user) in any other cases.
17678 2 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
17679 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
17680 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
17681 before ''inexact''.
17682 <a name="F.8" href="#F.8"><b> F.8 Optimization</b></a>
17683 1 This section identifies code transformations that might subvert IEC 60559-specified
17684 behavior, and others that do not.
17685 <a name="F.8.1" href="#F.8.1"><b> F.8.1 Global transformations</b></a>
17686 1 Floating-point arithmetic operations and external function calls may entail side effects
17687 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
17688 ''on''. The flags and modes in the floating-point environment may be regarded as global
17689 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
17690 flags.
17691 2 Concern about side effects may inhibit code motion and removal of seemingly useless
17692 code. For example, in
17693 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17694 #pragma STDC FENV_ACCESS ON
17695 void f(double x)
17697 /* ... */
17698 for (i = 0; i &lt; n; i++) x + 1;
17699 /* ... */
17701 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
17702 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
17703 course these optimizations are valid if the implementation can rule out the nettlesome
17704 cases.)
17705 3 This specification does not require support for trap handlers that maintain information
17706 about the order or count of floating-point exceptions. Therefore, between function calls,
17707 floating-point exceptions need not be precise: the actual order and number of occurrences
17708 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
17709 the preceding loop could be treated as
17710 [<a name="p451" href="#p451">page 451</a>] (<a href="#Contents">Contents</a>)
17712 if (0 &lt; n) x + 1;
17713 <a name="F.8.2" href="#F.8.2"><b> F.8.2 Expression transformations</b></a>
17714 1 x / 2 (&lt;-&gt;) x * 0.5 Although similar transformations involving inexact
17715 constants generally do not yield numerically equivalent
17716 expressions, if the constants are exact then such
17717 transformations can be made on IEC 60559 machines
17718 and others that round perfectly.
17719 1 * x and x / 1 (-&gt;) x The expressions 1 * x, x / 1, and x are equivalent
17720 (on IEC 60559 machines, among others).317)
17721 x / x (-&gt;) <a href="#1.0">1.0</a> The expressions x / x and <a href="#1.0">1.0</a> are not equivalent if x
17722 can be zero, infinite, or NaN.
17723 x - y (&lt;-&gt;) x + (-y) The expressions x - y, x + (-y), and (-y) + x
17724 are equivalent (on IEC 60559 machines, among others).
17725 x - y (&lt;-&gt;) -(y - x) The expressions x - y and -(y - x) are not
17726 equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the
17727 default rounding direction).318)
17728 x - x (-&gt;) 0.0 The expressions x - x and 0.0 are not equivalent if
17729 x is a NaN or infinite.
17730 0 * x (-&gt;) 0.0 The expressions 0 * x and 0.0 are not equivalent if
17731 x is a NaN, infinite, or -0.
17732 x + 0(-&gt;)x The expressions x + 0 and x are not equivalent if x is
17733 -0, because (-0) + (+0) yields +0 (in the default
17734 rounding direction), not -0.
17735 x - 0(-&gt;)x (+0) - (+0) yields -0 when rounding is downward
17736 (toward -(inf)), but +0 otherwise, and (-0) - (+0) always
17737 yields -0; so, if the state of the FENV_ACCESS pragma
17738 is ''off'', promising default rounding, then the
17739 implementation can replace x - 0 by x, even if x
17742 317) Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
17743 other transformations that remove arithmetic operators.
17744 318) IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
17745 Examples include:
17746 1/(1/ (+-) (inf)) is (+-) (inf)
17748 conj(csqrt(z)) is csqrt(conj(z)),
17749 for complex z.
17751 [<a name="p452" href="#p452">page 452</a>] (<a href="#Contents">Contents</a>)
17753 might be zero.
17754 -x (&lt;-&gt;) 0 - x The expressions -x and 0 - x are not equivalent if x
17755 is +0, because -(+0) yields -0, but 0 - (+0) yields +0
17756 (unless rounding is downward).
17757 <a name="F.8.3" href="#F.8.3"><b> F.8.3 Relational operators</b></a>
17758 1 x != x (-&gt;) false The statement x != x is true if x is a NaN.
17759 x == x (-&gt;) true The statement x == x is false if x is a NaN.
17760 x &lt; y (-&gt;) isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically
17761 equal, these expressions are not equivalent because of
17762 side effects when x or y is a NaN and the state of the
17763 FENV_ACCESS pragma is ''on''. This transformation,
17764 which would be desirable if extra code were required to
17765 cause the ''invalid'' floating-point exception for
17766 unordered cases, could be performed provided the state
17767 of the FENV_ACCESS pragma is ''off''.
17768 The sense of relational operators shall be maintained. This includes handling unordered
17769 cases as expressed by the source code.
17770 2 EXAMPLE
17771 // calls g and raises ''invalid'' if a and b are unordered
17772 if (a &lt; b)
17773 f();
17774 else
17775 g();
17776 is not equivalent to
17777 // calls f and raises ''invalid'' if a and b are unordered
17778 if (a &gt;= b)
17779 g();
17780 else
17781 f();
17782 nor to
17783 // calls f without raising ''invalid'' if a and b are unordered
17784 if (isgreaterequal(a,b))
17785 g();
17786 else
17787 f();
17788 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
17793 [<a name="p453" href="#p453">page 453</a>] (<a href="#Contents">Contents</a>)
17795 // calls g without raising ''invalid'' if a and b are unordered
17796 if (isless(a,b))
17797 f();
17798 else
17799 g();
17800 but is equivalent to
17801 if (!(a &lt; b))
17802 g();
17803 else
17804 f();
17806 <a name="F.8.4" href="#F.8.4"><b> F.8.4 Constant arithmetic</b></a>
17807 1 The implementation shall honor floating-point exceptions raised by execution-time
17808 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.7.4">F.7.4</a>
17809 and <a href="#F.7.5">F.7.5</a>.) An operation on constants that raises no floating-point exception can be
17810 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
17811 further check is required to assure that changing the rounding direction to downward does
17812 not alter the sign of the result,319) and implementations that support dynamic rounding
17813 precision modes shall assure further that the result of the operation raises no floating-
17814 point exception when converted to the semantic type of the operation.
17815 <a name="F.9" href="#F.9"><b> F.9 Mathematics &lt;math.h&gt;</b></a>
17816 1 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
17817 for IEC 60559 implementations.
17818 2 The Standard C macro HUGE_VAL and its float and long double analogs,
17819 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
17820 infinities.
17821 3 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
17822 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
17823 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
17824 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
17825 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
17826 4 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
17827 nonzero value.
17828 5 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
17829 subsequent subclauses of this annex.
17830 6 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
17831 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
17834 319) 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
17836 [<a name="p454" href="#p454">page 454</a>] (<a href="#Contents">Contents</a>)
17838 whose magnitude is too large.
17839 7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
17840 subnormal or zero) and suffers loss of accuracy.320)
17841 8 Whether or when library functions raise the ''inexact'' floating-point exception is
17842 unspecified, unless explicitly specified otherwise.
17843 9 Whether or when library functions raise an undeserved ''underflow'' floating-point
17844 exception is unspecified.321) 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
17845 not raise spurious floating-point exceptions (detectable by the user), other than the
17846 ''inexact'' floating-point exception.
17847 10 Whether the functions honor the rounding direction mode is implementation-defined,
17848 unless explicitly specified otherwise.
17849 11 Functions with a NaN argument return a NaN result and raise no floating-point exception,
17850 except where stated otherwise.
17851 12 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
17852 For families of functions, the specifications apply to all of the functions even though only
17853 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
17854 occurs in both an argument and the result, the result has the same sign as the argument.
17855 Recommended practice
17856 13 If a function with one or more NaN arguments returns a NaN result, the result should be
17857 the same as one of the NaN arguments (after possible type conversion), except perhaps
17858 for the sign.
17859 <a name="F.9.1" href="#F.9.1"><b> F.9.1 Trigonometric functions</b></a>
17860 <a name="F.9.1.1" href="#F.9.1.1"><b> F.9.1.1 The acos functions</b></a>
17861 1 -- acos(1) returns +0.
17862 -- acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
17863 | x | &gt; 1.
17868 320) IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
17869 when the floating-point exception is raised.
17870 321) It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
17871 avoiding them would be too costly.
17873 [<a name="p455" href="#p455">page 455</a>] (<a href="#Contents">Contents</a>)
17875 <a name="F.9.1.2" href="#F.9.1.2"><b> F.9.1.2 The asin functions</b></a>
17876 1 -- asin((+-)0) returns (+-)0.
17877 -- asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
17878 | x | &gt; 1.
17879 <a name="F.9.1.3" href="#F.9.1.3"><b> F.9.1.3 The atan functions</b></a>
17880 1 -- atan((+-)0) returns (+-)0.
17881 -- atan((+-)(inf)) returns (+-)pi /2.
17882 <a name="F.9.1.4" href="#F.9.1.4"><b> F.9.1.4 The atan2 functions</b></a>
17883 1 -- atan2((+-)0, -0) returns (+-)pi .322)
17884 -- atan2((+-)0, +0) returns (+-)0.
17885 -- atan2((+-)0, x) returns (+-)pi for x &lt; 0.
17886 -- atan2((+-)0, x) returns (+-)0 for x &gt; 0.
17887 -- atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
17888 -- atan2(y, (+-)0) returns pi /2 for y &gt; 0.
17889 -- atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
17890 -- atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
17891 -- atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
17892 -- atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
17893 -- atan2((+-)(inf), +(inf)) returns (+-)pi /4.
17894 <a name="F.9.1.5" href="#F.9.1.5"><b> F.9.1.5 The cos functions</b></a>
17895 1 -- cos((+-)0) returns 1.
17896 -- cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17897 <a name="F.9.1.6" href="#F.9.1.6"><b> F.9.1.6 The sin functions</b></a>
17898 1 -- sin((+-)0) returns (+-)0.
17899 -- sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17904 322) atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
17905 the ''divide-by-zero'' floating-point exception.
17907 [<a name="p456" href="#p456">page 456</a>] (<a href="#Contents">Contents</a>)
17909 <a name="F.9.1.7" href="#F.9.1.7"><b> F.9.1.7 The tan functions</b></a>
17910 1 -- tan((+-)0) returns (+-)0.
17911 -- tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17912 <a name="F.9.2" href="#F.9.2"><b> F.9.2 Hyperbolic functions</b></a>
17913 <a name="F.9.2.1" href="#F.9.2.1"><b> F.9.2.1 The acosh functions</b></a>
17914 1 -- acosh(1) returns +0.
17915 -- acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
17916 -- acosh(+(inf)) returns +(inf).
17917 <a name="F.9.2.2" href="#F.9.2.2"><b> F.9.2.2 The asinh functions</b></a>
17918 1 -- asinh((+-)0) returns (+-)0.
17919 -- asinh((+-)(inf)) returns (+-)(inf).
17920 <a name="F.9.2.3" href="#F.9.2.3"><b> F.9.2.3 The atanh functions</b></a>
17921 1 -- atanh((+-)0) returns (+-)0.
17922 -- atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
17923 -- atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
17924 | x | &gt; 1.
17925 <a name="F.9.2.4" href="#F.9.2.4"><b> F.9.2.4 The cosh functions</b></a>
17926 1 -- cosh((+-)0) returns 1.
17927 -- cosh((+-)(inf)) returns +(inf).
17928 <a name="F.9.2.5" href="#F.9.2.5"><b> F.9.2.5 The sinh functions</b></a>
17929 1 -- sinh((+-)0) returns (+-)0.
17930 -- sinh((+-)(inf)) returns (+-)(inf).
17931 <a name="F.9.2.6" href="#F.9.2.6"><b> F.9.2.6 The tanh functions</b></a>
17932 1 -- tanh((+-)0) returns (+-)0.
17933 -- tanh((+-)(inf)) returns (+-)1.
17938 [<a name="p457" href="#p457">page 457</a>] (<a href="#Contents">Contents</a>)
17940 <a name="F.9.3" href="#F.9.3"><b> F.9.3 Exponential and logarithmic functions</b></a>
17941 <a name="F.9.3.1" href="#F.9.3.1"><b> F.9.3.1 The exp functions</b></a>
17942 1 -- exp((+-)0) returns 1.
17943 -- exp(-(inf)) returns +0.
17944 -- exp(+(inf)) returns +(inf).
17945 <a name="F.9.3.2" href="#F.9.3.2"><b> F.9.3.2 The exp2 functions</b></a>
17946 1 -- exp2((+-)0) returns 1.
17947 -- exp2(-(inf)) returns +0.
17948 -- exp2(+(inf)) returns +(inf).
17949 <a name="F.9.3.3" href="#F.9.3.3"><b> F.9.3.3 The expm1 functions</b></a>
17950 1 -- expm1((+-)0) returns (+-)0.
17951 -- expm1(-(inf)) returns -1.
17952 -- expm1(+(inf)) returns +(inf).
17953 <a name="F.9.3.4" href="#F.9.3.4"><b> F.9.3.4 The frexp functions</b></a>
17954 1 -- frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
17955 -- frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
17956 pointed to by exp.
17957 -- frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
17958 (and returns a NaN).
17959 2 frexp raises no floating-point exceptions.
17960 3 On a binary system, the body of the frexp function might be
17962 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
17963 return scalbn(value, -(*exp));
17965 <a name="F.9.3.5" href="#F.9.3.5"><b> F.9.3.5 The ilogb functions</b></a>
17966 1 If the correct result is outside the range of the return type, the numeric result is
17967 unspecified and the ''invalid'' floating-point exception is raised.
17972 [<a name="p458" href="#p458">page 458</a>] (<a href="#Contents">Contents</a>)
17974 <a name="F.9.3.6" href="#F.9.3.6"><b> F.9.3.6 The ldexp functions</b></a>
17975 1 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
17976 <a name="F.9.3.7" href="#F.9.3.7"><b> F.9.3.7 The log functions</b></a>
17977 1 -- log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17978 -- log(1) returns +0.
17979 -- log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17980 -- log(+(inf)) returns +(inf).
17981 <a name="F.9.3.8" href="#F.9.3.8"><b> F.9.3.8 The log10 functions</b></a>
17982 1 -- log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17983 -- log10(1) returns +0.
17984 -- log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17985 -- log10(+(inf)) returns +(inf).
17986 <a name="F.9.3.9" href="#F.9.3.9"><b> F.9.3.9 The log1p functions</b></a>
17987 1 -- log1p((+-)0) returns (+-)0.
17988 -- log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17989 -- log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
17990 x &lt; -1.
17991 -- log1p(+(inf)) returns +(inf).
17992 <a name="F.9.3.10" href="#F.9.3.10"><b> F.9.3.10 The log2 functions</b></a>
17993 1 -- log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17994 -- log2(1) returns +0.
17995 -- log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17996 -- log2(+(inf)) returns +(inf).
17997 <a name="F.9.3.11" href="#F.9.3.11"><b> F.9.3.11 The logb functions</b></a>
17998 1 -- logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17999 -- logb((+-)(inf)) returns +(inf).
18004 [<a name="p459" href="#p459">page 459</a>] (<a href="#Contents">Contents</a>)
18006 <a name="F.9.3.12" href="#F.9.3.12"><b> F.9.3.12 The modf functions</b></a>
18007 1 -- modf((+-)x, iptr) returns a result with the same sign as x.
18008 -- modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
18009 -- modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
18010 NaN).
18011 2 modf behaves as though implemented by
18012 #include <a href="#7.12">&lt;math.h&gt;</a>
18013 #include <a href="#7.6">&lt;fenv.h&gt;</a>
18014 #pragma STDC FENV_ACCESS ON
18015 double modf(double value, double *iptr)
18017 int save_round = fegetround();
18018 fesetround(FE_TOWARDZERO);
18019 *iptr = nearbyint(value);
18020 fesetround(save_round);
18021 return copysign(
18022 isinf(value) ? 0.0 :
18023 value - (*iptr), value);
18025 <a name="F.9.3.13" href="#F.9.3.13"><b> F.9.3.13 The scalbn and scalbln functions</b></a>
18026 1 -- scalbn((+-)0, n) returns (+-)0.
18027 -- scalbn(x, 0) returns x.
18028 -- scalbn((+-)(inf), n) returns (+-)(inf).
18029 <a name="F.9.4" href="#F.9.4"><b> F.9.4 Power and absolute value functions</b></a>
18030 <a name="F.9.4.1" href="#F.9.4.1"><b> F.9.4.1 The cbrt functions</b></a>
18031 1 -- cbrt((+-)0) returns (+-)0.
18032 -- cbrt((+-)(inf)) returns (+-)(inf).
18033 <a name="F.9.4.2" href="#F.9.4.2"><b> F.9.4.2 The fabs functions</b></a>
18034 1 -- fabs((+-)0) returns +0.
18035 -- fabs((+-)(inf)) returns +(inf).
18040 [<a name="p460" href="#p460">page 460</a>] (<a href="#Contents">Contents</a>)
18042 <a name="F.9.4.3" href="#F.9.4.3"><b> F.9.4.3 The hypot functions</b></a>
18043 1 -- hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
18044 -- hypot(x, (+-)0) is equivalent to fabs(x).
18045 -- hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
18046 <a name="F.9.4.4" href="#F.9.4.4"><b> F.9.4.4 The pow functions</b></a>
18047 1 -- pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
18048 for y an odd integer &lt; 0.
18049 -- pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
18050 for y &lt; 0 and not an odd integer.
18051 -- pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
18052 -- pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
18053 -- pow(-1, (+-)(inf)) returns 1.
18054 -- pow(+1, y) returns 1 for any y, even a NaN.
18055 -- pow(x, (+-)0) returns 1 for any x, even a NaN.
18056 -- pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
18057 finite x &lt; 0 and finite non-integer y.
18058 -- pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
18059 -- pow(x, -(inf)) returns +0 for | x | &gt; 1.
18060 -- pow(x, +(inf)) returns +0 for | x | &lt; 1.
18061 -- pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
18062 -- pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
18063 -- pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
18064 -- pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
18065 -- pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
18066 -- pow(+(inf), y) returns +0 for y &lt; 0.
18067 -- pow(+(inf), y) returns +(inf) for y &gt; 0.
18072 [<a name="p461" href="#p461">page 461</a>] (<a href="#Contents">Contents</a>)
18074 <a name="F.9.4.5" href="#F.9.4.5"><b> F.9.4.5 The sqrt functions</b></a>
18075 1 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
18076 <a name="F.9.5" href="#F.9.5"><b> F.9.5 Error and gamma functions</b></a>
18077 <a name="F.9.5.1" href="#F.9.5.1"><b> F.9.5.1 The erf functions</b></a>
18078 1 -- erf((+-)0) returns (+-)0.
18079 -- erf((+-)(inf)) returns (+-)1.
18080 <a name="F.9.5.2" href="#F.9.5.2"><b> F.9.5.2 The erfc functions</b></a>
18081 1 -- erfc(-(inf)) returns 2.
18082 -- erfc(+(inf)) returns +0.
18083 <a name="F.9.5.3" href="#F.9.5.3"><b> F.9.5.3 The lgamma functions</b></a>
18084 1 -- lgamma(1) returns +0.
18085 -- lgamma(2) returns +0.
18086 -- lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
18087 x a negative integer or zero.
18088 -- lgamma(-(inf)) returns +(inf).
18089 -- lgamma(+(inf)) returns +(inf).
18090 <a name="F.9.5.4" href="#F.9.5.4"><b> F.9.5.4 The tgamma functions</b></a>
18091 1 -- tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
18092 -- tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
18093 negative integer.
18094 -- tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
18095 -- tgamma(+(inf)) returns +(inf).
18096 <a name="F.9.6" href="#F.9.6"><b> F.9.6 Nearest integer functions</b></a>
18097 <a name="F.9.6.1" href="#F.9.6.1"><b> F.9.6.1 The ceil functions</b></a>
18098 1 -- ceil((+-)0) returns (+-)0.
18099 -- ceil((+-)(inf)) returns (+-)(inf).
18100 2 The double version of ceil behaves as though implemented by
18105 [<a name="p462" href="#p462">page 462</a>] (<a href="#Contents">Contents</a>)
18107 #include <a href="#7.12">&lt;math.h&gt;</a>
18108 #include <a href="#7.6">&lt;fenv.h&gt;</a>
18109 #pragma STDC FENV_ACCESS ON
18110 double ceil(double x)
18112 double result;
18113 int save_round = fegetround();
18114 fesetround(FE_UPWARD);
18115 result = rint(x); // or nearbyint instead of rint
18116 fesetround(save_round);
18117 return result;
18119 <a name="F.9.6.2" href="#F.9.6.2"><b> F.9.6.2 The floor functions</b></a>
18120 1 -- floor((+-)0) returns (+-)0.
18121 -- floor((+-)(inf)) returns (+-)(inf).
18122 2 See the sample implementation for ceil in <a href="#F.9.6.1">F.9.6.1</a>.
18123 <a name="F.9.6.3" href="#F.9.6.3"><b> F.9.6.3 The nearbyint functions</b></a>
18124 1 The nearbyint functions use IEC 60559 rounding according to the current rounding
18125 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
18126 value from the argument.
18127 -- nearbyint((+-)0) returns (+-)0 (for all rounding directions).
18128 -- nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
18129 <a name="F.9.6.4" href="#F.9.6.4"><b> F.9.6.4 The rint functions</b></a>
18130 1 The rint functions differ from the nearbyint functions only in that they do raise the
18131 ''inexact'' floating-point exception if the result differs in value from the argument.
18132 <a name="F.9.6.5" href="#F.9.6.5"><b> F.9.6.5 The lrint and llrint functions</b></a>
18133 1 The lrint and llrint functions provide floating-to-integer conversion as prescribed
18134 by IEC 60559. They round according to the current rounding direction. If the rounded
18135 value is outside the range of the return type, the numeric result is unspecified and the
18136 ''invalid'' floating-point exception is raised. When they raise no other floating-point
18137 exception and the result differs from the argument, they raise the ''inexact'' floating-point
18138 exception.
18143 [<a name="p463" href="#p463">page 463</a>] (<a href="#Contents">Contents</a>)
18145 <a name="F.9.6.6" href="#F.9.6.6"><b> F.9.6.6 The round functions</b></a>
18146 1 -- round((+-)0) returns (+-)0.
18147 -- round((+-)(inf)) returns (+-)(inf).
18148 2 The double version of round behaves as though implemented by
18149 #include <a href="#7.12">&lt;math.h&gt;</a>
18150 #include <a href="#7.6">&lt;fenv.h&gt;</a>
18151 #pragma STDC FENV_ACCESS ON
18152 double round(double x)
18154 double result;
18155 fenv_t save_env;
18156 feholdexcept(&amp;save_env);
18157 result = rint(x);
18158 if (fetestexcept(FE_INEXACT)) {
18159 fesetround(FE_TOWARDZERO);
18160 result = rint(copysign(0.5 + fabs(x), x));
18162 feupdateenv(&amp;save_env);
18163 return result;
18165 The round functions may, but are not required to, raise the ''inexact'' floating-point
18166 exception for non-integer numeric arguments, as this implementation does.
18167 <a name="F.9.6.7" href="#F.9.6.7"><b> F.9.6.7 The lround and llround functions</b></a>
18168 1 The lround and llround functions differ from the lrint and llrint functions
18169 with the default rounding direction just in that the lround and llround functions
18170 round halfway cases away from zero and need not raise the ''inexact'' floating-point
18171 exception for non-integer arguments that round to within the range of the return type.
18172 <a name="F.9.6.8" href="#F.9.6.8"><b> F.9.6.8 The trunc functions</b></a>
18173 1 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
18174 rounding direction).
18175 -- trunc((+-)0) returns (+-)0.
18176 -- trunc((+-)(inf)) returns (+-)(inf).
18181 [<a name="p464" href="#p464">page 464</a>] (<a href="#Contents">Contents</a>)
18183 <a name="F.9.7" href="#F.9.7"><b> F.9.7 Remainder functions</b></a>
18184 <a name="F.9.7.1" href="#F.9.7.1"><b> F.9.7.1 The fmod functions</b></a>
18185 1 -- fmod((+-)0, y) returns (+-)0 for y not zero.
18186 -- fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
18187 infinite or y zero.
18188 -- fmod(x, (+-)(inf)) returns x for x not infinite.
18189 2 The double version of fmod behaves as though implemented by
18190 #include <a href="#7.12">&lt;math.h&gt;</a>
18191 #include <a href="#7.6">&lt;fenv.h&gt;</a>
18192 #pragma STDC FENV_ACCESS ON
18193 double fmod(double x, double y)
18195 double result;
18196 result = remainder(fabs(x), (y = fabs(y)));
18197 if (signbit(result)) result += y;
18198 return copysign(result, x);
18200 <a name="F.9.7.2" href="#F.9.7.2"><b> F.9.7.2 The remainder functions</b></a>
18201 1 The remainder functions are fully specified as a basic arithmetic operation in
18202 IEC 60559.
18203 <a name="F.9.7.3" href="#F.9.7.3"><b> F.9.7.3 The remquo functions</b></a>
18204 1 The remquo functions follow the specifications for the remainder functions. They
18205 have no further specifications special to IEC 60559 implementations.
18206 <a name="F.9.8" href="#F.9.8"><b> F.9.8 Manipulation functions</b></a>
18207 <a name="F.9.8.1" href="#F.9.8.1"><b> F.9.8.1 The copysign functions</b></a>
18208 1 copysign is specified in the Appendix to IEC 60559.
18209 <a name="F.9.8.2" href="#F.9.8.2"><b> F.9.8.2 The nan functions</b></a>
18210 1 All IEC 60559 implementations support quiet NaNs, in all floating formats.
18215 [<a name="p465" href="#p465">page 465</a>] (<a href="#Contents">Contents</a>)
18217 <a name="F.9.8.3" href="#F.9.8.3"><b> F.9.8.3 The nextafter functions</b></a>
18218 1 -- nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
18219 for x finite and the function value infinite.
18220 -- nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
18221 exceptions for the function value subnormal or zero and x != y.
18222 <a name="F.9.8.4" href="#F.9.8.4"><b> F.9.8.4 The nexttoward functions</b></a>
18223 1 No additional requirements beyond those on nextafter.
18224 <a name="F.9.9" href="#F.9.9"><b> F.9.9 Maximum, minimum, and positive difference functions</b></a>
18225 <a name="F.9.9.1" href="#F.9.9.1"><b> F.9.9.1 The fdim functions</b></a>
18226 1 No additional requirements.
18227 <a name="F.9.9.2" href="#F.9.9.2"><b> F.9.9.2 The fmax functions</b></a>
18228 1 If just one argument is a NaN, the fmax functions return the other argument (if both
18229 arguments are NaNs, the functions return a NaN).
18230 2 The body of the fmax function might be323)
18231 { return (isgreaterequal(x, y) ||
18232 isnan(y)) ? x : y; }
18233 <a name="F.9.9.3" href="#F.9.9.3"><b> F.9.9.3 The fmin functions</b></a>
18234 1 The fmin functions are analogous to the fmax functions (see <a href="#F.9.9.2">F.9.9.2</a>).
18235 <a name="F.9.10" href="#F.9.10"><b> F.9.10 Floating multiply-add</b></a>
18236 <a name="F.9.10.1" href="#F.9.10.1"><b> F.9.10.1 The fma functions</b></a>
18237 1 -- fma(x, y, z) computes xy + z, correctly rounded once.
18238 -- fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
18239 exception if one of x and y is infinite, the other is zero, and z is a NaN.
18240 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
18241 one of x and y is infinite, the other is zero, and z is not a NaN.
18242 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
18243 times y is an exact infinity and z is also an infinity but with the opposite sign.
18248 323) Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
18249 return +0; however, implementation in software might be impractical.
18251 [<a name="p466" href="#p466">page 466</a>] (<a href="#Contents">Contents</a>)
18253 <a name="G" href="#G"><b> Annex G</b></a>
18254 (informative)
18255 IEC 60559-compatible complex arithmetic
18256 <a name="G.1" href="#G.1"><b> G.1 Introduction</b></a>
18257 1 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
18258 IEC 60559 real floating-point arithmetic. Although these specifications have been
18259 carefully designed, there is little existing practice to validate the design decisions.
18260 Therefore, these specifications are not normative, but should be viewed more as
18261 recommended practice. An implementation that defines
18262 __STDC_IEC_559_COMPLEX__ should conform to the specifications in this annex.
18263 <a name="G.2" href="#G.2"><b> G.2 Types</b></a>
18264 1 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
18265 used as a type specifier within declaration specifiers in the same way as _Complex is
18266 (thus, _Imaginary float is a valid type name).
18267 2 There are three imaginary types, designated as float _Imaginary, double
18268 _Imaginary, and long double _Imaginary. The imaginary types (along with
18269 the real floating and complex types) are floating types.
18270 3 For imaginary types, the corresponding real type is given by deleting the keyword
18271 _Imaginary from the type name.
18272 4 Each imaginary type has the same representation and alignment requirements as the
18273 corresponding real type. The value of an object of imaginary type is the value of the real
18274 representation times the imaginary unit.
18275 5 The imaginary type domain comprises the imaginary types.
18276 <a name="G.3" href="#G.3"><b> G.3 Conventions</b></a>
18277 1 A complex or imaginary value with at least one infinite part is regarded as an infinity
18278 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
18279 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
18280 a zero if each of its parts is a zero.
18285 [<a name="p467" href="#p467">page 467</a>] (<a href="#Contents">Contents</a>)
18287 <a name="G.4" href="#G.4"><b> G.4 Conversions</b></a>
18288 <a name="G.4.1" href="#G.4.1"><b> G.4.1 Imaginary types</b></a>
18289 1 Conversions among imaginary types follow rules analogous to those for real floating
18290 types.
18291 <a name="G.4.2" href="#G.4.2"><b> G.4.2 Real and imaginary</b></a>
18292 1 When a value of imaginary type is converted to a real type other than _Bool,324) the
18293 result is a positive zero.
18294 2 When a value of real type is converted to an imaginary type, the result is a positive
18295 imaginary zero.
18296 <a name="G.4.3" href="#G.4.3"><b> G.4.3 Imaginary and complex</b></a>
18297 1 When a value of imaginary type is converted to a complex type, the real part of the
18298 complex result value is a positive zero and the imaginary part of the complex result value
18299 is determined by the conversion rules for the corresponding real types.
18300 2 When a value of complex type is converted to an imaginary type, the real part of the
18301 complex value is discarded and the value of the imaginary part is converted according to
18302 the conversion rules for the corresponding real types.
18303 <a name="G.5" href="#G.5"><b> G.5 Binary operators</b></a>
18304 1 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
18305 operation with an imaginary operand.
18306 2 For most operand types, the value of the result of a binary operator with an imaginary or
18307 complex operand is completely determined, with reference to real arithmetic, by the usual
18308 mathematical formula. For some operand types, the usual mathematical formula is
18309 problematic because of its treatment of infinities and because of undue overflow or
18310 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
18311 not completely determined.
18316 324) See <a href="#6.3.1.2">6.3.1.2</a>.
18318 [<a name="p468" href="#p468">page 468</a>] (<a href="#Contents">Contents</a>)
18320 <a name="G.5.1" href="#G.5.1"><b> G.5.1 Multiplicative operators</b></a>
18321 Semantics
18322 1 If one operand has real type and the other operand has imaginary type, then the result has
18323 imaginary type. If both operands have imaginary type, then the result has real type. (If
18324 either operand has complex type, then the result has complex type.)
18325 2 If the operands are not both complex, then the result and floating-point exception
18326 behavior of the * operator is defined by the usual mathematical formula:
18327 * u iv u + iv
18329 x xu i(xv) (xu) + i(xv)
18331 iy i(yu) -yv (-yv) + i(yu)
18333 x + iy (xu) + i(yu) (-yv) + i(xv)
18334 3 If the second operand is not complex, then the result and floating-point exception
18335 behavior of the / operator is defined by the usual mathematical formula:
18336 / u iv
18338 x x/u i(-x/v)
18340 iy i(y/u) y/v
18342 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
18343 4 The * and / operators satisfy the following infinity properties for all real, imaginary, and
18344 complex operands:325)
18345 -- if one operand is an infinity and the other operand is a nonzero finite number or an
18346 infinity, then the result of the * operator is an infinity;
18347 -- if the first operand is an infinity and the second operand is a finite number, then the
18348 result of the / operator is an infinity;
18349 -- if the first operand is a finite number and the second operand is an infinity, then the
18350 result of the / operator is a zero;
18355 325) These properties are already implied for those cases covered in the tables, but are required for all cases
18356 (at least where the state for CX_LIMITED_RANGE is ''off'').
18358 [<a name="p469" href="#p469">page 469</a>] (<a href="#Contents">Contents</a>)
18360 -- if the first operand is a nonzero finite number or an infinity and the second operand is
18361 a zero, then the result of the / operator is an infinity.
18362 5 If both operands of the * operator are complex or if the second operand of the / operator
18363 is complex, the operator raises floating-point exceptions if appropriate for the calculation
18364 of the parts of the result, and may raise spurious floating-point exceptions.
18365 6 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
18366 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
18367 #include <a href="#7.12">&lt;math.h&gt;</a>
18368 #include <a href="#7.3">&lt;complex.h&gt;</a>
18369 /* Multiply z * w ... */
18370 double complex _Cmultd(double complex z, double complex w)
18372 #pragma STDC FP_CONTRACT OFF
18373 double a, b, c, d, ac, bd, ad, bc, x, y;
18374 a = creal(z); b = cimag(z);
18375 c = creal(w); d = cimag(w);
18376 ac = a * c; bd = b * d;
18377 ad = a * d; bc = b * c;
18378 x = ac - bd; y = ad + bc;
18379 if (isnan(x) &amp;&amp; isnan(y)) {
18380 /* Recover infinities that computed as NaN+iNaN ... */
18381 int recalc = 0;
18382 if ( isinf(a) || isinf(b) ) { // z is infinite
18383 /* "Box" the infinity and change NaNs in the other factor to 0 */
18384 a = copysign(isinf(a) ? <a href="#1.0">1.0</a> : 0.0, a);
18385 b = copysign(isinf(b) ? <a href="#1.0">1.0</a> : 0.0, b);
18386 if (isnan(c)) c = copysign(0.0, c);
18387 if (isnan(d)) d = copysign(0.0, d);
18388 recalc = 1;
18390 if ( isinf(c) || isinf(d) ) { // w is infinite
18391 /* "Box" the infinity and change NaNs in the other factor to 0 */
18392 c = copysign(isinf(c) ? <a href="#1.0">1.0</a> : 0.0, c);
18393 d = copysign(isinf(d) ? <a href="#1.0">1.0</a> : 0.0, d);
18394 if (isnan(a)) a = copysign(0.0, a);
18395 if (isnan(b)) b = copysign(0.0, b);
18396 recalc = 1;
18398 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
18399 isinf(ad) || isinf(bc))) {
18400 /* Recover infinities from overflow by changing NaNs to 0 ... */
18401 if (isnan(a)) a = copysign(0.0, a);
18402 if (isnan(b)) b = copysign(0.0, b);
18403 if (isnan(c)) c = copysign(0.0, c);
18404 if (isnan(d)) d = copysign(0.0, d);
18405 recalc = 1;
18407 if (recalc) {
18409 [<a name="p470" href="#p470">page 470</a>] (<a href="#Contents">Contents</a>)
18411 x = INFINITY * ( a * c - b * d );
18412 y = INFINITY * ( a * d + b * c );
18415 return x + I * y;
18417 7 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
18418 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
18420 8 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
18421 #include <a href="#7.12">&lt;math.h&gt;</a>
18422 #include <a href="#7.3">&lt;complex.h&gt;</a>
18423 /* Divide z / w ... */
18424 double complex _Cdivd(double complex z, double complex w)
18426 #pragma STDC FP_CONTRACT OFF
18427 double a, b, c, d, logbw, denom, x, y;
18428 int ilogbw = 0;
18429 a = creal(z); b = cimag(z);
18430 c = creal(w); d = cimag(w);
18431 logbw = logb(fmax(fabs(c), fabs(d)));
18432 if (isfinite(logbw)) {
18433 ilogbw = (int)logbw;
18434 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
18436 denom = c * c + d * d;
18437 x = scalbn((a * c + b * d) / denom, -ilogbw);
18438 y = scalbn((b * c - a * d) / denom, -ilogbw);
18439 /* Recover infinities and zeros that computed as NaN+iNaN; */
18440 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
18441 if (isnan(x) &amp;&amp; isnan(y)) {
18442 if ((denom == 0.0) &amp;&amp;
18443 (!isnan(a) || !isnan(b))) {
18444 x = copysign(INFINITY, c) * a;
18445 y = copysign(INFINITY, c) * b;
18447 else if ((isinf(a) || isinf(b)) &amp;&amp;
18448 isfinite(c) &amp;&amp; isfinite(d)) {
18449 a = copysign(isinf(a) ? <a href="#1.0">1.0</a> : 0.0, a);
18450 b = copysign(isinf(b) ? <a href="#1.0">1.0</a> : 0.0, b);
18451 x = INFINITY * ( a * c + b * d );
18452 y = INFINITY * ( b * c - a * d );
18454 else if (isinf(logbw) &amp;&amp;
18455 isfinite(a) &amp;&amp; isfinite(b)) {
18456 c = copysign(isinf(c) ? <a href="#1.0">1.0</a> : 0.0, c);
18457 d = copysign(isinf(d) ? <a href="#1.0">1.0</a> : 0.0, d);
18458 x = 0.0 * ( a * c + b * d );
18459 y = 0.0 * ( b * c - a * d );
18461 [<a name="p471" href="#p471">page 471</a>] (<a href="#Contents">Contents</a>)
18465 return x + I * y;
18467 9 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
18468 for multiplication. In the spirit of the multiplication example above, this code does not defend against
18469 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
18470 with division, provides better roundoff characteristics.
18472 <a name="G.5.2" href="#G.5.2"><b> G.5.2 Additive operators</b></a>
18473 Semantics
18474 1 If both operands have imaginary type, then the result has imaginary type. (If one operand
18475 has real type and the other operand has imaginary type, or if either operand has complex
18476 type, then the result has complex type.)
18477 2 In all cases the result and floating-point exception behavior of a + or - operator is defined
18478 by the usual mathematical formula:
18479 + or - u iv u + iv
18481 x x(+-)u x (+-) iv (x (+-) u) (+-) iv
18483 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
18485 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
18486 <a name="G.6" href="#G.6"><b> G.6 Complex arithmetic &lt;complex.h&gt;</b></a>
18487 1 The macros
18488 imaginary
18490 _Imaginary_I
18491 are defined, respectively, as _Imaginary and a constant expression of type const
18492 float _Imaginary with the value of the imaginary unit. The macro
18494 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
18495 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
18496 imaginary.
18497 2 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
18498 particularly suited to IEC 60559 implementations. For families of functions, the
18499 specifications apply to all of the functions even though only the principal function is
18501 [<a name="p472" href="#p472">page 472</a>] (<a href="#Contents">Contents</a>)
18503 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
18504 and the result, the result has the same sign as the argument.
18505 3 The functions are continuous onto both sides of their branch cuts, taking into account the
18506 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)isqrt:2. ???
18507 4 Since complex and imaginary values are composed of real values, each function may be
18508 regarded as computing real values from real values. Except as noted, the functions treat
18509 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
18510 manner consistent with the specifications for real functions in F.9.326)
18511 5 The functions cimag, conj, cproj, and creal are fully specified for all
18512 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
18513 point exceptions.
18514 6 Each of the functions cabs and carg is specified by a formula in terms of a real
18515 function (whose special cases are covered in <a href="#F">annex F</a>):
18516 cabs(x + iy) = hypot(x, y)
18517 carg(x + iy) = atan2(y, x)
18518 7 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
18519 a formula in terms of other complex functions (whose special cases are specified below):
18520 casin(z) = -i casinh(iz)
18521 catan(z) = -i catanh(iz)
18522 ccos(z) = ccosh(iz)
18523 csin(z) = -i csinh(iz)
18524 ctan(z) = -i ctanh(iz)
18525 8 For the other functions, the following subclauses specify behavior for special cases,
18526 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
18527 families of functions, the specifications apply to all of the functions even though only the
18528 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
18529 specifications for the upper half-plane imply the specifications for the lower half-plane; if
18530 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
18531 specifications for the first quadrant imply the specifications for the other three quadrants.
18532 9 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
18537 326) 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
18538 other part is a NaN.
18540 [<a name="p473" href="#p473">page 473</a>] (<a href="#Contents">Contents</a>)
18542 <a name="G.6.1" href="#G.6.1"><b> G.6.1 Trigonometric functions</b></a>
18543 <a name="G.6.1.1" href="#G.6.1.1"><b> G.6.1.1 The cacos functions</b></a>
18544 1 -- cacos(conj(z)) = conj(cacos(z)).
18545 -- cacos((+-)0 + i0) returns pi /2 - i0.
18546 -- cacos((+-)0 + iNaN) returns pi /2 + iNaN.
18547 -- cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
18548 -- cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18549 point exception, for nonzero finite x.
18550 -- cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
18551 -- cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
18552 -- cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
18553 -- cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
18554 -- cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
18555 result is unspecified).
18556 -- cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18557 point exception, for finite y.
18558 -- cacos(NaN + i (inf)) returns NaN - i (inf).
18559 -- cacos(NaN + iNaN) returns NaN + iNaN.
18560 <a name="G.6.2" href="#G.6.2"><b> G.6.2 Hyperbolic functions</b></a>
18561 <a name="G.6.2.1" href="#G.6.2.1"><b> G.6.2.1 The cacosh functions</b></a>
18562 1 -- cacosh(conj(z)) = conj(cacosh(z)).
18563 -- cacosh((+-)0 + i0) returns +0 + ipi /2.
18564 -- cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
18565 -- cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18566 floating-point exception, for finite x.
18567 -- cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
18568 -- cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
18569 -- cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
18570 -- cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
18571 -- cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
18574 [<a name="p474" href="#p474">page 474</a>] (<a href="#Contents">Contents</a>)
18576 -- cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18577 floating-point exception, for finite y.
18578 -- cacosh(NaN + i (inf)) returns +(inf) + iNaN.
18579 -- cacosh(NaN + iNaN) returns NaN + iNaN.
18580 <a name="G.6.2.2" href="#G.6.2.2"><b> G.6.2.2 The casinh functions</b></a>
18581 1 -- casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
18582 -- casinh(+0 + i0) returns 0 + i0.
18583 -- casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
18584 -- casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18585 floating-point exception, for finite x.
18586 -- casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
18587 -- casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
18588 -- casinh(+(inf) + iNaN) returns +(inf) + iNaN.
18589 -- casinh(NaN + i0) returns NaN + i0.
18590 -- casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18591 floating-point exception, for finite nonzero y.
18592 -- casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18593 is unspecified).
18594 -- casinh(NaN + iNaN) returns NaN + iNaN.
18595 <a name="G.6.2.3" href="#G.6.2.3"><b> G.6.2.3 The catanh functions</b></a>
18596 1 -- catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
18597 -- catanh(+0 + i0) returns +0 + i0.
18598 -- catanh(+0 + iNaN) returns +0 + iNaN.
18599 -- catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
18600 exception.
18601 -- catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
18602 -- catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18603 floating-point exception, for nonzero finite x.
18604 -- catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
18605 -- catanh(+(inf) + i (inf)) returns +0 + ipi /2.
18606 -- catanh(+(inf) + iNaN) returns +0 + iNaN.
18608 [<a name="p475" href="#p475">page 475</a>] (<a href="#Contents">Contents</a>)
18610 -- catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18611 floating-point exception, for finite y.
18612 -- catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
18613 unspecified).
18614 -- catanh(NaN + iNaN) returns NaN + iNaN.
18615 <a name="G.6.2.4" href="#G.6.2.4"><b> G.6.2.4 The ccosh functions</b></a>
18616 1 -- ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
18617 -- ccosh(+0 + i0) returns 1 + i0.
18618 -- ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
18619 result is unspecified) and raises the ''invalid'' floating-point exception.
18620 -- ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
18621 result is unspecified).
18622 -- ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18623 exception, for finite nonzero x.
18624 -- ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18625 point exception, for finite nonzero x.
18626 -- ccosh(+(inf) + i0) returns +(inf) + i0.
18627 -- ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
18628 -- ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
18629 unspecified) and raises the ''invalid'' floating-point exception.
18630 -- ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
18631 -- ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
18632 result is unspecified).
18633 -- ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18634 point exception, for all nonzero numbers y.
18635 -- ccosh(NaN + iNaN) returns NaN + iNaN.
18636 <a name="G.6.2.5" href="#G.6.2.5"><b> G.6.2.5 The csinh functions</b></a>
18637 1 -- csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
18638 -- csinh(+0 + i0) returns +0 + i0.
18639 -- csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
18640 unspecified) and raises the ''invalid'' floating-point exception.
18641 -- csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
18642 unspecified).
18643 [<a name="p476" href="#p476">page 476</a>] (<a href="#Contents">Contents</a>)
18645 -- csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18646 exception, for positive finite x.
18647 -- csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18648 point exception, for finite nonzero x.
18649 -- csinh(+(inf) + i0) returns +(inf) + i0.
18650 -- csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
18651 -- csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
18652 unspecified) and raises the ''invalid'' floating-point exception.
18653 -- csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18654 is unspecified).
18655 -- csinh(NaN + i0) returns NaN + i0.
18656 -- csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18657 point exception, for all nonzero numbers y.
18658 -- csinh(NaN + iNaN) returns NaN + iNaN.
18659 <a name="G.6.2.6" href="#G.6.2.6"><b> G.6.2.6 The ctanh functions</b></a>
18660 1 -- ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
18661 -- ctanh(+0 + i0) returns +0 + i0.
18662 -- ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18663 exception, for finite x.
18664 -- ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18665 point exception, for finite x.
18666 -- ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
18667 -- ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
18668 is unspecified).
18669 -- ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
18670 result is unspecified).
18671 -- ctanh(NaN + i0) returns NaN + i0.
18672 -- ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18673 point exception, for all nonzero numbers y.
18674 -- ctanh(NaN + iNaN) returns NaN + iNaN.
18679 [<a name="p477" href="#p477">page 477</a>] (<a href="#Contents">Contents</a>)
18681 <a name="G.6.3" href="#G.6.3"><b> G.6.3 Exponential and logarithmic functions</b></a>
18682 <a name="G.6.3.1" href="#G.6.3.1"><b> G.6.3.1 The cexp functions</b></a>
18683 1 -- cexp(conj(z)) = conj(cexp(z)).
18684 -- cexp((+-)0 + i0) returns 1 + i0.
18685 -- cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18686 exception, for finite x.
18687 -- cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18688 point exception, for finite x.
18689 -- cexp(+(inf) + i0) returns +(inf) + i0.
18690 -- cexp(-(inf) + iy) returns +0 cis(y), for finite y.
18691 -- cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
18692 -- cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
18693 the result are unspecified).
18694 -- cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
18695 exception (where the sign of the real part of the result is unspecified).
18696 -- cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
18697 of the result are unspecified).
18698 -- cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18699 is unspecified).
18700 -- cexp(NaN + i0) returns NaN + i0.
18701 -- cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18702 point exception, for all nonzero numbers y.
18703 -- cexp(NaN + iNaN) returns NaN + iNaN.
18704 <a name="G.6.3.2" href="#G.6.3.2"><b> G.6.3.2 The clog functions</b></a>
18705 1 -- clog(conj(z)) = conj(clog(z)).
18706 -- clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
18707 exception.
18708 -- clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
18709 exception.
18710 -- clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
18711 -- clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18712 point exception, for finite x.
18714 [<a name="p478" href="#p478">page 478</a>] (<a href="#Contents">Contents</a>)
18716 -- clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
18717 -- clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
18718 -- clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
18719 -- clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
18720 -- clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
18721 -- clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18722 point exception, for finite y.
18723 -- clog(NaN + i (inf)) returns +(inf) + iNaN.
18724 -- clog(NaN + iNaN) returns NaN + iNaN.
18725 <a name="G.6.4" href="#G.6.4"><b> G.6.4 Power and absolute-value functions</b></a>
18726 <a name="G.6.4.1" href="#G.6.4.1"><b> G.6.4.1 The cpow functions</b></a>
18727 1 The cpow functions raise floating-point exceptions if appropriate for the calculation of
18728 the parts of the result, and may raise spurious exceptions.327)
18729 <a name="G.6.4.2" href="#G.6.4.2"><b> G.6.4.2 The csqrt functions</b></a>
18730 1 -- csqrt(conj(z)) = conj(csqrt(z)).
18731 -- csqrt((+-)0 + i0) returns +0 + i0.
18732 -- csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
18733 -- csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18734 point exception, for finite x.
18735 -- csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
18736 -- csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
18737 -- csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
18738 result is unspecified).
18739 -- csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
18740 -- csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18741 point exception, for finite y.
18742 -- csqrt(NaN + iNaN) returns NaN + iNaN.
18747 327) This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
18748 implementations that treat special cases more carefully.
18750 [<a name="p479" href="#p479">page 479</a>] (<a href="#Contents">Contents</a>)
18752 <a name="G.7" href="#G.7"><b> G.7 Type-generic math &lt;tgmath.h&gt;</b></a>
18753 1 Type-generic macros that accept complex arguments also accept imaginary arguments. If
18754 an argument is imaginary, the macro expands to an expression whose type is real,
18755 imaginary, or complex, as appropriate for the particular function: if the argument is
18756 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
18757 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
18758 the types of the others are complex.
18759 2 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
18760 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
18761 functions:
18762 cos(iy) = cosh(y)
18763 sin(iy) = i sinh(y)
18764 tan(iy) = i tanh(y)
18765 cosh(iy) = cos(y)
18766 sinh(iy) = i sin(y)
18767 tanh(iy) = i tan(y)
18768 asin(iy) = i asinh(y)
18769 atan(iy) = i atanh(y)
18770 asinh(iy) = i asin(y)
18771 atanh(iy) = i atan(y)
18776 [<a name="p480" href="#p480">page 480</a>] (<a href="#Contents">Contents</a>)
18778 <a name="H" href="#H"><b> Annex H</b></a>
18779 (informative)
18780 Language independent arithmetic
18781 <a name="H.1" href="#H.1"><b> H.1 Introduction</b></a>
18782 1 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
18783 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
18784 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
18785 <a name="H.2" href="#H.2"><b> H.2 Types</b></a>
18786 1 The relevant C arithmetic types meet the requirements of LIA-1 types if an
18787 implementation adds notification of exceptional arithmetic operations and meets the 1
18788 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
18789 <a name="H.2.1" href="#H.2.1"><b> H.2.1 Boolean type</b></a>
18790 1 The LIA-1 data type Boolean is implemented by the C data type bool with values of
18791 true and false, all from <a href="#7.16">&lt;stdbool.h&gt;</a>.
18792 <a name="H.2.2" href="#H.2.2"><b> H.2.2 Integer types</b></a>
18793 1 The signed C integer types int, long int, long long int, and the corresponding
18794 unsigned types are compatible with LIA-1. If an implementation adds support for the
18795 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
18796 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
18797 in that overflows or out-of-bounds results silently wrap. An implementation that defines
18798 signed integer types as also being modulo need not detect integer overflow, in which case,
18799 only integer divide-by-zero need be detected.
18800 2 The parameters for the integer data types can be accessed by the following:
18801 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
18802 ULLONG_MAX
18803 minint INT_MIN, LONG_MIN, LLONG_MIN
18804 3 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
18805 is always 0 for the unsigned types, and is not provided for those types.
18810 [<a name="p481" href="#p481">page 481</a>] (<a href="#Contents">Contents</a>)
18812 <a name="H.2.2.1" href="#H.2.2.1"><b> H.2.2.1 Integer operations</b></a>
18813 1 The integer operations on integer types are the following:
18814 addI x + y
18815 subI x - y
18816 mulI x * y
18817 divI, divtI x / y
18818 remI, remtI x % y
18819 negI -x
18820 absI abs(x), labs(x), llabs(x)
18821 eqI x == y
18822 neqI x != y
18823 lssI x &lt; y
18824 leqI x &lt;= y
18825 gtrI x &gt; y
18826 geqI x &gt;= y
18827 where x and y are expressions of the same integer type.
18828 <a name="H.2.3" href="#H.2.3"><b> H.2.3 Floating-point types</b></a>
18829 1 The C floating-point types float, double, and long double are compatible with
18830 LIA-1. If an implementation adds support for the LIA-1 exceptional values
18831 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
18832 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
18833 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
18834 conformant types.
18835 <a name="H.2.3.1" href="#H.2.3.1"><b> H.2.3.1 Floating-point parameters</b></a>
18836 1 The parameters for a floating point data type can be accessed by the following:
18837 r FLT_RADIX
18838 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
18839 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
18840 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
18841 2 The derived constants for the floating point types are accessed by the following:
18844 [<a name="p482" href="#p482">page 482</a>] (<a href="#Contents">Contents</a>)
18846 fmax FLT_MAX, DBL_MAX, LDBL_MAX
18847 fminN FLT_MIN, DBL_MIN, LDBL_MIN
18848 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
18849 rnd_style FLT_ROUNDS
18850 <a name="H.2.3.2" href="#H.2.3.2"><b> H.2.3.2 Floating-point operations</b></a>
18851 1 The floating-point operations on floating-point types are the following:
18852 addF x + y
18853 subF x - y
18854 mulF x * y
18855 divF x / y
18856 negF -x
18857 absF fabsf(x), fabs(x), fabsl(x)
18858 exponentF 1.f+logbf(x), <a href="#1.0">1.0</a>+logb(x), 1.L+logbl(x)
18859 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
18860 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
18861 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
18862 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
18863 eqF x == y
18864 neqF x != y
18865 lssF x &lt; y
18866 leqF x &lt;= y
18867 gtrF x &gt; y
18868 geqF x &gt;= y
18869 where x and y are expressions of the same floating point type, n is of type int, and li
18870 is of type long int.
18871 <a name="H.2.3.3" href="#H.2.3.3"><b> H.2.3.3 Rounding styles</b></a>
18872 1 The C Standard requires all floating types to use the same radix and rounding style, so
18873 that only one identifier for each is provided to map to LIA-1.
18874 2 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
18875 truncate FLT_ROUNDS == 0
18877 [<a name="p483" href="#p483">page 483</a>] (<a href="#Contents">Contents</a>)
18879 nearest FLT_ROUNDS == 1
18880 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
18881 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
18882 in all relevant LIA-1 operations, not just addition as in C.
18883 <a name="H.2.4" href="#H.2.4"><b> H.2.4 Type conversions</b></a>
18884 1 The LIA-1 type conversions are the following type casts:
18885 cvtI' (-&gt;) I (int)i, (long int)i, (long long int)i,
18886 (unsigned int)i, (unsigned long int)i,
18887 (unsigned long long int)i
18888 cvtF (-&gt;) I (int)x, (long int)x, (long long int)x,
18889 (unsigned int)x, (unsigned long int)x,
18890 (unsigned long long int)x
18891 cvtI (-&gt;) F (float)i, (double)i, (long double)i
18892 cvtF' (-&gt;) F (float)x, (double)x, (long double)x
18893 2 In the above conversions from floating to integer, the use of (cast)x can be replaced with
18894 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
18895 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
18896 conversion functions, lrint(), llrint(), lround(), and llround(), can be
18897 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
18898 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
18899 3 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
18900 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
18901 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
18902 to 65535.0 which can then be cast to unsigned short int. But, the
18903 remainder() function is not useful for doing silent wrapping to signed integer types,
18904 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
18905 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
18906 int.
18907 4 C's conversions (casts) from floating-point to floating-point can meet LIA-1
18908 requirements if an implementation uses round-to-nearest (IEC 60559 default).
18909 5 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
18910 implementation uses round-to-nearest.
18915 [<a name="p484" href="#p484">page 484</a>] (<a href="#Contents">Contents</a>)
18917 <a name="H.3" href="#H.3"><b> H.3 Notification</b></a>
18918 1 Notification is the process by which a user or program is informed that an exceptional
18919 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
18920 allows an implementation to cause a notification to occur when any arithmetic operation
18921 returns an exceptional value as defined in LIA-1 clause 5.
18922 <a name="H.3.1" href="#H.3.1"><b> H.3.1 Notification alternatives</b></a>
18923 1 LIA-1 requires at least the following two alternatives for handling of notifications:
18924 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
18925 resume.
18926 2 An implementation need only support a given notification alternative for the entire
18927 program. An implementation may support the ability to switch between notification
18928 alternatives during execution, but is not required to do so. An implementation can
18929 provide separate selection for each kind of notification, but this is not required.
18930 3 C allows an implementation to provide notification. C's SIGFPE (for traps) and
18931 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
18932 can provide LIA-1 notification.
18933 4 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
18934 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
18935 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
18936 and-resume behavior with the same constraint.
18937 <a name="H.3.1.1" href="#H.3.1.1"><b> H.3.1.1 Indicators</b></a>
18938 1 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
18939 2 The following mapping is for floating-point types:
18940 undefined FE_INVALID, FE_DIVBYZERO
18941 floating_overflow FE_OVERFLOW
18942 underflow FE_UNDERFLOW
18943 3 The floating-point indicator interrogation and manipulation operations are:
18944 set_indicators feraiseexcept(i)
18945 clear_indicators feclearexcept(i)
18946 test_indicators fetestexcept(i)
18947 current_indicators fetestexcept(FE_ALL_EXCEPT)
18948 where i is an expression of type int representing a subset of the LIA-1 indicators.
18949 4 C allows an implementation to provide the following LIA-1 required behavior: at
18950 program termination if any indicator is set the implementation shall send an unambiguous
18951 [<a name="p485" href="#p485">page 485</a>] (<a href="#Contents">Contents</a>)
18953 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
18954 5 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
18955 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
18956 point indicators.
18957 <a name="H.3.1.2" href="#H.3.1.2"><b> H.3.1.2 Traps</b></a>
18958 1 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
18959 math library functions (which are not permitted to generate any externally visible
18960 exceptional conditions). An implementation can provide an alternative of notification
18961 through termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
18962 2 LIA-1 does not require that traps be precise.
18963 3 C does require that SIGFPE be the signal corresponding to arithmetic exceptions, if there
18964 is any signal raised for them.
18965 4 C supports signal handlers for SIGFPE and allows trapping of arithmetic exceptions.
18966 When arithmetic exceptions do trap, C's signal-handler mechanism allows trap-and-
18967 terminate (either default implementation behavior or user replacement for it) or trap-and-
18968 resume, at the programmer's option.
18973 [<a name="p486" href="#p486">page 486</a>] (<a href="#Contents">Contents</a>)
18975 <a name="I" href="#I"><b> Annex I</b></a>
18976 (informative)
18977 Common warnings
18978 1 An implementation may generate warnings in many situations, none of which are
18979 specified as part of this International Standard. The following are a few of the more
18980 common situations.
18981 2 -- 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>).
18982 -- A block with initialization of an object that has automatic storage duration is jumped
18983 into (<a href="#6.2.4">6.2.4</a>).
18984 -- An implicit narrowing conversion is encountered, such as the assignment of a long
18985 int or a double to an int, or a pointer to void to a pointer to any type other than
18986 a character type (<a href="#6.3">6.3</a>).
18987 -- A hexadecimal floating constant cannot be represented exactly in its evaluation format
18988 (<a href="#6.4.4.2">6.4.4.2</a>).
18989 -- An integer character constant includes more than one character or a wide character
18990 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
18991 -- The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
18992 -- An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
18993 lvalue in one operand, and a side effect to, or an access to the value of, the identical
18994 lvalue in the other operand (<a href="#6.5">6.5</a>).
18995 -- A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
18996 -- The arguments in a function call do not agree in number and type with those of the
18997 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
18998 -- An object is defined but not used (<a href="#6.7">6.7</a>).
18999 -- A value is given to an object of an enumerated type other than by assignment of an
19000 enumeration constant that is a member of that type, or an enumeration object that has
19001 the same type, or the value of a function that returns the same enumerated type
19002 (<a href="#6.7.2.2">6.7.2.2</a>).
19003 -- An aggregate has a partly bracketed initialization (<a href="#6.7.7">6.7.7</a>).
19004 -- A statement cannot be reached (<a href="#6.8">6.8</a>).
19005 -- A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
19006 -- A constant expression is used as the controlling expression of a selection statement
19007 (<a href="#6.8.4">6.8.4</a>).
19008 [<a name="p487" href="#p487">page 487</a>] (<a href="#Contents">Contents</a>)
19010 -- An incorrectly formed preprocessing group is encountered while skipping a
19011 preprocessing group (<a href="#6.10.1">6.10.1</a>).
19012 -- An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
19017 [<a name="p488" href="#p488">page 488</a>] (<a href="#Contents">Contents</a>)
19019 <a name="J" href="#J"><b> Annex J</b></a>
19020 (informative)
19021 Portability issues
19022 1 This annex collects some information about portability that appears in this International
19023 Standard.
19024 <a name="J.1" href="#J.1"><b> J.1 Unspecified behavior</b></a>
19025 1 The following are unspecified:
19026 -- The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
19027 -- The termination status returned to the hosted environment if the return type of main
19028 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
19029 -- The behavior of the display device if a printing character is written when the active
19030 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
19031 -- The behavior of the display device if a backspace character is written when the active
19032 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
19033 -- The behavior of the display device if a horizontal tab character is written when the
19034 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
19035 -- The behavior of the display device if a vertical tab character is written when the active
19036 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
19037 -- How an extended source character that does not correspond to a universal character
19038 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
19039 -- Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
19040 -- The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
19041 -- The value of a union member other than the last one stored into (<a href="#6.2.6.1">6.2.6.1</a>).
19042 -- The representation used when storing a value in an object that has more than one
19043 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
19044 -- The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
19045 -- Whether certain operators can generate negative zeros and whether a negative zero
19046 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
19047 -- Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
19048 -- The order in which subexpressions are evaluated and the order in which side effects
19049 take place, except as specified for the function-call (), &amp;&amp;, ||, ?:, and comma
19050 operators (<a href="#6.5">6.5</a>).
19051 [<a name="p489" href="#p489">page 489</a>] (<a href="#Contents">Contents</a>)
19053 -- The order in which the function designator, arguments, and subexpressions within the
19054 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
19055 -- The order of side effects among compound literal initialization list expressions
19056 (<a href="#6.5.2.5">6.5.2.5</a>).
19057 -- The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
19058 -- The alignment of the addressable storage unit allocated to hold a bit-field (<a href="#6.7.2.1">6.7.2.1</a>).
19059 -- Whether a call to an inline function uses the inline definition or the external definition
19060 of the function (<a href="#6.7.4">6.7.4</a>).
19061 -- Whether or not a size expression is evaluated when it is part of the operand of a
19062 sizeof operator and changing the value of the size expression would not affect the
19063 result of the operator (<a href="#6.7.5.2">6.7.5.2</a>).
19064 -- The order in which any side effects occur among the initialization list expressions in
19065 an initializer (<a href="#6.7.8">6.7.8</a>).
19066 -- The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
19067 -- When a fully expanded macro replacement list contains a function-like macro name
19068 as its last preprocessing token and the next preprocessing token from the source file is
19069 a (, and the fully expanded replacement of that macro ends with the name of the first
19070 macro and the next preprocessing token from the source file is again a (, whether that
19071 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
19072 -- The order in which # and ## operations are evaluated during macro substitution
19073 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
19074 -- Whether errno is a macro or an identifier with external linkage (<a href="#7.5">7.5</a>).
19075 -- The state of the floating-point status flags when execution passes from a part of the
19076 program translated with FENV_ACCESS ''off'' to a part translated with
19077 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
19078 -- The order in which feraiseexcept raises floating-point exceptions, except as
19079 stated in <a href="#F.7.6">F.7.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
19080 -- Whether math_errhandling is a macro or an identifier with external linkage
19081 (<a href="#7.12">7.12</a>).
19082 -- The results of the frexp functions when the specified value is not a floating-point
19083 number (<a href="#7.12.6.4">7.12.6.4</a>).
19084 -- The numeric result of the ilogb functions when the correct value is outside the
19085 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>).
19086 -- 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>).
19088 [<a name="p490" href="#p490">page 490</a>] (<a href="#Contents">Contents</a>)
19090 -- The value stored by the remquo functions in the object pointed to by quo when y is
19091 zero (<a href="#7.12.10.3">7.12.10.3</a>).
19092 -- Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
19093 -- Whether va_copy and va_end are macros or identifiers with external linkage
19094 (<a href="#7.15.1">7.15.1</a>).
19095 -- The hexadecimal digit before the decimal point when a non-normalized floating-point
19096 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>).
19097 -- The value of the file position indicator after a successful call to the ungetc function
19098 for a text stream, or the ungetwc function for any stream, until all pushed-back
19099 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>).
19100 -- The details of the value stored by the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>).
19101 -- 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>).
19102 -- Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
19103 functions convert a minus-signed sequence to a negative number directly or by
19104 negating the value resulting from converting the corresponding unsigned sequence
19105 (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
19106 -- The order and contiguity of storage allocated by successive calls to the calloc,
19107 malloc, and realloc functions (<a href="#7.20.3">7.20.3</a>).
19108 -- The amount of storage allocated by a successful call to the calloc, malloc, or
19109 realloc function when 0 bytes was requested (<a href="#7.20.3">7.20.3</a>).
19110 -- Which of two elements that compare as equal is matched by the bsearch function
19111 (<a href="#7.20.5.1">7.20.5.1</a>).
19112 -- The order of two elements that compare as equal in an array sorted by the qsort
19113 function (<a href="#7.20.5.2">7.20.5.2</a>).
19114 -- The encoding of the calendar time returned by the time function (<a href="#7.23.2.4">7.23.2.4</a>).
19115 -- The characters stored by the strftime or wcsftime function if any of the time
19116 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>).
19117 -- 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>,
19118 <a href="#7.24.6.4.2">7.24.6.4.2</a>,
19119 -- The resulting value when the ''invalid'' floating-point exception is raised during
19120 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
19121 -- Whether conversion of non-integer IEC 60559 floating values to integer raises the
19122 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
19126 [<a name="p491" href="#p491">page 491</a>] (<a href="#Contents">Contents</a>)
19128 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
19129 exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
19130 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
19131 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
19132 -- The exponent value stored by frexp for a NaN or infinity (<a href="#F.9.3.4">F.9.3.4</a>).
19133 -- The numeric result returned by the lrint, llrint, lround, and llround
19134 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>).
19135 -- The sign of one part of the complex result of several math functions for certain
19136 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>,
19137 <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>).
19138 <a name="J.2" href="#J.2"><b> J.2 Undefined behavior</b></a>
19139 1 The behavior is undefined in the following circumstances:
19140 -- A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
19141 (clause 4).
19142 -- A nonempty source file does not end in a new-line character which is not immediately
19143 preceded by a backslash character or ends in a partial preprocessing token or
19144 comment (<a href="#5.1.1.2">5.1.1.2</a>).
19145 -- Token concatenation produces a character sequence matching the syntax of a
19146 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
19147 -- A program in a hosted environment does not define a function named main using one
19148 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
19149 -- A character not in the basic source character set is encountered in a source file, except
19150 in an identifier, a character constant, a string literal, a header name, a comment, or a
19151 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
19152 -- An identifier, comment, string literal, character constant, or header name contains an
19153 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>).
19154 -- The same identifier has both internal and external linkage in the same translation unit
19155 (<a href="#6.2.2">6.2.2</a>).
19156 -- An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
19157 -- The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
19158 -- The value of an object with automatic storage duration is used while it is
19159 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>).
19160 -- A trap representation is read by an lvalue expression that does not have character type
19161 (<a href="#6.2.6.1">6.2.6.1</a>).
19163 [<a name="p492" href="#p492">page 492</a>] (<a href="#Contents">Contents</a>)
19165 -- A trap representation is produced by a side effect that modifies any part of the object
19166 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
19167 -- The arguments to certain operators are such that could produce a negative zero result,
19168 but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
19169 -- Two declarations of the same object or function specify types that are not compatible
19170 (<a href="#6.2.7">6.2.7</a>).
19171 -- Conversion to or from an integer type produces a value outside the range that can be
19172 represented (<a href="#6.3.1.4">6.3.1.4</a>).
19173 -- Demotion of one real floating type to another produces a value outside the range that
19174 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
19175 -- An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
19176 -- A non-array lvalue with an incomplete type is used in a context that requires the value
19177 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
19178 -- An lvalue having array type is converted to a pointer to the initial element of the
19179 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
19180 -- An attempt is made to use the value of a void expression, or an implicit or explicit
19181 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
19182 -- Conversion of a pointer to an integer type produces a value outside the range that can
19183 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
19184 -- Conversion between two pointer types produces a result that is incorrectly aligned
19185 (<a href="#6.3.2.3">6.3.2.3</a>).
19186 -- A pointer is used to call a function whose type is not compatible with the pointed-to
19187 type (<a href="#6.3.2.3">6.3.2.3</a>).
19188 -- An unmatched ' or " character is encountered on a logical source line during
19189 tokenization (<a href="#6.4">6.4</a>).
19190 -- A reserved keyword token is used in translation phase 7 or 8 for some purpose other
19191 than as a keyword (<a href="#6.4.1">6.4.1</a>).
19192 -- A universal character name in an identifier does not designate a character whose
19193 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
19194 -- The initial character of an identifier is a universal character name designating a digit
19195 (<a href="#6.4.2.1">6.4.2.1</a>).
19196 -- Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
19197 -- The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
19200 [<a name="p493" href="#p493">page 493</a>] (<a href="#Contents">Contents</a>)
19202 -- The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
19203 -- The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
19204 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
19205 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
19206 -- Between two sequence points, an object is modified more than once, or is modified
19207 and the prior value is read other than to determine the value to be stored (<a href="#6.5">6.5</a>).
19208 -- An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
19209 -- An object has its stored value accessed other than by an lvalue of an allowable type
19210 (<a href="#6.5">6.5</a>).
19211 -- An attempt is made to modify the result of a function call, a conditional operator, an
19212 assignment operator, or a comma operator, or to access it after the next sequence
19213 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>).
19214 -- For a call to a function without a function prototype in scope, the number of
19215 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
19216 -- For call to a function without a function prototype in scope where the function is
19217 defined with a function prototype, either the prototype ends with an ellipsis or the
19218 types of the arguments after promotion are not compatible with the types of the
19219 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
19220 -- For a call to a function without a function prototype in scope where the function is not
19221 defined with a function prototype, the types of the arguments after promotion are not
19222 compatible with those of the parameters after promotion (with certain exceptions)
19223 (<a href="#6.5.2.2">6.5.2.2</a>).
19224 -- A function is defined with a type that is not compatible with the type (of the
19225 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
19226 -- The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
19227 -- A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
19228 -- The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
19229 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
19230 integer type produces a result that does not point into, or just beyond, the same array
19231 object (<a href="#6.5.6">6.5.6</a>).
19232 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
19233 integer type produces a result that points just beyond the array object and is used as
19234 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
19235 -- Pointers that do not point into, or just beyond, the same array object are subtracted
19236 (<a href="#6.5.6">6.5.6</a>).
19238 [<a name="p494" href="#p494">page 494</a>] (<a href="#Contents">Contents</a>)
19240 -- An array subscript is out of range, even if an object is apparently accessible with the
19241 given subscript (as in the lvalue expression a[1][7] given the declaration int
19242 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
19243 -- The result of subtracting two pointers is not representable in an object of type
19244 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
19245 -- An expression is shifted by a negative number or by an amount greater than or equal
19246 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
19247 -- An expression having signed promoted type is left-shifted and either the value of the
19248 expression is negative or the result of shifting would be not be representable in the
19249 promoted type (<a href="#6.5.7">6.5.7</a>).
19250 -- Pointers that do not point to the same aggregate or union (nor just beyond the same
19251 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
19252 -- An object is assigned to an inexactly overlapping object or to an exactly overlapping
19253 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
19254 -- An expression that is required to be an integer constant expression does not have an
19255 integer type; has operands that are not integer constants, enumeration constants,
19256 character constants, sizeof expressions whose results are integer constants, or
19257 immediately-cast floating constants; or contains casts (outside operands to sizeof
19258 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
19259 -- A constant expression in an initializer is not, or does not evaluate to, one of the
19260 following: an arithmetic constant expression, a null pointer constant, an address
19261 constant, or an address constant for an object type plus or minus an integer constant
19262 expression (<a href="#6.6">6.6</a>).
19263 -- An arithmetic constant expression does not have arithmetic type; has operands that
19264 are not integer constants, floating constants, enumeration constants, character
19265 constants, or sizeof expressions; or contains casts (outside operands to sizeof
19266 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
19267 -- The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
19268 address &amp;, or indirection * operator or a pointer cast in creating an address constant
19269 (<a href="#6.6">6.6</a>).
19270 -- An identifier for an object is declared with no linkage and the type of the object is
19271 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
19272 -- A function is declared at block scope with an explicit storage-class specifier other
19273 than extern (<a href="#6.7.1">6.7.1</a>).
19274 -- A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
19277 [<a name="p495" href="#p495">page 495</a>] (<a href="#Contents">Contents</a>)
19279 -- An attempt is made to access, or generate a pointer to just past, a flexible array
19280 member of a structure when the referenced object provides no elements for that array
19281 (<a href="#6.7.2.1">6.7.2.1</a>).
19282 -- When the complete type is needed, an incomplete structure or union type is not
19283 completed in the same scope by another declaration of the tag that defines the content
19284 (<a href="#6.7.2.3">6.7.2.3</a>).
19285 -- An attempt is made to modify an object defined with a const-qualified type through
19286 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
19287 -- An attempt is made to refer to an object defined with a volatile-qualified type through
19288 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
19289 -- The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
19290 -- Two qualified types that are required to be compatible do not have the identically
19291 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
19292 -- An object which has been modified is accessed through a restrict-qualified pointer to
19293 a const-qualified type, or through a restrict-qualified pointer and another pointer that
19294 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
19295 -- A restrict-qualified pointer is assigned a value based on another restricted pointer
19296 whose associated block neither began execution before the block associated with this
19297 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
19298 -- A function with external linkage is declared with an inline function specifier, but is
19299 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
19300 -- Two pointer types that are required to be compatible are not identically qualified, or
19301 are not pointers to compatible types (<a href="#6.7.5.1">6.7.5.1</a>).
19302 -- The size expression in an array declaration is not a constant expression and evaluates
19303 at program execution time to a nonpositive value (<a href="#6.7.5.2">6.7.5.2</a>).
19304 -- In a context requiring two array types to be compatible, they do not have compatible
19305 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.5.2">6.7.5.2</a>).
19306 -- A declaration of an array parameter includes the keyword static within the [ and
19307 ] and the corresponding argument does not provide access to the first element of an
19308 array with at least the specified number of elements (<a href="#6.7.5.3">6.7.5.3</a>).
19309 -- A storage-class specifier or type qualifier modifies the keyword void as a function
19310 parameter type list (<a href="#6.7.5.3">6.7.5.3</a>).
19311 -- In a context requiring two function types to be compatible, they do not have
19312 compatible return types, or their parameters disagree in use of the ellipsis terminator
19313 or the number and type of parameters (after default argument promotion, when there
19314 is no parameter type list or when one type is specified by a function definition with an
19315 [<a name="p496" href="#p496">page 496</a>] (<a href="#Contents">Contents</a>)
19317 identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
19318 -- The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
19319 -- The initializer for a scalar is neither a single expression nor a single expression
19320 enclosed in braces (<a href="#6.7.8">6.7.8</a>).
19321 -- The initializer for a structure or union object that has automatic storage duration is
19322 neither an initializer list nor a single expression that has compatible structure or union
19323 type (<a href="#6.7.8">6.7.8</a>).
19324 -- The initializer for an aggregate or union, other than an array initialized by a string
19325 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.8">6.7.8</a>).
19326 -- An identifier with external linkage is used, but in the program there does not exist
19327 exactly one external definition for the identifier, or the identifier is not used and there
19328 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
19329 -- A function definition includes an identifier list, but the types of the parameters are not
19330 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
19331 -- An adjusted parameter type in a function definition is not an object type (<a href="#6.9.1">6.9.1</a>).
19332 -- A function that accepts a variable number of arguments is defined without a
19333 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
19334 -- The } that terminates a function is reached, and the value of the function call is used
19335 by the caller (<a href="#6.9.1">6.9.1</a>).
19336 -- An identifier for an object with internal linkage and an incomplete type is declared
19337 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
19338 -- The token defined is generated during the expansion of a #if or #elif
19339 preprocessing directive, or the use of the defined unary operator does not match
19340 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
19341 -- The #include preprocessing directive that results after expansion does not match
19342 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
19343 -- The character sequence in an #include preprocessing directive does not start with a
19344 letter (<a href="#6.10.2">6.10.2</a>).
19345 -- There are sequences of preprocessing tokens within the list of macro arguments that
19346 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
19347 -- The result of the preprocessing operator # is not a valid character string literal
19348 (<a href="#6.10.3.2">6.10.3.2</a>).
19349 -- The result of the preprocessing operator ## is not a valid preprocessing token
19350 (<a href="#6.10.3.3">6.10.3.3</a>).
19352 [<a name="p497" href="#p497">page 497</a>] (<a href="#Contents">Contents</a>)
19354 -- The #line preprocessing directive that results after expansion does not match one of
19355 the two well-defined forms, or its digit sequence specifies zero or a number greater
19356 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
19357 -- A non-STDC #pragma preprocessing directive that is documented as causing
19358 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
19359 -- A #pragma STDC preprocessing directive does not match one of the well-defined
19360 forms (<a href="#6.10.6">6.10.6</a>).
19361 -- The name of a predefined macro, or the identifier defined, is the subject of a
19362 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
19363 -- An attempt is made to copy an object to an overlapping object by use of a library
19364 function, other than as explicitly allowed (e.g., memmove) (clause 7).
19365 -- A file with the same name as one of the standard headers, not provided as part of the
19366 implementation, is placed in any of the standard places that are searched for included
19367 source files (<a href="#7.1.2">7.1.2</a>).
19368 -- A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
19369 -- A function, object, type, or macro that is specified as being declared or defined by
19370 some standard header is used before any header that declares or defines it is included
19371 (<a href="#7.1.2">7.1.2</a>).
19372 -- A standard header is included while a macro is defined with the same name as a
19373 keyword (<a href="#7.1.2">7.1.2</a>).
19374 -- The program attempts to declare a library function itself, rather than via a standard
19375 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
19376 -- The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
19377 (<a href="#7.1.3">7.1.3</a>).
19378 -- The program removes the definition of a macro whose name begins with an
19379 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
19380 -- An argument to a library function has an invalid value or a type not expected by a
19381 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
19382 -- The pointer passed to a library function array parameter does not have a value such
19383 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
19384 -- The macro definition of assert is suppressed in order to access an actual function
19385 (<a href="#7.2">7.2</a>).
19386 -- The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
19387 -- The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
19388 any context other than outside all external declarations or preceding all explicit
19389 [<a name="p498" href="#p498">page 498</a>] (<a href="#Contents">Contents</a>)
19391 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>).
19392 -- The value of an argument to a character handling function is neither equal to the value
19393 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
19394 -- A macro definition of errno is suppressed in order to access an actual object, or the
19395 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
19396 -- Part of the program tests floating-point status flags, sets floating-point control modes,
19397 or runs under non-default mode settings, but was translated with the state for the
19398 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
19399 -- The exception-mask argument for one of the functions that provide access to the
19400 floating-point status flags has a nonzero value not obtained by bitwise OR of the
19401 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
19402 -- The fesetexceptflag function is used to set floating-point status flags that were
19403 not specified in the call to the fegetexceptflag function that provided the value
19404 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
19405 -- The argument to fesetenv or feupdateenv is neither an object set by a call to
19406 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>).
19407 -- The value of the result of an integer arithmetic or conversion function cannot be
19408 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>).
19409 -- The program modifies the string pointed to by the value returned by the setlocale
19410 function (<a href="#7.11.1.1">7.11.1.1</a>).
19411 -- The program modifies the structure pointed to by the value returned by the
19412 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
19413 -- A macro definition of math_errhandling is suppressed or the program defines
19414 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
19415 -- An argument to a floating-point classification or comparison macro is not of real
19416 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
19417 -- A macro definition of setjmp is suppressed in order to access an actual function, or
19418 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
19419 -- An invocation of the setjmp macro occurs other than in an allowed context
19420 (<a href="#7.13.2.1">7.13.2.1</a>).
19421 -- The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
19422 -- After a longjmp, there is an attempt to access the value of an object of automatic
19423 storage class with non-volatile-qualified type, local to the function containing the
19424 invocation of the corresponding setjmp macro, that was changed between the
19425 setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
19427 [<a name="p499" href="#p499">page 499</a>] (<a href="#Contents">Contents</a>)
19429 -- The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
19430 -- A signal handler returns when the signal corresponded to a computational exception
19431 (<a href="#7.14.1.1">7.14.1.1</a>).
19432 -- A signal occurs as the result of calling the abort or raise function, and the signal
19433 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
19434 -- A signal occurs other than as the result of calling the abort or raise function, and
19435 the signal handler refers to an object with static storage duration other than by
19436 assigning a value to an object declared as volatile sig_atomic_t, or calls any
19437 function in the standard library other than the abort function, the _Exit function,
19438 or the signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
19439 -- The value of errno is referred to after a signal occurred other than as the result of
19440 calling the abort or raise function and the corresponding signal handler obtained
19441 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
19442 -- A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
19443 -- A function with a variable number of arguments attempts to access its varying
19444 arguments other than through a properly declared and initialized va_list object, or
19445 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>).
19446 -- The macro va_arg is invoked using the parameter ap that was passed to a function
19447 that invoked the macro va_arg with the same parameter (<a href="#7.15">7.15</a>).
19448 -- A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
19449 order to access an actual function, or the program defines an external identifier with
19450 the name va_copy or va_end (<a href="#7.15.1">7.15.1</a>).
19451 -- The va_start or va_copy macro is invoked without a corresponding invocation
19452 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>,
19453 <a href="#7.15.1.4">7.15.1.4</a>).
19454 -- The type parameter to the va_arg macro is not such that a pointer to an object of
19455 that type can be obtained simply by postfixing a * (<a href="#7.15.1.1">7.15.1.1</a>).
19456 -- The va_arg macro is invoked when there is no actual next argument, or with a
19457 specified type that is not compatible with the promoted type of the actual next
19458 argument, with certain exceptions (<a href="#7.15.1.1">7.15.1.1</a>).
19459 -- The va_copy or va_start macro is called to initialize a va_list that was
19460 previously initialized by either macro without an intervening invocation of the
19461 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>).
19462 -- The parameter parmN of a va_start macro is declared with the register
19463 storage class, with a function or array type, or with a type that is not compatible with
19464 the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
19465 [<a name="p500" href="#p500">page 500</a>] (<a href="#Contents">Contents</a>)
19467 -- The member designator parameter of an offsetof macro is an invalid right
19468 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
19469 -- The argument in an instance of one of the integer-constant macros is not a decimal,
19470 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
19471 corresponding type (<a href="#7.18.4">7.18.4</a>).
19472 -- A byte input/output function is applied to a wide-oriented stream, or a wide character
19473 input/output function is applied to a byte-oriented stream (<a href="#7.19.2">7.19.2</a>).
19474 -- Use is made of any portion of a file beyond the most recent wide character written to
19475 a wide-oriented stream (<a href="#7.19.2">7.19.2</a>).
19476 -- The value of a pointer to a FILE object is used after the associated file is closed
19477 (<a href="#7.19.3">7.19.3</a>).
19478 -- The stream for the fflush function points to an input stream or to an update stream
19479 in which the most recent operation was input (<a href="#7.19.5.2">7.19.5.2</a>).
19480 -- The string pointed to by the mode argument in a call to the fopen function does not
19481 exactly match one of the specified character sequences (<a href="#7.19.5.3">7.19.5.3</a>).
19482 -- An output operation on an update stream is followed by an input operation without an
19483 intervening call to the fflush function or a file positioning function, or an input
19484 operation on an update stream is followed by an output operation with an intervening
19485 call to a file positioning function (<a href="#7.19.5.3">7.19.5.3</a>).
19486 -- An attempt is made to use the contents of the array that was supplied in a call to the
19487 setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
19488 -- There are insufficient arguments for the format in a call to one of the formatted
19489 input/output functions, or an argument does not have an appropriate type (<a href="#7.19.6.1">7.19.6.1</a>,
19490 <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>).
19491 -- The format in a call to one of the formatted input/output functions or to the
19492 strftime or wcsftime function is not a valid multibyte character sequence that
19493 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>,
19494 <a href="#7.24.5.1">7.24.5.1</a>).
19495 -- In a call to one of the formatted output functions, a precision appears with a
19496 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>).
19497 -- A conversion specification for a formatted output function uses an asterisk to denote
19498 an argument-supplied field width or precision, but the corresponding argument is not
19499 provided (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
19500 -- A conversion specification for a formatted output function uses a # or 0 flag with a
19501 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>).
19504 [<a name="p501" href="#p501">page 501</a>] (<a href="#Contents">Contents</a>)
19506 -- A conversion specification for one of the formatted input/output functions uses a
19507 length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
19508 <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>).
19509 -- An s conversion specifier is encountered by one of the formatted output functions,
19510 and the argument is missing the null terminator (unless a precision is specified that
19511 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>).
19512 -- An n conversion specification for one of the formatted input/output functions includes
19513 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.19.6.1">7.19.6.1</a>,
19514 <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>).
19515 -- A % conversion specifier is encountered by one of the formatted input/output
19516 functions, but the complete conversion specification is not exactly %% (<a href="#7.19.6.1">7.19.6.1</a>,
19517 <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>).
19518 -- An invalid conversion specification is found in the format for one of the formatted
19519 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>,
19520 <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>).
19521 -- The number of characters transmitted by a formatted output function is greater than
19522 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>).
19523 -- The result of a conversion by one of the formatted input functions cannot be
19524 represented in the corresponding object, or the receiving object does not have an
19525 appropriate type (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
19526 -- A c, s, or [ conversion specifier is encountered by one of the formatted input
19527 functions, and the array pointed to by the corresponding argument is not large enough
19528 to accept the input sequence (and a null terminator if the conversion specifier is s or
19529 [) (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
19530 -- A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
19531 formatted input functions, but the input is not a valid multibyte character sequence
19532 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>).
19533 -- The input item for a %p conversion by one of the formatted input functions is not a
19534 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>).
19535 -- The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
19536 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
19537 vwscanf function is called with an improperly initialized va_list argument, or
19538 the argument is used (other than in an invocation of va_end) after the function
19539 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>,
19540 <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>).
19541 -- The contents of the array supplied in a call to the fgets, gets, or fgetws function
19542 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>).
19543 [<a name="p502" href="#p502">page 502</a>] (<a href="#Contents">Contents</a>)
19545 -- The file position indicator for a binary stream is used after a call to the ungetc
19546 function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
19547 -- The file position indicator for a stream is used after an error occurred during a call to
19548 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>).
19549 -- A partial element read by a call to the fread function is used (<a href="#7.19.8.1">7.19.8.1</a>).
19550 -- The fseek function is called for a text stream with a nonzero offset and either the
19551 offset was not returned by a previous successful call to the ftell function on a
19552 stream associated with the same file or whence is not SEEK_SET (<a href="#7.19.9.2">7.19.9.2</a>).
19553 -- The fsetpos function is called to set a position that was not returned by a previous
19554 successful call to the fgetpos function on a stream associated with the same file
19555 (<a href="#7.19.9.3">7.19.9.3</a>).
19556 -- A non-null pointer returned by a call to the calloc, malloc, or realloc function
19557 with a zero requested size is used to access an object (<a href="#7.20.3">7.20.3</a>).
19558 -- The value of a pointer that refers to space deallocated by a call to the free or
19559 realloc function is used (<a href="#7.20.3">7.20.3</a>).
19560 -- The pointer argument to the free or realloc function does not match a pointer
19561 earlier returned by calloc, malloc, or realloc, or the space has been
19562 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>).
19563 -- The value of the object allocated by the malloc function is used (<a href="#7.20.3.3">7.20.3.3</a>).
19564 -- The value of any bytes in a new object allocated by the realloc function beyond
19565 the size of the old object are used (<a href="#7.20.3.4">7.20.3.4</a>).
19566 -- The program executes more than one call to the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
19567 -- During the call to a function registered with the atexit function, a call is made to
19568 the longjmp function that would terminate the call to the registered function
19569 (<a href="#7.20.4.3">7.20.4.3</a>).
19570 -- The string set up by the getenv or strerror function is modified by the program
19571 (<a href="#7.20.4.5">7.20.4.5</a>, <a href="#7.21.6.2">7.21.6.2</a>).
19572 -- A command is executed through the system function in a way that is documented as
19573 causing termination or some other form of undefined behavior (<a href="#7.20.4.6">7.20.4.6</a>).
19574 -- A searching or sorting utility function is called with an invalid pointer argument, even
19575 if the number of elements is zero (<a href="#7.20.5">7.20.5</a>).
19576 -- The comparison function called by a searching or sorting utility function alters the
19577 contents of the array being searched or sorted, or returns ordering values
19578 inconsistently (<a href="#7.20.5">7.20.5</a>).
19581 [<a name="p503" href="#p503">page 503</a>] (<a href="#Contents">Contents</a>)
19583 -- The array being searched by the bsearch function does not have its elements in
19584 proper order (<a href="#7.20.5.1">7.20.5.1</a>).
19585 -- The current conversion state is used by a multibyte/wide character conversion
19586 function after changing the LC_CTYPE category (<a href="#7.20.7">7.20.7</a>).
19587 -- A string or wide string utility function is instructed to access an array beyond the end
19588 of an object (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
19589 -- A string or wide string utility function is called with an invalid pointer argument, even
19590 if the length is zero (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
19591 -- The contents of the destination array are used after a call to the strxfrm,
19592 strftime, wcsxfrm, or wcsftime function in which the specified length was
19593 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>,
19594 <a href="#7.24.5.1">7.24.5.1</a>).
19595 -- The first argument in the very first call to the strtok or wcstok is a null pointer
19596 (<a href="#7.21.5.8">7.21.5.8</a>, <a href="#7.24.4.5.7">7.24.4.5.7</a>).
19597 -- The type of an argument to a type-generic macro is not compatible with the type of
19598 the corresponding parameter of the selected function (<a href="#7.22">7.22</a>).
19599 -- A complex argument is supplied for a generic parameter of a type-generic macro that
19600 has no corresponding complex function (<a href="#7.22">7.22</a>).
19601 -- The argument corresponding to an s specifier without an l qualifier in a call to the
19602 fwprintf function does not point to a valid multibyte character sequence that
19603 begins in the initial shift state (<a href="#7.24.2.11">7.24.2.11</a>).
19604 -- In a call to the wcstok function, the object pointed to by ptr does not have the
19605 value stored by the previous call for the same wide string (<a href="#7.24.4.5.7">7.24.4.5.7</a>).
19606 -- An mbstate_t object is used inappropriately (<a href="#7.24.6">7.24.6</a>).
19607 -- The value of an argument of type wint_t to a wide character classification or case
19608 mapping function is neither equal to the value of WEOF nor representable as a
19609 wchar_t (<a href="#7.25.1">7.25.1</a>).
19610 -- The iswctype function is called using a different LC_CTYPE category from the
19611 one in effect for the call to the wctype function that returned the description
19612 (<a href="#7.25.2.2.1">7.25.2.2.1</a>).
19613 -- The towctrans function is called using a different LC_CTYPE category from the
19614 one in effect for the call to the wctrans function that returned the description
19615 (<a href="#7.25.3.2.1">7.25.3.2.1</a>).
19620 [<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
19622 <a name="J.3" href="#J.3"><b> J.3 Implementation-defined behavior</b></a>
19623 1 A conforming implementation is required to document its choice of behavior in each of
19624 the areas listed in this subclause. The following are implementation-defined:
19625 <a name="J.3.1" href="#J.3.1"><b> J.3.1 Translation</b></a>
19626 1 -- How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
19627 -- Whether each nonempty sequence of white-space characters other than new-line is
19628 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
19629 <a name="J.3.2" href="#J.3.2"><b> J.3.2 Environment</b></a>
19630 1 -- The mapping between physical source file multibyte characters and the source
19631 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
19632 -- The name and type of the function called at program startup in a freestanding
19633 environment (<a href="#5.1.2.1">5.1.2.1</a>).
19634 -- The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
19635 -- An alternative manner in which the main function may be defined (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
19636 -- 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>).
19637 -- What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
19638 -- The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
19639 -- Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
19640 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
19641 -- Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
19642 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
19643 -- The set of environment names and the method for altering the environment list used
19644 by the getenv function (<a href="#7.20.4.5">7.20.4.5</a>).
19645 -- The manner of execution of the string by the system function (<a href="#7.20.4.6">7.20.4.6</a>).
19646 <a name="J.3.3" href="#J.3.3"><b> J.3.3 Identifiers</b></a>
19647 1 -- Which additional multibyte characters may appear in identifiers and their
19648 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
19649 -- 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>).
19654 [<a name="p505" href="#p505">page 505</a>] (<a href="#Contents">Contents</a>)
19656 <a name="J.3.4" href="#J.3.4"><b> J.3.4 Characters</b></a>
19657 1 -- The number of bits in a byte (<a href="#3.6">3.6</a>).
19658 -- The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
19659 -- The unique value of the member of the execution character set produced for each of
19660 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
19661 -- The value of a char object into which has been stored any character other than a
19662 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
19663 -- Which of signed char or unsigned char has the same range, representation,
19664 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>).
19665 -- The mapping of members of the source character set (in character constants and string
19666 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>).
19667 -- The value of an integer character constant containing more than one character or
19668 containing a character or escape sequence that does not map to a single-byte
19669 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
19670 -- The value of a wide character constant containing more than one multibyte character,
19671 or containing a multibyte character or escape sequence not represented in the
19672 extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
19673 -- The current locale used to convert a wide character constant consisting of a single
19674 multibyte character that maps to a member of the extended execution character set
19675 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
19676 -- The current locale used to convert a wide string literal into corresponding wide
19677 character codes (<a href="#6.4.5">6.4.5</a>).
19678 -- The value of a string literal containing a multibyte character or escape sequence not
19679 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
19680 <a name="J.3.5" href="#J.3.5"><b> J.3.5 Integers</b></a>
19681 1 -- Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
19682 -- Whether signed integer types are represented using sign and magnitude, two's
19683 complement, or ones' complement, and whether the extraordinary value is a trap
19684 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
19685 -- The rank of any extended integer type relative to another extended integer type with
19686 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
19687 -- The result of, or the signal raised by, converting an integer to a signed integer type
19688 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
19692 [<a name="p506" href="#p506">page 506</a>] (<a href="#Contents">Contents</a>)
19694 -- The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
19695 <a name="J.3.6" href="#J.3.6"><b> J.3.6 Floating point</b></a>
19696 1 -- The accuracy of the floating-point operations and of the library functions in
19697 <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>).
19698 -- The accuracy of the conversions between floating-point internal representations and
19699 string representations performed by the library functions in <a href="#7.19">&lt;stdio.h&gt;</a>,
19700 <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>).
19701 -- The rounding behaviors characterized by non-standard values of FLT_ROUNDS
19702 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
19703 -- The evaluation methods characterized by non-standard negative values of
19704 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
19705 -- The direction of rounding when an integer is converted to a floating-point number that
19706 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
19707 -- The direction of rounding when a floating-point number is converted to a narrower
19708 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
19709 -- How the nearest representable value or the larger or smaller representable value
19710 immediately adjacent to the nearest representable value is chosen for certain floating
19711 constants (<a href="#6.4.4.2">6.4.4.2</a>).
19712 -- Whether and how floating expressions are contracted when not disallowed by the
19713 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
19714 -- The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
19715 -- Additional floating-point exceptions, rounding modes, environments, and
19716 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
19717 -- The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>). *
19718 <a name="J.3.7" href="#J.3.7"><b> J.3.7 Arrays and pointers</b></a>
19719 1 -- The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
19720 -- The size of the result of subtracting two pointers to elements of the same array
19721 (<a href="#6.5.6">6.5.6</a>).
19726 [<a name="p507" href="#p507">page 507</a>] (<a href="#Contents">Contents</a>)
19728 <a name="J.3.8" href="#J.3.8"><b> J.3.8 Hints</b></a>
19729 1 -- The extent to which suggestions made by using the register storage-class
19730 specifier are effective (<a href="#6.7.1">6.7.1</a>).
19731 -- The extent to which suggestions made by using the inline function specifier are
19732 effective (<a href="#6.7.4">6.7.4</a>).
19733 <a name="J.3.9" href="#J.3.9"><b> J.3.9 Structures, unions, enumerations, and bit-fields</b></a>
19734 1 -- Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
19735 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
19736 -- Allowable bit-field types other than _Bool, signed int, and unsigned int
19737 (<a href="#6.7.2.1">6.7.2.1</a>).
19738 -- Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
19739 -- The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
19740 -- The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
19741 no problem unless binary data written by one implementation is read by another.
19742 -- The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
19743 <a name="J.3.10" href="#J.3.10"><b> J.3.10 Qualifiers</b></a>
19744 1 -- What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
19745 <a name="J.3.11" href="#J.3.11"><b> J.3.11 Preprocessing directives</b></a>
19746 1 -- The locations within #pragma directives where header name preprocessing tokens
19747 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
19748 -- How sequences in both forms of header names are mapped to headers or external
19749 source file names (<a href="#6.4.7">6.4.7</a>).
19750 -- Whether the value of a character constant in a constant expression that controls
19751 conditional inclusion matches the value of the same character constant in the
19752 execution character set (<a href="#6.10.1">6.10.1</a>).
19753 -- Whether the value of a single-character character constant in a constant expression
19754 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
19755 -- The places that are searched for an included &lt; &gt; delimited header, and how the places
19756 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
19757 -- How the named source file is searched for in an included " " delimited header
19758 (<a href="#6.10.2">6.10.2</a>).
19759 -- The method by which preprocessing tokens (possibly resulting from macro
19760 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
19762 [<a name="p508" href="#p508">page 508</a>] (<a href="#Contents">Contents</a>)
19764 -- The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
19765 -- Whether the # operator inserts a \ character before the \ character that begins a
19766 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
19767 -- The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
19768 -- The definitions for __DATE__ and __TIME__ when respectively, the date and
19769 time of translation are not available (<a href="#6.10.8">6.10.8</a>).
19770 <a name="J.3.12" href="#J.3.12"><b> J.3.12 Library functions</b></a>
19771 1 -- Any library facilities available to a freestanding program, other than the minimal set
19772 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
19773 -- The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
19774 -- The representation of the floating-point status flags stored by the
19775 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
19776 -- Whether the feraiseexcept function raises the ''inexact'' floating-point
19777 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
19778 (<a href="#7.6.2.3">7.6.2.3</a>).
19779 -- Strings other than "C" and "" that may be passed as the second argument to the
19780 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
19781 -- The types defined for float_t and double_t when the value of the
19782 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
19783 -- Domain errors for the mathematics functions, other than those required by this
19784 International Standard (<a href="#7.12.1">7.12.1</a>).
19785 -- The values returned by the mathematics functions on domain errors (<a href="#7.12.1">7.12.1</a>).
19786 -- The values returned by the mathematics functions on underflow range errors, whether
19787 errno is set to the value of the macro ERANGE when the integer expression
19788 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
19789 floating-point exception is raised when the integer expression math_errhandling
19790 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
19791 -- Whether a domain error occurs or zero is returned when an fmod function has a
19792 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
19793 -- Whether a domain error occurs or zero is returned when a remainder function has
19794 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
19795 -- The base-2 logarithm of the modulus used by the remquo functions in reducing the
19796 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
19800 [<a name="p509" href="#p509">page 509</a>] (<a href="#Contents">Contents</a>)
19802 -- Whether a domain error occurs or zero is returned when a remquo function has a
19803 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
19804 -- Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
19805 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>).
19806 -- The null pointer constant to which the macro NULL expands (<a href="#7.17">7.17</a>).
19807 -- Whether the last line of a text stream requires a terminating new-line character
19808 (<a href="#7.19.2">7.19.2</a>).
19809 -- Whether space characters that are written out to a text stream immediately before a
19810 new-line character appear when read in (<a href="#7.19.2">7.19.2</a>).
19811 -- The number of null characters that may be appended to data written to a binary
19812 stream (<a href="#7.19.2">7.19.2</a>).
19813 -- Whether the file position indicator of an append-mode stream is initially positioned at
19814 the beginning or end of the file (<a href="#7.19.3">7.19.3</a>).
19815 -- Whether a write on a text stream causes the associated file to be truncated beyond that
19816 point (<a href="#7.19.3">7.19.3</a>).
19817 -- The characteristics of file buffering (<a href="#7.19.3">7.19.3</a>).
19818 -- Whether a zero-length file actually exists (<a href="#7.19.3">7.19.3</a>).
19819 -- The rules for composing valid file names (<a href="#7.19.3">7.19.3</a>).
19820 -- Whether the same file can be simultaneously open multiple times (<a href="#7.19.3">7.19.3</a>).
19821 -- The nature and choice of encodings used for multibyte characters in files (<a href="#7.19.3">7.19.3</a>).
19822 -- The effect of the remove function on an open file (<a href="#7.19.4.1">7.19.4.1</a>).
19823 -- The effect if a file with the new name exists prior to a call to the rename function
19824 (<a href="#7.19.4.2">7.19.4.2</a>).
19825 -- Whether an open temporary file is removed upon abnormal program termination
19826 (<a href="#7.19.4.3">7.19.4.3</a>).
19827 -- Which changes of mode are permitted (if any), and under what circumstances
19828 (<a href="#7.19.5.4">7.19.5.4</a>).
19829 -- The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
19830 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>).
19831 -- The output for %p conversion in the fprintf or fwprintf function (<a href="#7.19.6.1">7.19.6.1</a>,
19832 <a href="#7.24.2.1">7.24.2.1</a>).
19833 -- The interpretation of a - character that is neither the first nor the last character, nor
19834 the second where a ^ character is the first, in the scanlist for %[ conversion in the
19835 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>).
19836 [<a name="p510" href="#p510">page 510</a>] (<a href="#Contents">Contents</a>)
19838 -- The set of sequences matched by a %p conversion and the interpretation of the
19839 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>).
19840 -- The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
19841 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>).
19842 -- The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
19843 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
19844 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>).
19845 -- Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
19846 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>).
19847 -- Whether the calloc, malloc, and realloc functions return a null pointer or a
19848 pointer to an allocated object when the size requested is zero (<a href="#7.20.3">7.20.3</a>).
19849 -- Whether open streams with unwritten buffered data are flushed, open streams are
19850 closed, or temporary files are removed when the abort or _Exit function is called
19851 (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.4">7.20.4.4</a>).
19852 -- The termination status returned to the host environment by the abort, exit, or
19853 _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>).
19854 -- The value returned by the system function when its argument is not a null pointer
19855 (<a href="#7.20.4.6">7.20.4.6</a>).
19856 -- The local time zone and Daylight Saving Time (<a href="#7.23.1">7.23.1</a>).
19857 -- The range and precision of times representable in clock_t and time_t (<a href="#7.23">7.23</a>).
19858 -- The era for the clock function (<a href="#7.23.2.1">7.23.2.1</a>).
19859 -- The replacement string for the %Z specifier to the strftime, and wcsftime
19860 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>).
19861 -- Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
19862 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.9">F.9</a>).
19863 <a name="J.3.13" href="#J.3.13"><b> J.3.13 Architecture</b></a>
19864 1 -- The values or expressions assigned to the macros specified in the headers
19865 <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>).
19866 -- The number, order, and encoding of bytes in any object (when not explicitly specified
19867 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
19868 -- The value of the result of the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>).
19873 [<a name="p511" href="#p511">page 511</a>] (<a href="#Contents">Contents</a>)
19875 <a name="J.4" href="#J.4"><b> J.4 Locale-specific behavior</b></a>
19876 1 The following characteristics of a hosted environment are locale-specific and are required
19877 to be documented by the implementation:
19878 -- Additional members of the source and execution character sets beyond the basic
19879 character set (<a href="#5.2.1">5.2.1</a>).
19880 -- The presence, meaning, and representation of additional multibyte characters in the
19881 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
19882 -- The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
19883 -- The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
19884 -- The decimal-point character (<a href="#7.1.1">7.1.1</a>).
19885 -- The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
19886 -- The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
19887 -- The sets of characters tested for by the isalpha, isblank, islower, ispunct,
19888 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
19889 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>,
19890 <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>).
19891 -- The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
19892 -- Additional subject sequences accepted by the numeric conversion functions (<a href="#7.20.1">7.20.1</a>,
19893 <a href="#7.24.4.1">7.24.4.1</a>).
19894 -- 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>).
19895 -- The contents of the error message strings set up by the strerror function
19896 (<a href="#7.21.6.2">7.21.6.2</a>).
19897 -- 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>).
19898 -- Character mappings that are supported by the towctrans function (<a href="#7.25.1">7.25.1</a>).
19899 -- Character classifications that are supported by the iswctype function (<a href="#7.25.1">7.25.1</a>).
19904 [<a name="p512" href="#p512">page 512</a>] (<a href="#Contents">Contents</a>)
19906 <a name="J.5" href="#J.5"><b> J.5 Common extensions</b></a>
19907 1 The following extensions are widely used in many systems, but are not portable to all
19908 implementations. The inclusion of any extension that may cause a strictly conforming
19909 program to become invalid renders an implementation nonconforming. Examples of such
19910 extensions are new keywords, extra library functions declared in standard headers, or
19911 predefined macros with names that do not begin with an underscore.
19912 <a name="J.5.1" href="#J.5.1"><b> J.5.1 Environment arguments</b></a>
19913 1 In a hosted environment, the main function receives a third argument, char *envp[],
19914 that points to a null-terminated array of pointers to char, each of which points to a string
19915 that provides information about the environment for this execution of the program
19916 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
19917 <a name="J.5.2" href="#J.5.2"><b> J.5.2 Specialized identifiers</b></a>
19918 1 Characters other than the underscore _, letters, and digits, that are not part of the basic
19919 source character set (such as the dollar sign $, or characters in national character sets)
19920 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
19921 <a name="J.5.3" href="#J.5.3"><b> J.5.3 Lengths and cases of identifiers</b></a>
19922 1 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
19923 <a name="J.5.4" href="#J.5.4"><b> J.5.4 Scopes of identifiers</b></a>
19924 1 A function identifier, or the identifier of an object the declaration of which contains the
19925 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
19926 <a name="J.5.5" href="#J.5.5"><b> J.5.5 Writable string literals</b></a>
19927 1 String literals are modifiable (in which case, identical string literals should denote distinct
19928 objects) (<a href="#6.4.5">6.4.5</a>).
19929 <a name="J.5.6" href="#J.5.6"><b> J.5.6 Other arithmetic types</b></a>
19930 1 Additional arithmetic types, such as __int128 or double double, and their
19931 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
19932 more range or precision than long double, may be used for evaluating expressions of
19933 other floating types, and may be used to define float_t or double_t.
19938 [<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
19940 <a name="J.5.7" href="#J.5.7"><b> J.5.7 Function pointer casts</b></a>
19941 1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
19942 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
19943 2 A pointer to a function may be cast to a pointer to an object or to void, allowing a
19944 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
19945 <a name="J.5.8" href="#J.5.8"><b> J.5.8 Extended bit-field types</b></a>
19946 1 A bit-field may be declared with a type other than _Bool, unsigned int, or
19947 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
19948 <a name="J.5.9" href="#J.5.9"><b> J.5.9 The fortran keyword</b></a>
19949 1 The fortran function specifier may be used in a function declaration to indicate that
19950 calls suitable for FORTRAN should be generated, or that a different representation for the
19951 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
19952 <a name="J.5.10" href="#J.5.10"><b> J.5.10 The asm keyword</b></a>
19953 1 The asm keyword may be used to insert assembly language directly into the translator
19954 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
19955 asm ( character-string-literal );
19956 <a name="J.5.11" href="#J.5.11"><b> J.5.11 Multiple external definitions</b></a>
19957 1 There may be more than one external definition for the identifier of an object, with or
19958 without the explicit use of the keyword extern; if the definitions disagree, or more than
19959 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
19960 <a name="J.5.12" href="#J.5.12"><b> J.5.12 Predefined macro names</b></a>
19961 1 Macro names that do not begin with an underscore, describing the translation and
19962 execution environments, are defined by the implementation before translation begins
19963 (<a href="#6.10.8">6.10.8</a>).
19964 <a name="J.5.13" href="#J.5.13"><b> J.5.13 Floating-point status flags</b></a>
19965 1 If any floating-point status flags are set on normal termination after all calls to functions
19966 registered by the atexit function have been made (see <a href="#7.20.4.3">7.20.4.3</a>), the implementation
19967 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
19972 [<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
19974 <a name="J.5.14" href="#J.5.14"><b> J.5.14 Extra arguments for signal handlers</b></a>
19975 1 Handlers for specific signals are called with extra arguments in addition to the signal
19976 number (<a href="#7.14.1.1">7.14.1.1</a>).
19977 <a name="J.5.15" href="#J.5.15"><b> J.5.15 Additional stream types and file-opening modes</b></a>
19978 1 Additional mappings from files to streams are supported (<a href="#7.19.2">7.19.2</a>).
19979 2 Additional file-opening modes may be specified by characters appended to the mode
19980 argument of the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
19981 <a name="J.5.16" href="#J.5.16"><b> J.5.16 Defined file position indicator</b></a>
19982 1 The file position indicator is decremented by each successful call to the ungetc or
19983 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>,
19984 <a name="7.24.3.10)" href="#7.24.3.10)"><b> 7.24.3.10).</b></a>
19985 <a name="J.5.17" href="#J.5.17"><b> J.5.17 Math error reporting</b></a>
19986 1 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
19987 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
19988 <a name="7.12)" href="#7.12)"><b> 7.12).</b></a>
19993 [<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
19996 <a name="Bibliography" href="#Bibliography"><b> Bibliography</b></a>
19997 1. ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
19998 published in The C Programming Language by Brian W. Kernighan and Dennis
19999 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
20000 2. 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
20001 California, USA, November 1984.
20002 3. ANSI X3/TR-1-82 (1982), American National Dictionary for Information
20003 Processing Systems, Information Processing Systems Technical Report.
20004 4. ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
20005 Arithmetic.
20006 5. ANSI/IEEE 854-1988, American National Standard for Radix-Independent
20007 Floating-Point Arithmetic.
20008 6. IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
20009 second edition (previously designated IEC 559:1989).
20010 7. ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
20011 symbols for use in the physical sciences and technology.
20012 8. ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
20013 information interchange.
20014 9. ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
20015 Fundamental terms.
20016 10. ISO 4217:1995, Codes for the representation of currencies and funds.
20017 11. ISO 8601:1988, Data elements and interchange formats -- Information
20018 interchange -- Representation of dates and times.
20019 12. ISO/IEC 9899:1990, Programming languages -- C.
20020 13. ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
20021 14. ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
20022 15. ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
20023 16. ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
20024 Interface (POSIX) -- Part 2: Shell and Utilities.
20025 17. ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
20026 preparation of programming language standards.
20027 18. ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
20028 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
20030 [<a name="p516" href="#p516">page 516</a>] (<a href="#Contents">Contents</a>)
20032 19. ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
20033 ISO/IEC 10646-1:1993.
20034 20. ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
20035 ISO/IEC 10646-1:1993.
20036 21. ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
20037 Transformation Format for 16 planes of group 00 (UTF-16).
20038 22. ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
20039 Transformation Format 8 (UTF-8).
20040 23. ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
20041 24. ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
20042 25. ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
20043 syllables.
20044 26. ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993 Tibetan.
20045 27. ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
20046 additional characters.
20047 28. ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
20048 29. ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
20049 Identifiers for characters.
20050 30. ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
20051 Ethiopic.
20052 31. ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
20053 Unified Canadian Aboriginal Syllabics.
20054 32. ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
20055 Cherokee.
20056 33. ISO/IEC 10967-1:1994, Information technology -- Language independent
20057 arithmetic -- Part 1: Integer and floating point arithmetic.
20062 [<a name="p517" href="#p517">page 517</a>] (<a href="#Contents">Contents</a>)
20066 [<a name="p518" href="#p518">page 518</a>] (<a href="#Contents">Contents</a>)
20069 <a name="Index" href="#Index"><b>Index</b></a>
20070 ??? 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>,
20071 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>
20072 ??? 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>
20073 ! (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>
20074 != (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>
20075 # 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>
20076 # 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>
20077 # punctuator, <a href="#6.10">6.10</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
20078 ## 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>,
20079 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> <a href="#6.5.2.3">6.5.2.3</a>
20080 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.8">6.7.8</a>
20081 #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>
20082 #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>
20083 #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>
20084 #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>
20085 <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>
20086 #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>
20087 #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>
20088 #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>,
20089 <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>
20090 #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>
20091 #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>
20092 #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>
20093 <a href="#7.1.4">7.1.4</a> &lt;&lt; (left-shift operator), <a href="#6.5.7">6.5.7</a>
20094 % (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>
20095 %: (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>
20096 %:%: (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>
20097 %= (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>,
20098 %&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>
20099 &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>
20100 &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>
20101 &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>,
20102 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#H">H</a>
20103 ' ' (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>,
20104 <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>
20105 ( ) (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>
20106 ( ) (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>
20107 ( ) (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>
20108 ( ){ } (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>
20109 * (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>,
20110 * (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>
20111 * (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>
20112 *= (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>
20113 + (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>
20114 <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>
20115 + (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>,
20116 ++ (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>
20117 ++ (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>,
20118 += (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>
20119 , (comma operator), <a href="#6.5.17">6.5.17</a>
20120 [<a name="p519" href="#p519">page 519</a>] (<a href="#Contents">Contents</a>)
20122 <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>
20123 <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>
20124 <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>
20125 <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>
20126 <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>
20127 <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>
20128 <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>
20129 <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>
20130 = (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>
20131 = (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>
20132 == (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>
20133 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
20134 &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>
20135 &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>
20136 &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>,
20137 ? : (conditional operator), <a href="#6.5.15">6.5.15</a> <a href="#7.18.3">7.18.3</a>
20138 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
20139 [ ] (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>
20140 [ ] (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>
20141 \ (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>
20142 \ (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>
20143 \" (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>
20144 <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>
20145 \\ (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>
20146 \' (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>
20147 \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>
20148 padding of binary stream, <a href="#7.19.2">7.19.2</a> _Imaginary keyword, <a href="#G.2">G.2</a>
20149 \? (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>
20150 \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>
20151 \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>
20152 \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>
20153 <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>
20154 \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>
20155 <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>,
20156 \octal digits (octal-character escape sequence), <a href="#6.8.2">6.8.2</a>
20157 <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>
20158 \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>
20159 <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),
20160 \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>
20161 <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>
20162 \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>
20163 \u (universal character names), <a href="#6.4.3">6.4.3</a>
20164 \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>,
20165 <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.20.4.1">7.20.4.1</a>
20166 \x hexadecimal digits (hexadecimal-character abs function, <a href="#7.20.6.1">7.20.6.1</a>
20167 escape sequence), <a href="#6.4.4.4">6.4.4.4</a> absolute-value functions
20168 ^ (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>
20169 ^= (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>
20170 <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>
20171 __bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
20172 macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
20174 [<a name="p520" href="#p520">page 520</a>] (<a href="#Contents">Contents</a>)
20176 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
20177 accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
20178 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>
20179 acos type-generic macro, <a href="#7.22">7.22</a> initialization, <a href="#6.7.8">6.7.8</a>
20180 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>
20181 acosh type-generic macro, <a href="#7.22">7.22</a> parameter, <a href="#6.9.1">6.9.1</a>
20182 active position, <a href="#5.2.2">5.2.2</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
20183 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>
20184 actual parameter (deprecated), <a href="#3.3">3.3</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
20185 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> type, <a href="#6.2.5">6.2.5</a>
20186 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>
20187 <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>
20188 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>
20189 address constant, <a href="#6.6">6.6</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
20190 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>
20191 aggregate initialization, <a href="#6.7.8">6.7.8</a> asctime function, <a href="#7.23.3.1">7.23.3.1</a>
20192 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>
20193 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>
20194 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>
20195 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>
20196 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>
20197 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>
20198 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>
20199 and macro, <a href="#7.9">7.9</a> assignment
20200 AND operators compound, <a href="#6.5.16.2">6.5.16.2</a>
20201 bitwise (&amp;), <a href="#6.5.10">6.5.10</a> conversion, <a href="#6.5.16.1">6.5.16.1</a>
20202 bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> expression, <a href="#6.5.16">6.5.16</a>
20203 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>
20204 and_eq macro, <a href="#7.9">7.9</a> simple, <a href="#6.5.16.1">6.5.16.1</a>
20205 ANSI/IEEE 754, <a href="#F.1">F.1</a> associativity of operators, <a href="#6.5">6.5</a>
20206 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>
20207 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>
20208 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>
20209 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>
20210 default promotions, <a href="#6.5.2.2">6.5.2.2</a> atan2 type-generic macro, <a href="#7.22">7.22</a>
20211 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>
20212 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>
20213 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>,
20214 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>
20215 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>
20216 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>
20217 conversions atol function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
20218 arithmetic operators atoll function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
20219 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>
20220 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>
20221 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>
20222 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>
20223 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>
20224 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>
20225 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>
20226 arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
20228 [<a name="p521" href="#p521">page 521</a>] (<a href="#Contents">Contents</a>)
20230 behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
20231 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>,
20232 <a href="#7.19.9.4">7.19.9.4</a> <a href="#7.20.3.4">7.20.3.4</a>
20233 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>
20234 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>
20235 low order, <a href="#3.6">3.6</a> carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>,
20236 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>
20237 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>
20238 bitor macro, <a href="#7.9">7.9</a> case mapping functions
20239 bitwise operators, <a href="#6.5">6.5</a> character, <a href="#7.4.2">7.4.2</a>
20240 AND, <a href="#6.5.10">6.5.10</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
20241 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>
20242 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>
20243 exclusive OR, <a href="#6.5.11">6.5.11</a> type-generic macro for, <a href="#7.22">7.22</a>
20244 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>
20245 inclusive OR, <a href="#6.5.12">6.5.12</a> type-generic macro for, <a href="#7.22">7.22</a>
20246 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>
20247 shift, <a href="#6.5.7">6.5.7</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
20248 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>
20249 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>
20250 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>
20251 block structure, <a href="#6.2.1">6.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
20252 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>
20253 bool macro, <a href="#7.16">7.16</a> cbrt type-generic macro, <a href="#7.22">7.22</a>
20254 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>
20255 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>
20256 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>
20257 <a href="#6.8.2">6.8.2</a> type-generic macro for, <a href="#7.22">7.22</a>
20258 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>
20259 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>
20260 branch cuts, <a href="#7.3.3">7.3.3</a> cerf function, <a href="#7.26.1">7.26.1</a>
20261 break statement, <a href="#6.8.6.3">6.8.6.3</a> cerfc function, <a href="#7.26.1">7.26.1</a>
20262 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>
20263 <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>
20264 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>
20265 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>
20266 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>
20267 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>,
20268 byte input/output functions, <a href="#7.19.1">7.19.1</a> <a href="#6.3.1.8">6.3.1.8</a>
20269 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>
20270 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>
20271 C 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>
20272 C++, <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>
20273 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>
20274 type-generic macro for, <a href="#7.22">7.22</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
20275 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>
20276 type-generic macro for, <a href="#7.22">7.22</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
20277 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>
20278 type-generic macro for, <a href="#7.22">7.22</a> wide character, <a href="#7.25.2.1">7.25.2.1</a>
20279 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>
20280 <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>
20282 [<a name="p522" href="#p522">page 522</a>] (<a href="#Contents">Contents</a>)
20284 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>,
20285 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>
20286 character input/output functions, <a href="#7.19.7">7.19.7</a> compliance, see conformance
20287 wide character, <a href="#7.24.3">7.24.3</a> components of time, <a href="#7.23.1">7.23.1</a>
20288 character sets, <a href="#5.2.1">5.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
20289 character string literal, see string literal compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
20290 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>
20291 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>
20292 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>
20293 cimag type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> concatenation functions
20294 cis function, <a href="#G.6">G.6</a> string, <a href="#7.21.3">7.21.3</a>
20295 classification functions wide string, <a href="#7.24.4.3">7.24.4.3</a>
20296 character, <a href="#7.4.1">7.4.1</a> concatenation, preprocessing, see preprocessing
20297 floating-point, <a href="#7.12.3">7.12.3</a> concatenation
20298 wide character, <a href="#7.25.2.1">7.25.2.1</a> conceptual models, <a href="#5.1">5.1</a>
20299 extensible, <a href="#7.25.2.2">7.25.2.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
20300 clearerr function, <a href="#7.19.10.1">7.19.10.1</a> conditional operator (? :), <a href="#6.5.15">6.5.15</a>
20301 clgamma function, <a href="#7.26.1">7.26.1</a> conformance, <a href="#4">4</a>
20302 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>
20303 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>
20304 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>
20305 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>
20306 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>
20307 clog10 function, <a href="#7.26.1">7.26.1</a> constants, <a href="#6.4.4">6.4.4</a>
20308 clog1p function, <a href="#7.26.1">7.26.1</a> as primary expression, <a href="#6.5.1">6.5.1</a>
20309 clog2 function, <a href="#7.26.1">7.26.1</a> character, <a href="#6.4.4.4">6.4.4.4</a>
20310 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>
20311 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>
20312 comma operator (,), <a href="#6.5.17">6.5.17</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
20313 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>
20314 <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>
20315 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>
20316 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>
20317 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>
20318 common extensions, <a href="#J.5">J.5</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
20319 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>
20320 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>
20321 common warnings, <a href="#I">I</a> control wide character, <a href="#7.25.2">7.25.2</a>
20322 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>
20323 string, <a href="#7.21.4">7.21.4</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
20324 wide string, <a href="#7.24.4.4">7.24.4.4</a> array argument, <a href="#6.9.1">6.9.1</a> *
20325 comparison macros, <a href="#7.12.14">7.12.14</a> array parameter, <a href="#6.9.1">6.9.1</a>
20326 comparison, pointer, <a href="#6.5.8">6.5.8</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
20327 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>
20328 compl macro, <a href="#7.9">7.9</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
20329 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>
20330 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>
20331 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>
20332 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>
20333 complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
20334 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>
20336 [<a name="p523" href="#p523">page 523</a>] (<a href="#Contents">Contents</a>)
20338 function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
20339 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>
20340 imaginary, <a href="#G.4.1">G.4.1</a> type-generic macro for, <a href="#7.22">7.22</a>
20341 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>
20342 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.22">7.22</a>
20343 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>
20344 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>
20345 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>
20346 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.22">7.22</a>
20347 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>
20348 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>
20349 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>
20350 usual arithmetic, see usual arithmetic current object, <a href="#6.7.8">6.7.8</a>
20351 conversions CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
20352 void type, <a href="#6.3.2.2">6.3.2.2</a>
20353 conversion functions data stream, see streams
20354 multibyte/wide character, <a href="#7.20.7">7.20.7</a> date and time header, <a href="#7.23">7.23</a>
20355 extended, <a href="#7.24.6">7.24.6</a> Daylight Saving Time, <a href="#7.23.1">7.23.1</a>
20356 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>
20357 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>
20358 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>
20359 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>
20360 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>
20361 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>
20362 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>
20363 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>
20364 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>
20365 <a href="#7.24.2.2">7.24.2.2</a> decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
20366 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>
20367 <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>
20368 <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>,
20369 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>
20370 copying functions declaration specifiers, <a href="#6.7">6.7</a>
20371 string, <a href="#7.21.2">7.21.2</a> declarations, <a href="#6.7">6.7</a>
20372 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>
20373 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>
20374 <a href="#F.9.8.1">F.9.8.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
20375 copysign type-generic macro, <a href="#7.22">7.22</a> typedef, <a href="#6.7.7">6.7.7</a>
20376 correctly rounded result, <a href="#3.9">3.9</a> declarator, <a href="#6.7.5">6.7.5</a>
20377 corresponding real type, <a href="#6.2.5">6.2.5</a> abstract, <a href="#6.7.6">6.7.6</a>
20378 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>
20379 cos type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
20380 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
20381 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>
20382 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>
20383 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>
20384 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>
20385 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>
20386 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>
20387 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>
20388 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>
20390 [<a name="p524" href="#p524">page 524</a>] (<a href="#Contents">Contents</a>)
20392 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>,
20393 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>,
20394 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>,
20395 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>
20396 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
20397 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>
20398 diagnostics header, <a href="#7.2">7.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
20399 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>
20400 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>
20401 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>
20402 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>
20403 display device, <a href="#5.2.2">5.2.2</a> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
20404 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>
20405 div_t type, <a href="#7.20">7.20</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
20406 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>
20407 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>
20408 do statement, <a href="#6.8.5.2">6.8.5.2</a> environment, <a href="#5">5</a>
20409 documentation of implementation, <a href="#4">4</a> environment functions, <a href="#7.20.4">7.20.4</a>
20410 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>
20411 <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>
20412 <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>,
20413 <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>,
20414 <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>
20415 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>,
20416 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>,
20417 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>,
20418 <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>,
20419 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>,
20420 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>,
20421 <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>
20422 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>
20423 <a href="#6.3.1.8">6.3.1.8</a> equal-to operator, see equality operator
20424 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>
20425 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>
20426 <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>,
20427 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
20428 also range error
20429 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>
20430 effective type, <a href="#6.5">6.5</a> erf type-generic macro, <a href="#7.22">7.22</a>
20431 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>
20432 <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>
20433 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>,
20434 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>,
20435 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>,
20436 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>,
20437 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>
20438 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>
20439 empty statement, <a href="#6.8.3">6.8.3</a> error
20440 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
20441 <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
20442 end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
20444 [<a name="p525" href="#p525">page 525</a>] (<a href="#Contents">Contents</a>)
20446 error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
20447 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>,
20448 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>
20449 <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
20450 <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>
20451 <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,
20452 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>
20453 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,
20454 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.25.2.2">7.25.2.2</a>
20455 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>
20456 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>
20457 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>
20458 evaluation order, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
20459 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>
20460 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>
20461 <a href="#6.8.6.4">6.8.6.4</a>
20462 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>
20463 exclusive OR operators fabs type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
20464 bitwise (^), <a href="#6.5.11">6.5.11</a> false macro, <a href="#7.16">7.16</a>
20465 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>
20466 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>
20467 execution character set, <a href="#5.2.1">5.2.1</a> fdim type-generic macro, <a href="#7.22">7.22</a>
20468 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>
20469 environmental limits FE_DFL_ENV macro, <a href="#7.6">7.6</a>
20470 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>
20471 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>
20472 <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>
20473 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>
20474 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>
20475 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>
20476 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>
20477 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>
20478 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>
20479 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>
20480 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>
20481 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>
20482 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>
20483 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>,
20484 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>
20485 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>
20486 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>,
20487 assignment, <a href="#6.5.16">6.5.16</a> <a href="#F.9">F.9</a>
20488 cast, <a href="#6.5.4">6.5.4</a> fenv_t type, <a href="#7.6">7.6</a>
20489 constant, <a href="#6.6">6.6</a> feof function, <a href="#7.19.10.2">7.19.10.2</a>
20490 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>
20491 order of evaluation, <a href="#6.5">6.5</a> ferror function, <a href="#7.19.10.3">7.19.10.3</a>
20492 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>
20493 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>
20494 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>
20495 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>
20496 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>
20498 [<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
20500 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>
20501 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>
20502 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>
20503 <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>
20504 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>
20505 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>,
20506 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>
20507 <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>
20508 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>
20509 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>
20510 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>
20511 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>
20512 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>
20513 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>
20514 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>,
20515 <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>
20516 <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>
20517 <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>
20518 <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>
20519 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>
20520 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>
20521 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>
20522 FILENAME_MAX macro, <a href="#7.19.1">7.19.1</a> fmin type-generic macro, <a href="#7.22">7.22</a>
20523 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>
20524 floating-point status, see floating-point status fmod type-generic macro, <a href="#7.22">7.22</a>
20525 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>
20526 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>
20527 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>
20528 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>
20529 <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>,
20530 float _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.4.1.10">7.4.1.10</a>
20531 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>
20532 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>
20533 <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>
20534 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>
20535 <a href="#7.24.4.1.1">7.24.4.1.1</a> fortran keyword, <a href="#J.5.9">J.5.9</a>
20536 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>
20537 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
20538 floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a> also contracted expression
20539 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>
20540 <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>
20541 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>
20542 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>
20543 <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>
20544 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>
20545 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>
20546 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>
20547 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>
20548 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>
20549 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>
20550 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>
20552 [<a name="p527" href="#p527">page 527</a>] (<a href="#Contents">Contents</a>)
20554 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>
20555 <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>
20556 <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>
20557 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>,
20558 <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>,
20559 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>
20560 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>
20561 <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>,
20562 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>
20563 fread function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.1">7.19.8.1</a>
20564 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>
20565 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>
20566 <a href="#5.1.2.1">5.1.2.1</a> wide string, <a href="#7.24.4">7.24.4</a>
20567 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>
20568 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>
20569 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>
20570 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>
20571 <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>
20572 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>
20573 <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>
20574 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>
20575 <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>
20576 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>
20577 full declarator, <a href="#6.7.5">6.7.5</a> graphic characters, <a href="#5.2.1">5.2.1</a>
20578 full expression, <a href="#6.8">6.8</a> greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a>
20579 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>
20580 function
20581 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
20582 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>
20583 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>
20584 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>
20585 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>
20586 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
20587 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>
20588 image, <a href="#5.2.3">5.2.3</a> high-order bit, <a href="#3.6">3.6</a>
20589 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>
20590 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>
20591 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>,
20592 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>
20593 <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>
20594 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>,
20595 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>
20596 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>,
20597 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>
20598 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>,
20599 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>
20600 function specifiers, <a href="#6.7.4">6.7.4</a> hyperbolic functions
20601 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>
20602 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>
20603 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>
20604 future directions hypot type-generic macro, <a href="#7.22">7.22</a>
20606 [<a name="p528" href="#p528">page 528</a>] (<a href="#Contents">Contents</a>)
20608 I 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>
20609 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>
20610 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>,
20611 maximum length, <a href="#6.4.2.1">6.4.2.1</a> <a href="#F.7.5">F.7.5</a>
20612 name spaces, <a href="#6.2.3">6.2.3</a> in blocks, <a href="#6.8">6.8</a>
20613 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>
20614 scope, <a href="#6.2.1">6.2.1</a> permitted form, <a href="#6.6">6.6</a>
20615 type, <a href="#6.2.5">6.2.5</a> string literal, <a href="#6.3.2.1">6.3.2.1</a>
20616 identifier list, <a href="#6.7.5">6.7.5</a> inline, <a href="#6.7.4">6.7.4</a>
20617 identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a> inner scope, <a href="#6.2.1">6.2.1</a>
20618 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>
20619 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
20620 <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>
20621 IEEE 754, <a href="#F.1">F.1</a> direct, <a href="#7.19.8">7.19.8</a>
20622 IEEE 854, <a href="#F.1">F.1</a> formatted, <a href="#7.19.6">7.19.6</a>
20623 IEEE floating-point arithmetic standard, see wide character, <a href="#7.24.2">7.24.2</a>
20624 IEC 60559, ANSI/IEEE 754, wide character, <a href="#7.24.3">7.24.3</a>
20625 ANSI/IEEE 854 formatted, <a href="#7.24.2">7.24.2</a>
20626 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>
20627 <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>
20628 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>
20629 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>,
20630 ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.3.1.8">6.3.1.8</a>
20631 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>
20632 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>
20633 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>
20634 imaginary numbers, <a href="#G">G</a> INT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
20635 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>
20636 imaginary types, <a href="#G">G</a> int_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
20637 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>
20638 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>
20639 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>,
20640 implementation, <a href="#3.12">3.12</a> <a href="#7.20.6">7.20.6</a>
20641 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>
20642 <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>
20643 limits integer constant expression, <a href="#6.6">6.6</a>
20644 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>
20645 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>,
20646 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>,
20647 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>
20648 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>
20649 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>,
20650 bitwise (|), <a href="#6.5.12">6.5.12</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
20651 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>
20652 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>
20653 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>
20654 increment and decrement internal linkage, <a href="#6.2.2">6.2.2</a>
20655 indeterminate value, <a href="#3.17.2">3.17.2</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
20656 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>
20657 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>
20658 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>
20660 [<a name="p529" href="#p529">page 529</a>] (<a href="#Contents">Contents</a>)
20662 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>,
20663 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>
20664 <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>
20665 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>,
20666 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>
20667 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>
20668 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>,
20669 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>
20670 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>,
20671 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>
20672 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>,
20673 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>
20674 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>,
20675 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>
20676 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>,
20677 <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>,
20678 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>
20679 <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>,
20680 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>,
20681 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>,
20682 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>
20683 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>,
20684 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>
20685 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>
20686 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>
20687 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>
20688 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>
20689 <a href="#7.4.2.2">7.4.2.2</a>
20690 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>
20691 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a> jump statements, <a href="#6.8.6">6.8.6</a>
20692 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
20693 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>
20694 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>
20695 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>
20696 ISO/IEC 10976-1, <a href="#H.1">H.1</a> <a href="#L">L</a>_tmpnam macro, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.4.4">7.19.4.4</a>
20697 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>
20698 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>
20699 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labs function, <a href="#7.20.6.1">7.20.6.1</a>
20700 ISO/IEC TR 10176, <a href="#D">D</a> language, <a href="#6">6</a>
20701 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> future directions, <a href="#6.11">6.11</a>
20702 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>
20703 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>
20704 <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>
20705 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>,
20706 <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>
20707 <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>,
20708 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>,
20709 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>
20710 <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>
20711 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>
20712 <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>
20714 [<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
20716 lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
20717 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>
20718 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>
20719 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>,
20720 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>
20721 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>,
20722 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>
20723 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>
20724 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>
20725 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>
20726 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>
20727 ldexp type-generic macro, <a href="#7.22">7.22</a> local time, <a href="#7.23.1">7.23.1</a>
20728 ldiv function, <a href="#7.20.6.2">7.20.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
20729 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>
20730 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>
20731 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>
20732 left-shift operator (&lt;&lt;), <a href="#6.5.7">6.5.7</a> localization, <a href="#7.11">7.11</a>
20733 length localtime function, <a href="#7.23.3.4">7.23.3.4</a>
20734 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>
20735 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>
20736 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>
20737 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>
20738 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>
20739 <a href="#7.24.6.3.1">7.24.6.3.1</a> log1p type-generic macro, <a href="#7.22">7.22</a>
20740 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>
20741 <a href="#7.24.2.2">7.24.2.2</a> log2 type-generic macro, <a href="#7.22">7.22</a>
20742 less-than operator (&lt;), <a href="#6.5.8">6.5.8</a> logarithmic functions
20743 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>
20744 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>
20745 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>
20746 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>
20747 lgamma type-generic macro, <a href="#7.22">7.22</a> logical operators
20748 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>
20749 future directions, <a href="#7.26">7.26</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
20750 summary, <a href="#B">B</a> OR (||), <a href="#6.5.14">6.5.14</a>
20751 terms, <a href="#7.1.1">7.1.1</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
20752 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>
20753 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type conversion,
20754 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>
20755 environmental, see environmental limits long double _Imaginary type, <a href="#G.2">G.2</a>
20756 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>
20757 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>,
20758 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>
20759 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>,
20760 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>
20761 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>,
20762 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>
20763 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>,
20764 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>
20765 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>
20766 <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>,
20768 [<a name="p531" href="#p531">page 531</a>] (<a href="#Contents">Contents</a>)
20770 <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>
20771 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>
20772 <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>,
20773 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>,
20774 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>
20775 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>
20776 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>,
20777 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.24.6.3">7.24.6.3</a>
20778 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>
20779 lowercase letter, <a href="#5.2.1">5.2.1</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
20780 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>
20781 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>
20782 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>
20783 lround type-generic macro, <a href="#7.22">7.22</a> memmove function, <a href="#7.21.2.2">7.21.2.2</a>
20784 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>
20785 memset function, <a href="#7.21.6.1">7.21.6.1</a>
20786 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>
20787 macro definition minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
20788 library function, <a href="#7.1.4">7.1.4</a> miscellaneous functions
20789 macro invocation, <a href="#6.10.3">6.10.3</a> string, <a href="#7.21.6">7.21.6</a>
20790 macro name, <a href="#6.10.3">6.10.3</a> wide string, <a href="#7.24.4.6">7.24.4.6</a>
20791 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>
20792 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>
20793 redefinition, <a href="#6.10.3">6.10.3</a> modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
20794 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>
20795 macro parameter, <a href="#6.10.3">6.10.3</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
20796 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>
20797 macro replacement, <a href="#6.10.3">6.10.3</a> multibyte conversion functions
20798 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> wide character, <a href="#7.20.7">7.20.7</a>
20799 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>
20800 <a href="#7.19.3">7.19.3</a> restartable, <a href="#7.24.6.3">7.24.6.3</a>
20801 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>
20802 <a href="#7.20.3.4">7.20.3.4</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
20803 manipulation functions multibyte string, <a href="#7.1.1">7.1.1</a>
20804 complex, <a href="#7.3.9">7.3.9</a> multibyte/wide character conversion functions,
20805 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>
20806 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>
20807 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>
20808 <a href="#J.5.17">J.5.17</a> multibyte/wide string conversion functions, <a href="#7.20.8">7.20.8</a>
20809 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>
20810 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>
20811 MATH_ERRNO macro, <a href="#7.12">7.12</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
20812 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>
20813 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>
20814 <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>
20815 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>
20816 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>
20817 mbrlen function, <a href="#7.24.6.3.1">7.24.6.3.1</a> name
20818 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>
20819 <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>
20820 <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>
20822 [<a name="p532" href="#p532">page 532</a>] (<a href="#Contents">Contents</a>)
20824 label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
20825 structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
20826 name spaces, <a href="#6.2.3">6.2.3</a> offsetof macro, <a href="#7.17">7.17</a>
20827 named label, <a href="#6.8.1">6.8.1</a> on-off switch, <a href="#6.10.6">6.10.6</a>
20828 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>
20829 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>
20830 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>
20831 NDEBUG macro, <a href="#7.2">7.2</a> operations on files, <a href="#7.19.4">7.19.4</a>
20832 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>
20833 <a href="#F.9.6.3">F.9.6.3</a> operators, <a href="#6.5">6.5</a>
20834 nearbyint type-generic macro, <a href="#7.22">7.22</a> assignment, <a href="#6.5.16">6.5.16</a>
20835 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>
20836 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> equality, <a href="#6.5.9">6.5.9</a>
20837 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>
20838 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>
20839 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>
20840 <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>
20841 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>
20842 <a href="#F.9.8.3">F.9.8.3</a> shift, <a href="#6.5.7">6.5.7</a>
20843 nextafter type-generic macro, <a href="#7.22">7.22</a> unary, <a href="#6.5.3">6.5.3</a>
20844 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>
20845 nexttoward type-generic macro, <a href="#7.22">7.22</a> or macro, <a href="#7.9">7.9</a>
20846 no linkage, <a href="#6.2.2">6.2.2</a> OR operators
20847 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>
20848 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>
20849 nonlocal jumps header, <a href="#7.13">7.13</a> bitwise inclusive (|), <a href="#6.5.12">6.5.12</a>
20850 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>
20851 not macro, <a href="#7.9">7.9</a> logical (||), <a href="#6.5.14">6.5.14</a>
20852 not-equal-to operator, see inequality operator or_eq macro, <a href="#7.9">7.9</a>
20853 not_eq macro, <a href="#7.9">7.9</a> order of allocated storage, <a href="#7.20.3">7.20.3</a>
20854 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>
20855 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>
20856 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>
20857 <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>
20858 null pointer, <a href="#6.3.2.3">6.3.2.3</a>
20859 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> padding
20860 null preprocessing directive, <a href="#6.10.7">6.10.7</a> binary stream, <a href="#7.19.2">7.19.2</a>
20861 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>
20862 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>
20863 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>
20864 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>
20865 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>
20866 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>
20867 macro, <a href="#6.10.3">6.10.3</a>
20868 object, <a href="#3.14">3.14</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
20869 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>
20870 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>
20871 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>
20872 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>
20873 octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</a>
20874 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>
20876 [<a name="p533" href="#p533">page 533</a>] (<a href="#Contents">Contents</a>)
20878 perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
20879 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>
20880 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>
20881 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>
20882 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>
20883 pointer arithmetic, <a href="#6.5.6">6.5.6</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
20884 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>
20885 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>
20886 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>
20887 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>
20888 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>
20889 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>
20890 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>
20891 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>,
20892 position indicator, file, see file position indicator <a href="#5.1.2.3">5.1.2.3</a>
20893 positive difference, <a href="#7.12.12.1">7.12.12.1</a> program, conforming, <a href="#4">4</a>
20894 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>
20895 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
20896 postfix expressions, <a href="#6.5.2">6.5.2</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
20897 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>
20898 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
20899 pow type-generic macro, <a href="#7.22">7.22</a> pseudo-random sequence functions, <a href="#7.20.2">7.20.2</a>
20900 power functions PTRDIFF_MAX macro, <a href="#7.18.3">7.18.3</a>
20901 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>
20902 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>,
20903 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>
20904 pragma operator, <a href="#6.10.9">6.10.9</a> punctuators, <a href="#6.4.6">6.4.6</a>
20905 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>
20906 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>
20907 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>
20908 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>
20909 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>
20910 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
20911 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>
20912 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>
20913 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>
20914 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>
20915 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>
20916 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
20917 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>
20918 #, <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>
20919 ##, <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>
20920 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> range
20921 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>
20922 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>,
20923 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>,
20924 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>,
20925 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>,
20926 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>,
20927 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>,
20928 PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
20930 [<a name="p534" href="#p534">page 534</a>] (<a href="#Contents">Contents</a>)
20932 rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
20933 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>
20934 <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>
20935 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>
20936 real type domain, <a href="#6.2.5">6.2.5</a> scalbln type-generic macro, <a href="#7.22">7.22</a>
20937 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>
20938 real-floating, <a href="#7.12.3">7.12.3</a> scalbn type-generic macro, <a href="#7.22">7.22</a>
20939 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>
20940 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>
20941 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>
20942 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>
20943 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>
20944 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>
20945 library functions, <a href="#7.1.4">7.1.4</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
20946 referenced type, <a href="#6.2.5">6.2.5</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
20947 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>
20948 relational expressions, <a href="#6.5.8">6.5.8</a> SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
20949 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>
20950 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> search functions
20951 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>
20952 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>
20953 <a href="#F.9.7.2">F.9.7.2</a> wide string, <a href="#7.24.4.5">7.24.4.5</a>
20954 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>
20955 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>
20956 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>
20957 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>
20958 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>
20959 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>,
20960 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>
20961 pointer, <a href="#6.2.5">6.2.5</a> separate compilation, <a href="#5.1.1.1">5.1.1.1</a>
20962 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>
20963 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>,
20964 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>
20965 functions, <a href="#7.24.6.3">7.24.6.3</a> sequencing of statements, <a href="#6.8">6.8</a>
20966 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>
20967 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>
20968 restore calling environment function, <a href="#7.13.2">7.13.2</a> setjmp.h header, <a href="#7.13">7.13</a>
20969 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>
20970 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>,
20971 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>
20972 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>
20973 <a href="#7.24.3.10">7.24.3.10</a> shift expressions, <a href="#6.5.7">6.5.7</a>
20974 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>
20975 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>
20976 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>
20977 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>,
20978 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>
20979 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>,
20980 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>
20981 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>
20982 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
20984 [<a name="p535" href="#p535">page 535</a>] (<a href="#Contents">Contents</a>)
20986 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>
20987 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>
20988 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>,
20989 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>
20990 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>
20991 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>
20992 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>
20993 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>
20994 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>
20995 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>
20996 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>
20997 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>
20998 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>,
20999 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>
21000 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>
21001 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>
21002 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>
21003 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>,
21004 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>
21005 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>
21006 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>
21007 <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>
21008 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>
21009 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>,
21010 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>
21011 <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>
21012 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>
21013 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>
21014 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>
21015 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>,
21016 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>
21017 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>,
21018 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>
21019 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>
21020 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>
21021 <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>
21022 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>
21023 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>
21024 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>,
21025 sinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#F">F</a>
21026 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>
21027 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>
21028 <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>
21029 <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>
21030 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>
21031 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>
21032 sorting utility functions, <a href="#7.20.5">7.20.5</a> statements, <a href="#6.8">6.8</a>
21033 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>
21034 source file, <a href="#5.1.1.1">5.1.1.1</a> compound, <a href="#6.8.2">6.8.2</a>
21035 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>
21036 source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
21038 [<a name="p536" href="#p536">page 536</a>] (<a href="#Contents">Contents</a>)
21040 else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
21041 expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
21042 for, <a href="#6.8.5.3">6.8.5.3</a> comparison functions, <a href="#7.21.4">7.21.4</a>
21043 goto, <a href="#6.8.6.1">6.8.6.1</a> concatenation functions, <a href="#7.21.3">7.21.3</a>
21044 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>
21045 iteration, <a href="#6.8.5">6.8.5</a> copying functions, <a href="#7.21.2">7.21.2</a>
21046 jump, <a href="#6.8.6">6.8.6</a> library function conventions, <a href="#7.21.1">7.21.1</a>
21047 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>
21048 null, <a href="#6.8.3">6.8.3</a> miscellaneous functions, <a href="#7.21.6">7.21.6</a>
21049 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>
21050 selection, <a href="#6.8.4">6.8.4</a> search functions, <a href="#7.21.5">7.21.5</a>
21051 sequencing, <a href="#6.8">6.8</a> string handling header, <a href="#7.21">7.21</a>
21052 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>
21053 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>
21054 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>
21055 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>
21056 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>
21057 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>
21058 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>
21059 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>
21060 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>
21061 <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>
21062 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>,
21063 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>
21064 <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>
21065 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>
21066 <a href="#7.26.8">7.26.8</a> strtok function, <a href="#7.21.5.8">7.21.5.8</a>
21067 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>,
21068 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>
21069 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>
21070 <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>
21071 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>,
21072 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>
21073 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>
21074 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>
21075 strchr function, <a href="#7.21.5.2">7.21.5.2</a> struct hack, see flexible array member
21076 strcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.2">7.21.4.2</a> structure
21077 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>
21078 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>
21079 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>
21080 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>
21081 fully buffered, <a href="#7.19.3">7.19.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
21082 line buffered, <a href="#7.19.3">7.19.3</a> member name space, <a href="#6.2.3">6.2.3</a>
21083 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>
21084 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>
21085 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>
21086 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>
21087 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>
21088 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>
21089 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>
21090 <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>
21092 [<a name="p537" href="#p537">page 537</a>] (<a href="#Contents">Contents</a>)
21094 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>
21095 suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
21096 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>
21097 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>
21098 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>
21099 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>
21100 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>
21101 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>
21102 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>
21103 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>,
21104 symbols, <a href="#3">3</a> <a href="#6.5.2.3">6.5.2.3</a>
21105 syntactic categories, <a href="#6.1">6.1</a> trigonometric functions
21106 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>
21107 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>
21108 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>
21109 system function, <a href="#7.20.4.6">7.20.4.6</a> true macro, <a href="#7.16">7.16</a>
21110 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.9.6.8">F.9.6.8</a>
21111 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>
21112 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>
21113 tag name space, <a href="#6.2.3">6.2.3</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
21114 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>
21115 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>
21116 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>
21117 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>
21118 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>
21119 tentative definition, <a href="#6.9.2">6.9.2</a> type names, <a href="#6.7.6">6.7.6</a>
21120 terms, <a href="#3">3</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
21121 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>
21122 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>
21123 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>
21124 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>
21125 time typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.7">6.7.7</a>
21126 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>
21127 <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>
21128 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>
21129 <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>
21130 components, <a href="#7.23.1">7.23.1</a> composite, <a href="#6.2.7">6.2.7</a>
21131 conversion functions, <a href="#7.23.3">7.23.3</a> const qualified, <a href="#6.7.3">6.7.3</a>
21132 wide character, <a href="#7.24.5">7.24.5</a> conversions, <a href="#6.3">6.3</a>
21133 local, <a href="#7.23.1">7.23.1</a> imaginary, <a href="#G">G</a>
21134 manipulation functions, <a href="#7.23.2">7.23.2</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
21135 time function, <a href="#7.23.2.4">7.23.2.4</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
21136 time.h header, <a href="#7.23">7.23</a>
21137 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>
21138 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>
21139 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>
21140 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>
21141 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>
21142 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>
21143 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>
21144 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>
21146 [<a name="p538" href="#p538">page 538</a>] (<a href="#Contents">Contents</a>)
21148 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>
21149 <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>,
21150 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>
21151 UINTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> utilities, general, <a href="#7.20">7.20</a>
21152 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>
21153 UINTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a>
21154 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>,
21155 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>,
21156 <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>,
21157 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>,
21158 <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>
21159 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>,
21160 unary expression, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.3">7.15.1.3</a>
21161 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>,
21162 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>,
21163 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>,
21164 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>,
21165 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>
21166 <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>
21167 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>,
21168 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>,
21169 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>,
21170 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>,
21171 <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>
21172 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>
21173 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>
21174 union variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.15">7.15</a>
21175 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> variable arguments header, <a href="#7.15">7.15</a>
21176 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>
21177 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>
21178 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>
21179 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>,
21180 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.4.1.10">7.4.1.10</a>
21181 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>
21182 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>
21183 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>
21184 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>
21185 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>
21186 universal character name, <a href="#6.4.3">6.4.3</a> VLA, see variable length array
21187 unqualified type, <a href="#6.2.5">6.2.5</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
21188 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>
21189 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>
21190 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>
21191 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>
21192 <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>
21193 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>
21194 <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>
21195 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>
21196 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>
21197 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>
21198 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>
21200 [<a name="p539" href="#p539">page 539</a>] (<a href="#Contents">Contents</a>)
21202 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>
21203 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>
21204 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>,
21205 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>,
21206 <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.25.1">7.25.1</a>
21207 warnings, <a href="#I">I</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
21208 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>,
21209 <a href="#F">F</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>
21210 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>
21211 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>
21212 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>
21213 <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>
21214 <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>
21215 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>
21216 <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>
21217 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>
21218 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>
21219 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>
21220 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>
21221 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>
21222 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>
21223 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>
21224 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>
21225 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>
21226 wcsncmp function, <a href="#7.24.4.4.3">7.24.4.4.3</a> wide string literal, see string literal
21227 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>
21228 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>,
21229 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>
21230 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>
21231 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>
21232 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>
21233 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>
21234 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>
21235 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>,
21236 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#7.25.1">7.25.1</a>
21237 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>
21238 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>
21239 <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>
21240 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>
21241 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>
21242 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>
21243 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>,
21244 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.3.10">7.24.3.10</a>
21245 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>
21246 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> xor macro, <a href="#7.9">7.9</a>
21247 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>
21248 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>
21249 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>
21250 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>
21251 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>
21252 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>
21254 [<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
21255 </pre></body></html>