fix formula for logb in n1570.html
[c-standard.git] / n1256.pre.html
blobedd1a81b587e7c1a94ac5b174d82162932eed611
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>
46 [page iii]
48 <a href="#6.5.1"> 6.5.1 Primary expressions . . . . . . . . . . . . . . . . . 69</a>
49 <a href="#6.5.2"> 6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . 69</a>
50 <a href="#6.5.3"> 6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . 78</a>
51 <a href="#6.5.4"> 6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . 81</a>
52 <a href="#6.5.5"> 6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . 82</a>
53 <a href="#6.5.6"> 6.5.6 Additive operators . . . . . . . . . . . . . . . . . . 82</a>
54 <a href="#6.5.7"> 6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . 84</a>
55 <a href="#6.5.8"> 6.5.8 Relational operators . . . . . . . . . . . . . . . . . . 85</a>
56 <a href="#6.5.9"> 6.5.9 Equality operators . . . . . . . . . . . . . . . . . . 86</a>
57 <a href="#6.5.10"> 6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . 87</a>
58 <a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . 88</a>
59 <a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . 88</a>
60 <a href="#6.5.13"> 6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . 89</a>
61 <a href="#6.5.14"> 6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . 89</a>
62 <a href="#6.5.15"> 6.5.15 Conditional operator . . . . . . . . . . . . . . . . . 90</a>
63 <a href="#6.5.16"> 6.5.16 Assignment operators . . . . . . . . . . . . . . . . . 91</a>
64 <a href="#6.5.17"> 6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . 94</a>
65 <a href="#6.6"> 6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . 95</a>
66 <a href="#6.7"> 6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . 97</a>
67 <a href="#6.7.1"> 6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . 98</a>
68 <a href="#6.7.2"> 6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . 99</a>
69 <a href="#6.7.3"> 6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . 108</a>
70 <a href="#6.7.4"> 6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . 112</a>
71 <a href="#6.7.5"> 6.7.5 Declarators . . . . . . . . . . . . . . . . . . . . . 114</a>
72 <a href="#6.7.6"> 6.7.6 Type names . . . . . . . . . . . . . . . . . . . . . 122</a>
73 <a href="#6.7.7"> 6.7.7 Type definitions . . . . . . . . . . . . . . . . . . . 123</a>
74 <a href="#6.7.8"> 6.7.8 Initialization . . . . . . . . . . . . . . . . . . . . 125</a>
75 <a href="#6.8"> 6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . 131</a>
76 <a href="#6.8.1"> 6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . 131</a>
77 <a href="#6.8.2"> 6.8.2 Compound statement . . . . . . . . . . . . . . . . . 132</a>
78 <a href="#6.8.3"> 6.8.3 Expression and null statements . . . . . . . . . . . . . 132</a>
79 <a href="#6.8.4"> 6.8.4 Selection statements . . . . . . . . . . . . . . . . . 133</a>
80 <a href="#6.8.5"> 6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . 135</a>
81 <a href="#6.8.6"> 6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . 136</a>
82 <a href="#6.9"> 6.9 External definitions . . . . . . . . . . . . . . . . . . . . . 140</a>
83 <a href="#6.9.1"> 6.9.1 Function definitions . . . . . . . . . . . . . . . . . . 141</a>
84 <a href="#6.9.2"> 6.9.2 External object definitions . . . . . . . . . . . . . . . 143</a>
85 <a href="#6.10"> 6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . 145</a>
86 <a href="#6.10.1"> 6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . 147</a>
87 <a href="#6.10.2"> 6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . 149</a>
88 <a href="#6.10.3"> 6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . 151</a>
89 <a href="#6.10.4"> 6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . 158</a>
90 <a href="#6.10.5"> 6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . 159</a>
91 <a href="#6.10.6"> 6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . 159</a>
93 [page iv]
95 <a href="#6.10.7"> 6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . 160</a>
96 <a href="#6.10.8"> 6.10.8 Predefined macro names . . . . . . . . . . . . . . . . 160</a>
97 <a href="#6.10.9"> 6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . 161</a>
98 <a href="#6.11"> 6.11 Future language directions . . . . . . . . . . . . . . . . . . 163</a>
99 <a href="#6.11.1"> 6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . 163</a>
100 <a href="#6.11.2"> 6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 163</a>
101 <a href="#6.11.3"> 6.11.3 External names . . . . . . . . . . . . . . . . . . . 163</a>
102 <a href="#6.11.4"> 6.11.4 Character escape sequences . . . . . . . . . . . . . . 163</a>
103 <a href="#6.11.5"> 6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . 163</a>
104 <a href="#6.11.6"> 6.11.6 Function declarators . . . . . . . . . . . . . . . . . 163</a>
105 <a href="#6.11.7"> 6.11.7 Function definitions . . . . . . . . . . . . . . . . . . 163</a>
106 <a href="#6.11.8"> 6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . 163</a>
107 <a href="#6.11.9"> 6.11.9 Predefined macro names . . . . . . . . . . . . . . . . 163</a>
108 <a href="#7">7. Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164</a>
109 <a href="#7.1"> 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 164</a>
110 <a href="#7.1.1"> 7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . 164</a>
111 <a href="#7.1.2"> 7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . 165</a>
112 <a href="#7.1.3"> 7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . 166</a>
113 <a href="#7.1.4"> 7.1.4 Use of library functions . . . . . . . . . . . . . . . . 166</a>
114 <a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 169</a>
115 <a href="#7.2.1"> 7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . 169</a>
116 <a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 170</a>
117 <a href="#7.3.1"> 7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . 170</a>
118 <a href="#7.3.2"> 7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . 171</a>
119 <a href="#7.3.3"> 7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . 171</a>
120 <a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma . . . . . . . . . . . 171</a>
121 <a href="#7.3.5"> 7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . 172</a>
122 <a href="#7.3.6"> 7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . 174</a>
123 <a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions . . . . . . . . . . 176</a>
124 <a href="#7.3.8"> 7.3.8 Power and absolute-value functions . . . . . . . . . . . 177</a>
125 <a href="#7.3.9"> 7.3.9 Manipulation functions . . . . . . . . . . . . . . . . 178</a>
126 <a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 181</a>
127 <a href="#7.4.1"> 7.4.1 Character classification functions . . . . . . . . . . . . 181</a>
128 <a href="#7.4.2"> 7.4.2 Character case mapping functions . . . . . . . . . . . . 184</a>
129 <a href="#7.5"> 7.5 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 186</a>
130 <a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 187</a>
131 <a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma . . . . . . . . . . . . . . 189</a>
132 <a href="#7.6.2"> 7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . 190</a>
133 <a href="#7.6.3"> 7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . 193</a>
134 <a href="#7.6.4"> 7.6.4 Environment . . . . . . . . . . . . . . . . . . . . 194</a>
135 <a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 197</a>
136 <a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 198</a>
137 <a href="#7.8.1"> 7.8.1 Macros for format specifiers . . . . . . . . . . . . . . 198</a>
138 <a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types . . . . . . . . . 199</a>
140 [page v]
142 <a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 202</a>
143 <a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 203</a>
144 <a href="#7.11"> 7.11 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 204</a>
145 <a href="#7.11.1"> 7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . 205</a>
146 <a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry . . . . . . . . . . 206</a>
147 <a href="#7.12"> 7.12 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 212</a>
148 <a href="#7.12.1"> 7.12.1 Treatment of error conditions . . . . . . . . . . . . . . 214</a>
149 <a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma . . . . . . . . . . . . . . 215</a>
150 <a href="#7.12.3"> 7.12.3 Classification macros . . . . . . . . . . . . . . . . . 216</a>
151 <a href="#7.12.4"> 7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . 218</a>
152 <a href="#7.12.5"> 7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . 221</a>
153 <a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions . . . . . . . . . . 223</a>
154 <a href="#7.12.7"> 7.12.7 Power and absolute-value functions . . . . . . . . . . . 228</a>
155 <a href="#7.12.8"> 7.12.8 Error and gamma functions . . . . . . . . . . . . . . . 230</a>
156 <a href="#7.12.9"> 7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . 231</a>
157 <a href="#7.12.10"> 7.12.10 Remainder functions . . . . . . . . . . . . . . . . . 235</a>
158 <a href="#7.12.11"> 7.12.11 Manipulation functions . . . . . . . . . . . . . . . . 236</a>
159 <a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions . . . 238</a>
160 <a href="#7.12.13"> 7.12.13 Floating multiply-add . . . . . . . . . . . . . . . . . 239</a>
161 <a href="#7.12.14"> 7.12.14 Comparison macros . . . . . . . . . . . . . . . . . . 240</a>
162 <a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 243</a>
163 <a href="#7.13.1"> 7.13.1 Save calling environment . . . . . . . . . . . . . . . 243</a>
164 <a href="#7.13.2"> 7.13.2 Restore calling environment . . . . . . . . . . . . . . 244</a>
165 <a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 246</a>
166 <a href="#7.14.1"> 7.14.1 Specify signal handling . . . . . . . . . . . . . . . . 247</a>
167 <a href="#7.14.2"> 7.14.2 Send signal . . . . . . . . . . . . . . . . . . . . . 248</a>
168 <a href="#7.15"> 7.15 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 249</a>
169 <a href="#7.15.1"> 7.15.1 Variable argument list access macros . . . . . . . . . . . 249</a>
170 <a href="#7.16"> 7.16 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 253</a>
171 <a href="#7.17"> 7.17 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 254</a>
172 <a href="#7.18"> 7.18 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 255</a>
173 <a href="#7.18.1"> 7.18.1 Integer types . . . . . . . . . . . . . . . . . . . . 255</a>
174 <a href="#7.18.2"> 7.18.2 Limits of specified-width integer types . . . . . . . . . . 257</a>
175 <a href="#7.18.3"> 7.18.3 Limits of other integer types . . . . . . . . . . . . . . 259</a>
176 <a href="#7.18.4"> 7.18.4 Macros for integer constants . . . . . . . . . . . . . . 260</a>
177 <a href="#7.19"> 7.19 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 262</a>
178 <a href="#7.19.1"> 7.19.1 Introduction . . . . . . . . . . . . . . . . . . . . . 262</a>
179 <a href="#7.19.2"> 7.19.2 Streams . . . . . . . . . . . . . . . . . . . . . . 264</a>
180 <a href="#7.19.3"> 7.19.3 Files . . . . . . . . . . . . . . . . . . . . . . . . 266</a>
181 <a href="#7.19.4"> 7.19.4 Operations on files . . . . . . . . . . . . . . . . . . 268</a>
182 <a href="#7.19.5"> 7.19.5 File access functions . . . . . . . . . . . . . . . . . 270</a>
183 <a href="#7.19.6"> 7.19.6 Formatted input/output functions . . . . . . . . . . . . 274</a>
184 <a href="#7.19.7"> 7.19.7 Character input/output functions . . . . . . . . . . . . . 296</a>
185 <a href="#7.19.8"> 7.19.8 Direct input/output functions . . . . . . . . . . . . . . 301</a>
187 [page vi]
189 <a href="#7.19.9"> 7.19.9 File positioning functions . . . . . . . . . . . . . . . 302</a>
190 <a href="#7.19.10"> 7.19.10 Error-handling functions . . . . . . . . . . . . . . . . 304</a>
191 <a href="#7.20"> 7.20 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 306</a>
192 <a href="#7.20.1"> 7.20.1 Numeric conversion functions . . . . . . . . . . . . . . 307</a>
193 <a href="#7.20.2"> 7.20.2 Pseudo-random sequence generation functions . . . . . . . 312</a>
194 <a href="#7.20.3"> 7.20.3 Memory management functions . . . . . . . . . . . . . 313</a>
195 <a href="#7.20.4"> 7.20.4 Communication with the environment . . . . . . . . . . 315</a>
196 <a href="#7.20.5"> 7.20.5 Searching and sorting utilities . . . . . . . . . . . . . . 318</a>
197 <a href="#7.20.6"> 7.20.6 Integer arithmetic functions . . . . . . . . . . . . . . 320</a>
198 <a href="#7.20.7"> 7.20.7 Multibyte/wide character conversion functions . . . . . . . 321</a>
199 <a href="#7.20.8"> 7.20.8 Multibyte/wide string conversion functions . . . . . . . . 323</a>
200 <a href="#7.21"> 7.21 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 325</a>
201 <a href="#7.21.1"> 7.21.1 String function conventions . . . . . . . . . . . . . . . 325</a>
202 <a href="#7.21.2"> 7.21.2 Copying functions . . . . . . . . . . . . . . . . . . 325</a>
203 <a href="#7.21.3"> 7.21.3 Concatenation functions . . . . . . . . . . . . . . . . 327</a>
204 <a href="#7.21.4"> 7.21.4 Comparison functions . . . . . . . . . . . . . . . . . 328</a>
205 <a href="#7.21.5"> 7.21.5 Search functions . . . . . . . . . . . . . . . . . . . 330</a>
206 <a href="#7.21.6"> 7.21.6 Miscellaneous functions . . . . . . . . . . . . . . . . 333</a>
207 <a href="#7.22"> 7.22 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 335</a>
208 <a href="#7.23"> 7.23 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 338</a>
209 <a href="#7.23.1"> 7.23.1 Components of time . . . . . . . . . . . . . . . . . 338</a>
210 <a href="#7.23.2"> 7.23.2 Time manipulation functions . . . . . . . . . . . . . . 339</a>
211 <a href="#7.23.3"> 7.23.3 Time conversion functions . . . . . . . . . . . . . . . 341</a>
212 <a href="#7.24"> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt; . . . . . 348</a>
213 <a href="#7.24.1"> 7.24.1 Introduction . . . . . . . . . . . . . . . . . . . . . 348</a>
214 <a href="#7.24.2"> 7.24.2 Formatted wide character input/output functions . . . . . . 349</a>
215 <a href="#7.24.3"> 7.24.3 Wide character input/output functions . . . . . . . . . . 367</a>
216 <a href="#7.24.4"> 7.24.4 General wide string utilities . . . . . . . . . . . . . . 371</a>
217 <a href="#7.24.5"> 7.24.5 Wide character time conversion functions . . . . . . . . . 385</a>
218 <a href="#7.24.6"> 7.24.6 Extended multibyte/wide character conversion utilities . . . . 386</a>
219 <a href="#7.25"> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 393</a>
220 <a href="#7.25.1"> 7.25.1 Introduction . . . . . . . . . . . . . . . . . . . . . 393</a>
221 <a href="#7.25.2"> 7.25.2 Wide character classification utilities . . . . . . . . . . . 394</a>
222 <a href="#7.25.3"> 7.25.3 Wide character case mapping utilities . . . . . . . . . . . 399</a>
223 <a href="#7.26"> 7.26 Future library directions . . . . . . . . . . . . . . . . . . . 401</a>
224 <a href="#7.26.1"> 7.26.1 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . 401</a>
225 <a href="#7.26.2"> 7.26.2 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . 401</a>
226 <a href="#7.26.3"> 7.26.3 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . 401</a>
227 <a href="#7.26.4"> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt; . . . . 401</a>
228 <a href="#7.26.5"> 7.26.5 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . 401</a>
229 <a href="#7.26.6"> 7.26.6 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . 401</a>
230 <a href="#7.26.7"> 7.26.7 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . 401</a>
231 <a href="#7.26.8"> 7.26.8 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . 401</a>
232 <a href="#7.26.9"> 7.26.9 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . 402</a>
234 [page vii]
236 <a href="#7.26.10"> 7.26.10 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . 402</a>
237 <a href="#7.26.11"> 7.26.11 String handling &lt;string.h&gt; . . . . . . . . . . . . . 402</a>
238 <a href="#7.26.12"> 7.26.12 Extended multibyte and wide character utilities
239 &lt;wchar.h&gt; . . . . . . . . . . . . . . . . . . . . 402</a>
240 <a href="#7.26.13"> 7.26.13 Wide character classification and mapping utilities
241 &lt;wctype.h&gt; . . . . . . . . . . . . . . . . . . . . 402</a>
242 <a href="#A">Annex A (informative) Language syntax summary . . . . . . . . . . . . 403</a>
243 <a href="#A.1"> A.1 Lexical grammar . . . . . . . . . . . . . . . . . . . . . . 403</a>
244 <a href="#A.2"> A.2 Phrase structure grammar . . . . . . . . . . . . . . . . . . . 409</a>
245 <a href="#A.3"> A.3 Preprocessing directives . . . . . . . . . . . . . . . . . . . 416</a>
246 <a href="#B">Annex B (informative) Library summary . . . . . . . . . . . . . . . . 419</a>
247 <a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 419</a>
248 <a href="#B.2"> B.2 Complex &lt;complex.h&gt; . . . . . . . . . . . . . . . . . . . 419</a>
249 <a href="#B.3"> B.3 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 421</a>
250 <a href="#B.4"> B.4 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 421</a>
251 <a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 421</a>
252 <a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 422</a>
253 <a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 422</a>
254 <a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 423</a>
255 <a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 423</a>
256 <a href="#B.10"> B.10 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 423</a>
257 <a href="#B.11"> B.11 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 423</a>
258 <a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 428</a>
259 <a href="#B.13"> B.13 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 428</a>
260 <a href="#B.14"> B.14 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 428</a>
261 <a href="#B.15"> B.15 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 428</a>
262 <a href="#B.16"> B.16 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 429</a>
263 <a href="#B.17"> B.17 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 429</a>
264 <a href="#B.18"> B.18 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 429</a>
265 <a href="#B.19"> B.19 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 431</a>
266 <a href="#B.20"> B.20 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 433</a>
267 <a href="#B.21"> B.21 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 434</a>
268 <a href="#B.22"> B.22 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 434</a>
269 <a href="#B.23"> B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt; . . . . . . 435</a>
270 <a href="#B.24"> B.24 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 437</a>
271 <a href="#C">Annex C (informative) Sequence points . . . . . . . . . . . . . . . . . 439</a>
272 <a href="#D">Annex D (normative) Universal character names for identifiers . . . . . . . 440</a>
273 <a href="#E">Annex E (informative) Implementation limits . . . . . . . . . . . . . . 442</a>
274 <a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic . . . . . . . . . . 444</a>
275 <a href="#F.1"> F.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 444</a>
276 <a href="#F.2"> F.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 444</a>
277 <a href="#F.3"> F.3 Operators and functions . . . . . . . . . . . . . . . . . . . 445</a>
279 [page viii]
281 <a href="#F.4"> F.4 Floating to integer conversion . . . . . . . . . . . . . . . . . 447</a>
282 <a href="#F.5"> F.5 Binary-decimal conversion . . . . . . . . . . . . . . . . . . 447</a>
283 <a href="#F.6"> F.6 Contracted expressions . . . . . . . . . . . . . . . . . . . . 448</a>
284 <a href="#F.7"> F.7 Floating-point environment . . . . . . . . . . . . . . . . . . 448</a>
285 <a href="#F.8"> F.8 Optimization . . . . . . . . . . . . . . . . . . . . . . . . 451</a>
286 <a href="#F.9"> F.9 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 454</a>
287 <a href="#G">Annex G (informative) IEC 60559-compatible complex arithmetic . . . . . . 467</a>
288 <a href="#G.1"> G.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
289 <a href="#G.2"> G.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
290 <a href="#G.3"> G.3 Conventions . . . . . . . . . . . . . . . . . . . . . . . . 467</a>
291 <a href="#G.4"> G.4 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 468</a>
292 <a href="#G.5"> G.5 Binary operators . . . . . . . . . . . . . . . . . . . . . . 468</a>
293 <a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 472</a>
294 <a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 480</a>
295 <a href="#H">Annex H (informative) Language independent arithmetic . . . . . . . . . . 481</a>
296 <a href="#H.1"> H.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 481</a>
297 <a href="#H.2"> H.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 481</a>
298 <a href="#H.3"> H.3 Notification . . . . . . . . . . . . . . . . . . . . . . . . 485</a>
299 <a href="#I">Annex I (informative) Common warnings . . . . . . . . . . . . . . . . 487</a>
300 <a href="#J">Annex J (informative) Portability issues . . . . . . . . . . . . . . . . . 489</a>
301 <a href="#J.1"> J.1 Unspecified behavior . . . . . . . . . . . . . . . . . . . . . 489</a>
302 <a href="#J.2"> J.2 Undefined behavior . . . . . . . . . . . . . . . . . . . . . 492</a>
303 <a href="#J.3"> J.3 Implementation-defined behavior . . . . . . . . . . . . . . . . 505</a>
304 <a href="#J.4"> J.4 Locale-specific behavior . . . . . . . . . . . . . . . . . . . 512</a>
305 <a href="#J.5"> J.5 Common extensions . . . . . . . . . . . . . . . . . . . . . 513</a>
306 <a href="#Bibliography">Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 516</a>
307 <a href="#Index">Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519</a>
309 [<a name="pix" href="#pix">page ix</a>] (<a href="#Contents">Contents</a>)
312 [<a name="px" href="#px">page x</a>] (<a href="#Contents">Contents</a>)
314 <a name="Foreword" href="#Foreword"><b> Foreword</b></a>
315 1 ISO (the International Organization for Standardization) and IEC (the International
316 Electrotechnical Commission) form the specialized system for worldwide
317 standardization. National bodies that are member of ISO or IEC participate in the
318 development of International Standards through technical committees established by the
319 respective organization to deal with particular fields of technical activity. ISO and IEC
320 technical committees collaborate in fields of mutual interest. Other international
321 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
322 take part in the work.
323 2 International Standards are drafted in accordance with the rules given in the ISO/IEC
324 Directives, Part 3.
325 3 In the field of information technology, ISO and IEC have established a joint technical
326 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
327 committee are circulated to national bodies for voting. Publication as an International
328 Standard requires approval by at least 75% of the national bodies casting a vote.
329 4 International Standard ISO/IEC 9899 was prepared by Joint Technical Committee
330 ISO/IEC JTC 1, Information technology, Subcommittee SC 22, Programming languages,
331 their environments and system software interfaces. The Working Group responsible for
332 this standard (WG 14) maintains a site on the World Wide Web at
333 http://www.open-std.org/JTC1/SC22/WG14/ containing additional
334 information relevant to this standard such as a Rationale for many of the decisions made
335 during its preparation and a log of Defect Reports and Responses.
336 5 This second edition cancels and replaces the first edition, ISO/IEC 9899:1990, as
337 amended and corrected by ISO/IEC 9899/COR1:1994, ISO/IEC 9899/AMD1:1995, and
338 ISO/IEC 9899/COR2:1996. Major changes from the previous edition include:
339 -- restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
340 in AMD1)
341 -- 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
342 specified in AMD1)
343 -- more precise aliasing rules via effective type
344 -- restricted pointers
345 -- variable length arrays
346 -- flexible array members
347 -- static and type qualifiers in parameter array declarators
348 -- complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
349 -- type-generic math macros in <a href="#7.22">&lt;tgmath.h&gt;</a>
350 -- the long long int type and library functions
352 [<a name="pxi" href="#pxi">page xi</a>] (<a href="#Contents">Contents</a>)
354 -- increased minimum translation limits
355 -- additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
356 -- remove implicit int
357 -- reliable integer division
358 -- universal character names (\u and \U)
359 -- extended identifiers
360 -- hexadecimal floating-point constants and %a and %A printf/scanf conversion
361 specifiers
362 -- compound literals
363 -- designated initializers
364 -- // comments
365 -- 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>
366 -- remove implicit function declaration
367 -- preprocessor arithmetic done in intmax_t/uintmax_t
368 -- mixed declarations and code
369 -- new block scopes for selection and iteration statements
370 -- integer constant type rules
371 -- integer promotion rules
372 -- macros with a variable number of arguments
373 -- 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>
374 -- additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
375 -- treatment of error conditions by math library functions (math_errhandling)
376 -- floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
377 -- IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
378 -- trailing comma allowed in enum declaration
379 -- %lf conversion specifier allowed in printf
380 -- inline functions
381 -- the snprintf family of functions in <a href="#7.19">&lt;stdio.h&gt;</a>
382 -- boolean type in <a href="#7.16">&lt;stdbool.h&gt;</a>
383 -- idempotent type qualifiers
384 -- empty macro arguments
386 [<a name="pxii" href="#pxii">page xii</a>] (<a href="#Contents">Contents</a>)
388 -- new structure type compatibility rules (tag compatibility)
389 -- additional predefined macro names
390 -- _Pragma preprocessing operator
391 -- standard pragmas
392 -- __func__ predefined identifier
393 -- va_copy macro
394 -- additional strftime conversion specifiers
395 -- LIA compatibility annex
396 -- deprecate ungetc at the beginning of a binary file
397 -- remove deprecation of aliased array parameters
398 -- conversion of array to pointer not limited to lvalues
399 -- relaxed constraints on aggregate and union initialization
400 -- relaxed restrictions on portable header names
401 -- return without expression not permitted in function that returns a value (and vice
402 versa)
403 6 Annexes D and F form a normative part of this standard; annexes A, B, C, E, G, H, I, J,
404 the bibliography, and the index are for information only. In accordance with Part 3 of the
405 ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples are
406 also for information only.
408 [<a name="pxiii" href="#pxiii">page xiii</a>] (<a href="#Contents">Contents</a>)
410 <a name="Introduction" href="#Introduction"><b> Introduction</b></a>
411 1 With the introduction of new devices and extended character sets, new features may be
412 added to this International Standard. Subclauses in the language and library clauses warn
413 implementors and programmers of usages which, though valid in themselves, may
414 conflict with future additions.
415 2 Certain features are obsolescent, which means that they may be considered for
416 withdrawal in future revisions of this International Standard. They are retained because
417 of their widespread use, but their use in new implementations (for implementation
418 features) or new programs (for language [6.11] or library features [7.26]) is discouraged.
419 3 This International Standard is divided into four major subdivisions:
420 -- preliminary elements (clauses 1-4);
421 -- the characteristics of environments that translate and execute C programs (clause 5);
422 -- the language syntax, constraints, and semantics (clause 6);
423 -- the library facilities (clause 7).
424 4 Examples are provided to illustrate possible forms of the constructions described.
425 Footnotes are provided to emphasize consequences of the rules described in that
426 subclause or elsewhere in this International Standard. References are used to refer to
427 other related subclauses. Recommendations are provided to give advice or guidance to
428 implementors. Annexes provide additional information and summarize the information
429 contained in this International Standard. A bibliography lists documents that were
430 referred to during the preparation of the standard.
431 5 The language clause (clause 6) is derived from ''The C Reference Manual''.
432 6 The library clause (clause 7) is based on the 1984 /usr/group Standard.
434 [<a name="pxiv" href="#pxiv">page xiv</a>] (<a href="#Contents">Contents</a>)
438 Programming languages -- C
443 <a name="1" href="#1"><b> 1. Scope</b></a>
444 1 This International Standard specifies the form and establishes the interpretation of
445 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
446 -- the representation of C programs;
447 -- the syntax and constraints of the C language;
448 -- the semantic rules for interpreting C programs;
449 -- the representation of input data to be processed by C programs;
450 -- the representation of output data produced by C programs;
451 -- the restrictions and limits imposed by a conforming implementation of C.
452 2 This International Standard does not specify
453 -- the mechanism by which C programs are transformed for use by a data-processing
454 system;
455 -- the mechanism by which C programs are invoked for use by a data-processing
456 system;
457 -- the mechanism by which input data are transformed for use by a C program;
458 -- the mechanism by which output data are transformed after being produced by a C
459 program;
460 -- the size or complexity of a program and its data that will exceed the capacity of any
461 specific data-processing system or the capacity of a particular processor;
464 <sup><a name="note1" href="#note1"><b>1)</b></a></sup> This International Standard is designed to promote the portability of C programs among a variety of
465 data-processing systems. It is intended for use by implementors and programmers.
467 [<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
469 -- all minimal requirements of a data-processing system that is capable of supporting a
470 conforming implementation.
472 <a name="2" href="#2"><b> 2. Normative references</b></a>
473 1 The following normative documents contain provisions which, through reference in this
474 text, constitute provisions of this International Standard. For dated references,
475 subsequent amendments to, or revisions of, any of these publications do not apply.
476 However, parties to agreements based on this International Standard are encouraged to
477 investigate the possibility of applying the most recent editions of the normative
478 documents indicated below. For undated references, the latest edition of the normative
479 document referred to applies. Members of ISO and IEC maintain registers of currently
480 valid International Standards.
481 2 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
482 use in the physical sciences and technology.
483 3 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
484 interchange.
485 4 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
486 terms.
487 5 ISO 4217, Codes for the representation of currencies and funds.
488 6 ISO 8601, Data elements and interchange formats -- Information interchange --
489 Representation of dates and times.
490 7 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
491 Character Set (UCS).
492 8 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
493 designated IEC 559:1989).
495 [<a name="p2" href="#p2">page 2</a>] (<a href="#Contents">Contents</a>)
498 <a name="3" href="#3"><b> 3. Terms, definitions, and symbols</b></a>
499 1 For the purposes of this International Standard, the following definitions apply. Other
500 terms are defined where they appear in italic type or on the left side of a syntax rule.
501 Terms explicitly defined in this International Standard are not to be presumed to refer
502 implicitly to similar terms defined elsewhere. Terms not defined in this International
503 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
504 defined in this International Standard are to be interpreted according to ISO 31-11.
505 <a name="3.1" href="#3.1"><b> 3.1</b></a>
506 1 access
507 &lt;execution-time action&gt; to read or modify the value of an object
508 2 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
510 3 NOTE 2 "Modify'' includes the case where the new value being stored is the same as the previous value.
512 4 NOTE 3 Expressions that are not evaluated do not access objects.
514 <a name="3.2" href="#3.2"><b> 3.2</b></a>
515 1 alignment
516 requirement that objects of a particular type be located on storage boundaries with
517 addresses that are particular multiples of a byte address
518 <a name="3.3" href="#3.3"><b> 3.3</b></a>
519 1 argument
520 actual argument
521 actual parameter (deprecated)
522 expression in the comma-separated list bounded by the parentheses in a function call
523 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
524 by the parentheses in a function-like macro invocation
525 <a name="3.4" href="#3.4"><b> 3.4</b></a>
526 1 behavior
527 external appearance or action
528 <a name="3.4.1" href="#3.4.1"><b> 3.4.1</b></a>
529 1 implementation-defined behavior
530 unspecified behavior where each implementation documents how the choice is made
531 2 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
532 when a signed integer is shifted right.
534 <a name="3.4.2" href="#3.4.2"><b> 3.4.2</b></a>
535 1 locale-specific behavior
536 behavior that depends on local conventions of nationality, culture, and language that each
537 implementation documents
539 [<a name="p3" href="#p3">page 3</a>] (<a href="#Contents">Contents</a>)
541 2 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
542 characters other than the 26 lowercase Latin letters.
544 <a name="3.4.3" href="#3.4.3"><b> 3.4.3</b></a>
545 1 undefined behavior
546 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
547 for which this International Standard imposes no requirements
548 2 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
549 results, to behaving during translation or program execution in a documented manner characteristic of the
550 environment (with or without the issuance of a diagnostic message), to terminating a translation or
551 execution (with the issuance of a diagnostic message).
553 3 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
555 <a name="3.4.4" href="#3.4.4"><b> 3.4.4</b></a>
556 1 unspecified behavior
557 use of an unspecified value, or other behavior where this International Standard provides
558 two or more possibilities and imposes no further requirements on which is chosen in any
559 instance
560 2 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
561 evaluated.
563 <a name="3.5" href="#3.5"><b> 3.5</b></a>
564 1 bit
565 unit of data storage in the execution environment large enough to hold an object that may
566 have one of two values
567 2 NOTE It need not be possible to express the address of each individual bit of an object.
569 <a name="3.6" href="#3.6"><b> 3.6</b></a>
570 1 byte
571 addressable unit of data storage large enough to hold any member of the basic character
572 set of the execution environment
573 2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
575 3 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
576 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
577 bit.
579 <a name="3.7" href="#3.7"><b> 3.7</b></a>
580 1 character
581 &lt;abstract&gt; member of a set of elements used for the organization, control, or
582 representation of data
583 <a name="3.7.1" href="#3.7.1"><b> 3.7.1</b></a>
584 1 character
585 single-byte character
586 &lt;C&gt; bit representation that fits in a byte
588 [<a name="p4" href="#p4">page 4</a>] (<a href="#Contents">Contents</a>)
590 <a name="3.7.2" href="#3.7.2"><b> 3.7.2</b></a>
591 1 multibyte character
592 sequence of one or more bytes representing a member of the extended character set of
593 either the source or the execution environment
594 2 NOTE The extended character set is a superset of the basic character set.
596 <a name="3.7.3" href="#3.7.3"><b> 3.7.3</b></a>
597 1 wide character
598 bit representation that fits in an object of type wchar_t, capable of representing any
599 character in the current locale
600 <a name="3.8" href="#3.8"><b> 3.8</b></a>
601 1 constraint
602 restriction, either syntactic or semantic, by which the exposition of language elements is
603 to be interpreted
604 <a name="3.9" href="#3.9"><b> 3.9</b></a>
605 1 correctly rounded result
606 representation in the result format that is nearest in value, subject to the current rounding
607 mode, to what the result would be given unlimited range and precision
608 <a name="3.10" href="#3.10"><b> 3.10</b></a>
609 1 diagnostic message
610 message belonging to an implementation-defined subset of the implementation's message
611 output
612 <a name="3.11" href="#3.11"><b> 3.11</b></a>
613 1 forward reference
614 reference to a later subclause of this International Standard that contains additional
615 information relevant to this subclause
616 <a name="3.12" href="#3.12"><b> 3.12</b></a>
617 1 implementation
618 particular set of software, running in a particular translation environment under particular
619 control options, that performs translation of programs for, and supports execution of
620 functions in, a particular execution environment
621 <a name="3.13" href="#3.13"><b> 3.13</b></a>
622 1 implementation limit
623 restriction imposed upon programs by the implementation
624 <a name="3.14" href="#3.14"><b> 3.14</b></a>
625 1 object
626 region of data storage in the execution environment, the contents of which can represent
627 values
629 [<a name="p5" href="#p5">page 5</a>] (<a href="#Contents">Contents</a>)
631 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>.
633 <a name="3.15" href="#3.15"><b> 3.15</b></a>
634 1 parameter
635 formal parameter
636 formal argument (deprecated)
637 object declared as part of a function declaration or definition that acquires a value on
638 entry to the function, or an identifier from the comma-separated list bounded by the
639 parentheses immediately following the macro name in a function-like macro definition
640 <a name="3.16" href="#3.16"><b> 3.16</b></a>
641 1 recommended practice
642 specification that is strongly recommended as being in keeping with the intent of the
643 standard, but that may be impractical for some implementations
644 <a name="3.17" href="#3.17"><b> 3.17</b></a>
645 1 value
646 precise meaning of the contents of an object when interpreted as having a specific type
647 <a name="3.17.1" href="#3.17.1"><b> 3.17.1</b></a>
648 1 implementation-defined value
649 unspecified value where each implementation documents how the choice is made
650 <a name="3.17.2" href="#3.17.2"><b> 3.17.2</b></a>
651 1 indeterminate value
652 either an unspecified value or a trap representation
653 <a name="3.17.3" href="#3.17.3"><b> 3.17.3</b></a>
654 1 unspecified value
655 valid value of the relevant type where this International Standard imposes no
656 requirements on which value is chosen in any instance
657 2 NOTE An unspecified value cannot be a trap representation.
659 <a name="3.18" href="#3.18"><b> 3.18</b></a>
660 1 ??? x???
661 ceiling of x: the least integer greater than or equal to x
662 2 EXAMPLE ???2.4??? is 3, ???-2.4??? is -2.
664 <a name="3.19" href="#3.19"><b> 3.19</b></a>
665 1 ??? x???
666 floor of x: the greatest integer less than or equal to x
667 2 EXAMPLE ???2.4??? is 2, ???-2.4??? is -3.
669 [<a name="p6" href="#p6">page 6</a>] (<a href="#Contents">Contents</a>)
672 <a name="4" href="#4"><b> 4. Conformance</b></a>
673 1 In this International Standard, ''shall'' is to be interpreted as a requirement on an
674 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
675 prohibition.
676 2 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated, the
677 behavior is undefined. Undefined behavior is otherwise indicated in this International
678 Standard by the words ''undefined behavior'' or by the omission of any explicit definition
679 of behavior. There is no difference in emphasis among these three; they all describe
680 ''behavior that is undefined''.
681 3 A program that is correct in all other aspects, operating on correct data, containing
682 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
683 4 The implementation shall not successfully translate a preprocessing translation unit
684 containing a #error preprocessing directive unless it is part of a group skipped by
685 conditional inclusion.
686 5 A strictly conforming program shall use only those features of the language and library
687 specified in this International Standard.<sup><a href="#note2"><b>2)</b></a></sup> It shall not produce output dependent on any
688 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
689 minimum implementation limit.
690 6 The two forms of conforming implementation are hosted and freestanding. A conforming
691 hosted implementation shall accept any strictly conforming program. A conforming
692 freestanding implementation shall accept any strictly conforming program that does not
693 use complex types and in which the use of the features specified in the library clause
694 (clause 7) is confined to the contents of the standard headers <a href="#7.7">&lt;float.h&gt;</a>,
695 <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
696 <a href="#7.18">&lt;stdint.h&gt;</a>. A conforming implementation may have extensions (including additional
697 library functions), provided they do not alter the behavior of any strictly conforming
698 program.<sup><a href="#note3"><b>3)</b></a></sup>
702 <sup><a name="note2" href="#note2"><b>2)</b></a></sup> A strictly conforming program can use conditional features (such as those in <a href="#F">annex F</a>) provided the
703 use is guarded by a #ifdef directive with the appropriate macro. For example:
704 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
705 /* ... */
706 fesetround(FE_UPWARD);
707 /* ... */
708 #endif
710 <sup><a name="note3" href="#note3"><b>3)</b></a></sup> This implies that a conforming implementation reserves no identifiers other than those explicitly
711 reserved in this International Standard.
713 [<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
715 7 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note4"><b>4)</b></a></sup>
716 8 An implementation shall be accompanied by a document that defines all implementation-
717 defined and locale-specific characteristics and all extensions.
718 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
719 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>
720 (<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>
721 (<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
722 <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>).
727 <sup><a name="note4" href="#note4"><b>4)</b></a></sup> Strictly conforming programs are intended to be maximally portable among conforming
728 implementations. Conforming programs may depend upon nonportable features of a conforming
729 implementation.
731 [<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
734 <a name="5" href="#5"><b> 5. Environment</b></a>
735 1 An implementation translates C source files and executes C programs in two data-
736 processing-system environments, which will be called the translation environment and
737 the execution environment in this International Standard. Their characteristics define and
738 constrain the results of executing conforming C programs constructed according to the
739 syntactic and semantic rules for conforming implementations.
740 Forward references: In this clause, only a few of many possible forward references
741 have been noted.
742 <a name="5.1" href="#5.1"><b> 5.1 Conceptual models</b></a>
743 <a name="5.1.1" href="#5.1.1"><b> 5.1.1 Translation environment</b></a>
744 <a name="5.1.1.1" href="#5.1.1.1"><b> 5.1.1.1 Program structure</b></a>
745 1 A C program need not all be translated at the same time. The text of the program is kept
746 in units called source files, (or preprocessing files) in this International Standard. A
747 source file together with all the headers and source files included via the preprocessing
748 directive #include is known as a preprocessing translation unit. After preprocessing, a
749 preprocessing translation unit is called a translation unit. Previously translated translation
750 units may be preserved individually or in libraries. The separate translation units of a
751 program communicate by (for example) calls to functions whose identifiers have external
752 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
753 of data files. Translation units may be separately translated and then later linked to
754 produce an executable program.
755 Forward references: linkages of identifiers (<a href="#6.2.2">6.2.2</a>), external definitions (<a href="#6.9">6.9</a>),
756 preprocessing directives (<a href="#6.10">6.10</a>).
757 <a name="5.1.1.2" href="#5.1.1.2"><b> 5.1.1.2 Translation phases</b></a>
758 1 The precedence among the syntax rules of translation is specified by the following
759 phases.<sup><a href="#note5"><b>5)</b></a></sup>
760 1. Physical source file multibyte characters are mapped, in an implementation-
761 defined manner, to the source character set (introducing new-line characters for
762 end-of-line indicators) if necessary. Trigraph sequences are replaced by
763 corresponding single-character internal representations.
767 <sup><a name="note5" href="#note5"><b>5)</b></a></sup> Implementations shall behave as if these separate phases occur, even though many are typically folded
768 together in practice. Source files, translation units, and translated translation units need not
769 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
770 and any external representation. The description is conceptual only, and does not specify any
771 particular implementation.
773 [<a name="p9" href="#p9">page 9</a>] (<a href="#Contents">Contents</a>)
775 2. Each instance of a backslash character (\) immediately followed by a new-line
776 character is deleted, splicing physical source lines to form logical source lines.
777 Only the last backslash on any physical source line shall be eligible for being part
778 of such a splice. A source file that is not empty shall end in a new-line character,
779 which shall not be immediately preceded by a backslash character before any such
780 splicing takes place.
781 3. The source file is decomposed into preprocessing tokens<sup><a href="#note6"><b>6)</b></a></sup> and sequences of
782 white-space characters (including comments). A source file shall not end in a
783 partial preprocessing token or in a partial comment. Each comment is replaced by
784 one space character. New-line characters are retained. Whether each nonempty
785 sequence of white-space characters other than new-line is retained or replaced by
786 one space character is implementation-defined.
787 4. Preprocessing directives are executed, macro invocations are expanded, and
788 _Pragma unary operator expressions are executed. If a character sequence that
789 matches the syntax of a universal character name is produced by token
790 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
791 directive causes the named header or source file to be processed from phase 1
792 through phase 4, recursively. All preprocessing directives are then deleted.
793 5. Each source character set member and escape sequence in character constants and
794 string literals is converted to the corresponding member of the execution character
795 set; if there is no corresponding member, it is converted to an implementation-
796 defined member other than the null (wide) character.<sup><a href="#note7"><b>7)</b></a></sup>
797 6. Adjacent string literal tokens are concatenated.
798 7. White-space characters separating tokens are no longer significant. Each
799 preprocessing token is converted into a token. The resulting tokens are
800 syntactically and semantically analyzed and translated as a translation unit.
801 8. All external object and function references are resolved. Library components are
802 linked to satisfy external references to functions and objects not defined in the
803 current translation. All such translator output is collected into a program image
804 which contains information needed for execution in its execution environment.
805 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), lexical elements (<a href="#6.4">6.4</a>),
806 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>).
810 <sup><a name="note6" href="#note6"><b>6)</b></a></sup> As described in <a href="#6.4">6.4</a>, the process of dividing a source file's characters into preprocessing tokens is
811 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
812 <sup><a name="note7" href="#note7"><b>7)</b></a></sup> An implementation need not convert all non-corresponding source characters to the same execution
813 character.
815 [<a name="p10" href="#p10">page 10</a>] (<a href="#Contents">Contents</a>)
817 <a name="5.1.1.3" href="#5.1.1.3"><b> 5.1.1.3 Diagnostics</b></a>
818 1 A conforming implementation shall produce at least one diagnostic message (identified in
819 an implementation-defined manner) if a preprocessing translation unit or translation unit
820 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
821 specified as undefined or implementation-defined. Diagnostic messages need not be
822 produced in other circumstances.<sup><a href="#note8"><b>8)</b></a></sup>
823 2 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
824 char i;
825 int i;
826 because in those cases where wording in this International Standard describes the behavior for a construct
827 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
829 <a name="5.1.2" href="#5.1.2"><b> 5.1.2 Execution environments</b></a>
830 1 Two execution environments are defined: freestanding and hosted. In both cases,
831 program startup occurs when a designated C function is called by the execution
832 environment. All objects with static storage duration shall be initialized (set to their
833 initial values) before program startup. The manner and timing of such initialization are
834 otherwise unspecified. Program termination returns control to the execution
835 environment.
836 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>).
837 <a name="5.1.2.1" href="#5.1.2.1"><b> 5.1.2.1 Freestanding environment</b></a>
838 1 In a freestanding environment (in which C program execution may take place without any
839 benefit of an operating system), the name and type of the function called at program
840 startup are implementation-defined. Any library facilities available to a freestanding
841 program, other than the minimal set required by clause 4, are implementation-defined.
842 2 The effect of program termination in a freestanding environment is implementation-
843 defined.
844 <a name="5.1.2.2" href="#5.1.2.2"><b> 5.1.2.2 Hosted environment</b></a>
845 1 A hosted environment need not be provided, but shall conform to the following
846 specifications if present.
851 <sup><a name="note8" href="#note8"><b>8)</b></a></sup> The intent is that an implementation should identify the nature of, and where possible localize, each
852 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
853 valid program is still correctly translated. It may also successfully translate an invalid program.
855 [<a name="p11" href="#p11">page 11</a>] (<a href="#Contents">Contents</a>)
857 <a name="5.1.2.2.1" href="#5.1.2.2.1"><b> 5.1.2.2.1 Program startup</b></a>
858 1 The function called at program startup is named main. The implementation declares no
859 prototype for this function. It shall be defined with a return type of int and with no
860 parameters:
861 int main(void) { /* ... */ }
862 or with two parameters (referred to here as argc and argv, though any names may be
863 used, as they are local to the function in which they are declared):
864 int main(int argc, char *argv[]) { /* ... */ }
865 or equivalent;<sup><a href="#note9"><b>9)</b></a></sup> or in some other implementation-defined manner.
866 2 If they are declared, the parameters to the main function shall obey the following
867 constraints:
868 -- The value of argc shall be nonnegative.
869 -- argv[argc] shall be a null pointer.
870 -- If the value of argc is greater than zero, the array members argv[0] through
871 argv[argc-1] inclusive shall contain pointers to strings, which are given
872 implementation-defined values by the host environment prior to program startup. The
873 intent is to supply to the program information determined prior to program startup
874 from elsewhere in the hosted environment. If the host environment is not capable of
875 supplying strings with letters in both uppercase and lowercase, the implementation
876 shall ensure that the strings are received in lowercase.
877 -- If the value of argc is greater than zero, the string pointed to by argv[0]
878 represents the program name; argv[0][0] shall be the null character if the
879 program name is not available from the host environment. If the value of argc is
880 greater than one, the strings pointed to by argv[1] through argv[argc-1]
881 represent the program parameters.
882 -- The parameters argc and argv and the strings pointed to by the argv array shall
883 be modifiable by the program, and retain their last-stored values between program
884 startup and program termination.
885 <a name="5.1.2.2.2" href="#5.1.2.2.2"><b> 5.1.2.2.2 Program execution</b></a>
886 1 In a hosted environment, a program may use all the functions, macros, type definitions,
887 and objects described in the library clause (clause 7).
891 <sup><a name="note9" href="#note9"><b>9)</b></a></sup> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
892 char ** argv, and so on.
894 [<a name="p12" href="#p12">page 12</a>] (<a href="#Contents">Contents</a>)
896 <a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
897 1 If the return type of the main function is a type compatible with int, a return from the
898 initial call to the main function is equivalent to calling the exit function with the value
899 returned by the main function as its argument;<sup><a href="#note10"><b>10)</b></a></sup> reaching the } that terminates the
900 main function returns a value of 0. If the return type is not compatible with int, the
901 termination status returned to the host environment is unspecified.
902 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>).
903 <a name="5.1.2.3" href="#5.1.2.3"><b> 5.1.2.3 Program execution</b></a>
904 1 The semantic descriptions in this International Standard describe the behavior of an
905 abstract machine in which issues of optimization are irrelevant.
906 2 Accessing a volatile object, modifying an object, modifying a file, or calling a function
907 that does any of those operations are all side effects,<sup><a href="#note11"><b>11)</b></a></sup> which are changes in the state of
908 the execution environment. Evaluation of an expression may produce side effects. At
909 certain specified points in the execution sequence called sequence points, all side effects
910 of previous evaluations shall be complete and no side effects of subsequent evaluations
911 shall have taken place. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
912 3 In the abstract machine, all expressions are evaluated as specified by the semantics. An
913 actual implementation need not evaluate part of an expression if it can deduce that its
914 value is not used and that no needed side effects are produced (including any caused by
915 calling a function or accessing a volatile object).
916 4 When the processing of the abstract machine is interrupted by receipt of a signal, only the
917 values of objects as of the previous sequence point may be relied on. Objects that may be
918 modified between the previous sequence point and the next sequence point need not have
919 received their correct values yet.
920 5 The least requirements on a conforming implementation are:
921 -- At sequence points, volatile objects are stable in the sense that previous accesses are
922 complete and subsequent accesses have not yet occurred.
927 <sup><a name="note10" href="#note10"><b>10)</b></a></sup> In accordance with <a href="#6.2.4">6.2.4</a>, the lifetimes of objects with automatic storage duration declared in main
928 will have ended in the former case, even where they would not have in the latter.
929 <sup><a name="note11" href="#note11"><b>11)</b></a></sup> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
930 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
931 values of floating-point operations. Implementations that support such floating-point state are
932 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
933 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
934 effects matter, freeing the implementations in other cases.
936 [<a name="p13" href="#p13">page 13</a>] (<a href="#Contents">Contents</a>)
938 -- At program termination, all data written into files shall be identical to the result that
939 execution of the program according to the abstract semantics would have produced.
940 -- The input and output dynamics of interactive devices shall take place as specified in
941 <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>
942 appear as soon as possible, to ensure that prompting messages actually appear prior to
943 a program waiting for input.
944 6 What constitutes an interactive device is implementation-defined.
945 7 More stringent correspondences between abstract and actual semantics may be defined by
946 each implementation.
947 8 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
948 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
949 abstract semantics. The keyword volatile would then be redundant.
950 9 Alternatively, an implementation might perform various optimizations within each translation unit, such
951 that the actual semantics would agree with the abstract semantics only when making function calls across
952 translation unit boundaries. In such an implementation, at the time of each function entry and function
953 return where the calling function and the called function are in different translation units, the values of all
954 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
955 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
956 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
957 type of implementation, objects referred to by interrupt service routines activated by the signal function
958 would require explicit specification of volatile storage, as well as other implementation-defined
959 restrictions.
961 10 EXAMPLE 2 In executing the fragment
962 char c1, c2;
963 /* ... */
964 c1 = c1 + c2;
965 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
966 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
967 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
968 produce the same result, possibly omitting the promotions.
970 11 EXAMPLE 3 Similarly, in the fragment
971 float f1, f2;
972 double d;
973 /* ... */
974 f1 = f2 * d;
975 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
976 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
977 were replaced by the constant 2.0, which has type double).
979 [<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
981 12 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
982 semantics. Values are independent of whether they are represented in a register or in memory. For
983 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
984 is required to round to the precision of the storage type. In particular, casts and assignments are required to
985 perform their specified conversion. For the fragment
986 double d1, d2;
987 float f;
988 d1 = f = expression;
989 d2 = (float) expression;
990 the values assigned to d1 and d2 are required to have been converted to float.
992 13 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
993 precision as well as range. The implementation cannot generally apply the mathematical associative rules
994 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
995 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
996 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
997 numbers are often not valid (see <a href="#F.8">F.8</a>).
998 double x, y, z;
999 /* ... */
1000 x = (x * y) * z; // not equivalent to x *= y * z;
1001 z = (x - y) + y ; // not equivalent to z = x;
1002 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1003 y = x / 5.0; // not equivalent to y = x * 0.2;
1005 14 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1006 int a, b;
1007 /* ... */
1008 a = a + 32760 + b + 5;
1009 the expression statement behaves exactly the same as
1010 a = (((a + 32760) + b) + 5);
1011 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1012 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1013 which overflows produce an explicit trap and in which the range of values representable by an int is
1014 [-32768, +32767], the implementation cannot rewrite this expression as
1015 a = ((a + b) + 32765);
1016 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1017 while the original expression would not; nor can the expression be rewritten either as
1018 a = ((a + 32765) + b);
1020 a = (a + (b + 32765));
1021 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1022 in which overflow silently generates some value and where positive and negative overflows cancel, the
1023 above expression statement can be rewritten by the implementation in any of the above ways because the
1024 same result will occur.
1026 [<a name="p15" href="#p15">page 15</a>] (<a href="#Contents">Contents</a>)
1028 15 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1029 following fragment
1030 #include <a href="#7.19">&lt;stdio.h&gt;</a>
1031 int sum;
1032 char *p;
1033 /* ... */
1034 sum = sum * 10 - '0' + (*p++ = getchar());
1035 the expression statement is grouped as if it were written as
1036 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1037 but the actual increment of p can occur at any time between the previous sequence point and the next
1038 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1039 value.
1041 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
1042 signal function (<a href="#7.14">7.14</a>), files (<a href="#7.19.3">7.19.3</a>).
1044 [<a name="p16" href="#p16">page 16</a>] (<a href="#Contents">Contents</a>)
1046 <a name="5.2" href="#5.2"><b> 5.2 Environmental considerations</b></a>
1047 <a name="5.2.1" href="#5.2.1"><b> 5.2.1 Character sets</b></a>
1048 1 Two sets of characters and their associated collating sequences shall be defined: the set in
1049 which source files are written (the source character set), and the set interpreted in the
1050 execution environment (the execution character set). Each set is further divided into a
1051 basic character set, whose contents are given by this subclause, and a set of zero or more
1052 locale-specific members (which are not members of the basic character set) called
1053 extended characters. The combined set is also called the extended character set. The
1054 values of the members of the execution character set are implementation-defined.
1055 2 In a character constant or string literal, members of the execution character set shall be
1056 represented by corresponding members of the source character set or by escape
1057 sequences consisting of the backslash \ followed by one or more characters. A byte with
1058 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1059 is used to terminate a character string.
1060 3 Both the basic source and basic execution character sets shall have the following
1061 members: the 26 uppercase letters of the Latin alphabet
1062 A B C D E F G H I J K L M
1063 N O P Q R S T U V W X Y Z
1064 the 26 lowercase letters of the Latin alphabet
1065 a b c d e f g h i j k l m
1066 n o p q r s t u v w x y z
1067 the 10 decimal digits
1068 0 1 2 3 4 5 6 7 8 9
1069 the following 29 graphic characters
1070 ! " # % &amp; ' ( ) * + , - . / :
1071 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~
1072 the space character, and control characters representing horizontal tab, vertical tab, and
1073 form feed. The representation of each member of the source and execution basic
1074 character sets shall fit in a byte. In both the source and execution basic character sets, the
1075 value of each character after 0 in the above list of decimal digits shall be one greater than
1076 the value of the previous. In source files, there shall be some way of indicating the end of
1077 each line of text; this International Standard treats such an end-of-line indicator as if it
1078 were a single new-line character. In the basic execution character set, there shall be
1079 control characters representing alert, backspace, carriage return, and new line. If any
1080 other characters are encountered in a source file (except in an identifier, a character
1081 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1083 [<a name="p17" href="#p17">page 17</a>] (<a href="#Contents">Contents</a>)
1085 converted to a token), the behavior is undefined.
1086 4 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1087 Standard the term does not include other characters that are letters in other alphabets.
1088 5 The universal character name construct provides a way to name other characters.
1089 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>),
1090 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>).
1091 <a name="5.2.1.1" href="#5.2.1.1"><b> 5.2.1.1 Trigraph sequences</b></a>
1092 1 Before any other processing takes place, each occurrence of one of the following
1093 sequences of three characters (called trigraph sequences<sup><a href="#note12"><b>12)</b></a></sup>) is replaced with the
1094 corresponding single character.
1095 ??= # ??) ] ??! |
1096 ??( [ ??' ^ ??&gt; }
1097 ??/ \ ??&lt; { ??- ~
1098 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1099 above is not changed.
1100 2 EXAMPLE 1
1101 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1102 becomes
1103 #define arraycheck(a, b) a[b] || b[a]
1105 3 EXAMPLE 2 The following source line
1106 printf("Eh???/n");
1107 becomes (after replacement of the trigraph sequence ??/)
1108 printf("Eh?\n");
1110 <a name="5.2.1.2" href="#5.2.1.2"><b> 5.2.1.2 Multibyte characters</b></a>
1111 1 The source character set may contain multibyte characters, used to represent members of
1112 the extended character set. The execution character set may also contain multibyte
1113 characters, which need not have the same encoding as for the source character set. For
1114 both character sets, the following shall hold:
1115 -- The basic character set shall be present and each character shall be encoded as a
1116 single byte.
1117 -- The presence, meaning, and representation of any additional members is locale-
1118 specific.
1120 <sup><a name="note12" href="#note12"><b>12)</b></a></sup> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1121 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1123 [<a name="p18" href="#p18">page 18</a>] (<a href="#Contents">Contents</a>)
1125 -- A multibyte character set may have a state-dependent encoding, wherein each
1126 sequence of multibyte characters begins in an initial shift state and enters other
1127 locale-specific shift states when specific multibyte characters are encountered in the
1128 sequence. While in the initial shift state, all single-byte characters retain their usual
1129 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1130 in the sequence is a function of the current shift state.
1131 -- A byte with all bits zero shall be interpreted as a null character independent of shift
1132 state. Such a byte shall not occur as part of any other multibyte character.
1133 2 For source files, the following shall hold:
1134 -- An identifier, comment, string literal, character constant, or header name shall begin
1135 and end in the initial shift state.
1136 -- An identifier, comment, string literal, character constant, or header name shall consist
1137 of a sequence of valid multibyte characters.
1138 <a name="5.2.2" href="#5.2.2"><b> 5.2.2 Character display semantics</b></a>
1139 1 The active position is that location on a display device where the next character output by
1140 the fputc function would appear. The intent of writing a printing character (as defined
1141 by the isprint function) to a display device is to display a graphic representation of
1142 that character at the active position and then advance the active position to the next
1143 position on the current line. The direction of writing is locale-specific. If the active
1144 position is at the final position of a line (if there is one), the behavior of the display device
1145 is unspecified.
1146 2 Alphabetic escape sequences representing nongraphic characters in the execution
1147 character set are intended to produce actions on display devices as follows:
1148 \a (alert) Produces an audible or visible alert without changing the active position.
1149 \b (backspace) Moves the active position to the previous position on the current line. If
1150 the active position is at the initial position of a line, the behavior of the display
1151 device is unspecified.
1152 \f ( form feed) Moves the active position to the initial position at the start of the next
1153 logical page.
1154 \n (new line) Moves the active position to the initial position of the next line.
1155 \r (carriage return) Moves the active position to the initial position of the current line.
1156 \t (horizontal tab) Moves the active position to the next horizontal tabulation position
1157 on the current line. If the active position is at or past the last defined horizontal
1158 tabulation position, the behavior of the display device is unspecified.
1159 \v (vertical tab) Moves the active position to the initial position of the next vertical
1160 tabulation position. If the active position is at or past the last defined vertical
1162 [<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
1164 tabulation position, the behavior of the display device is unspecified.
1165 3 Each of these escape sequences shall produce a unique implementation-defined value
1166 which can be stored in a single char object. The external representations in a text file
1167 need not be identical to the internal representations, and are outside the scope of this
1168 International Standard.
1169 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>).
1170 <a name="5.2.3" href="#5.2.3"><b> 5.2.3 Signals and interrupts</b></a>
1171 1 Functions shall be implemented such that they may be interrupted at any time by a signal,
1172 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1173 invocations' control flow (after the interruption), function return values, or objects with
1174 automatic storage duration. All such objects shall be maintained outside the function
1175 image (the instructions that compose the executable representation of a function) on a
1176 per-invocation basis.
1177 <a name="5.2.4" href="#5.2.4"><b> 5.2.4 Environmental limits</b></a>
1178 1 Both the translation and execution environments constrain the implementation of
1179 language translators and libraries. The following summarizes the language-related
1180 environmental limits on a conforming implementation; the library-related limits are
1181 discussed in clause 7.
1182 <a name="5.2.4.1" href="#5.2.4.1"><b> 5.2.4.1 Translation limits</b></a>
1183 1 The implementation shall be able to translate and execute at least one program that
1184 contains at least one instance of every one of the following limits:<sup><a href="#note13"><b>13)</b></a></sup>
1185 -- 127 nesting levels of blocks
1186 -- 63 nesting levels of conditional inclusion
1187 -- 12 pointer, array, and function declarators (in any combinations) modifying an
1188 arithmetic, structure, union, or incomplete type in a declaration
1189 -- 63 nesting levels of parenthesized declarators within a full declarator
1190 -- 63 nesting levels of parenthesized expressions within a full expression
1191 -- 63 significant initial characters in an internal identifier or a macro name (each
1192 universal character name or extended source character is considered a single
1193 character)
1194 -- 31 significant initial characters in an external identifier (each universal character name
1195 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1198 <sup><a name="note13" href="#note13"><b>13)</b></a></sup> Implementations should avoid imposing fixed translation limits whenever possible.
1200 [<a name="p20" href="#p20">page 20</a>] (<a href="#Contents">Contents</a>)
1202 universal character name specifying a short identifier of 00010000 or more is
1203 considered 10 characters, and each extended source character is considered the same
1204 number of characters as the corresponding universal character name, if any)<sup><a href="#note14"><b>14)</b></a></sup>
1205 -- 4095 external identifiers in one translation unit
1206 -- 511 identifiers with block scope declared in one block
1207 -- 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1208 -- 127 parameters in one function definition
1209 -- 127 arguments in one function call
1210 -- 127 parameters in one macro definition
1211 -- 127 arguments in one macro invocation
1212 -- 4095 characters in a logical source line
1213 -- 4095 characters in a character string literal or wide string literal (after concatenation)
1214 -- 65535 bytes in an object (in a hosted environment only)
1215 -- 15 nesting levels for #included files
1216 -- 1023 case labels for a switch statement (excluding those for any nested switch
1217 statements)
1218 -- 1023 members in a single structure or union
1219 -- 1023 enumeration constants in a single enumeration
1220 -- 63 levels of nested structure or union definitions in a single struct-declaration-list
1221 <a name="5.2.4.2" href="#5.2.4.2"><b> 5.2.4.2 Numerical limits</b></a>
1222 1 An implementation is required to document all the limits specified in this subclause,
1223 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
1224 specified in <a href="#7.18">&lt;stdint.h&gt;</a>.
1225 Forward references: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>).
1226 <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>
1227 1 The values given below shall be replaced by constant expressions suitable for use in #if
1228 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1229 following shall be replaced by expressions that have the same type as would an
1230 expression that is an object of the corresponding type converted according to the integer
1231 promotions. Their implementation-defined values shall be equal or greater in magnitude
1234 <sup><a name="note14" href="#note14"><b>14)</b></a></sup> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1236 [<a name="p21" href="#p21">page 21</a>] (<a href="#Contents">Contents</a>)
1238 (absolute value) to those shown, with the same sign.
1239 -- number of bits for smallest object that is not a bit-field (byte)
1240 CHAR_BIT 8
1241 -- minimum value for an object of type signed char
1242 SCHAR_MIN -127 // -(27 - 1)
1243 -- maximum value for an object of type signed char
1244 SCHAR_MAX +127 // 27 - 1
1245 -- maximum value for an object of type unsigned char
1246 UCHAR_MAX 255 // 28 - 1
1247 -- minimum value for an object of type char
1248 CHAR_MIN see below
1249 -- maximum value for an object of type char
1250 CHAR_MAX see below
1251 -- maximum number of bytes in a multibyte character, for any supported locale
1252 MB_LEN_MAX 1
1253 -- minimum value for an object of type short int
1254 SHRT_MIN -32767 // -(215 - 1)
1255 -- maximum value for an object of type short int
1256 SHRT_MAX +32767 // 215 - 1
1257 -- maximum value for an object of type unsigned short int
1258 USHRT_MAX 65535 // 216 - 1
1259 -- minimum value for an object of type int
1260 INT_MIN -32767 // -(215 - 1)
1261 -- maximum value for an object of type int
1262 INT_MAX +32767 // 215 - 1
1263 -- maximum value for an object of type unsigned int
1264 UINT_MAX 65535 // 216 - 1
1265 -- minimum value for an object of type long int
1266 LONG_MIN -2147483647 // -(231 - 1)
1267 -- maximum value for an object of type long int
1268 LONG_MAX +2147483647 // 231 - 1
1269 -- maximum value for an object of type unsigned long int
1270 ULONG_MAX 4294967295 // 232 - 1
1272 [<a name="p22" href="#p22">page 22</a>] (<a href="#Contents">Contents</a>)
1274 -- minimum value for an object of type long long int
1275 LLONG_MIN -9223372036854775807 // -(263 - 1)
1276 -- maximum value for an object of type long long int
1277 LLONG_MAX +9223372036854775807 // 263 - 1
1278 -- maximum value for an object of type unsigned long long int
1279 ULLONG_MAX 18446744073709551615 // 264 - 1
1280 2 If the value of an object of type char is treated as a signed integer when used in an
1281 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1282 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1283 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1284 UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
1285 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>).
1286 <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>
1287 1 The characteristics of floating types are defined in terms of a model that describes a
1288 representation of floating-point numbers and values that provide information about an
1289 implementation's floating-point arithmetic.<sup><a href="#note16"><b>16)</b></a></sup> The following parameters are used to
1290 define the model for each floating-point type:
1291 s sign ((+-)1)
1292 b base or radix of exponent representation (an integer &gt; 1)
1293 e exponent (an integer between a minimum emin and a maximum emax )
1294 p precision (the number of base-b digits in the significand)
1295 fk nonnegative integers less than b (the significand digits)
1296 2 A floating-point number (x) is defined by the following model:
1298 x = sb e (Sum) f k b-k ,
1300 emin &lt;= e &lt;= emax
1302 3 In addition to normalized floating-point numbers ( f 1 &gt; 0 if x != 0), floating types may be
1303 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1304 numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
1305 e &gt; emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
1306 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1307 through almost every arithmetic operation without raising a floating-point exception; a
1308 signaling NaN generally raises a floating-point exception when occurring as an
1311 <sup><a name="note15" href="#note15"><b>15)</b></a></sup> See <a href="#6.2.5">6.2.5</a>.
1312 <sup><a name="note16" href="#note16"><b>16)</b></a></sup> The floating-point model is intended to clarify the description of each floating-point characteristic and
1313 does not require the floating-point arithmetic of the implementation to be identical.
1315 [<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
1317 arithmetic operand.<sup><a href="#note17"><b>17)</b></a></sup>
1318 4 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
1319 sign or may leave them unsigned. Wherever such values are unsigned, any requirement
1320 in this International Standard to retrieve the sign shall produce an unspecified sign, and
1321 any requirement to set the sign shall be ignored.
1322 5 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1323 <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-
1324 defined, as is the accuracy of the conversion between floating-point internal
1325 representations and string representations performed by the library functions in
1326 <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
1327 accuracy is unknown.
1328 6 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
1329 expressions suitable for use in #if preprocessing directives; all floating values shall be
1330 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1331 and FLT_ROUNDS have separate names for all three floating-point types. The floating-
1332 point model representation is provided for all values except FLT_EVAL_METHOD and
1333 FLT_ROUNDS.
1334 7 The rounding mode for floating-point addition is characterized by the implementation-
1335 defined value of FLT_ROUNDS:<sup><a href="#note18"><b>18)</b></a></sup>
1336 -1 indeterminable
1337 0 toward zero
1338 1 to nearest
1339 2 toward positive infinity
1340 3 toward negative infinity
1341 All other values for FLT_ROUNDS characterize implementation-defined rounding
1342 behavior.
1343 8 Except for assignment and cast (which remove all extra range and precision), the values
1344 of operations with floating operands and values subject to the usual arithmetic
1345 conversions and of floating constants are evaluated to a format whose range and precision
1346 may be greater than required by the type. The use of evaluation formats is characterized
1347 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note19"><b>19)</b></a></sup>
1351 <sup><a name="note17" href="#note17"><b>17)</b></a></sup> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1352 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1353 similar behavior.
1354 <sup><a name="note18" href="#note18"><b>18)</b></a></sup> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1355 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
1357 [<a name="p24" href="#p24">page 24</a>] (<a href="#Contents">Contents</a>)
1359 -1 indeterminable;
1360 0 evaluate all operations and constants just to the range and precision of the
1361 type;
1362 1 evaluate operations and constants of type float and double to the
1363 range and precision of the double type, evaluate long double
1364 operations and constants to the range and precision of the long double
1365 type;
1366 2 evaluate all operations and constants to the range and precision of the
1367 long double type.
1368 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1369 behavior.
1370 9 The values given in the following list shall be replaced by constant expressions with
1371 implementation-defined values that are greater or equal in magnitude (absolute value) to
1372 those shown, with the same sign:
1373 -- radix of exponent representation, b
1374 FLT_RADIX 2
1375 -- number of base-FLT_RADIX digits in the floating-point significand, p
1376 FLT_MANT_DIG
1377 DBL_MANT_DIG
1378 LDBL_MANT_DIG
1379 -- number of decimal digits, n, such that any floating-point number in the widest
1380 supported floating type with pmax radix b digits can be rounded to a floating-point
1381 number with n decimal digits and back again without change to the value,
1382 ??? pmax log10 b if b is a power of 10
1384 ??? ???1 + pmax log10 b??? otherwise
1385 DECIMAL_DIG 10
1386 -- number of decimal digits, q, such that any floating-point number with q decimal digits
1387 can be rounded into a floating-point number with p radix b digits and back again
1388 without change to the q decimal digits,
1393 <sup><a name="note19" href="#note19"><b>19)</b></a></sup> The evaluation method determines evaluation formats of expressions involving all floating types, not
1394 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1395 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1396 double.
1398 [<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
1400 ??? p log10 b if b is a power of 10
1402 ??? ???( p - 1) log10 b??? otherwise
1403 FLT_DIG 6
1404 DBL_DIG 10
1405 LDBL_DIG 10
1406 -- minimum negative integer such that FLT_RADIX raised to one less than that power is
1407 a normalized floating-point number, emin
1408 FLT_MIN_EXP
1409 DBL_MIN_EXP
1410 LDBL_MIN_EXP
1411 -- minimum negative integer such that 10 raised to that power is in the range of
1412 normalized floating-point numbers, ???log10 b emin -1 ???
1413 ??? ???
1414 FLT_MIN_10_EXP -37
1415 DBL_MIN_10_EXP -37
1416 LDBL_MIN_10_EXP -37
1417 -- maximum integer such that FLT_RADIX raised to one less than that power is a
1418 representable finite floating-point number, emax
1419 FLT_MAX_EXP
1420 DBL_MAX_EXP
1421 LDBL_MAX_EXP
1422 -- maximum integer such that 10 raised to that power is in the range of representable
1423 finite floating-point numbers, ???log10 ((1 - b- p )b emax )???
1424 FLT_MAX_10_EXP +37
1425 DBL_MAX_10_EXP +37
1426 LDBL_MAX_10_EXP +37
1427 10 The values given in the following list shall be replaced by constant expressions with
1428 implementation-defined values that are greater than or equal to those shown:
1429 -- maximum representable finite floating-point number, (1 - b- p )b emax
1430 FLT_MAX 1E+37
1431 DBL_MAX 1E+37
1432 LDBL_MAX 1E+37
1433 11 The values given in the following list shall be replaced by constant expressions with
1434 implementation-defined (positive) values that are less than or equal to those shown:
1435 -- the difference between 1 and the least value greater than 1 that is representable in the
1436 given floating point type, b1- p
1438 [<a name="p26" href="#p26">page 26</a>] (<a href="#Contents">Contents</a>)
1440 FLT_EPSILON 1E-5
1441 DBL_EPSILON 1E-9
1442 LDBL_EPSILON 1E-9
1443 -- minimum normalized positive floating-point number, b emin -1
1444 FLT_MIN 1E-37
1445 DBL_MIN 1E-37
1446 LDBL_MIN 1E-37
1447 Recommended practice
1448 12 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1449 should be the identity function.
1450 13 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1451 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
1452 float:
1454 x = s16e (Sum) f k 16-k ,
1456 -31 &lt;= e &lt;= +32
1458 FLT_RADIX 16
1459 FLT_MANT_DIG 6
1460 FLT_EPSILON 9.53674316E-07F
1461 FLT_DIG 6
1462 FLT_MIN_EXP -31
1463 FLT_MIN 2.93873588E-39F
1464 FLT_MIN_10_EXP -38
1465 FLT_MAX_EXP +32
1466 FLT_MAX 3.40282347E+38F
1467 FLT_MAX_10_EXP +38
1469 14 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1470 single-precision and double-precision normalized numbers in IEC 60559,<sup><a href="#note20"><b>20)</b></a></sup> and the appropriate values in a
1471 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
1473 x f = s2e (Sum) f k 2-k ,
1475 -125 &lt;= e &lt;= +128
1478 x d = s2e (Sum) f k 2-k ,
1480 -1021 &lt;= e &lt;= +1024
1482 FLT_RADIX 2
1483 DECIMAL_DIG 17
1484 FLT_MANT_DIG 24
1485 FLT_EPSILON 1.19209290E-07F // decimal constant
1486 FLT_EPSILON 0X1P-23F // hex constant
1489 <sup><a name="note20" href="#note20"><b>20)</b></a></sup> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1490 limits are one less than shown here.
1492 [<a name="p27" href="#p27">page 27</a>] (<a href="#Contents">Contents</a>)
1494 FLT_DIG 6
1495 FLT_MIN_EXP -125
1496 FLT_MIN 1.17549435E-38F // decimal constant
1497 FLT_MIN 0X1P-126F // hex constant
1498 FLT_MIN_10_EXP -37
1499 FLT_MAX_EXP +128
1500 FLT_MAX 3.40282347E+38F // decimal constant
1501 FLT_MAX 0X1.fffffeP127F // hex constant
1502 FLT_MAX_10_EXP +38
1503 DBL_MANT_DIG 53
1504 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1505 DBL_EPSILON 0X1P-52 // hex constant
1506 DBL_DIG 15
1507 DBL_MIN_EXP -1021
1508 DBL_MIN 2.2250738585072014E-308 // decimal constant
1509 DBL_MIN 0X1P-1022 // hex constant
1510 DBL_MIN_10_EXP -307
1511 DBL_MAX_EXP +1024
1512 DBL_MAX 1.7976931348623157E+308 // decimal constant
1513 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1514 DBL_MAX_10_EXP +308
1515 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1516 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1517 precision), then DECIMAL_DIG would be 21.
1519 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1520 <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>
1521 (<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>
1522 (<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>).
1524 [<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
1527 <a name="6" href="#6"><b> 6. Language</b></a>
1528 <a name="6.1" href="#6.1"><b> 6.1 Notation</b></a>
1529 1 In the syntax notation used in this clause, syntactic categories (nonterminals) are
1530 indicated by italic type, and literal words and character set members (terminals) by bold
1531 type. A colon (:) following a nonterminal introduces its definition. Alternative
1532 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
1533 optional symbol is indicated by the subscript ''opt'', so that
1534 { expressionopt }
1535 indicates an optional expression enclosed in braces.
1536 2 When syntactic categories are referred to in the main text, they are not italicized and
1537 words are separated by spaces instead of hyphens.
1538 3 A summary of the language syntax is given in <a href="#A">annex A</a>.
1539 <a name="6.2" href="#6.2"><b> 6.2 Concepts</b></a>
1540 <a name="6.2.1" href="#6.2.1"><b> 6.2.1 Scopes of identifiers</b></a>
1541 1 An identifier can denote an object; a function; a tag or a member of a structure, union, or
1542 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
1543 same identifier can denote different entities at different points in the program. A member
1544 of an enumeration is called an enumeration constant. Macro names and macro
1545 parameters are not considered further here, because prior to the semantic phase of
1546 program translation any occurrences of macro names in the source file are replaced by the
1547 preprocessing token sequences that constitute their macro definitions.
1548 2 For each different entity that an identifier designates, the identifier is visible (i.e., can be
1549 used) only within a region of program text called its scope. Different entities designated
1550 by the same identifier either have different scopes, or are in different name spaces. There
1551 are four kinds of scopes: function, file, block, and function prototype. (A function
1552 prototype is a declaration of a function that declares the types of its parameters.)
1553 3 A label name is the only kind of identifier that has function scope. It can be used (in a
1554 goto statement) anywhere in the function in which it appears, and is declared implicitly
1555 by its syntactic appearance (followed by a : and a statement).
1556 4 Every other identifier has scope determined by the placement of its declaration (in a
1557 declarator or type specifier). If the declarator or type specifier that declares the identifier
1558 appears outside of any block or list of parameters, the identifier has file scope, which
1559 terminates at the end of the translation unit. If the declarator or type specifier that
1560 declares the identifier appears inside a block or within the list of parameter declarations in
1561 a function definition, the identifier has block scope, which terminates at the end of the
1562 associated block. If the declarator or type specifier that declares the identifier appears
1564 [<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
1566 within the list of parameter declarations in a function prototype (not part of a function
1567 definition), the identifier has function prototype scope, which terminates at the end of the
1568 function declarator. If an identifier designates two different entities in the same name
1569 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will be a
1570 strict subset of the scope of the other entity (the outer scope). Within the inner scope, the
1571 identifier designates the entity declared in the inner scope; the entity declared in the outer
1572 scope is hidden (and not visible) within the inner scope.
1573 5 Unless explicitly stated otherwise, where this International Standard uses the term
1574 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
1575 entity in the relevant name space whose declaration is visible at the point the identifier
1576 occurs.
1577 6 Two identifiers have the same scope if and only if their scopes terminate at the same
1578 point.
1579 7 Structure, union, and enumeration tags have scope that begins just after the appearance of
1580 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
1581 begins just after the appearance of its defining enumerator in an enumerator list. Any
1582 other identifier has scope that begins just after the completion of its declarator.
1583 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
1584 (<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>),
1585 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
1586 <a name="6.2.2" href="#6.2.2"><b> 6.2.2 Linkages of identifiers</b></a>
1587 1 An identifier declared in different scopes or in the same scope more than once can be
1588 made to refer to the same object or function by a process called linkage.<sup><a href="#note21"><b>21)</b></a></sup> There are
1589 three kinds of linkage: external, internal, and none.
1590 2 In the set of translation units and libraries that constitutes an entire program, each
1591 declaration of a particular identifier with external linkage denotes the same object or
1592 function. Within one translation unit, each declaration of an identifier with internal
1593 linkage denotes the same object or function. Each declaration of an identifier with no
1594 linkage denotes a unique entity.
1595 3 If the declaration of a file scope identifier for an object or a function contains the storage-
1596 class specifier static, the identifier has internal linkage.<sup><a href="#note22"><b>22)</b></a></sup>
1597 4 For an identifier declared with the storage-class specifier extern in a scope in which a
1601 <sup><a name="note21" href="#note21"><b>21)</b></a></sup> There is no linkage between different identifiers.
1602 <sup><a name="note22" href="#note22"><b>22)</b></a></sup> A function declaration can contain the storage-class specifier static only if it is at file scope; see
1603 <a href="#6.7.1">6.7.1</a>.
1605 [<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
1607 prior declaration of that identifier is visible,<sup><a href="#note23"><b>23)</b></a></sup> if the prior declaration specifies internal or
1608 external linkage, the linkage of the identifier at the later declaration is the same as the
1609 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
1610 declaration specifies no linkage, then the identifier has external linkage.
1611 5 If the declaration of an identifier for a function has no storage-class specifier, its linkage
1612 is determined exactly as if it were declared with the storage-class specifier extern. If
1613 the declaration of an identifier for an object has file scope and no storage-class specifier,
1614 its linkage is external.
1615 6 The following identifiers have no linkage: an identifier declared to be anything other than
1616 an object or a function; an identifier declared to be a function parameter; a block scope
1617 identifier for an object declared without the storage-class specifier extern.
1618 7 If, within a translation unit, the same identifier appears with both internal and external
1619 linkage, the behavior is undefined.
1620 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>),
1621 statements (<a href="#6.8">6.8</a>).
1622 <a name="6.2.3" href="#6.2.3"><b> 6.2.3 Name spaces of identifiers</b></a>
1623 1 If more than one declaration of a particular identifier is visible at any point in a
1624 translation unit, the syntactic context disambiguates uses that refer to different entities.
1625 Thus, there are separate name spaces for various categories of identifiers, as follows:
1626 -- label names (disambiguated by the syntax of the label declaration and use);
1627 -- the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note24"><b>24)</b></a></sup>
1628 of the keywords struct, union, or enum);
1629 -- the members of structures or unions; each structure or union has a separate name
1630 space for its members (disambiguated by the type of the expression used to access the
1631 member via the . or -&gt; operator);
1632 -- all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
1633 enumeration constants).
1634 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>),
1635 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
1636 (<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>).
1641 <sup><a name="note23" href="#note23"><b>23)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
1642 <sup><a name="note24" href="#note24"><b>24)</b></a></sup> There is only one name space for tags even though three are possible.
1644 [<a name="p31" href="#p31">page 31</a>] (<a href="#Contents">Contents</a>)
1646 <a name="6.2.4" href="#6.2.4"><b> 6.2.4 Storage durations of objects</b></a>
1647 1 An object has a storage duration that determines its lifetime. There are three storage
1648 durations: static, automatic, and allocated. Allocated storage is described in <a href="#7.20.3">7.20.3</a>.
1649 2 The lifetime of an object is the portion of program execution during which storage is
1650 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note25"><b>25)</b></a></sup> and retains
1651 its last-stored value throughout its lifetime.<sup><a href="#note26"><b>26)</b></a></sup> If an object is referred to outside of its
1652 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
1653 the object it points to reaches the end of its lifetime.
1654 3 An object whose identifier is declared with external or internal linkage, or with the
1655 storage-class specifier static has static storage duration. Its lifetime is the entire
1656 execution of the program and its stored value is initialized only once, prior to program
1657 startup.
1658 4 An object whose identifier is declared with no linkage and without the storage-class
1659 specifier static has automatic storage duration.
1660 5 For such an object that does not have a variable length array type, its lifetime extends
1661 from entry into the block with which it is associated until execution of that block ends in
1662 any way. (Entering an enclosed block or calling a function suspends, but does not end,
1663 execution of the current block.) If the block is entered recursively, a new instance of the
1664 object is created each time. The initial value of the object is indeterminate. If an
1665 initialization is specified for the object, it is performed each time the declaration is
1666 reached in the execution of the block; otherwise, the value becomes indeterminate each
1667 time the declaration is reached.
1668 6 For such an object that does have a variable length array type, its lifetime extends from
1669 the declaration of the object until execution of the program leaves the scope of the
1670 declaration.<sup><a href="#note27"><b>27)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
1671 each time. The initial value of the object is indeterminate.
1672 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
1673 declarators (<a href="#6.7.5.2">6.7.5.2</a>), initialization (<a href="#6.7.8">6.7.8</a>).
1678 <sup><a name="note25" href="#note25"><b>25)</b></a></sup> The term ''constant address'' means that two pointers to the object constructed at possibly different
1679 times will compare equal. The address may be different during two different executions of the same
1680 program.
1681 <sup><a name="note26" href="#note26"><b>26)</b></a></sup> In the case of a volatile object, the last store need not be explicit in the program.
1682 <sup><a name="note27" href="#note27"><b>27)</b></a></sup> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
1683 embedded block prior to the declaration, leaves the scope of the declaration.
1685 [<a name="p32" href="#p32">page 32</a>] (<a href="#Contents">Contents</a>)
1687 <a name="6.2.5" href="#6.2.5"><b> 6.2.5 Types</b></a>
1688 1 The meaning of a value stored in an object or returned by a function is determined by the
1689 type of the expression used to access it. (An identifier declared to be an object is the
1690 simplest such expression; the type is specified in the declaration of the identifier.) Types
1691 are partitioned into object types (types that fully describe objects), function types (types
1692 that describe functions), and incomplete types (types that describe objects but lack
1693 information needed to determine their sizes).
1694 2 An object declared as type _Bool is large enough to store the values 0 and 1.
1695 3 An object declared as type char is large enough to store any member of the basic
1696 execution character set. If a member of the basic execution character set is stored in a
1697 char object, its value is guaranteed to be nonnegative. If any other character is stored in
1698 a char object, the resulting value is implementation-defined but shall be within the range
1699 of values that can be represented in that type.
1700 4 There are five standard signed integer types, designated as signed char, short
1701 int, int, long int, and long long int. (These and other types may be
1702 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
1703 implementation-defined extended signed integer types.<sup><a href="#note28"><b>28)</b></a></sup> The standard and extended
1704 signed integer types are collectively called signed integer types.<sup><a href="#note29"><b>29)</b></a></sup>
1705 5 An object declared as type signed char occupies the same amount of storage as a
1706 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
1707 architecture of the execution environment (large enough to contain any value in the range
1708 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
1709 6 For each of the signed integer types, there is a corresponding (but different) unsigned
1710 integer type (designated with the keyword unsigned) that uses the same amount of
1711 storage (including sign information) and has the same alignment requirements. The type
1712 _Bool and the unsigned integer types that correspond to the standard signed integer
1713 types are the standard unsigned integer types. The unsigned integer types that
1714 correspond to the extended signed integer types are the extended unsigned integer types.
1715 The standard and extended unsigned integer types are collectively called unsigned integer
1716 types.<sup><a href="#note30"><b>30)</b></a></sup>
1720 <sup><a name="note28" href="#note28"><b>28)</b></a></sup> Implementation-defined keywords shall have the form of an identifier reserved for any use as
1721 described in <a href="#7.1.3">7.1.3</a>.
1722 <sup><a name="note29" href="#note29"><b>29)</b></a></sup> Therefore, any statement in this Standard about signed integer types also applies to the extended
1723 signed integer types.
1724 <sup><a name="note30" href="#note30"><b>30)</b></a></sup> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
1725 unsigned integer types.
1727 [<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
1729 7 The standard signed integer types and standard unsigned integer types are collectively
1730 called the standard integer types, the extended signed integer types and extended
1731 unsigned integer types are collectively called the extended integer types.
1732 8 For any two integer types with the same signedness and different integer conversion rank
1733 (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
1734 subrange of the values of the other type.
1735 9 The range of nonnegative values of a signed integer type is a subrange of the
1736 corresponding unsigned integer type, and the representation of the same value in each
1737 type is the same.<sup><a href="#note31"><b>31)</b></a></sup> A computation involving unsigned operands can never overflow,
1738 because a result that cannot be represented by the resulting unsigned integer type is
1739 reduced modulo the number that is one greater than the largest value that can be
1740 represented by the resulting type.
1741 10 There are three real floating types, designated as float, double, and long
1742 double.<sup><a href="#note32"><b>32)</b></a></sup> The set of values of the type float is a subset of the set of values of the
1743 type double; the set of values of the type double is a subset of the set of values of the
1744 type long double.
1745 11 There are three complex types, designated as float _Complex, double
1746 _Complex, and long double _Complex.<sup><a href="#note33"><b>33)</b></a></sup> The real floating and complex types
1747 are collectively called the floating types.
1748 12 For each floating type there is a corresponding real type, which is always a real floating
1749 type. For real floating types, it is the same type. For complex types, it is the type given
1750 by deleting the keyword _Complex from the type name.
1751 13 Each complex type has the same representation and alignment requirements as an array
1752 type containing exactly two elements of the corresponding real type; the first element is
1753 equal to the real part, and the second element to the imaginary part, of the complex
1754 number.
1755 14 The type char, the signed and unsigned integer types, and the floating types are
1756 collectively called the basic types. Even if the implementation defines two or more basic
1757 types to have the same representation, they are nevertheless different types.<sup><a href="#note34"><b>34)</b></a></sup>
1759 <sup><a name="note31" href="#note31"><b>31)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
1760 arguments to functions, return values from functions, and members of unions.
1761 <sup><a name="note32" href="#note32"><b>32)</b></a></sup> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
1762 <sup><a name="note33" href="#note33"><b>33)</b></a></sup> A specification for imaginary types is in informative <a href="#G">annex G</a>.
1763 <sup><a name="note34" href="#note34"><b>34)</b></a></sup> An implementation may define new keywords that provide alternative ways to designate a basic (or
1764 any other) type; this does not violate the requirement that all basic types be different.
1765 Implementation-defined keywords shall have the form of an identifier reserved for any use as
1766 described in <a href="#7.1.3">7.1.3</a>.
1768 [<a name="p34" href="#p34">page 34</a>] (<a href="#Contents">Contents</a>)
1770 15 The three types char, signed char, and unsigned char are collectively called
1771 the character types. The implementation shall define char to have the same range,
1772 representation, and behavior as either signed char or unsigned char.<sup><a href="#note35"><b>35)</b></a></sup>
1773 16 An enumeration comprises a set of named integer constant values. Each distinct
1774 enumeration constitutes a different enumerated type.
1775 17 The type char, the signed and unsigned integer types, and the enumerated types are
1776 collectively called integer types. The integer and real floating types are collectively called
1777 real types.
1778 18 Integer and floating types are collectively called arithmetic types. Each arithmetic type
1779 belongs to one type domain: the real type domain comprises the real types, the complex
1780 type domain comprises the complex types.
1781 19 The void type comprises an empty set of values; it is an incomplete type that cannot be
1782 completed.
1783 20 Any number of derived types can be constructed from the object, function, and
1784 incomplete types, as follows:
1785 -- An array type describes a contiguously allocated nonempty set of objects with a
1786 particular member object type, called the element type.<sup><a href="#note36"><b>36)</b></a></sup> Array types are
1787 characterized by their element type and by the number of elements in the array. An
1788 array type is said to be derived from its element type, and if its element type is T , the
1789 array type is sometimes called ''array of T ''. The construction of an array type from
1790 an element type is called ''array type derivation''.
1791 -- A structure type describes a sequentially allocated nonempty set of member objects
1792 (and, in certain circumstances, an incomplete array), each of which has an optionally
1793 specified name and possibly distinct type.
1794 -- A union type describes an overlapping nonempty set of member objects, each of
1795 which has an optionally specified name and possibly distinct type.
1796 -- A function type describes a function with specified return type. A function type is
1797 characterized by its return type and the number and types of its parameters. A
1798 function type is said to be derived from its return type, and if its return type is T , the
1799 function type is sometimes called ''function returning T ''. The construction of a
1800 function type from a return type is called ''function type derivation''.
1804 <sup><a name="note35" href="#note35"><b>35)</b></a></sup> 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
1805 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
1806 other two and is not compatible with either.
1807 <sup><a name="note36" href="#note36"><b>36)</b></a></sup> Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
1809 [<a name="p35" href="#p35">page 35</a>] (<a href="#Contents">Contents</a>)
1811 -- A pointer type may be derived from a function type, an object type, or an incomplete
1812 type, called the referenced type. A pointer type describes an object whose value
1813 provides a reference to an entity of the referenced type. A pointer type derived from
1814 the referenced type T is sometimes called ''pointer to T ''. The construction of a
1815 pointer type from a referenced type is called ''pointer type derivation''.
1816 These methods of constructing derived types can be applied recursively.
1817 21 Arithmetic types and pointer types are collectively called scalar types. Array and
1818 structure types are collectively called aggregate types.<sup><a href="#note37"><b>37)</b></a></sup>
1819 22 An array type of unknown size is an incomplete type. It is completed, for an identifier of
1820 that type, by specifying the size in a later declaration (with internal or external linkage).
1821 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
1822 type. It is completed, for all declarations of that type, by declaring the same structure or
1823 union tag with its defining content later in the same scope.
1824 23 A type has known constant size if the type is not incomplete and is not a variable length
1825 array type.
1826 24 Array, function, and pointer types are collectively called derived declarator types. A
1827 declarator type derivation from a type T is the construction of a derived declarator type
1828 from T by the application of an array-type, a function-type, or a pointer-type derivation to
1830 25 A type is characterized by its type category, which is either the outermost derivation of a
1831 derived type (as noted above in the construction of derived types), or the type itself if the
1832 type consists of no derived types.
1833 26 Any type so far mentioned is an unqualified type. Each unqualified type has several
1834 qualified versions of its type,<sup><a href="#note38"><b>38)</b></a></sup> corresponding to the combinations of one, two, or all
1835 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
1836 versions of a type are distinct types that belong to the same type category and have the
1837 same representation and alignment requirements.<sup><a href="#note39"><b>39)</b></a></sup> A derived type is not qualified by the
1838 qualifiers (if any) of the type from which it is derived.
1839 27 A pointer to void shall have the same representation and alignment requirements as a
1840 pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of
1841 compatible types shall have the same representation and alignment requirements. All
1844 <sup><a name="note37" href="#note37"><b>37)</b></a></sup> Note that aggregate type does not include union type because an object with union type can only
1845 contain one member at a time.
1846 <sup><a name="note38" href="#note38"><b>38)</b></a></sup> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
1847 <sup><a name="note39" href="#note39"><b>39)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
1848 arguments to functions, return values from functions, and members of unions.
1850 [<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
1852 pointers to structure types shall have the same representation and alignment requirements
1853 as each other. All pointers to union types shall have the same representation and
1854 alignment requirements as each other. Pointers to other types need not have the same
1855 representation or alignment requirements.
1856 28 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
1857 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
1858 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
1859 qualified float'' and is a pointer to a qualified type.
1861 29 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
1862 function returning struct tag''. The array has length five and the function has a single parameter of type
1863 float. Its type category is array.
1865 Forward references: compatible type and composite type (<a href="#6.2.7">6.2.7</a>), declarations (<a href="#6.7">6.7</a>).
1866 <a name="6.2.6" href="#6.2.6"><b> 6.2.6 Representations of types</b></a>
1867 <a name="6.2.6.1" href="#6.2.6.1"><b> 6.2.6.1 General</b></a>
1868 1 The representations of all types are unspecified except as stated in this subclause.
1869 2 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
1870 the number, order, and encoding of which are either explicitly specified or
1871 implementation-defined.
1872 3 Values stored in unsigned bit-fields and objects of type unsigned char shall be
1873 represented using a pure binary notation.<sup><a href="#note40"><b>40)</b></a></sup>
1874 4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
1875 bits, where n is the size of an object of that type, in bytes. The value may be copied into
1876 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
1877 called the object representation of the value. Values stored in bit-fields consist of m bits,
1878 where m is the size specified for the bit-field. The object representation is the set of m
1879 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
1880 than NaNs) with the same object representation compare equal, but values that compare
1881 equal may have different object representations.
1882 5 Certain object representations need not represent a value of the object type. If the stored
1883 value of an object has such a representation and is read by an lvalue expression that does
1884 not have character type, the behavior is undefined. If such a representation is produced
1885 by a side effect that modifies all or any part of the object by an lvalue expression that
1886 does not have character type, the behavior is undefined.<sup><a href="#note41"><b>41)</b></a></sup> Such a representation is called
1888 <sup><a name="note40" href="#note40"><b>40)</b></a></sup> A positional representation for integers that uses the binary digits 0 and 1, in which the values
1889 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
1890 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
1891 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
1892 type unsigned char range from 0 to 2
1893 CHAR_BIT
1894 - 1.
1896 [<a name="p37" href="#p37">page 37</a>] (<a href="#Contents">Contents</a>)
1898 a trap representation.
1899 6 When a value is stored in an object of structure or union type, including in a member
1900 object, the bytes of the object representation that correspond to any padding bytes take
1901 unspecified values.<sup><a href="#note42"><b>42)</b></a></sup> The value of a structure or union object is never a trap
1902 representation, even though the value of a member of the structure or union object may be
1903 a trap representation.
1904 7 When a value is stored in a member of an object of union type, the bytes of the object
1905 representation that do not correspond to that member but do correspond to other members
1906 take unspecified values.
1907 8 Where an operator is applied to a value that has more than one object representation,
1908 which object representation is used shall not affect the value of the result.<sup><a href="#note43"><b>43)</b></a></sup> Where a
1909 value is stored in an object using a type that has more than one object representation for
1910 that value, it is unspecified which representation is used, but a trap representation shall
1911 not be generated.
1912 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), lvalues, arrays, and function
1913 designators (<a href="#6.3.2.1">6.3.2.1</a>).
1914 <a name="6.2.6.2" href="#6.2.6.2"><b> 6.2.6.2 Integer types</b></a>
1915 1 For unsigned integer types other than unsigned char, the bits of the object
1916 representation shall be divided into two groups: value bits and padding bits (there need
1917 not be any of the latter). If there are N value bits, each bit shall represent a different
1918 power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
1919 representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
1920 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note44"><b>44)</b></a></sup>
1921 2 For signed integer types, the bits of the object representation shall be divided into three
1922 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
1924 <sup><a name="note41" href="#note41"><b>41)</b></a></sup> Thus, an automatic variable can be initialized to a trap representation without causing undefined
1925 behavior, but the value of the variable cannot be used until a proper value is stored in it.
1926 <sup><a name="note42" href="#note42"><b>42)</b></a></sup> Thus, for example, structure assignment need not copy any padding bits.
1927 <sup><a name="note43" href="#note43"><b>43)</b></a></sup> It is possible for objects x and y with the same effective type T to have the same value when they are
1928 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
1929 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
1930 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
1931 on values of type T may distinguish between them.
1932 <sup><a name="note44" href="#note44"><b>44)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
1933 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
1934 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
1935 with unsigned types. All other combinations of padding bits are alternative object representations of
1936 the value specified by the value bits.
1938 [<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
1940 there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
1941 the same bit in the object representation of the corresponding unsigned type (if there are
1942 M value bits in the signed type and N in the unsigned type, then M &lt;= N ). If the sign bit
1943 is zero, it shall not affect the resulting value. If the sign bit is one, the value shall be
1944 modified in one of the following ways:
1945 -- the corresponding value with sign bit 0 is negated (sign and magnitude);
1946 -- the sign bit has the value -(2 N ) (two's complement);
1947 -- the sign bit has the value -(2 N - 1) (ones' complement ).
1948 Which of these applies is implementation-defined, as is whether the value with sign bit 1
1949 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
1950 complement), is a trap representation or a normal value. In the case of sign and
1951 magnitude and ones' complement, if this representation is a normal value it is called a
1952 negative zero.
1953 3 If the implementation supports negative zeros, they shall be generated only by:
1954 -- the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with arguments that produce such a value;
1955 -- the +, -, *, /, and % operators where one argument is a negative zero and the result is
1956 zero;
1957 -- compound assignment operators based on the above cases.
1958 It is unspecified whether these cases actually generate a negative zero or a normal zero,
1959 and whether a negative zero becomes a normal zero when stored in an object.
1960 4 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
1961 and &gt;&gt; operators with arguments that would produce such a value is undefined.
1962 5 The values of any padding bits are unspecified.<sup><a href="#note45"><b>45)</b></a></sup> A valid (non-trap) object representation
1963 of a signed integer type where the sign bit is zero is a valid object representation of the
1964 corresponding unsigned type, and shall represent the same value. For any integer type,
1965 the object representation where all the bits are zero shall be a representation of the value
1966 zero in that type.
1967 6 The precision of an integer type is the number of bits it uses to represent values,
1968 excluding any sign and padding bits. The width of an integer type is the same but
1969 including any sign bit; thus for unsigned integer types the two values are the same, while
1972 <sup><a name="note45" href="#note45"><b>45)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
1973 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
1974 representation other than as part of an exceptional condition such as an overflow. All other
1975 combinations of padding bits are alternative object representations of the value specified by the value
1976 bits.
1978 [<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
1980 for signed integer types the width is one greater than the precision.
1981 <a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
1982 1 Two types have compatible type if their types are the same. Additional rules for
1983 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
1984 in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.5">6.7.5</a> for declarators.<sup><a href="#note46"><b>46)</b></a></sup> Moreover, two structure,
1985 union, or enumerated types declared in separate translation units are compatible if their
1986 tags and members satisfy the following requirements: If one is declared with a tag, the
1987 other shall be declared with the same tag. If both are complete types, then the following
1988 additional requirements apply: there shall be a one-to-one correspondence between their
1989 members such that each pair of corresponding members are declared with compatible
1990 types, and such that if one member of a corresponding pair is declared with a name, the
1991 other member is declared with the same name. For two structures, corresponding
1992 members shall be declared in the same order. For two structures or unions, corresponding
1993 bit-fields shall have the same widths. For two enumerations, corresponding members
1994 shall have the same values.
1995 2 All declarations that refer to the same object or function shall have compatible type;
1996 otherwise, the behavior is undefined.
1997 3 A composite type can be constructed from two types that are compatible; it is a type that
1998 is compatible with both of the two types and satisfies the following conditions:
1999 -- If one type is an array of known constant size, the composite type is an array of that
2000 size; otherwise, if one type is a variable length array, the composite type is that type.
2001 -- If only one type is a function type with a parameter type list (a function prototype),
2002 the composite type is a function prototype with the parameter type list.
2003 -- If both types are function types with parameter type lists, the type of each parameter
2004 in the composite parameter type list is the composite type of the corresponding
2005 parameters.
2006 These rules apply recursively to the types from which the two types are derived.
2007 4 For an identifier with internal or external linkage declared in a scope in which a prior
2008 declaration of that identifier is visible,<sup><a href="#note47"><b>47)</b></a></sup> if the prior declaration specifies internal or
2009 external linkage, the type of the identifier at the later declaration becomes the composite
2010 type.
2015 <sup><a name="note46" href="#note46"><b>46)</b></a></sup> Two types need not be identical to be compatible.
2016 <sup><a name="note47" href="#note47"><b>47)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2018 [<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
2020 5 EXAMPLE Given the following two file scope declarations:
2021 int f(int (*)(), double (*)[3]);
2022 int f(int (*)(char *), double (*)[]);
2023 The resulting composite type for the function is:
2024 int f(int (*)(char *), double (*)[3]);
2026 [<a name="p41" href="#p41">page 41</a>] (<a href="#Contents">Contents</a>)
2028 <a name="6.3" href="#6.3"><b> 6.3 Conversions</b></a>
2029 1 Several operators convert operand values from one type to another automatically. This
2030 subclause specifies the result required from such an implicit conversion, as well as those
2031 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2032 the conversions performed by most ordinary operators; it is supplemented as required by
2033 the discussion of each operator in <a href="#6.5">6.5</a>.
2034 2 Conversion of an operand value to a compatible type causes no change to the value or the
2035 representation.
2036 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>).
2037 <a name="6.3.1" href="#6.3.1"><b> 6.3.1 Arithmetic operands</b></a>
2038 <a name="6.3.1.1" href="#6.3.1.1"><b> 6.3.1.1 Boolean, characters, and integers</b></a>
2039 1 Every integer type has an integer conversion rank defined as follows:
2040 -- No two signed integer types shall have the same rank, even if they have the same
2041 representation.
2042 -- The rank of a signed integer type shall be greater than the rank of any signed integer
2043 type with less precision.
2044 -- The rank of long long int shall be greater than the rank of long int, which
2045 shall be greater than the rank of int, which shall be greater than the rank of short
2046 int, which shall be greater than the rank of signed char.
2047 -- The rank of any unsigned integer type shall equal the rank of the corresponding
2048 signed integer type, if any.
2049 -- The rank of any standard integer type shall be greater than the rank of any extended
2050 integer type with the same width.
2051 -- The rank of char shall equal the rank of signed char and unsigned char.
2052 -- The rank of _Bool shall be less than the rank of all other standard integer types.
2053 -- The rank of any enumerated type shall equal the rank of the compatible integer type
2054 (see <a href="#6.7.2.2">6.7.2.2</a>).
2055 -- The rank of any extended signed integer type relative to another extended signed
2056 integer type with the same precision is implementation-defined, but still subject to the
2057 other rules for determining the integer conversion rank.
2058 -- For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2059 greater rank than T3, then T1 has greater rank than T3.
2060 2 The following may be used in an expression wherever an int or unsigned int may
2061 be used:
2063 [<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
2065 -- An object or expression with an integer type whose integer conversion rank is less
2066 than or equal to the rank of int and unsigned int.
2067 -- A bit-field of type _Bool, int, signed int, or unsigned int.
2068 If an int can represent all values of the original type, the value is converted to an int;
2069 otherwise, it is converted to an unsigned int. These are called the integer
2070 promotions.<sup><a href="#note48"><b>48)</b></a></sup> All other types are unchanged by the integer promotions.
2071 3 The integer promotions preserve value including sign. As discussed earlier, whether a
2072 ''plain'' char is treated as signed is implementation-defined.
2073 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2074 (<a href="#6.7.2.1">6.7.2.1</a>).
2075 <a name="6.3.1.2" href="#6.3.1.2"><b> 6.3.1.2 Boolean type</b></a>
2076 1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2077 to 0; otherwise, the result is 1.
2078 <a name="6.3.1.3" href="#6.3.1.3"><b> 6.3.1.3 Signed and unsigned integers</b></a>
2079 1 When a value with integer type is converted to another integer type other than _Bool, if
2080 the value can be represented by the new type, it is unchanged.
2081 2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2082 subtracting one more than the maximum value that can be represented in the new type
2083 until the value is in the range of the new type.<sup><a href="#note49"><b>49)</b></a></sup>
2084 3 Otherwise, the new type is signed and the value cannot be represented in it; either the
2085 result is implementation-defined or an implementation-defined signal is raised.
2086 <a name="6.3.1.4" href="#6.3.1.4"><b> 6.3.1.4 Real floating and integer</b></a>
2087 1 When a finite value of real floating type is converted to an integer type other than _Bool,
2088 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2089 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup>
2090 2 When a value of integer type is converted to a real floating type, if the value being
2091 converted can be represented exactly in the new type, it is unchanged. If the value being
2092 converted is in the range of values that can be represented but cannot be represented
2094 <sup><a name="note48" href="#note48"><b>48)</b></a></sup> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2095 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2096 shift operators, as specified by their respective subclauses.
2097 <sup><a name="note49" href="#note49"><b>49)</b></a></sup> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2098 <sup><a name="note50" href="#note50"><b>50)</b></a></sup> The remaindering operation performed when a value of integer type is converted to unsigned type
2099 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2100 range of portable real floating values is (-1, Utype_MAX+1).
2102 [<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
2104 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2105 in an implementation-defined manner. If the value being converted is outside the range of
2106 values that can be represented, the behavior is undefined.
2107 <a name="6.3.1.5" href="#6.3.1.5"><b> 6.3.1.5 Real floating types</b></a>
2108 1 When a float is promoted to double or long double, or a double is promoted
2109 to long double, its value is unchanged (if the source value is represented in the
2110 precision and range of its type).
2111 2 When a double is demoted to float, a long double is demoted to double or
2112 float, or a value being represented in greater precision and range than required by its
2113 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
2114 being converted can be represented exactly in the new type, it is unchanged. If the value
2115 being converted is in the range of values that can be represented but cannot be
2116 represented exactly, the result is either the nearest higher or nearest lower representable
2117 value, chosen in an implementation-defined manner. If the value being converted is
2118 outside the range of values that can be represented, the behavior is undefined.
2119 <a name="6.3.1.6" href="#6.3.1.6"><b> 6.3.1.6 Complex types</b></a>
2120 1 When a value of complex type is converted to another complex type, both the real and
2121 imaginary parts follow the conversion rules for the corresponding real types.
2122 <a name="6.3.1.7" href="#6.3.1.7"><b> 6.3.1.7 Real and complex</b></a>
2123 1 When a value of real type is converted to a complex type, the real part of the complex
2124 result value is determined by the rules of conversion to the corresponding real type and
2125 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2126 2 When a value of complex type is converted to a real type, the imaginary part of the
2127 complex value is discarded and the value of the real part is converted according to the
2128 conversion rules for the corresponding real type.
2129 <a name="6.3.1.8" href="#6.3.1.8"><b> 6.3.1.8 Usual arithmetic conversions</b></a>
2130 1 Many operators that expect operands of arithmetic type cause conversions and yield result
2131 types in a similar way. The purpose is to determine a common real type for the operands
2132 and result. For the specified operands, each operand is converted, without change of type
2133 domain, to a type whose corresponding real type is the common real type. Unless
2134 explicitly stated otherwise, the common real type is also the corresponding real type of
2135 the result, whose type domain is the type domain of the operands if they are the same,
2136 and complex otherwise. This pattern is called the usual arithmetic conversions:
2137 First, if the corresponding real type of either operand is long double, the other
2138 operand is converted, without change of type domain, to a type whose
2139 corresponding real type is long double.
2141 [<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
2143 Otherwise, if the corresponding real type of either operand is double, the other
2144 operand is converted, without change of type domain, to a type whose
2145 corresponding real type is double.
2146 Otherwise, if the corresponding real type of either operand is float, the other
2147 operand is converted, without change of type domain, to a type whose
2148 corresponding real type is float.<sup><a href="#note51"><b>51)</b></a></sup>
2149 Otherwise, the integer promotions are performed on both operands. Then the
2150 following rules are applied to the promoted operands:
2151 If both operands have the same type, then no further conversion is needed.
2152 Otherwise, if both operands have signed integer types or both have unsigned
2153 integer types, the operand with the type of lesser integer conversion rank is
2154 converted to the type of the operand with greater rank.
2155 Otherwise, if the operand that has unsigned integer type has rank greater or
2156 equal to the rank of the type of the other operand, then the operand with
2157 signed integer type is converted to the type of the operand with unsigned
2158 integer type.
2159 Otherwise, if the type of the operand with signed integer type can represent
2160 all of the values of the type of the operand with unsigned integer type, then
2161 the operand with unsigned integer type is converted to the type of the
2162 operand with signed integer type.
2163 Otherwise, both operands are converted to the unsigned integer type
2164 corresponding to the type of the operand with signed integer type.
2165 2 The values of floating operands and of the results of floating expressions may be
2166 represented in greater precision and range than that required by the type; the types are not
2167 changed thereby.<sup><a href="#note52"><b>52)</b></a></sup>
2172 <sup><a name="note51" href="#note51"><b>51)</b></a></sup> For example, addition of a double _Complex and a float entails just the conversion of the
2173 float operand to double (and yields a double _Complex result).
2174 <sup><a name="note52" href="#note52"><b>52)</b></a></sup> The cast and assignment operators are still required to perform their specified conversions as
2175 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>.
2177 [<a name="p45" href="#p45">page 45</a>] (<a href="#Contents">Contents</a>)
2179 <a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
2180 <a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
2181 1 An lvalue is an expression with an object type or an incomplete type other than void;<sup><a href="#note53"><b>53)</b></a></sup>
2182 if an lvalue does not designate an object when it is evaluated, the behavior is undefined.
2183 When an object is said to have a particular type, the type is specified by the lvalue used to
2184 designate the object. A modifiable lvalue is an lvalue that does not have array type, does
2185 not have an incomplete type, does not have a const-qualified type, and if it is a structure
2186 or union, does not have any member (including, recursively, any member or element of
2187 all contained aggregates or unions) with a const-qualified type.
2188 2 Except when it is the operand of the sizeof operator, the unary &amp; operator, the ++
2189 operator, the -- operator, or the left operand of the . operator or an assignment operator,
2190 an lvalue that does not have array type is converted to the value stored in the designated
2191 object (and is no longer an lvalue). If the lvalue has qualified type, the value has the
2192 unqualified version of the type of the lvalue; otherwise, the value has the type of the
2193 lvalue. If the lvalue has an incomplete type and does not have array type, the behavior is
2194 undefined.
2195 3 Except when it is the operand of the sizeof operator or the unary &amp; operator, or is a
2196 string literal used to initialize an array, an expression that has type ''array of type'' is
2197 converted to an expression with type ''pointer to type'' that points to the initial element of
2198 the array object and is not an lvalue. If the array object has register storage class, the
2199 behavior is undefined.
2200 4 A function designator is an expression that has function type. Except when it is the
2201 operand of the sizeof operator<sup><a href="#note54"><b>54)</b></a></sup> or the unary &amp; operator, a function designator with
2202 type ''function returning type'' is converted to an expression that has type ''pointer to
2203 function returning type''.
2204 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2205 (<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
2206 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2207 (<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>).
2210 <sup><a name="note53" href="#note53"><b>53)</b></a></sup> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2211 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2212 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2213 as the ''value of an expression''.
2214 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2215 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2216 <sup><a name="note54" href="#note54"><b>54)</b></a></sup> Because this conversion does not occur, the operand of the sizeof operator remains a function
2217 designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
2219 [<a name="p46" href="#p46">page 46</a>] (<a href="#Contents">Contents</a>)
2221 <a href="#6.3.2.2">6.3.2.2</a> void
2222 1 The (nonexistent) value of a void expression (an expression that has type void) shall not
2223 be used in any way, and implicit or explicit conversions (except to void) shall not be
2224 applied to such an expression. If an expression of any other type is evaluated as a void
2225 expression, its value or designator is discarded. (A void expression is evaluated for its
2226 side effects.)
2227 <a name="6.3.2.3" href="#6.3.2.3"><b> 6.3.2.3 Pointers</b></a>
2228 1 A pointer to void may be converted to or from a pointer to any incomplete or object
2229 type. A pointer to any incomplete or object type may be converted to a pointer to void
2230 and back again; the result shall compare equal to the original pointer.
2231 2 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2232 the q-qualified version of the type; the values stored in the original and converted pointers
2233 shall compare equal.
2234 3 An integer constant expression with the value 0, or such an expression cast to type
2235 void *, is called a null pointer constant.<sup><a href="#note55"><b>55)</b></a></sup> If a null pointer constant is converted to a
2236 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2237 to a pointer to any object or function.
2238 4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2239 Any two null pointers shall compare equal.
2240 5 An integer may be converted to any pointer type. Except as previously specified, the
2241 result is implementation-defined, might not be correctly aligned, might not point to an
2242 entity of the referenced type, and might be a trap representation.<sup><a href="#note56"><b>56)</b></a></sup>
2243 6 Any pointer type may be converted to an integer type. Except as previously specified, the
2244 result is implementation-defined. If the result cannot be represented in the integer type,
2245 the behavior is undefined. The result need not be in the range of values of any integer
2246 type.
2247 7 A pointer to an object or incomplete type may be converted to a pointer to a different
2248 object or incomplete type. If the resulting pointer is not correctly aligned<sup><a href="#note57"><b>57)</b></a></sup> for the
2249 pointed-to type, the behavior is undefined. Otherwise, when converted back again, the
2250 result shall compare equal to the original pointer. When a pointer to an object is
2253 <sup><a name="note55" href="#note55"><b>55)</b></a></sup> 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>.
2254 <sup><a name="note56" href="#note56"><b>56)</b></a></sup> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2255 be consistent with the addressing structure of the execution environment.
2256 <sup><a name="note57" href="#note57"><b>57)</b></a></sup> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2257 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2258 correctly aligned for a pointer to type C.
2260 [<a name="p47" href="#p47">page 47</a>] (<a href="#Contents">Contents</a>)
2262 converted to a pointer to a character type, the result points to the lowest addressed byte of
2263 the object. Successive increments of the result, up to the size of the object, yield pointers
2264 to the remaining bytes of the object.
2265 8 A pointer to a function of one type may be converted to a pointer to a function of another
2266 type and back again; the result shall compare equal to the original pointer. If a converted
2267 pointer is used to call a function whose type is not compatible with the pointed-to type,
2268 the behavior is undefined.
2269 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
2270 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>).
2272 [<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
2274 <a name="6.4" href="#6.4"><b> 6.4 Lexical elements</b></a>
2275 <b> Syntax</b>
2276 1 token:
2277 keyword
2278 identifier
2279 constant
2280 string-literal
2281 punctuator
2282 preprocessing-token:
2283 header-name
2284 identifier
2285 pp-number
2286 character-constant
2287 string-literal
2288 punctuator
2289 each non-white-space character that cannot be one of the above
2290 <b> Constraints</b>
2291 2 Each preprocessing token that is converted to a token shall have the lexical form of a
2292 keyword, an identifier, a constant, a string literal, or a punctuator.
2293 <b> Semantics</b>
2294 3 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2295 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2296 A preprocessing token is the minimal lexical element of the language in translation
2297 phases 3 through 6. The categories of preprocessing tokens are: header names,
2298 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2299 single non-white-space characters that do not lexically match the other preprocessing
2300 token categories.<sup><a href="#note58"><b>58)</b></a></sup> If a ' or a " character matches the last category, the behavior is
2301 undefined. Preprocessing tokens can be separated by white space; this consists of
2302 comments (described later), or white-space characters (space, horizontal tab, new-line,
2303 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2304 during translation phase 4, white space (or the absence thereof) serves as more than
2305 preprocessing token separation. White space may appear within a preprocessing token
2306 only as part of a header name or between the quotation characters in a character constant
2307 or string literal.
2311 <sup><a name="note58" href="#note58"><b>58)</b></a></sup> 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
2312 occur in source files.
2314 [<a name="p49" href="#p49">page 49</a>] (<a href="#Contents">Contents</a>)
2316 4 If the input stream has been parsed into preprocessing tokens up to a given character, the
2317 next preprocessing token is the longest sequence of characters that could constitute a
2318 preprocessing token. There is one exception to this rule: header name preprocessing
2319 tokens are recognized only within #include preprocessing directives and in
2320 implementation-defined locations within #pragma directives. In such contexts, a
2321 sequence of characters that could be either a header name or a string literal is recognized
2322 as the former.
2323 5 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2324 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2325 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2326 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2327 not E is a macro name.
2329 6 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2330 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2332 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>),
2333 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
2334 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2335 (<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
2336 (<a href="#6.4.5">6.4.5</a>).
2337 <a name="6.4.1" href="#6.4.1"><b> 6.4.1 Keywords</b></a>
2338 <b> Syntax</b>
2339 1 keyword: one of
2340 auto enum restrict unsigned
2341 break extern return void
2342 case float short volatile
2343 char for signed while
2344 const goto sizeof _Bool
2345 continue if static _Complex
2346 default inline struct _Imaginary
2347 do int switch
2348 double long typedef
2349 else register union
2350 <b> Semantics</b>
2351 2 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
2352 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
2353 specifying imaginary types.<sup><a href="#note59"><b>59)</b></a></sup>
2357 <sup><a name="note59" href="#note59"><b>59)</b></a></sup> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
2359 [<a name="p50" href="#p50">page 50</a>] (<a href="#Contents">Contents</a>)
2361 <a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
2362 <a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
2363 <b> Syntax</b>
2364 1 identifier:
2365 identifier-nondigit
2366 identifier identifier-nondigit
2367 identifier digit
2368 identifier-nondigit:
2369 nondigit
2370 universal-character-name
2371 other implementation-defined characters
2372 nondigit: one of
2373 _ a b c d e f g h i j k l m
2374 n o p q r s t u v w x y z
2375 A B C D E F G H I J K L M
2376 N O P Q R S T U V W X Y Z
2377 digit: one of
2378 0 1 2 3 4 5 6 7 8 9
2379 <b> Semantics</b>
2380 2 An identifier is a sequence of nondigit characters (including the underscore _, the
2381 lowercase and uppercase Latin letters, and other characters) and digits, which designates
2382 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
2383 There is no specific limit on the maximum length of an identifier.
2384 3 Each universal character name in an identifier shall designate a character whose encoding
2385 in ISO/IEC 10646 falls into one of the ranges specified in <a href="#D">annex D</a>.<sup><a href="#note60"><b>60)</b></a></sup> The initial
2386 character shall not be a universal character name designating a digit. An implementation
2387 may allow multibyte characters that are not part of the basic source character set to
2388 appear in identifiers; which characters and their correspondence to universal character
2389 names is implementation-defined.
2390 4 When preprocessing tokens are converted to tokens during translation phase 7, if a
2391 preprocessing token could be converted to either a keyword or an identifier, it is converted
2392 to a keyword.
2395 <sup><a name="note60" href="#note60"><b>60)</b></a></sup> On systems in which linkers cannot accept extended characters, an encoding of the universal character
2396 name may be used in forming valid external identifiers. For example, some otherwise unused
2397 character or sequence of characters may be used to encode the \u in a universal character name.
2398 Extended characters may produce a long external identifier.
2400 [<a name="p51" href="#p51">page 51</a>] (<a href="#Contents">Contents</a>)
2402 Implementation limits
2403 5 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
2404 characters in an identifier; the limit for an external name (an identifier that has external
2405 linkage) may be more restrictive than that for an internal name (a macro name or an
2406 identifier that does not have external linkage). The number of significant characters in an
2407 identifier is implementation-defined.
2408 6 Any identifiers that differ in a significant character are different identifiers. If two
2409 identifiers differ only in nonsignificant characters, the behavior is undefined.
2410 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>).
2411 <a name="6.4.2.2" href="#6.4.2.2"><b> 6.4.2.2 Predefined identifiers</b></a>
2412 <b> Semantics</b>
2413 1 The identifier __func__ shall be implicitly declared by the translator as if,
2414 immediately following the opening brace of each function definition, the declaration
2415 static const char __func__[] = "function-name";
2416 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note61"><b>61)</b></a></sup>
2417 2 This name is encoded as if the implicit declaration had been written in the source
2418 character set and then translated into the execution character set as indicated in translation
2419 phase 5.
2420 3 EXAMPLE Consider the code fragment:
2421 #include <a href="#7.19">&lt;stdio.h&gt;</a>
2422 void myfunc(void)
2424 printf("%s\n", __func__);
2425 /* ... */
2427 Each time the function is called, it will print to the standard output stream:
2428 myfunc
2430 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
2435 <sup><a name="note61" href="#note61"><b>61)</b></a></sup> Since the name __func__ is reserved for any use by the implementation (<a href="#7.1.3">7.1.3</a>), if any other
2436 identifier is explicitly declared using the name __func__, the behavior is undefined.
2438 [<a name="p52" href="#p52">page 52</a>] (<a href="#Contents">Contents</a>)
2440 <a name="6.4.3" href="#6.4.3"><b> 6.4.3 Universal character names</b></a>
2441 <b> Syntax</b>
2442 1 universal-character-name:
2443 \u hex-quad
2444 \U hex-quad hex-quad
2445 hex-quad:
2446 hexadecimal-digit hexadecimal-digit
2447 hexadecimal-digit hexadecimal-digit
2448 <b> Constraints</b>
2449 2 A universal character name shall not specify a character whose short identifier is less than
2450 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
2451 DFFF inclusive.<sup><a href="#note62"><b>62)</b></a></sup>
2452 <b> Description</b>
2453 3 Universal character names may be used in identifiers, character constants, and string
2454 literals to designate characters that are not in the basic character set.
2455 <b> Semantics</b>
2456 4 The universal character name \Unnnnnnnn designates the character whose eight-digit
2457 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note63"><b>63)</b></a></sup> Similarly, the universal
2458 character name \unnnn designates the character whose four-digit short identifier is nnnn
2459 (and whose eight-digit short identifier is 0000nnnn).
2464 <sup><a name="note62" href="#note62"><b>62)</b></a></sup> The disallowed characters are the characters in the basic character set and the code positions reserved
2465 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
2466 UTF-16).
2467 <sup><a name="note63" href="#note63"><b>63)</b></a></sup> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
2469 [<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
2471 <a name="6.4.4" href="#6.4.4"><b> 6.4.4 Constants</b></a>
2472 <b> Syntax</b>
2473 1 constant:
2474 integer-constant
2475 floating-constant
2476 enumeration-constant
2477 character-constant
2478 <b> Constraints</b>
2479 2 Each constant shall have a type and the value of a constant shall be in the range of
2480 representable values for its type.
2481 <b> Semantics</b>
2482 3 Each constant has a type, determined by its form and value, as detailed later.
2483 <a name="6.4.4.1" href="#6.4.4.1"><b> 6.4.4.1 Integer constants</b></a>
2484 <b> Syntax</b>
2485 1 integer-constant:
2486 decimal-constant integer-suffixopt
2487 octal-constant integer-suffixopt
2488 hexadecimal-constant integer-suffixopt
2489 decimal-constant:
2490 nonzero-digit
2491 decimal-constant digit
2492 octal-constant:
2494 octal-constant octal-digit
2495 hexadecimal-constant:
2496 hexadecimal-prefix hexadecimal-digit
2497 hexadecimal-constant hexadecimal-digit
2498 hexadecimal-prefix: one of
2499 0x 0X
2500 nonzero-digit: one of
2501 1 2 3 4 5 6 7 8 9
2502 octal-digit: one of
2503 0 1 2 3 4 5 6 7
2505 [<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
2507 hexadecimal-digit: one of
2508 0 1 2 3 4 5 6 7 8 9
2509 a b c d e f
2510 A B C D E F
2511 integer-suffix:
2512 unsigned-suffix long-suffixopt
2513 unsigned-suffix long-long-suffix
2514 long-suffix unsigned-suffixopt
2515 long-long-suffix unsigned-suffixopt
2516 unsigned-suffix: one of
2518 long-suffix: one of
2520 long-long-suffix: one of
2521 ll LL
2522 <b> Description</b>
2523 2 An integer constant begins with a digit, but has no period or exponent part. It may have a
2524 prefix that specifies its base and a suffix that specifies its type.
2525 3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
2526 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
2527 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
2528 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
2529 10 through 15 respectively.
2530 <b> Semantics</b>
2531 4 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
2532 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
2533 5 The type of an integer constant is the first of the corresponding list in which its value can
2534 be represented.
2536 [<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
2538 Octal or Hexadecimal
2539 Suffix Decimal Constant Constant
2541 none int int
2542 long int unsigned int
2543 long long int long int
2544 unsigned long int
2545 long long int
2546 unsigned long long int
2548 u or U unsigned int unsigned int
2549 unsigned long int unsigned long int
2550 unsigned long long int unsigned long long int
2552 l or L long int long int
2553 long long int unsigned long int
2554 long long int
2555 unsigned long long int
2557 Both u or U unsigned long int unsigned long int
2558 and l or L unsigned long long int unsigned long long int
2560 ll or LL long long int long long int
2561 unsigned long long int
2563 Both u or U unsigned long long int unsigned long long int
2564 and ll or LL
2565 6 If an integer constant cannot be represented by any type in its list, it may have an
2566 extended integer type, if the extended integer type can represent its value. If all of the
2567 types in the list for the constant are signed, the extended integer type shall be signed. If
2568 all of the types in the list for the constant are unsigned, the extended integer type shall be
2569 unsigned. If the list contains both signed and unsigned types, the extended integer type
2570 may be signed or unsigned. If an integer constant cannot be represented by any type in
2571 its list and has no extended integer type, then the integer constant has no type.
2573 [<a name="p56" href="#p56">page 56</a>] (<a href="#Contents">Contents</a>)
2575 <a name="6.4.4.2" href="#6.4.4.2"><b> 6.4.4.2 Floating constants</b></a>
2576 <b> Syntax</b>
2577 1 floating-constant:
2578 decimal-floating-constant
2579 hexadecimal-floating-constant
2580 decimal-floating-constant:
2581 fractional-constant exponent-partopt floating-suffixopt
2582 digit-sequence exponent-part floating-suffixopt
2583 hexadecimal-floating-constant:
2584 hexadecimal-prefix hexadecimal-fractional-constant
2585 binary-exponent-part floating-suffixopt
2586 hexadecimal-prefix hexadecimal-digit-sequence
2587 binary-exponent-part floating-suffixopt
2588 fractional-constant:
2589 digit-sequenceopt . digit-sequence
2590 digit-sequence .
2591 exponent-part:
2592 e signopt digit-sequence
2593 E signopt digit-sequence
2594 sign: one of
2596 digit-sequence:
2597 digit
2598 digit-sequence digit
2599 hexadecimal-fractional-constant:
2600 hexadecimal-digit-sequenceopt .
2601 hexadecimal-digit-sequence
2602 hexadecimal-digit-sequence .
2603 binary-exponent-part:
2604 p signopt digit-sequence
2605 P signopt digit-sequence
2606 hexadecimal-digit-sequence:
2607 hexadecimal-digit
2608 hexadecimal-digit-sequence hexadecimal-digit
2609 floating-suffix: one of
2610 f l F L
2612 [<a name="p57" href="#p57">page 57</a>] (<a href="#Contents">Contents</a>)
2614 <b> Description</b>
2615 2 A floating constant has a significand part that may be followed by an exponent part and a
2616 suffix that specifies its type. The components of the significand part may include a digit
2617 sequence representing the whole-number part, followed by a period (.), followed by a
2618 digit sequence representing the fraction part. The components of the exponent part are an
2619 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
2620 Either the whole-number part or the fraction part has to be present; for decimal floating
2621 constants, either the period or the exponent part has to be present.
2622 <b> Semantics</b>
2623 3 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
2624 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
2625 floating constants, the exponent indicates the power of 10 by which the significand part is
2626 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
2627 by which the significand part is to be scaled. For decimal floating constants, and also for
2628 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
2629 the nearest representable value, or the larger or smaller representable value immediately
2630 adjacent to the nearest representable value, chosen in an implementation-defined manner.
2631 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
2632 correctly rounded.
2633 4 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
2634 type float. If suffixed by the letter l or L, it has type long double.
2635 5 Floating constants are converted to internal format as if at translation-time. The
2636 conversion of a floating constant shall not raise an exceptional condition or a floating-
2637 point exception at execution time.
2638 Recommended practice
2639 6 The implementation should produce a diagnostic message if a hexadecimal constant
2640 cannot be represented exactly in its evaluation format; the implementation should then
2641 proceed with the translation of the program.
2642 7 The translation-time conversion of floating constants should match the execution-time
2643 conversion of character strings by library functions, such as strtod, given matching
2644 inputs suitable for both conversions, the same result format, and default execution-time
2645 rounding.<sup><a href="#note64"><b>64)</b></a></sup>
2650 <sup><a name="note64" href="#note64"><b>64)</b></a></sup> The specification for the library functions recommends more accurate conversion than required for
2651 floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
2653 [<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
2655 <a name="6.4.4.3" href="#6.4.4.3"><b> 6.4.4.3 Enumeration constants</b></a>
2656 <b> Syntax</b>
2657 1 enumeration-constant:
2658 identifier
2659 <b> Semantics</b>
2660 2 An identifier declared as an enumeration constant has type int.
2661 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
2662 <a name="6.4.4.4" href="#6.4.4.4"><b> 6.4.4.4 Character constants</b></a>
2663 <b> Syntax</b>
2664 1 character-constant:
2665 ' c-char-sequence '
2666 L' c-char-sequence '
2667 c-char-sequence:
2668 c-char
2669 c-char-sequence c-char
2670 c-char:
2671 any member of the source character set except
2672 the single-quote ', backslash \, or new-line character
2673 escape-sequence
2674 escape-sequence:
2675 simple-escape-sequence
2676 octal-escape-sequence
2677 hexadecimal-escape-sequence
2678 universal-character-name
2679 simple-escape-sequence: one of
2680 \' \" \? \\
2681 \a \b \f \n \r \t \v
2682 octal-escape-sequence:
2683 \ octal-digit
2684 \ octal-digit octal-digit
2685 \ octal-digit octal-digit octal-digit
2686 hexadecimal-escape-sequence:
2687 \x hexadecimal-digit
2688 hexadecimal-escape-sequence hexadecimal-digit
2690 [<a name="p59" href="#p59">page 59</a>] (<a href="#Contents">Contents</a>)
2692 <b> Description</b>
2693 2 An integer character constant is a sequence of one or more multibyte characters enclosed
2694 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
2695 letter L. With a few exceptions detailed later, the elements of the sequence are any
2696 members of the source character set; they are mapped in an implementation-defined
2697 manner to members of the execution character set.
2698 3 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
2699 arbitrary integer values are representable according to the following table of escape
2700 sequences:
2701 single quote ' \'
2702 double quote " \"
2703 question mark ? \?
2704 backslash \ \\
2705 octal character \octal digits
2706 hexadecimal character \x hexadecimal digits
2707 4 The double-quote " and question-mark ? are representable either by themselves or by the
2708 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
2709 shall be represented, respectively, by the escape sequences \' and \\.
2710 5 The octal digits that follow the backslash in an octal escape sequence are taken to be part
2711 of the construction of a single character for an integer character constant or of a single
2712 wide character for a wide character constant. The numerical value of the octal integer so
2713 formed specifies the value of the desired character or wide character.
2714 6 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
2715 sequence are taken to be part of the construction of a single character for an integer
2716 character constant or of a single wide character for a wide character constant. The
2717 numerical value of the hexadecimal integer so formed specifies the value of the desired
2718 character or wide character.
2719 7 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
2720 constitute the escape sequence.
2721 8 In addition, characters not in the basic character set are representable by universal
2722 character names and certain nongraphic characters are representable by escape sequences
2723 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
2724 and \v.<sup><a href="#note65"><b>65)</b></a></sup>
2729 <sup><a name="note65" href="#note65"><b>65)</b></a></sup> The semantics of these characters were discussed in <a href="#5.2.2">5.2.2</a>. If any other character follows a backslash,
2730 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
2732 [<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
2734 <b> Constraints</b>
2735 9 The value of an octal or hexadecimal escape sequence shall be in the range of
2736 representable values for the type unsigned char for an integer character constant, or
2737 the unsigned type corresponding to wchar_t for a wide character constant.
2738 <b> Semantics</b>
2739 10 An integer character constant has type int. The value of an integer character constant
2740 containing a single character that maps to a single-byte execution character is the
2741 numerical value of the representation of the mapped character interpreted as an integer.
2742 The value of an integer character constant containing more than one character (e.g.,
2743 'ab'), or containing a character or escape sequence that does not map to a single-byte
2744 execution character, is implementation-defined. If an integer character constant contains
2745 a single character or escape sequence, its value is the one that results when an object with
2746 type char whose value is that of the single character or escape sequence is converted to
2747 type int.
2748 11 A wide character constant has type wchar_t, an integer type defined in the
2749 <a href="#7.17">&lt;stddef.h&gt;</a> header. The value of a wide character constant containing a single
2750 multibyte character that maps to a member of the extended execution character set is the
2751 wide character corresponding to that multibyte character, as defined by the mbtowc
2752 function, with an implementation-defined current locale. The value of a wide character
2753 constant containing more than one multibyte character, or containing a multibyte
2754 character or escape sequence not represented in the extended execution character set, is
2755 implementation-defined.
2756 12 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
2758 13 EXAMPLE 2 Consider implementations that use two's-complement representation for integers and eight
2759 bits for objects that have type char. In an implementation in which type char has the same range of
2760 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
2761 same range of values as unsigned char, the character constant '\xFF' has the value +255.
2763 14 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
2764 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
2765 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
2766 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
2767 escape sequence is terminated after three octal digits. (The value of this two-character integer character
2768 constant is implementation-defined.)
2770 15 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
2771 L'\1234' specifies the implementation-defined value that results from the combination of the values
2772 0123 and '4'.
2774 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbtowc function
2775 (<a href="#7.20.7.2">7.20.7.2</a>).
2777 [<a name="p61" href="#p61">page 61</a>] (<a href="#Contents">Contents</a>)
2779 <a name="6.4.5" href="#6.4.5"><b> 6.4.5 String literals</b></a>
2780 <b> Syntax</b>
2781 1 string-literal:
2782 " s-char-sequenceopt "
2783 L" s-char-sequenceopt "
2784 s-char-sequence:
2785 s-char
2786 s-char-sequence s-char
2787 s-char:
2788 any member of the source character set except
2789 the double-quote ", backslash \, or new-line character
2790 escape-sequence
2791 <b> Description</b>
2792 2 A character string literal is a sequence of zero or more multibyte characters enclosed in
2793 double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
2794 letter L.
2795 3 The same considerations apply to each element of the sequence in a character string
2796 literal or a wide string literal as if it were in an integer character constant or a wide
2797 character constant, except that the single-quote ' is representable either by itself or by the
2798 escape sequence \', but the double-quote " shall be represented by the escape sequence
2800 <b> Semantics</b>
2801 4 In translation phase 6, the multibyte character sequences specified by any sequence of
2802 adjacent character and wide string literal tokens are concatenated into a single multibyte
2803 character sequence. If any of the tokens are wide string literal tokens, the resulting
2804 multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a
2805 character string literal.
2806 5 In translation phase 7, a byte or code of value zero is appended to each multibyte
2807 character sequence that results from a string literal or literals.<sup><a href="#note66"><b>66)</b></a></sup> The multibyte character
2808 sequence is then used to initialize an array of static storage duration and length just
2809 sufficient to contain the sequence. For character string literals, the array elements have
2810 type char, and are initialized with the individual bytes of the multibyte character
2811 sequence; for wide string literals, the array elements have type wchar_t, and are
2812 initialized with the sequence of wide characters corresponding to the multibyte character
2814 <sup><a name="note66" href="#note66"><b>66)</b></a></sup> 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
2815 it by a \0 escape sequence.
2817 [<a name="p62" href="#p62">page 62</a>] (<a href="#Contents">Contents</a>)
2819 sequence, as defined by the mbstowcs function with an implementation-defined current
2820 locale. The value of a string literal containing a multibyte character or escape sequence
2821 not represented in the execution character set is implementation-defined.
2822 6 It is unspecified whether these arrays are distinct provided their elements have the
2823 appropriate values. If the program attempts to modify such an array, the behavior is
2824 undefined.
2825 7 EXAMPLE This pair of adjacent character string literals
2826 "\x12" "3"
2827 produces a single character string literal containing the two characters whose values are '\x12' and '3',
2828 because escape sequences are converted into single members of the execution character set just prior to
2829 adjacent string literal concatenation.
2831 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>), the mbstowcs
2832 function (<a href="#7.20.8.1">7.20.8.1</a>).
2833 <a name="6.4.6" href="#6.4.6"><b> 6.4.6 Punctuators</b></a>
2834 <b> Syntax</b>
2835 1 punctuator: one of
2836 [ ] ( ) { } . -&gt;
2837 ++ -- &amp; * + - ~ !
2838 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
2839 ? : ; ...
2840 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
2841 , # ##
2842 &lt;: :&gt; &lt;% %&gt; %: %:%:
2843 <b> Semantics</b>
2844 2 A punctuator is a symbol that has independent syntactic and semantic significance.
2845 Depending on context, it may specify an operation to be performed (which in turn may
2846 yield a value or a function designator, produce a side effect, or some combination thereof)
2847 in which case it is known as an operator (other forms of operator also exist in some
2848 contexts). An operand is an entity on which an operator acts.
2850 [<a name="p63" href="#p63">page 63</a>] (<a href="#Contents">Contents</a>)
2852 3 In all aspects of the language, the six tokens<sup><a href="#note67"><b>67)</b></a></sup>
2853 &lt;: :&gt; &lt;% %&gt; %: %:%:
2854 behave, respectively, the same as the six tokens
2855 [ ] { } # ##
2856 except for their spelling.<sup><a href="#note68"><b>68)</b></a></sup>
2857 Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
2858 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
2859 <a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
2860 <b> Syntax</b>
2861 1 header-name:
2862 &lt; h-char-sequence &gt;
2863 " q-char-sequence "
2864 h-char-sequence:
2865 h-char
2866 h-char-sequence h-char
2867 h-char:
2868 any member of the source character set except
2869 the new-line character and &gt;
2870 q-char-sequence:
2871 q-char
2872 q-char-sequence q-char
2873 q-char:
2874 any member of the source character set except
2875 the new-line character and "
2876 <b> Semantics</b>
2877 2 The sequences in both forms of header names are mapped in an implementation-defined
2878 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
2879 3 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
2880 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
2885 <sup><a name="note67" href="#note67"><b>67)</b></a></sup> These tokens are sometimes called ''digraphs''.
2886 <sup><a name="note68" href="#note68"><b>68)</b></a></sup> Thus [ and &lt;: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
2887 interchanged.
2889 [<a name="p64" href="#p64">page 64</a>] (<a href="#Contents">Contents</a>)
2891 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note69"><b>69)</b></a></sup> Header name
2892 preprocessing tokens are recognized only within #include preprocessing directives and
2893 in implementation-defined locations within #pragma directives.<sup><a href="#note70"><b>70)</b></a></sup>
2894 4 EXAMPLE The following sequence of characters:
2895 0x3&lt;1/a.h&gt;1e2
2896 #include &lt;1/a.h&gt;
2897 #define const.member@$
2898 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
2899 by a { on the left and a } on the right).
2900 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
2901 {#}{include} {&lt;1/a.h&gt;}
2902 {#}{define} {const}{.}{member}{@}{$}
2904 Forward references: source file inclusion (<a href="#6.10.2">6.10.2</a>).
2905 <a name="6.4.8" href="#6.4.8"><b> 6.4.8 Preprocessing numbers</b></a>
2906 <b> Syntax</b>
2907 1 pp-number:
2908 digit
2909 . digit
2910 pp-number digit
2911 pp-number identifier-nondigit
2912 pp-number e sign
2913 pp-number E sign
2914 pp-number p sign
2915 pp-number P sign
2916 pp-number .
2917 <b> Description</b>
2918 2 A preprocessing number begins with a digit optionally preceded by a period (.) and may
2919 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
2920 p+, p-, P+, or P-.
2921 3 Preprocessing number tokens lexically include all floating and integer constant tokens.
2922 <b> Semantics</b>
2923 4 A preprocessing number does not have type or a value; it acquires both after a successful
2924 conversion (as part of translation phase 7) to a floating constant token or an integer
2925 constant token.
2928 <sup><a name="note69" href="#note69"><b>69)</b></a></sup> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
2929 <sup><a name="note70" href="#note70"><b>70)</b></a></sup> For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
2931 [<a name="p65" href="#p65">page 65</a>] (<a href="#Contents">Contents</a>)
2933 <a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
2934 1 Except within a character constant, a string literal, or a comment, the characters /*
2935 introduce a comment. The contents of such a comment are examined only to identify
2936 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note71"><b>71)</b></a></sup>
2937 2 Except within a character constant, a string literal, or a comment, the characters //
2938 introduce a comment that includes all multibyte characters up to, but not including, the
2939 next new-line character. The contents of such a comment are examined only to identify
2940 multibyte characters and to find the terminating new-line character.
2941 3 EXAMPLE
2942 "a//b" // four-character string literal
2943 #include "//e" // undefined behavior
2944 // */ // comment, not syntax error
2945 f = g/**//h; // equivalent to f = g / h;
2947 i(); // part of a two-line comment
2949 / j(); // part of a two-line comment
2950 #define glue(x,y) x##y
2951 glue(/,/) k(); // syntax error, not comment
2952 /*//*/ l(); // equivalent to l();
2953 m = n//**/o
2954 + p; // equivalent to m = n + p;
2959 <sup><a name="note71" href="#note71"><b>71)</b></a></sup> Thus, /* ... */ comments do not nest.
2961 [<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
2963 <a name="6.5" href="#6.5"><b> 6.5 Expressions</b></a>
2964 1 An expression is a sequence of operators and operands that specifies computation of a
2965 value, or that designates an object or a function, or that generates side effects, or that
2966 performs a combination thereof.
2967 2 Between the previous and next sequence point an object shall have its stored value
2968 modified at most once by the evaluation of an expression.<sup><a href="#note72"><b>72)</b></a></sup> Furthermore, the prior value
2969 shall be read only to determine the value to be stored.<sup><a href="#note73"><b>73)</b></a></sup>
2970 3 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note74"><b>74)</b></a></sup> Except as specified
2971 later (for the function-call (), &amp;&amp;, ||, ?:, and comma operators), the order of evaluation
2972 of subexpressions and the order in which side effects take place are both unspecified.
2973 4 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
2974 collectively described as bitwise operators) are required to have operands that have
2975 integer type. These operators yield values that depend on the internal representations of
2976 integers, and have implementation-defined and undefined aspects for signed types.
2977 5 If an exceptional condition occurs during the evaluation of an expression (that is, if the
2978 result is not mathematically defined or not in the range of representable values for its
2979 type), the behavior is undefined.
2980 6 The effective type of an object for an access to its stored value is the declared type of the
2981 object, if any.<sup><a href="#note75"><b>75)</b></a></sup> If a value is stored into an object having no declared type through an
2982 lvalue having a type that is not a character type, then the type of the lvalue becomes the
2985 <sup><a name="note72" href="#note72"><b>72)</b></a></sup> A floating-point status flag is not an object and can be set more than once within an expression.
2986 <sup><a name="note73" href="#note73"><b>73)</b></a></sup> This paragraph renders undefined statement expressions such as
2987 i = ++i + 1;
2988 a[i++] = i;
2989 while allowing
2990 i = i + 1;
2991 a[i] = i;
2993 <sup><a name="note74" href="#note74"><b>74)</b></a></sup> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
2994 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
2995 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
2996 <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
2997 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
2998 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
2999 the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
3000 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3001 indicated in each subclause by the syntax for the expressions discussed therein.
3002 <sup><a name="note75" href="#note75"><b>75)</b></a></sup> Allocated objects have no declared type.
3004 [<a name="p67" href="#p67">page 67</a>] (<a href="#Contents">Contents</a>)
3006 effective type of the object for that access and for subsequent accesses that do not modify
3007 the stored value. If a value is copied into an object having no declared type using
3008 memcpy or memmove, or is copied as an array of character type, then the effective type
3009 of the modified object for that access and for subsequent accesses that do not modify the
3010 value is the effective type of the object from which the value is copied, if it has one. For
3011 all other accesses to an object having no declared type, the effective type of the object is
3012 simply the type of the lvalue used for the access.
3013 7 An object shall have its stored value accessed only by an lvalue expression that has one of
3014 the following types:<sup><a href="#note76"><b>76)</b></a></sup>
3015 -- a type compatible with the effective type of the object,
3016 -- a qualified version of a type compatible with the effective type of the object,
3017 -- a type that is the signed or unsigned type corresponding to the effective type of the
3018 object,
3019 -- a type that is the signed or unsigned type corresponding to a qualified version of the
3020 effective type of the object,
3021 -- an aggregate or union type that includes one of the aforementioned types among its
3022 members (including, recursively, a member of a subaggregate or contained union), or
3023 -- a character type.
3024 8 A floating expression may be contracted, that is, evaluated as though it were an atomic
3025 operation, thereby omitting rounding errors implied by the source code and the
3026 expression evaluation method.<sup><a href="#note77"><b>77)</b></a></sup> The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
3027 way to disallow contracted expressions. Otherwise, whether and how expressions are
3028 contracted is implementation-defined.<sup><a href="#note78"><b>78)</b></a></sup>
3029 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>).
3034 <sup><a name="note76" href="#note76"><b>76)</b></a></sup> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3035 <sup><a name="note77" href="#note77"><b>77)</b></a></sup> A contracted expression might also omit the raising of floating-point exceptions.
3036 <sup><a name="note78" href="#note78"><b>78)</b></a></sup> This license is specifically intended to allow implementations to exploit fast machine instructions that
3037 combine multiple C operators. As contractions potentially undermine predictability, and can even
3038 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3039 documented.
3041 [<a name="p68" href="#p68">page 68</a>] (<a href="#Contents">Contents</a>)
3043 <a name="6.5.1" href="#6.5.1"><b> 6.5.1 Primary expressions</b></a>
3044 <b> Syntax</b>
3045 1 primary-expression:
3046 identifier
3047 constant
3048 string-literal
3049 ( expression )
3050 <b> Semantics</b>
3051 2 An identifier is a primary expression, provided it has been declared as designating an
3052 object (in which case it is an lvalue) or a function (in which case it is a function
3053 designator).<sup><a href="#note79"><b>79)</b></a></sup>
3054 3 A constant is a primary expression. Its type depends on its form and value, as detailed in
3055 <a href="#6.4.4">6.4.4</a>.
3056 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>.
3057 5 A parenthesized expression is a primary expression. Its type and value are identical to
3058 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3059 expression if the unparenthesized expression is, respectively, an lvalue, a function
3060 designator, or a void expression.
3061 Forward references: declarations (<a href="#6.7">6.7</a>).
3062 <a name="6.5.2" href="#6.5.2"><b> 6.5.2 Postfix operators</b></a>
3063 <b> Syntax</b>
3064 1 postfix-expression:
3065 primary-expression
3066 postfix-expression [ expression ]
3067 postfix-expression ( argument-expression-listopt )
3068 postfix-expression . identifier
3069 postfix-expression -&gt; identifier
3070 postfix-expression ++
3071 postfix-expression --
3072 ( type-name ) { initializer-list }
3073 ( type-name ) { initializer-list , }
3078 <sup><a name="note79" href="#note79"><b>79)</b></a></sup> Thus, an undeclared identifier is a violation of the syntax.
3080 [<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
3082 argument-expression-list:
3083 assignment-expression
3084 argument-expression-list , assignment-expression
3085 <a name="6.5.2.1" href="#6.5.2.1"><b> 6.5.2.1 Array subscripting</b></a>
3086 <b> Constraints</b>
3087 1 One of the expressions shall have type ''pointer to object type'', the other expression shall
3088 have integer type, and the result has type ''type''.
3089 <b> Semantics</b>
3090 2 A postfix expression followed by an expression in square brackets [] is a subscripted
3091 designation of an element of an array object. The definition of the subscript operator []
3092 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3093 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3094 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3095 element of E1 (counting from zero).
3096 3 Successive subscript operators designate an element of a multidimensional array object.
3097 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
3098 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3099 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3100 implicitly as a result of subscripting, the result is the pointed-to (n - 1)-dimensional array,
3101 which itself is converted into a pointer if used as other than an lvalue. It follows from this
3102 that arrays are stored in row-major order (last subscript varies fastest).
3103 4 EXAMPLE Consider the array object defined by the declaration
3104 int x[3][5];
3105 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
3106 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3107 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3108 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
3109 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
3110 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
3111 yields an int.
3113 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
3114 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
3116 [<a name="p70" href="#p70">page 70</a>] (<a href="#Contents">Contents</a>)
3118 <a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
3119 <b> Constraints</b>
3120 1 The expression that denotes the called function<sup><a href="#note80"><b>80)</b></a></sup> shall have type pointer to function
3121 returning void or returning an object type other than an array type.
3122 2 If the expression that denotes the called function has a type that includes a prototype, the
3123 number of arguments shall agree with the number of parameters. Each argument shall
3124 have a type such that its value may be assigned to an object with the unqualified version
3125 of the type of its corresponding parameter.
3126 <b> Semantics</b>
3127 3 A postfix expression followed by parentheses () containing a possibly empty, comma-
3128 separated list of expressions is a function call. The postfix expression denotes the called
3129 function. The list of expressions specifies the arguments to the function.
3130 4 An argument may be an expression of any object type. In preparing for the call to a
3131 function, the arguments are evaluated, and each parameter is assigned the value of the
3132 corresponding argument.<sup><a href="#note81"><b>81)</b></a></sup>
3133 5 If the expression that denotes the called function has type pointer to function returning an
3134 object type, the function call expression has the same type as that object type, and has the
3135 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. If
3136 an attempt is made to modify the result of a function call or to access it after the next
3137 sequence point, the behavior is undefined.
3138 6 If the expression that denotes the called function has a type that does not include a
3139 prototype, the integer promotions are performed on each argument, and arguments that
3140 have type float are promoted to double. These are called the default argument
3141 promotions. If the number of arguments does not equal the number of parameters, the
3142 behavior is undefined. If the function is defined with a type that includes a prototype, and
3143 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
3144 promotion are not compatible with the types of the parameters, the behavior is undefined.
3145 If the function is defined with a type that does not include a prototype, and the types of
3146 the arguments after promotion are not compatible with those of the parameters after
3147 promotion, the behavior is undefined, except for the following cases:
3152 <sup><a name="note80" href="#note80"><b>80)</b></a></sup> Most often, this is the result of converting an identifier that is a function designator.
3153 <sup><a name="note81" href="#note81"><b>81)</b></a></sup> A function may change the values of its parameters, but these changes cannot affect the values of the
3154 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
3155 change the value of the object pointed to. A parameter declared to have array or function type is
3156 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
3158 [<a name="p71" href="#p71">page 71</a>] (<a href="#Contents">Contents</a>)
3160 -- one promoted type is a signed integer type, the other promoted type is the
3161 corresponding unsigned integer type, and the value is representable in both types;
3162 -- both types are pointers to qualified or unqualified versions of a character type or
3163 void.
3164 7 If the expression that denotes the called function has a type that does include a prototype,
3165 the arguments are implicitly converted, as if by assignment, to the types of the
3166 corresponding parameters, taking the type of each parameter to be the unqualified version
3167 of its declared type. The ellipsis notation in a function prototype declarator causes
3168 argument type conversion to stop after the last declared parameter. The default argument
3169 promotions are performed on trailing arguments.
3170 8 No other conversions are performed implicitly; in particular, the number and types of
3171 arguments are not compared with those of the parameters in a function definition that
3172 does not include a function prototype declarator.
3173 9 If the function is defined with a type that is not compatible with the type (of the
3174 expression) pointed to by the expression that denotes the called function, the behavior is
3175 undefined.
3176 10 The order of evaluation of the function designator, the actual arguments, and
3177 subexpressions within the actual arguments is unspecified, but there is a sequence point
3178 before the actual call.
3179 11 Recursive function calls shall be permitted, both directly and indirectly through any chain
3180 of other functions.
3181 12 EXAMPLE In the function call
3182 (*pf[f1()]) (f2(), f3() + f4())
3183 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
3184 the function pointed to by pf[f1()] is called.
3186 Forward references: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
3187 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>).
3188 <a name="6.5.2.3" href="#6.5.2.3"><b> 6.5.2.3 Structure and union members</b></a>
3189 <b> Constraints</b>
3190 1 The first operand of the . operator shall have a qualified or unqualified structure or union
3191 type, and the second operand shall name a member of that type.
3192 2 The first operand of the -&gt; operator shall have type ''pointer to qualified or unqualified
3193 structure'' or ''pointer to qualified or unqualified union'', and the second operand shall
3194 name a member of the type pointed to.
3196 [<a name="p72" href="#p72">page 72</a>] (<a href="#Contents">Contents</a>)
3198 <b> Semantics</b>
3199 3 A postfix expression followed by the . operator and an identifier designates a member of
3200 a structure or union object. The value is that of the named member,<sup><a href="#note82"><b>82)</b></a></sup> and is an lvalue if
3201 the first expression is an lvalue. If the first expression has qualified type, the result has
3202 the so-qualified version of the type of the designated member.
3203 4 A postfix expression followed by the -&gt; operator and an identifier designates a member
3204 of a structure or union object. The value is that of the named member of the object to
3205 which the first expression points, and is an lvalue.<sup><a href="#note83"><b>83)</b></a></sup> If the first expression is a pointer to
3206 a qualified type, the result has the so-qualified version of the type of the designated
3207 member.
3208 5 One special guarantee is made in order to simplify the use of unions: if a union contains
3209 several structures that share a common initial sequence (see below), and if the union
3210 object currently contains one of these structures, it is permitted to inspect the common
3211 initial part of any of them anywhere that a declaration of the complete type of the union is
3212 visible. Two structures share a common initial sequence if corresponding members have
3213 compatible types (and, for bit-fields, the same widths) for a sequence of one or more
3214 initial members.
3215 6 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
3216 union, f().x is a valid postfix expression but is not an lvalue.
3218 7 EXAMPLE 2 In:
3219 struct s { int i; const int ci; };
3220 struct s s;
3221 const struct s cs;
3222 volatile struct s vs;
3223 the various members have the types:
3224 s.i int
3225 s.ci const int
3226 cs.i const int
3227 cs.ci const int
3228 vs.i volatile int
3229 vs.ci volatile const int
3234 <sup><a name="note82" href="#note82"><b>82)</b></a></sup> If the member used to access the contents of a union object is not the same as the member last used to
3235 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
3236 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
3237 punning"). This might be a trap representation.
3238 <sup><a name="note83" href="#note83"><b>83)</b></a></sup> If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
3239 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
3241 [<a name="p73" href="#p73">page 73</a>] (<a href="#Contents">Contents</a>)
3243 8 EXAMPLE 3 The following is a valid fragment:
3244 union {
3245 struct {
3246 int alltypes;
3247 } n;
3248 struct {
3249 int type;
3250 int intnode;
3251 } ni;
3252 struct {
3253 int type;
3254 double doublenode;
3255 } nf;
3256 } u;
3257 u.nf.type = 1;
3258 u.nf.doublenode = <a href="#3.14">3.14</a>;
3259 /* ... */
3260 if (u.n.alltypes == 1)
3261 if (sin(u.nf.doublenode) == 0.0)
3262 /* ... */
3263 The following is not a valid fragment (because the union type is not visible within function f):
3264 struct t1 { int m; };
3265 struct t2 { int m; };
3266 int f(struct t1 *p1, struct t2 *p2)
3268 if (p1-&gt;m &lt; 0)
3269 p2-&gt;m = -p2-&gt;m;
3270 return p1-&gt;m;
3272 int g()
3274 union {
3275 struct t1 s1;
3276 struct t2 s2;
3277 } u;
3278 /* ... */
3279 return f(&amp;u.s1, &amp;u.s2);
3282 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
3283 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
3285 [<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
3287 <a name="6.5.2.4" href="#6.5.2.4"><b> 6.5.2.4 Postfix increment and decrement operators</b></a>
3288 <b> Constraints</b>
3289 1 The operand of the postfix increment or decrement operator shall have qualified or
3290 unqualified real or pointer type and shall be a modifiable lvalue.
3291 <b> Semantics</b>
3292 2 The result of the postfix ++ operator is the value of the operand. After the result is
3293 obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
3294 type is added to it.) See the discussions of additive operators and compound assignment
3295 for information on constraints, types, and conversions and the effects of operations on
3296 pointers. The side effect of updating the stored value of the operand shall occur between
3297 the previous and the next sequence point.
3298 3 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
3299 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
3300 it).
3301 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>).
3302 <a name="6.5.2.5" href="#6.5.2.5"><b> 6.5.2.5 Compound literals</b></a>
3303 <b> Constraints</b>
3304 1 The type name shall specify an object type or an array of unknown size, but not a variable
3305 length array type.
3306 2 No initializer shall attempt to provide a value for an object not contained within the entire
3307 unnamed object specified by the compound literal.
3308 3 If the compound literal occurs outside the body of a function, the initializer list shall
3309 consist of constant expressions.
3310 <b> Semantics</b>
3311 4 A postfix expression that consists of a parenthesized type name followed by a brace-
3312 enclosed list of initializers is a compound literal. It provides an unnamed object whose
3313 value is given by the initializer list.<sup><a href="#note84"><b>84)</b></a></sup>
3314 5 If the type name specifies an array of unknown size, the size is determined by the
3315 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
3316 completed array type. Otherwise (when the type name specifies an object type), the type
3317 of the compound literal is that specified by the type name. In either case, the result is an
3318 lvalue.
3321 <sup><a name="note84" href="#note84"><b>84)</b></a></sup> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
3322 or void only, and the result of a cast expression is not an lvalue.
3324 [<a name="p75" href="#p75">page 75</a>] (<a href="#Contents">Contents</a>)
3326 6 The value of the compound literal is that of an unnamed object initialized by the
3327 initializer list. If the compound literal occurs outside the body of a function, the object
3328 has static storage duration; otherwise, it has automatic storage duration associated with
3329 the enclosing block.
3330 7 All the semantic rules and constraints for initializer lists in <a href="#6.7.8">6.7.8</a> are applicable to
3331 compound literals.<sup><a href="#note85"><b>85)</b></a></sup>
3332 8 String literals, and compound literals with const-qualified types, need not designate
3333 distinct objects.<sup><a href="#note86"><b>86)</b></a></sup>
3334 9 EXAMPLE 1 The file scope definition
3335 int *p = (int []){2, 4};
3336 initializes p to point to the first element of an array of two ints, the first having the value two and the
3337 second, four. The expressions in this compound literal are required to be constant. The unnamed object
3338 has static storage duration.
3340 10 EXAMPLE 2 In contrast, in
3341 void f(void)
3343 int *p;
3344 /*...*/
3345 p = (int [2]){*p};
3346 /*...*/
3348 p is assigned the address of the first element of an array of two ints, the first having the value previously
3349 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
3350 unnamed object has automatic storage duration.
3352 11 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
3353 created using compound literals can be passed to functions without depending on member order:
3354 drawline((struct point){.x=1, .y=1},
3355 (struct point){.x=3, .y=4});
3356 Or, if drawline instead expected pointers to struct point:
3357 drawline(&amp;(struct point){.x=1, .y=1},
3358 &amp;(struct point){.x=3, .y=4});
3360 12 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
3361 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
3366 <sup><a name="note85" href="#note85"><b>85)</b></a></sup> For example, subobjects without explicit initializers are initialized to zero.
3367 <sup><a name="note86" href="#note86"><b>86)</b></a></sup> This allows implementations to share storage for string literals and constant compound literals with
3368 the same or overlapping representations.
3370 [<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
3372 13 EXAMPLE 5 The following three expressions have different meanings:
3373 "/tmp/fileXXXXXX"
3374 (char []){"/tmp/fileXXXXXX"}
3375 (const char []){"/tmp/fileXXXXXX"}
3376 The first always has static storage duration and has type array of char, but need not be modifiable; the last
3377 two have automatic storage duration when they occur within the body of a function, and the first of these
3378 two is modifiable.
3380 14 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
3381 and can even be shared. For example,
3382 (const char []){"abc"} == "abc"
3383 might yield 1 if the literals' storage is shared.
3385 15 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
3386 linked object. For example, there is no way to write a self-referential compound literal that could be used
3387 as the function argument in place of the named object endless_zeros below:
3388 struct int_list { int car; struct int_list *cdr; };
3389 struct int_list endless_zeros = {0, &amp;endless_zeros};
3390 eval(endless_zeros);
3392 16 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
3393 struct s { int i; };
3394 int f (void)
3396 struct s *p = 0, *q;
3397 int j = 0;
3398 again:
3399 q = p, p = &amp;((struct s){ j++ });
3400 if (j &lt; 2) goto again;
3401 return p == q &amp;&amp; q-&gt;i == 1;
3403 The function f() always returns the value 1.
3404 17 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
3405 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
3406 have an indeterminate value, which would result in undefined behavior.
3408 Forward references: type names (<a href="#6.7.6">6.7.6</a>), initialization (<a href="#6.7.8">6.7.8</a>).
3410 [<a name="p77" href="#p77">page 77</a>] (<a href="#Contents">Contents</a>)
3412 <a name="6.5.3" href="#6.5.3"><b> 6.5.3 Unary operators</b></a>
3413 <b> Syntax</b>
3414 1 unary-expression:
3415 postfix-expression
3416 ++ unary-expression
3417 -- unary-expression
3418 unary-operator cast-expression
3419 sizeof unary-expression
3420 sizeof ( type-name )
3421 unary-operator: one of
3422 &amp; * + - ~ !
3423 <a name="6.5.3.1" href="#6.5.3.1"><b> 6.5.3.1 Prefix increment and decrement operators</b></a>
3424 <b> Constraints</b>
3425 1 The operand of the prefix increment or decrement operator shall have qualified or
3426 unqualified real or pointer type and shall be a modifiable lvalue.
3427 <b> Semantics</b>
3428 2 The value of the operand of the prefix ++ operator is incremented. The result is the new
3429 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
3430 See the discussions of additive operators and compound assignment for information on
3431 constraints, types, side effects, and conversions and the effects of operations on pointers.
3432 3 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
3433 operand is decremented.
3434 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>).
3435 <a name="6.5.3.2" href="#6.5.3.2"><b> 6.5.3.2 Address and indirection operators</b></a>
3436 <b> Constraints</b>
3437 1 The operand of the unary &amp; operator shall be either a function designator, the result of a
3438 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
3439 not declared with the register storage-class specifier.
3440 2 The operand of the unary * operator shall have pointer type.
3441 <b> Semantics</b>
3442 3 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
3443 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
3444 neither that operator nor the &amp; operator is evaluated and the result is as if both were
3445 omitted, except that the constraints on the operators still apply and the result is not an
3446 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
3448 [<a name="p78" href="#p78">page 78</a>] (<a href="#Contents">Contents</a>)
3450 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
3451 were removed and the [] operator were changed to a + operator. Otherwise, the result is
3452 a pointer to the object or function designated by its operand.
3453 4 The unary * operator denotes indirection. If the operand points to a function, the result is
3454 a function designator; if it points to an object, the result is an lvalue designating the
3455 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
3456 invalid value has been assigned to the pointer, the behavior of the unary * operator is
3457 undefined.<sup><a href="#note87"><b>87)</b></a></sup>
3458 Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
3459 (<a href="#6.7.2.1">6.7.2.1</a>).
3460 <a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
3461 <b> Constraints</b>
3462 1 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
3463 integer type; of the ! operator, scalar type.
3464 <b> Semantics</b>
3465 2 The result of the unary + operator is the value of its (promoted) operand. The integer
3466 promotions are performed on the operand, and the result has the promoted type.
3467 3 The result of the unary - operator is the negative of its (promoted) operand. The integer
3468 promotions are performed on the operand, and the result has the promoted type.
3469 4 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
3470 each bit in the result is set if and only if the corresponding bit in the converted operand is
3471 not set). The integer promotions are performed on the operand, and the result has the
3472 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
3473 to the maximum value representable in that type minus E.
3474 5 The result of the logical negation operator ! is 0 if the value of its operand compares
3475 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
3476 The expression !E is equivalent to (0==E).
3481 <sup><a name="note87" href="#note87"><b>87)</b></a></sup> Thus, &amp;*E is equivalent to E (even if E is a null pointer), and &amp;(E1[E2]) to ((E1)+(E2)). It is
3482 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
3483 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
3484 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
3485 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
3486 address inappropriately aligned for the type of object pointed to, and the address of an object after the
3487 end of its lifetime.
3489 [<a name="p79" href="#p79">page 79</a>] (<a href="#Contents">Contents</a>)
3491 <a name="6.5.3.4" href="#6.5.3.4"><b> 6.5.3.4 The sizeof operator</b></a>
3492 <b> Constraints</b>
3493 1 The sizeof operator shall not be applied to an expression that has function type or an
3494 incomplete type, to the parenthesized name of such a type, or to an expression that
3495 designates a bit-field member.
3496 <b> Semantics</b>
3497 2 The sizeof operator yields the size (in bytes) of its operand, which may be an
3498 expression or the parenthesized name of a type. The size is determined from the type of
3499 the operand. The result is an integer. If the type of the operand is a variable length array
3500 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
3501 integer constant.
3502 3 When applied to an operand that has type char, unsigned char, or signed char,
3503 (or a qualified version thereof) the result is 1. When applied to an operand that has array
3504 type, the result is the total number of bytes in the array.<sup><a href="#note88"><b>88)</b></a></sup> When applied to an operand
3505 that has structure or union type, the result is the total number of bytes in such an object,
3506 including internal and trailing padding.
3507 4 The value of the result is implementation-defined, and its type (an unsigned integer type)
3508 is size_t, defined in <a href="#7.17">&lt;stddef.h&gt;</a> (and other headers).
3509 5 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
3510 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
3511 allocate and return a pointer to void. For example:
3512 extern void *alloc(size_t);
3513 double *dp = alloc(sizeof *dp);
3514 The implementation of the alloc function should ensure that its return value is aligned suitably for
3515 conversion to a pointer to double.
3517 6 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
3518 sizeof array / sizeof array[0]
3520 7 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
3521 function:
3522 #include <a href="#7.17">&lt;stddef.h&gt;</a>
3523 size_t fsize3(int n)
3525 char b[n+3]; // variable length array
3526 return sizeof b; // execution time sizeof
3531 <sup><a name="note88" href="#note88"><b>88)</b></a></sup> When applied to a parameter declared to have array or function type, the sizeof operator yields the
3532 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
3534 [<a name="p80" href="#p80">page 80</a>] (<a href="#Contents">Contents</a>)
3536 int main()
3538 size_t size;
3539 size = fsize3(10); // fsize3 returns 13
3540 return 0;
3543 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>),
3544 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>).
3545 <a name="6.5.4" href="#6.5.4"><b> 6.5.4 Cast operators</b></a>
3546 <b> Syntax</b>
3547 1 cast-expression:
3548 unary-expression
3549 ( type-name ) cast-expression
3550 <b> Constraints</b>
3551 2 Unless the type name specifies a void type, the type name shall specify qualified or
3552 unqualified scalar type and the operand shall have scalar type.
3553 3 Conversions that involve pointers, other than where permitted by the constraints of
3554 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
3555 <b> Semantics</b>
3556 4 Preceding an expression by a parenthesized type name converts the value of the
3557 expression to the named type. This construction is called a cast.<sup><a href="#note89"><b>89)</b></a></sup> A cast that specifies
3558 no conversion has no effect on the type or value of an expression.
3559 5 If the value of the expression is represented with greater precision or range than required
3560 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
3561 type of the expression is the same as the named type.
3562 Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
3563 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>).
3568 <sup><a name="note89" href="#note89"><b>89)</b></a></sup> A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
3569 unqualified version of the type.
3571 [<a name="p81" href="#p81">page 81</a>] (<a href="#Contents">Contents</a>)
3573 <a name="6.5.5" href="#6.5.5"><b> 6.5.5 Multiplicative operators</b></a>
3574 <b> Syntax</b>
3575 1 multiplicative-expression:
3576 cast-expression
3577 multiplicative-expression * cast-expression
3578 multiplicative-expression / cast-expression
3579 multiplicative-expression % cast-expression
3580 <b> Constraints</b>
3581 2 Each of the operands shall have arithmetic type. The operands of the % operator shall
3582 have integer type.
3583 <b> Semantics</b>
3584 3 The usual arithmetic conversions are performed on the operands.
3585 4 The result of the binary * operator is the product of the operands.
3586 5 The result of the / operator is the quotient from the division of the first operand by the
3587 second; the result of the % operator is the remainder. In both operations, if the value of
3588 the second operand is zero, the behavior is undefined.
3589 6 When integers are divided, the result of the / operator is the algebraic quotient with any
3590 fractional part discarded.<sup><a href="#note90"><b>90)</b></a></sup> If the quotient a/b is representable, the expression
3591 (a/b)*b + a%b shall equal a.
3592 <a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
3593 <b> Syntax</b>
3594 1 additive-expression:
3595 multiplicative-expression
3596 additive-expression + multiplicative-expression
3597 additive-expression - multiplicative-expression
3598 <b> Constraints</b>
3599 2 For addition, either both operands shall have arithmetic type, or one operand shall be a
3600 pointer to an object type and the other shall have integer type. (Incrementing is
3601 equivalent to adding 1.)
3602 3 For subtraction, one of the following shall hold:
3603 -- both operands have arithmetic type;
3607 <sup><a name="note90" href="#note90"><b>90)</b></a></sup> This is often called ''truncation toward zero''.
3609 [<a name="p82" href="#p82">page 82</a>] (<a href="#Contents">Contents</a>)
3611 -- both operands are pointers to qualified or unqualified versions of compatible object
3612 types; or
3613 -- the left operand is a pointer to an object type and the right operand has integer type.
3614 (Decrementing is equivalent to subtracting 1.)
3615 <b> Semantics</b>
3616 4 If both operands have arithmetic type, the usual arithmetic conversions are performed on
3617 them.
3618 5 The result of the binary + operator is the sum of the operands.
3619 6 The result of the binary - operator is the difference resulting from the subtraction of the
3620 second operand from the first.
3621 7 For the purposes of these operators, a pointer to an object that is not an element of an
3622 array behaves the same as a pointer to the first element of an array of length one with the
3623 type of the object as its element type.
3624 8 When an expression that has integer type is added to or subtracted from a pointer, the
3625 result has the type of the pointer operand. If the pointer operand points to an element of
3626 an array object, and the array is large enough, the result points to an element offset from
3627 the original element such that the difference of the subscripts of the resulting and original
3628 array elements equals the integer expression. In other words, if the expression P points to
3629 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
3630 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
3631 the array object, provided they exist. Moreover, if the expression P points to the last
3632 element of an array object, the expression (P)+1 points one past the last element of the
3633 array object, and if the expression Q points one past the last element of an array object,
3634 the expression (Q)-1 points to the last element of the array object. If both the pointer
3635 operand and the result point to elements of the same array object, or one past the last
3636 element of the array object, the evaluation shall not produce an overflow; otherwise, the
3637 behavior is undefined. If the result points one past the last element of the array object, it
3638 shall not be used as the operand of a unary * operator that is evaluated.
3639 9 When two pointers are subtracted, both shall point to elements of the same array object,
3640 or one past the last element of the array object; the result is the difference of the
3641 subscripts of the two array elements. The size of the result is implementation-defined,
3642 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.17">&lt;stddef.h&gt;</a> header.
3643 If the result is not representable in an object of that type, the behavior is undefined. In
3644 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
3645 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
3646 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
3647 an array object or one past the last element of an array object, and the expression Q points
3648 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
3650 [<a name="p83" href="#p83">page 83</a>] (<a href="#Contents">Contents</a>)
3652 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
3653 expression P points one past the last element of the array object, even though the
3654 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note91"><b>91)</b></a></sup>
3655 10 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
3657 int n = 4, m = 3;
3658 int a[n][m];
3659 int (*p)[m] = a; // p == &amp;a[0]
3660 p += 1; // p == &amp;a[1]
3661 (*p)[2] = 99; // a[1][2] == 99
3662 n = p - a; // n == 1
3664 11 If array a in the above example were declared to be an array of known constant size, and pointer p were
3665 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
3666 the same.
3668 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>
3669 (<a href="#7.17">7.17</a>).
3670 <a name="6.5.7" href="#6.5.7"><b> 6.5.7 Bitwise shift operators</b></a>
3671 <b> Syntax</b>
3672 1 shift-expression:
3673 additive-expression
3674 shift-expression &lt;&lt; additive-expression
3675 shift-expression &gt;&gt; additive-expression
3676 <b> Constraints</b>
3677 2 Each of the operands shall have integer type.
3678 <b> Semantics</b>
3679 3 The integer promotions are performed on each of the operands. The type of the result is
3680 that of the promoted left operand. If the value of the right operand is negative or is
3681 greater than or equal to the width of the promoted left operand, the behavior is undefined.
3686 <sup><a name="note91" href="#note91"><b>91)</b></a></sup> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
3687 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
3688 by the size of the object originally pointed to, and the resulting pointer is converted back to the
3689 original type. For pointer subtraction, the result of the difference between the character pointers is
3690 similarly divided by the size of the object originally pointed to.
3691 When viewed in this way, an implementation need only provide one extra byte (which may overlap
3692 another object in the program) just after the end of the object in order to satisfy the ''one past the last
3693 element'' requirements.
3695 [<a name="p84" href="#p84">page 84</a>] (<a href="#Contents">Contents</a>)
3697 4 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
3698 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
3699 one more than the maximum value representable in the result type. If E1 has a signed
3700 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
3701 the resulting value; otherwise, the behavior is undefined.
3702 5 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
3703 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
3704 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
3705 resulting value is implementation-defined.
3706 <a name="6.5.8" href="#6.5.8"><b> 6.5.8 Relational operators</b></a>
3707 <b> Syntax</b>
3708 1 relational-expression:
3709 shift-expression
3710 relational-expression &lt; shift-expression
3711 relational-expression &gt; shift-expression
3712 relational-expression &lt;= shift-expression
3713 relational-expression &gt;= shift-expression
3714 <b> Constraints</b>
3715 2 One of the following shall hold:
3716 -- both operands have real type;
3717 -- both operands are pointers to qualified or unqualified versions of compatible object
3718 types; or
3719 -- both operands are pointers to qualified or unqualified versions of compatible
3720 incomplete types.
3721 <b> Semantics</b>
3722 3 If both of the operands have arithmetic type, the usual arithmetic conversions are
3723 performed.
3724 4 For the purposes of these operators, a pointer to an object that is not an element of an
3725 array behaves the same as a pointer to the first element of an array of length one with the
3726 type of the object as its element type.
3727 5 When two pointers are compared, the result depends on the relative locations in the
3728 address space of the objects pointed to. If two pointers to object or incomplete types both
3729 point to the same object, or both point one past the last element of the same array object,
3730 they compare equal. If the objects pointed to are members of the same aggregate object,
3731 pointers to structure members declared later compare greater than pointers to members
3732 declared earlier in the structure, and pointers to array elements with larger subscript
3734 [<a name="p85" href="#p85">page 85</a>] (<a href="#Contents">Contents</a>)
3736 values compare greater than pointers to elements of the same array with lower subscript
3737 values. All pointers to members of the same union object compare equal. If the
3738 expression P points to an element of an array object and the expression Q points to the
3739 last element of the same array object, the pointer expression Q+1 compares greater than
3740 P. In all other cases, the behavior is undefined.
3741 6 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
3742 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.<sup><a href="#note92"><b>92)</b></a></sup>
3743 The result has type int.
3744 <a name="6.5.9" href="#6.5.9"><b> 6.5.9 Equality operators</b></a>
3745 <b> Syntax</b>
3746 1 equality-expression:
3747 relational-expression
3748 equality-expression == relational-expression
3749 equality-expression != relational-expression
3750 <b> Constraints</b>
3751 2 One of the following shall hold:
3752 -- both operands have arithmetic type;
3753 -- both operands are pointers to qualified or unqualified versions of compatible types;
3754 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
3755 qualified or unqualified version of void; or
3756 -- one operand is a pointer and the other is a null pointer constant.
3757 <b> Semantics</b>
3758 3 The == (equal to) and != (not equal to) operators are analogous to the relational
3759 operators except for their lower precedence.<sup><a href="#note93"><b>93)</b></a></sup> Each of the operators yields 1 if the
3760 specified relation is true and 0 if it is false. The result has type int. For any pair of
3761 operands, exactly one of the relations is true.
3762 4 If both of the operands have arithmetic type, the usual arithmetic conversions are
3763 performed. Values of complex types are equal if and only if both their real parts are equal
3764 and also their imaginary parts are equal. Any two values of arithmetic types from
3765 different type domains are equal if and only if the results of their conversions to the
3766 (complex) result type determined by the usual arithmetic conversions are equal.
3769 <sup><a name="note92" href="#note92"><b>92)</b></a></sup> The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
3770 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
3771 <sup><a name="note93" href="#note93"><b>93)</b></a></sup> 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.
3773 [<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
3775 5 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
3776 null pointer constant, the null pointer constant is converted to the type of the pointer. If
3777 one operand is a pointer to an object or incomplete type and the other is a pointer to a
3778 qualified or unqualified version of void, the former is converted to the type of the latter.
3779 6 Two pointers compare equal if and only if both are null pointers, both are pointers to the
3780 same object (including a pointer to an object and a subobject at its beginning) or function,
3781 both are pointers to one past the last element of the same array object, or one is a pointer
3782 to one past the end of one array object and the other is a pointer to the start of a different
3783 array object that happens to immediately follow the first array object in the address
3784 space.<sup><a href="#note94"><b>94)</b></a></sup>
3785 7 For the purposes of these operators, a pointer to an object that is not an element of an
3786 array behaves the same as a pointer to the first element of an array of length one with the
3787 type of the object as its element type.
3788 <a name="6.5.10" href="#6.5.10"><b> 6.5.10 Bitwise AND operator</b></a>
3789 <b> Syntax</b>
3790 1 AND-expression:
3791 equality-expression
3792 AND-expression &amp; equality-expression
3793 <b> Constraints</b>
3794 2 Each of the operands shall have integer type.
3795 <b> Semantics</b>
3796 3 The usual arithmetic conversions are performed on the operands.
3797 4 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
3798 the result is set if and only if each of the corresponding bits in the converted operands is
3799 set).
3804 <sup><a name="note94" href="#note94"><b>94)</b></a></sup> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
3805 adjacent members of a structure with no padding between them, or because the implementation chose
3806 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
3807 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
3808 behavior.
3810 [<a name="p87" href="#p87">page 87</a>] (<a href="#Contents">Contents</a>)
3812 <a name="6.5.11" href="#6.5.11"><b> 6.5.11 Bitwise exclusive OR operator</b></a>
3813 <b> Syntax</b>
3814 1 exclusive-OR-expression:
3815 AND-expression
3816 exclusive-OR-expression ^ AND-expression
3817 <b> Constraints</b>
3818 2 Each of the operands shall have integer type.
3819 <b> Semantics</b>
3820 3 The usual arithmetic conversions are performed on the operands.
3821 4 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
3822 in the result is set if and only if exactly one of the corresponding bits in the converted
3823 operands is set).
3824 <a name="6.5.12" href="#6.5.12"><b> 6.5.12 Bitwise inclusive OR operator</b></a>
3825 <b> Syntax</b>
3826 1 inclusive-OR-expression:
3827 exclusive-OR-expression
3828 inclusive-OR-expression | exclusive-OR-expression
3829 <b> Constraints</b>
3830 2 Each of the operands shall have integer type.
3831 <b> Semantics</b>
3832 3 The usual arithmetic conversions are performed on the operands.
3833 4 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
3834 the result is set if and only if at least one of the corresponding bits in the converted
3835 operands is set).
3837 [<a name="p88" href="#p88">page 88</a>] (<a href="#Contents">Contents</a>)
3839 <a name="6.5.13" href="#6.5.13"><b> 6.5.13 Logical AND operator</b></a>
3840 <b> Syntax</b>
3841 1 logical-AND-expression:
3842 inclusive-OR-expression
3843 logical-AND-expression &amp;&amp; inclusive-OR-expression
3844 <b> Constraints</b>
3845 2 Each of the operands shall have scalar type.
3846 <b> Semantics</b>
3847 3 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
3848 yields 0. The result has type int.
3849 4 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
3850 there is a sequence point after the evaluation of the first operand. If the first operand
3851 compares equal to 0, the second operand is not evaluated.
3852 <a name="6.5.14" href="#6.5.14"><b> 6.5.14 Logical OR operator</b></a>
3853 <b> Syntax</b>
3854 1 logical-OR-expression:
3855 logical-AND-expression
3856 logical-OR-expression || logical-AND-expression
3857 <b> Constraints</b>
3858 2 Each of the operands shall have scalar type.
3859 <b> Semantics</b>
3860 3 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
3861 yields 0. The result has type int.
3862 4 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
3863 a sequence point after the evaluation of the first operand. If the first operand compares
3864 unequal to 0, the second operand is not evaluated.
3866 [<a name="p89" href="#p89">page 89</a>] (<a href="#Contents">Contents</a>)
3868 <a name="6.5.15" href="#6.5.15"><b> 6.5.15 Conditional operator</b></a>
3869 <b> Syntax</b>
3870 1 conditional-expression:
3871 logical-OR-expression
3872 logical-OR-expression ? expression : conditional-expression
3873 <b> Constraints</b>
3874 2 The first operand shall have scalar type.
3875 3 One of the following shall hold for the second and third operands:
3876 -- both operands have arithmetic type;
3877 -- both operands have the same structure or union type;
3878 -- both operands have void type;
3879 -- both operands are pointers to qualified or unqualified versions of compatible types;
3880 -- one operand is a pointer and the other is a null pointer constant; or
3881 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
3882 qualified or unqualified version of void.
3883 <b> Semantics</b>
3884 4 The first operand is evaluated; there is a sequence point after its evaluation. The second
3885 operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
3886 only if the first compares equal to 0; the result is the value of the second or third operand
3887 (whichever is evaluated), converted to the type described below.<sup><a href="#note95"><b>95)</b></a></sup> If an attempt is made
3888 to modify the result of a conditional operator or to access it after the next sequence point,
3889 the behavior is undefined.
3890 5 If both the second and third operands have arithmetic type, the result type that would be
3891 determined by the usual arithmetic conversions, were they applied to those two operands,
3892 is the type of the result. If both the operands have structure or union type, the result has
3893 that type. If both operands have void type, the result has void type.
3894 6 If both the second and third operands are pointers or one is a null pointer constant and the
3895 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
3896 of the types pointed-to by both operands. Furthermore, if both operands are pointers to
3897 compatible types or to differently qualified versions of compatible types, the result type is
3898 a pointer to an appropriately qualified version of the composite type; if one operand is a
3899 null pointer constant, the result has the type of the other operand; otherwise, one operand
3900 is a pointer to void or a qualified version of void, in which case the result type is a
3902 <sup><a name="note95" href="#note95"><b>95)</b></a></sup> A conditional expression does not yield an lvalue.
3904 [<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
3906 pointer to an appropriately qualified version of void.
3907 7 EXAMPLE The common type that results when the second and third operands are pointers is determined
3908 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
3909 pointers have compatible types.
3910 8 Given the declarations
3911 const void *c_vp;
3912 void *vp;
3913 const int *c_ip;
3914 volatile int *v_ip;
3915 int *ip;
3916 const char *c_cp;
3917 the third column in the following table is the common type that is the result of a conditional expression in
3918 which the first two columns are the second and third operands (in either order):
3919 c_vp c_ip const void *
3920 v_ip 0 volatile int *
3921 c_ip v_ip const volatile int *
3922 vp c_cp const void *
3923 ip c_ip const int *
3924 vp ip void *
3926 <a name="6.5.16" href="#6.5.16"><b> 6.5.16 Assignment operators</b></a>
3927 <b> Syntax</b>
3928 1 assignment-expression:
3929 conditional-expression
3930 unary-expression assignment-operator assignment-expression
3931 assignment-operator: one of
3932 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
3933 <b> Constraints</b>
3934 2 An assignment operator shall have a modifiable lvalue as its left operand.
3935 <b> Semantics</b>
3936 3 An assignment operator stores a value in the object designated by the left operand. An
3937 assignment expression has the value of the left operand after the assignment, but is not an
3938 lvalue. The type of an assignment expression is the type of the left operand unless the
3939 left operand has qualified type, in which case it is the unqualified version of the type of
3940 the left operand. The side effect of updating the stored value of the left operand shall
3941 occur between the previous and the next sequence point.
3942 4 The order of evaluation of the operands is unspecified. If an attempt is made to modify
3943 the result of an assignment operator or to access it after the next sequence point, the
3944 behavior is undefined.
3946 [<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
3948 <a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
3949 <b> Constraints</b>
3950 1 One of the following shall hold:<sup><a href="#note96"><b>96)</b></a></sup>
3951 -- the left operand has qualified or unqualified arithmetic type and the right has
3952 arithmetic type;
3953 -- the left operand has a qualified or unqualified version of a structure or union type
3954 compatible with the type of the right;
3955 -- both operands are pointers to qualified or unqualified versions of compatible types,
3956 and the type pointed to by the left has all the qualifiers of the type pointed to by the
3957 right;
3958 -- one operand is a pointer to an object or incomplete type and the other is a pointer to a
3959 qualified or unqualified version of void, and the type pointed to by the left has all
3960 the qualifiers of the type pointed to by the right;
3961 -- the left operand is a pointer and the right is a null pointer constant; or
3962 -- the left operand has type _Bool and the right is a pointer.
3963 <b> Semantics</b>
3964 2 In simple assignment (=), the value of the right operand is converted to the type of the
3965 assignment expression and replaces the value stored in the object designated by the left
3966 operand.
3967 3 If the value being stored in an object is read from another object that overlaps in any way
3968 the storage of the first object, then the overlap shall be exact and the two objects shall
3969 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
3970 undefined.
3971 4 EXAMPLE 1 In the program fragment
3972 int f(void);
3973 char c;
3974 /* ... */
3975 if ((c = f()) == -1)
3976 /* ... */
3977 the int value returned by the function may be truncated when stored in the char, and then converted back
3978 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
3979 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
3983 <sup><a name="note96" href="#note96"><b>96)</b></a></sup> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
3984 (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
3985 qualifiers that were applied to the type category of the expression (for example, it removes const but
3986 not volatile from the type int volatile * const).
3988 [<a name="p92" href="#p92">page 92</a>] (<a href="#Contents">Contents</a>)
3990 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
3991 variable c should be declared as int.
3993 5 EXAMPLE 2 In the fragment:
3994 char c;
3995 int i;
3996 long l;
3997 l = (c = i);
3998 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
3999 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
4000 that is, long int type.
4002 6 EXAMPLE 3 Consider the fragment:
4003 const char **cpp;
4004 char *p;
4005 const char c = 'A';
4006 cpp = &amp;p; // constraint violation
4007 *cpp = &amp;c; // valid
4008 *p = 0; // valid
4009 The first assignment is unsafe because it would allow the following valid code to attempt to change the
4010 value of the const object c.
4012 <a name="6.5.16.2" href="#6.5.16.2"><b> 6.5.16.2 Compound assignment</b></a>
4013 <b> Constraints</b>
4014 1 For the operators += and -= only, either the left operand shall be a pointer to an object
4015 type and the right shall have integer type, or the left operand shall have qualified or
4016 unqualified arithmetic type and the right shall have arithmetic type.
4017 2 For the other operators, each operand shall have arithmetic type consistent with those
4018 allowed by the corresponding binary operator.
4019 <b> Semantics</b>
4020 3 A compound assignment of the form E1 op = E2 differs from the simple assignment
4021 expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
4023 [<a name="p93" href="#p93">page 93</a>] (<a href="#Contents">Contents</a>)
4025 <a name="6.5.17" href="#6.5.17"><b> 6.5.17 Comma operator</b></a>
4026 <b> Syntax</b>
4027 1 expression:
4028 assignment-expression
4029 expression , assignment-expression
4030 <b> Semantics</b>
4031 2 The left operand of a comma operator is evaluated as a void expression; there is a
4032 sequence point after its evaluation. Then the right operand is evaluated; the result has its
4033 type and value.<sup><a href="#note97"><b>97)</b></a></sup> If an attempt is made to modify the result of a comma operator or to
4034 access it after the next sequence point, the behavior is undefined.
4035 3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
4036 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
4037 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
4038 expression of a conditional operator in such contexts. In the function call
4039 f(a, (t=3, t+2), c)
4040 the function has three arguments, the second of which has the value 5.
4042 Forward references: initialization (<a href="#6.7.8">6.7.8</a>).
4047 <sup><a name="note97" href="#note97"><b>97)</b></a></sup> A comma operator does not yield an lvalue.
4049 [<a name="p94" href="#p94">page 94</a>] (<a href="#Contents">Contents</a>)
4051 <a name="6.6" href="#6.6"><b> 6.6 Constant expressions</b></a>
4052 <b> Syntax</b>
4053 1 constant-expression:
4054 conditional-expression
4055 <b> Description</b>
4056 2 A constant expression can be evaluated during translation rather than runtime, and
4057 accordingly may be used in any place that a constant may be.
4058 <b> Constraints</b>
4059 3 Constant expressions shall not contain assignment, increment, decrement, function-call,
4060 or comma operators, except when they are contained within a subexpression that is not
4061 evaluated.<sup><a href="#note98"><b>98)</b></a></sup>
4062 4 Each constant expression shall evaluate to a constant that is in the range of representable
4063 values for its type.
4064 <b> Semantics</b>
4065 5 An expression that evaluates to a constant is required in several contexts. If a floating
4066 expression is evaluated in the translation environment, the arithmetic precision and range
4067 shall be at least as great as if the expression were being evaluated in the execution
4068 environment.
4069 6 An integer constant expression<sup><a href="#note99"><b>99)</b></a></sup> shall have integer type and shall only have operands
4070 that are integer constants, enumeration constants, character constants, sizeof
4071 expressions whose results are integer constants, and floating constants that are the
4072 immediate operands of casts. Cast operators in an integer constant expression shall only
4073 convert arithmetic types to integer types, except as part of an operand to the sizeof
4074 operator.
4075 7 More latitude is permitted for constant expressions in initializers. Such a constant
4076 expression shall be, or evaluate to, one of the following:
4077 -- an arithmetic constant expression,
4078 -- a null pointer constant,
4083 <sup><a name="note98" href="#note98"><b>98)</b></a></sup> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
4084 <sup><a name="note99" href="#note99"><b>99)</b></a></sup> An integer constant expression is used to specify the size of a bit-field member of a structure, the
4085 value of an enumeration constant, the size of an array, or the value of a case constant. Further
4086 constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
4087 directives are discussed in <a href="#6.10.1">6.10.1</a>.
4089 [<a name="p95" href="#p95">page 95</a>] (<a href="#Contents">Contents</a>)
4091 -- an address constant, or
4092 -- an address constant for an object type plus or minus an integer constant expression.
4093 8 An arithmetic constant expression shall have arithmetic type and shall only have
4094 operands that are integer constants, floating constants, enumeration constants, character
4095 constants, and sizeof expressions. Cast operators in an arithmetic constant expression
4096 shall only convert arithmetic types to arithmetic types, except as part of an operand to a
4097 sizeof operator whose result is an integer constant.
4098 9 An address constant is a null pointer, a pointer to an lvalue designating an object of static
4099 storage duration, or a pointer to a function designator; it shall be created explicitly using
4100 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
4101 an expression of array or function type. The array-subscript [] and member-access .
4102 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
4103 be used in the creation of an address constant, but the value of an object shall not be
4104 accessed by use of these operators.
4105 10 An implementation may accept other forms of constant expressions.
4106 11 The semantic rules for the evaluation of a constant expression are the same as for
4107 nonconstant expressions.<sup><a href="#note100"><b>100)</b></a></sup>
4108 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>).
4113 <sup><a name="note100" href="#note100"><b>100)</b></a></sup> Thus, in the following initialization,
4114 static int i = 2 || 1 / 0;
4115 the expression is a valid integer constant expression with value one.
4117 [<a name="p96" href="#p96">page 96</a>] (<a href="#Contents">Contents</a>)
4119 <a name="6.7" href="#6.7"><b> 6.7 Declarations</b></a>
4120 <b> Syntax</b>
4121 1 declaration:
4122 declaration-specifiers init-declarator-listopt ;
4123 declaration-specifiers:
4124 storage-class-specifier declaration-specifiersopt
4125 type-specifier declaration-specifiersopt
4126 type-qualifier declaration-specifiersopt
4127 function-specifier declaration-specifiersopt
4128 init-declarator-list:
4129 init-declarator
4130 init-declarator-list , init-declarator
4131 init-declarator:
4132 declarator
4133 declarator = initializer
4134 <b> Constraints</b>
4135 2 A declaration shall declare at least a declarator (other than the parameters of a function or
4136 the members of a structure or union), a tag, or the members of an enumeration.
4137 3 If an identifier has no linkage, there shall be no more than one declaration of the identifier
4138 (in a declarator or type specifier) with the same scope and in the same name space, except
4139 for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
4140 4 All declarations in the same scope that refer to the same object or function shall specify
4141 compatible types.
4142 <b> Semantics</b>
4143 5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
4144 of an identifier is a declaration for that identifier that:
4145 -- for an object, causes storage to be reserved for that object;
4146 -- for a function, includes the function body;<sup><a href="#note101"><b>101)</b></a></sup>
4147 -- for an enumeration constant or typedef name, is the (only) declaration of the
4148 identifier.
4149 6 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
4150 storage duration, and part of the type of the entities that the declarators denote. The init-
4151 declarator-list is a comma-separated sequence of declarators, each of which may have
4153 <sup><a name="note101" href="#note101"><b>101)</b></a></sup> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
4155 [<a name="p97" href="#p97">page 97</a>] (<a href="#Contents">Contents</a>)
4157 additional type information, or an initializer, or both. The declarators contain the
4158 identifiers (if any) being declared.
4159 7 If an identifier for an object is declared with no linkage, the type for the object shall be
4160 complete by the end of its declarator, or by the end of its init-declarator if it has an
4161 initializer; in the case of function parameters (including in prototypes), it is the adjusted
4162 type (see <a href="#6.7.5.3">6.7.5.3</a>) that is required to be complete.
4163 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
4164 (<a href="#6.7.8">6.7.8</a>).
4165 <a name="6.7.1" href="#6.7.1"><b> 6.7.1 Storage-class specifiers</b></a>
4166 <b> Syntax</b>
4167 1 storage-class-specifier:
4168 typedef
4169 extern
4170 static
4171 auto
4172 register
4173 <b> Constraints</b>
4174 2 At most, one storage-class specifier may be given in the declaration specifiers in a
4175 declaration.<sup><a href="#note102"><b>102)</b></a></sup>
4176 <b> Semantics</b>
4177 3 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
4178 only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
4179 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
4180 4 A declaration of an identifier for an object with storage-class specifier register
4181 suggests that access to the object be as fast as possible. The extent to which such
4182 suggestions are effective is implementation-defined.<sup><a href="#note103"><b>103)</b></a></sup>
4183 5 The declaration of an identifier for a function that has block scope shall have no explicit
4184 storage-class specifier other than extern.
4188 <sup><a name="note102" href="#note102"><b>102)</b></a></sup> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
4189 <sup><a name="note103" href="#note103"><b>103)</b></a></sup> The implementation may treat any register declaration simply as an auto declaration. However,
4190 whether or not addressable storage is actually used, the address of any part of an object declared with
4191 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
4192 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
4193 <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
4194 register is sizeof.
4196 [<a name="p98" href="#p98">page 98</a>] (<a href="#Contents">Contents</a>)
4198 6 If an aggregate or union object is declared with a storage-class specifier other than
4199 typedef, the properties resulting from the storage-class specifier, except with respect to
4200 linkage, also apply to the members of the object, and so on recursively for any aggregate
4201 or union member objects.
4202 Forward references: type definitions (<a href="#6.7.7">6.7.7</a>).
4203 <a name="6.7.2" href="#6.7.2"><b> 6.7.2 Type specifiers</b></a>
4204 <b> Syntax</b>
4205 1 type-specifier:
4206 void
4207 char
4208 short
4210 long
4211 float
4212 double
4213 signed
4214 unsigned
4215 _Bool
4216 _Complex
4217 struct-or-union-specifier *
4218 enum-specifier
4219 typedef-name
4220 <b> Constraints</b>
4221 2 At least one type specifier shall be given in the declaration specifiers in each declaration,
4222 and in the specifier-qualifier list in each struct declaration and type name. Each list of
4223 type specifiers shall be one of the following sets (delimited by commas, when there is
4224 more than one set on a line); the type specifiers may occur in any order, possibly
4225 intermixed with the other declaration specifiers.
4226 -- void
4227 -- char
4228 -- signed char
4229 -- unsigned char
4230 -- short, signed short, short int, or signed short int
4231 -- unsigned short, or unsigned short int
4232 -- int, signed, or signed int
4234 [<a name="p99" href="#p99">page 99</a>] (<a href="#Contents">Contents</a>)
4236 -- unsigned, or unsigned int
4237 -- long, signed long, long int, or signed long int
4238 -- unsigned long, or unsigned long int
4239 -- long long, signed long long, long long int, or
4240 signed long long int
4241 -- unsigned long long, or unsigned long long int
4242 -- float
4243 -- double
4244 -- long double
4245 -- _Bool
4246 -- float _Complex
4247 -- double _Complex
4248 -- long double _Complex
4249 -- struct or union specifier *
4250 -- enum specifier
4251 -- typedef name
4252 3 The type specifier _Complex shall not be used if the implementation does not provide
4253 complex types.<sup><a href="#note104"><b>104)</b></a></sup>
4254 <b> Semantics</b>
4255 4 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
4256 <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>
4257 other types are discussed in <a href="#6.2.5">6.2.5</a>.
4258 5 Each of the comma-separated sets designates the same type, except that for bit-fields, it is
4259 implementation-defined whether the specifier int designates the same type as signed
4260 int or the same type as unsigned int.
4261 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
4262 (<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>).
4267 <sup><a name="note104" href="#note104"><b>104)</b></a></sup> Freestanding implementations are not required to provide complex types. *
4269 [<a name="p100" href="#p100">page 100</a>] (<a href="#Contents">Contents</a>)
4271 <a name="6.7.2.1" href="#6.7.2.1"><b> 6.7.2.1 Structure and union specifiers</b></a>
4272 <b> Syntax</b>
4273 1 struct-or-union-specifier:
4274 struct-or-union identifieropt { struct-declaration-list }
4275 struct-or-union identifier
4276 struct-or-union:
4277 struct
4278 union
4279 struct-declaration-list:
4280 struct-declaration
4281 struct-declaration-list struct-declaration
4282 struct-declaration:
4283 specifier-qualifier-list struct-declarator-list ;
4284 specifier-qualifier-list:
4285 type-specifier specifier-qualifier-listopt
4286 type-qualifier specifier-qualifier-listopt
4287 struct-declarator-list:
4288 struct-declarator
4289 struct-declarator-list , struct-declarator
4290 struct-declarator:
4291 declarator
4292 declaratoropt : constant-expression
4293 <b> Constraints</b>
4294 2 A structure or union shall not contain a member with incomplete or function type (hence,
4295 a structure shall not contain an instance of itself, but may contain a pointer to an instance
4296 of itself), except that the last member of a structure with more than one named member
4297 may have incomplete array type; such a structure (and any union containing, possibly
4298 recursively, a member that is such a structure) shall not be a member of a structure or an
4299 element of an array.
4300 3 The expression that specifies the width of a bit-field shall be an integer constant
4301 expression with a nonnegative value that does not exceed the width of an object of the
4302 type that would be specified were the colon and expression omitted. If the value is zero,
4303 the declaration shall have no declarator.
4304 4 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
4305 int, unsigned int, or some other implementation-defined type.
4307 [<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
4309 <b> Semantics</b>
4310 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
4311 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
4312 of members whose storage overlap.
4313 6 Structure and union specifiers have the same form. The keywords struct and union
4314 indicate that the type being specified is, respectively, a structure type or a union type.
4315 7 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
4316 within a translation unit. The struct-declaration-list is a sequence of declarations for the
4317 members of the structure or union. If the struct-declaration-list contains no named
4318 members, the behavior is undefined. The type is incomplete until after the } that
4319 terminates the list.
4320 8 A member of a structure or union may have any object type other than a variably
4321 modified type.<sup><a href="#note105"><b>105)</b></a></sup> In addition, a member may be declared to consist of a specified
4322 number of bits (including a sign bit, if any). Such a member is called a bit-field;<sup><a href="#note106"><b>106)</b></a></sup> its
4323 width is preceded by a colon.
4324 9 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified
4325 number of bits.<sup><a href="#note107"><b>107)</b></a></sup> If the value 0 or 1 is stored into a nonzero-width bit-field of type
4326 _Bool, the value of the bit-field shall compare equal to the value stored.
4327 10 An implementation may allocate any addressable storage unit large enough to hold a bit-
4328 field. If enough space remains, a bit-field that immediately follows another bit-field in a
4329 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
4330 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
4331 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
4332 low-order or low-order to high-order) is implementation-defined. The alignment of the
4333 addressable storage unit is unspecified.
4334 11 A bit-field declaration with no declarator, but only a colon and a width, indicates an
4335 unnamed bit-field.<sup><a href="#note108"><b>108)</b></a></sup> As a special case, a bit-field structure member with a width of 0
4336 indicates that no further bit-field is to be packed into the unit in which the previous bit-
4337 field, if any, was placed.
4340 <sup><a name="note105" href="#note105"><b>105)</b></a></sup> A structure or union can not contain a member with a variably modified type because member names
4341 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
4342 <sup><a name="note106" href="#note106"><b>106)</b></a></sup> The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
4343 or arrays of bit-field objects.
4344 <sup><a name="note107" href="#note107"><b>107)</b></a></sup> 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,
4345 then it is implementation-defined whether the bit-field is signed or unsigned.
4346 <sup><a name="note108" href="#note108"><b>108)</b></a></sup> An unnamed bit-field structure member is useful for padding to conform to externally imposed
4347 layouts.
4349 [<a name="p102" href="#p102">page 102</a>] (<a href="#Contents">Contents</a>)
4351 12 Each non-bit-field member of a structure or union object is aligned in an implementation-
4352 defined manner appropriate to its type.
4353 13 Within a structure object, the non-bit-field members and the units in which bit-fields
4354 reside have addresses that increase in the order in which they are declared. A pointer to a
4355 structure object, suitably converted, points to its initial member (or if that member is a
4356 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
4357 padding within a structure object, but not at its beginning.
4358 14 The size of a union is sufficient to contain the largest of its members. The value of at
4359 most one of the members can be stored in a union object at any time. A pointer to a
4360 union object, suitably converted, points to each of its members (or if a member is a bit-
4361 field, then to the unit in which it resides), and vice versa.
4362 15 There may be unnamed padding at the end of a structure or union.
4363 16 As a special case, the last element of a structure with more than one named member may
4364 have an incomplete array type; this is called a flexible array member. In most situations,
4365 the flexible array member is ignored. In particular, the size of the structure is as if the
4366 flexible array member were omitted except that it may have more trailing padding than
4367 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
4368 (a pointer to) a structure with a flexible array member and the right operand names that
4369 member, it behaves as if that member were replaced with the longest array (with the same
4370 element type) that would not make the structure larger than the object being accessed; the
4371 offset of the array shall remain that of the flexible array member, even if this would differ
4372 from that of the replacement array. If this array would have no elements, it behaves as if
4373 it had one element but the behavior is undefined if any attempt is made to access that
4374 element or to generate a pointer one past it.
4375 17 EXAMPLE After the declaration:
4376 struct s { int n; double d[]; };
4377 the structure struct s has a flexible array member d. A typical way to use this is:
4378 int m = /* some value */;
4379 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
4380 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
4381 p had been declared as:
4382 struct { int n; double d[m]; } *p;
4383 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
4384 not be the same).
4385 18 Following the above declaration:
4387 [<a name="p103" href="#p103">page 103</a>] (<a href="#Contents">Contents</a>)
4389 struct s t1 = { 0 }; // valid
4390 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
4391 t1.n = 4; // valid
4392 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
4393 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
4394 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
4395 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
4396 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
4397 code.
4398 19 After the further declaration:
4399 struct ss { int n; };
4400 the expressions:
4401 sizeof (struct s) &gt;= sizeof (struct ss)
4402 sizeof (struct s) &gt;= offsetof(struct s, d)
4403 are always equal to 1.
4404 20 If sizeof (double) is 8, then after the following code is executed:
4405 struct s *s1;
4406 struct s *s2;
4407 s1 = malloc(sizeof (struct s) + 64);
4408 s2 = malloc(sizeof (struct s) + 46);
4409 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
4410 purposes, as if the identifiers had been declared as:
4411 struct { int n; double d[8]; } *s1;
4412 struct { int n; double d[5]; } *s2;
4413 21 Following the further successful assignments:
4414 s1 = malloc(sizeof (struct s) + 10);
4415 s2 = malloc(sizeof (struct s) + 6);
4416 they then behave as if the declarations were:
4417 struct { int n; double d[1]; } *s1, *s2;
4418 and:
4419 double *dp;
4420 dp = &amp;(s1-&gt;d[0]); // valid
4421 *dp = 42; // valid
4422 dp = &amp;(s2-&gt;d[0]); // valid
4423 *dp = 42; // undefined behavior
4424 22 The assignment:
4425 *s1 = *s2;
4426 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
4427 of the structure, they might be copied or simply overwritten with indeterminate values.
4429 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
4431 [<a name="p104" href="#p104">page 104</a>] (<a href="#Contents">Contents</a>)
4433 <a name="6.7.2.2" href="#6.7.2.2"><b> 6.7.2.2 Enumeration specifiers</b></a>
4434 <b> Syntax</b>
4435 1 enum-specifier:
4436 enum identifieropt { enumerator-list }
4437 enum identifieropt { enumerator-list , }
4438 enum identifier
4439 enumerator-list:
4440 enumerator
4441 enumerator-list , enumerator
4442 enumerator:
4443 enumeration-constant
4444 enumeration-constant = constant-expression
4445 <b> Constraints</b>
4446 2 The expression that defines the value of an enumeration constant shall be an integer
4447 constant expression that has a value representable as an int.
4448 <b> Semantics</b>
4449 3 The identifiers in an enumerator list are declared as constants that have type int and
4450 may appear wherever such are permitted.<sup><a href="#note109"><b>109)</b></a></sup> An enumerator with = defines its
4451 enumeration constant as the value of the constant expression. If the first enumerator has
4452 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
4453 defines its enumeration constant as the value of the constant expression obtained by
4454 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
4455 = may produce enumeration constants with values that duplicate other values in the same
4456 enumeration.) The enumerators of an enumeration are also known as its members.
4457 4 Each enumerated type shall be compatible with char, a signed integer type, or an
4458 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note110"><b>110)</b></a></sup> but shall be
4459 capable of representing the values of all the members of the enumeration. The
4460 enumerated type is incomplete until after the } that terminates the list of enumerator
4461 declarations.
4466 <sup><a name="note109" href="#note109"><b>109)</b></a></sup> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
4467 each other and from other identifiers declared in ordinary declarators.
4468 <sup><a name="note110" href="#note110"><b>110)</b></a></sup> An implementation may delay the choice of which integer type until all enumeration constants have
4469 been seen.
4471 [<a name="p105" href="#p105">page 105</a>] (<a href="#Contents">Contents</a>)
4473 5 EXAMPLE The following fragment:
4474 enum hue { chartreuse, burgundy, claret=20, winedark };
4475 enum hue col, *cp;
4476 col = claret;
4477 cp = &amp;col;
4478 if (*cp != burgundy)
4479 /* ... */
4480 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
4481 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
4483 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
4484 <a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3 Tags</b></a>
4485 <b> Constraints</b>
4486 1 A specific type shall have its content defined at most once.
4487 2 Where two declarations that use the same tag declare the same type, they shall both use
4488 the same choice of struct, union, or enum.
4489 3 A type specifier of the form
4490 enum identifier
4491 without an enumerator list shall only appear after the type it specifies is complete.
4492 <b> Semantics</b>
4493 4 All declarations of structure, union, or enumerated types that have the same scope and
4494 use the same tag declare the same type. The type is incomplete<sup><a href="#note111"><b>111)</b></a></sup> until the closing brace
4495 of the list defining the content, and complete thereafter.
4496 5 Two declarations of structure, union, or enumerated types which are in different scopes or
4497 use different tags declare distinct types. Each declaration of a structure, union, or
4498 enumerated type which does not include a tag declares a distinct type.
4499 6 A type specifier of the form
4500 struct-or-union identifieropt { struct-declaration-list }
4502 enum identifier { enumerator-list }
4504 enum identifier { enumerator-list , }
4505 declares a structure, union, or enumerated type. The list defines the structure content,
4507 <sup><a name="note111" href="#note111"><b>111)</b></a></sup> An incomplete type may only by used when the size of an object of that type is not needed. It is not
4508 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
4509 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
4510 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
4512 [<a name="p106" href="#p106">page 106</a>] (<a href="#Contents">Contents</a>)
4514 union content, or enumeration content. If an identifier is provided,<sup><a href="#note112"><b>112)</b></a></sup> the type specifier
4515 also declares the identifier to be the tag of that type.
4516 7 A declaration of the form
4517 struct-or-union identifier ;
4518 specifies a structure or union type and declares the identifier as a tag of that type.<sup><a href="#note113"><b>113)</b></a></sup>
4519 8 If a type specifier of the form
4520 struct-or-union identifier
4521 occurs other than as part of one of the above forms, and no other declaration of the
4522 identifier as a tag is visible, then it declares an incomplete structure or union type, and
4523 declares the identifier as the tag of that type.113)
4524 9 If a type specifier of the form
4525 struct-or-union identifier
4527 enum identifier
4528 occurs other than as part of one of the above forms, and a declaration of the identifier as a
4529 tag is visible, then it specifies the same type as that other declaration, and does not
4530 redeclare the tag.
4531 10 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
4532 struct tnode {
4533 int count;
4534 struct tnode *left, *right;
4536 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
4537 declaration has been given, the declaration
4538 struct tnode s, *sp;
4539 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
4540 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
4541 which sp points; the expression s.right-&gt;count designates the count member of the right struct
4542 tnode pointed to from s.
4543 11 The following alternative formulation uses the typedef mechanism:
4548 <sup><a name="note112" href="#note112"><b>112)</b></a></sup> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
4549 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
4550 can make use of that typedef name to declare objects having the specified structure, union, or
4551 enumerated type.
4552 <sup><a name="note113" href="#note113"><b>113)</b></a></sup> A similar construction with enum does not exist.
4554 [<a name="p107" href="#p107">page 107</a>] (<a href="#Contents">Contents</a>)
4556 typedef struct tnode TNODE;
4557 struct tnode {
4558 int count;
4559 TNODE *left, *right;
4561 TNODE s, *sp;
4563 12 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
4564 structures, the declarations
4565 struct s1 { struct s2 *s2p; /* ... */ }; // D1
4566 struct s2 { struct s1 *s1p; /* ... */ }; // D2
4567 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
4568 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
4569 D2. To eliminate this context sensitivity, the declaration
4570 struct s2;
4571 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
4572 completes the specification of the new type.
4574 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
4575 (<a href="#6.7.7">6.7.7</a>).
4576 <a name="6.7.3" href="#6.7.3"><b> 6.7.3 Type qualifiers</b></a>
4577 <b> Syntax</b>
4578 1 type-qualifier:
4579 const
4580 restrict
4581 volatile
4582 <b> Constraints</b>
4583 2 Types other than pointer types derived from object or incomplete types shall not be
4584 restrict-qualified.
4585 <b> Semantics</b>
4586 3 The properties associated with qualified types are meaningful only for expressions that
4587 are lvalues.<sup><a href="#note114"><b>114)</b></a></sup>
4588 4 If the same qualifier appears more than once in the same specifier-qualifier-list, either
4589 directly or via one or more typedefs, the behavior is the same as if it appeared only
4590 once.
4595 <sup><a name="note114" href="#note114"><b>114)</b></a></sup> The implementation may place a const object that is not volatile in a read-only region of
4596 storage. Moreover, the implementation need not allocate storage for such an object if its address is
4597 never used.
4599 [<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
4601 5 If an attempt is made to modify an object defined with a const-qualified type through use
4602 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
4603 made to refer to an object defined with a volatile-qualified type through use of an lvalue
4604 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note115"><b>115)</b></a></sup>
4605 6 An object that has volatile-qualified type may be modified in ways unknown to the
4606 implementation or have other unknown side effects. Therefore any expression referring
4607 to such an object shall be evaluated strictly according to the rules of the abstract machine,
4608 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
4609 object shall agree with that prescribed by the abstract machine, except as modified by the
4610 unknown factors mentioned previously.<sup><a href="#note116"><b>116)</b></a></sup> What constitutes an access to an object that
4611 has volatile-qualified type is implementation-defined.
4612 7 An object that is accessed through a restrict-qualified pointer has a special association
4613 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
4614 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note117"><b>117)</b></a></sup> The intended
4615 use of the restrict qualifier (like the register storage class) is to promote
4616 optimization, and deleting all instances of the qualifier from all preprocessing translation
4617 units composing a conforming program does not change its meaning (i.e., observable
4618 behavior).
4619 8 If the specification of an array type includes any type qualifiers, the element type is so-
4620 qualified, not the array type. If the specification of a function type includes any type
4621 qualifiers, the behavior is undefined.<sup><a href="#note118"><b>118)</b></a></sup>
4622 9 For two qualified types to be compatible, both shall have the identically qualified version
4623 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
4624 does not affect the specified type.
4625 10 EXAMPLE 1 An object declared
4626 extern const volatile int real_time_clock;
4627 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
4632 <sup><a name="note115" href="#note115"><b>115)</b></a></sup> This applies to those objects that behave as if they were defined with qualified types, even if they are
4633 never actually defined as objects in the program (such as an object at a memory-mapped input/output
4634 address).
4635 <sup><a name="note116" href="#note116"><b>116)</b></a></sup> A volatile declaration may be used to describe an object corresponding to a memory-mapped
4636 input/output port or an object accessed by an asynchronously interrupting function. Actions on
4637 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
4638 permitted by the rules for evaluating expressions.
4639 <sup><a name="note117" href="#note117"><b>117)</b></a></sup> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
4640 association between the allocated object and the pointer.
4641 <sup><a name="note118" href="#note118"><b>118)</b></a></sup> Both of these can occur through the use of typedefs.
4643 [<a name="p109" href="#p109">page 109</a>] (<a href="#Contents">Contents</a>)
4645 11 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
4646 modify an aggregate type:
4647 const struct s { int mem; } cs = { 1 };
4648 struct s ncs; // the object ncs is modifiable
4649 typedef int A[2][3];
4650 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
4651 int *pi;
4652 const int *pci;
4653 ncs = cs; // valid
4654 cs = ncs; // violates modifiable lvalue constraint for =
4655 pi = &amp;ncs.mem; // valid
4656 pi = &amp;cs.mem; // violates type constraints for =
4657 pci = &amp;cs.mem; // valid
4658 pi = a[0]; // invalid: a[0] has type ''const int *''
4660 <a name="6.7.3.1" href="#6.7.3.1"><b> 6.7.3.1 Formal definition of restrict</b></a>
4661 1 Let D be a declaration of an ordinary identifier that provides a means of designating an
4662 object P as a restrict-qualified pointer to type T.
4663 2 If D appears inside a block and does not have storage class extern, let B denote the
4664 block. If D appears in the list of parameter declarations of a function definition, let B
4665 denote the associated block. Otherwise, let B denote the block of main (or the block of
4666 whatever function is called at program startup in a freestanding environment).
4667 3 In what follows, a pointer expression E is said to be based on object P if (at some
4668 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
4669 a copy of the array object into which it formerly pointed would change the value of E.<sup><a href="#note119"><b>119)</b></a></sup>
4670 Note that ''based'' is defined only for expressions with pointer types.
4671 4 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
4672 access the value of the object X that it designates, and X is also modified (by any means),
4673 then the following requirements apply: T shall not be const-qualified. Every other lvalue
4674 used to access the value of X shall also have its address based on P. Every access that
4675 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
4676 is assigned the value of a pointer expression E that is based on another restricted pointer
4677 object P2, associated with block B2, then either the execution of B2 shall begin before
4678 the execution of B, or the execution of B2 shall end prior to the assignment. If these
4679 requirements are not met, then the behavior is undefined.
4680 5 Here an execution of B means that portion of the execution of the program that would
4681 correspond to the lifetime of an object with scalar type and automatic storage duration
4683 <sup><a name="note119" href="#note119"><b>119)</b></a></sup> In other words, E depends on the value of P itself rather than on the value of an object referenced
4684 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
4685 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
4686 expressions *p and p[1] are not.
4688 [<a name="p110" href="#p110">page 110</a>] (<a href="#Contents">Contents</a>)
4690 associated with B.
4691 6 A translator is free to ignore any or all aliasing implications of uses of restrict.
4692 7 EXAMPLE 1 The file scope declarations
4693 int * restrict a;
4694 int * restrict b;
4695 extern int c[];
4696 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
4697 program, then it is never accessed using either of the other two.
4699 8 EXAMPLE 2 The function parameter declarations in the following example
4700 void f(int n, int * restrict p, int * restrict q)
4702 while (n-- &gt; 0)
4703 *p++ = *q++;
4705 assert that, during each execution of the function, if an object is accessed through one of the pointer
4706 parameters, then it is not also accessed through the other.
4707 9 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
4708 analysis of function f without examining any of the calls of f in the program. The cost is that the
4709 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
4710 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
4711 both p and q.
4712 void g(void)
4714 extern int d[100];
4715 f(50, d + 50, d); // valid
4716 f(50, d + 1, d); // undefined behavior
4719 10 EXAMPLE 3 The function parameter declarations
4720 void h(int n, int * restrict p, int * restrict q, int * restrict r)
4722 int i;
4723 for (i = 0; i &lt; n; i++)
4724 p[i] = q[i] + r[i];
4726 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
4727 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
4728 modified within function h.
4730 11 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
4731 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
4732 between restricted pointers declared in nested blocks have defined behavior.
4734 [<a name="p111" href="#p111">page 111</a>] (<a href="#Contents">Contents</a>)
4737 int * restrict p1;
4738 int * restrict q1;
4739 p1 = q1; // undefined behavior
4741 int * restrict p2 = p1; // valid
4742 int * restrict q2 = q1; // valid
4743 p1 = q2; // undefined behavior
4744 p2 = q2; // undefined behavior
4747 12 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
4748 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
4749 example, this permits new_vector to return a vector.
4750 typedef struct { int n; float * restrict v; } vector;
4751 vector new_vector(int n)
4753 vector t;
4754 t.n = n;
4755 t.v = malloc(n * sizeof (float));
4756 return t;
4759 <a name="6.7.4" href="#6.7.4"><b> 6.7.4 Function specifiers</b></a>
4760 <b> Syntax</b>
4761 1 function-specifier:
4762 inline
4763 <b> Constraints</b>
4764 2 Function specifiers shall be used only in the declaration of an identifier for a function.
4765 3 An inline definition of a function with external linkage shall not contain a definition of a
4766 modifiable object with static storage duration, and shall not contain a reference to an
4767 identifier with internal linkage.
4768 4 In a hosted environment, the inline function specifier shall not appear in a declaration
4769 of main.
4770 <b> Semantics</b>
4771 5 A function declared with an inline function specifier is an inline function. The
4772 function specifier may appear more than once; the behavior is the same as if it appeared
4773 only once. Making a function an inline function suggests that calls to the function be as
4774 fast as possible.<sup><a href="#note120"><b>120)</b></a></sup> The extent to which such suggestions are effective is
4775 implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
4776 6 Any function with internal linkage can be an inline function. For a function with external
4777 linkage, the following restrictions apply: If a function is declared with an inline
4779 [<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
4781 function specifier, then it shall also be defined in the same translation unit. If all of the
4782 file scope declarations for a function in a translation unit include the inline function
4783 specifier without extern, then the definition in that translation unit is an inline
4784 definition. An inline definition does not provide an external definition for the function,
4785 and does not forbid an external definition in another translation unit. An inline definition
4786 provides an alternative to an external definition, which a translator may use to implement
4787 any call to the function in the same translation unit. It is unspecified whether a call to the
4788 function uses the inline definition or the external definition.<sup><a href="#note122"><b>122)</b></a></sup>
4789 7 EXAMPLE The declaration of an inline function with external linkage can result in either an external
4790 definition, or a definition available for use only within the translation unit. A file scope declaration with
4791 extern creates an external definition. The following example shows an entire translation unit.
4792 inline double fahr(double t)
4794 return (9.0 * t) / 5.0 + 32.0;
4796 inline double cels(double t)
4798 return (5.0 * (t - 32.0)) / 9.0;
4800 extern double fahr(double); // creates an external definition
4801 double convert(int is_fahr, double temp)
4803 /* A translator may perform inline substitutions */
4804 return is_fahr ? cels(temp) : fahr(temp);
4806 8 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
4807 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
4808 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
4809 definition are distinct and either may be used for the call.
4811 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
4814 <sup><a name="note120" href="#note120"><b>120)</b></a></sup> By using, for example, an alternative to the usual function call mechanism, such as ''inline
4815 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
4816 Therefore, for example, the expansion of a macro used within the body of the function uses the
4817 definition it had at the point the function body appears, and not where the function is called; and
4818 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
4819 single address, regardless of the number of inline definitions that occur in addition to the external
4820 definition.
4821 <sup><a name="note121" href="#note121"><b>121)</b></a></sup> For example, an implementation might never perform inline substitution, or might only perform inline
4822 substitutions to calls in the scope of an inline declaration.
4823 <sup><a name="note122" href="#note122"><b>122)</b></a></sup> Since an inline definition is distinct from the corresponding external definition and from any other
4824 corresponding inline definitions in other translation units, all corresponding objects with static storage
4825 duration are also distinct in each of the definitions.
4827 [<a name="p113" href="#p113">page 113</a>] (<a href="#Contents">Contents</a>)
4829 <a name="6.7.5" href="#6.7.5"><b> 6.7.5 Declarators</b></a>
4830 <b> Syntax</b>
4831 1 declarator:
4832 pointeropt direct-declarator
4833 direct-declarator:
4834 identifier
4835 ( declarator )
4836 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
4837 direct-declarator [ static type-qualifier-listopt assignment-expression ]
4838 direct-declarator [ type-qualifier-list static assignment-expression ]
4839 direct-declarator [ type-qualifier-listopt * ]
4840 direct-declarator ( parameter-type-list )
4841 direct-declarator ( identifier-listopt )
4842 pointer:
4843 * type-qualifier-listopt
4844 * type-qualifier-listopt pointer
4845 type-qualifier-list:
4846 type-qualifier
4847 type-qualifier-list type-qualifier
4848 parameter-type-list:
4849 parameter-list
4850 parameter-list , ...
4851 parameter-list:
4852 parameter-declaration
4853 parameter-list , parameter-declaration
4854 parameter-declaration:
4855 declaration-specifiers declarator
4856 declaration-specifiers abstract-declaratoropt
4857 identifier-list:
4858 identifier
4859 identifier-list , identifier
4860 <b> Semantics</b>
4861 2 Each declarator declares one identifier, and asserts that when an operand of the same
4862 form as the declarator appears in an expression, it designates a function or object with the
4863 scope, storage duration, and type indicated by the declaration specifiers.
4864 3 A full declarator is a declarator that is not part of another declarator. The end of a full
4865 declarator is a sequence point. If, in the nested sequence of declarators in a full
4867 [<a name="p114" href="#p114">page 114</a>] (<a href="#Contents">Contents</a>)
4869 declarator, there is a declarator specifying a variable length array type, the type specified
4870 by the full declarator is said to be variably modified. Furthermore, any type derived by
4871 declarator type derivation from a variably modified type is itself variably modified.
4872 4 In the following subclauses, consider a declaration
4873 T D1
4874 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
4875 a declarator that contains an identifier ident. The type specified for the identifier ident in
4876 the various forms of declarator is described inductively using this notation.
4877 5 If, in the declaration ''T D1'', D1 has the form
4878 identifier
4879 then the type specified for ident is T .
4880 6 If, in the declaration ''T D1'', D1 has the form
4881 ( D )
4882 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
4883 parentheses is identical to the unparenthesized declarator, but the binding of complicated
4884 declarators may be altered by parentheses.
4885 Implementation limits
4886 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
4887 function declarators that modify an arithmetic, structure, union, or incomplete type, either
4888 directly or via one or more typedefs.
4889 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>).
4890 <a name="6.7.5.1" href="#6.7.5.1"><b> 6.7.5.1 Pointer declarators</b></a>
4891 <b> Semantics</b>
4892 1 If, in the declaration ''T D1'', D1 has the form
4893 * type-qualifier-listopt D
4894 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
4895 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
4896 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
4897 2 For two pointer types to be compatible, both shall be identically qualified and both shall
4898 be pointers to compatible types.
4899 3 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
4900 to a constant value'' and a ''constant pointer to a variable value''.
4902 [<a name="p115" href="#p115">page 115</a>] (<a href="#Contents">Contents</a>)
4904 const int *ptr_to_constant;
4905 int *const constant_ptr;
4906 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
4907 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
4908 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
4909 same location.
4910 4 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
4911 type ''pointer to int''.
4912 typedef int *int_ptr;
4913 const int_ptr constant_ptr;
4914 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
4916 <a name="6.7.5.2" href="#6.7.5.2"><b> 6.7.5.2 Array declarators</b></a>
4917 <b> Constraints</b>
4918 1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
4919 an expression or *. If they delimit an expression (which specifies the size of an array), the
4920 expression shall have an integer type. If the expression is a constant expression, it shall
4921 have a value greater than zero. The element type shall not be an incomplete or function
4922 type. The optional type qualifiers and the keyword static shall appear only in a
4923 declaration of a function parameter with an array type, and then only in the outermost
4924 array type derivation.
4925 2 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
4926 either block scope and no linkage or function prototype scope. If an identifier is declared
4927 to be an object with static storage duration, it shall not have a variable length array type.
4928 <b> Semantics</b>
4929 3 If, in the declaration ''T D1'', D1 has one of the forms:
4930 D[ type-qualifier-listopt assignment-expressionopt ]
4931 D[ static type-qualifier-listopt assignment-expression ]
4932 D[ type-qualifier-list static assignment-expression ]
4933 D[ type-qualifier-listopt * ]
4934 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
4935 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note123"><b>123)</b></a></sup>
4936 (See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
4937 4 If the size is not present, the array type is an incomplete type. If the size is * instead of
4938 being an expression, the array type is a variable length array type of unspecified size,
4939 which can only be used in declarations with function prototype scope;<sup><a href="#note124"><b>124)</b></a></sup> such arrays are
4940 nonetheless complete types. If the size is an integer constant expression and the element
4942 <sup><a name="note123" href="#note123"><b>123)</b></a></sup> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
4944 [<a name="p116" href="#p116">page 116</a>] (<a href="#Contents">Contents</a>)
4946 type has a known constant size, the array type is not a variable length array type;
4947 otherwise, the array type is a variable length array type.
4948 5 If the size is an expression that is not an integer constant expression: if it occurs in a
4949 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
4950 each time it is evaluated it shall have a value greater than zero. The size of each instance
4951 of a variable length array type does not change during its lifetime. Where a size
4952 expression is part of the operand of a sizeof operator and changing the value of the
4953 size expression would not affect the result of the operator, it is unspecified whether or not
4954 the size expression is evaluated.
4955 6 For two array types to be compatible, both shall have compatible element types, and if
4956 both size specifiers are present, and are integer constant expressions, then both size
4957 specifiers shall have the same constant value. If the two array types are used in a context
4958 which requires them to be compatible, it is undefined behavior if the two size specifiers
4959 evaluate to unequal values.
4960 7 EXAMPLE 1
4961 float fa[11], *afp[17];
4962 declares an array of float numbers and an array of pointers to float numbers.
4964 8 EXAMPLE 2 Note the distinction between the declarations
4965 extern int *x;
4966 extern int y[];
4967 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
4968 (an incomplete type), the storage for which is defined elsewhere.
4970 9 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
4971 extern int n;
4972 extern int m;
4973 void fcompat(void)
4975 int a[n][6][m];
4976 int (*p)[4][n+1];
4977 int c[n][n][6][m];
4978 int (*r)[n][n][n+1];
4979 p = a; // invalid: not compatible because 4 != 6
4980 r = c; // compatible, but defined behavior only if
4981 // n == 6 and m == n+1
4987 <sup><a name="note124" href="#note124"><b>124)</b></a></sup> Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.5.3">6.7.5.3</a>).
4989 [<a name="p117" href="#p117">page 117</a>] (<a href="#Contents">Contents</a>)
4991 10 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
4992 function prototype scope. Array objects declared with the static or extern storage-class specifier
4993 cannot have a variable length array (VLA) type. However, an object declared with the static storage-
4994 class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all identifiers declared with a
4995 VM type have to be ordinary identifiers and cannot, therefore, be members of structures or unions.
4996 extern int n;
4997 int A[n]; // invalid: file scope VLA
4998 extern int (*p2)[n]; // invalid: file scope VM
4999 int B[100]; // valid: file scope but not VM
5000 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
5001 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
5003 typedef int VLA[m][m]; // valid: block scope typedef VLA
5004 struct tag {
5005 int (*y)[n]; // invalid: y not ordinary identifier
5006 int z[n]; // invalid: z not ordinary identifier
5008 int D[m]; // valid: auto VLA
5009 static int E[m]; // invalid: static block scope VLA
5010 extern int F[m]; // invalid: F has linkage and is VLA
5011 int (*s)[m]; // valid: auto pointer to VLA
5012 extern int (*r)[m]; // invalid: r has linkage and points to VLA
5013 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
5016 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>),
5017 initialization (<a href="#6.7.8">6.7.8</a>).
5018 <a name="6.7.5.3" href="#6.7.5.3"><b> 6.7.5.3 Function declarators (including prototypes)</b></a>
5019 <b> Constraints</b>
5020 1 A function declarator shall not specify a return type that is a function type or an array
5021 type.
5022 2 The only storage-class specifier that shall occur in a parameter declaration is register.
5023 3 An identifier list in a function declarator that is not part of a definition of that function
5024 shall be empty.
5025 4 After adjustment, the parameters in a parameter type list in a function declarator that is
5026 part of a definition of that function shall not have incomplete type.
5027 <b> Semantics</b>
5028 5 If, in the declaration ''T D1'', D1 has the form
5029 D( parameter-type-list )
5031 D( identifier-listopt )
5033 [<a name="p118" href="#p118">page 118</a>] (<a href="#Contents">Contents</a>)
5035 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5036 T '', then the type specified for ident is ''derived-declarator-type-list function returning
5037 T ''.
5038 6 A parameter type list specifies the types of, and may declare identifiers for, the
5039 parameters of the function.
5040 7 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
5041 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
5042 array type derivation. If the keyword static also appears within the [ and ] of the
5043 array type derivation, then for each call to the function, the value of the corresponding
5044 actual argument shall provide access to the first element of an array with at least as many
5045 elements as specified by the size expression.
5046 8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
5047 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
5048 9 If the list terminates with an ellipsis (, ...), no information about the number or types
5049 of the parameters after the comma is supplied.<sup><a href="#note125"><b>125)</b></a></sup>
5050 10 The special case of an unnamed parameter of type void as the only item in the list
5051 specifies that the function has no parameters.
5052 11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
5053 parameter name, it shall be taken as a typedef name.
5054 12 If the function declarator is not part of a definition of that function, parameters may have
5055 incomplete type and may use the [*] notation in their sequences of declarator specifiers
5056 to specify variable length array types.
5057 13 The storage-class specifier in the declaration specifiers for a parameter declaration, if
5058 present, is ignored unless the declared parameter is one of the members of the parameter
5059 type list for a function definition.
5060 14 An identifier list declares only the identifiers of the parameters of the function. An empty
5061 list in a function declarator that is part of a definition of that function specifies that the
5062 function has no parameters. The empty list in a function declarator that is not part of a
5063 definition of that function specifies that no information about the number or types of the
5064 parameters is supplied.<sup><a href="#note126"><b>126)</b></a></sup>
5065 15 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note127"><b>127)</b></a></sup>
5068 <sup><a name="note125" href="#note125"><b>125)</b></a></sup> 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
5069 correspond to the ellipsis.
5070 <sup><a name="note126" href="#note126"><b>126)</b></a></sup> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
5071 <sup><a name="note127" href="#note127"><b>127)</b></a></sup> If both function types are ''old style'', parameter types are not compared.
5073 [<a name="p119" href="#p119">page 119</a>] (<a href="#Contents">Contents</a>)
5075 Moreover, the parameter type lists, if both are present, shall agree in the number of
5076 parameters and in use of the ellipsis terminator; corresponding parameters shall have
5077 compatible types. If one type has a parameter type list and the other type is specified by a
5078 function declarator that is not part of a function definition and that contains an empty
5079 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
5080 parameter shall be compatible with the type that results from the application of the
5081 default argument promotions. If one type has a parameter type list and the other type is
5082 specified by a function definition that contains a (possibly empty) identifier list, both shall
5083 agree in the number of parameters, and the type of each prototype parameter shall be
5084 compatible with the type that results from the application of the default argument
5085 promotions to the type of the corresponding identifier. (In the determination of type
5086 compatibility and of a composite type, each parameter declared with function or array
5087 type is taken as having the adjusted type and each parameter declared with qualified type
5088 is taken as having the unqualified version of its declared type.)
5089 16 EXAMPLE 1 The declaration
5090 int f(void), *fip(), (*pfi)();
5091 declares a function f with no parameters returning an int, a function fip with no parameter specification
5092 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
5093 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
5094 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
5095 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
5096 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
5097 designator, which is then used to call the function; it returns an int.
5098 17 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
5099 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
5100 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
5101 the identifier of the pointer pfi has block scope and no linkage.
5103 18 EXAMPLE 2 The declaration
5104 int (*apfi[3])(int *x, int *y);
5105 declares an array apfi of three pointers to functions returning int. Each of these functions has two
5106 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
5107 go out of scope at the end of the declaration of apfi.
5109 19 EXAMPLE 3 The declaration
5110 int (*fpfi(int (*)(long), int))(int, ...);
5111 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
5112 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
5113 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
5114 additional arguments of any type.
5116 [<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
5118 20 EXAMPLE 4 The following prototype has a variably modified parameter.
5119 void addscalar(int n, int m,
5120 double a[n][n*m+300], double x);
5121 int main()
5123 double b[4][308];
5124 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
5125 return 0;
5127 void addscalar(int n, int m,
5128 double a[n][n*m+300], double x)
5130 for (int i = 0; i &lt; n; i++)
5131 for (int j = 0, k = n*m+300; j &lt; k; j++)
5132 // a is a pointer to a VLA with n*m+300 elements
5133 a[i][j] += x;
5136 21 EXAMPLE 5 The following are all compatible function prototype declarators.
5137 double maximum(int n, int m, double a[n][m]);
5138 double maximum(int n, int m, double a[*][*]);
5139 double maximum(int n, int m, double a[ ][*]);
5140 double maximum(int n, int m, double a[ ][m]);
5141 as are:
5142 void f(double (* restrict a)[5]);
5143 void f(double a[restrict][5]);
5144 void f(double a[restrict 3][5]);
5145 void f(double a[restrict static 3][5]);
5146 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
5147 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
5149 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.6">6.7.6</a>).
5151 [<a name="p121" href="#p121">page 121</a>] (<a href="#Contents">Contents</a>)
5153 <a name="6.7.6" href="#6.7.6"><b> 6.7.6 Type names</b></a>
5154 <b> Syntax</b>
5155 1 type-name:
5156 specifier-qualifier-list abstract-declaratoropt
5157 abstract-declarator:
5158 pointer
5159 pointeropt direct-abstract-declarator
5160 direct-abstract-declarator:
5161 ( abstract-declarator )
5162 direct-abstract-declaratoropt [ type-qualifier-listopt
5163 assignment-expressionopt ]
5164 direct-abstract-declaratoropt [ static type-qualifier-listopt
5165 assignment-expression ]
5166 direct-abstract-declaratoropt [ type-qualifier-list static
5167 assignment-expression ]
5168 direct-abstract-declaratoropt [ * ]
5169 direct-abstract-declaratoropt ( parameter-type-listopt )
5170 <b> Semantics</b>
5171 2 In several contexts, it is necessary to specify a type. This is accomplished using a type
5172 name, which is syntactically a declaration for a function or an object of that type that
5173 omits the identifier.<sup><a href="#note128"><b>128)</b></a></sup>
5174 3 EXAMPLE The constructions
5175 (a) int
5176 (b) int *
5177 (c) int *[3]
5178 (d) int (*)[3]
5179 (e) int (*)[*]
5180 (f) int *()
5181 (g) int (*)(void)
5182 (h) int (*const [])(unsigned int, ...)
5183 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
5184 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
5185 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
5186 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
5187 parameter that has type unsigned int and an unspecified number of other parameters, returning an
5188 int.
5193 <sup><a name="note128" href="#note128"><b>128)</b></a></sup> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
5194 parameter specification'', rather than redundant parentheses around the omitted identifier.
5196 [<a name="p122" href="#p122">page 122</a>] (<a href="#Contents">Contents</a>)
5198 <a name="6.7.7" href="#6.7.7"><b> 6.7.7 Type definitions</b></a>
5199 <b> Syntax</b>
5200 1 typedef-name:
5201 identifier
5202 <b> Constraints</b>
5203 2 If a typedef name specifies a variably modified type then it shall have block scope.
5204 <b> Semantics</b>
5205 3 In a declaration whose storage-class specifier is typedef, each declarator defines an
5206 identifier to be a typedef name that denotes the type specified for the identifier in the way
5207 described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
5208 declarators are evaluated each time the declaration of the typedef name is reached in the
5209 order of execution. A typedef declaration does not introduce a new type, only a
5210 synonym for the type so specified. That is, in the following declarations:
5211 typedef T type_ident;
5212 type_ident D;
5213 type_ident is defined as a typedef name with the type specified by the declaration
5214 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
5215 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
5216 typedef name shares the same name space as other identifiers declared in ordinary
5217 declarators.
5218 4 EXAMPLE 1 After
5219 typedef int MILES, KLICKSP();
5220 typedef struct { double hi, lo; } range;
5221 the constructions
5222 MILES distance;
5223 extern KLICKSP *metricp;
5224 range x;
5225 range z, *zp;
5226 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
5227 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
5228 such a structure. The object distance has a type compatible with any other int object.
5230 5 EXAMPLE 2 After the declarations
5231 typedef struct s1 { int x; } t1, *tp1;
5232 typedef struct s2 { int x; } t2, *tp2;
5233 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
5234 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
5236 [<a name="p123" href="#p123">page 123</a>] (<a href="#Contents">Contents</a>)
5238 6 EXAMPLE 3 The following obscure constructions
5239 typedef signed int t;
5240 typedef int plain;
5241 struct tag {
5242 unsigned t:4;
5243 const t:5;
5244 plain r:5;
5246 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
5247 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
5248 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
5249 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
5250 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
5251 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
5252 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
5253 in an inner scope by
5254 t f(t (t));
5255 long t;
5256 then a function f is declared with type ''function returning signed int with one unnamed parameter
5257 with type pointer to function returning signed int with one unnamed parameter with type signed
5258 int'', and an identifier t with type long int.
5260 7 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
5261 following declarations of the signal function specify exactly the same type, the first without making use
5262 of any typedef names.
5263 typedef void fv(int), (*pfv)(int);
5264 void (*signal(int, void (*)(int)))(int);
5265 fv *signal(int, fv *);
5266 pfv signal(int, pfv);
5268 8 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
5269 time the typedef name is defined, not each time it is used:
5270 void copyt(int n)
5272 typedef int B[n]; // B is n ints, n evaluated now
5273 n += 1;
5274 B a; // a is n ints, n without += 1
5275 int b[n]; // a and b are different sizes
5276 for (int i = 1; i &lt; n; i++)
5277 a[i-1] = b[i];
5280 [<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
5282 <a name="6.7.8" href="#6.7.8"><b> 6.7.8 Initialization</b></a>
5283 <b> Syntax</b>
5284 1 initializer:
5285 assignment-expression
5286 { initializer-list }
5287 { initializer-list , }
5288 initializer-list:
5289 designationopt initializer
5290 initializer-list , designationopt initializer
5291 designation:
5292 designator-list =
5293 designator-list:
5294 designator
5295 designator-list designator
5296 designator:
5297 [ constant-expression ]
5298 . identifier
5299 <b> Constraints</b>
5300 2 No initializer shall attempt to provide a value for an object not contained within the entity
5301 being initialized.
5302 3 The type of the entity to be initialized shall be an array of unknown size or an object type
5303 that is not a variable length array type.
5304 4 All the expressions in an initializer for an object that has static storage duration shall be
5305 constant expressions or string literals.
5306 5 If the declaration of an identifier has block scope, and the identifier has external or
5307 internal linkage, the declaration shall have no initializer for the identifier.
5308 6 If a designator has the form
5309 [ constant-expression ]
5310 then the current object (defined below) shall have array type and the expression shall be
5311 an integer constant expression. If the array is of unknown size, any nonnegative value is
5312 valid.
5313 7 If a designator has the form
5314 . identifier
5315 then the current object (defined below) shall have structure or union type and the
5316 identifier shall be the name of a member of that type.
5318 [<a name="p125" href="#p125">page 125</a>] (<a href="#Contents">Contents</a>)
5320 <b> Semantics</b>
5321 8 An initializer specifies the initial value stored in an object.
5322 9 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
5323 members of objects of structure and union type do not participate in initialization.
5324 Unnamed members of structure objects have indeterminate value even after initialization.
5325 10 If an object that has automatic storage duration is not initialized explicitly, its value is
5326 indeterminate. If an object that has static storage duration is not initialized explicitly,
5327 then:
5328 -- if it has pointer type, it is initialized to a null pointer;
5329 -- if it has arithmetic type, it is initialized to (positive or unsigned) zero;
5330 -- if it is an aggregate, every member is initialized (recursively) according to these rules;
5331 -- if it is a union, the first named member is initialized (recursively) according to these
5332 rules.
5333 11 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
5334 initial value of the object is that of the expression (after conversion); the same type
5335 constraints and conversions as for simple assignment apply, taking the type of the scalar
5336 to be the unqualified version of its declared type.
5337 12 The rest of this subclause deals with initializers for objects that have aggregate or union
5338 type.
5339 13 The initializer for a structure or union object that has automatic storage duration shall be
5340 either an initializer list as described below, or a single expression that has compatible
5341 structure or union type. In the latter case, the initial value of the object, including
5342 unnamed members, is that of the expression.
5343 14 An array of character type may be initialized by a character string literal, optionally
5344 enclosed in braces. Successive characters of the character string literal (including the
5345 terminating null character if there is room or if the array is of unknown size) initialize the
5346 elements of the array.
5347 15 An array with element type compatible with wchar_t may be initialized by a wide
5348 string literal, optionally enclosed in braces. Successive wide characters of the wide string
5349 literal (including the terminating null wide character if there is room or if the array is of
5350 unknown size) initialize the elements of the array.
5351 16 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
5352 enclosed list of initializers for the elements or named members.
5353 17 Each brace-enclosed initializer list has an associated current object. When no
5354 designations are present, subobjects of the current object are initialized in order according
5355 to the type of the current object: array elements in increasing subscript order, structure
5357 [<a name="p126" href="#p126">page 126</a>] (<a href="#Contents">Contents</a>)
5359 members in declaration order, and the first named member of a union.<sup><a href="#note129"><b>129)</b></a></sup> In contrast, a
5360 designation causes the following initializer to begin initialization of the subobject
5361 described by the designator. Initialization then continues forward in order, beginning
5362 with the next subobject after that described by the designator.<sup><a href="#note130"><b>130)</b></a></sup>
5363 18 Each designator list begins its description with the current object associated with the
5364 closest surrounding brace pair. Each item in the designator list (in order) specifies a
5365 particular member of its current object and changes the current object for the next
5366 designator (if any) to be that member.<sup><a href="#note131"><b>131)</b></a></sup> The current object that results at the end of the
5367 designator list is the subobject to be initialized by the following initializer.
5368 19 The initialization shall occur in initializer list order, each initializer provided for a
5369 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note132"><b>132)</b></a></sup>
5370 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
5371 objects that have static storage duration.
5372 20 If the aggregate or union contains elements or members that are aggregates or unions,
5373 these rules apply recursively to the subaggregates or contained unions. If the initializer of
5374 a subaggregate or contained union begins with a left brace, the initializers enclosed by
5375 that brace and its matching right brace initialize the elements or members of the
5376 subaggregate or the contained union. Otherwise, only enough initializers from the list are
5377 taken to account for the elements or members of the subaggregate or the first member of
5378 the contained union; any remaining initializers are left to initialize the next element or
5379 member of the aggregate of which the current subaggregate or contained union is a part.
5380 21 If there are fewer initializers in a brace-enclosed list than there are elements or members
5381 of an aggregate, or fewer characters in a string literal used to initialize an array of known
5382 size than there are elements in the array, the remainder of the aggregate shall be
5383 initialized implicitly the same as objects that have static storage duration.
5384 22 If an array of unknown size is initialized, its size is determined by the largest indexed
5385 element with an explicit initializer. At the end of its initializer list, the array no longer
5386 has incomplete type.
5390 <sup><a name="note129" href="#note129"><b>129)</b></a></sup> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
5391 subobjects are initialized as usual, but the subaggregate or contained union does not become the
5392 current object: current objects are associated only with brace-enclosed initializer lists.
5393 <sup><a name="note130" href="#note130"><b>130)</b></a></sup> After a union member is initialized, the next object is not the next member of the union; instead, it is
5394 the next subobject of an object containing the union.
5395 <sup><a name="note131" href="#note131"><b>131)</b></a></sup> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
5396 the surrounding brace pair. Note, too, that each separate designator list is independent.
5397 <sup><a name="note132" href="#note132"><b>132)</b></a></sup> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
5398 not be evaluated at all.
5400 [<a name="p127" href="#p127">page 127</a>] (<a href="#Contents">Contents</a>)
5402 23 The order in which any side effects occur among the initialization list expressions is
5403 unspecified.<sup><a href="#note133"><b>133)</b></a></sup>
5404 24 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
5405 int i = <a href="#3.5">3.5</a>;
5406 double complex c = 5 + 3 * I;
5407 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
5409 25 EXAMPLE 2 The declaration
5410 int x[] = { 1, 3, 5 };
5411 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
5412 and there are three initializers.
5414 26 EXAMPLE 3 The declaration
5415 int y[4][3] = {
5416 { 1, 3, 5 },
5417 { 2, 4, 6 },
5418 { 3, 5, 7 },
5420 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
5421 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
5422 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
5423 been achieved by
5424 int y[4][3] = {
5425 1, 3, 5, 2, 4, 6, 3, 5, 7
5427 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
5428 next three are taken successively for y[1] and y[2].
5430 27 EXAMPLE 4 The declaration
5431 int z[4][3] = {
5432 { 1 }, { 2 }, { 3 }, { 4 }
5434 initializes the first column of z as specified and initializes the rest with zeros.
5436 28 EXAMPLE 5 The declaration
5437 struct { int a[3], b; } w[] = { { 1 }, 2 };
5438 is a definition with an inconsistently bracketed initialization. It defines an array with two element
5439 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
5444 <sup><a name="note133" href="#note133"><b>133)</b></a></sup> In particular, the evaluation order need not be the same as the order of subobject initialization.
5446 [<a name="p128" href="#p128">page 128</a>] (<a href="#Contents">Contents</a>)
5448 29 EXAMPLE 6 The declaration
5449 short q[4][3][2] = {
5450 { 1 },
5451 { 2, 3 },
5452 { 4, 5, 6 }
5454 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
5455 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
5456 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
5457 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
5458 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
5459 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
5460 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
5461 diagnostic message would have been issued. The same initialization result could have been achieved by:
5462 short q[4][3][2] = {
5463 1, 0, 0, 0, 0, 0,
5464 2, 3, 0, 0, 0, 0,
5465 4, 5, 6
5467 or by:
5468 short q[4][3][2] = {
5470 { 1 },
5473 { 2, 3 },
5476 { 4, 5 },
5477 { 6 },
5480 in a fully bracketed form.
5481 30 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
5482 cause confusion.
5484 31 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
5485 declaration
5486 typedef int A[]; // OK - declared with block scope
5487 the declaration
5488 A a = { 1, 2 }, b = { 3, 4, 5 };
5489 is identical to
5490 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
5491 due to the rules for incomplete types.
5493 [<a name="p129" href="#p129">page 129</a>] (<a href="#Contents">Contents</a>)
5495 32 EXAMPLE 8 The declaration
5496 char s[] = "abc", t[3] = "abc";
5497 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
5498 This declaration is identical to
5499 char s[] = { 'a', 'b', 'c', '\0' },
5500 t[] = { 'a', 'b', 'c' };
5501 The contents of the arrays are modifiable. On the other hand, the declaration
5502 char *p = "abc";
5503 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
5504 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
5505 modify the contents of the array, the behavior is undefined.
5507 33 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
5508 designators:
5509 enum { member_one, member_two };
5510 const char *nm[] = {
5511 [member_two] = "member two",
5512 [member_one] = "member one",
5515 34 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
5516 div_t answer = { .quot = 2, .rem = -1 };
5518 35 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
5519 might be misunderstood:
5520 struct { int a[3], b; } w[] =
5521 { [0].a = {1}, [1].a[0] = 2 };
5523 36 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
5524 int a[MAX] = {
5525 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
5527 37 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
5528 than ten, some of the values provided by the first five initializers will be overridden by the second five.
5530 38 EXAMPLE 13 Any member of a union can be initialized:
5531 union { /* ... */ } u = { .any_member = 42 };
5533 Forward references: common definitions <a href="#7.17">&lt;stddef.h&gt;</a> (<a href="#7.17">7.17</a>).
5535 [<a name="p130" href="#p130">page 130</a>] (<a href="#Contents">Contents</a>)
5537 <a name="6.8" href="#6.8"><b> 6.8 Statements and blocks</b></a>
5538 <b> Syntax</b>
5539 1 statement:
5540 labeled-statement
5541 compound-statement
5542 expression-statement
5543 selection-statement
5544 iteration-statement
5545 jump-statement
5546 <b> Semantics</b>
5547 2 A statement specifies an action to be performed. Except as indicated, statements are
5548 executed in sequence.
5549 3 A block allows a set of declarations and statements to be grouped into one syntactic unit.
5550 The initializers of objects that have automatic storage duration, and the variable length
5551 array declarators of ordinary identifiers with block scope, are evaluated and the values are
5552 stored in the objects (including storing an indeterminate value in objects without an
5553 initializer) each time the declaration is reached in the order of execution, as if it were a
5554 statement, and within each declaration in the order that declarators appear.
5555 4 A full expression is an expression that is not part of another expression or of a declarator.
5556 Each of the following is a full expression: an initializer; the expression in an expression
5557 statement; the controlling expression of a selection statement (if or switch); the
5558 controlling expression of a while or do statement; each of the (optional) expressions of
5559 a for statement; the (optional) expression in a return statement. The end of a full
5560 expression is a sequence point.
5561 Forward references: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
5562 (<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>).
5563 <a name="6.8.1" href="#6.8.1"><b> 6.8.1 Labeled statements</b></a>
5564 <b> Syntax</b>
5565 1 labeled-statement:
5566 identifier : statement
5567 case constant-expression : statement
5568 default : statement
5569 <b> Constraints</b>
5570 2 A case or default label shall appear only in a switch statement. Further
5571 constraints on such labels are discussed under the switch statement.
5573 [<a name="p131" href="#p131">page 131</a>] (<a href="#Contents">Contents</a>)
5575 3 Label names shall be unique within a function.
5576 <b> Semantics</b>
5577 4 Any statement may be preceded by a prefix that declares an identifier as a label name.
5578 Labels in themselves do not alter the flow of control, which continues unimpeded across
5579 them.
5580 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>).
5581 <a name="6.8.2" href="#6.8.2"><b> 6.8.2 Compound statement</b></a>
5582 <b> Syntax</b>
5583 1 compound-statement:
5584 { block-item-listopt }
5585 block-item-list:
5586 block-item
5587 block-item-list block-item
5588 block-item:
5589 declaration
5590 statement
5591 <b> Semantics</b>
5592 2 A compound statement is a block.
5593 <a name="6.8.3" href="#6.8.3"><b> 6.8.3 Expression and null statements</b></a>
5594 <b> Syntax</b>
5595 1 expression-statement:
5596 expressionopt ;
5597 <b> Semantics</b>
5598 2 The expression in an expression statement is evaluated as a void expression for its side
5599 effects.<sup><a href="#note134"><b>134)</b></a></sup>
5600 3 A null statement (consisting of just a semicolon) performs no operations.
5601 4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
5602 discarding of its value may be made explicit by converting the expression to a void expression by means of
5603 a cast:
5604 int p(int);
5605 /* ... */
5606 (void)p(0);
5610 <sup><a name="note134" href="#note134"><b>134)</b></a></sup> Such as assignments, and function calls which have side effects.
5612 [<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
5614 5 EXAMPLE 2 In the program fragment
5615 char *s;
5616 /* ... */
5617 while (*s++ != '\0')
5619 a null statement is used to supply an empty loop body to the iteration statement.
5621 6 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
5622 statement.
5623 while (loop1) {
5624 /* ... */
5625 while (loop2) {
5626 /* ... */
5627 if (want_out)
5628 goto end_loop1;
5629 /* ... */
5631 /* ... */
5632 end_loop1: ;
5635 Forward references: iteration statements (<a href="#6.8.5">6.8.5</a>).
5636 <a name="6.8.4" href="#6.8.4"><b> 6.8.4 Selection statements</b></a>
5637 <b> Syntax</b>
5638 1 selection-statement:
5639 if ( expression ) statement
5640 if ( expression ) statement else statement
5641 switch ( expression ) statement
5642 <b> Semantics</b>
5643 2 A selection statement selects among a set of statements depending on the value of a
5644 controlling expression.
5645 3 A selection statement is a block whose scope is a strict subset of the scope of its
5646 enclosing block. Each associated substatement is also a block whose scope is a strict
5647 subset of the scope of the selection statement.
5648 <a name="6.8.4.1" href="#6.8.4.1"><b> 6.8.4.1 The if statement</b></a>
5649 <b> Constraints</b>
5650 1 The controlling expression of an if statement shall have scalar type.
5651 <b> Semantics</b>
5652 2 In both forms, the first substatement is executed if the expression compares unequal to 0.
5653 In the else form, the second substatement is executed if the expression compares equal
5655 [<a name="p133" href="#p133">page 133</a>] (<a href="#Contents">Contents</a>)
5657 to 0. If the first substatement is reached via a label, the second substatement is not
5658 executed.
5659 3 An else is associated with the lexically nearest preceding if that is allowed by the
5660 syntax.
5661 <a name="6.8.4.2" href="#6.8.4.2"><b> 6.8.4.2 The switch statement</b></a>
5662 <b> Constraints</b>
5663 1 The controlling expression of a switch statement shall have integer type.
5664 2 If a switch statement has an associated case or default label within the scope of an
5665 identifier with a variably modified type, the entire switch statement shall be within the
5666 scope of that identifier.<sup><a href="#note135"><b>135)</b></a></sup>
5667 3 The expression of each case label shall be an integer constant expression and no two of
5668 the case constant expressions in the same switch statement shall have the same value
5669 after conversion. There may be at most one default label in a switch statement.
5670 (Any enclosed switch statement may have a default label or case constant
5671 expressions with values that duplicate case constant expressions in the enclosing
5672 switch statement.)
5673 <b> Semantics</b>
5674 4 A switch statement causes control to jump to, into, or past the statement that is the
5675 switch body, depending on the value of a controlling expression, and on the presence of a
5676 default label and the values of any case labels on or in the switch body. A case or
5677 default label is accessible only within the closest enclosing switch statement.
5678 5 The integer promotions are performed on the controlling expression. The constant
5679 expression in each case label is converted to the promoted type of the controlling
5680 expression. If a converted value matches that of the promoted controlling expression,
5681 control jumps to the statement following the matched case label. Otherwise, if there is
5682 a default label, control jumps to the labeled statement. If no converted case constant
5683 expression matches and there is no default label, no part of the switch body is
5684 executed.
5685 Implementation limits
5686 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
5687 switch statement.
5692 <sup><a name="note135" href="#note135"><b>135)</b></a></sup> That is, the declaration either precedes the switch statement, or it follows the last case or
5693 default label associated with the switch that is in the block containing the declaration.
5695 [<a name="p134" href="#p134">page 134</a>] (<a href="#Contents">Contents</a>)
5697 7 EXAMPLE In the artificial program fragment
5698 switch (expr)
5700 int i = 4;
5701 f(i);
5702 case 0:
5703 i = 17;
5704 /* falls through into default code */
5705 default:
5706 printf("%d\n", i);
5708 the object whose identifier is i exists with automatic storage duration (within the block) but is never
5709 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
5710 access an indeterminate value. Similarly, the call to the function f cannot be reached.
5712 <a name="6.8.5" href="#6.8.5"><b> 6.8.5 Iteration statements</b></a>
5713 <b> Syntax</b>
5714 1 iteration-statement:
5715 while ( expression ) statement
5716 do statement while ( expression ) ;
5717 for ( expressionopt ; expressionopt ; expressionopt ) statement
5718 for ( declaration expressionopt ; expressionopt ) statement
5719 <b> Constraints</b>
5720 2 The controlling expression of an iteration statement shall have scalar type.
5721 3 The declaration part of a for statement shall only declare identifiers for objects having
5722 storage class auto or register.
5723 <b> Semantics</b>
5724 4 An iteration statement causes a statement called the loop body to be executed repeatedly
5725 until the controlling expression compares equal to 0. The repetition occurs regardless of
5726 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note136"><b>136)</b></a></sup>
5727 5 An iteration statement is a block whose scope is a strict subset of the scope of its
5728 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
5729 of the iteration statement.
5734 <sup><a name="note136" href="#note136"><b>136)</b></a></sup> Code jumped over is not executed. In particular, the controlling expression of a for or while
5735 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
5737 [<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
5739 <a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
5740 1 The evaluation of the controlling expression takes place before each execution of the loop
5741 body.
5742 <a name="6.8.5.2" href="#6.8.5.2"><b> 6.8.5.2 The do statement</b></a>
5743 1 The evaluation of the controlling expression takes place after each execution of the loop
5744 body.
5745 <a name="6.8.5.3" href="#6.8.5.3"><b> 6.8.5.3 The for statement</b></a>
5746 1 The statement
5747 for ( clause-1 ; expression-2 ; expression-3 ) statement
5748 behaves as follows: The expression expression-2 is the controlling expression that is
5749 evaluated before each execution of the loop body. The expression expression-3 is
5750 evaluated as a void expression after each execution of the loop body. If clause-1 is a
5751 declaration, the scope of any identifiers it declares is the remainder of the declaration and
5752 the entire loop, including the other two expressions; it is reached in the order of execution
5753 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
5754 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note137"><b>137)</b></a></sup>
5755 2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
5756 nonzero constant.
5757 <a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
5758 <b> Syntax</b>
5759 1 jump-statement:
5760 goto identifier ;
5761 continue ;
5762 break ;
5763 return expressionopt ;
5764 <b> Semantics</b>
5765 2 A jump statement causes an unconditional jump to another place.
5770 <sup><a name="note137" href="#note137"><b>137)</b></a></sup> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
5771 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
5772 such that execution of the loop continues until the expression compares equal to 0; and expression-3
5773 specifies an operation (such as incrementing) that is performed after each iteration.
5775 [<a name="p136" href="#p136">page 136</a>] (<a href="#Contents">Contents</a>)
5777 <a name="6.8.6.1" href="#6.8.6.1"><b> 6.8.6.1 The goto statement</b></a>
5778 <b> Constraints</b>
5779 1 The identifier in a goto statement shall name a label located somewhere in the enclosing
5780 function. A goto statement shall not jump from outside the scope of an identifier having
5781 a variably modified type to inside the scope of that identifier.
5782 <b> Semantics</b>
5783 2 A goto statement causes an unconditional jump to the statement prefixed by the named
5784 label in the enclosing function.
5785 3 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
5786 following outline presents one possible approach to a problem based on these three assumptions:
5787 1. The general initialization code accesses objects only visible to the current function.
5788 2. The general initialization code is too large to warrant duplication.
5789 3. The code to determine the next operation is at the head of the loop. (To allow it to be reached by
5790 continue statements, for example.)
5791 /* ... */
5792 goto first_time;
5793 for (;;) {
5794 // determine next operation
5795 /* ... */
5796 if (need to reinitialize) {
5797 // reinitialize-only code
5798 /* ... */
5799 first_time:
5800 // general initialization code
5801 /* ... */
5802 continue;
5804 // handle other operations
5805 /* ... */
5808 [<a name="p137" href="#p137">page 137</a>] (<a href="#Contents">Contents</a>)
5810 4 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
5811 modified types. A jump within the scope, however, is permitted.
5812 goto lab3; // invalid: going INTO scope of VLA.
5814 double a[n];
5815 a[j] = <a href="#4.4">4.4</a>;
5816 lab3:
5817 a[j] = <a href="#3.3">3.3</a>;
5818 goto lab4; // valid: going WITHIN scope of VLA.
5819 a[j] = <a href="#5.5">5.5</a>;
5820 lab4:
5821 a[j] = <a href="#6.6">6.6</a>;
5823 goto lab4; // invalid: going INTO scope of VLA.
5825 <a name="6.8.6.2" href="#6.8.6.2"><b> 6.8.6.2 The continue statement</b></a>
5826 <b> Constraints</b>
5827 1 A continue statement shall appear only in or as a loop body.
5828 <b> Semantics</b>
5829 2 A continue statement causes a jump to the loop-continuation portion of the smallest
5830 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
5831 of the statements
5832 while (/* ... */) { do { for (/* ... */) {
5833 /* ... */ /* ... */ /* ... */
5834 continue; continue; continue;
5835 /* ... */ /* ... */ /* ... */
5836 contin: ; contin: ; contin: ;
5837 } } while (/* ... */); }
5838 unless the continue statement shown is in an enclosed iteration statement (in which
5839 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note138"><b>138)</b></a></sup>
5840 <a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
5841 <b> Constraints</b>
5842 1 A break statement shall appear only in or as a switch body or loop body.
5843 <b> Semantics</b>
5844 2 A break statement terminates execution of the smallest enclosing switch or iteration
5845 statement.
5849 <sup><a name="note138" href="#note138"><b>138)</b></a></sup> Following the contin: label is a null statement.
5851 [<a name="p138" href="#p138">page 138</a>] (<a href="#Contents">Contents</a>)
5853 <a name="6.8.6.4" href="#6.8.6.4"><b> 6.8.6.4 The return statement</b></a>
5854 <b> Constraints</b>
5855 1 A return statement with an expression shall not appear in a function whose return type
5856 is void. A return statement without an expression shall only appear in a function
5857 whose return type is void.
5858 <b> Semantics</b>
5859 2 A return statement terminates execution of the current function and returns control to
5860 its caller. A function may have any number of return statements.
5861 3 If a return statement with an expression is executed, the value of the expression is
5862 returned to the caller as the value of the function call expression. If the expression has a
5863 type different from the return type of the function in which it appears, the value is
5864 converted as if by assignment to an object having the return type of the function.<sup><a href="#note139"><b>139)</b></a></sup>
5865 4 EXAMPLE In:
5866 struct s { double i; } f(void);
5867 union {
5868 struct {
5869 int f1;
5870 struct s f2;
5871 } u1;
5872 struct {
5873 struct s f3;
5874 int f4;
5875 } u2;
5876 } g;
5877 struct s f(void)
5879 return g.u1.f2;
5881 /* ... */
5882 g.u2.f3 = f();
5883 there is no undefined behavior, although there would be if the assignment were done directly (without using
5884 a function call to fetch the value).
5889 <sup><a name="note139" href="#note139"><b>139)</b></a></sup> 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
5890 apply to the case of function return. The representation of floating-point values may have wider range
5891 or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
5892 range and precision.
5894 [<a name="p139" href="#p139">page 139</a>] (<a href="#Contents">Contents</a>)
5896 <a name="6.9" href="#6.9"><b> 6.9 External definitions</b></a>
5897 <b> Syntax</b>
5898 1 translation-unit:
5899 external-declaration
5900 translation-unit external-declaration
5901 external-declaration:
5902 function-definition
5903 declaration
5904 <b> Constraints</b>
5905 2 The storage-class specifiers auto and register shall not appear in the declaration
5906 specifiers in an external declaration.
5907 3 There shall be no more than one external definition for each identifier declared with
5908 internal linkage in a translation unit. Moreover, if an identifier declared with internal
5909 linkage is used in an expression (other than as a part of the operand of a sizeof
5910 operator whose result is an integer constant), there shall be exactly one external definition
5911 for the identifier in the translation unit.
5912 <b> Semantics</b>
5913 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,
5914 which consists of a sequence of external declarations. These are described as ''external''
5915 because they appear outside any function (and hence have file scope). As discussed in
5916 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
5917 by the identifier is a definition.
5918 5 An external definition is an external declaration that is also a definition of a function
5919 (other than an inline definition) or an object. If an identifier declared with external
5920 linkage is used in an expression (other than as part of the operand of a sizeof operator
5921 whose result is an integer constant), somewhere in the entire program there shall be
5922 exactly one external definition for the identifier; otherwise, there shall be no more than
5923 one.<sup><a href="#note140"><b>140)</b></a></sup>
5928 <sup><a name="note140" href="#note140"><b>140)</b></a></sup> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
5929 external definition for it.
5931 [<a name="p140" href="#p140">page 140</a>] (<a href="#Contents">Contents</a>)
5933 <a name="6.9.1" href="#6.9.1"><b> 6.9.1 Function definitions</b></a>
5934 <b> Syntax</b>
5935 1 function-definition:
5936 declaration-specifiers declarator declaration-listopt compound-statement
5937 declaration-list:
5938 declaration
5939 declaration-list declaration
5940 <b> Constraints</b>
5941 2 The identifier declared in a function definition (which is the name of the function) shall
5942 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note141"><b>141)</b></a></sup>
5943 3 The return type of a function shall be void or an object type other than array type.
5944 4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
5945 static.
5946 5 If the declarator includes a parameter type list, the declaration of each parameter shall
5947 include an identifier, except for the special case of a parameter list consisting of a single
5948 parameter of type void, in which case there shall not be an identifier. No declaration list
5949 shall follow.
5950 6 If the declarator includes an identifier list, each declaration in the declaration list shall
5951 have at least one declarator, those declarators shall declare only identifiers from the
5952 identifier list, and every identifier in the identifier list shall be declared. An identifier
5953 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
5954 declaration list shall contain no storage-class specifier other than register and no
5955 initializations.
5960 <sup><a name="note141" href="#note141"><b>141)</b></a></sup> The intent is that the type category in a function definition cannot be inherited from a typedef:
5961 typedef int F(void); // type F is ''function with no parameters
5962 // returning int''
5963 F f, g; // f and g both have type compatible with F
5964 F f { /* ... */ } // WRONG: syntax/constraint error
5965 F g() { /* ... */ } // WRONG: declares that g returns a function
5966 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
5967 int g() { /* ... */ } // RIGHT: g has type compatible with F
5968 F *e(void) { /* ... */ } // e returns a pointer to a function
5969 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
5970 int (*fp)(void); // fp points to a function that has type F
5971 F *Fp; // Fp points to a function that has type F
5973 [<a name="p141" href="#p141">page 141</a>] (<a href="#Contents">Contents</a>)
5975 <b> Semantics</b>
5976 7 The declarator in a function definition specifies the name of the function being defined
5977 and the identifiers of its parameters. If the declarator includes a parameter type list, the
5978 list also specifies the types of all the parameters; such a declarator also serves as a
5979 function prototype for later calls to the same function in the same translation unit. If the
5980 declarator includes an identifier list,<sup><a href="#note142"><b>142)</b></a></sup> the types of the parameters shall be declared in a
5981 following declaration list. In either case, the type of each parameter is adjusted as
5982 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.
5983 8 If a function that accepts a variable number of arguments is defined without a parameter
5984 type list that ends with the ellipsis notation, the behavior is undefined.
5985 9 Each parameter has automatic storage duration. Its identifier is an lvalue, which is in
5986 effect declared at the head of the compound statement that constitutes the function body
5987 (and therefore cannot be redeclared in the function body except in an enclosed block).
5988 The layout of the storage for parameters is unspecified.
5989 10 On entry to the function, the size expressions of each variably modified parameter are
5990 evaluated and the value of each argument expression is converted to the type of the
5991 corresponding parameter as if by assignment. (Array expressions and function
5992 designators as arguments were converted to pointers before the call.)
5993 11 After all parameters have been assigned, the compound statement that constitutes the
5994 body of the function definition is executed.
5995 12 If the } that terminates a function is reached, and the value of the function call is used by
5996 the caller, the behavior is undefined.
5997 13 EXAMPLE 1 In the following:
5998 extern int max(int a, int b)
6000 return a &gt; b ? a : b;
6002 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
6003 function declarator; and
6004 { return a &gt; b ? a : b; }
6005 is the function body. The following similar definition uses the identifier-list form for the parameter
6006 declarations:
6011 <sup><a name="note142" href="#note142"><b>142)</b></a></sup> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
6013 [<a name="p142" href="#p142">page 142</a>] (<a href="#Contents">Contents</a>)
6015 extern int max(a, b)
6016 int a, b;
6018 return a &gt; b ? a : b;
6020 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
6021 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
6022 to the function, whereas the second form does not.
6024 14 EXAMPLE 2 To pass one function to another, one might say
6025 int f(void);
6026 /* ... */
6027 g(f);
6028 Then the definition of g might read
6029 void g(int (*funcp)(void))
6031 /* ... */
6032 (*funcp)(); /* or funcp(); ... */
6034 or, equivalently,
6035 void g(int func(void))
6037 /* ... */
6038 func(); /* or (*func)(); ... */
6041 <a name="6.9.2" href="#6.9.2"><b> 6.9.2 External object definitions</b></a>
6042 <b> Semantics</b>
6043 1 If the declaration of an identifier for an object has file scope and an initializer, the
6044 declaration is an external definition for the identifier.
6045 2 A declaration of an identifier for an object that has file scope without an initializer, and
6046 without a storage-class specifier or with the storage-class specifier static, constitutes a
6047 tentative definition. If a translation unit contains one or more tentative definitions for an
6048 identifier, and the translation unit contains no external definition for that identifier, then
6049 the behavior is exactly as if the translation unit contains a file scope declaration of that
6050 identifier, with the composite type as of the end of the translation unit, with an initializer
6051 equal to 0.
6052 3 If the declaration of an identifier for an object is a tentative definition and has internal
6053 linkage, the declared type shall not be an incomplete type.
6055 [<a name="p143" href="#p143">page 143</a>] (<a href="#Contents">Contents</a>)
6057 4 EXAMPLE 1
6058 int i1 = 1; // definition, external linkage
6059 static int i2 = 2; // definition, internal linkage
6060 extern int i3 = 3; // definition, external linkage
6061 int i4; // tentative definition, external linkage
6062 static int i5; // tentative definition, internal linkage
6063 int i1; // valid tentative definition, refers to previous
6064 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6065 int i3; // valid tentative definition, refers to previous
6066 int i4; // valid tentative definition, refers to previous
6067 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6068 extern int i1; // refers to previous, whose linkage is external
6069 extern int i2; // refers to previous, whose linkage is internal
6070 extern int i3; // refers to previous, whose linkage is external
6071 extern int i4; // refers to previous, whose linkage is external
6072 extern int i5; // refers to previous, whose linkage is internal
6074 5 EXAMPLE 2 If at the end of the translation unit containing
6075 int i[];
6076 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
6077 zero on program startup.
6079 [<a name="p144" href="#p144">page 144</a>] (<a href="#Contents">Contents</a>)
6081 <a name="6.10" href="#6.10"><b> 6.10 Preprocessing directives</b></a>
6082 <b> Syntax</b>
6083 1 preprocessing-file:
6084 groupopt
6085 group:
6086 group-part
6087 group group-part
6088 group-part:
6089 if-section
6090 control-line
6091 text-line
6092 # non-directive
6093 if-section:
6094 if-group elif-groupsopt else-groupopt endif-line
6095 if-group:
6096 # if constant-expression new-line groupopt
6097 # ifdef identifier new-line groupopt
6098 # ifndef identifier new-line groupopt
6099 elif-groups:
6100 elif-group
6101 elif-groups elif-group
6102 elif-group:
6103 # elif constant-expression new-line groupopt
6104 else-group:
6105 # else new-line groupopt
6106 endif-line:
6107 # endif new-line
6109 [<a name="p145" href="#p145">page 145</a>] (<a href="#Contents">Contents</a>)
6111 control-line:
6112 # include pp-tokens new-line
6113 # define identifier replacement-list new-line
6114 # define identifier lparen identifier-listopt )
6115 replacement-list new-line
6116 # define identifier lparen ... ) replacement-list new-line
6117 # define identifier lparen identifier-list , ... )
6118 replacement-list new-line
6119 # undef identifier new-line
6120 # line pp-tokens new-line
6121 # error pp-tokensopt new-line
6122 # pragma pp-tokensopt new-line
6123 # new-line
6124 text-line:
6125 pp-tokensopt new-line
6126 non-directive:
6127 pp-tokens new-line
6128 lparen:
6129 a ( character not immediately preceded by white-space
6130 replacement-list:
6131 pp-tokensopt
6132 pp-tokens:
6133 preprocessing-token
6134 pp-tokens preprocessing-token
6135 new-line:
6136 the new-line character
6137 <b> Description</b>
6138 2 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
6139 following constraints: The first token in the sequence is a # preprocessing token that (at
6140 the start of translation phase 4) is either the first character in the source file (optionally
6141 after white space containing no new-line characters) or that follows white space
6142 containing at least one new-line character. The last token in the sequence is the first new-
6143 line character that follows the first token in the sequence.<sup><a href="#note143"><b>143)</b></a></sup> A new-line character ends
6144 the preprocessing directive even if it occurs within what would otherwise be an
6146 <sup><a name="note143" href="#note143"><b>143)</b></a></sup> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
6147 significance, as all white space is equivalent except in certain situations during preprocessing (see the
6148 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
6150 [<a name="p146" href="#p146">page 146</a>] (<a href="#Contents">Contents</a>)
6152 invocation of a function-like macro.
6153 3 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
6154 with any of the directive names appearing in the syntax.
6155 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
6156 sequence of preprocessing tokens to occur between the directive name and the following
6157 new-line character.
6158 <b> Constraints</b>
6159 5 The only white-space characters that shall appear between preprocessing tokens within a
6160 preprocessing directive (from just after the introducing # preprocessing token through
6161 just before the terminating new-line character) are space and horizontal-tab (including
6162 spaces that have replaced comments or possibly other white-space characters in
6163 translation phase 3).
6164 <b> Semantics</b>
6165 6 The implementation can process and skip sections of source files conditionally, include
6166 other source files, and replace macros. These capabilities are called preprocessing,
6167 because conceptually they occur before translation of the resulting translation unit.
6168 7 The preprocessing tokens within a preprocessing directive are not subject to macro
6169 expansion unless otherwise stated.
6170 8 EXAMPLE In:
6171 #define EMPTY
6172 EMPTY # include &lt;file.h&gt;
6173 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
6174 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
6175 replaced.
6177 <a name="6.10.1" href="#6.10.1"><b> 6.10.1 Conditional inclusion</b></a>
6178 <b> Constraints</b>
6179 1 The expression that controls conditional inclusion shall be an integer constant expression
6180 except that: it shall not contain a cast; identifiers (including those lexically identical to
6181 keywords) are interpreted as described below;<sup><a href="#note144"><b>144)</b></a></sup> and it may contain unary operator
6182 expressions of the form
6187 <sup><a name="note144" href="#note144"><b>144)</b></a></sup> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
6188 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
6190 [<a name="p147" href="#p147">page 147</a>] (<a href="#Contents">Contents</a>)
6192 defined identifier
6194 defined ( identifier )
6195 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
6196 predefined or if it has been the subject of a #define preprocessing directive without an
6197 intervening #undef directive with the same subject identifier), 0 if it is not.
6198 2 Each preprocessing token that remains (in the list of preprocessing tokens that will
6199 become the controlling expression) after all macro replacements have occurred shall be in
6200 the lexical form of a token (<a href="#6.4">6.4</a>).
6201 <b> Semantics</b>
6202 3 Preprocessing directives of the forms
6203 # if constant-expression new-line groupopt
6204 # elif constant-expression new-line groupopt
6205 check whether the controlling constant expression evaluates to nonzero.
6206 4 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
6207 the controlling constant expression are replaced (except for those macro names modified
6208 by the defined unary operator), just as in normal text. If the token defined is
6209 generated as a result of this replacement process or use of the defined unary operator
6210 does not match one of the two specified forms prior to macro replacement, the behavior is
6211 undefined. After all replacements due to macro expansion and the defined unary
6212 operator have been performed, all remaining identifiers (including those lexically
6213 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
6214 token is converted into a token. The resulting tokens compose the controlling constant
6215 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
6216 token conversion and evaluation, all signed integer types and all unsigned integer types
6217 act as if they have the same representation as, respectively, the types intmax_t and
6218 uintmax_t defined in the header <a href="#7.18">&lt;stdint.h&gt;</a>.<sup><a href="#note145"><b>145)</b></a></sup> This includes interpreting
6219 character constants, which may involve converting escape sequences into execution
6220 character set members. Whether the numeric value for these character constants matches
6221 the value obtained when an identical character constant occurs in an expression (other
6222 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note146"><b>146)</b></a></sup> Also, whether a
6223 single-character character constant may have a negative value is implementation-defined.
6224 5 Preprocessing directives of the forms
6228 <sup><a name="note145" href="#note145"><b>145)</b></a></sup> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
6229 0x8000 is signed and positive within a #if expression even though it would be unsigned in
6230 translation phase 7.
6232 [<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
6234 # ifdef identifier new-line groupopt
6235 # ifndef identifier new-line groupopt
6236 check whether the identifier is or is not currently defined as a macro name. Their
6237 conditions are equivalent to #if defined identifier and #if !defined identifier
6238 respectively.
6239 6 Each directive's condition is checked in order. If it evaluates to false (zero), the group
6240 that it controls is skipped: directives are processed only through the name that determines
6241 the directive in order to keep track of the level of nested conditionals; the rest of the
6242 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
6243 group. Only the first group whose control condition evaluates to true (nonzero) is
6244 processed. If none of the conditions evaluates to true, and there is a #else directive, the
6245 group controlled by the #else is processed; lacking a #else directive, all the groups
6246 until the #endif are skipped.<sup><a href="#note147"><b>147)</b></a></sup>
6247 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
6248 integer types (<a href="#7.18.1.5">7.18.1.5</a>).
6249 <a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
6250 <b> Constraints</b>
6251 1 A #include directive shall identify a header or source file that can be processed by the
6252 implementation.
6253 <b> Semantics</b>
6254 2 A preprocessing directive of the form
6255 # include &lt;h-char-sequence&gt; new-line
6256 searches a sequence of implementation-defined places for a header identified uniquely by
6257 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
6258 directive by the entire contents of the header. How the places are specified or the header
6259 identified is implementation-defined.
6260 3 A preprocessing directive of the form
6264 <sup><a name="note146" href="#note146"><b>146)</b></a></sup> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
6265 evaluate to the same value in these two contexts.
6266 #if 'z' - 'a' == 25
6267 if ('z' - 'a' == 25)
6269 <sup><a name="note147" href="#note147"><b>147)</b></a></sup> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
6270 before the terminating new-line character. However, comments may appear anywhere in a source file,
6271 including within a preprocessing directive.
6273 [<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
6275 # include "q-char-sequence" new-line
6276 causes the replacement of that directive by the entire contents of the source file identified
6277 by the specified sequence between the " delimiters. The named source file is searched
6278 for in an implementation-defined manner. If this search is not supported, or if the search
6279 fails, the directive is reprocessed as if it read
6280 # include &lt;h-char-sequence&gt; new-line
6281 with the identical contained sequence (including &gt; characters, if any) from the original
6282 directive.
6283 4 A preprocessing directive of the form
6284 # include pp-tokens new-line
6285 (that does not match one of the two previous forms) is permitted. The preprocessing
6286 tokens after include in the directive are processed just as in normal text. (Each
6287 identifier currently defined as a macro name is replaced by its replacement list of
6288 preprocessing tokens.) The directive resulting after all replacements shall match one of
6289 the two previous forms.<sup><a href="#note148"><b>148)</b></a></sup> The method by which a sequence of preprocessing tokens
6290 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
6291 single header name preprocessing token is implementation-defined.
6292 5 The implementation shall provide unique mappings for sequences consisting of one or
6293 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
6294 first character shall not be a digit. The implementation may ignore distinctions of
6295 alphabetical case and restrict the mapping to eight significant characters before the
6296 period.
6297 6 A #include preprocessing directive may appear in a source file that has been read
6298 because of a #include directive in another file, up to an implementation-defined
6299 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
6300 7 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
6301 #include <a href="#7.19">&lt;stdio.h&gt;</a>
6302 #include "myprog.h"
6304 8 EXAMPLE 2 This illustrates macro-replaced #include directives:
6309 <sup><a name="note148" href="#note148"><b>148)</b></a></sup> Note that adjacent string literals are not concatenated into a single string literal (see the translation
6310 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.
6312 [<a name="p150" href="#p150">page 150</a>] (<a href="#Contents">Contents</a>)
6314 #if VERSION == 1
6315 #define INCFILE "vers1.h"
6316 #elif VERSION == 2
6317 #define INCFILE "vers2.h" // and so on
6318 #else
6319 #define INCFILE "versN.h"
6320 #endif
6321 #include INCFILE
6323 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>).
6324 <a name="6.10.3" href="#6.10.3"><b> 6.10.3 Macro replacement</b></a>
6325 <b> Constraints</b>
6326 1 Two replacement lists are identical if and only if the preprocessing tokens in both have
6327 the same number, ordering, spelling, and white-space separation, where all white-space
6328 separations are considered identical.
6329 2 An identifier currently defined as an object-like macro shall not be redefined by another
6330 #define preprocessing directive unless the second definition is an object-like macro
6331 definition and the two replacement lists are identical. Likewise, an identifier currently
6332 defined as a function-like macro shall not be redefined by another #define
6333 preprocessing directive unless the second definition is a function-like macro definition
6334 that has the same number and spelling of parameters, and the two replacement lists are
6335 identical.
6336 3 There shall be white-space between the identifier and the replacement list in the definition
6337 of an object-like macro.
6338 4 If the identifier-list in the macro definition does not end with an ellipsis, the number of
6339 arguments (including those arguments consisting of no preprocessing tokens) in an
6340 invocation of a function-like macro shall equal the number of parameters in the macro
6341 definition. Otherwise, there shall be more arguments in the invocation than there are
6342 parameters in the macro definition (excluding the ...). There shall exist a )
6343 preprocessing token that terminates the invocation.
6344 5 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
6345 macro that uses the ellipsis notation in the parameters.
6346 6 A parameter identifier in a function-like macro shall be uniquely declared within its
6347 scope.
6348 <b> Semantics</b>
6349 7 The identifier immediately following the define is called the macro name. There is one
6350 name space for macro names. Any white-space characters preceding or following the
6351 replacement list of preprocessing tokens are not considered part of the replacement list
6352 for either form of macro.
6354 [<a name="p151" href="#p151">page 151</a>] (<a href="#Contents">Contents</a>)
6356 8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
6357 a preprocessing directive could begin, the identifier is not subject to macro replacement.
6358 9 A preprocessing directive of the form
6359 # define identifier replacement-list new-line
6360 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note149"><b>149)</b></a></sup>
6361 to be replaced by the replacement list of preprocessing tokens that constitute the
6362 remainder of the directive. The replacement list is then rescanned for more macro names
6363 as specified below.
6364 10 A preprocessing directive of the form
6365 # define identifier lparen identifier-listopt ) replacement-list new-line
6366 # define identifier lparen ... ) replacement-list new-line
6367 # define identifier lparen identifier-list , ... ) replacement-list new-line
6368 defines a function-like macro with parameters, whose use is similar syntactically to a
6369 function call. The parameters are specified by the optional list of identifiers, whose scope
6370 extends from their declaration in the identifier list until the new-line character that
6371 terminates the #define preprocessing directive. Each subsequent instance of the
6372 function-like macro name followed by a ( as the next preprocessing token introduces the
6373 sequence of preprocessing tokens that is replaced by the replacement list in the definition
6374 (an invocation of the macro). The replaced sequence of preprocessing tokens is
6375 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
6376 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
6377 tokens making up an invocation of a function-like macro, new-line is considered a normal
6378 white-space character.
6379 11 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
6380 forms the list of arguments for the function-like macro. The individual arguments within
6381 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
6382 between matching inner parentheses do not separate arguments. If there are sequences of
6383 preprocessing tokens within the list of arguments that would otherwise act as
6384 preprocessing directives,<sup><a href="#note150"><b>150)</b></a></sup> the behavior is undefined.
6385 12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
6386 including any separating comma preprocessing tokens, are merged to form a single item:
6387 the variable arguments. The number of arguments so combined is such that, following
6390 <sup><a name="note149" href="#note149"><b>149)</b></a></sup> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
6391 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
6392 are never scanned for macro names or parameters.
6393 <sup><a name="note150" href="#note150"><b>150)</b></a></sup> Despite the name, a non-directive is a preprocessing directive.
6395 [<a name="p152" href="#p152">page 152</a>] (<a href="#Contents">Contents</a>)
6397 merger, the number of arguments is one more than the number of parameters in the macro
6398 definition (excluding the ...).
6399 <a name="6.10.3.1" href="#6.10.3.1"><b> 6.10.3.1 Argument substitution</b></a>
6400 1 After the arguments for the invocation of a function-like macro have been identified,
6401 argument substitution takes place. A parameter in the replacement list, unless preceded
6402 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
6403 replaced by the corresponding argument after all macros contained therein have been
6404 expanded. Before being substituted, each argument's preprocessing tokens are
6405 completely macro replaced as if they formed the rest of the preprocessing file; no other
6406 preprocessing tokens are available.
6407 2 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
6408 were a parameter, and the variable arguments shall form the preprocessing tokens used to
6409 replace it.
6410 <a name="6.10.3.2" href="#6.10.3.2"><b> 6.10.3.2 The # operator</b></a>
6411 <b> Constraints</b>
6412 1 Each # preprocessing token in the replacement list for a function-like macro shall be
6413 followed by a parameter as the next preprocessing token in the replacement list.
6414 <b> Semantics</b>
6415 2 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
6416 token, both are replaced by a single character string literal preprocessing token that
6417 contains the spelling of the preprocessing token sequence for the corresponding
6418 argument. Each occurrence of white space between the argument's preprocessing tokens
6419 becomes a single space character in the character string literal. White space before the
6420 first preprocessing token and after the last preprocessing token composing the argument
6421 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
6422 is retained in the character string literal, except for special handling for producing the
6423 spelling of string literals and character constants: a \ character is inserted before each "
6424 and \ character of a character constant or string literal (including the delimiting "
6425 characters), except that it is implementation-defined whether a \ character is inserted
6426 before the \ character beginning a universal character name. If the replacement that
6427 results is not a valid character string literal, the behavior is undefined. The character
6428 string literal corresponding to an empty argument is "". The order of evaluation of # and
6429 ## operators is unspecified.
6431 [<a name="p153" href="#p153">page 153</a>] (<a href="#Contents">Contents</a>)
6433 <a name="6.10.3.3" href="#6.10.3.3"><b> 6.10.3.3 The ## operator</b></a>
6434 <b> Constraints</b>
6435 1 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
6436 list for either form of macro definition.
6437 <b> Semantics</b>
6438 2 If, in the replacement list of a function-like macro, a parameter is immediately preceded
6439 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
6440 argument's preprocessing token sequence; however, if an argument consists of no
6441 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
6442 instead.<sup><a href="#note151"><b>151)</b></a></sup>
6443 3 For both object-like and function-like macro invocations, before the replacement list is
6444 reexamined for more macro names to replace, each instance of a ## preprocessing token
6445 in the replacement list (not from an argument) is deleted and the preceding preprocessing
6446 token is concatenated with the following preprocessing token. Placemarker
6447 preprocessing tokens are handled specially: concatenation of two placemarkers results in
6448 a single placemarker preprocessing token, and concatenation of a placemarker with a
6449 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
6450 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
6451 token is available for further macro replacement. The order of evaluation of ## operators
6452 is unspecified.
6453 4 EXAMPLE In the following fragment:
6454 #define hash_hash # ## #
6455 #define mkstr(a) # a
6456 #define in_between(a) mkstr(a)
6457 #define join(c, d) in_between(c hash_hash d)
6458 char p[] = join(x, y); // equivalent to
6459 // char p[] = "x ## y";
6460 The expansion produces, at various stages:
6461 join(x, y)
6462 in_between(x hash_hash y)
6463 in_between(x ## y)
6464 mkstr(x ## y)
6465 "x ## y"
6466 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
6467 this new token is not the ## operator.
6470 <sup><a name="note151" href="#note151"><b>151)</b></a></sup> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
6471 exist only within translation phase 4.
6473 [<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
6475 <a name="6.10.3.4" href="#6.10.3.4"><b> 6.10.3.4 Rescanning and further replacement</b></a>
6476 1 After all parameters in the replacement list have been substituted and # and ##
6477 processing has taken place, all placemarker preprocessing tokens are removed. Then, the
6478 resulting preprocessing token sequence is rescanned, along with all subsequent
6479 preprocessing tokens of the source file, for more macro names to replace.
6480 2 If the name of the macro being replaced is found during this scan of the replacement list
6481 (not including the rest of the source file's preprocessing tokens), it is not replaced.
6482 Furthermore, if any nested replacements encounter the name of the macro being replaced,
6483 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
6484 available for further replacement even if they are later (re)examined in contexts in which
6485 that macro name preprocessing token would otherwise have been replaced.
6486 3 The resulting completely macro-replaced preprocessing token sequence is not processed
6487 as a preprocessing directive even if it resembles one, but all pragma unary operator
6488 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
6489 <a name="6.10.3.5" href="#6.10.3.5"><b> 6.10.3.5 Scope of macro definitions</b></a>
6490 1 A macro definition lasts (independent of block structure) until a corresponding #undef
6491 directive is encountered or (if none is encountered) until the end of the preprocessing
6492 translation unit. Macro definitions have no significance after translation phase 4.
6493 2 A preprocessing directive of the form
6494 # undef identifier new-line
6495 causes the specified identifier no longer to be defined as a macro name. It is ignored if
6496 the specified identifier is not currently defined as a macro name.
6497 3 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
6498 #define TABSIZE 100
6499 int table[TABSIZE];
6501 4 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
6502 It has the advantages of working for any compatible types of the arguments and of generating in-line code
6503 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
6504 arguments a second time (including side effects) and generating more code than a function if invoked
6505 several times. It also cannot have its address taken, as it has none.
6506 #define max(a, b) ((a) &gt; (b) ? (a) : (b))
6507 The parentheses ensure that the arguments and the resulting expression are bound properly.
6509 [<a name="p155" href="#p155">page 155</a>] (<a href="#Contents">Contents</a>)
6511 5 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
6512 #define x 3
6513 #define f(a) f(x * (a))
6514 #undef x
6515 #define x 2
6516 #define g f
6517 #define z z[0]
6518 #define h g(~
6519 #define m(a) a(w)
6520 #define w 0,1
6521 #define t(a) a
6522 #define p() int
6523 #define q(x) x
6524 #define r(x,y) x ## y
6525 #define str(x) # x
6526 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
6527 g(x+(3,4)-w) | h 5) &amp; m
6528 (f)^m(m);
6529 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
6530 char c[2][6] = { str(hello), str() };
6531 results in
6532 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
6533 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
6534 int i[] = { 1, 23, 4, 5, };
6535 char c[2][6] = { "hello", "" };
6537 6 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
6538 sequence
6539 #define str(s) # s
6540 #define xstr(s) str(s)
6541 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
6542 x ## s, x ## t)
6543 #define INCFILE(n) vers ## n
6544 #define glue(a, b) a ## b
6545 #define xglue(a, b) glue(a, b)
6546 #define HIGHLOW "hello"
6547 #define LOW LOW ", world"
6548 debug(1, 2);
6549 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
6550 == 0) str(: @\n), s);
6551 #include xstr(INCFILE(2).h)
6552 glue(HIGH, LOW);
6553 xglue(HIGH, LOW)
6554 results in
6556 [<a name="p156" href="#p156">page 156</a>] (<a href="#Contents">Contents</a>)
6558 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
6559 fputs(
6560 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
6562 #include "vers2.h" (after macro replacement, before file access)
6563 "hello";
6564 "hello" ", world"
6565 or, after concatenation of the character string literals,
6566 printf("x1= %d, x2= %s", x1, x2);
6567 fputs(
6568 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
6570 #include "vers2.h" (after macro replacement, before file access)
6571 "hello";
6572 "hello, world"
6573 Space around the # and ## tokens in the macro definition is optional.
6575 7 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
6576 #define t(x,y,z) x ## y ## z
6577 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
6578 t(10,,), t(,11,), t(,,12), t(,,) };
6579 results in
6580 int j[] = { 123, 45, 67, 89,
6581 10, 11, 12, };
6583 8 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
6584 #define OBJ_LIKE (1-1)
6585 #define OBJ_LIKE /* white space */ (1-1) /* other */
6586 #define FUNC_LIKE(a) ( a )
6587 #define FUNC_LIKE( a )( /* note the white space */ \
6588 a /* other stuff on this line
6589 */ )
6590 But the following redefinitions are invalid:
6591 #define OBJ_LIKE (0) // different token sequence
6592 #define OBJ_LIKE (1 - 1) // different white space
6593 #define FUNC_LIKE(b) ( a ) // different parameter usage
6594 #define FUNC_LIKE(b) ( b ) // different parameter spelling
6596 9 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
6597 #define debug(...) fprintf(stderr, __VA_ARGS__)
6598 #define showlist(...) puts(#__VA_ARGS__)
6599 #define report(test, ...) ((test)?puts(#test):\
6600 printf(__VA_ARGS__))
6601 debug("Flag");
6602 debug("X = %d\n", x);
6603 showlist(The first, second, and third items.);
6604 report(x&gt;y, "x is %d but y is %d", x, y);
6606 [<a name="p157" href="#p157">page 157</a>] (<a href="#Contents">Contents</a>)
6608 results in
6609 fprintf(stderr, "Flag" );
6610 fprintf(stderr, "X = %d\n", x );
6611 puts( "The first, second, and third items." );
6612 ((x&gt;y)?puts("x&gt;y"):
6613 printf("x is %d but y is %d", x, y));
6615 <a name="6.10.4" href="#6.10.4"><b> 6.10.4 Line control</b></a>
6616 <b> Constraints</b>
6617 1 The string literal of a #line directive, if present, shall be a character string literal.
6618 <b> Semantics</b>
6619 2 The line number of the current source line is one greater than the number of new-line
6620 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
6621 file to the current token.
6622 3 A preprocessing directive of the form
6623 # line digit-sequence new-line
6624 causes the implementation to behave as if the following sequence of source lines begins
6625 with a source line that has a line number as specified by the digit sequence (interpreted as
6626 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
6627 2147483647.
6628 4 A preprocessing directive of the form
6629 # line digit-sequence "s-char-sequenceopt" new-line
6630 sets the presumed line number similarly and changes the presumed name of the source
6631 file to be the contents of the character string literal.
6632 5 A preprocessing directive of the form
6633 # line pp-tokens new-line
6634 (that does not match one of the two previous forms) is permitted. The preprocessing
6635 tokens after line on the directive are processed just as in normal text (each identifier
6636 currently defined as a macro name is replaced by its replacement list of preprocessing
6637 tokens). The directive resulting after all replacements shall match one of the two
6638 previous forms and is then processed as appropriate.
6640 [<a name="p158" href="#p158">page 158</a>] (<a href="#Contents">Contents</a>)
6642 <a name="6.10.5" href="#6.10.5"><b> 6.10.5 Error directive</b></a>
6643 <b> Semantics</b>
6644 1 A preprocessing directive of the form
6645 # error pp-tokensopt new-line
6646 causes the implementation to produce a diagnostic message that includes the specified
6647 sequence of preprocessing tokens.
6648 <a name="6.10.6" href="#6.10.6"><b> 6.10.6 Pragma directive</b></a>
6649 <b> Semantics</b>
6650 1 A preprocessing directive of the form
6651 # pragma pp-tokensopt new-line
6652 where the preprocessing token STDC does not immediately follow pragma in the
6653 directive (prior to any macro replacement)<sup><a href="#note152"><b>152)</b></a></sup> causes the implementation to behave in an
6654 implementation-defined manner. The behavior might cause translation to fail or cause the
6655 translator or the resulting program to behave in a non-conforming manner. Any such
6656 pragma that is not recognized by the implementation is ignored.
6657 2 If the preprocessing token STDC does immediately follow pragma in the directive (prior
6658 to any macro replacement), then no macro replacement is performed on the directive, and
6659 the directive shall have one of the following forms<sup><a href="#note153"><b>153)</b></a></sup> whose meanings are described
6660 elsewhere:
6661 #pragma STDC FP_CONTRACT on-off-switch
6662 #pragma STDC FENV_ACCESS on-off-switch
6663 #pragma STDC CX_LIMITED_RANGE on-off-switch
6664 on-off-switch: one of
6665 ON OFF DEFAULT
6666 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
6667 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
6672 <sup><a name="note152" href="#note152"><b>152)</b></a></sup> An implementation is not required to perform macro replacement in pragmas, but it is permitted
6673 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
6674 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
6675 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
6676 but is not required to.
6677 <sup><a name="note153" href="#note153"><b>153)</b></a></sup> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
6679 [<a name="p159" href="#p159">page 159</a>] (<a href="#Contents">Contents</a>)
6681 <a name="6.10.7" href="#6.10.7"><b> 6.10.7 Null directive</b></a>
6682 <b> Semantics</b>
6683 1 A preprocessing directive of the form
6684 # new-line
6685 has no effect.
6686 <a name="6.10.8" href="#6.10.8"><b> 6.10.8 Predefined macro names</b></a>
6687 1 The following macro names<sup><a href="#note154"><b>154)</b></a></sup> shall be defined by the implementation:
6688 __DATE__ The date of translation of the preprocessing translation unit: a character
6689 string literal of the form "Mmm dd yyyy", where the names of the
6690 months are the same as those generated by the asctime function, and the
6691 first character of dd is a space character if the value is less than 10. If the
6692 date of translation is not available, an implementation-defined valid date
6693 shall be supplied.
6694 __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
6695 __LINE__ The presumed line number (within the current source file) of the current
6696 source line (an integer constant).155)
6697 __STDC__ The integer constant 1, intended to indicate a conforming implementation.
6698 __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
6699 implementation or the integer constant 0 if it is not.
6700 __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
6701 the encoding for wchar_t, a member of the basic character set need not
6702 have a code value equal to its value when used as the lone character in an
6703 integer character constant.
6704 __STDC_VERSION__ The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
6705 __TIME__ The time of translation of the preprocessing translation unit: a character
6706 string literal of the form "hh:mm:ss" as in the time generated by the
6707 asctime function. If the time of translation is not available, an
6708 implementation-defined valid time shall be supplied.
6712 <sup><a name="note154" href="#note154"><b>154)</b></a></sup> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
6713 <sup><a name="note155" href="#note155"><b>155)</b></a></sup> The presumed source file name and line number can be changed by the #line directive.
6714 <sup><a name="note156" href="#note156"><b>156)</b></a></sup> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
6715 ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
6716 int that is increased with each revision of this International Standard.
6718 [<a name="p160" href="#p160">page 160</a>] (<a href="#Contents">Contents</a>)
6720 2 The following macro names are conditionally defined by the implementation:
6721 __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
6722 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
6723 __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
6724 adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
6725 compatible complex arithmetic).
6726 __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
6727 199712L). If this symbol is defined, then every character in the Unicode
6728 required set, when stored in an object of type wchar_t, has the same
6729 value as the short identifier of that character. The Unicode required set
6730 consists of all the characters that are defined by ISO/IEC 10646, along with
6731 all amendments and technical corrigenda, as of the specified year and
6732 month.
6733 3 The values of the predefined macros (except for __FILE__ and __LINE__) remain
6734 constant throughout the translation unit.
6735 4 None of these macro names, nor the identifier defined, shall be the subject of a
6736 #define or a #undef preprocessing directive. Any other predefined macro names
6737 shall begin with a leading underscore followed by an uppercase letter or a second
6738 underscore.
6739 5 The implementation shall not predefine the macro __cplusplus, nor shall it define it
6740 in any standard header.
6741 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>).
6742 <a name="6.10.9" href="#6.10.9"><b> 6.10.9 Pragma operator</b></a>
6743 <b> Semantics</b>
6744 1 A unary operator expression of the form:
6745 _Pragma ( string-literal )
6746 is processed as follows: The string literal is destringized by deleting the L prefix, if
6747 present, deleting the leading and trailing double-quotes, replacing each escape sequence
6748 \" by a double-quote, and replacing each escape sequence \\ by a single backslash. The
6749 resulting sequence of characters is processed through translation phase 3 to produce
6750 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
6751 directive. The original four preprocessing tokens in the unary operator expression are
6752 removed.
6753 2 EXAMPLE A directive of the form:
6754 #pragma listing on "..\listing.dir"
6755 can also be expressed as:
6757 [<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
6759 _Pragma ( "listing on \"..\\listing.dir\"" )
6760 The latter form is processed in the same way whether it appears literally as shown, or results from macro
6761 replacement, as in:
6762 #define LISTING(x) PRAGMA(listing on #x)
6763 #define PRAGMA(x) _Pragma(#x)
6764 LISTING ( ..\listing.dir )
6766 [<a name="p162" href="#p162">page 162</a>] (<a href="#Contents">Contents</a>)
6768 <a name="6.11" href="#6.11"><b> 6.11 Future language directions</b></a>
6769 <a name="6.11.1" href="#6.11.1"><b> 6.11.1 Floating types</b></a>
6770 1 Future standardization may include additional floating-point types, including those with
6771 greater range, precision, or both than long double.
6772 <a name="6.11.2" href="#6.11.2"><b> 6.11.2 Linkages of identifiers</b></a>
6773 1 Declaring an identifier with internal linkage at file scope without the static storage-
6774 class specifier is an obsolescent feature.
6775 <a name="6.11.3" href="#6.11.3"><b> 6.11.3 External names</b></a>
6776 1 Restriction of the significance of an external name to fewer than 255 characters
6777 (considering each universal character name or extended source character as a single
6778 character) is an obsolescent feature that is a concession to existing implementations.
6779 <a name="6.11.4" href="#6.11.4"><b> 6.11.4 Character escape sequences</b></a>
6780 1 Lowercase letters as escape sequences are reserved for future standardization. Other
6781 characters may be used in extensions.
6782 <a name="6.11.5" href="#6.11.5"><b> 6.11.5 Storage-class specifiers</b></a>
6783 1 The placement of a storage-class specifier other than at the beginning of the declaration
6784 specifiers in a declaration is an obsolescent feature.
6785 <a name="6.11.6" href="#6.11.6"><b> 6.11.6 Function declarators</b></a>
6786 1 The use of function declarators with empty parentheses (not prototype-format parameter
6787 type declarators) is an obsolescent feature.
6788 <a name="6.11.7" href="#6.11.7"><b> 6.11.7 Function definitions</b></a>
6789 1 The use of function definitions with separate parameter identifier and declaration lists
6790 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
6791 <a name="6.11.8" href="#6.11.8"><b> 6.11.8 Pragma directives</b></a>
6792 1 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
6793 <a name="6.11.9" href="#6.11.9"><b> 6.11.9 Predefined macro names</b></a>
6794 1 Macro names beginning with __STDC_ are reserved for future standardization.
6796 [<a name="p163" href="#p163">page 163</a>] (<a href="#Contents">Contents</a>)
6799 <a name="7" href="#7"><b> 7. Library</b></a>
6801 <a name="7.1" href="#7.1"><b> 7.1 Introduction</b></a>
6802 <a name="7.1.1" href="#7.1.1"><b> 7.1.1 Definitions of terms</b></a>
6803 1 A string is a contiguous sequence of characters terminated by and including the first null
6804 character. The term multibyte string is sometimes used instead to emphasize special
6805 processing given to multibyte characters contained in the string or to avoid confusion
6806 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
6807 character. The length of a string is the number of bytes preceding the null character and
6808 the value of a string is the sequence of the values of the contained characters, in order.
6809 2 The decimal-point character is the character used by functions that convert floating-point
6810 numbers to or from character sequences to denote the beginning of the fractional part of
6811 such character sequences.<sup><a href="#note157"><b>157)</b></a></sup> It is represented in the text and examples by a period, but
6812 may be changed by the setlocale function.
6813 3 A null wide character is a wide character with code value zero.
6814 4 A wide string is a contiguous sequence of wide characters terminated by and including
6815 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
6816 addressed) wide character. The length of a wide string is the number of wide characters
6817 preceding the null wide character and the value of a wide string is the sequence of code
6818 values of the contained wide characters, in order.
6819 5 A shift sequence is a contiguous sequence of bytes within a multibyte string that
6820 (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
6821 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
6822 character.<sup><a href="#note158"><b>158)</b></a></sup>
6823 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>).
6828 <sup><a name="note157" href="#note157"><b>157)</b></a></sup> The functions that make use of the decimal-point character are the numeric conversion functions
6829 (<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>).
6830 <sup><a name="note158" href="#note158"><b>158)</b></a></sup> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
6831 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
6832 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
6833 implementation's choice.
6835 [<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
6837 <a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
6838 1 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note159"><b>159)</b></a></sup>
6839 whose contents are made available by the #include preprocessing directive. The
6840 header declares a set of related functions, plus any necessary types and additional macros
6841 needed to facilitate their use. Declarations of types described in this clause shall not
6842 include type qualifiers, unless explicitly stated otherwise.
6843 2 The standard headers are
6844 <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>
6845 <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>
6846 <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>
6847 <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>
6848 <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>
6849 <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>
6850 3 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
6851 provided as part of the implementation, is placed in any of the standard places that are
6852 searched for included source files, the behavior is undefined.
6853 4 Standard headers may be included in any order; each may be included more than once in
6854 a given scope, with no effect different from being included only once, except that the
6855 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
6856 used, a header shall be included outside of any external declaration or definition, and it
6857 shall first be included before the first reference to any of the functions or objects it
6858 declares, or to any of the types or macros it defines. However, if an identifier is declared
6859 or defined in more than one header, the second and subsequent associated headers may be
6860 included after the initial reference to the identifier. The program shall not have any
6861 macros with names lexically identical to keywords currently defined prior to the
6862 inclusion.
6863 5 Any definition of an object-like macro described in this clause shall expand to code that is
6864 fully protected by parentheses where necessary, so that it groups in an arbitrary
6865 expression as if it were a single identifier.
6866 6 Any declaration of a library function shall have external linkage.
6867 7 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
6868 Forward references: diagnostics (<a href="#7.2">7.2</a>).
6873 <sup><a name="note159" href="#note159"><b>159)</b></a></sup> A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
6874 necessarily valid source file names.
6876 [<a name="p165" href="#p165">page 165</a>] (<a href="#Contents">Contents</a>)
6878 <a name="7.1.3" href="#7.1.3"><b> 7.1.3 Reserved identifiers</b></a>
6879 1 Each header declares or defines all identifiers listed in its associated subclause, and
6880 optionally declares or defines identifiers listed in its associated future library directions
6881 subclause and identifiers which are always reserved either for any use or for use as file
6882 scope identifiers.
6883 -- All identifiers that begin with an underscore and either an uppercase letter or another
6884 underscore are always reserved for any use.
6885 -- All identifiers that begin with an underscore are always reserved for use as identifiers
6886 with file scope in both the ordinary and tag name spaces.
6887 -- Each macro name in any of the following subclauses (including the future library
6888 directions) is reserved for use as specified if any of its associated headers is included;
6889 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
6890 -- All identifiers with external linkage in any of the following subclauses (including the
6891 future library directions) are always reserved for use as identifiers with external
6892 linkage.<sup><a href="#note160"><b>160)</b></a></sup>
6893 -- Each identifier with file scope listed in any of the following subclauses (including the
6894 future library directions) is reserved for use as a macro name and as an identifier with
6895 file scope in the same name space if any of its associated headers is included.
6896 2 No other identifiers are reserved. If the program declares or defines an identifier in a
6897 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
6898 identifier as a macro name, the behavior is undefined.
6899 3 If the program removes (with #undef) any macro definition of an identifier in the first
6900 group listed above, the behavior is undefined.
6901 <a name="7.1.4" href="#7.1.4"><b> 7.1.4 Use of library functions</b></a>
6902 1 Each of the following statements applies unless explicitly stated otherwise in the detailed
6903 descriptions that follow: If an argument to a function has an invalid value (such as a value
6904 outside the domain of the function, or a pointer outside the address space of the program,
6905 or a null pointer, or a pointer to non-modifiable storage when the corresponding
6906 parameter is not const-qualified) or a type (after promotion) not expected by a function
6907 with variable number of arguments, the behavior is undefined. If a function argument is
6908 described as being an array, the pointer actually passed to the function shall have a value
6909 such that all address computations and accesses to objects (that would be valid if the
6910 pointer did point to the first element of such an array) are in fact valid. Any function
6911 declared in a header may be additionally implemented as a function-like macro defined in
6913 <sup><a name="note160" href="#note160"><b>160)</b></a></sup> The list of reserved identifiers with external linkage includes errno, math_errhandling,
6914 setjmp, and va_end.
6916 [<a name="p166" href="#p166">page 166</a>] (<a href="#Contents">Contents</a>)
6918 the header, so if a library function is declared explicitly when its header is included, one
6919 of the techniques shown below can be used to ensure the declaration is not affected by
6920 such a macro. Any macro definition of a function can be suppressed locally by enclosing
6921 the name of the function in parentheses, because the name is then not followed by the left
6922 parenthesis that indicates expansion of a macro function name. For the same syntactic
6923 reason, it is permitted to take the address of a library function even if it is also defined as
6924 a macro.<sup><a href="#note161"><b>161)</b></a></sup> The use of #undef to remove any macro definition will also ensure that an
6925 actual function is referred to. Any invocation of a library function that is implemented as
6926 a macro shall expand to code that evaluates each of its arguments exactly once, fully
6927 protected by parentheses where necessary, so it is generally safe to use arbitrary
6928 expressions as arguments.<sup><a href="#note162"><b>162)</b></a></sup> Likewise, those function-like macros described in the
6929 following subclauses may be invoked in an expression anywhere a function with a
6930 compatible return type could be called.<sup><a href="#note163"><b>163)</b></a></sup> All object-like macros listed as expanding to
6931 integer constant expressions shall additionally be suitable for use in #if preprocessing
6932 directives.
6933 2 Provided that a library function can be declared without reference to any type defined in a
6934 header, it is also permissible to declare the function and use it without including its
6935 associated header.
6936 3 There is a sequence point immediately before a library function returns.
6937 4 The functions in the standard library are not guaranteed to be reentrant and may modify
6938 objects with static storage duration.<sup><a href="#note164"><b>164)</b></a></sup>
6942 <sup><a name="note161" href="#note161"><b>161)</b></a></sup> This means that an implementation shall provide an actual function for each library function, even if it
6943 also provides a macro for that function.
6944 <sup><a name="note162" href="#note162"><b>162)</b></a></sup> Such macros might not contain the sequence points that the corresponding function calls do.
6945 <sup><a name="note163" href="#note163"><b>163)</b></a></sup> Because external identifiers and some macro names beginning with an underscore are reserved,
6946 implementations may provide special semantics for such names. For example, the identifier
6947 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
6948 appropriate header could specify
6949 #define abs(x) _BUILTIN_abs(x)
6950 for a compiler whose code generator will accept it.
6951 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
6952 function may write
6953 #undef abs
6954 whether the implementation's header provides a macro implementation of abs or a built-in
6955 implementation. The prototype for the function, which precedes and is hidden by any macro
6956 definition, is thereby revealed also.
6957 <sup><a name="note164" href="#note164"><b>164)</b></a></sup> Thus, a signal handler cannot, in general, call standard library functions.
6959 [<a name="p167" href="#p167">page 167</a>] (<a href="#Contents">Contents</a>)
6961 5 EXAMPLE The function atoi may be used in any of several ways:
6962 -- by use of its associated header (possibly generating a macro expansion)
6963 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
6964 const char *str;
6965 /* ... */
6966 i = atoi(str);
6967 -- by use of its associated header (assuredly generating a true function reference)
6968 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
6969 #undef atoi
6970 const char *str;
6971 /* ... */
6972 i = atoi(str);
6974 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
6975 const char *str;
6976 /* ... */
6977 i = (atoi)(str);
6978 -- by explicit declaration
6979 extern int atoi(const char *);
6980 const char *str;
6981 /* ... */
6982 i = atoi(str);
6984 [<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
6986 <a name="7.2" href="#7.2"><b> 7.2 Diagnostics &lt;assert.h&gt;</b></a>
6987 1 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert macro and refers to another macro,
6988 NDEBUG
6989 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
6990 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
6991 simply as
6992 #define assert(ignore) ((void)0)
6993 The assert macro is redefined according to the current state of NDEBUG each time that
6994 <a href="#7.2">&lt;assert.h&gt;</a> is included.
6995 2 The assert macro shall be implemented as a macro, not as an actual function. If the
6996 macro definition is suppressed in order to access an actual function, the behavior is
6997 undefined.
6998 <a name="7.2.1" href="#7.2.1"><b> 7.2.1 Program diagnostics</b></a>
6999 <a name="7.2.1.1" href="#7.2.1.1"><b> 7.2.1.1 The assert macro</b></a>
7000 <b> Synopsis</b>
7001 1 #include <a href="#7.2">&lt;assert.h&gt;</a>
7002 void assert(scalar expression);
7003 <b> Description</b>
7004 2 The assert macro puts diagnostic tests into programs; it expands to a void expression.
7005 When it is executed, if expression (which shall have a scalar type) is false (that is,
7006 compares equal to 0), the assert macro writes information about the particular call that
7007 failed (including the text of the argument, the name of the source file, the source line
7008 number, and the name of the enclosing function -- the latter are respectively the values of
7009 the preprocessing macros __FILE__ and __LINE__ and of the identifier
7010 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note165"><b>165)</b></a></sup> It
7011 then calls the abort function.
7012 <b> Returns</b>
7013 3 The assert macro returns no value.
7014 Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
7019 <sup><a name="note165" href="#note165"><b>165)</b></a></sup> The message written might be of the form:
7020 Assertion failed: expression, function abc, file xyz, line nnn.
7022 [<a name="p169" href="#p169">page 169</a>] (<a href="#Contents">Contents</a>)
7024 <a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic &lt;complex.h&gt;</b></a>
7025 <a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
7026 1 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
7027 arithmetic.<sup><a href="#note166"><b>166)</b></a></sup> Each synopsis specifies a family of functions consisting of a principal
7028 function with one or more double complex parameters and a double complex or
7029 double return value; and other functions with the same name but with f and l suffixes
7030 which are corresponding functions with float and long double parameters and
7031 return values.
7032 2 The macro
7033 complex
7034 expands to _Complex; the macro
7035 _Complex_I
7036 expands to a constant expression of type const float _Complex, with the value of
7037 the imaginary unit.<sup><a href="#note167"><b>167)</b></a></sup>
7038 3 The macros
7039 imaginary
7041 _Imaginary_I
7042 are defined if and only if the implementation supports imaginary types;<sup><a href="#note168"><b>168)</b></a></sup> if defined,
7043 they expand to _Imaginary and a constant expression of type const float
7044 _Imaginary with the value of the imaginary unit.
7045 4 The macro
7047 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
7048 defined, I shall expand to _Complex_I.
7049 5 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
7050 redefine the macros complex, imaginary, and I.
7051 Forward references: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
7055 <sup><a name="note166" href="#note166"><b>166)</b></a></sup> See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
7056 <sup><a name="note167" href="#note167"><b>167)</b></a></sup> The imaginary unit is a number i such that i 2 = -1.
7057 <sup><a name="note168" href="#note168"><b>168)</b></a></sup> A specification for imaginary types is in informative <a href="#G">annex G</a>.
7059 [<a name="p170" href="#p170">page 170</a>] (<a href="#Contents">Contents</a>)
7061 <a name="7.3.2" href="#7.3.2"><b> 7.3.2 Conventions</b></a>
7062 1 Values are interpreted as radians, not degrees. An implementation may set errno but is
7063 not required to.
7064 <a name="7.3.3" href="#7.3.3"><b> 7.3.3 Branch cuts</b></a>
7065 1 Some of the functions below have branch cuts, across which the function is
7066 discontinuous. For implementations with a signed zero (including all IEC 60559
7067 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
7068 one side of a cut from another so the function is continuous (except for format
7069 limitations) as the cut is approached from either side. For example, for the square root
7070 function, which has a branch cut along the negative real axis, the top of the cut, with
7071 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
7072 imaginary part -0, maps to the negative imaginary axis.
7073 2 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
7074 sides of branch cuts. These implementations shall map a cut so the function is continuous
7075 as the cut is approached coming around the finite endpoint of the cut in a counter
7076 clockwise direction. (Branch cuts for the functions specified here have just one finite
7077 endpoint.) For example, for the square root function, coming counter clockwise around
7078 the finite endpoint of the cut along the negative real axis approaches the cut from above,
7079 so the cut maps to the positive imaginary axis.
7080 <a name="7.3.4" href="#7.3.4"><b> 7.3.4 The CX_LIMITED_RANGE pragma</b></a>
7081 <b> Synopsis</b>
7082 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7083 #pragma STDC CX_LIMITED_RANGE on-off-switch
7084 <b> Description</b>
7085 2 The usual mathematical formulas for complex multiply, divide, and absolute value are
7086 problematic because of their treatment of infinities and because of undue overflow and
7087 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
7088 implementation that (where the state is ''on'') the usual mathematical formulas are
7089 acceptable.<sup><a href="#note169"><b>169)</b></a></sup> The pragma can occur either outside external declarations or preceding all
7090 explicit declarations and statements inside a compound statement. When outside external
7092 <sup><a name="note169" href="#note169"><b>169)</b></a></sup> The purpose of the pragma is to allow the implementation to use the formulas:
7093 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
7094 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
7095 | x + iy | = (sqrt) x 2 + y 2
7096 ???????????????
7097 where the programmer can determine they are safe.
7099 [<a name="p171" href="#p171">page 171</a>] (<a href="#Contents">Contents</a>)
7101 declarations, the pragma takes effect from its occurrence until another
7102 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
7103 When inside a compound statement, the pragma takes effect from its occurrence until
7104 another CX_LIMITED_RANGE pragma is encountered (including within a nested
7105 compound statement), or until the end of the compound statement; at the end of a
7106 compound statement the state for the pragma is restored to its condition just before the
7107 compound statement. If this pragma is used in any other context, the behavior is
7108 undefined. The default state for the pragma is ''off''.
7109 <a name="7.3.5" href="#7.3.5"><b> 7.3.5 Trigonometric functions</b></a>
7110 <a name="7.3.5.1" href="#7.3.5.1"><b> 7.3.5.1 The cacos functions</b></a>
7111 <b> Synopsis</b>
7112 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7113 double complex cacos(double complex z);
7114 float complex cacosf(float complex z);
7115 long double complex cacosl(long double complex z);
7116 <b> Description</b>
7117 2 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
7118 interval [-1, +1] along the real axis.
7119 <b> Returns</b>
7120 3 The cacos functions return the complex arc cosine value, in the range of a strip
7121 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
7122 real axis.
7123 <a name="7.3.5.2" href="#7.3.5.2"><b> 7.3.5.2 The casin functions</b></a>
7124 <b> Synopsis</b>
7125 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7126 double complex casin(double complex z);
7127 float complex casinf(float complex z);
7128 long double complex casinl(long double complex z);
7129 <b> Description</b>
7130 2 The casin functions compute the complex arc sine of z, with branch cuts outside the
7131 interval [-1, +1] along the real axis.
7132 <b> Returns</b>
7133 3 The casin functions return the complex arc sine value, in the range of a strip
7134 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
7135 along the real axis.
7137 [<a name="p172" href="#p172">page 172</a>] (<a href="#Contents">Contents</a>)
7139 <a name="7.3.5.3" href="#7.3.5.3"><b> 7.3.5.3 The catan functions</b></a>
7140 <b> Synopsis</b>
7141 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7142 double complex catan(double complex z);
7143 float complex catanf(float complex z);
7144 long double complex catanl(long double complex z);
7145 <b> Description</b>
7146 2 The catan functions compute the complex arc tangent of z, with branch cuts outside the
7147 interval [-i, +i] along the imaginary axis.
7148 <b> Returns</b>
7149 3 The catan functions return the complex arc tangent value, in the range of a strip
7150 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
7151 along the real axis.
7152 <a name="7.3.5.4" href="#7.3.5.4"><b> 7.3.5.4 The ccos functions</b></a>
7153 <b> Synopsis</b>
7154 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7155 double complex ccos(double complex z);
7156 float complex ccosf(float complex z);
7157 long double complex ccosl(long double complex z);
7158 <b> Description</b>
7159 2 The ccos functions compute the complex cosine of z.
7160 <b> Returns</b>
7161 3 The ccos functions return the complex cosine value.
7162 <a name="7.3.5.5" href="#7.3.5.5"><b> 7.3.5.5 The csin functions</b></a>
7163 <b> Synopsis</b>
7164 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7165 double complex csin(double complex z);
7166 float complex csinf(float complex z);
7167 long double complex csinl(long double complex z);
7168 <b> Description</b>
7169 2 The csin functions compute the complex sine of z.
7170 <b> Returns</b>
7171 3 The csin functions return the complex sine value.
7173 [<a name="p173" href="#p173">page 173</a>] (<a href="#Contents">Contents</a>)
7175 <a name="7.3.5.6" href="#7.3.5.6"><b> 7.3.5.6 The ctan functions</b></a>
7176 <b> Synopsis</b>
7177 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7178 double complex ctan(double complex z);
7179 float complex ctanf(float complex z);
7180 long double complex ctanl(long double complex z);
7181 <b> Description</b>
7182 2 The ctan functions compute the complex tangent of z.
7183 <b> Returns</b>
7184 3 The ctan functions return the complex tangent value.
7185 <a name="7.3.6" href="#7.3.6"><b> 7.3.6 Hyperbolic functions</b></a>
7186 <a name="7.3.6.1" href="#7.3.6.1"><b> 7.3.6.1 The cacosh functions</b></a>
7187 <b> Synopsis</b>
7188 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7189 double complex cacosh(double complex z);
7190 float complex cacoshf(float complex z);
7191 long double complex cacoshl(long double complex z);
7192 <b> Description</b>
7193 2 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
7194 cut at values less than 1 along the real axis.
7195 <b> Returns</b>
7196 3 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
7197 half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
7198 the imaginary axis.
7199 <a name="7.3.6.2" href="#7.3.6.2"><b> 7.3.6.2 The casinh functions</b></a>
7200 <b> Synopsis</b>
7201 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7202 double complex casinh(double complex z);
7203 float complex casinhf(float complex z);
7204 long double complex casinhl(long double complex z);
7205 <b> Description</b>
7206 2 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
7207 outside the interval [-i, +i] along the imaginary axis.
7209 [<a name="p174" href="#p174">page 174</a>] (<a href="#Contents">Contents</a>)
7211 <b> Returns</b>
7212 3 The casinh functions return the complex arc hyperbolic sine value, in the range of a
7213 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
7214 along the imaginary axis.
7215 <a name="7.3.6.3" href="#7.3.6.3"><b> 7.3.6.3 The catanh functions</b></a>
7216 <b> Synopsis</b>
7217 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7218 double complex catanh(double complex z);
7219 float complex catanhf(float complex z);
7220 long double complex catanhl(long double complex z);
7221 <b> Description</b>
7222 2 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
7223 cuts outside the interval [-1, +1] along the real axis.
7224 <b> Returns</b>
7225 3 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
7226 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
7227 along the imaginary axis.
7228 <a name="7.3.6.4" href="#7.3.6.4"><b> 7.3.6.4 The ccosh functions</b></a>
7229 <b> Synopsis</b>
7230 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7231 double complex ccosh(double complex z);
7232 float complex ccoshf(float complex z);
7233 long double complex ccoshl(long double complex z);
7234 <b> Description</b>
7235 2 The ccosh functions compute the complex hyperbolic cosine of z.
7236 <b> Returns</b>
7237 3 The ccosh functions return the complex hyperbolic cosine value.
7238 <a name="7.3.6.5" href="#7.3.6.5"><b> 7.3.6.5 The csinh functions</b></a>
7239 <b> Synopsis</b>
7240 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7241 double complex csinh(double complex z);
7242 float complex csinhf(float complex z);
7243 long double complex csinhl(long double complex z);
7245 [<a name="p175" href="#p175">page 175</a>] (<a href="#Contents">Contents</a>)
7247 <b> Description</b>
7248 2 The csinh functions compute the complex hyperbolic sine of z.
7249 <b> Returns</b>
7250 3 The csinh functions return the complex hyperbolic sine value.
7251 <a name="7.3.6.6" href="#7.3.6.6"><b> 7.3.6.6 The ctanh functions</b></a>
7252 <b> Synopsis</b>
7253 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7254 double complex ctanh(double complex z);
7255 float complex ctanhf(float complex z);
7256 long double complex ctanhl(long double complex z);
7257 <b> Description</b>
7258 2 The ctanh functions compute the complex hyperbolic tangent of z.
7259 <b> Returns</b>
7260 3 The ctanh functions return the complex hyperbolic tangent value.
7261 <a name="7.3.7" href="#7.3.7"><b> 7.3.7 Exponential and logarithmic functions</b></a>
7262 <a name="7.3.7.1" href="#7.3.7.1"><b> 7.3.7.1 The cexp functions</b></a>
7263 <b> Synopsis</b>
7264 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7265 double complex cexp(double complex z);
7266 float complex cexpf(float complex z);
7267 long double complex cexpl(long double complex z);
7268 <b> Description</b>
7269 2 The cexp functions compute the complex base-e exponential of z.
7270 <b> Returns</b>
7271 3 The cexp functions return the complex base-e exponential value.
7272 <a name="7.3.7.2" href="#7.3.7.2"><b> 7.3.7.2 The clog functions</b></a>
7273 <b> Synopsis</b>
7274 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7275 double complex clog(double complex z);
7276 float complex clogf(float complex z);
7277 long double complex clogl(long double complex z);
7279 [<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
7281 <b> Description</b>
7282 2 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
7283 cut along the negative real axis.
7284 <b> Returns</b>
7285 3 The clog functions return the complex natural logarithm value, in the range of a strip
7286 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
7287 imaginary axis.
7288 <a name="7.3.8" href="#7.3.8"><b> 7.3.8 Power and absolute-value functions</b></a>
7289 <a name="7.3.8.1" href="#7.3.8.1"><b> 7.3.8.1 The cabs functions</b></a>
7290 <b> Synopsis</b>
7291 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7292 double cabs(double complex z);
7293 float cabsf(float complex z);
7294 long double cabsl(long double complex z);
7295 <b> Description</b>
7296 2 The cabs functions compute the complex absolute value (also called norm, modulus, or
7297 magnitude) of z.
7298 <b> Returns</b>
7299 3 The cabs functions return the complex absolute value.
7300 <a name="7.3.8.2" href="#7.3.8.2"><b> 7.3.8.2 The cpow functions</b></a>
7301 <b> Synopsis</b>
7302 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7303 double complex cpow(double complex x, double complex y);
7304 float complex cpowf(float complex x, float complex y);
7305 long double complex cpowl(long double complex x,
7306 long double complex y);
7307 <b> Description</b>
7308 2 The cpow functions compute the complex power function xy , with a branch cut for the
7309 first parameter along the negative real axis.
7310 <b> Returns</b>
7311 3 The cpow functions return the complex power function value.
7313 [<a name="p177" href="#p177">page 177</a>] (<a href="#Contents">Contents</a>)
7315 <a name="7.3.8.3" href="#7.3.8.3"><b> 7.3.8.3 The csqrt functions</b></a>
7316 <b> Synopsis</b>
7317 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7318 double complex csqrt(double complex z);
7319 float complex csqrtf(float complex z);
7320 long double complex csqrtl(long double complex z);
7321 <b> Description</b>
7322 2 The csqrt functions compute the complex square root of z, with a branch cut along the
7323 negative real axis.
7324 <b> Returns</b>
7325 3 The csqrt functions return the complex square root value, in the range of the right half-
7326 plane (including the imaginary axis).
7327 <a name="7.3.9" href="#7.3.9"><b> 7.3.9 Manipulation functions</b></a>
7328 <a name="7.3.9.1" href="#7.3.9.1"><b> 7.3.9.1 The carg functions</b></a>
7329 <b> Synopsis</b>
7330 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7331 double carg(double complex z);
7332 float cargf(float complex z);
7333 long double cargl(long double complex z);
7334 <b> Description</b>
7335 2 The carg functions compute the argument (also called phase angle) of z, with a branch
7336 cut along the negative real axis.
7337 <b> Returns</b>
7338 3 The carg functions return the value of the argument in the interval [-pi , +pi ].
7339 <a name="7.3.9.2" href="#7.3.9.2"><b> 7.3.9.2 The cimag functions</b></a>
7340 <b> Synopsis</b>
7341 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7342 double cimag(double complex z);
7343 float cimagf(float complex z);
7344 long double cimagl(long double complex z);
7346 [<a name="p178" href="#p178">page 178</a>] (<a href="#Contents">Contents</a>)
7348 <b> Description</b>
7349 2 The cimag functions compute the imaginary part of z.<sup><a href="#note170"><b>170)</b></a></sup>
7350 <b> Returns</b>
7351 3 The cimag functions return the imaginary part value (as a real).
7352 <a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The conj functions</b></a>
7353 <b> Synopsis</b>
7354 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7355 double complex conj(double complex z);
7356 float complex conjf(float complex z);
7357 long double complex conjl(long double complex z);
7358 <b> Description</b>
7359 2 The conj functions compute the complex conjugate of z, by reversing the sign of its
7360 imaginary part.
7361 <b> Returns</b>
7362 3 The conj functions return the complex conjugate value.
7363 <a name="7.3.9.4" href="#7.3.9.4"><b> 7.3.9.4 The cproj functions</b></a>
7364 <b> Synopsis</b>
7365 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7366 double complex cproj(double complex z);
7367 float complex cprojf(float complex z);
7368 long double complex cprojl(long double complex z);
7369 <b> Description</b>
7370 2 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
7371 z except that all complex infinities (even those with one infinite part and one NaN part)
7372 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
7373 equivalent to
7374 INFINITY + I * copysign(0.0, cimag(z))
7375 <b> Returns</b>
7376 3 The cproj functions return the value of the projection onto the Riemann sphere.
7381 <sup><a name="note170" href="#note170"><b>170)</b></a></sup> For a variable z of complex type, z == creal(z) + cimag(z)*I.
7383 [<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
7385 <a name="7.3.9.5" href="#7.3.9.5"><b> 7.3.9.5 The creal functions</b></a>
7386 <b> Synopsis</b>
7387 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
7388 double creal(double complex z);
7389 float crealf(float complex z);
7390 long double creall(long double complex z);
7391 <b> Description</b>
7392 2 The creal functions compute the real part of z.<sup><a href="#note171"><b>171)</b></a></sup>
7393 <b> Returns</b>
7394 3 The creal functions return the real part value.
7399 <sup><a name="note171" href="#note171"><b>171)</b></a></sup> For a variable z of complex type, z == creal(z) + cimag(z)*I.
7401 [<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
7403 <a name="7.4" href="#7.4"><b> 7.4 Character handling &lt;ctype.h&gt;</b></a>
7404 1 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
7405 characters.<sup><a href="#note172"><b>172)</b></a></sup> In all cases the argument is an int, the value of which shall be
7406 representable as an unsigned char or shall equal the value of the macro EOF. If the
7407 argument has any other value, the behavior is undefined.
7408 2 The behavior of these functions is affected by the current locale. Those functions that
7409 have locale-specific aspects only when not in the "C" locale are noted below.
7410 3 The term printing character refers to a member of a locale-specific set of characters, each
7411 of which occupies one printing position on a display device; the term control character
7412 refers to a member of a locale-specific set of characters that are not printing
7413 characters.<sup><a href="#note173"><b>173)</b></a></sup> All letters and digits are printing characters.
7414 Forward references: EOF (<a href="#7.19.1">7.19.1</a>), localization (<a href="#7.11">7.11</a>).
7415 <a name="7.4.1" href="#7.4.1"><b> 7.4.1 Character classification functions</b></a>
7416 1 The functions in this subclause return nonzero (true) if and only if the value of the
7417 argument c conforms to that in the description of the function.
7418 <a name="7.4.1.1" href="#7.4.1.1"><b> 7.4.1.1 The isalnum function</b></a>
7419 <b> Synopsis</b>
7420 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7421 int isalnum(int c);
7422 <b> Description</b>
7423 2 The isalnum function tests for any character for which isalpha or isdigit is true.
7424 <a name="7.4.1.2" href="#7.4.1.2"><b> 7.4.1.2 The isalpha function</b></a>
7425 <b> Synopsis</b>
7426 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7427 int isalpha(int c);
7428 <b> Description</b>
7429 2 The isalpha function tests for any character for which isupper or islower is true,
7430 or any character that is one of a locale-specific set of alphabetic characters for which
7434 <sup><a name="note172" href="#note172"><b>172)</b></a></sup> See ''future library directions'' (<a href="#7.26.2">7.26.2</a>).
7435 <sup><a name="note173" href="#note173"><b>173)</b></a></sup> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
7436 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
7437 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
7439 [<a name="p181" href="#p181">page 181</a>] (<a href="#Contents">Contents</a>)
7441 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note174"><b>174)</b></a></sup> In the "C" locale,
7442 isalpha returns true only for the characters for which isupper or islower is true.
7443 <a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
7444 <b> Synopsis</b>
7445 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7446 int isblank(int c);
7447 <b> Description</b>
7448 2 The isblank function tests for any character that is a standard blank character or is one
7449 of a locale-specific set of characters for which isspace is true and that is used to
7450 separate words within a line of text. The standard blank characters are the following:
7451 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
7452 for the standard blank characters.
7453 <a name="7.4.1.4" href="#7.4.1.4"><b> 7.4.1.4 The iscntrl function</b></a>
7454 <b> Synopsis</b>
7455 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7456 int iscntrl(int c);
7457 <b> Description</b>
7458 2 The iscntrl function tests for any control character.
7459 <a name="7.4.1.5" href="#7.4.1.5"><b> 7.4.1.5 The isdigit function</b></a>
7460 <b> Synopsis</b>
7461 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7462 int isdigit(int c);
7463 <b> Description</b>
7464 2 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
7465 <a name="7.4.1.6" href="#7.4.1.6"><b> 7.4.1.6 The isgraph function</b></a>
7466 <b> Synopsis</b>
7467 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7468 int isgraph(int c);
7473 <sup><a name="note174" href="#note174"><b>174)</b></a></sup> The functions islower and isupper test true or false separately for each of these additional
7474 characters; all four combinations are possible.
7476 [<a name="p182" href="#p182">page 182</a>] (<a href="#Contents">Contents</a>)
7478 <b> Description</b>
7479 2 The isgraph function tests for any printing character except space (' ').
7480 <a name="7.4.1.7" href="#7.4.1.7"><b> 7.4.1.7 The islower function</b></a>
7481 <b> Synopsis</b>
7482 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7483 int islower(int c);
7484 <b> Description</b>
7485 2 The islower function tests for any character that is a lowercase letter or is one of a
7486 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
7487 isspace is true. In the "C" locale, islower returns true only for the lowercase
7488 letters (as defined in <a href="#5.2.1">5.2.1</a>).
7489 <a name="7.4.1.8" href="#7.4.1.8"><b> 7.4.1.8 The isprint function</b></a>
7490 <b> Synopsis</b>
7491 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7492 int isprint(int c);
7493 <b> Description</b>
7494 2 The isprint function tests for any printing character including space (' ').
7495 <a name="7.4.1.9" href="#7.4.1.9"><b> 7.4.1.9 The ispunct function</b></a>
7496 <b> Synopsis</b>
7497 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7498 int ispunct(int c);
7499 <b> Description</b>
7500 2 The ispunct function tests for any printing character that is one of a locale-specific set
7501 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
7502 locale, ispunct returns true for every printing character for which neither isspace
7503 nor isalnum is true.
7504 <a name="7.4.1.10" href="#7.4.1.10"><b> 7.4.1.10 The isspace function</b></a>
7505 <b> Synopsis</b>
7506 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7507 int isspace(int c);
7508 <b> Description</b>
7509 2 The isspace function tests for any character that is a standard white-space character or
7510 is one of a locale-specific set of characters for which isalnum is false. The standard
7512 [<a name="p183" href="#p183">page 183</a>] (<a href="#Contents">Contents</a>)
7514 white-space characters are the following: space (' '), form feed ('\f'), new-line
7515 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
7516 "C" locale, isspace returns true only for the standard white-space characters.
7517 <a name="7.4.1.11" href="#7.4.1.11"><b> 7.4.1.11 The isupper function</b></a>
7518 <b> Synopsis</b>
7519 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7520 int isupper(int c);
7521 <b> Description</b>
7522 2 The isupper function tests for any character that is an uppercase letter or is one of a
7523 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
7524 isspace is true. In the "C" locale, isupper returns true only for the uppercase
7525 letters (as defined in <a href="#5.2.1">5.2.1</a>).
7526 <a name="7.4.1.12" href="#7.4.1.12"><b> 7.4.1.12 The isxdigit function</b></a>
7527 <b> Synopsis</b>
7528 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7529 int isxdigit(int c);
7530 <b> Description</b>
7531 2 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
7532 <a name="7.4.2" href="#7.4.2"><b> 7.4.2 Character case mapping functions</b></a>
7533 <a name="7.4.2.1" href="#7.4.2.1"><b> 7.4.2.1 The tolower function</b></a>
7534 <b> Synopsis</b>
7535 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7536 int tolower(int c);
7537 <b> Description</b>
7538 2 The tolower function converts an uppercase letter to a corresponding lowercase letter.
7539 <b> Returns</b>
7540 3 If the argument is a character for which isupper is true and there are one or more
7541 corresponding characters, as specified by the current locale, for which islower is true,
7542 the tolower function returns one of the corresponding characters (always the same one
7543 for any given locale); otherwise, the argument is returned unchanged.
7545 [<a name="p184" href="#p184">page 184</a>] (<a href="#Contents">Contents</a>)
7547 <a name="7.4.2.2" href="#7.4.2.2"><b> 7.4.2.2 The toupper function</b></a>
7548 <b> Synopsis</b>
7549 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
7550 int toupper(int c);
7551 <b> Description</b>
7552 2 The toupper function converts a lowercase letter to a corresponding uppercase letter.
7553 <b> Returns</b>
7554 3 If the argument is a character for which islower is true and there are one or more
7555 corresponding characters, as specified by the current locale, for which isupper is true,
7556 the toupper function returns one of the corresponding characters (always the same one
7557 for any given locale); otherwise, the argument is returned unchanged.
7559 [<a name="p185" href="#p185">page 185</a>] (<a href="#Contents">Contents</a>)
7561 <a name="7.5" href="#7.5"><b> 7.5 Errors &lt;errno.h&gt;</b></a>
7562 1 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
7563 conditions.
7564 2 The macros are
7565 EDOM
7566 EILSEQ
7567 ERANGE
7568 which expand to integer constant expressions with type int, distinct positive values, and
7569 which are suitable for use in #if preprocessing directives; and
7570 errno
7571 which expands to a modifiable lvalue<sup><a href="#note175"><b>175)</b></a></sup> that has type int, the value of which is set to a
7572 positive error number by several library functions. It is unspecified whether errno is a
7573 macro or an identifier declared with external linkage. If a macro definition is suppressed
7574 in order to access an actual object, or a program defines an identifier with the name
7575 errno, the behavior is undefined.
7576 3 The value of errno is zero at program startup, but is never set to zero by any library
7577 function.<sup><a href="#note176"><b>176)</b></a></sup> The value of errno may be set to nonzero by a library function call
7578 whether or not there is an error, provided the use of errno is not documented in the
7579 description of the function in this International Standard.
7580 4 Additional macro definitions, beginning with E and a digit or E and an uppercase
7581 letter,<sup><a href="#note177"><b>177)</b></a></sup> may also be specified by the implementation.
7586 <sup><a name="note175" href="#note175"><b>175)</b></a></sup> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
7587 resulting from a function call (for example, *errno()).
7588 <sup><a name="note176" href="#note176"><b>176)</b></a></sup> Thus, a program that uses errno for error checking should set it to zero before a library function call,
7589 then inspect it before a subsequent library function call. Of course, a library function can save the
7590 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
7591 value is still zero just before the return.
7592 <sup><a name="note177" href="#note177"><b>177)</b></a></sup> See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
7594 [<a name="p186" href="#p186">page 186</a>] (<a href="#Contents">Contents</a>)
7596 <a name="7.6" href="#7.6"><b> 7.6 Floating-point environment &lt;fenv.h&gt;</b></a>
7597 1 The header <a href="#7.6">&lt;fenv.h&gt;</a> declares two types and several macros and functions to provide
7598 access to the floating-point environment. The floating-point environment refers
7599 collectively to any floating-point status flags and control modes supported by the
7600 implementation.<sup><a href="#note178"><b>178)</b></a></sup> A floating-point status flag is a system variable whose value is set
7601 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
7602 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note179"><b>179)</b></a></sup> A floating-
7603 point control mode is a system variable whose value may be set by the user to affect the
7604 subsequent behavior of floating-point arithmetic.
7605 2 Certain programming conventions support the intended model of use for the floating-
7606 point environment:<sup><a href="#note180"><b>180)</b></a></sup>
7607 -- a function call does not alter its caller's floating-point control modes, clear its caller's
7608 floating-point status flags, nor depend on the state of its caller's floating-point status
7609 flags unless the function is so documented;
7610 -- a function call is assumed to require default floating-point control modes, unless its
7611 documentation promises otherwise;
7612 -- a function call is assumed to have the potential for raising floating-point exceptions,
7613 unless its documentation promises otherwise.
7614 3 The type
7615 fenv_t
7616 represents the entire floating-point environment.
7617 4 The type
7618 fexcept_t
7619 represents the floating-point status flags collectively, including any status the
7620 implementation associates with the flags.
7625 <sup><a name="note178" href="#note178"><b>178)</b></a></sup> This header is designed to support the floating-point exception status flags and directed-rounding
7626 control modes required by IEC 60559, and other similar floating-point state information. Also it is
7627 designed to facilitate code portability among all systems.
7628 <sup><a name="note179" href="#note179"><b>179)</b></a></sup> A floating-point status flag is not an object and can be set more than once within an expression.
7629 <sup><a name="note180" href="#note180"><b>180)</b></a></sup> With these conventions, a programmer can safely assume default floating-point control modes (or be
7630 unaware of them). The responsibilities associated with accessing the floating-point environment fall
7631 on the programmer or program that does so explicitly.
7633 [<a name="p187" href="#p187">page 187</a>] (<a href="#Contents">Contents</a>)
7635 5 Each of the macros
7636 FE_DIVBYZERO
7637 FE_INEXACT
7638 FE_INVALID
7639 FE_OVERFLOW
7640 FE_UNDERFLOW
7641 is defined if and only if the implementation supports the floating-point exception by
7642 means of the functions in 7.6.2.<sup><a href="#note181"><b>181)</b></a></sup> Additional implementation-defined floating-point
7643 exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
7644 be specified by the implementation. The defined macros expand to integer constant
7645 expressions with values such that bitwise ORs of all combinations of the macros result in
7646 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
7647 zero.<sup><a href="#note182"><b>182)</b></a></sup>
7648 6 The macro
7649 FE_ALL_EXCEPT
7650 is simply the bitwise OR of all floating-point exception macros defined by the
7651 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
7652 7 Each of the macros
7653 FE_DOWNWARD
7654 FE_TONEAREST
7655 FE_TOWARDZERO
7656 FE_UPWARD
7657 is defined if and only if the implementation supports getting and setting the represented
7658 rounding direction by means of the fegetround and fesetround functions.
7659 Additional implementation-defined rounding directions, with macro definitions beginning
7660 with FE_ and an uppercase letter, may also be specified by the implementation. The
7661 defined macros expand to integer constant expressions whose values are distinct
7662 nonnegative values.<sup><a href="#note183"><b>183)</b></a></sup>
7663 8 The macro
7667 <sup><a name="note181" href="#note181"><b>181)</b></a></sup> The implementation supports an exception if there are circumstances where a call to at least one of the
7668 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
7669 all the functions to succeed all the time.
7670 <sup><a name="note182" href="#note182"><b>182)</b></a></sup> The macros should be distinct powers of two.
7671 <sup><a name="note183" href="#note183"><b>183)</b></a></sup> Even though the rounding direction macros may expand to constants corresponding to the values of
7672 FLT_ROUNDS, they are not required to do so.
7674 [<a name="p188" href="#p188">page 188</a>] (<a href="#Contents">Contents</a>)
7676 FE_DFL_ENV
7677 represents the default floating-point environment -- the one installed at program startup
7678 -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
7679 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
7680 9 Additional implementation-defined environments, with macro definitions beginning with
7681 FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
7682 also be specified by the implementation.
7683 <a name="7.6.1" href="#7.6.1"><b> 7.6.1 The FENV_ACCESS pragma</b></a>
7684 <b> Synopsis</b>
7685 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7686 #pragma STDC FENV_ACCESS on-off-switch
7687 <b> Description</b>
7688 2 The FENV_ACCESS pragma provides a means to inform the implementation when a
7689 program might access the floating-point environment to test floating-point status flags or
7690 run under non-default floating-point control modes.<sup><a href="#note184"><b>184)</b></a></sup> The pragma shall occur either
7691 outside external declarations or preceding all explicit declarations and statements inside a
7692 compound statement. When outside external declarations, the pragma takes effect from
7693 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
7694 the translation unit. When inside a compound statement, the pragma takes effect from its
7695 occurrence until another FENV_ACCESS pragma is encountered (including within a
7696 nested compound statement), or until the end of the compound statement; at the end of a
7697 compound statement the state for the pragma is restored to its condition just before the
7698 compound statement. If this pragma is used in any other context, the behavior is
7699 undefined. If part of a program tests floating-point status flags, sets floating-point control
7700 modes, or runs under non-default mode settings, but was translated with the state for the
7701 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
7702 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
7703 the program translated with FENV_ACCESS ''off'' to a part translated with
7704 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
7705 floating-point control modes have their default settings.)
7710 <sup><a name="note184" href="#note184"><b>184)</b></a></sup> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
7711 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
7712 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
7713 modes are in effect and the flags are not tested.
7715 [<a name="p189" href="#p189">page 189</a>] (<a href="#Contents">Contents</a>)
7717 3 EXAMPLE
7718 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7719 void f(double x)
7721 #pragma STDC FENV_ACCESS ON
7722 void g(double);
7723 void h(double);
7724 /* ... */
7725 g(x + 1);
7726 h(x + 1);
7727 /* ... */
7729 4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
7730 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
7731 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note185"><b>185)</b></a></sup>
7733 <a name="7.6.2" href="#7.6.2"><b> 7.6.2 Floating-point exceptions</b></a>
7734 1 The following functions provide access to the floating-point status flags.<sup><a href="#note186"><b>186)</b></a></sup> The int
7735 input argument for the functions represents a subset of floating-point exceptions, and can
7736 be zero or the bitwise OR of one or more floating-point exception macros, for example
7737 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
7738 functions is undefined.
7739 <a name="7.6.2.1" href="#7.6.2.1"><b> 7.6.2.1 The feclearexcept function</b></a>
7740 <b> Synopsis</b>
7741 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7742 int feclearexcept(int excepts);
7743 <b> Description</b>
7744 2 The feclearexcept function attempts to clear the supported floating-point exceptions
7745 represented by its argument.
7746 <b> Returns</b>
7747 3 The feclearexcept function returns zero if the excepts argument is zero or if all
7748 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
7751 <sup><a name="note185" href="#note185"><b>185)</b></a></sup> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
7752 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
7753 ''off'', just one evaluation of x + 1 would suffice.
7754 <sup><a name="note186" href="#note186"><b>186)</b></a></sup> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
7755 abstraction of flags that are either set or clear. An implementation may endow floating-point status
7756 flags with more information -- for example, the address of the code which first raised the floating-
7757 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
7758 content of flags.
7760 [<a name="p190" href="#p190">page 190</a>] (<a href="#Contents">Contents</a>)
7762 <a name="7.6.2.2" href="#7.6.2.2"><b> 7.6.2.2 The fegetexceptflag function</b></a>
7763 <b> Synopsis</b>
7764 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7765 int fegetexceptflag(fexcept_t *flagp,
7766 int excepts);
7767 <b> Description</b>
7768 2 The fegetexceptflag function attempts to store an implementation-defined
7769 representation of the states of the floating-point status flags indicated by the argument
7770 excepts in the object pointed to by the argument flagp.
7771 <b> Returns</b>
7772 3 The fegetexceptflag function returns zero if the representation was successfully
7773 stored. Otherwise, it returns a nonzero value.
7774 <a name="7.6.2.3" href="#7.6.2.3"><b> 7.6.2.3 The feraiseexcept function</b></a>
7775 <b> Synopsis</b>
7776 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7777 int feraiseexcept(int excepts);
7778 <b> Description</b>
7779 2 The feraiseexcept function attempts to raise the supported floating-point exceptions
7780 represented by its argument.<sup><a href="#note187"><b>187)</b></a></sup> The order in which these floating-point exceptions are
7781 raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
7782 additionally raises the ''inexact'' floating-point exception whenever it raises the
7783 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
7784 <b> Returns</b>
7785 3 The feraiseexcept function returns zero if the excepts argument is zero or if all
7786 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
7791 <sup><a name="note187" href="#note187"><b>187)</b></a></sup> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
7792 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
7793 in <a href="#F.7.6">F.7.6</a> is in the same spirit.
7795 [<a name="p191" href="#p191">page 191</a>] (<a href="#Contents">Contents</a>)
7797 <a name="7.6.2.4" href="#7.6.2.4"><b> 7.6.2.4 The fesetexceptflag function</b></a>
7798 <b> Synopsis</b>
7799 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7800 int fesetexceptflag(const fexcept_t *flagp,
7801 int excepts);
7802 <b> Description</b>
7803 2 The fesetexceptflag function attempts to set the floating-point status flags
7804 indicated by the argument excepts to the states stored in the object pointed to by
7805 flagp. The value of *flagp shall have been set by a previous call to
7806 fegetexceptflag whose second argument represented at least those floating-point
7807 exceptions represented by the argument excepts. This function does not raise floating-
7808 point exceptions, but only sets the state of the flags.
7809 <b> Returns</b>
7810 3 The fesetexceptflag function returns zero if the excepts argument is zero or if
7811 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
7812 a nonzero value.
7813 <a name="7.6.2.5" href="#7.6.2.5"><b> 7.6.2.5 The fetestexcept function</b></a>
7814 <b> Synopsis</b>
7815 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7816 int fetestexcept(int excepts);
7817 <b> Description</b>
7818 2 The fetestexcept function determines which of a specified subset of the floating-
7819 point exception flags are currently set. The excepts argument specifies the floating-
7820 point status flags to be queried.<sup><a href="#note188"><b>188)</b></a></sup>
7821 <b> Returns</b>
7822 3 The fetestexcept function returns the value of the bitwise OR of the floating-point
7823 exception macros corresponding to the currently set floating-point exceptions included in
7824 excepts.
7825 4 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
7830 <sup><a name="note188" href="#note188"><b>188)</b></a></sup> This mechanism allows testing several floating-point exceptions with just one function call.
7832 [<a name="p192" href="#p192">page 192</a>] (<a href="#Contents">Contents</a>)
7834 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7835 /* ... */
7837 #pragma STDC FENV_ACCESS ON
7838 int set_excepts;
7839 feclearexcept(FE_INVALID | FE_OVERFLOW);
7840 // maybe raise exceptions
7841 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
7842 if (set_excepts &amp; FE_INVALID) f();
7843 if (set_excepts &amp; FE_OVERFLOW) g();
7844 /* ... */
7847 <a name="7.6.3" href="#7.6.3"><b> 7.6.3 Rounding</b></a>
7848 1 The fegetround and fesetround functions provide control of rounding direction
7849 modes.
7850 <a name="7.6.3.1" href="#7.6.3.1"><b> 7.6.3.1 The fegetround function</b></a>
7851 <b> Synopsis</b>
7852 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7853 int fegetround(void);
7854 <b> Description</b>
7855 2 The fegetround function gets the current rounding direction.
7856 <b> Returns</b>
7857 3 The fegetround function returns the value of the rounding direction macro
7858 representing the current rounding direction or a negative value if there is no such
7859 rounding direction macro or the current rounding direction is not determinable.
7860 <a name="7.6.3.2" href="#7.6.3.2"><b> 7.6.3.2 The fesetround function</b></a>
7861 <b> Synopsis</b>
7862 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7863 int fesetround(int round);
7864 <b> Description</b>
7865 2 The fesetround function establishes the rounding direction represented by its
7866 argument round. If the argument is not equal to the value of a rounding direction macro,
7867 the rounding direction is not changed.
7868 <b> Returns</b>
7869 3 The fesetround function returns zero if and only if the requested rounding direction
7870 was established.
7872 [<a name="p193" href="#p193">page 193</a>] (<a href="#Contents">Contents</a>)
7874 4 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
7875 rounding direction fails.
7876 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7877 #include <a href="#7.2">&lt;assert.h&gt;</a>
7878 void f(int round_dir)
7880 #pragma STDC FENV_ACCESS ON
7881 int save_round;
7882 int setround_ok;
7883 save_round = fegetround();
7884 setround_ok = fesetround(round_dir);
7885 assert(setround_ok == 0);
7886 /* ... */
7887 fesetround(save_round);
7888 /* ... */
7891 <a name="7.6.4" href="#7.6.4"><b> 7.6.4 Environment</b></a>
7892 1 The functions in this section manage the floating-point environment -- status flags and
7893 control modes -- as one entity.
7894 <a name="7.6.4.1" href="#7.6.4.1"><b> 7.6.4.1 The fegetenv function</b></a>
7895 <b> Synopsis</b>
7896 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7897 int fegetenv(fenv_t *envp);
7898 <b> Description</b>
7899 2 The fegetenv function attempts to store the current floating-point environment in the
7900 object pointed to by envp.
7901 <b> Returns</b>
7902 3 The fegetenv function returns zero if the environment was successfully stored.
7903 Otherwise, it returns a nonzero value.
7904 <a name="7.6.4.2" href="#7.6.4.2"><b> 7.6.4.2 The feholdexcept function</b></a>
7905 <b> Synopsis</b>
7906 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7907 int feholdexcept(fenv_t *envp);
7908 <b> Description</b>
7909 2 The feholdexcept function saves the current floating-point environment in the object
7910 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
7911 (continue on floating-point exceptions) mode, if available, for all floating-point
7912 exceptions.<sup><a href="#note189"><b>189)</b></a></sup>
7914 [<a name="p194" href="#p194">page 194</a>] (<a href="#Contents">Contents</a>)
7916 <b> Returns</b>
7917 3 The feholdexcept function returns zero if and only if non-stop floating-point
7918 exception handling was successfully installed.
7919 <a name="7.6.4.3" href="#7.6.4.3"><b> 7.6.4.3 The fesetenv function</b></a>
7920 <b> Synopsis</b>
7921 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7922 int fesetenv(const fenv_t *envp);
7923 <b> Description</b>
7924 2 The fesetenv function attempts to establish the floating-point environment represented
7925 by the object pointed to by envp. The argument envp shall point to an object set by a
7926 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
7927 Note that fesetenv merely installs the state of the floating-point status flags
7928 represented through its argument, and does not raise these floating-point exceptions.
7929 <b> Returns</b>
7930 3 The fesetenv function returns zero if the environment was successfully established.
7931 Otherwise, it returns a nonzero value.
7932 <a name="7.6.4.4" href="#7.6.4.4"><b> 7.6.4.4 The feupdateenv function</b></a>
7933 <b> Synopsis</b>
7934 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7935 int feupdateenv(const fenv_t *envp);
7936 <b> Description</b>
7937 2 The feupdateenv function attempts to save the currently raised floating-point
7938 exceptions in its automatic storage, install the floating-point environment represented by
7939 the object pointed to by envp, and then raise the saved floating-point exceptions. The
7940 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
7941 or equal a floating-point environment macro.
7942 <b> Returns</b>
7943 3 The feupdateenv function returns zero if all the actions were successfully carried out.
7944 Otherwise, it returns a nonzero value.
7949 <sup><a name="note189" href="#note189"><b>189)</b></a></sup> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
7950 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
7951 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
7952 function to write routines that hide spurious floating-point exceptions from their callers.
7954 [<a name="p195" href="#p195">page 195</a>] (<a href="#Contents">Contents</a>)
7956 4 EXAMPLE Hide spurious underflow floating-point exceptions:
7957 #include <a href="#7.6">&lt;fenv.h&gt;</a>
7958 double f(double x)
7960 #pragma STDC FENV_ACCESS ON
7961 double result;
7962 fenv_t save_env;
7963 if (feholdexcept(&amp;save_env))
7964 return /* indication of an environmental problem */;
7965 // compute result
7966 if (/* test spurious underflow */)
7967 if (feclearexcept(FE_UNDERFLOW))
7968 return /* indication of an environmental problem */;
7969 if (feupdateenv(&amp;save_env))
7970 return /* indication of an environmental problem */;
7971 return result;
7974 [<a name="p196" href="#p196">page 196</a>] (<a href="#Contents">Contents</a>)
7976 <a name="7.7" href="#7.7"><b> 7.7 Characteristics of floating types &lt;float.h&gt;</b></a>
7977 1 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
7978 parameters of the standard floating-point types.
7979 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
7980 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
7982 [<a name="p197" href="#p197">page 197</a>] (<a href="#Contents">Contents</a>)
7984 <a name="7.8" href="#7.8"><b> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
7985 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
7986 additional facilities provided by hosted implementations.
7987 2 It declares functions for manipulating greatest-width integers and converting numeric
7988 character strings to greatest-width integers, and it declares the type
7989 imaxdiv_t
7990 which is a structure type that is the type of the value returned by the imaxdiv function.
7991 For each type declared in <a href="#7.18">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
7992 specifiers for use with the formatted input/output functions.<sup><a href="#note190"><b>190)</b></a></sup>
7993 Forward references: integer types <a href="#7.18">&lt;stdint.h&gt;</a> (<a href="#7.18">7.18</a>), formatted input/output
7994 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>).
7995 <a name="7.8.1" href="#7.8.1"><b> 7.8.1 Macros for format specifiers</b></a>
7996 1 Each of the following object-like macros<sup><a href="#note191"><b>191)</b></a></sup> expands to a character string literal
7997 containing a conversion specifier, possibly modified by a length modifier, suitable for use
7998 within the format argument of a formatted input/output function when converting the
7999 corresponding integer type. These macro names have the general form of PRI (character
8000 string literals for the fprintf and fwprintf family) or SCN (character string literals
8001 for the fscanf and fwscanf family),<sup><a href="#note192"><b>192)</b></a></sup> followed by the conversion specifier,
8002 followed by a name corresponding to a similar type name in <a href="#7.18.1">7.18.1</a>. In these names, N
8003 represents the width of the type as described in <a href="#7.18.1">7.18.1</a>. For example, PRIdFAST32 can
8004 be used in a format string to print the value of an integer of type int_fast32_t.
8005 2 The fprintf macros for signed integers are:
8006 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
8007 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
8012 <sup><a name="note190" href="#note190"><b>190)</b></a></sup> See ''future library directions'' (<a href="#7.26.4">7.26.4</a>).
8013 <sup><a name="note191" href="#note191"><b>191)</b></a></sup> C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined
8014 before <a href="#7.8">&lt;inttypes.h&gt;</a> is included.
8015 <sup><a name="note192" href="#note192"><b>192)</b></a></sup> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
8016 different format specifiers may be required for fprintf and fscanf, even when the type is the
8017 same.
8019 [<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
8021 3 The fprintf macros for unsigned integers are:
8022 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
8023 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
8024 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
8025 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
8026 4 The fscanf macros for signed integers are:
8027 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
8028 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
8029 5 The fscanf macros for unsigned integers are:
8030 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
8031 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
8032 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
8033 6 For each type that the implementation provides in <a href="#7.18">&lt;stdint.h&gt;</a>, the corresponding
8034 fprintf macros shall be defined and the corresponding fscanf macros shall be
8035 defined unless the implementation does not have a suitable fscanf length modifier for
8036 the type.
8037 7 EXAMPLE
8038 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8039 #include <a href="#7.24">&lt;wchar.h&gt;</a>
8040 int main(void)
8042 uintmax_t i = UINTMAX_MAX; // this type always exists
8043 wprintf(L"The largest integer value is %020"
8044 PRIxMAX "\n", i);
8045 return 0;
8048 <a name="7.8.2" href="#7.8.2"><b> 7.8.2 Functions for greatest-width integer types</b></a>
8049 <a name="7.8.2.1" href="#7.8.2.1"><b> 7.8.2.1 The imaxabs function</b></a>
8050 <b> Synopsis</b>
8051 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8052 intmax_t imaxabs(intmax_t j);
8053 <b> Description</b>
8054 2 The imaxabs function computes the absolute value of an integer j. If the result cannot
8055 be represented, the behavior is undefined.<sup><a href="#note193"><b>193)</b></a></sup>
8059 <sup><a name="note193" href="#note193"><b>193)</b></a></sup> The absolute value of the most negative number cannot be represented in two's complement.
8061 [<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
8063 <b> Returns</b>
8064 3 The imaxabs function returns the absolute value.
8065 <a name="7.8.2.2" href="#7.8.2.2"><b> 7.8.2.2 The imaxdiv function</b></a>
8066 <b> Synopsis</b>
8067 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8068 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
8069 <b> Description</b>
8070 2 The imaxdiv function computes numer / denom and numer % denom in a single
8071 operation.
8072 <b> Returns</b>
8073 3 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
8074 quotient and the remainder. The structure shall contain (in either order) the members
8075 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
8076 either part of the result cannot be represented, the behavior is undefined.
8077 <a name="7.8.2.3" href="#7.8.2.3"><b> 7.8.2.3 The strtoimax and strtoumax functions</b></a>
8078 <b> Synopsis</b>
8079 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8080 intmax_t strtoimax(const char * restrict nptr,
8081 char ** restrict endptr, int base);
8082 uintmax_t strtoumax(const char * restrict nptr,
8083 char ** restrict endptr, int base);
8084 <b> Description</b>
8085 2 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
8086 strtoul, and strtoull functions, except that the initial portion of the string is
8087 converted to intmax_t and uintmax_t representation, respectively.
8088 <b> Returns</b>
8089 3 The strtoimax and strtoumax functions return the converted value, if any. If no
8090 conversion could be performed, zero is returned. If the correct value is outside the range
8091 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
8092 (according to the return type and sign of the value, if any), and the value of the macro
8093 ERANGE is stored in errno.
8094 Forward references: the strtol, strtoll, strtoul, and strtoull functions
8095 (<a href="#7.20.1.4">7.20.1.4</a>).
8097 [<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
8099 <a name="7.8.2.4" href="#7.8.2.4"><b> 7.8.2.4 The wcstoimax and wcstoumax functions</b></a>
8100 <b> Synopsis</b>
8101 1 #include <a href="#7.17">&lt;stddef.h&gt;</a> // for wchar_t
8102 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
8103 intmax_t wcstoimax(const wchar_t * restrict nptr,
8104 wchar_t ** restrict endptr, int base);
8105 uintmax_t wcstoumax(const wchar_t * restrict nptr,
8106 wchar_t ** restrict endptr, int base);
8107 <b> Description</b>
8108 2 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
8109 wcstoul, and wcstoull functions except that the initial portion of the wide string is
8110 converted to intmax_t and uintmax_t representation, respectively.
8111 <b> Returns</b>
8112 3 The wcstoimax function returns the converted value, if any. If no conversion could be
8113 performed, zero is returned. If the correct value is outside the range of representable
8114 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
8115 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
8116 errno.
8117 Forward references: the wcstol, wcstoll, wcstoul, and wcstoull functions
8118 (<a href="#7.24.4.1.2">7.24.4.1.2</a>).
8120 [<a name="p201" href="#p201">page 201</a>] (<a href="#Contents">Contents</a>)
8122 <a name="7.9" href="#7.9"><b> 7.9 Alternative spellings &lt;iso646.h&gt;</b></a>
8123 1 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
8124 to the corresponding tokens (on the right):
8125 and &amp;&amp;
8126 and_eq &amp;=
8127 bitand &amp;
8128 bitor |
8129 compl ~
8130 not !
8131 not_eq !=
8132 or ||
8133 or_eq |=
8134 xor ^
8135 xor_eq ^=
8137 [<a name="p202" href="#p202">page 202</a>] (<a href="#Contents">Contents</a>)
8139 <a name="7.10" href="#7.10"><b> 7.10 Sizes of integer types &lt;limits.h&gt;</b></a>
8140 1 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
8141 parameters of the standard integer types.
8142 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
8143 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
8145 [<a name="p203" href="#p203">page 203</a>] (<a href="#Contents">Contents</a>)
8147 <a name="7.11" href="#7.11"><b> 7.11 Localization &lt;locale.h&gt;</b></a>
8148 1 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
8149 2 The type is
8150 struct lconv
8151 which contains members related to the formatting of numeric values. The structure shall
8152 contain at least the following members, in any order. The semantics of the members and
8153 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
8154 the values specified in the comments.
8155 char *decimal_point; // "."
8156 char *thousands_sep; // ""
8157 char *grouping; // ""
8158 char *mon_decimal_point; // ""
8159 char *mon_thousands_sep; // ""
8160 char *mon_grouping; // ""
8161 char *positive_sign; // ""
8162 char *negative_sign; // ""
8163 char *currency_symbol; // ""
8164 char frac_digits; // CHAR_MAX
8165 char p_cs_precedes; // CHAR_MAX
8166 char n_cs_precedes; // CHAR_MAX
8167 char p_sep_by_space; // CHAR_MAX
8168 char n_sep_by_space; // CHAR_MAX
8169 char p_sign_posn; // CHAR_MAX
8170 char n_sign_posn; // CHAR_MAX
8171 char *int_curr_symbol; // ""
8172 char int_frac_digits; // CHAR_MAX
8173 char int_p_cs_precedes; // CHAR_MAX
8174 char int_n_cs_precedes; // CHAR_MAX
8175 char int_p_sep_by_space; // CHAR_MAX
8176 char int_n_sep_by_space; // CHAR_MAX
8177 char int_p_sign_posn; // CHAR_MAX
8178 char int_n_sign_posn; // CHAR_MAX
8180 [<a name="p204" href="#p204">page 204</a>] (<a href="#Contents">Contents</a>)
8182 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
8183 LC_ALL
8184 LC_COLLATE
8185 LC_CTYPE
8186 LC_MONETARY
8187 LC_NUMERIC
8188 LC_TIME
8189 which expand to integer constant expressions with distinct values, suitable for use as the
8190 first argument to the setlocale function.<sup><a href="#note194"><b>194)</b></a></sup> Additional macro definitions, beginning
8191 with the characters LC_ and an uppercase letter,<sup><a href="#note195"><b>195)</b></a></sup> may also be specified by the
8192 implementation.
8193 <a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
8194 <a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
8195 <b> Synopsis</b>
8196 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
8197 char *setlocale(int category, const char *locale);
8198 <b> Description</b>
8199 2 The setlocale function selects the appropriate portion of the program's locale as
8200 specified by the category and locale arguments. The setlocale function may be
8201 used to change or query the program's entire current locale or portions thereof. The value
8202 LC_ALL for category names the program's entire locale; the other values for
8203 category name only a portion of the program's locale. LC_COLLATE affects the
8204 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
8205 the character handling functions<sup><a href="#note196"><b>196)</b></a></sup> and the multibyte and wide character functions.
8206 LC_MONETARY affects the monetary formatting information returned by the
8207 localeconv function. LC_NUMERIC affects the decimal-point character for the
8208 formatted input/output functions and the string conversion functions, as well as the
8209 nonmonetary formatting information returned by the localeconv function. LC_TIME
8210 affects the behavior of the strftime and wcsftime functions.
8211 3 A value of "C" for locale specifies the minimal environment for C translation; a value
8212 of "" for locale specifies the locale-specific native environment. Other
8213 implementation-defined strings may be passed as the second argument to setlocale.
8215 <sup><a name="note194" href="#note194"><b>194)</b></a></sup> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
8216 <sup><a name="note195" href="#note195"><b>195)</b></a></sup> See ''future library directions'' (<a href="#7.26.5">7.26.5</a>).
8217 <sup><a name="note196" href="#note196"><b>196)</b></a></sup> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
8218 isxdigit.
8220 [<a name="p205" href="#p205">page 205</a>] (<a href="#Contents">Contents</a>)
8222 4 At program startup, the equivalent of
8223 setlocale(LC_ALL, "C");
8224 is executed.
8225 5 The implementation shall behave as if no library function calls the setlocale function.
8226 <b> Returns</b>
8227 6 If a pointer to a string is given for locale and the selection can be honored, the
8228 setlocale function returns a pointer to the string associated with the specified
8229 category for the new locale. If the selection cannot be honored, the setlocale
8230 function returns a null pointer and the program's locale is not changed.
8231 7 A null pointer for locale causes the setlocale function to return a pointer to the
8232 string associated with the category for the program's current locale; the program's
8233 locale is not changed.<sup><a href="#note197"><b>197)</b></a></sup>
8234 8 The pointer to string returned by the setlocale function is such that a subsequent call
8235 with that string value and its associated category will restore that part of the program's
8236 locale. The string pointed to shall not be modified by the program, but may be
8237 overwritten by a subsequent call to the setlocale function.
8238 Forward references: formatted input/output functions (<a href="#7.19.6">7.19.6</a>), multibyte/wide
8239 character conversion functions (<a href="#7.20.7">7.20.7</a>), multibyte/wide string conversion functions
8240 (<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
8241 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>).
8242 <a name="7.11.2" href="#7.11.2"><b> 7.11.2 Numeric formatting convention inquiry</b></a>
8243 <a name="7.11.2.1" href="#7.11.2.1"><b> 7.11.2.1 The localeconv function</b></a>
8244 <b> Synopsis</b>
8245 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
8246 struct lconv *localeconv(void);
8247 <b> Description</b>
8248 2 The localeconv function sets the components of an object with type struct lconv
8249 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
8250 according to the rules of the current locale.
8251 3 The members of the structure with type char * are pointers to strings, any of which
8252 (except decimal_point) can point to "", to indicate that the value is not available in
8253 the current locale or is of zero length. Apart from grouping and mon_grouping, the
8255 <sup><a name="note197" href="#note197"><b>197)</b></a></sup> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
8256 locale when category has the value LC_ALL.
8258 [<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
8260 strings shall start and end in the initial shift state. The members with type char are
8261 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
8262 available in the current locale. The members include the following:
8263 char *decimal_point
8264 The decimal-point character used to format nonmonetary quantities.
8265 char *thousands_sep
8266 The character used to separate groups of digits before the decimal-point
8267 character in formatted nonmonetary quantities.
8268 char *grouping
8269 A string whose elements indicate the size of each group of digits in
8270 formatted nonmonetary quantities.
8271 char *mon_decimal_point
8272 The decimal-point used to format monetary quantities.
8273 char *mon_thousands_sep
8274 The separator for groups of digits before the decimal-point in formatted
8275 monetary quantities.
8276 char *mon_grouping
8277 A string whose elements indicate the size of each group of digits in
8278 formatted monetary quantities.
8279 char *positive_sign
8280 The string used to indicate a nonnegative-valued formatted monetary
8281 quantity.
8282 char *negative_sign
8283 The string used to indicate a negative-valued formatted monetary quantity.
8284 char *currency_symbol
8285 The local currency symbol applicable to the current locale.
8286 char frac_digits
8287 The number of fractional digits (those after the decimal-point) to be
8288 displayed in a locally formatted monetary quantity.
8289 char p_cs_precedes
8290 Set to 1 or 0 if the currency_symbol respectively precedes or
8291 succeeds the value for a nonnegative locally formatted monetary quantity.
8292 char n_cs_precedes
8293 Set to 1 or 0 if the currency_symbol respectively precedes or
8294 succeeds the value for a negative locally formatted monetary quantity.
8296 [<a name="p207" href="#p207">page 207</a>] (<a href="#Contents">Contents</a>)
8298 char p_sep_by_space
8299 Set to a value indicating the separation of the currency_symbol, the
8300 sign string, and the value for a nonnegative locally formatted monetary
8301 quantity.
8302 char n_sep_by_space
8303 Set to a value indicating the separation of the currency_symbol, the
8304 sign string, and the value for a negative locally formatted monetary
8305 quantity.
8306 char p_sign_posn
8307 Set to a value indicating the positioning of the positive_sign for a
8308 nonnegative locally formatted monetary quantity.
8309 char n_sign_posn
8310 Set to a value indicating the positioning of the negative_sign for a
8311 negative locally formatted monetary quantity.
8312 char *int_curr_symbol
8313 The international currency symbol applicable to the current locale. The
8314 first three characters contain the alphabetic international currency symbol
8315 in accordance with those specified in ISO 4217. The fourth character
8316 (immediately preceding the null character) is the character used to separate
8317 the international currency symbol from the monetary quantity.
8318 char int_frac_digits
8319 The number of fractional digits (those after the decimal-point) to be
8320 displayed in an internationally formatted monetary quantity.
8321 char int_p_cs_precedes
8322 Set to 1 or 0 if the int_curr_symbol respectively precedes or
8323 succeeds the value for a nonnegative internationally formatted monetary
8324 quantity.
8325 char int_n_cs_precedes
8326 Set to 1 or 0 if the int_curr_symbol respectively precedes or
8327 succeeds the value for a negative internationally formatted monetary
8328 quantity.
8329 char int_p_sep_by_space
8330 Set to a value indicating the separation of the int_curr_symbol, the
8331 sign string, and the value for a nonnegative internationally formatted
8332 monetary quantity.
8334 [<a name="p208" href="#p208">page 208</a>] (<a href="#Contents">Contents</a>)
8336 char int_n_sep_by_space
8337 Set to a value indicating the separation of the int_curr_symbol, the
8338 sign string, and the value for a negative internationally formatted monetary
8339 quantity.
8340 char int_p_sign_posn
8341 Set to a value indicating the positioning of the positive_sign for a
8342 nonnegative internationally formatted monetary quantity.
8343 char int_n_sign_posn
8344 Set to a value indicating the positioning of the negative_sign for a
8345 negative internationally formatted monetary quantity.
8346 4 The elements of grouping and mon_grouping are interpreted according to the
8347 following:
8348 CHAR_MAX No further grouping is to be performed.
8349 0 The previous element is to be repeatedly used for the remainder of the
8350 digits.
8351 other The integer value is the number of digits that compose the current group.
8352 The next element is examined to determine the size of the next group of
8353 digits before the current group.
8354 5 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
8355 and int_n_sep_by_space are interpreted according to the following:
8356 0 No space separates the currency symbol and value.
8357 1 If the currency symbol and sign string are adjacent, a space separates them from the
8358 value; otherwise, a space separates the currency symbol from the value.
8359 2 If the currency symbol and sign string are adjacent, a space separates them;
8360 otherwise, a space separates the sign string from the value.
8361 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
8362 int_curr_symbol is used instead of a space.
8363 6 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
8364 int_n_sign_posn are interpreted according to the following:
8365 0 Parentheses surround the quantity and currency symbol.
8366 1 The sign string precedes the quantity and currency symbol.
8367 2 The sign string succeeds the quantity and currency symbol.
8368 3 The sign string immediately precedes the currency symbol.
8369 4 The sign string immediately succeeds the currency symbol.
8371 [<a name="p209" href="#p209">page 209</a>] (<a href="#Contents">Contents</a>)
8373 7 The implementation shall behave as if no library function calls the localeconv
8374 function.
8375 <b> Returns</b>
8376 8 The localeconv function returns a pointer to the filled-in object. The structure
8377 pointed to by the return value shall not be modified by the program, but may be
8378 overwritten by a subsequent call to the localeconv function. In addition, calls to the
8379 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
8380 overwrite the contents of the structure.
8381 9 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
8382 monetary quantities.
8383 Local format International format
8385 Country Positive Negative Positive Negative
8387 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
8388 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
8389 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
8390 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
8391 10 For these four countries, the respective values for the monetary members of the structure returned by
8392 localeconv could be:
8393 Country1 Country2 Country3 Country4
8395 mon_decimal_point "," "" "," "."
8396 mon_thousands_sep "." "." "." ","
8397 mon_grouping "\3" "\3" "\3" "\3"
8398 positive_sign "" "" "" ""
8399 negative_sign "-" "-" "-" "C"
8400 currency_symbol "mk" "L." "\u0192" "SFrs."
8401 frac_digits 2 0 2 2
8402 p_cs_precedes 0 1 1 1
8403 n_cs_precedes 0 1 1 1
8404 p_sep_by_space 1 0 1 0
8405 n_sep_by_space 1 0 2 0
8406 p_sign_posn 1 1 1 1
8407 n_sign_posn 1 1 4 2
8408 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
8409 int_frac_digits 2 0 2 2
8410 int_p_cs_precedes 1 1 1 1
8411 int_n_cs_precedes 1 1 1 1
8412 int_p_sep_by_space 1 1 1 1
8413 int_n_sep_by_space 2 1 2 1
8414 int_p_sign_posn 1 1 1 1
8415 int_n_sign_posn 4 1 4 2
8417 [<a name="p210" href="#p210">page 210</a>] (<a href="#Contents">Contents</a>)
8419 11 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
8420 affect the formatted value.
8421 p_sep_by_space
8423 p_cs_precedes p_sign_posn 0 1 2
8425 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
8426 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
8427 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
8428 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
8429 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
8431 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
8432 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
8433 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
8434 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
8435 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25
8437 [<a name="p211" href="#p211">page 211</a>] (<a href="#Contents">Contents</a>)
8439 <a name="7.12" href="#7.12"><b> 7.12 Mathematics &lt;math.h&gt;</b></a>
8440 1 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
8441 several macros. Most synopses specify a family of functions consisting of a principal
8442 function with one or more double parameters, a double return value, or both; and
8443 other functions with the same name but with f and l suffixes, which are corresponding
8444 functions with float and long double parameters, return values, or both.<sup><a href="#note198"><b>198)</b></a></sup>
8445 Integer arithmetic functions and conversion functions are discussed later.
8446 2 The types
8447 float_t
8448 double_t
8449 are floating types at least as wide as float and double, respectively, and such that
8450 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
8451 float_t and double_t are float and double, respectively; if
8452 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
8453 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
8454 otherwise implementation-defined.<sup><a href="#note199"><b>199)</b></a></sup>
8455 3 The macro
8456 HUGE_VAL
8457 expands to a positive double constant expression, not necessarily representable as a
8458 float. The macros
8459 HUGE_VALF
8460 HUGE_VALL
8461 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note200"><b>200)</b></a></sup>
8462 4 The macro
8463 INFINITY
8464 expands to a constant expression of type float representing positive or unsigned
8465 infinity, if available; else to a positive constant of type float that overflows at
8469 <sup><a name="note198" href="#note198"><b>198)</b></a></sup> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
8470 and return values in wider format than the synopsis prototype indicates.
8471 <sup><a name="note199" href="#note199"><b>199)</b></a></sup> The types float_t and double_t are intended to be the implementation's most efficient types at
8472 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
8473 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
8474 <sup><a name="note200" href="#note200"><b>200)</b></a></sup> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
8475 supports infinities.
8477 [<a name="p212" href="#p212">page 212</a>] (<a href="#Contents">Contents</a>)
8479 translation time.<sup><a href="#note201"><b>201)</b></a></sup>
8480 5 The macro
8482 is defined if and only if the implementation supports quiet NaNs for the float type. It
8483 expands to a constant expression of type float representing a quiet NaN.
8484 6 The number classification macros
8485 FP_INFINITE
8486 FP_NAN
8487 FP_NORMAL
8488 FP_SUBNORMAL
8489 FP_ZERO
8490 represent the mutually exclusive kinds of floating-point values. They expand to integer
8491 constant expressions with distinct values. Additional implementation-defined floating-
8492 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
8493 may also be specified by the implementation.
8494 7 The macro
8495 FP_FAST_FMA
8496 is optionally defined. If defined, it indicates that the fma function generally executes
8497 about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note202"><b>202)</b></a></sup> The
8498 macros
8499 FP_FAST_FMAF
8500 FP_FAST_FMAL
8501 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
8502 these macros expand to the integer constant 1.
8503 8 The macros
8504 FP_ILOGB0
8505 FP_ILOGBNAN
8506 expand to integer constant expressions whose values are returned by ilogb(x) if x is
8507 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
8508 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
8511 <sup><a name="note201" href="#note201"><b>201)</b></a></sup> In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
8512 <sup><a name="note202" href="#note202"><b>202)</b></a></sup> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
8513 directly with a hardware multiply-add instruction. Software implementations are expected to be
8514 substantially slower.
8516 [<a name="p213" href="#p213">page 213</a>] (<a href="#Contents">Contents</a>)
8518 9 The macros
8519 MATH_ERRNO
8520 MATH_ERREXCEPT
8521 expand to the integer constants 1 and 2, respectively; the macro
8522 math_errhandling
8523 expands to an expression that has type int and the value MATH_ERRNO,
8524 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
8525 constant for the duration of the program. It is unspecified whether
8526 math_errhandling is a macro or an identifier with external linkage. If a macro
8527 definition is suppressed or a program defines an identifier with the name
8528 math_errhandling, the behavior is undefined. If the expression
8529 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
8530 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
8531 <a href="#7.6">&lt;fenv.h&gt;</a>.
8532 <a name="7.12.1" href="#7.12.1"><b> 7.12.1 Treatment of error conditions</b></a>
8533 1 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
8534 values of its input arguments, except where stated otherwise. Each function shall execute
8535 as if it were a single operation without generating any externally visible exceptional
8536 conditions.
8537 2 For all functions, a domain error occurs if an input argument is outside the domain over
8538 which the mathematical function is defined. The description of each function lists any
8539 required domain errors; an implementation may define additional domain errors, provided
8540 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note203"><b>203)</b></a></sup> On a
8541 domain error, the function returns an implementation-defined value; if the integer
8542 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
8543 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
8544 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
8545 3 Similarly, a range error occurs if the mathematical result of the function cannot be
8546 represented in an object of the specified type, due to extreme magnitude.
8547 4 A floating result overflows if the magnitude of the mathematical result is finite but so
8548 large that the mathematical result cannot be represented without extraordinary roundoff
8549 error in an object of the specified type. If a floating result overflows and default rounding
8550 is in effect, or if the mathematical result is an exact infinity from finite arguments (for
8551 example log(0.0)), then the function returns the value of the macro HUGE_VAL,
8554 <sup><a name="note203" href="#note203"><b>203)</b></a></sup> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
8555 error if the mathematical domain of the function does not include the infinity.
8557 [<a name="p214" href="#p214">page 214</a>] (<a href="#Contents">Contents</a>)
8559 HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
8560 correct value of the function; if the integer expression math_errhandling &amp;
8561 MATH_ERRNO is nonzero, the integer expression errno acquires the value ERANGE; if
8562 the integer expression math_errhandling &amp; MATH_ERREXCEPT is nonzero, the
8563 ''divide-by-zero'' floating-point exception is raised if the mathematical result is an exact
8564 infinity and the ''overflow'' floating-point exception is raised otherwise.
8565 5 The result underflows if the magnitude of the mathematical result is so small that the
8566 mathematical result cannot be represented, without extraordinary roundoff error, in an
8567 object of the specified type.<sup><a href="#note204"><b>204)</b></a></sup> If the result underflows, the function returns an
8568 implementation-defined value whose magnitude is no greater than the smallest
8569 normalized positive number in the specified type; if the integer expression
8570 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
8571 value ERANGE is implementation-defined; if the integer expression
8572 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
8573 floating-point exception is raised is implementation-defined.
8574 <a name="7.12.2" href="#7.12.2"><b> 7.12.2 The FP_CONTRACT pragma</b></a>
8575 <b> Synopsis</b>
8576 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8577 #pragma STDC FP_CONTRACT on-off-switch
8578 <b> Description</b>
8579 2 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
8580 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
8581 either outside external declarations or preceding all explicit declarations and statements
8582 inside a compound statement. When outside external declarations, the pragma takes
8583 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
8584 the end of the translation unit. When inside a compound statement, the pragma takes
8585 effect from its occurrence until another FP_CONTRACT pragma is encountered
8586 (including within a nested compound statement), or until the end of the compound
8587 statement; at the end of a compound statement the state for the pragma is restored to its
8588 condition just before the compound statement. If this pragma is used in any other
8589 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
8590 implementation-defined.
8595 <sup><a name="note204" href="#note204"><b>204)</b></a></sup> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
8596 also ''flush-to-zero'' underflow.
8598 [<a name="p215" href="#p215">page 215</a>] (<a href="#Contents">Contents</a>)
8600 <a name="7.12.3" href="#7.12.3"><b> 7.12.3 Classification macros</b></a>
8601 1 In the synopses in this subclause, real-floating indicates that the argument shall be an
8602 expression of real floating type.
8603 <a name="7.12.3.1" href="#7.12.3.1"><b> 7.12.3.1 The fpclassify macro</b></a>
8604 <b> Synopsis</b>
8605 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8606 int fpclassify(real-floating x);
8607 <b> Description</b>
8608 2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
8609 subnormal, zero, or into another implementation-defined category. First, an argument
8610 represented in a format wider than its semantic type is converted to its semantic type.
8611 Then classification is based on the type of the argument.<sup><a href="#note205"><b>205)</b></a></sup>
8612 <b> Returns</b>
8613 3 The fpclassify macro returns the value of the number classification macro
8614 appropriate to the value of its argument.
8615 4 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
8616 #define fpclassify(x) \
8617 ((sizeof (x) == sizeof (float)) ? __fpclassifyf(x) : \
8618 (sizeof (x) == sizeof (double)) ? __fpclassifyd(x) : \
8619 __fpclassifyl(x))
8621 <a name="7.12.3.2" href="#7.12.3.2"><b> 7.12.3.2 The isfinite macro</b></a>
8622 <b> Synopsis</b>
8623 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8624 int isfinite(real-floating x);
8625 <b> Description</b>
8626 2 The isfinite macro determines whether its argument has a finite value (zero,
8627 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
8628 format wider than its semantic type is converted to its semantic type. Then determination
8629 is based on the type of the argument.
8634 <sup><a name="note205" href="#note205"><b>205)</b></a></sup> Since an expression can be evaluated with more range and precision than its type has, it is important to
8635 know the type that classification is based on. For example, a normal long double value might
8636 become subnormal when converted to double, and zero when converted to float.
8638 [<a name="p216" href="#p216">page 216</a>] (<a href="#Contents">Contents</a>)
8640 <b> Returns</b>
8641 3 The isfinite macro returns a nonzero value if and only if its argument has a finite
8642 value.
8643 <a name="7.12.3.3" href="#7.12.3.3"><b> 7.12.3.3 The isinf macro</b></a>
8644 <b> Synopsis</b>
8645 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8646 int isinf(real-floating x);
8647 <b> Description</b>
8648 2 The isinf macro determines whether its argument value is an infinity (positive or
8649 negative). First, an argument represented in a format wider than its semantic type is
8650 converted to its semantic type. Then determination is based on the type of the argument.
8651 <b> Returns</b>
8652 3 The isinf macro returns a nonzero value if and only if its argument has an infinite
8653 value.
8654 <a name="7.12.3.4" href="#7.12.3.4"><b> 7.12.3.4 The isnan macro</b></a>
8655 <b> Synopsis</b>
8656 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8657 int isnan(real-floating x);
8658 <b> Description</b>
8659 2 The isnan macro determines whether its argument value is a NaN. First, an argument
8660 represented in a format wider than its semantic type is converted to its semantic type.
8661 Then determination is based on the type of the argument.<sup><a href="#note206"><b>206)</b></a></sup>
8662 <b> Returns</b>
8663 3 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
8664 <a name="7.12.3.5" href="#7.12.3.5"><b> 7.12.3.5 The isnormal macro</b></a>
8665 <b> Synopsis</b>
8666 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8667 int isnormal(real-floating x);
8672 <sup><a name="note206" href="#note206"><b>206)</b></a></sup> For the isnan macro, the type for determination does not matter unless the implementation supports
8673 NaNs in the evaluation type but not in the semantic type.
8675 [<a name="p217" href="#p217">page 217</a>] (<a href="#Contents">Contents</a>)
8677 <b> Description</b>
8678 2 The isnormal macro determines whether its argument value is normal (neither zero,
8679 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
8680 semantic type is converted to its semantic type. Then determination is based on the type
8681 of the argument.
8682 <b> Returns</b>
8683 3 The isnormal macro returns a nonzero value if and only if its argument has a normal
8684 value.
8685 <a name="7.12.3.6" href="#7.12.3.6"><b> 7.12.3.6 The signbit macro</b></a>
8686 <b> Synopsis</b>
8687 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8688 int signbit(real-floating x);
8689 <b> Description</b>
8690 2 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note207"><b>207)</b></a></sup>
8691 <b> Returns</b>
8692 3 The signbit macro returns a nonzero value if and only if the sign of its argument value
8693 is negative.
8694 <a name="7.12.4" href="#7.12.4"><b> 7.12.4 Trigonometric functions</b></a>
8695 <a name="7.12.4.1" href="#7.12.4.1"><b> 7.12.4.1 The acos functions</b></a>
8696 <b> Synopsis</b>
8697 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8698 double acos(double x);
8699 float acosf(float x);
8700 long double acosl(long double x);
8701 <b> Description</b>
8702 2 The acos functions compute the principal value of the arc cosine of x. A domain error
8703 occurs for arguments not in the interval [-1, +1].
8704 <b> Returns</b>
8705 3 The acos functions return arccos x in the interval [0, pi ] radians.
8710 <sup><a name="note207" href="#note207"><b>207)</b></a></sup> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
8711 unsigned, it is treated as positive.
8713 [<a name="p218" href="#p218">page 218</a>] (<a href="#Contents">Contents</a>)
8715 <a name="7.12.4.2" href="#7.12.4.2"><b> 7.12.4.2 The asin functions</b></a>
8716 <b> Synopsis</b>
8717 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8718 double asin(double x);
8719 float asinf(float x);
8720 long double asinl(long double x);
8721 <b> Description</b>
8722 2 The asin functions compute the principal value of the arc sine of x. A domain error
8723 occurs for arguments not in the interval [-1, +1].
8724 <b> Returns</b>
8725 3 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
8726 <a name="7.12.4.3" href="#7.12.4.3"><b> 7.12.4.3 The atan functions</b></a>
8727 <b> Synopsis</b>
8728 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8729 double atan(double x);
8730 float atanf(float x);
8731 long double atanl(long double x);
8732 <b> Description</b>
8733 2 The atan functions compute the principal value of the arc tangent of x.
8734 <b> Returns</b>
8735 3 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
8736 <a name="7.12.4.4" href="#7.12.4.4"><b> 7.12.4.4 The atan2 functions</b></a>
8737 <b> Synopsis</b>
8738 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8739 double atan2(double y, double x);
8740 float atan2f(float y, float x);
8741 long double atan2l(long double y, long double x);
8742 <b> Description</b>
8743 2 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
8744 arguments to determine the quadrant of the return value. A domain error may occur if
8745 both arguments are zero.
8746 <b> Returns</b>
8747 3 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
8749 [<a name="p219" href="#p219">page 219</a>] (<a href="#Contents">Contents</a>)
8751 <a name="7.12.4.5" href="#7.12.4.5"><b> 7.12.4.5 The cos functions</b></a>
8752 <b> Synopsis</b>
8753 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8754 double cos(double x);
8755 float cosf(float x);
8756 long double cosl(long double x);
8757 <b> Description</b>
8758 2 The cos functions compute the cosine of x (measured in radians).
8759 <b> Returns</b>
8760 3 The cos functions return cos x.
8761 <a name="7.12.4.6" href="#7.12.4.6"><b> 7.12.4.6 The sin functions</b></a>
8762 <b> Synopsis</b>
8763 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8764 double sin(double x);
8765 float sinf(float x);
8766 long double sinl(long double x);
8767 <b> Description</b>
8768 2 The sin functions compute the sine of x (measured in radians).
8769 <b> Returns</b>
8770 3 The sin functions return sin x.
8771 <a name="7.12.4.7" href="#7.12.4.7"><b> 7.12.4.7 The tan functions</b></a>
8772 <b> Synopsis</b>
8773 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8774 double tan(double x);
8775 float tanf(float x);
8776 long double tanl(long double x);
8777 <b> Description</b>
8778 2 The tan functions return the tangent of x (measured in radians).
8779 <b> Returns</b>
8780 3 The tan functions return tan x.
8782 [<a name="p220" href="#p220">page 220</a>] (<a href="#Contents">Contents</a>)
8784 <a name="7.12.5" href="#7.12.5"><b> 7.12.5 Hyperbolic functions</b></a>
8785 <a name="7.12.5.1" href="#7.12.5.1"><b> 7.12.5.1 The acosh functions</b></a>
8786 <b> Synopsis</b>
8787 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8788 double acosh(double x);
8789 float acoshf(float x);
8790 long double acoshl(long double x);
8791 <b> Description</b>
8792 2 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
8793 error occurs for arguments less than 1.
8794 <b> Returns</b>
8795 3 The acosh functions return arcosh x in the interval [0, +(inf)].
8796 <a name="7.12.5.2" href="#7.12.5.2"><b> 7.12.5.2 The asinh functions</b></a>
8797 <b> Synopsis</b>
8798 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8799 double asinh(double x);
8800 float asinhf(float x);
8801 long double asinhl(long double x);
8802 <b> Description</b>
8803 2 The asinh functions compute the arc hyperbolic sine of x.
8804 <b> Returns</b>
8805 3 The asinh functions return arsinh x.
8806 <a name="7.12.5.3" href="#7.12.5.3"><b> 7.12.5.3 The atanh functions</b></a>
8807 <b> Synopsis</b>
8808 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8809 double atanh(double x);
8810 float atanhf(float x);
8811 long double atanhl(long double x);
8812 <b> Description</b>
8813 2 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
8814 for arguments not in the interval [-1, +1]. A range error may occur if the argument
8815 equals -1 or +1.
8817 [<a name="p221" href="#p221">page 221</a>] (<a href="#Contents">Contents</a>)
8819 <b> Returns</b>
8820 3 The atanh functions return artanh x.
8821 <a name="7.12.5.4" href="#7.12.5.4"><b> 7.12.5.4 The cosh functions</b></a>
8822 <b> Synopsis</b>
8823 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8824 double cosh(double x);
8825 float coshf(float x);
8826 long double coshl(long double x);
8827 <b> Description</b>
8828 2 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
8829 magnitude of x is too large.
8830 <b> Returns</b>
8831 3 The cosh functions return cosh x.
8832 <a name="7.12.5.5" href="#7.12.5.5"><b> 7.12.5.5 The sinh functions</b></a>
8833 <b> Synopsis</b>
8834 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8835 double sinh(double x);
8836 float sinhf(float x);
8837 long double sinhl(long double x);
8838 <b> Description</b>
8839 2 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
8840 magnitude of x is too large.
8841 <b> Returns</b>
8842 3 The sinh functions return sinh x.
8843 <a name="7.12.5.6" href="#7.12.5.6"><b> 7.12.5.6 The tanh functions</b></a>
8844 <b> Synopsis</b>
8845 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8846 double tanh(double x);
8847 float tanhf(float x);
8848 long double tanhl(long double x);
8849 <b> Description</b>
8850 2 The tanh functions compute the hyperbolic tangent of x.
8852 [<a name="p222" href="#p222">page 222</a>] (<a href="#Contents">Contents</a>)
8854 <b> Returns</b>
8855 3 The tanh functions return tanh x.
8856 <a name="7.12.6" href="#7.12.6"><b> 7.12.6 Exponential and logarithmic functions</b></a>
8857 <a name="7.12.6.1" href="#7.12.6.1"><b> 7.12.6.1 The exp functions</b></a>
8858 <b> Synopsis</b>
8859 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8860 double exp(double x);
8861 float expf(float x);
8862 long double expl(long double x);
8863 <b> Description</b>
8864 2 The exp functions compute the base-e exponential of x. A range error occurs if the
8865 magnitude of x is too large.
8866 <b> Returns</b>
8867 3 The exp functions return ex .
8868 <a name="7.12.6.2" href="#7.12.6.2"><b> 7.12.6.2 The exp2 functions</b></a>
8869 <b> Synopsis</b>
8870 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8871 double exp2(double x);
8872 float exp2f(float x);
8873 long double exp2l(long double x);
8874 <b> Description</b>
8875 2 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
8876 magnitude of x is too large.
8877 <b> Returns</b>
8878 3 The exp2 functions return 2x .
8879 <a name="7.12.6.3" href="#7.12.6.3"><b> 7.12.6.3 The expm1 functions</b></a>
8880 <b> Synopsis</b>
8881 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8882 double expm1(double x);
8883 float expm1f(float x);
8884 long double expm1l(long double x);
8886 [<a name="p223" href="#p223">page 223</a>] (<a href="#Contents">Contents</a>)
8888 <b> Description</b>
8889 2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
8890 error occurs if x is too large.<sup><a href="#note208"><b>208)</b></a></sup>
8891 <b> Returns</b>
8892 3 The expm1 functions return ex - 1.
8893 <a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
8894 <b> Synopsis</b>
8895 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8896 double frexp(double value, int *exp);
8897 float frexpf(float value, int *exp);
8898 long double frexpl(long double value, int *exp);
8899 <b> Description</b>
8900 2 The frexp functions break a floating-point number into a normalized fraction and an
8901 integral power of 2. They store the integer in the int object pointed to by exp.
8902 <b> Returns</b>
8903 3 If value is not a floating-point number, the results are unspecified. Otherwise, the
8904 frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
8905 zero, and value equals x x 2*exp . If value is zero, both parts of the result are zero.
8906 <a name="7.12.6.5" href="#7.12.6.5"><b> 7.12.6.5 The ilogb functions</b></a>
8907 <b> Synopsis</b>
8908 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8909 int ilogb(double x);
8910 int ilogbf(float x);
8911 int ilogbl(long double x);
8912 <b> Description</b>
8913 2 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
8914 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
8915 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
8916 the corresponding logb function and casting the returned value to type int. A domain
8917 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
8918 the range of the return type, the numeric result is unspecified.
8923 <sup><a name="note208" href="#note208"><b>208)</b></a></sup> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
8925 [<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
8927 <b> Returns</b>
8928 3 The ilogb functions return the exponent of x as a signed int value.
8929 Forward references: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
8930 <a name="7.12.6.6" href="#7.12.6.6"><b> 7.12.6.6 The ldexp functions</b></a>
8931 <b> Synopsis</b>
8932 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8933 double ldexp(double x, int exp);
8934 float ldexpf(float x, int exp);
8935 long double ldexpl(long double x, int exp);
8936 <b> Description</b>
8937 2 The ldexp functions multiply a floating-point number by an integral power of 2. A
8938 range error may occur.
8939 <b> Returns</b>
8940 3 The ldexp functions return x x 2exp .
8941 <a name="7.12.6.7" href="#7.12.6.7"><b> 7.12.6.7 The log functions</b></a>
8942 <b> Synopsis</b>
8943 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8944 double log(double x);
8945 float logf(float x);
8946 long double logl(long double x);
8947 <b> Description</b>
8948 2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
8949 the argument is negative. A range error may occur if the argument is zero.
8950 <b> Returns</b>
8951 3 The log functions return loge x.
8952 <a name="7.12.6.8" href="#7.12.6.8"><b> 7.12.6.8 The log10 functions</b></a>
8953 <b> Synopsis</b>
8954 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8955 double log10(double x);
8956 float log10f(float x);
8957 long double log10l(long double x);
8959 [<a name="p225" href="#p225">page 225</a>] (<a href="#Contents">Contents</a>)
8961 <b> Description</b>
8962 2 The log10 functions compute the base-10 (common) logarithm of x. A domain error
8963 occurs if the argument is negative. A range error may occur if the argument is zero.
8964 <b> Returns</b>
8965 3 The log10 functions return log10 x.
8966 <a name="7.12.6.9" href="#7.12.6.9"><b> 7.12.6.9 The log1p functions</b></a>
8967 <b> Synopsis</b>
8968 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8969 double log1p(double x);
8970 float log1pf(float x);
8971 long double log1pl(long double x);
8972 <b> Description</b>
8973 2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note209"><b>209)</b></a></sup>
8974 A domain error occurs if the argument is less than -1. A range error may occur if the
8975 argument equals -1.
8976 <b> Returns</b>
8977 3 The log1p functions return loge (1 + x).
8978 <a name="7.12.6.10" href="#7.12.6.10"><b> 7.12.6.10 The log2 functions</b></a>
8979 <b> Synopsis</b>
8980 1 #include <a href="#7.12">&lt;math.h&gt;</a>
8981 double log2(double x);
8982 float log2f(float x);
8983 long double log2l(long double x);
8984 <b> Description</b>
8985 2 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
8986 argument is less than zero. A range error may occur if the argument is zero.
8987 <b> Returns</b>
8988 3 The log2 functions return log2 x.
8993 <sup><a name="note209" href="#note209"><b>209)</b></a></sup> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
8995 [<a name="p226" href="#p226">page 226</a>] (<a href="#Contents">Contents</a>)
8997 <a name="7.12.6.11" href="#7.12.6.11"><b> 7.12.6.11 The logb functions</b></a>
8998 <b> Synopsis</b>
8999 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9000 double logb(double x);
9001 float logbf(float x);
9002 long double logbl(long double x);
9003 <b> Description</b>
9004 2 The logb functions extract the exponent of x, as a signed integer value in floating-point
9005 format. If x is subnormal it is treated as though it were normalized; thus, for positive
9006 finite x,
9007 1 &lt;= x x FLT_RADIX-logb(x) &lt; FLT_RADIX
9008 A domain error or range error may occur if the argument is zero.
9009 <b> Returns</b>
9010 3 The logb functions return the signed exponent of x.
9011 <a name="7.12.6.12" href="#7.12.6.12"><b> 7.12.6.12 The modf functions</b></a>
9012 <b> Synopsis</b>
9013 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9014 double modf(double value, double *iptr);
9015 float modff(float value, float *iptr);
9016 long double modfl(long double value, long double *iptr);
9017 <b> Description</b>
9018 2 The modf functions break the argument value into integral and fractional parts, each of
9019 which has the same type and sign as the argument. They store the integral part (in
9020 floating-point format) in the object pointed to by iptr.
9021 <b> Returns</b>
9022 3 The modf functions return the signed fractional part of value.
9024 [<a name="p227" href="#p227">page 227</a>] (<a href="#Contents">Contents</a>)
9026 <a name="7.12.6.13" href="#7.12.6.13"><b> 7.12.6.13 The scalbn and scalbln functions</b></a>
9027 <b> Synopsis</b>
9028 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9029 double scalbn(double x, int n);
9030 float scalbnf(float x, int n);
9031 long double scalbnl(long double x, int n);
9032 double scalbln(double x, long int n);
9033 float scalblnf(float x, long int n);
9034 long double scalblnl(long double x, long int n);
9035 <b> Description</b>
9036 2 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
9037 normally by computing FLT_RADIXn explicitly. A range error may occur.
9038 <b> Returns</b>
9039 3 The scalbn and scalbln functions return x x FLT_RADIXn .
9040 <a name="7.12.7" href="#7.12.7"><b> 7.12.7 Power and absolute-value functions</b></a>
9041 <a name="7.12.7.1" href="#7.12.7.1"><b> 7.12.7.1 The cbrt functions</b></a>
9042 <b> Synopsis</b>
9043 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9044 double cbrt(double x);
9045 float cbrtf(float x);
9046 long double cbrtl(long double x);
9047 <b> Description</b>
9048 2 The cbrt functions compute the real cube root of x.
9049 <b> Returns</b>
9050 3 The cbrt functions return x1/3 .
9051 <a name="7.12.7.2" href="#7.12.7.2"><b> 7.12.7.2 The fabs functions</b></a>
9052 <b> Synopsis</b>
9053 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9054 double fabs(double x);
9055 float fabsf(float x);
9056 long double fabsl(long double x);
9057 <b> Description</b>
9058 2 The fabs functions compute the absolute value of a floating-point number x.
9060 [<a name="p228" href="#p228">page 228</a>] (<a href="#Contents">Contents</a>)
9062 <b> Returns</b>
9063 3 The fabs functions return | x |.
9064 <a name="7.12.7.3" href="#7.12.7.3"><b> 7.12.7.3 The hypot functions</b></a>
9065 <b> Synopsis</b>
9066 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9067 double hypot(double x, double y);
9068 float hypotf(float x, float y);
9069 long double hypotl(long double x, long double y);
9070 <b> Description</b>
9071 2 The hypot functions compute the square root of the sum of the squares of x and y,
9072 without undue overflow or underflow. A range error may occur.
9073 3 Returns
9074 4 The hypot functions return (sqrt)x2 + y2 .
9076 ???????????????
9077 <a name="7.12.7.4" href="#7.12.7.4"><b> 7.12.7.4 The pow functions</b></a>
9078 <b> Synopsis</b>
9079 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9080 double pow(double x, double y);
9081 float powf(float x, float y);
9082 long double powl(long double x, long double y);
9083 <b> Description</b>
9084 2 The pow functions compute x raised to the power y. A domain error occurs if x is finite
9085 and negative and y is finite and not an integer value. A range error may occur. A domain
9086 error may occur if x is zero and y is zero. A domain error or range error may occur if x
9087 is zero and y is less than zero.
9088 <b> Returns</b>
9089 3 The pow functions return xy .
9090 <a name="7.12.7.5" href="#7.12.7.5"><b> 7.12.7.5 The sqrt functions</b></a>
9091 <b> Synopsis</b>
9092 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9093 double sqrt(double x);
9094 float sqrtf(float x);
9095 long double sqrtl(long double x);
9097 [<a name="p229" href="#p229">page 229</a>] (<a href="#Contents">Contents</a>)
9099 <b> Description</b>
9100 2 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
9101 the argument is less than zero.
9102 <b> Returns</b>
9103 3 The sqrt functions return (sqrt)x.
9106 <a name="7.12.8" href="#7.12.8"><b> 7.12.8 Error and gamma functions</b></a>
9107 <a name="7.12.8.1" href="#7.12.8.1"><b> 7.12.8.1 The erf functions</b></a>
9108 <b> Synopsis</b>
9109 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9110 double erf(double x);
9111 float erff(float x);
9112 long double erfl(long double x);
9113 <b> Description</b>
9114 2 The erf functions compute the error function of x.
9115 <b> Returns</b>
9117 (integral)
9119 The erf functions return erf x = e-t dt.
9123 (sqrt)pi
9125 ??? 0
9127 <a name="7.12.8.2" href="#7.12.8.2"><b> 7.12.8.2 The erfc functions</b></a>
9128 <b> Synopsis</b>
9129 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9130 double erfc(double x);
9131 float erfcf(float x);
9132 long double erfcl(long double x);
9133 <b> Description</b>
9134 2 The erfc functions compute the complementary error function of x. A range error
9135 occurs if x is too large.
9136 <b> Returns</b>
9137 2 (inf)
9138 (integral)
9140 The erfc functions return erfc x = 1 - erf x = e-t dt.
9144 (sqrt)pi
9146 ??? x
9148 [<a name="p230" href="#p230">page 230</a>] (<a href="#Contents">Contents</a>)
9150 <a name="7.12.8.3" href="#7.12.8.3"><b> 7.12.8.3 The lgamma functions</b></a>
9151 <b> Synopsis</b>
9152 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9153 double lgamma(double x);
9154 float lgammaf(float x);
9155 long double lgammal(long double x);
9156 <b> Description</b>
9157 2 The lgamma functions compute the natural logarithm of the absolute value of gamma of
9158 x. A range error occurs if x is too large. A range error may occur if x is a negative
9159 integer or zero.
9160 <b> Returns</b>
9161 3 The lgamma functions return loge | (Gamma)(x) |.
9162 <a name="7.12.8.4" href="#7.12.8.4"><b> 7.12.8.4 The tgamma functions</b></a>
9163 <b> Synopsis</b>
9164 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9165 double tgamma(double x);
9166 float tgammaf(float x);
9167 long double tgammal(long double x);
9168 <b> Description</b>
9169 2 The tgamma functions compute the gamma function of x. A domain error or range error
9170 may occur if x is a negative integer or zero. A range error may occur if the magnitude of
9171 x is too large or too small.
9172 <b> Returns</b>
9173 3 The tgamma functions return (Gamma)(x).
9174 <a name="7.12.9" href="#7.12.9"><b> 7.12.9 Nearest integer functions</b></a>
9175 <a name="7.12.9.1" href="#7.12.9.1"><b> 7.12.9.1 The ceil functions</b></a>
9176 <b> Synopsis</b>
9177 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9178 double ceil(double x);
9179 float ceilf(float x);
9180 long double ceill(long double x);
9181 <b> Description</b>
9182 2 The ceil functions compute the smallest integer value not less than x.
9184 [<a name="p231" href="#p231">page 231</a>] (<a href="#Contents">Contents</a>)
9186 <b> Returns</b>
9187 3 The ceil functions return ???x???, expressed as a floating-point number.
9188 <a name="7.12.9.2" href="#7.12.9.2"><b> 7.12.9.2 The floor functions</b></a>
9189 <b> Synopsis</b>
9190 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9191 double floor(double x);
9192 float floorf(float x);
9193 long double floorl(long double x);
9194 <b> Description</b>
9195 2 The floor functions compute the largest integer value not greater than x.
9196 <b> Returns</b>
9197 3 The floor functions return ???x???, expressed as a floating-point number.
9198 <a name="7.12.9.3" href="#7.12.9.3"><b> 7.12.9.3 The nearbyint functions</b></a>
9199 <b> Synopsis</b>
9200 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9201 double nearbyint(double x);
9202 float nearbyintf(float x);
9203 long double nearbyintl(long double x);
9204 <b> Description</b>
9205 2 The nearbyint functions round their argument to an integer value in floating-point
9206 format, using the current rounding direction and without raising the ''inexact'' floating-
9207 point exception.
9208 <b> Returns</b>
9209 3 The nearbyint functions return the rounded integer value.
9210 <a name="7.12.9.4" href="#7.12.9.4"><b> 7.12.9.4 The rint functions</b></a>
9211 <b> Synopsis</b>
9212 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9213 double rint(double x);
9214 float rintf(float x);
9215 long double rintl(long double x);
9216 <b> Description</b>
9217 2 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
9218 rint functions may raise the ''inexact'' floating-point exception if the result differs in
9219 value from the argument.
9221 [<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
9223 <b> Returns</b>
9224 3 The rint functions return the rounded integer value.
9225 <a name="7.12.9.5" href="#7.12.9.5"><b> 7.12.9.5 The lrint and llrint functions</b></a>
9226 <b> Synopsis</b>
9227 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9228 long int lrint(double x);
9229 long int lrintf(float x);
9230 long int lrintl(long double x);
9231 long long int llrint(double x);
9232 long long int llrintf(float x);
9233 long long int llrintl(long double x);
9234 <b> Description</b>
9235 2 The lrint and llrint functions round their argument to the nearest integer value,
9236 rounding according to the current rounding direction. If the rounded value is outside the
9237 range of the return type, the numeric result is unspecified and a domain error or range
9238 error may occur. *
9239 <b> Returns</b>
9240 3 The lrint and llrint functions return the rounded integer value.
9241 <a name="7.12.9.6" href="#7.12.9.6"><b> 7.12.9.6 The round functions</b></a>
9242 <b> Synopsis</b>
9243 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9244 double round(double x);
9245 float roundf(float x);
9246 long double roundl(long double x);
9247 <b> Description</b>
9248 2 The round functions round their argument to the nearest integer value in floating-point
9249 format, rounding halfway cases away from zero, regardless of the current rounding
9250 direction.
9251 <b> Returns</b>
9252 3 The round functions return the rounded integer value.
9254 [<a name="p233" href="#p233">page 233</a>] (<a href="#Contents">Contents</a>)
9256 <a name="7.12.9.7" href="#7.12.9.7"><b> 7.12.9.7 The lround and llround functions</b></a>
9257 <b> Synopsis</b>
9258 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9259 long int lround(double x);
9260 long int lroundf(float x);
9261 long int lroundl(long double x);
9262 long long int llround(double x);
9263 long long int llroundf(float x);
9264 long long int llroundl(long double x);
9265 <b> Description</b>
9266 2 The lround and llround functions round their argument to the nearest integer value,
9267 rounding halfway cases away from zero, regardless of the current rounding direction. If
9268 the rounded value is outside the range of the return type, the numeric result is unspecified
9269 and a domain error or range error may occur.
9270 <b> Returns</b>
9271 3 The lround and llround functions return the rounded integer value.
9272 <a name="7.12.9.8" href="#7.12.9.8"><b> 7.12.9.8 The trunc functions</b></a>
9273 <b> Synopsis</b>
9274 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9275 double trunc(double x);
9276 float truncf(float x);
9277 long double truncl(long double x);
9278 <b> Description</b>
9279 2 The trunc functions round their argument to the integer value, in floating format,
9280 nearest to but no larger in magnitude than the argument.
9281 <b> Returns</b>
9282 3 The trunc functions return the truncated integer value.
9284 [<a name="p234" href="#p234">page 234</a>] (<a href="#Contents">Contents</a>)
9286 <a name="7.12.10" href="#7.12.10"><b> 7.12.10 Remainder functions</b></a>
9287 <a name="7.12.10.1" href="#7.12.10.1"><b> 7.12.10.1 The fmod functions</b></a>
9288 <b> Synopsis</b>
9289 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9290 double fmod(double x, double y);
9291 float fmodf(float x, float y);
9292 long double fmodl(long double x, long double y);
9293 <b> Description</b>
9294 2 The fmod functions compute the floating-point remainder of x/y.
9295 <b> Returns</b>
9296 3 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
9297 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
9298 whether a domain error occurs or the fmod functions return zero is implementation-
9299 defined.
9300 <a name="7.12.10.2" href="#7.12.10.2"><b> 7.12.10.2 The remainder functions</b></a>
9301 <b> Synopsis</b>
9302 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9303 double remainder(double x, double y);
9304 float remainderf(float x, float y);
9305 long double remainderl(long double x, long double y);
9306 <b> Description</b>
9307 2 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note210"><b>210)</b></a></sup>
9308 <b> Returns</b>
9309 3 The remainder functions return x REM y. If y is zero, whether a domain error occurs
9310 or the functions return zero is implementation defined.
9315 <sup><a name="note210" href="#note210"><b>210)</b></a></sup> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
9316 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
9317 | n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
9318 x.'' This definition is applicable for all implementations.
9320 [<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
9322 <a name="7.12.10.3" href="#7.12.10.3"><b> 7.12.10.3 The remquo functions</b></a>
9323 <b> Synopsis</b>
9324 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9325 double remquo(double x, double y, int *quo);
9326 float remquof(float x, float y, int *quo);
9327 long double remquol(long double x, long double y,
9328 int *quo);
9329 <b> Description</b>
9330 2 The remquo functions compute the same remainder as the remainder functions. In
9331 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
9332 magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
9333 n is an implementation-defined integer greater than or equal to 3.
9334 <b> Returns</b>
9335 3 The remquo functions return x REM y. If y is zero, the value stored in the object
9336 pointed to by quo is unspecified and whether a domain error occurs or the functions
9337 return zero is implementation defined.
9338 <a name="7.12.11" href="#7.12.11"><b> 7.12.11 Manipulation functions</b></a>
9339 <a name="7.12.11.1" href="#7.12.11.1"><b> 7.12.11.1 The copysign functions</b></a>
9340 <b> Synopsis</b>
9341 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9342 double copysign(double x, double y);
9343 float copysignf(float x, float y);
9344 long double copysignl(long double x, long double y);
9345 <b> Description</b>
9346 2 The copysign functions produce a value with the magnitude of x and the sign of y.
9347 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
9348 represent a signed zero but do not treat negative zero consistently in arithmetic
9349 operations, the copysign functions regard the sign of zero as positive.
9350 <b> Returns</b>
9351 3 The copysign functions return a value with the magnitude of x and the sign of y.
9353 [<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
9355 <a name="7.12.11.2" href="#7.12.11.2"><b> 7.12.11.2 The nan functions</b></a>
9356 <b> Synopsis</b>
9357 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9358 double nan(const char *tagp);
9359 float nanf(const char *tagp);
9360 long double nanl(const char *tagp);
9361 <b> Description</b>
9362 2 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
9363 sequence)", (char**) NULL); the call nan("") is equivalent to
9364 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
9365 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
9366 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
9367 and strtold.
9368 <b> Returns</b>
9369 3 The nan functions return a quiet NaN, if available, with content indicated through tagp.
9370 If the implementation does not support quiet NaNs, the functions return zero.
9371 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
9372 <a name="7.12.11.3" href="#7.12.11.3"><b> 7.12.11.3 The nextafter functions</b></a>
9373 <b> Synopsis</b>
9374 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9375 double nextafter(double x, double y);
9376 float nextafterf(float x, float y);
9377 long double nextafterl(long double x, long double y);
9378 <b> Description</b>
9379 2 The nextafter functions determine the next representable value, in the type of the
9380 function, after x in the direction of y, where x and y are first converted to the type of the
9381 function.<sup><a href="#note211"><b>211)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
9382 if the magnitude of x is the largest finite value representable in the type and the result is
9383 infinite or not representable in the type.
9384 <b> Returns</b>
9385 3 The nextafter functions return the next representable value in the specified format
9386 after x in the direction of y.
9389 <sup><a name="note211" href="#note211"><b>211)</b></a></sup> The argument values are converted to the type of the function, even by a macro implementation of the
9390 function.
9392 [<a name="p237" href="#p237">page 237</a>] (<a href="#Contents">Contents</a>)
9394 <a name="7.12.11.4" href="#7.12.11.4"><b> 7.12.11.4 The nexttoward functions</b></a>
9395 <b> Synopsis</b>
9396 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9397 double nexttoward(double x, long double y);
9398 float nexttowardf(float x, long double y);
9399 long double nexttowardl(long double x, long double y);
9400 <b> Description</b>
9401 2 The nexttoward functions are equivalent to the nextafter functions except that the
9402 second parameter has type long double and the functions return y converted to the
9403 type of the function if x equals y.<sup><a href="#note212"><b>212)</b></a></sup>
9404 <a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
9405 <a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
9406 <b> Synopsis</b>
9407 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9408 double fdim(double x, double y);
9409 float fdimf(float x, float y);
9410 long double fdiml(long double x, long double y);
9411 <b> Description</b>
9412 2 The fdim functions determine the positive difference between their arguments:
9413 ???x - y if x &gt; y
9415 ???+0 if x &lt;= y
9416 A range error may occur.
9417 <b> Returns</b>
9418 3 The fdim functions return the positive difference value.
9419 <a name="7.12.12.2" href="#7.12.12.2"><b> 7.12.12.2 The fmax functions</b></a>
9420 <b> Synopsis</b>
9421 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9422 double fmax(double x, double y);
9423 float fmaxf(float x, float y);
9424 long double fmaxl(long double x, long double y);
9428 <sup><a name="note212" href="#note212"><b>212)</b></a></sup> The result of the nexttoward functions is determined in the type of the function, without loss of
9429 range or precision in a floating second argument.
9431 [<a name="p238" href="#p238">page 238</a>] (<a href="#Contents">Contents</a>)
9433 <b> Description</b>
9434 2 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note213"><b>213)</b></a></sup>
9435 <b> Returns</b>
9436 3 The fmax functions return the maximum numeric value of their arguments.
9437 <a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
9438 <b> Synopsis</b>
9439 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9440 double fmin(double x, double y);
9441 float fminf(float x, float y);
9442 long double fminl(long double x, long double y);
9443 <b> Description</b>
9444 2 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note214"><b>214)</b></a></sup>
9445 <b> Returns</b>
9446 3 The fmin functions return the minimum numeric value of their arguments.
9447 <a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
9448 <a name="7.12.13.1" href="#7.12.13.1"><b> 7.12.13.1 The fma functions</b></a>
9449 <b> Synopsis</b>
9450 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9451 double fma(double x, double y, double z);
9452 float fmaf(float x, float y, float z);
9453 long double fmal(long double x, long double y,
9454 long double z);
9455 <b> Description</b>
9456 2 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
9457 the value (as if) to infinite precision and round once to the result format, according to the
9458 current rounding mode. A range error may occur.
9459 <b> Returns</b>
9460 3 The fma functions return (x x y) + z, rounded as one ternary operation.
9465 <sup><a name="note213" href="#note213"><b>213)</b></a></sup> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
9466 fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
9467 <sup><a name="note214" href="#note214"><b>214)</b></a></sup> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
9469 [<a name="p239" href="#p239">page 239</a>] (<a href="#Contents">Contents</a>)
9471 <a name="7.12.14" href="#7.12.14"><b> 7.12.14 Comparison macros</b></a>
9472 1 The relational and equality operators support the usual mathematical relationships
9473 between numeric values. For any ordered pair of numeric values exactly one of the
9474 relationships -- less, greater, and equal -- is true. Relational operators may raise the
9475 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
9476 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note215"><b>215)</b></a></sup> The following
9477 subclauses provide macros that are quiet (non floating-point exception raising) versions
9478 of the relational operators, and other comparison macros that facilitate writing efficient
9479 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
9480 the synopses in this subclause, real-floating indicates that the argument shall be an
9481 expression of real floating type.
9482 <a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
9483 <b> Synopsis</b>
9484 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9485 int isgreater(real-floating x, real-floating y);
9486 <b> Description</b>
9487 2 The isgreater macro determines whether its first argument is greater than its second
9488 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
9489 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
9490 exception when x and y are unordered.
9491 <b> Returns</b>
9492 3 The isgreater macro returns the value of (x) &gt; (y).
9493 <a name="7.12.14.2" href="#7.12.14.2"><b> 7.12.14.2 The isgreaterequal macro</b></a>
9494 <b> Synopsis</b>
9495 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9496 int isgreaterequal(real-floating x, real-floating y);
9497 <b> Description</b>
9498 2 The isgreaterequal macro determines whether its first argument is greater than or
9499 equal to its second argument. The value of isgreaterequal(x, y) is always equal
9500 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
9501 not raise the ''invalid'' floating-point exception when x and y are unordered.
9505 <sup><a name="note215" href="#note215"><b>215)</b></a></sup> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
9506 the operands compare unordered, as an error indicator for programs written without consideration of
9507 NaNs; the result in these cases is false.
9509 [<a name="p240" href="#p240">page 240</a>] (<a href="#Contents">Contents</a>)
9511 <b> Returns</b>
9512 3 The isgreaterequal macro returns the value of (x) &gt;= (y).
9513 <a name="7.12.14.3" href="#7.12.14.3"><b> 7.12.14.3 The isless macro</b></a>
9514 <b> Synopsis</b>
9515 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9516 int isless(real-floating x, real-floating y);
9517 <b> Description</b>
9518 2 The isless macro determines whether its first argument is less than its second
9519 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
9520 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
9521 exception when x and y are unordered.
9522 <b> Returns</b>
9523 3 The isless macro returns the value of (x) &lt; (y).
9524 <a name="7.12.14.4" href="#7.12.14.4"><b> 7.12.14.4 The islessequal macro</b></a>
9525 <b> Synopsis</b>
9526 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9527 int islessequal(real-floating x, real-floating y);
9528 <b> Description</b>
9529 2 The islessequal macro determines whether its first argument is less than or equal to
9530 its second argument. The value of islessequal(x, y) is always equal to
9531 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
9532 the ''invalid'' floating-point exception when x and y are unordered.
9533 <b> Returns</b>
9534 3 The islessequal macro returns the value of (x) &lt;= (y).
9535 <a name="7.12.14.5" href="#7.12.14.5"><b> 7.12.14.5 The islessgreater macro</b></a>
9536 <b> Synopsis</b>
9537 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9538 int islessgreater(real-floating x, real-floating y);
9539 <b> Description</b>
9540 2 The islessgreater macro determines whether its first argument is less than or
9541 greater than its second argument. The islessgreater(x, y) macro is similar to
9542 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
9543 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
9544 and y twice).
9546 [<a name="p241" href="#p241">page 241</a>] (<a href="#Contents">Contents</a>)
9548 <b> Returns</b>
9549 3 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
9550 <a name="7.12.14.6" href="#7.12.14.6"><b> 7.12.14.6 The isunordered macro</b></a>
9551 <b> Synopsis</b>
9552 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9553 int isunordered(real-floating x, real-floating y);
9554 <b> Description</b>
9555 2 The isunordered macro determines whether its arguments are unordered.
9556 <b> Returns</b>
9557 3 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
9559 [<a name="p242" href="#p242">page 242</a>] (<a href="#Contents">Contents</a>)
9561 <a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
9562 1 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
9563 one type, for bypassing the normal function call and return discipline.<sup><a href="#note216"><b>216)</b></a></sup>
9564 2 The type declared is
9565 jmp_buf
9566 which is an array type suitable for holding the information needed to restore a calling
9567 environment. The environment of a call to the setjmp macro consists of information
9568 sufficient for a call to the longjmp function to return execution to the correct block and
9569 invocation of that block, were it called recursively. It does not include the state of the
9570 floating-point status flags, of open files, or of any other component of the abstract
9571 machine.
9572 3 It is unspecified whether setjmp is a macro or an identifier declared with external
9573 linkage. If a macro definition is suppressed in order to access an actual function, or a
9574 program defines an external identifier with the name setjmp, the behavior is undefined.
9575 <a name="7.13.1" href="#7.13.1"><b> 7.13.1 Save calling environment</b></a>
9576 <a name="7.13.1.1" href="#7.13.1.1"><b> 7.13.1.1 The setjmp macro</b></a>
9577 <b> Synopsis</b>
9578 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9579 int setjmp(jmp_buf env);
9580 <b> Description</b>
9581 2 The setjmp macro saves its calling environment in its jmp_buf argument for later use
9582 by the longjmp function.
9583 <b> Returns</b>
9584 3 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
9585 return is from a call to the longjmp function, the setjmp macro returns a nonzero
9586 value.
9587 Environmental limits
9588 4 An invocation of the setjmp macro shall appear only in one of the following contexts:
9589 -- the entire controlling expression of a selection or iteration statement;
9590 -- one operand of a relational or equality operator with the other operand an integer
9591 constant expression, with the resulting expression being the entire controlling
9594 <sup><a name="note216" href="#note216"><b>216)</b></a></sup> These functions are useful for dealing with unusual conditions encountered in a low-level function of
9595 a program.
9597 [<a name="p243" href="#p243">page 243</a>] (<a href="#Contents">Contents</a>)
9599 expression of a selection or iteration statement;
9600 -- the operand of a unary ! operator with the resulting expression being the entire
9601 controlling expression of a selection or iteration statement; or
9602 -- the entire expression of an expression statement (possibly cast to void).
9603 5 If the invocation appears in any other context, the behavior is undefined.
9604 <a name="7.13.2" href="#7.13.2"><b> 7.13.2 Restore calling environment</b></a>
9605 <a name="7.13.2.1" href="#7.13.2.1"><b> 7.13.2.1 The longjmp function</b></a>
9606 <b> Synopsis</b>
9607 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9608 void longjmp(jmp_buf env, int val);
9609 <b> Description</b>
9610 2 The longjmp function restores the environment saved by the most recent invocation of
9611 the setjmp macro in the same invocation of the program with the corresponding
9612 jmp_buf argument. If there has been no such invocation, or if the function containing
9613 the invocation of the setjmp macro has terminated execution<sup><a href="#note217"><b>217)</b></a></sup> in the interim, or if the
9614 invocation of the setjmp macro was within the scope of an identifier with variably
9615 modified type and execution has left that scope in the interim, the behavior is undefined.
9616 3 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note218"><b>218)</b></a></sup>
9617 have state, as of the time the longjmp function was called, except that the values of
9618 objects of automatic storage duration that are local to the function containing the
9619 invocation of the corresponding setjmp macro that do not have volatile-qualified type
9620 and have been changed between the setjmp invocation and longjmp call are
9621 indeterminate.
9622 <b> Returns</b>
9623 4 After longjmp is completed, program execution continues as if the corresponding
9624 invocation of the setjmp macro had just returned the value specified by val. The
9625 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
9626 the setjmp macro returns the value 1.
9627 5 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
9628 might cause memory associated with a variable length array object to be squandered.
9633 <sup><a name="note217" href="#note217"><b>217)</b></a></sup> For example, by executing a return statement or because another longjmp call has caused a
9634 transfer to a setjmp invocation in a function earlier in the set of nested calls.
9635 <sup><a name="note218" href="#note218"><b>218)</b></a></sup> This includes, but is not limited to, the floating-point status flags and the state of open files.
9637 [<a name="p244" href="#p244">page 244</a>] (<a href="#Contents">Contents</a>)
9639 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
9640 jmp_buf buf;
9641 void g(int n);
9642 void h(int n);
9643 int n = 6;
9644 void f(void)
9646 int x[n]; // valid: f is not terminated
9647 setjmp(buf);
9648 g(n);
9650 void g(int n)
9652 int a[n]; // a may remain allocated
9653 h(n);
9655 void h(int n)
9657 int b[n]; // b may remain allocated
9658 longjmp(buf, 2); // might cause memory loss
9661 [<a name="p245" href="#p245">page 245</a>] (<a href="#Contents">Contents</a>)
9663 <a name="7.14" href="#7.14"><b> 7.14 Signal handling &lt;signal.h&gt;</b></a>
9664 1 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
9665 for handling various signals (conditions that may be reported during program execution).
9666 2 The type defined is
9667 sig_atomic_t
9668 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
9669 an atomic entity, even in the presence of asynchronous interrupts.
9670 3 The macros defined are
9671 SIG_DFL
9672 SIG_ERR
9673 SIG_IGN
9674 which expand to constant expressions with distinct values that have type compatible with
9675 the second argument to, and the return value of, the signal function, and whose values
9676 compare unequal to the address of any declarable function; and the following, which
9677 expand to positive integer constant expressions with type int and distinct values that are
9678 the signal numbers, each corresponding to the specified condition:
9679 SIGABRT abnormal termination, such as is initiated by the abort function
9680 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
9681 resulting in overflow
9682 SIGILL detection of an invalid function image, such as an invalid instruction
9683 SIGINT receipt of an interactive attention signal
9684 SIGSEGV an invalid access to storage
9685 SIGTERM a termination request sent to the program
9686 4 An implementation need not generate any of these signals, except as a result of explicit
9687 calls to the raise function. Additional signals and pointers to undeclarable functions,
9688 with macro definitions beginning, respectively, with the letters SIG and an uppercase
9689 letter or with SIG_ and an uppercase letter,<sup><a href="#note219"><b>219)</b></a></sup> may also be specified by the
9690 implementation. The complete set of signals, their semantics, and their default handling
9691 is implementation-defined; all signal numbers shall be positive.
9696 <sup><a name="note219" href="#note219"><b>219)</b></a></sup> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>). The names of the signal numbers reflect the following terms
9697 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
9698 and termination.
9700 [<a name="p246" href="#p246">page 246</a>] (<a href="#Contents">Contents</a>)
9702 <a name="7.14.1" href="#7.14.1"><b> 7.14.1 Specify signal handling</b></a>
9703 <a name="7.14.1.1" href="#7.14.1.1"><b> 7.14.1.1 The signal function</b></a>
9704 <b> Synopsis</b>
9705 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
9706 void (*signal(int sig, void (*func)(int)))(int);
9707 <b> Description</b>
9708 2 The signal function chooses one of three ways in which receipt of the signal number
9709 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
9710 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
9711 Otherwise, func shall point to a function to be called when that signal occurs. An
9712 invocation of such a function because of a signal, or (recursively) of any further functions
9713 called by that invocation (other than functions in the standard library), is called a signal
9714 handler.
9715 3 When a signal occurs and func points to a function, it is implementation-defined
9716 whether the equivalent of signal(sig, SIG_DFL); is executed or the
9717 implementation prevents some implementation-defined set of signals (at least including
9718 sig) from occurring until the current signal handling has completed; in the case of
9719 SIGILL, the implementation may alternatively define that no action is taken. Then the
9720 equivalent of (*func)(sig); is executed. If and when the function returns, if the
9721 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
9722 value corresponding to a computational exception, the behavior is undefined; otherwise
9723 the program will resume execution at the point it was interrupted.
9724 4 If the signal occurs as the result of calling the abort or raise function, the signal
9725 handler shall not call the raise function.
9726 5 If the signal occurs other than as the result of calling the abort or raise function, the
9727 behavior is undefined if the signal handler refers to any object with static storage duration
9728 other than by assigning a value to an object declared as volatile sig_atomic_t, or
9729 the signal handler calls any function in the standard library other than the abort
9730 function, the _Exit function, or the signal function with the first argument equal to
9731 the signal number corresponding to the signal that caused the invocation of the handler.
9732 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
9733 value of errno is indeterminate.<sup><a href="#note220"><b>220)</b></a></sup>
9734 6 At program startup, the equivalent of
9735 signal(sig, SIG_IGN);
9738 <sup><a name="note220" href="#note220"><b>220)</b></a></sup> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
9740 [<a name="p247" href="#p247">page 247</a>] (<a href="#Contents">Contents</a>)
9742 may be executed for some signals selected in an implementation-defined manner; the
9743 equivalent of
9744 signal(sig, SIG_DFL);
9745 is executed for all other signals defined by the implementation.
9746 7 The implementation shall behave as if no library function calls the signal function.
9747 <b> Returns</b>
9748 8 If the request can be honored, the signal function returns the value of func for the
9749 most recent successful call to signal for the specified signal sig. Otherwise, a value of
9750 SIG_ERR is returned and a positive value is stored in errno.
9751 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
9752 _Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
9753 <a name="7.14.2" href="#7.14.2"><b> 7.14.2 Send signal</b></a>
9754 <a name="7.14.2.1" href="#7.14.2.1"><b> 7.14.2.1 The raise function</b></a>
9755 <b> Synopsis</b>
9756 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
9757 int raise(int sig);
9758 <b> Description</b>
9759 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
9760 signal handler is called, the raise function shall not return until after the signal handler
9761 does.
9762 <b> Returns</b>
9763 3 The raise function returns zero if successful, nonzero if unsuccessful.
9765 [<a name="p248" href="#p248">page 248</a>] (<a href="#Contents">Contents</a>)
9767 <a name="7.15" href="#7.15"><b> 7.15 Variable arguments &lt;stdarg.h&gt;</b></a>
9768 1 The header <a href="#7.15">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
9769 through a list of arguments whose number and types are not known to the called function
9770 when it is translated.
9771 2 A function may be called with a variable number of arguments of varying types. As
9772 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
9773 parameter plays a special role in the access mechanism, and will be designated parmN in
9774 this description.
9775 3 The type declared is
9776 va_list
9777 which is an object type suitable for holding information needed by the macros
9778 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
9779 desired, the called function shall declare an object (generally referred to as ap in this
9780 subclause) having type va_list. The object ap may be passed as an argument to
9781 another function; if that function invokes the va_arg macro with parameter ap, the
9782 value of ap in the calling function is indeterminate and shall be passed to the va_end
9783 macro prior to any further reference to ap.<sup><a href="#note221"><b>221)</b></a></sup>
9784 <a name="7.15.1" href="#7.15.1"><b> 7.15.1 Variable argument list access macros</b></a>
9785 1 The va_start and va_arg macros described in this subclause shall be implemented
9786 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
9787 identifiers declared with external linkage. If a macro definition is suppressed in order to
9788 access an actual function, or a program defines an external identifier with the same name,
9789 the behavior is undefined. Each invocation of the va_start and va_copy macros
9790 shall be matched by a corresponding invocation of the va_end macro in the same
9791 function.
9792 <a name="7.15.1.1" href="#7.15.1.1"><b> 7.15.1.1 The va_arg macro</b></a>
9793 <b> Synopsis</b>
9794 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9795 type va_arg(va_list ap, type);
9796 <b> Description</b>
9797 2 The va_arg macro expands to an expression that has the specified type and the value of
9798 the next argument in the call. The parameter ap shall have been initialized by the
9799 va_start or va_copy macro (without an intervening invocation of the va_end
9801 <sup><a name="note221" href="#note221"><b>221)</b></a></sup> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
9802 case the original function may make further use of the original list after the other function returns.
9804 [<a name="p249" href="#p249">page 249</a>] (<a href="#Contents">Contents</a>)
9806 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
9807 values of successive arguments are returned in turn. The parameter type shall be a type
9808 name specified such that the type of a pointer to an object that has the specified type can
9809 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
9810 type is not compatible with the type of the actual next argument (as promoted according
9811 to the default argument promotions), the behavior is undefined, except for the following
9812 cases:
9813 -- one type is a signed integer type, the other type is the corresponding unsigned integer
9814 type, and the value is representable in both types;
9815 -- one type is pointer to void and the other is a pointer to a character type.
9816 <b> Returns</b>
9817 3 The first invocation of the va_arg macro after that of the va_start macro returns the
9818 value of the argument after that specified by parmN . Successive invocations return the
9819 values of the remaining arguments in succession.
9820 <a name="7.15.1.2" href="#7.15.1.2"><b> 7.15.1.2 The va_copy macro</b></a>
9821 <b> Synopsis</b>
9822 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9823 void va_copy(va_list dest, va_list src);
9824 <b> Description</b>
9825 2 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
9826 been applied to dest followed by the same sequence of uses of the va_arg macro as
9827 had previously been used to reach the present state of src. Neither the va_copy nor
9828 va_start macro shall be invoked to reinitialize dest without an intervening
9829 invocation of the va_end macro for the same dest.
9830 <b> Returns</b>
9831 3 The va_copy macro returns no value.
9832 <a name="7.15.1.3" href="#7.15.1.3"><b> 7.15.1.3 The va_end macro</b></a>
9833 <b> Synopsis</b>
9834 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9835 void va_end(va_list ap);
9836 <b> Description</b>
9837 2 The va_end macro facilitates a normal return from the function whose variable
9838 argument list was referred to by the expansion of the va_start macro, or the function
9839 containing the expansion of the va_copy macro, that initialized the va_list ap. The
9840 va_end macro may modify ap so that it is no longer usable (without being reinitialized
9842 [<a name="p250" href="#p250">page 250</a>] (<a href="#Contents">Contents</a>)
9844 by the va_start or va_copy macro). If there is no corresponding invocation of the
9845 va_start or va_copy macro, or if the va_end macro is not invoked before the
9846 return, the behavior is undefined.
9847 <b> Returns</b>
9848 3 The va_end macro returns no value.
9849 <a name="7.15.1.4" href="#7.15.1.4"><b> 7.15.1.4 The va_start macro</b></a>
9850 <b> Synopsis</b>
9851 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9852 void va_start(va_list ap, parmN);
9853 <b> Description</b>
9854 2 The va_start macro shall be invoked before any access to the unnamed arguments.
9855 3 The va_start macro initializes ap for subsequent use by the va_arg and va_end
9856 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
9857 without an intervening invocation of the va_end macro for the same ap.
9858 4 The parameter parmN is the identifier of the rightmost parameter in the variable
9859 parameter list in the function definition (the one just before the , ...). If the parameter
9860 parmN is declared with the register storage class, with a function or array type, or
9861 with a type that is not compatible with the type that results after application of the default
9862 argument promotions, the behavior is undefined.
9863 <b> Returns</b>
9864 5 The va_start macro returns no value.
9865 6 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
9866 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
9867 pointers is specified by the first argument to f1.
9868 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9869 #define MAXARGS 31
9870 void f1(int n_ptrs, ...)
9872 va_list ap;
9873 char *array[MAXARGS];
9874 int ptr_no = 0;
9876 [<a name="p251" href="#p251">page 251</a>] (<a href="#Contents">Contents</a>)
9878 if (n_ptrs &gt; MAXARGS)
9879 n_ptrs = MAXARGS;
9880 va_start(ap, n_ptrs);
9881 while (ptr_no &lt; n_ptrs)
9882 array[ptr_no++] = va_arg(ap, char *);
9883 va_end(ap);
9884 f2(n_ptrs, array);
9886 Each call to f1 is required to have visible the definition of the function or a declaration such as
9887 void f1(int, ...);
9889 7 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
9890 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
9891 is gathered again and passed to function f4.
9892 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
9893 #define MAXARGS 31
9894 void f3(int n_ptrs, int f4_after, ...)
9896 va_list ap, ap_save;
9897 char *array[MAXARGS];
9898 int ptr_no = 0;
9899 if (n_ptrs &gt; MAXARGS)
9900 n_ptrs = MAXARGS;
9901 va_start(ap, f4_after);
9902 while (ptr_no &lt; n_ptrs) {
9903 array[ptr_no++] = va_arg(ap, char *);
9904 if (ptr_no == f4_after)
9905 va_copy(ap_save, ap);
9907 va_end(ap);
9908 f2(n_ptrs, array);
9909 // Now process the saved copy.
9910 n_ptrs -= f4_after;
9911 ptr_no = 0;
9912 while (ptr_no &lt; n_ptrs)
9913 array[ptr_no++] = va_arg(ap_save, char *);
9914 va_end(ap_save);
9915 f4(n_ptrs, array);
9918 [<a name="p252" href="#p252">page 252</a>] (<a href="#Contents">Contents</a>)
9920 <a name="7.16" href="#7.16"><b> 7.16 Boolean type and values &lt;stdbool.h&gt;</b></a>
9921 1 The header <a href="#7.16">&lt;stdbool.h&gt;</a> defines four macros.
9922 2 The macro
9923 bool
9924 expands to _Bool.
9925 3 The remaining three macros are suitable for use in #if preprocessing directives. They
9927 true
9928 which expands to the integer constant 1,
9929 false
9930 which expands to the integer constant 0, and
9931 __bool_true_false_are_defined
9932 which expands to the integer constant 1.
9933 4 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
9934 redefine the macros bool, true, and false.<sup><a href="#note222"><b>222)</b></a></sup>
9939 <sup><a name="note222" href="#note222"><b>222)</b></a></sup> See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
9941 [<a name="p253" href="#p253">page 253</a>] (<a href="#Contents">Contents</a>)
9943 <a name="7.17" href="#7.17"><b> 7.17 Common definitions &lt;stddef.h&gt;</b></a>
9944 1 The following types and macros are defined in the standard header <a href="#7.17">&lt;stddef.h&gt;</a>. Some
9945 are also defined in other headers, as noted in their respective subclauses.
9946 2 The types are
9947 ptrdiff_t
9948 which is the signed integer type of the result of subtracting two pointers;
9949 size_t
9950 which is the unsigned integer type of the result of the sizeof operator; and
9951 wchar_t
9952 which is an integer type whose range of values can represent distinct codes for all
9953 members of the largest extended character set specified among the supported locales; the
9954 null character shall have the code value zero. Each member of the basic character set
9955 shall have a code value equal to its value when used as the lone character in an integer
9956 character constant if an implementation does not define
9957 __STDC_MB_MIGHT_NEQ_WC__.
9958 3 The macros are
9959 NULL
9960 which expands to an implementation-defined null pointer constant; and
9961 offsetof(type, member-designator)
9962 which expands to an integer constant expression that has type size_t, the value of
9963 which is the offset in bytes, to the structure member (designated by member-designator),
9964 from the beginning of its structure (designated by type). The type and member designator
9965 shall be such that given
9966 static type t;
9967 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
9968 specified member is a bit-field, the behavior is undefined.)
9969 Recommended practice
9970 4 The types used for size_t and ptrdiff_t should not have an integer conversion rank
9971 greater than that of signed long int unless the implementation supports objects
9972 large enough to make this necessary.
9973 Forward references: localization (<a href="#7.11">7.11</a>).
9975 [<a name="p254" href="#p254">page 254</a>] (<a href="#Contents">Contents</a>)
9977 <a name="7.18" href="#7.18"><b> 7.18 Integer types &lt;stdint.h&gt;</b></a>
9978 1 The header <a href="#7.18">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
9979 defines corresponding sets of macros.<sup><a href="#note223"><b>223)</b></a></sup> It also defines macros that specify limits of
9980 integer types corresponding to types defined in other standard headers.
9981 2 Types are defined in the following categories:
9982 -- integer types having certain exact widths;
9983 -- integer types having at least certain specified widths;
9984 -- fastest integer types having at least certain specified widths;
9985 -- integer types wide enough to hold pointers to objects;
9986 -- integer types having greatest width.
9987 (Some of these types may denote the same type.)
9988 3 Corresponding macros specify limits of the declared types and construct suitable
9989 constants.
9990 4 For each type described herein that the implementation provides,<sup><a href="#note224"><b>224)</b></a></sup> <a href="#7.18">&lt;stdint.h&gt;</a> shall
9991 declare that typedef name and define the associated macros. Conversely, for each type
9992 described herein that the implementation does not provide, <a href="#7.18">&lt;stdint.h&gt;</a> shall not
9993 declare that typedef name nor shall it define the associated macros. An implementation
9994 shall provide those types described as ''required'', but need not provide any of the others
9995 (described as ''optional'').
9996 <a name="7.18.1" href="#7.18.1"><b> 7.18.1 Integer types</b></a>
9997 1 When typedef names differing only in the absence or presence of the initial u are defined,
9998 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
9999 implementation providing one of these corresponding types shall also provide the other.
10000 2 In the following descriptions, the symbol N represents an unsigned decimal integer with
10001 no leading zeros (e.g., 8 or 24, but not 04 or 048).
10006 <sup><a name="note223" href="#note223"><b>223)</b></a></sup> See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
10007 <sup><a name="note224" href="#note224"><b>224)</b></a></sup> Some of these types may denote implementation-defined extended integer types.
10009 [<a name="p255" href="#p255">page 255</a>] (<a href="#Contents">Contents</a>)
10011 <a name="7.18.1.1" href="#7.18.1.1"><b> 7.18.1.1 Exact-width integer types</b></a>
10012 1 The typedef name intN_t designates a signed integer type with width N , no padding
10013 bits, and a two's complement representation. Thus, int8_t denotes a signed integer
10014 type with a width of exactly 8 bits.
10015 2 The typedef name uintN_t designates an unsigned integer type with width N . Thus,
10016 uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
10017 3 These types are optional. However, if an implementation provides integer types with
10018 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
10019 two's complement representation, it shall define the corresponding typedef names.
10020 <a name="7.18.1.2" href="#7.18.1.2"><b> 7.18.1.2 Minimum-width integer types</b></a>
10021 1 The typedef name int_leastN_t designates a signed integer type with a width of at
10022 least N , such that no signed integer type with lesser size has at least the specified width.
10023 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
10024 2 The typedef name uint_leastN_t designates an unsigned integer type with a width
10025 of at least N , such that no unsigned integer type with lesser size has at least the specified
10026 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
10027 least 16 bits.
10028 3 The following types are required:
10029 int_least8_t uint_least8_t
10030 int_least16_t uint_least16_t
10031 int_least32_t uint_least32_t
10032 int_least64_t uint_least64_t
10033 All other types of this form are optional.
10034 <a name="7.18.1.3" href="#7.18.1.3"><b> 7.18.1.3 Fastest minimum-width integer types</b></a>
10035 1 Each of the following types designates an integer type that is usually fastest<sup><a href="#note225"><b>225)</b></a></sup> to operate
10036 with among all integer types that have at least the specified width.
10037 2 The typedef name int_fastN_t designates the fastest signed integer type with a width
10038 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
10039 type with a width of at least N .
10044 <sup><a name="note225" href="#note225"><b>225)</b></a></sup> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
10045 grounds for choosing one type over another, it will simply pick some integer type satisfying the
10046 signedness and width requirements.
10048 [<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
10050 3 The following types are required:
10051 int_fast8_t uint_fast8_t
10052 int_fast16_t uint_fast16_t
10053 int_fast32_t uint_fast32_t
10054 int_fast64_t uint_fast64_t
10055 All other types of this form are optional.
10056 <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>
10057 1 The following type designates a signed integer type with the property that any valid
10058 pointer to void can be converted to this type, then converted back to pointer to void,
10059 and the result will compare equal to the original pointer:
10060 intptr_t
10061 The following type designates an unsigned integer type with the property that any valid
10062 pointer to void can be converted to this type, then converted back to pointer to void,
10063 and the result will compare equal to the original pointer:
10064 uintptr_t
10065 These types are optional.
10066 <a name="7.18.1.5" href="#7.18.1.5"><b> 7.18.1.5 Greatest-width integer types</b></a>
10067 1 The following type designates a signed integer type capable of representing any value of
10068 any signed integer type:
10069 intmax_t
10070 The following type designates an unsigned integer type capable of representing any value
10071 of any unsigned integer type:
10072 uintmax_t
10073 These types are required.
10074 <a name="7.18.2" href="#7.18.2"><b> 7.18.2 Limits of specified-width integer types</b></a>
10075 1 The following object-like macros<sup><a href="#note226"><b>226)</b></a></sup> specify the minimum and maximum limits of the
10076 types declared in <a href="#7.18">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
10077 <a href="#7.18.1">7.18.1</a>.
10078 2 Each instance of any defined macro shall be replaced by a constant expression suitable
10079 for use in #if preprocessing directives, and this expression shall have the same type as
10080 would an expression that is an object of the corresponding type converted according to
10082 <sup><a name="note226" href="#note226"><b>226)</b></a></sup> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
10083 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10085 [<a name="p257" href="#p257">page 257</a>] (<a href="#Contents">Contents</a>)
10087 the integer promotions. Its implementation-defined value shall be equal to or greater in
10088 magnitude (absolute value) than the corresponding value given below, with the same sign,
10089 except where stated to be exactly the given value.
10090 <a name="7.18.2.1" href="#7.18.2.1"><b> 7.18.2.1 Limits of exact-width integer types</b></a>
10091 1 -- minimum values of exact-width signed integer types
10092 INTN_MIN exactly -(2 N -1 )
10093 -- maximum values of exact-width signed integer types
10094 INTN_MAX exactly 2 N -1 - 1
10095 -- maximum values of exact-width unsigned integer types
10096 UINTN_MAX exactly 2 N - 1
10097 <a name="7.18.2.2" href="#7.18.2.2"><b> 7.18.2.2 Limits of minimum-width integer types</b></a>
10098 1 -- minimum values of minimum-width signed integer types
10099 INT_LEASTN_MIN -(2 N -1 - 1)
10100 -- maximum values of minimum-width signed integer types
10101 INT_LEASTN_MAX 2 N -1 - 1
10102 -- maximum values of minimum-width unsigned integer types
10103 UINT_LEASTN_MAX 2N - 1
10104 <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>
10105 1 -- minimum values of fastest minimum-width signed integer types
10106 INT_FASTN_MIN -(2 N -1 - 1)
10107 -- maximum values of fastest minimum-width signed integer types
10108 INT_FASTN_MAX 2 N -1 - 1
10109 -- maximum values of fastest minimum-width unsigned integer types
10110 UINT_FASTN_MAX 2N - 1
10111 <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>
10112 1 -- minimum value of pointer-holding signed integer type
10113 INTPTR_MIN -(215 - 1)
10114 -- maximum value of pointer-holding signed integer type
10115 INTPTR_MAX 215 - 1
10117 [<a name="p258" href="#p258">page 258</a>] (<a href="#Contents">Contents</a>)
10119 -- maximum value of pointer-holding unsigned integer type
10120 UINTPTR_MAX 216 - 1
10121 <a name="7.18.2.5" href="#7.18.2.5"><b> 7.18.2.5 Limits of greatest-width integer types</b></a>
10122 1 -- minimum value of greatest-width signed integer type
10123 INTMAX_MIN -(263 - 1)
10124 -- maximum value of greatest-width signed integer type
10125 INTMAX_MAX 263 - 1
10126 -- maximum value of greatest-width unsigned integer type
10127 UINTMAX_MAX 264 - 1
10128 <a name="7.18.3" href="#7.18.3"><b> 7.18.3 Limits of other integer types</b></a>
10129 1 The following object-like macros<sup><a href="#note227"><b>227)</b></a></sup> specify the minimum and maximum limits of
10130 integer types corresponding to types defined in other standard headers.
10131 2 Each instance of these macros shall be replaced by a constant expression suitable for use
10132 in #if preprocessing directives, and this expression shall have the same type as would an
10133 expression that is an object of the corresponding type converted according to the integer
10134 promotions. Its implementation-defined value shall be equal to or greater in magnitude
10135 (absolute value) than the corresponding value given below, with the same sign. An
10136 implementation shall define only the macros corresponding to those typedef names it
10137 actually provides.<sup><a href="#note228"><b>228)</b></a></sup>
10138 -- limits of ptrdiff_t
10139 PTRDIFF_MIN -65535
10140 PTRDIFF_MAX +65535
10141 -- limits of sig_atomic_t
10142 SIG_ATOMIC_MIN see below
10143 SIG_ATOMIC_MAX see below
10144 -- limit of size_t
10145 SIZE_MAX 65535
10146 -- limits of wchar_t
10150 <sup><a name="note227" href="#note227"><b>227)</b></a></sup> C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
10151 before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10152 <sup><a name="note228" href="#note228"><b>228)</b></a></sup> A freestanding implementation need not provide all of these types.
10154 [<a name="p259" href="#p259">page 259</a>] (<a href="#Contents">Contents</a>)
10156 WCHAR_MIN see below
10157 WCHAR_MAX see below
10158 -- limits of wint_t
10159 WINT_MIN see below
10160 WINT_MAX see below
10161 3 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
10162 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
10163 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
10164 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
10165 SIG_ATOMIC_MAX shall be no less than 255.
10166 4 If wchar_t (see <a href="#7.17">7.17</a>) is defined as a signed integer type, the value of WCHAR_MIN
10167 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
10168 otherwise, wchar_t is defined as an unsigned integer type, and the value of
10169 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note229"><b>229)</b></a></sup>
10170 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
10171 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
10172 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
10173 shall be 0 and the value of WINT_MAX shall be no less than 65535.
10174 <a name="7.18.4" href="#7.18.4"><b> 7.18.4 Macros for integer constants</b></a>
10175 1 The following function-like macros<sup><a href="#note230"><b>230)</b></a></sup> expand to integer constants suitable for
10176 initializing objects that have integer types corresponding to types defined in
10177 <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
10178 <a href="#7.18.1.5">7.18.1.5</a>.
10179 2 The argument in any instance of these macros shall be an unsuffixed integer constant (as
10180 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.
10181 3 Each invocation of one of these macros shall expand to an integer constant expression
10182 suitable for use in #if preprocessing directives. The type of the expression shall have
10183 the same type as would an expression of the corresponding type converted according to
10184 the integer promotions. The value of the expression shall be that of the argument.
10189 <sup><a name="note229" href="#note229"><b>229)</b></a></sup> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
10190 character set.
10191 <sup><a name="note230" href="#note230"><b>230)</b></a></sup> C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
10192 defined before <a href="#7.18">&lt;stdint.h&gt;</a> is included.
10194 [<a name="p260" href="#p260">page 260</a>] (<a href="#Contents">Contents</a>)
10196 <a name="7.18.4.1" href="#7.18.4.1"><b> 7.18.4.1 Macros for minimum-width integer constants</b></a>
10197 1 The macro INTN_C(value) shall expand to an integer constant expression
10198 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
10199 to an integer constant expression corresponding to the type uint_leastN_t. For
10200 example, if uint_least64_t is a name for the type unsigned long long int,
10201 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
10202 <a name="7.18.4.2" href="#7.18.4.2"><b> 7.18.4.2 Macros for greatest-width integer constants</b></a>
10203 1 The following macro expands to an integer constant expression having the value specified
10204 by its argument and the type intmax_t:
10205 INTMAX_C(value)
10206 The following macro expands to an integer constant expression having the value specified
10207 by its argument and the type uintmax_t:
10208 UINTMAX_C(value)
10210 [<a name="p261" href="#p261">page 261</a>] (<a href="#Contents">Contents</a>)
10212 <a name="7.19" href="#7.19"><b> 7.19 Input/output &lt;stdio.h&gt;</b></a>
10213 <a name="7.19.1" href="#7.19.1"><b> 7.19.1 Introduction</b></a>
10214 1 The header <a href="#7.19">&lt;stdio.h&gt;</a> declares three types, several macros, and many functions for
10215 performing input and output.
10216 2 The types declared are size_t (described in <a href="#7.17">7.17</a>);
10217 FILE
10218 which is an object type capable of recording all the information needed to control a
10219 stream, including its file position indicator, a pointer to its associated buffer (if any), an
10220 error indicator that records whether a read/write error has occurred, and an end-of-file
10221 indicator that records whether the end of the file has been reached; and
10222 fpos_t
10223 which is an object type other than an array type capable of recording all the information
10224 needed to specify uniquely every position within a file.
10225 3 The macros are NULL (described in <a href="#7.17">7.17</a>);
10226 _IOFBF
10227 _IOLBF
10228 _IONBF
10229 which expand to integer constant expressions with distinct values, suitable for use as the
10230 third argument to the setvbuf function;
10231 BUFSIZ
10232 which expands to an integer constant expression that is the size of the buffer used by the
10233 setbuf function;
10235 which expands to an integer constant expression, with type int and a negative value, that
10236 is returned by several functions to indicate end-of-file, that is, no more input from a
10237 stream;
10238 FOPEN_MAX
10239 which expands to an integer constant expression that is the minimum number of files that
10240 the implementation guarantees can be open simultaneously;
10241 FILENAME_MAX
10242 which expands to an integer constant expression that is the size needed for an array of
10243 char large enough to hold the longest file name string that the implementation
10245 [<a name="p262" href="#p262">page 262</a>] (<a href="#Contents">Contents</a>)
10247 guarantees can be opened;<sup><a href="#note231"><b>231)</b></a></sup>
10248 L_tmpnam
10249 which expands to an integer constant expression that is the size needed for an array of
10250 char large enough to hold a temporary file name string generated by the tmpnam
10251 function;
10252 SEEK_CUR
10253 SEEK_END
10254 SEEK_SET
10255 which expand to integer constant expressions with distinct values, suitable for use as the
10256 third argument to the fseek function;
10257 TMP_MAX
10258 which expands to an integer constant expression that is the maximum number of unique
10259 file names that can be generated by the tmpnam function;
10260 stderr
10261 stdin
10262 stdout
10263 which are expressions of type ''pointer to FILE'' that point to the FILE objects
10264 associated, respectively, with the standard error, input, and output streams.
10265 4 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
10266 and output. The wide character input/output functions described in that subclause
10267 provide operations analogous to most of those described here, except that the
10268 fundamental units internal to the program are wide characters. The external
10269 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
10270 described further in <a href="#7.19.3">7.19.3</a>.
10271 5 The input/output functions are given the following collective terms:
10272 -- The wide character input functions -- those functions described in <a href="#7.24">7.24</a> that perform
10273 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
10274 fwscanf, wscanf, vfwscanf, and vwscanf.
10275 -- The wide character output functions -- those functions described in <a href="#7.24">7.24</a> that perform
10276 output from wide characters and wide strings: fputwc, fputws, putwc,
10277 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
10280 <sup><a name="note231" href="#note231"><b>231)</b></a></sup> If the implementation imposes no practical limit on the length of file name strings, the value of
10281 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
10282 string. Of course, file name string contents are subject to other system-specific constraints; therefore
10283 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
10285 [<a name="p263" href="#p263">page 263</a>] (<a href="#Contents">Contents</a>)
10287 -- The wide character input/output functions -- the union of the ungetwc function, the
10288 wide character input functions, and the wide character output functions.
10289 -- The byte input/output functions -- those functions described in this subclause that
10290 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
10291 fscanf, fwrite, getc, getchar, gets, printf, putc, putchar, puts,
10292 scanf, ungetc, vfprintf, vfscanf, vprintf, and vscanf.
10293 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
10294 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>).
10295 <a name="7.19.2" href="#7.19.2"><b> 7.19.2 Streams</b></a>
10296 1 Input and output, whether to or from physical devices such as terminals and tape drives,
10297 or whether to or from files supported on structured storage devices, are mapped into
10298 logical data streams, whose properties are more uniform than their various inputs and
10299 outputs. Two forms of mapping are supported, for text streams and for binary
10300 streams.<sup><a href="#note232"><b>232)</b></a></sup>
10301 2 A text stream is an ordered sequence of characters composed into lines, each line
10302 consisting of zero or more characters plus a terminating new-line character. Whether the
10303 last line requires a terminating new-line character is implementation-defined. Characters
10304 may have to be added, altered, or deleted on input and output to conform to differing
10305 conventions for representing text in the host environment. Thus, there need not be a one-
10306 to-one correspondence between the characters in a stream and those in the external
10307 representation. Data read in from a text stream will necessarily compare equal to the data
10308 that were earlier written out to that stream only if: the data consist only of printing
10309 characters and the control characters horizontal tab and new-line; no new-line character is
10310 immediately preceded by space characters; and the last character is a new-line character.
10311 Whether space characters that are written out immediately before a new-line character
10312 appear when read in is implementation-defined.
10313 3 A binary stream is an ordered sequence of characters that can transparently record
10314 internal data. Data read in from a binary stream shall compare equal to the data that were
10315 earlier written out to that stream, under the same implementation. Such a stream may,
10316 however, have an implementation-defined number of null characters appended to the end
10317 of the stream.
10318 4 Each stream has an orientation. After a stream is associated with an external file, but
10319 before any operations are performed on it, the stream is without orientation. Once a wide
10320 character input/output function has been applied to a stream without orientation, the
10323 <sup><a name="note232" href="#note232"><b>232)</b></a></sup> An implementation need not distinguish between text streams and binary streams. In such an
10324 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
10325 line.
10327 [<a name="p264" href="#p264">page 264</a>] (<a href="#Contents">Contents</a>)
10329 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
10330 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
10331 Only a call to the freopen function or the fwide function can otherwise alter the
10332 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note233"><b>233)</b></a></sup>
10333 5 Byte input/output functions shall not be applied to a wide-oriented stream and wide
10334 character input/output functions shall not be applied to a byte-oriented stream. The
10335 remaining stream operations do not affect, and are not affected by, a stream's orientation,
10336 except for the following additional restrictions:
10337 -- Binary wide-oriented streams have the file-positioning restrictions ascribed to both
10338 text and binary streams.
10339 -- For wide-oriented streams, after a successful call to a file-positioning function that
10340 leaves the file position indicator prior to the end-of-file, a wide character output
10341 function can overwrite a partial multibyte character; any file contents beyond the
10342 byte(s) written are henceforth indeterminate.
10343 6 Each wide-oriented stream has an associated mbstate_t object that stores the current
10344 parse state of the stream. A successful call to fgetpos stores a representation of the
10345 value of this mbstate_t object as part of the value of the fpos_t object. A later
10346 successful call to fsetpos using the same stored fpos_t value restores the value of
10347 the associated mbstate_t object as well as the position within the controlled stream.
10348 Environmental limits
10349 7 An implementation shall support text files with lines containing at least 254 characters,
10350 including the terminating new-line character. The value of the macro BUFSIZ shall be at
10351 least 256.
10352 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>),
10353 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
10354 (<a href="#7.19.9.3">7.19.9.3</a>).
10359 <sup><a name="note233" href="#note233"><b>233)</b></a></sup> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
10361 [<a name="p265" href="#p265">page 265</a>] (<a href="#Contents">Contents</a>)
10363 <a name="7.19.3" href="#7.19.3"><b> 7.19.3 Files</b></a>
10364 1 A stream is associated with an external file (which may be a physical device) by opening
10365 a file, which may involve creating a new file. Creating an existing file causes its former
10366 contents to be discarded, if necessary. If a file can support positioning requests (such as a
10367 disk file, as opposed to a terminal), then a file position indicator associated with the
10368 stream is positioned at the start (character number zero) of the file, unless the file is
10369 opened with append mode in which case it is implementation-defined whether the file
10370 position indicator is initially positioned at the beginning or the end of the file. The file
10371 position indicator is maintained by subsequent reads, writes, and positioning requests, to
10372 facilitate an orderly progression through the file.
10373 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
10374 stream causes the associated file to be truncated beyond that point is implementation-
10375 defined.
10376 3 When a stream is unbuffered, characters are intended to appear from the source or at the
10377 destination as soon as possible. Otherwise characters may be accumulated and
10378 transmitted to or from the host environment as a block. When a stream is fully buffered,
10379 characters are intended to be transmitted to or from the host environment as a block when
10380 a buffer is filled. When a stream is line buffered, characters are intended to be
10381 transmitted to or from the host environment as a block when a new-line character is
10382 encountered. Furthermore, characters are intended to be transmitted as a block to the host
10383 environment when a buffer is filled, when input is requested on an unbuffered stream, or
10384 when input is requested on a line buffered stream that requires the transmission of
10385 characters from the host environment. Support for these characteristics is
10386 implementation-defined, and may be affected via the setbuf and setvbuf functions.
10387 4 A file may be disassociated from a controlling stream by closing the file. Output streams
10388 are flushed (any unwritten buffer contents are transmitted to the host environment) before
10389 the stream is disassociated from the file. The value of a pointer to a FILE object is
10390 indeterminate after the associated file is closed (including the standard text streams).
10391 Whether a file of zero length (on which no characters have been written by an output
10392 stream) actually exists is implementation-defined.
10393 5 The file may be subsequently reopened, by the same or another program execution, and
10394 its contents reclaimed or modified (if it can be repositioned at its start). If the main
10395 function returns to its original caller, or if the exit function is called, all open files are
10396 closed (hence all output streams are flushed) before program termination. Other paths to
10397 program termination, such as calling the abort function, need not close all files
10398 properly.
10399 6 The address of the FILE object used to control a stream may be significant; a copy of a
10400 FILE object need not serve in place of the original.
10402 [<a name="p266" href="#p266">page 266</a>] (<a href="#Contents">Contents</a>)
10404 7 At program startup, three text streams are predefined and need not be opened explicitly
10405 -- standard input (for reading conventional input), standard output (for writing
10406 conventional output), and standard error (for writing diagnostic output). As initially
10407 opened, the standard error stream is not fully buffered; the standard input and standard
10408 output streams are fully buffered if and only if the stream can be determined not to refer
10409 to an interactive device.
10410 8 Functions that open additional (nontemporary) files require a file name, which is a string.
10411 The rules for composing valid file names are implementation-defined. Whether the same
10412 file can be simultaneously open multiple times is also implementation-defined.
10413 9 Although both text and binary wide-oriented streams are conceptually sequences of wide
10414 characters, the external file associated with a wide-oriented stream is a sequence of
10415 multibyte characters, generalized as follows:
10416 -- Multibyte encodings within files may contain embedded null bytes (unlike multibyte
10417 encodings valid for use internal to the program).
10418 -- A file need not begin nor end in the initial shift state.<sup><a href="#note234"><b>234)</b></a></sup>
10419 10 Moreover, the encodings used for multibyte characters may differ among files. Both the
10420 nature and choice of such encodings are implementation-defined.
10421 11 The wide character input functions read multibyte characters from the stream and convert
10422 them to wide characters as if they were read by successive calls to the fgetwc function.
10423 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
10424 described by the stream's own mbstate_t object. The byte input functions read
10425 characters from the stream as if by successive calls to the fgetc function.
10426 12 The wide character output functions convert wide characters to multibyte characters and
10427 write them to the stream as if they were written by successive calls to the fputwc
10428 function. Each conversion occurs as if by a call to the wcrtomb function, with the
10429 conversion state described by the stream's own mbstate_t object. The byte output
10430 functions write characters to the stream as if by successive calls to the fputc function.
10431 13 In some cases, some of the byte input/output functions also perform conversions between
10432 multibyte characters and wide characters. These conversions also occur as if by calls to
10433 the mbrtowc and wcrtomb functions.
10434 14 An encoding error occurs if the character sequence presented to the underlying
10435 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
10436 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
10439 <sup><a name="note234" href="#note234"><b>234)</b></a></sup> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
10440 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
10441 with state-dependent encoding that does not assuredly end in the initial shift state.
10443 [<a name="p267" href="#p267">page 267</a>] (<a href="#Contents">Contents</a>)
10445 multibyte character. The wide character input/output functions and the byte input/output
10446 functions store the value of the macro EILSEQ in errno if and only if an encoding error
10447 occurs.
10448 Environmental limits
10449 15 The value of FOPEN_MAX shall be at least eight, including the three standard text
10450 streams.
10451 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
10452 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
10453 (<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
10454 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
10455 (<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>).
10456 <a name="7.19.4" href="#7.19.4"><b> 7.19.4 Operations on files</b></a>
10457 <a name="7.19.4.1" href="#7.19.4.1"><b> 7.19.4.1 The remove function</b></a>
10458 <b> Synopsis</b>
10459 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10460 int remove(const char *filename);
10461 <b> Description</b>
10462 2 The remove function causes the file whose name is the string pointed to by filename
10463 to be no longer accessible by that name. A subsequent attempt to open that file using that
10464 name will fail, unless it is created anew. If the file is open, the behavior of the remove
10465 function is implementation-defined.
10466 <b> Returns</b>
10467 3 The remove function returns zero if the operation succeeds, nonzero if it fails.
10468 <a name="7.19.4.2" href="#7.19.4.2"><b> 7.19.4.2 The rename function</b></a>
10469 <b> Synopsis</b>
10470 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10471 int rename(const char *old, const char *new);
10472 <b> Description</b>
10473 2 The rename function causes the file whose name is the string pointed to by old to be
10474 henceforth known by the name given by the string pointed to by new. The file named
10475 old is no longer accessible by that name. If a file named by the string pointed to by new
10476 exists prior to the call to the rename function, the behavior is implementation-defined.
10478 [<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
10480 <b> Returns</b>
10481 3 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note235"><b>235)</b></a></sup> in
10482 which case if the file existed previously it is still known by its original name.
10483 <a name="7.19.4.3" href="#7.19.4.3"><b> 7.19.4.3 The tmpfile function</b></a>
10484 <b> Synopsis</b>
10485 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10486 FILE *tmpfile(void);
10487 <b> Description</b>
10488 2 The tmpfile function creates a temporary binary file that is different from any other
10489 existing file and that will automatically be removed when it is closed or at program
10490 termination. If the program terminates abnormally, whether an open temporary file is
10491 removed is implementation-defined. The file is opened for update with "wb+" mode.
10492 Recommended practice
10493 3 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
10494 program (this limit may be shared with tmpnam) and there should be no limit on the
10495 number simultaneously open other than this limit and any limit on the number of open
10496 files (FOPEN_MAX).
10497 <b> Returns</b>
10498 4 The tmpfile function returns a pointer to the stream of the file that it created. If the file
10499 cannot be created, the tmpfile function returns a null pointer.
10500 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
10501 <a name="7.19.4.4" href="#7.19.4.4"><b> 7.19.4.4 The tmpnam function</b></a>
10502 <b> Synopsis</b>
10503 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10504 char *tmpnam(char *s);
10505 <b> Description</b>
10506 2 The tmpnam function generates a string that is a valid file name and that is not the same
10507 as the name of an existing file.<sup><a href="#note236"><b>236)</b></a></sup> The function is potentially capable of generating
10510 <sup><a name="note235" href="#note235"><b>235)</b></a></sup> Among the reasons the implementation may cause the rename function to fail are that the file is open
10511 or that it is necessary to copy its contents to effectuate its renaming.
10512 <sup><a name="note236" href="#note236"><b>236)</b></a></sup> Files created using strings generated by the tmpnam function are temporary only in the sense that
10513 their names should not collide with those generated by conventional naming rules for the
10514 implementation. It is still necessary to use the remove function to remove such files when their use
10515 is ended, and before program termination.
10517 [<a name="p269" href="#p269">page 269</a>] (<a href="#Contents">Contents</a>)
10519 TMP_MAX different strings, but any or all of them may already be in use by existing files
10520 and thus not be suitable return values.
10521 3 The tmpnam function generates a different string each time it is called.
10522 4 The implementation shall behave as if no library function calls the tmpnam function.
10523 <b> Returns</b>
10524 5 If no suitable string can be generated, the tmpnam function returns a null pointer.
10525 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
10526 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
10527 function may modify the same object). If the argument is not a null pointer, it is assumed
10528 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
10529 in that array and returns the argument as its value.
10530 Environmental limits
10531 6 The value of the macro TMP_MAX shall be at least 25.
10532 <a name="7.19.5" href="#7.19.5"><b> 7.19.5 File access functions</b></a>
10533 <a name="7.19.5.1" href="#7.19.5.1"><b> 7.19.5.1 The fclose function</b></a>
10534 <b> Synopsis</b>
10535 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10536 int fclose(FILE *stream);
10537 <b> Description</b>
10538 2 A successful call to the fclose function causes the stream pointed to by stream to be
10539 flushed and the associated file to be closed. Any unwritten buffered data for the stream
10540 are delivered to the host environment to be written to the file; any unread buffered data
10541 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
10542 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
10543 (and deallocated if it was automatically allocated).
10544 <b> Returns</b>
10545 3 The fclose function returns zero if the stream was successfully closed, or EOF if any
10546 errors were detected.
10547 <a name="7.19.5.2" href="#7.19.5.2"><b> 7.19.5.2 The fflush function</b></a>
10548 <b> Synopsis</b>
10549 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10550 int fflush(FILE *stream);
10552 [<a name="p270" href="#p270">page 270</a>] (<a href="#Contents">Contents</a>)
10554 <b> Description</b>
10555 2 If stream points to an output stream or an update stream in which the most recent
10556 operation was not input, the fflush function causes any unwritten data for that stream
10557 to be delivered to the host environment to be written to the file; otherwise, the behavior is
10558 undefined.
10559 3 If stream is a null pointer, the fflush function performs this flushing action on all
10560 streams for which the behavior is defined above.
10561 <b> Returns</b>
10562 4 The fflush function sets the error indicator for the stream and returns EOF if a write
10563 error occurs, otherwise it returns zero.
10564 Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
10565 <a name="7.19.5.3" href="#7.19.5.3"><b> 7.19.5.3 The fopen function</b></a>
10566 <b> Synopsis</b>
10567 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10568 FILE *fopen(const char * restrict filename,
10569 const char * restrict mode);
10570 <b> Description</b>
10571 2 The fopen function opens the file whose name is the string pointed to by filename,
10572 and associates a stream with it.
10573 3 The argument mode points to a string. If the string is one of the following, the file is
10574 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note237"><b>237)</b></a></sup>
10575 r open text file for reading
10576 w truncate to zero length or create text file for writing
10577 a append; open or create text file for writing at end-of-file
10578 rb open binary file for reading
10579 wb truncate to zero length or create binary file for writing
10580 ab append; open or create binary file for writing at end-of-file
10581 r+ open text file for update (reading and writing)
10582 w+ truncate to zero length or create text file for update
10583 a+ append; open or create text file for update, writing at end-of-file
10588 <sup><a name="note237" href="#note237"><b>237)</b></a></sup> If the string begins with one of the above sequences, the implementation might choose to ignore the
10589 remaining characters, or it might use them to select different kinds of a file (some of which might not
10590 conform to the properties in <a href="#7.19.2">7.19.2</a>).
10592 [<a name="p271" href="#p271">page 271</a>] (<a href="#Contents">Contents</a>)
10594 r+b or rb+ open binary file for update (reading and writing)
10595 w+b or wb+ truncate to zero length or create binary file for update
10596 a+b or ab+ append; open or create binary file for update, writing at end-of-file
10597 4 Opening a file with read mode ('r' as the first character in the mode argument) fails if
10598 the file does not exist or cannot be read.
10599 5 Opening a file with append mode ('a' as the first character in the mode argument)
10600 causes all subsequent writes to the file to be forced to the then current end-of-file,
10601 regardless of intervening calls to the fseek function. In some implementations, opening
10602 a binary file with append mode ('b' as the second or third character in the above list of
10603 mode argument values) may initially position the file position indicator for the stream
10604 beyond the last data written, because of null character padding.
10605 6 When a file is opened with update mode ('+' as the second or third character in the
10606 above list of mode argument values), both input and output may be performed on the
10607 associated stream. However, output shall not be directly followed by input without an
10608 intervening call to the fflush function or to a file positioning function (fseek,
10609 fsetpos, or rewind), and input shall not be directly followed by output without an
10610 intervening call to a file positioning function, unless the input operation encounters end-
10611 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
10612 binary stream in some implementations.
10613 7 When opened, a stream is fully buffered if and only if it can be determined not to refer to
10614 an interactive device. The error and end-of-file indicators for the stream are cleared.
10615 <b> Returns</b>
10616 8 The fopen function returns a pointer to the object controlling the stream. If the open
10617 operation fails, fopen returns a null pointer.
10618 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
10619 <a name="7.19.5.4" href="#7.19.5.4"><b> 7.19.5.4 The freopen function</b></a>
10620 <b> Synopsis</b>
10621 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10622 FILE *freopen(const char * restrict filename,
10623 const char * restrict mode,
10624 FILE * restrict stream);
10625 <b> Description</b>
10626 2 The freopen function opens the file whose name is the string pointed to by filename
10627 and associates the stream pointed to by stream with it. The mode argument is used just
10629 [<a name="p272" href="#p272">page 272</a>] (<a href="#Contents">Contents</a>)
10631 as in the fopen function.<sup><a href="#note238"><b>238)</b></a></sup>
10632 3 If filename is a null pointer, the freopen function attempts to change the mode of
10633 the stream to that specified by mode, as if the name of the file currently associated with
10634 the stream had been used. It is implementation-defined which changes of mode are
10635 permitted (if any), and under what circumstances.
10636 4 The freopen function first attempts to close any file that is associated with the specified
10637 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
10638 stream are cleared.
10639 <b> Returns</b>
10640 5 The freopen function returns a null pointer if the open operation fails. Otherwise,
10641 freopen returns the value of stream.
10642 <a name="7.19.5.5" href="#7.19.5.5"><b> 7.19.5.5 The setbuf function</b></a>
10643 <b> Synopsis</b>
10644 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10645 void setbuf(FILE * restrict stream,
10646 char * restrict buf);
10647 <b> Description</b>
10648 2 Except that it returns no value, the setbuf function is equivalent to the setvbuf
10649 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
10650 is a null pointer), with the value _IONBF for mode.
10651 <b> Returns</b>
10652 3 The setbuf function returns no value.
10653 Forward references: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
10654 <a name="7.19.5.6" href="#7.19.5.6"><b> 7.19.5.6 The setvbuf function</b></a>
10655 <b> Synopsis</b>
10656 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10657 int setvbuf(FILE * restrict stream,
10658 char * restrict buf,
10659 int mode, size_t size);
10664 <sup><a name="note238" href="#note238"><b>238)</b></a></sup> The primary use of the freopen function is to change the file associated with a standard text stream
10665 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
10666 returned by the fopen function may be assigned.
10668 [<a name="p273" href="#p273">page 273</a>] (<a href="#Contents">Contents</a>)
10670 <b> Description</b>
10671 2 The setvbuf function may be used only after the stream pointed to by stream has
10672 been associated with an open file and before any other operation (other than an
10673 unsuccessful call to setvbuf) is performed on the stream. The argument mode
10674 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
10675 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
10676 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
10677 used instead of a buffer allocated by the setvbuf function<sup><a href="#note239"><b>239)</b></a></sup> and the argument size
10678 specifies the size of the array; otherwise, size may determine the size of a buffer
10679 allocated by the setvbuf function. The contents of the array at any time are
10680 indeterminate.
10681 <b> Returns</b>
10682 3 The setvbuf function returns zero on success, or nonzero if an invalid value is given
10683 for mode or if the request cannot be honored.
10684 <a name="7.19.6" href="#7.19.6"><b> 7.19.6 Formatted input/output functions</b></a>
10685 1 The formatted input/output functions shall behave as if there is a sequence point after the
10686 actions associated with each specifier.<sup><a href="#note240"><b>240)</b></a></sup>
10687 <a name="7.19.6.1" href="#7.19.6.1"><b> 7.19.6.1 The fprintf function</b></a>
10688 <b> Synopsis</b>
10689 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10690 int fprintf(FILE * restrict stream,
10691 const char * restrict format, ...);
10692 <b> Description</b>
10693 2 The fprintf function writes output to the stream pointed to by stream, under control
10694 of the string pointed to by format that specifies how subsequent arguments are
10695 converted for output. If there are insufficient arguments for the format, the behavior is
10696 undefined. If the format is exhausted while arguments remain, the excess arguments are
10697 evaluated (as always) but are otherwise ignored. The fprintf function returns when
10698 the end of the format string is encountered.
10699 3 The format shall be a multibyte character sequence, beginning and ending in its initial
10700 shift state. The format is composed of zero or more directives: ordinary multibyte
10701 characters (not %), which are copied unchanged to the output stream; and conversion
10704 <sup><a name="note239" href="#note239"><b>239)</b></a></sup> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
10705 before a buffer that has automatic storage duration is deallocated upon block exit.
10706 <sup><a name="note240" href="#note240"><b>240)</b></a></sup> The fprintf functions perform writes to memory for the %n specifier.
10708 [<a name="p274" href="#p274">page 274</a>] (<a href="#Contents">Contents</a>)
10710 specifications, each of which results in fetching zero or more subsequent arguments,
10711 converting them, if applicable, according to the corresponding conversion specifier, and
10712 then writing the result to the output stream.
10713 4 Each conversion specification is introduced by the character %. After the %, the following
10714 appear in sequence:
10715 -- Zero or more flags (in any order) that modify the meaning of the conversion
10716 specification.
10717 -- An optional minimum field width. If the converted value has fewer characters than the
10718 field width, it is padded with spaces (by default) on the left (or right, if the left
10719 adjustment flag, described later, has been given) to the field width. The field width
10720 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note241"><b>241)</b></a></sup>
10721 -- An optional precision that gives the minimum number of digits to appear for the d, i,
10722 o, u, x, and X conversions, the number of digits to appear after the decimal-point
10723 character for a, A, e, E, f, and F conversions, the maximum number of significant
10724 digits for the g and G conversions, or the maximum number of bytes to be written for
10725 s conversions. The precision takes the form of a period (.) followed either by an
10726 asterisk * (described later) or by an optional decimal integer; if only the period is
10727 specified, the precision is taken as zero. If a precision appears with any other
10728 conversion specifier, the behavior is undefined.
10729 -- An optional length modifier that specifies the size of the argument.
10730 -- A conversion specifier character that specifies the type of conversion to be applied.
10731 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
10732 this case, an int argument supplies the field width or precision. The arguments
10733 specifying field width, or precision, or both, shall appear (in that order) before the
10734 argument (if any) to be converted. A negative field width argument is taken as a - flag
10735 followed by a positive field width. A negative precision argument is taken as if the
10736 precision were omitted.
10737 6 The flag characters and their meanings are:
10738 - The result of the conversion is left-justified within the field. (It is right-justified if
10739 this flag is not specified.)
10740 + The result of a signed conversion always begins with a plus or minus sign. (It
10741 begins with a sign only when a negative value is converted if this flag is not
10746 <sup><a name="note241" href="#note241"><b>241)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
10748 [<a name="p275" href="#p275">page 275</a>] (<a href="#Contents">Contents</a>)
10750 specified.)<sup><a href="#note242"><b>242)</b></a></sup>
10751 space If the first character of a signed conversion is not a sign, or if a signed conversion
10752 results in no characters, a space is prefixed to the result. If the space and + flags
10753 both appear, the space flag is ignored.
10754 # The result is converted to an ''alternative form''. For o conversion, it increases
10755 the precision, if and only if necessary, to force the first digit of the result to be a
10756 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
10757 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
10758 and G conversions, the result of converting a floating-point number always
10759 contains a decimal-point character, even if no digits follow it. (Normally, a
10760 decimal-point character appears in the result of these conversions only if a digit
10761 follows it.) For g and G conversions, trailing zeros are not removed from the
10762 result. For other conversions, the behavior is undefined.
10763 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
10764 (following any indication of sign or base) are used to pad to the field width rather
10765 than performing space padding, except when converting an infinity or NaN. If the
10766 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
10767 conversions, if a precision is specified, the 0 flag is ignored. For other
10768 conversions, the behavior is undefined.
10769 7 The length modifiers and their meanings are:
10770 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10771 signed char or unsigned char argument (the argument will have
10772 been promoted according to the integer promotions, but its value shall be
10773 converted to signed char or unsigned char before printing); or that
10774 a following n conversion specifier applies to a pointer to a signed char
10775 argument.
10776 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10777 short int or unsigned short int argument (the argument will
10778 have been promoted according to the integer promotions, but its value shall
10779 be converted to short int or unsigned short int before printing);
10780 or that a following n conversion specifier applies to a pointer to a short
10781 int argument.
10782 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10783 long int or unsigned long int argument; that a following n
10784 conversion specifier applies to a pointer to a long int argument; that a
10786 <sup><a name="note242" href="#note242"><b>242)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
10787 include a minus sign.
10789 [<a name="p276" href="#p276">page 276</a>] (<a href="#Contents">Contents</a>)
10791 following c conversion specifier applies to a wint_t argument; that a
10792 following s conversion specifier applies to a pointer to a wchar_t
10793 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
10794 specifier.
10795 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10796 long long int or unsigned long long int argument; or that a
10797 following n conversion specifier applies to a pointer to a long long int
10798 argument.
10799 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
10800 an intmax_t or uintmax_t argument; or that a following n conversion
10801 specifier applies to a pointer to an intmax_t argument.
10802 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10803 size_t or the corresponding signed integer type argument; or that a
10804 following n conversion specifier applies to a pointer to a signed integer type
10805 corresponding to size_t argument.
10806 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
10807 ptrdiff_t or the corresponding unsigned integer type argument; or that a
10808 following n conversion specifier applies to a pointer to a ptrdiff_t
10809 argument.
10810 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
10811 applies to a long double argument.
10812 If a length modifier appears with any conversion specifier other than as specified above,
10813 the behavior is undefined.
10814 8 The conversion specifiers and their meanings are:
10815 d,i The int argument is converted to signed decimal in the style [-]dddd. The
10816 precision specifies the minimum number of digits to appear; if the value
10817 being converted can be represented in fewer digits, it is expanded with
10818 leading zeros. The default precision is 1. The result of converting a zero
10819 value with a precision of zero is no characters.
10820 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
10821 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
10822 letters abcdef are used for x conversion and the letters ABCDEF for X
10823 conversion. The precision specifies the minimum number of digits to appear;
10824 if the value being converted can be represented in fewer digits, it is expanded
10825 with leading zeros. The default precision is 1. The result of converting a
10826 zero value with a precision of zero is no characters.
10828 [<a name="p277" href="#p277">page 277</a>] (<a href="#Contents">Contents</a>)
10830 f,F A double argument representing a floating-point number is converted to
10831 decimal notation in the style [-]ddd.ddd, where the number of digits after
10832 the decimal-point character is equal to the precision specification. If the
10833 precision is missing, it is taken as 6; if the precision is zero and the # flag is
10834 not specified, no decimal-point character appears. If a decimal-point
10835 character appears, at least one digit appears before it. The value is rounded to
10836 the appropriate number of digits.
10837 A double argument representing an infinity is converted in one of the styles
10838 [-]inf or [-]infinity -- which style is implementation-defined. A
10839 double argument representing a NaN is converted in one of the styles
10840 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
10841 any n-char-sequence, is implementation-defined. The F conversion specifier
10842 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
10843 respectively.<sup><a href="#note243"><b>243)</b></a></sup>
10844 e,E A double argument representing a floating-point number is converted in the
10845 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
10846 argument is nonzero) before the decimal-point character and the number of
10847 digits after it is equal to the precision; if the precision is missing, it is taken as
10848 6; if the precision is zero and the # flag is not specified, no decimal-point
10849 character appears. The value is rounded to the appropriate number of digits.
10850 The E conversion specifier produces a number with E instead of e
10851 introducing the exponent. The exponent always contains at least two digits,
10852 and only as many more digits as necessary to represent the exponent. If the
10853 value is zero, the exponent is zero.
10854 A double argument representing an infinity or NaN is converted in the style
10855 of an f or F conversion specifier.
10856 g,G A double argument representing a floating-point number is converted in
10857 style f or e (or in style F or E in the case of a G conversion specifier),
10858 depending on the value converted and the precision. Let P equal the
10859 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
10860 Then, if a conversion with style E would have an exponent of X :
10861 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
10862 P - (X + 1).
10863 -- otherwise, the conversion is with style e (or E) and precision P - 1.
10864 Finally, unless the # flag is used, any trailing zeros are removed from the
10866 <sup><a name="note243" href="#note243"><b>243)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
10867 the # and 0 flag characters have no effect.
10869 [<a name="p278" href="#p278">page 278</a>] (<a href="#Contents">Contents</a>)
10871 fractional portion of the result and the decimal-point character is removed if
10872 there is no fractional portion remaining.
10873 A double argument representing an infinity or NaN is converted in the style
10874 of an f or F conversion specifier.
10875 a,A A double argument representing a floating-point number is converted in the
10876 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
10877 nonzero if the argument is a normalized floating-point number and is
10878 otherwise unspecified) before the decimal-point character<sup><a href="#note244"><b>244)</b></a></sup> and the number
10879 of hexadecimal digits after it is equal to the precision; if the precision is
10880 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
10881 an exact representation of the value; if the precision is missing and
10882 FLT_RADIX is not a power of 2, then the precision is sufficient to
10883 distinguish<sup><a href="#note245"><b>245)</b></a></sup> values of type double, except that trailing zeros may be
10884 omitted; if the precision is zero and the # flag is not specified, no decimal-
10885 point character appears. The letters abcdef are used for a conversion and
10886 the letters ABCDEF for A conversion. The A conversion specifier produces a
10887 number with X and P instead of x and p. The exponent always contains at
10888 least one digit, and only as many more digits as necessary to represent the
10889 decimal exponent of 2. If the value is zero, the exponent is zero.
10890 A double argument representing an infinity or NaN is converted in the style
10891 of an f or F conversion specifier.
10892 c If no l length modifier is present, the int argument is converted to an
10893 unsigned char, and the resulting character is written.
10894 If an l length modifier is present, the wint_t argument is converted as if by
10895 an ls conversion specification with no precision and an argument that points
10896 to the initial element of a two-element array of wchar_t, the first element
10897 containing the wint_t argument to the lc conversion specification and the
10898 second a null wide character.
10899 s If no l length modifier is present, the argument shall be a pointer to the initial
10900 element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are
10903 <sup><a name="note244" href="#note244"><b>244)</b></a></sup> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
10904 that subsequent digits align to nibble (4-bit) boundaries.
10905 <sup><a name="note245" href="#note245"><b>245)</b></a></sup> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
10906 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
10907 might suffice depending on the implementation's scheme for determining the digit to the left of the
10908 decimal-point character.
10909 <sup><a name="note246" href="#note246"><b>246)</b></a></sup> No special provisions are made for multibyte characters.
10911 [<a name="p279" href="#p279">page 279</a>] (<a href="#Contents">Contents</a>)
10913 written up to (but not including) the terminating null character. If the
10914 precision is specified, no more than that many bytes are written. If the
10915 precision is not specified or is greater than the size of the array, the array shall
10916 contain a null character.
10917 If an l length modifier is present, the argument shall be a pointer to the initial
10918 element of an array of wchar_t type. Wide characters from the array are
10919 converted to multibyte characters (each as if by a call to the wcrtomb
10920 function, with the conversion state described by an mbstate_t object
10921 initialized to zero before the first wide character is converted) up to and
10922 including a terminating null wide character. The resulting multibyte
10923 characters are written up to (but not including) the terminating null character
10924 (byte). If no precision is specified, the array shall contain a null wide
10925 character. If a precision is specified, no more than that many bytes are
10926 written (including shift sequences, if any), and the array shall contain a null
10927 wide character if, to equal the multibyte character sequence length given by
10928 the precision, the function would need to access a wide character one past the
10929 end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup>
10930 p The argument shall be a pointer to void. The value of the pointer is
10931 converted to a sequence of printing characters, in an implementation-defined
10932 manner.
10933 n The argument shall be a pointer to signed integer into which is written the
10934 number of characters written to the output stream so far by this call to
10935 fprintf. No argument is converted, but one is consumed. If the conversion
10936 specification includes any flags, a field width, or a precision, the behavior is
10937 undefined.
10938 % A % character is written. No argument is converted. The complete
10939 conversion specification shall be %%.
10940 9 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note248"><b>248)</b></a></sup> If any argument is
10941 not the correct type for the corresponding conversion specification, the behavior is
10942 undefined.
10943 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
10944 of a conversion is wider than the field width, the field is expanded to contain the
10945 conversion result.
10950 <sup><a name="note247" href="#note247"><b>247)</b></a></sup> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
10951 <sup><a name="note248" href="#note248"><b>248)</b></a></sup> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
10953 [<a name="p280" href="#p280">page 280</a>] (<a href="#Contents">Contents</a>)
10955 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
10956 to a hexadecimal floating number with the given precision.
10957 Recommended practice
10958 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
10959 representable in the given precision, the result should be one of the two adjacent numbers
10960 in hexadecimal floating style with the given precision, with the extra stipulation that the
10961 error should have a correct sign for the current rounding direction.
10962 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
10963 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note249"><b>249)</b></a></sup> If the number of
10964 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
10965 representable with DECIMAL_DIG digits, then the result should be an exact
10966 representation with trailing zeros. Otherwise, the source value is bounded by two
10967 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
10968 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
10969 the error should have a correct sign for the current rounding direction.
10970 <b> Returns</b>
10971 14 The fprintf function returns the number of characters transmitted, or a negative value
10972 if an output or encoding error occurred.
10973 Environmental limits
10974 15 The number of characters that can be produced by any single conversion shall be at least
10975 4095.
10976 16 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
10977 places:
10978 #include <a href="#7.12">&lt;math.h&gt;</a>
10979 #include <a href="#7.19">&lt;stdio.h&gt;</a>
10980 /* ... */
10981 char *weekday, *month; // pointers to strings
10982 int day, hour, min;
10983 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
10984 weekday, month, day, hour, min);
10985 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
10987 17 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
10988 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
10989 the first of which is denoted here by a and the second by an uppercase letter.
10994 <sup><a name="note249" href="#note249"><b>249)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
10995 given format specifier. The number of significant digits is determined by the format specifier, and in
10996 the case of fixed-point conversion by the source value as well.
10998 [<a name="p281" href="#p281">page 281</a>] (<a href="#Contents">Contents</a>)
11000 18 Given the following wide string with length seven,
11001 static wchar_t wstr[] = L" X Yabc Z W";
11002 the seven calls
11003 fprintf(stdout, "|1234567890123|\n");
11004 fprintf(stdout, "|%13ls|\n", wstr);
11005 fprintf(stdout, "|%-13.9ls|\n", wstr);
11006 fprintf(stdout, "|%13.10ls|\n", wstr);
11007 fprintf(stdout, "|%13.11ls|\n", wstr);
11008 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
11009 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
11010 will print the following seven lines:
11011 |1234567890123|
11012 | X Yabc Z W|
11013 | X Yabc Z |
11014 | X Yabc Z|
11015 | X Yabc Z W|
11016 | abc Z W|
11017 | Z|
11019 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>).
11020 <a name="7.19.6.2" href="#7.19.6.2"><b> 7.19.6.2 The fscanf function</b></a>
11021 <b> Synopsis</b>
11022 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11023 int fscanf(FILE * restrict stream,
11024 const char * restrict format, ...);
11025 <b> Description</b>
11026 2 The fscanf function reads input from the stream pointed to by stream, under control
11027 of the string pointed to by format that specifies the admissible input sequences and how
11028 they are to be converted for assignment, using subsequent arguments as pointers to the
11029 objects to receive the converted input. If there are insufficient arguments for the format,
11030 the behavior is undefined. If the format is exhausted while arguments remain, the excess
11031 arguments are evaluated (as always) but are otherwise ignored.
11032 3 The format shall be a multibyte character sequence, beginning and ending in its initial
11033 shift state. The format is composed of zero or more directives: one or more white-space
11034 characters, an ordinary multibyte character (neither % nor a white-space character), or a
11035 conversion specification. Each conversion specification is introduced by the character %.
11036 After the %, the following appear in sequence:
11037 -- An optional assignment-suppressing character *.
11038 -- An optional decimal integer greater than zero that specifies the maximum field width
11039 (in characters).
11041 [<a name="p282" href="#p282">page 282</a>] (<a href="#Contents">Contents</a>)
11043 -- An optional length modifier that specifies the size of the receiving object.
11044 -- A conversion specifier character that specifies the type of conversion to be applied.
11045 4 The fscanf function executes each directive of the format in turn. If a directive fails, as
11046 detailed below, the function returns. Failures are described as input failures (due to the
11047 occurrence of an encoding error or the unavailability of input characters), or matching
11048 failures (due to inappropriate input).
11049 5 A directive composed of white-space character(s) is executed by reading input up to the
11050 first non-white-space character (which remains unread), or until no more characters can
11051 be read.
11052 6 A directive that is an ordinary multibyte character is executed by reading the next
11053 characters of the stream. If any of those characters differ from the ones composing the
11054 directive, the directive fails and the differing and subsequent characters remain unread.
11055 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
11056 read, the directive fails.
11057 7 A directive that is a conversion specification defines a set of matching input sequences, as
11058 described below for each specifier. A conversion specification is executed in the
11059 following steps:
11060 8 Input white-space characters (as specified by the isspace function) are skipped, unless
11061 the specification includes a [, c, or n specifier.<sup><a href="#note250"><b>250)</b></a></sup>
11062 9 An input item is read from the stream, unless the specification includes an n specifier. An
11063 input item is defined as the longest sequence of input characters which does not exceed
11064 any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note251"><b>251)</b></a></sup>
11065 The first character, if any, after the input item remains unread. If the length of the input
11066 item is zero, the execution of the directive fails; this condition is a matching failure unless
11067 end-of-file, an encoding error, or a read error prevented input from the stream, in which
11068 case it is an input failure.
11069 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
11070 count of input characters) is converted to a type appropriate to the conversion specifier. If
11071 the input item is not a matching sequence, the execution of the directive fails: this
11072 condition is a matching failure. Unless assignment suppression was indicated by a *, the
11073 result of the conversion is placed in the object pointed to by the first argument following
11074 the format argument that has not already received a conversion result. If this object
11075 does not have an appropriate type, or if the result of the conversion cannot be represented
11078 <sup><a name="note250" href="#note250"><b>250)</b></a></sup> These white-space characters are not counted against a specified field width.
11079 <sup><a name="note251" href="#note251"><b>251)</b></a></sup> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
11080 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
11082 [<a name="p283" href="#p283">page 283</a>] (<a href="#Contents">Contents</a>)
11084 in the object, the behavior is undefined.
11085 11 The length modifiers and their meanings are:
11086 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11087 to an argument with type pointer to signed char or unsigned char.
11088 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11089 to an argument with type pointer to short int or unsigned short
11090 int.
11091 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11092 to an argument with type pointer to long int or unsigned long
11093 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
11094 an argument with type pointer to double; or that a following c, s, or [
11095 conversion specifier applies to an argument with type pointer to wchar_t.
11096 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11097 to an argument with type pointer to long long int or unsigned
11098 long long int.
11099 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11100 to an argument with type pointer to intmax_t or uintmax_t.
11101 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11102 to an argument with type pointer to size_t or the corresponding signed
11103 integer type.
11104 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
11105 to an argument with type pointer to ptrdiff_t or the corresponding
11106 unsigned integer type.
11107 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
11108 applies to an argument with type pointer to long double.
11109 If a length modifier appears with any conversion specifier other than as specified above,
11110 the behavior is undefined.
11111 12 The conversion specifiers and their meanings are:
11112 d Matches an optionally signed decimal integer, whose format is the same as
11113 expected for the subject sequence of the strtol function with the value 10
11114 for the base argument. The corresponding argument shall be a pointer to
11115 signed integer.
11116 i Matches an optionally signed integer, whose format is the same as expected
11117 for the subject sequence of the strtol function with the value 0 for the
11118 base argument. The corresponding argument shall be a pointer to signed
11119 integer.
11121 [<a name="p284" href="#p284">page 284</a>] (<a href="#Contents">Contents</a>)
11123 o Matches an optionally signed octal integer, whose format is the same as
11124 expected for the subject sequence of the strtoul function with the value 8
11125 for the base argument. The corresponding argument shall be a pointer to
11126 unsigned integer.
11127 u Matches an optionally signed decimal integer, whose format is the same as
11128 expected for the subject sequence of the strtoul function with the value 10
11129 for the base argument. The corresponding argument shall be a pointer to
11130 unsigned integer.
11131 x Matches an optionally signed hexadecimal integer, whose format is the same
11132 as expected for the subject sequence of the strtoul function with the value
11133 16 for the base argument. The corresponding argument shall be a pointer to
11134 unsigned integer.
11135 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
11136 format is the same as expected for the subject sequence of the strtod
11137 function. The corresponding argument shall be a pointer to floating.
11138 c Matches a sequence of characters of exactly the number specified by the field
11139 width (1 if no field width is present in the directive).<sup><a href="#note252"><b>252)</b></a></sup>
11140 If no l length modifier is present, the corresponding argument shall be a
11141 pointer to the initial element of a character array large enough to accept the
11142 sequence. No null character is added.
11143 If an l length modifier is present, the input shall be a sequence of multibyte
11144 characters that begins in the initial shift state. Each multibyte character in the
11145 sequence is converted to a wide character as if by a call to the mbrtowc
11146 function, with the conversion state described by an mbstate_t object
11147 initialized to zero before the first multibyte character is converted. The
11148 corresponding argument shall be a pointer to the initial element of an array of
11149 wchar_t large enough to accept the resulting sequence of wide characters.
11150 No null wide character is added.
11151 s Matches a sequence of non-white-space characters.252)
11152 If no l length modifier is present, the corresponding argument shall be a
11153 pointer to the initial element of a character array large enough to accept the
11154 sequence and a terminating null character, which will be added automatically.
11155 If an l length modifier is present, the input shall be a sequence of multibyte
11158 <sup><a name="note252" href="#note252"><b>252)</b></a></sup> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
11159 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
11160 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
11162 [<a name="p285" href="#p285">page 285</a>] (<a href="#Contents">Contents</a>)
11164 characters that begins in the initial shift state. Each multibyte character is
11165 converted to a wide character as if by a call to the mbrtowc function, with
11166 the conversion state described by an mbstate_t object initialized to zero
11167 before the first multibyte character is converted. The corresponding argument
11168 shall be a pointer to the initial element of an array of wchar_t large enough
11169 to accept the sequence and the terminating null wide character, which will be
11170 added automatically.
11171 [ Matches a nonempty sequence of characters from a set of expected characters
11172 (the scanset).252)
11173 If no l length modifier is present, the corresponding argument shall be a
11174 pointer to the initial element of a character array large enough to accept the
11175 sequence and a terminating null character, which will be added automatically.
11176 If an l length modifier is present, the input shall be a sequence of multibyte
11177 characters that begins in the initial shift state. Each multibyte character is
11178 converted to a wide character as if by a call to the mbrtowc function, with
11179 the conversion state described by an mbstate_t object initialized to zero
11180 before the first multibyte character is converted. The corresponding argument
11181 shall be a pointer to the initial element of an array of wchar_t large enough
11182 to accept the sequence and the terminating null wide character, which will be
11183 added automatically.
11184 The conversion specifier includes all subsequent characters in the format
11185 string, up to and including the matching right bracket (]). The characters
11186 between the brackets (the scanlist) compose the scanset, unless the character
11187 after the left bracket is a circumflex (^), in which case the scanset contains all
11188 characters that do not appear in the scanlist between the circumflex and the
11189 right bracket. If the conversion specifier begins with [] or [^], the right
11190 bracket character is in the scanlist and the next following right bracket
11191 character is the matching right bracket that ends the specification; otherwise
11192 the first following right bracket character is the one that ends the
11193 specification. If a - character is in the scanlist and is not the first, nor the
11194 second where the first character is a ^, nor the last character, the behavior is
11195 implementation-defined.
11196 p Matches an implementation-defined set of sequences, which should be the
11197 same as the set of sequences that may be produced by the %p conversion of
11198 the fprintf function. The corresponding argument shall be a pointer to a
11199 pointer to void. The input item is converted to a pointer value in an
11200 implementation-defined manner. If the input item is a value converted earlier
11201 during the same program execution, the pointer that results shall compare
11202 equal to that value; otherwise the behavior of the %p conversion is undefined.
11204 [<a name="p286" href="#p286">page 286</a>] (<a href="#Contents">Contents</a>)
11206 n No input is consumed. The corresponding argument shall be a pointer to
11207 signed integer into which is to be written the number of characters read from
11208 the input stream so far by this call to the fscanf function. Execution of a
11209 %n directive does not increment the assignment count returned at the
11210 completion of execution of the fscanf function. No argument is converted,
11211 but one is consumed. If the conversion specification includes an assignment-
11212 suppressing character or a field width, the behavior is undefined.
11213 % Matches a single % character; no conversion or assignment occurs. The
11214 complete conversion specification shall be %%.
11215 13 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note253"><b>253)</b></a></sup>
11216 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
11217 respectively, a, e, f, g, and x.
11218 15 Trailing white space (including new-line characters) is left unread unless matched by a
11219 directive. The success of literal matches and suppressed assignments is not directly
11220 determinable other than via the %n directive.
11221 <b> Returns</b>
11222 16 The fscanf function returns the value of the macro EOF if an input failure occurs
11223 before any conversion. Otherwise, the function returns the number of input items
11224 assigned, which can be fewer than provided for, or even zero, in the event of an early
11225 matching failure.
11226 17 EXAMPLE 1 The call:
11227 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11228 /* ... */
11229 int n, i; float x; char name[50];
11230 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
11231 with the input line:
11232 25 54.32E-1 thompson
11233 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
11234 thompson\0.
11236 18 EXAMPLE 2 The call:
11237 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11238 /* ... */
11239 int i; float x; char name[50];
11240 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
11241 with input:
11245 <sup><a name="note253" href="#note253"><b>253)</b></a></sup> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
11247 [<a name="p287" href="#p287">page 287</a>] (<a href="#Contents">Contents</a>)
11249 56789 0123 56a72
11250 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
11251 sequence 56\0. The next character read from the input stream will be a.
11253 19 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
11254 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11255 /* ... */
11256 int count; float quant; char units[21], item[21];
11257 do {
11258 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
11259 fscanf(stdin,"%*[^\n]");
11260 } while (!feof(stdin) &amp;&amp; !ferror(stdin));
11261 20 If the stdin stream contains the following lines:
11262 2 quarts of oil
11263 -12.8degrees Celsius
11264 lots of luck
11265 10.0LBS of
11266 dirt
11267 100ergs of energy
11268 the execution of the above example will be analogous to the following assignments:
11269 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
11270 count = 3;
11271 quant = -12.8; strcpy(units, "degrees");
11272 count = 2; // "C" fails to match "o"
11273 count = 0; // "l" fails to match "%f"
11274 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
11275 count = 3;
11276 count = 0; // "100e" fails to match "%f"
11277 count = EOF;
11279 21 EXAMPLE 4 In:
11280 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11281 /* ... */
11282 int d1, d2, n1, n2, i;
11283 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
11284 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure the value
11285 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
11287 22 EXAMPLE 5 In these examples, multibyte characters do have a state-dependent encoding, and the
11288 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
11289 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
11290 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
11291 entry into the alternate shift state.
11292 23 After the call:
11294 [<a name="p288" href="#p288">page 288</a>] (<a href="#Contents">Contents</a>)
11296 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11297 /* ... */
11298 char str[50];
11299 fscanf(stdin, "a%s", str);
11300 with the input line:
11301 a(uparrow) X Y(downarrow) bc
11302 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
11303 characters, in the more general case) appears to be a single-byte white-space character.
11304 24 In contrast, after the call:
11305 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11306 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11307 /* ... */
11308 wchar_t wstr[50];
11309 fscanf(stdin, "a%ls", wstr);
11310 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
11311 terminating null wide character.
11312 25 However, the call:
11313 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11314 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11315 /* ... */
11316 wchar_t wstr[50];
11317 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
11318 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
11319 string.
11320 26 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
11321 character Y, after the call:
11322 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11323 #include <a href="#7.17">&lt;stddef.h&gt;</a>
11324 /* ... */
11325 wchar_t wstr[50];
11326 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
11327 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
11328 multibyte character.
11330 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>), the
11331 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.20.1.4">7.20.1.4</a>), conversion state
11332 (<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>).
11334 [<a name="p289" href="#p289">page 289</a>] (<a href="#Contents">Contents</a>)
11336 <a name="7.19.6.3" href="#7.19.6.3"><b> 7.19.6.3 The printf function</b></a>
11337 <b> Synopsis</b>
11338 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11339 int printf(const char * restrict format, ...);
11340 <b> Description</b>
11341 2 The printf function is equivalent to fprintf with the argument stdout interposed
11342 before the arguments to printf.
11343 <b> Returns</b>
11344 3 The printf function returns the number of characters transmitted, or a negative value if
11345 an output or encoding error occurred.
11346 <a name="7.19.6.4" href="#7.19.6.4"><b> 7.19.6.4 The scanf function</b></a>
11347 <b> Synopsis</b>
11348 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11349 int scanf(const char * restrict format, ...);
11350 <b> Description</b>
11351 2 The scanf function is equivalent to fscanf with the argument stdin interposed
11352 before the arguments to scanf.
11353 <b> Returns</b>
11354 3 The scanf function returns the value of the macro EOF if an input failure occurs before
11355 any conversion. Otherwise, the scanf function returns the number of input items
11356 assigned, which can be fewer than provided for, or even zero, in the event of an early
11357 matching failure.
11358 <a name="7.19.6.5" href="#7.19.6.5"><b> 7.19.6.5 The snprintf function</b></a>
11359 <b> Synopsis</b>
11360 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11361 int snprintf(char * restrict s, size_t n,
11362 const char * restrict format, ...);
11363 <b> Description</b>
11364 2 The snprintf function is equivalent to fprintf, except that the output is written into
11365 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
11366 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
11367 discarded rather than being written to the array, and a null character is written at the end
11368 of the characters actually written into the array. If copying takes place between objects
11369 that overlap, the behavior is undefined.
11371 [<a name="p290" href="#p290">page 290</a>] (<a href="#Contents">Contents</a>)
11373 <b> Returns</b>
11374 3 The snprintf function returns the number of characters that would have been written
11375 had n been sufficiently large, not counting the terminating null character, or a negative
11376 value if an encoding error occurred. Thus, the null-terminated output has been
11377 completely written if and only if the returned value is nonnegative and less than n.
11378 <a name="7.19.6.6" href="#7.19.6.6"><b> 7.19.6.6 The sprintf function</b></a>
11379 <b> Synopsis</b>
11380 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11381 int sprintf(char * restrict s,
11382 const char * restrict format, ...);
11383 <b> Description</b>
11384 2 The sprintf function is equivalent to fprintf, except that the output is written into
11385 an array (specified by the argument s) rather than to a stream. A null character is written
11386 at the end of the characters written; it is not counted as part of the returned value. If
11387 copying takes place between objects that overlap, the behavior is undefined.
11388 <b> Returns</b>
11389 3 The sprintf function returns the number of characters written in the array, not
11390 counting the terminating null character, or a negative value if an encoding error occurred.
11391 <a name="7.19.6.7" href="#7.19.6.7"><b> 7.19.6.7 The sscanf function</b></a>
11392 <b> Synopsis</b>
11393 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11394 int sscanf(const char * restrict s,
11395 const char * restrict format, ...);
11396 <b> Description</b>
11397 2 The sscanf function is equivalent to fscanf, except that input is obtained from a
11398 string (specified by the argument s) rather than from a stream. Reaching the end of the
11399 string is equivalent to encountering end-of-file for the fscanf function. If copying
11400 takes place between objects that overlap, the behavior is undefined.
11401 <b> Returns</b>
11402 3 The sscanf function returns the value of the macro EOF if an input failure occurs
11403 before any conversion. Otherwise, the sscanf function returns the number of input
11404 items assigned, which can be fewer than provided for, or even zero, in the event of an
11405 early matching failure.
11407 [<a name="p291" href="#p291">page 291</a>] (<a href="#Contents">Contents</a>)
11409 <a name="7.19.6.8" href="#7.19.6.8"><b> 7.19.6.8 The vfprintf function</b></a>
11410 <b> Synopsis</b>
11411 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11412 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11413 int vfprintf(FILE * restrict stream,
11414 const char * restrict format,
11415 va_list arg);
11416 <b> Description</b>
11417 2 The vfprintf function is equivalent to fprintf, with the variable argument list
11418 replaced by arg, which shall have been initialized by the va_start macro (and
11419 possibly subsequent va_arg calls). The vfprintf function does not invoke the
11420 va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
11421 <b> Returns</b>
11422 3 The vfprintf function returns the number of characters transmitted, or a negative
11423 value if an output or encoding error occurred.
11424 4 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
11425 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11426 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11427 void error(char *function_name, char *format, ...)
11429 va_list args;
11430 va_start(args, format);
11431 // print out name of function causing error
11432 fprintf(stderr, "ERROR in %s: ", function_name);
11433 // print out remainder of message
11434 vfprintf(stderr, format, args);
11435 va_end(args);
11441 <sup><a name="note254" href="#note254"><b>254)</b></a></sup> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
11442 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
11444 [<a name="p292" href="#p292">page 292</a>] (<a href="#Contents">Contents</a>)
11446 <a name="7.19.6.9" href="#7.19.6.9"><b> 7.19.6.9 The vfscanf function</b></a>
11447 <b> Synopsis</b>
11448 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11449 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11450 int vfscanf(FILE * restrict stream,
11451 const char * restrict format,
11452 va_list arg);
11453 <b> Description</b>
11454 2 The vfscanf function is equivalent to fscanf, with the variable argument list
11455 replaced by arg, which shall have been initialized by the va_start macro (and
11456 possibly subsequent va_arg calls). The vfscanf function does not invoke the
11457 va_end macro.254)
11458 <b> Returns</b>
11459 3 The vfscanf function returns the value of the macro EOF if an input failure occurs
11460 before any conversion. Otherwise, the vfscanf function returns the number of input
11461 items assigned, which can be fewer than provided for, or even zero, in the event of an
11462 early matching failure.
11463 <a name="7.19.6.10" href="#7.19.6.10"><b> 7.19.6.10 The vprintf function</b></a>
11464 <b> Synopsis</b>
11465 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11466 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11467 int vprintf(const char * restrict format,
11468 va_list arg);
11469 <b> Description</b>
11470 2 The vprintf function is equivalent to printf, with the variable argument list
11471 replaced by arg, which shall have been initialized by the va_start macro (and
11472 possibly subsequent va_arg calls). The vprintf function does not invoke the
11473 va_end macro.254)
11474 <b> Returns</b>
11475 3 The vprintf function returns the number of characters transmitted, or a negative value
11476 if an output or encoding error occurred.
11478 [<a name="p293" href="#p293">page 293</a>] (<a href="#Contents">Contents</a>)
11480 <a name="7.19.6.11" href="#7.19.6.11"><b> 7.19.6.11 The vscanf function</b></a>
11481 <b> Synopsis</b>
11482 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11483 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11484 int vscanf(const char * restrict format,
11485 va_list arg);
11486 <b> Description</b>
11487 2 The vscanf function is equivalent to scanf, with the variable argument list replaced
11488 by arg, which shall have been initialized by the va_start macro (and possibly
11489 subsequent va_arg calls). The vscanf function does not invoke the va_end
11490 macro.254)
11491 <b> Returns</b>
11492 3 The vscanf function returns the value of the macro EOF if an input failure occurs
11493 before any conversion. Otherwise, the vscanf function returns the number of input
11494 items assigned, which can be fewer than provided for, or even zero, in the event of an
11495 early matching failure.
11496 <a name="7.19.6.12" href="#7.19.6.12"><b> 7.19.6.12 The vsnprintf function</b></a>
11497 <b> Synopsis</b>
11498 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11499 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11500 int vsnprintf(char * restrict s, size_t n,
11501 const char * restrict format,
11502 va_list arg);
11503 <b> Description</b>
11504 2 The vsnprintf function is equivalent to snprintf, with the variable argument list
11505 replaced by arg, which shall have been initialized by the va_start macro (and
11506 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
11507 va_end macro.254) If copying takes place between objects that overlap, the behavior is
11508 undefined.
11509 <b> Returns</b>
11510 3 The vsnprintf function returns the number of characters that would have been written
11511 had n been sufficiently large, not counting the terminating null character, or a negative
11512 value if an encoding error occurred. Thus, the null-terminated output has been
11513 completely written if and only if the returned value is nonnegative and less than n.
11515 [<a name="p294" href="#p294">page 294</a>] (<a href="#Contents">Contents</a>)
11517 <a name="7.19.6.13" href="#7.19.6.13"><b> 7.19.6.13 The vsprintf function</b></a>
11518 <b> Synopsis</b>
11519 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11520 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11521 int vsprintf(char * restrict s,
11522 const char * restrict format,
11523 va_list arg);
11524 <b> Description</b>
11525 2 The vsprintf function is equivalent to sprintf, with the variable argument list
11526 replaced by arg, which shall have been initialized by the va_start macro (and
11527 possibly subsequent va_arg calls). The vsprintf function does not invoke the
11528 va_end macro.254) If copying takes place between objects that overlap, the behavior is
11529 undefined.
11530 <b> Returns</b>
11531 3 The vsprintf function returns the number of characters written in the array, not
11532 counting the terminating null character, or a negative value if an encoding error occurred.
11533 <a name="7.19.6.14" href="#7.19.6.14"><b> 7.19.6.14 The vsscanf function</b></a>
11534 <b> Synopsis</b>
11535 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
11536 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11537 int vsscanf(const char * restrict s,
11538 const char * restrict format,
11539 va_list arg);
11540 <b> Description</b>
11541 2 The vsscanf function is equivalent to sscanf, with the variable argument list
11542 replaced by arg, which shall have been initialized by the va_start macro (and
11543 possibly subsequent va_arg calls). The vsscanf function does not invoke the
11544 va_end macro.254)
11545 <b> Returns</b>
11546 3 The vsscanf function returns the value of the macro EOF if an input failure occurs
11547 before any conversion. Otherwise, the vsscanf function returns the number of input
11548 items assigned, which can be fewer than provided for, or even zero, in the event of an
11549 early matching failure.
11551 [<a name="p295" href="#p295">page 295</a>] (<a href="#Contents">Contents</a>)
11553 <a name="7.19.7" href="#7.19.7"><b> 7.19.7 Character input/output functions</b></a>
11554 <a name="7.19.7.1" href="#7.19.7.1"><b> 7.19.7.1 The fgetc function</b></a>
11555 <b> Synopsis</b>
11556 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11557 int fgetc(FILE *stream);
11558 <b> Description</b>
11559 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
11560 next character is present, the fgetc function obtains that character as an unsigned
11561 char converted to an int and advances the associated file position indicator for the
11562 stream (if defined).
11563 <b> Returns</b>
11564 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
11565 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
11566 fgetc function returns the next character from the input stream pointed to by stream.
11567 If a read error occurs, the error indicator for the stream is set and the fgetc function
11568 returns EOF.<sup><a href="#note255"><b>255)</b></a></sup>
11569 <a name="7.19.7.2" href="#7.19.7.2"><b> 7.19.7.2 The fgets function</b></a>
11570 <b> Synopsis</b>
11571 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11572 char *fgets(char * restrict s, int n,
11573 FILE * restrict stream);
11574 <b> Description</b>
11575 2 The fgets function reads at most one less than the number of characters specified by n
11576 from the stream pointed to by stream into the array pointed to by s. No additional
11577 characters are read after a new-line character (which is retained) or after end-of-file. A
11578 null character is written immediately after the last character read into the array.
11579 <b> Returns</b>
11580 3 The fgets function returns s if successful. If end-of-file is encountered and no
11581 characters have been read into the array, the contents of the array remain unchanged and a
11582 null pointer is returned. If a read error occurs during the operation, the array contents are
11583 indeterminate and a null pointer is returned.
11588 <sup><a name="note255" href="#note255"><b>255)</b></a></sup> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
11590 [<a name="p296" href="#p296">page 296</a>] (<a href="#Contents">Contents</a>)
11592 <a name="7.19.7.3" href="#7.19.7.3"><b> 7.19.7.3 The fputc function</b></a>
11593 <b> Synopsis</b>
11594 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11595 int fputc(int c, FILE *stream);
11596 <b> Description</b>
11597 2 The fputc function writes the character specified by c (converted to an unsigned
11598 char) to the output stream pointed to by stream, at the position indicated by the
11599 associated file position indicator for the stream (if defined), and advances the indicator
11600 appropriately. If the file cannot support positioning requests, or if the stream was opened
11601 with append mode, the character is appended to the output stream.
11602 <b> Returns</b>
11603 3 The fputc function returns the character written. If a write error occurs, the error
11604 indicator for the stream is set and fputc returns EOF.
11605 <a name="7.19.7.4" href="#7.19.7.4"><b> 7.19.7.4 The fputs function</b></a>
11606 <b> Synopsis</b>
11607 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11608 int fputs(const char * restrict s,
11609 FILE * restrict stream);
11610 <b> Description</b>
11611 2 The fputs function writes the string pointed to by s to the stream pointed to by
11612 stream. The terminating null character is not written.
11613 <b> Returns</b>
11614 3 The fputs function returns EOF if a write error occurs; otherwise it returns a
11615 nonnegative value.
11616 <a name="7.19.7.5" href="#7.19.7.5"><b> 7.19.7.5 The getc function</b></a>
11617 <b> Synopsis</b>
11618 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11619 int getc(FILE *stream);
11620 <b> Description</b>
11621 2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
11622 may evaluate stream more than once, so the argument should never be an expression
11623 with side effects.
11625 [<a name="p297" href="#p297">page 297</a>] (<a href="#Contents">Contents</a>)
11627 <b> Returns</b>
11628 3 The getc function returns the next character from the input stream pointed to by
11629 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
11630 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
11631 getc returns EOF.
11632 <a name="7.19.7.6" href="#7.19.7.6"><b> 7.19.7.6 The getchar function</b></a>
11633 <b> Synopsis</b>
11634 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11635 int getchar(void);
11636 <b> Description</b>
11637 2 The getchar function is equivalent to getc with the argument stdin.
11638 <b> Returns</b>
11639 3 The getchar function returns the next character from the input stream pointed to by
11640 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
11641 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
11642 getchar returns EOF.
11643 <a name="7.19.7.7" href="#7.19.7.7"><b> 7.19.7.7 The gets function</b></a>
11644 <b> Synopsis</b>
11645 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11646 char *gets(char *s);
11647 <b> Description</b>
11648 2 The gets function reads characters from the input stream pointed to by stdin, into the
11649 array pointed to by s, until end-of-file is encountered or a new-line character is read.
11650 Any new-line character is discarded, and a null character is written immediately after the
11651 last character read into the array.
11652 <b> Returns</b>
11653 3 The gets function returns s if successful. If end-of-file is encountered and no
11654 characters have been read into the array, the contents of the array remain unchanged and a
11655 null pointer is returned. If a read error occurs during the operation, the array contents are
11656 indeterminate and a null pointer is returned.
11657 Forward references: future library directions (<a href="#7.26.9">7.26.9</a>).
11659 [<a name="p298" href="#p298">page 298</a>] (<a href="#Contents">Contents</a>)
11661 <a name="7.19.7.8" href="#7.19.7.8"><b> 7.19.7.8 The putc function</b></a>
11662 <b> Synopsis</b>
11663 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11664 int putc(int c, FILE *stream);
11665 <b> Description</b>
11666 2 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
11667 may evaluate stream more than once, so that argument should never be an expression
11668 with side effects.
11669 <b> Returns</b>
11670 3 The putc function returns the character written. If a write error occurs, the error
11671 indicator for the stream is set and putc returns EOF.
11672 <a name="7.19.7.9" href="#7.19.7.9"><b> 7.19.7.9 The putchar function</b></a>
11673 <b> Synopsis</b>
11674 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11675 int putchar(int c);
11676 <b> Description</b>
11677 2 The putchar function is equivalent to putc with the second argument stdout.
11678 <b> Returns</b>
11679 3 The putchar function returns the character written. If a write error occurs, the error
11680 indicator for the stream is set and putchar returns EOF.
11681 <a name="7.19.7.10" href="#7.19.7.10"><b> 7.19.7.10 The puts function</b></a>
11682 <b> Synopsis</b>
11683 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11684 int puts(const char *s);
11685 <b> Description</b>
11686 2 The puts function writes the string pointed to by s to the stream pointed to by stdout,
11687 and appends a new-line character to the output. The terminating null character is not
11688 written.
11689 <b> Returns</b>
11690 3 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
11691 value.
11693 [<a name="p299" href="#p299">page 299</a>] (<a href="#Contents">Contents</a>)
11695 <a name="7.19.7.11" href="#7.19.7.11"><b> 7.19.7.11 The ungetc function</b></a>
11696 <b> Synopsis</b>
11697 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11698 int ungetc(int c, FILE *stream);
11699 <b> Description</b>
11700 2 The ungetc function pushes the character specified by c (converted to an unsigned
11701 char) back onto the input stream pointed to by stream. Pushed-back characters will be
11702 returned by subsequent reads on that stream in the reverse order of their pushing. A
11703 successful intervening call (with the stream pointed to by stream) to a file positioning
11704 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
11705 stream. The external storage corresponding to the stream is unchanged.
11706 3 One character of pushback is guaranteed. If the ungetc function is called too many
11707 times on the same stream without an intervening read or file positioning operation on that
11708 stream, the operation may fail.
11709 4 If the value of c equals that of the macro EOF, the operation fails and the input stream is
11710 unchanged.
11711 5 A successful call to the ungetc function clears the end-of-file indicator for the stream.
11712 The value of the file position indicator for the stream after reading or discarding all
11713 pushed-back characters shall be the same as it was before the characters were pushed
11714 back. For a text stream, the value of its file position indicator after a successful call to the
11715 ungetc function is unspecified until all pushed-back characters are read or discarded.
11716 For a binary stream, its file position indicator is decremented by each successful call to
11717 the ungetc function; if its value was zero before a call, it is indeterminate after the
11718 call.<sup><a href="#note256"><b>256)</b></a></sup>
11719 <b> Returns</b>
11720 6 The ungetc function returns the character pushed back after conversion, or EOF if the
11721 operation fails.
11722 Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
11727 <sup><a name="note256" href="#note256"><b>256)</b></a></sup> See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
11729 [<a name="p300" href="#p300">page 300</a>] (<a href="#Contents">Contents</a>)
11731 <a name="7.19.8" href="#7.19.8"><b> 7.19.8 Direct input/output functions</b></a>
11732 <a name="7.19.8.1" href="#7.19.8.1"><b> 7.19.8.1 The fread function</b></a>
11733 <b> Synopsis</b>
11734 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11735 size_t fread(void * restrict ptr,
11736 size_t size, size_t nmemb,
11737 FILE * restrict stream);
11738 <b> Description</b>
11739 2 The fread function reads, into the array pointed to by ptr, up to nmemb elements
11740 whose size is specified by size, from the stream pointed to by stream. For each
11741 object, size calls are made to the fgetc function and the results stored, in the order
11742 read, in an array of unsigned char exactly overlaying the object. The file position
11743 indicator for the stream (if defined) is advanced by the number of characters successfully
11744 read. If an error occurs, the resulting value of the file position indicator for the stream is
11745 indeterminate. If a partial element is read, its value is indeterminate.
11746 <b> Returns</b>
11747 3 The fread function returns the number of elements successfully read, which may be
11748 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
11749 fread returns zero and the contents of the array and the state of the stream remain
11750 unchanged.
11751 <a name="7.19.8.2" href="#7.19.8.2"><b> 7.19.8.2 The fwrite function</b></a>
11752 <b> Synopsis</b>
11753 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11754 size_t fwrite(const void * restrict ptr,
11755 size_t size, size_t nmemb,
11756 FILE * restrict stream);
11757 <b> Description</b>
11758 2 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
11759 whose size is specified by size, to the stream pointed to by stream. For each object,
11760 size calls are made to the fputc function, taking the values (in order) from an array of
11761 unsigned char exactly overlaying the object. The file position indicator for the
11762 stream (if defined) is advanced by the number of characters successfully written. If an
11763 error occurs, the resulting value of the file position indicator for the stream is
11764 indeterminate.
11766 [<a name="p301" href="#p301">page 301</a>] (<a href="#Contents">Contents</a>)
11768 <b> Returns</b>
11769 3 The fwrite function returns the number of elements successfully written, which will be
11770 less than nmemb only if a write error is encountered. If size or nmemb is zero,
11771 fwrite returns zero and the state of the stream remains unchanged.
11772 <a name="7.19.9" href="#7.19.9"><b> 7.19.9 File positioning functions</b></a>
11773 <a name="7.19.9.1" href="#7.19.9.1"><b> 7.19.9.1 The fgetpos function</b></a>
11774 <b> Synopsis</b>
11775 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11776 int fgetpos(FILE * restrict stream,
11777 fpos_t * restrict pos);
11778 <b> Description</b>
11779 2 The fgetpos function stores the current values of the parse state (if any) and file
11780 position indicator for the stream pointed to by stream in the object pointed to by pos.
11781 The values stored contain unspecified information usable by the fsetpos function for
11782 repositioning the stream to its position at the time of the call to the fgetpos function.
11783 <b> Returns</b>
11784 3 If successful, the fgetpos function returns zero; on failure, the fgetpos function
11785 returns nonzero and stores an implementation-defined positive value in errno.
11786 Forward references: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
11787 <a name="7.19.9.2" href="#7.19.9.2"><b> 7.19.9.2 The fseek function</b></a>
11788 <b> Synopsis</b>
11789 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11790 int fseek(FILE *stream, long int offset, int whence);
11791 <b> Description</b>
11792 2 The fseek function sets the file position indicator for the stream pointed to by stream.
11793 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
11794 3 For a binary stream, the new position, measured in characters from the beginning of the
11795 file, is obtained by adding offset to the position specified by whence. The specified
11796 position is the beginning of the file if whence is SEEK_SET, the current value of the file
11797 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
11798 meaningfully support fseek calls with a whence value of SEEK_END.
11799 4 For a text stream, either offset shall be zero, or offset shall be a value returned by
11800 an earlier successful call to the ftell function on a stream associated with the same file
11801 and whence shall be SEEK_SET.
11803 [<a name="p302" href="#p302">page 302</a>] (<a href="#Contents">Contents</a>)
11805 5 After determining the new position, a successful call to the fseek function undoes any
11806 effects of the ungetc function on the stream, clears the end-of-file indicator for the
11807 stream, and then establishes the new position. After a successful fseek call, the next
11808 operation on an update stream may be either input or output.
11809 <b> Returns</b>
11810 6 The fseek function returns nonzero only for a request that cannot be satisfied.
11811 Forward references: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
11812 <a name="7.19.9.3" href="#7.19.9.3"><b> 7.19.9.3 The fsetpos function</b></a>
11813 <b> Synopsis</b>
11814 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11815 int fsetpos(FILE *stream, const fpos_t *pos);
11816 <b> Description</b>
11817 2 The fsetpos function sets the mbstate_t object (if any) and file position indicator
11818 for the stream pointed to by stream according to the value of the object pointed to by
11819 pos, which shall be a value obtained from an earlier successful call to the fgetpos
11820 function on a stream associated with the same file. If a read or write error occurs, the
11821 error indicator for the stream is set and fsetpos fails.
11822 3 A successful call to the fsetpos function undoes any effects of the ungetc function
11823 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
11824 parse state and position. After a successful fsetpos call, the next operation on an
11825 update stream may be either input or output.
11826 <b> Returns</b>
11827 4 If successful, the fsetpos function returns zero; on failure, the fsetpos function
11828 returns nonzero and stores an implementation-defined positive value in errno.
11829 <a name="7.19.9.4" href="#7.19.9.4"><b> 7.19.9.4 The ftell function</b></a>
11830 <b> Synopsis</b>
11831 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11832 long int ftell(FILE *stream);
11833 <b> Description</b>
11834 2 The ftell function obtains the current value of the file position indicator for the stream
11835 pointed to by stream. For a binary stream, the value is the number of characters from
11836 the beginning of the file. For a text stream, its file position indicator contains unspecified
11837 information, usable by the fseek function for returning the file position indicator for the
11838 stream to its position at the time of the ftell call; the difference between two such
11839 return values is not necessarily a meaningful measure of the number of characters written
11841 [<a name="p303" href="#p303">page 303</a>] (<a href="#Contents">Contents</a>)
11843 or read.
11844 <b> Returns</b>
11845 3 If successful, the ftell function returns the current value of the file position indicator
11846 for the stream. On failure, the ftell function returns -1L and stores an
11847 implementation-defined positive value in errno.
11848 <a name="7.19.9.5" href="#7.19.9.5"><b> 7.19.9.5 The rewind function</b></a>
11849 <b> Synopsis</b>
11850 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11851 void rewind(FILE *stream);
11852 <b> Description</b>
11853 2 The rewind function sets the file position indicator for the stream pointed to by
11854 stream to the beginning of the file. It is equivalent to
11855 (void)fseek(stream, 0L, SEEK_SET)
11856 except that the error indicator for the stream is also cleared.
11857 <b> Returns</b>
11858 3 The rewind function returns no value.
11859 <a name="7.19.10" href="#7.19.10"><b> 7.19.10 Error-handling functions</b></a>
11860 <a name="7.19.10.1" href="#7.19.10.1"><b> 7.19.10.1 The clearerr function</b></a>
11861 <b> Synopsis</b>
11862 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11863 void clearerr(FILE *stream);
11864 <b> Description</b>
11865 2 The clearerr function clears the end-of-file and error indicators for the stream pointed
11866 to by stream.
11867 <b> Returns</b>
11868 3 The clearerr function returns no value.
11870 [<a name="p304" href="#p304">page 304</a>] (<a href="#Contents">Contents</a>)
11872 <a name="7.19.10.2" href="#7.19.10.2"><b> 7.19.10.2 The feof function</b></a>
11873 <b> Synopsis</b>
11874 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11875 int feof(FILE *stream);
11876 <b> Description</b>
11877 2 The feof function tests the end-of-file indicator for the stream pointed to by stream.
11878 <b> Returns</b>
11879 3 The feof function returns nonzero if and only if the end-of-file indicator is set for
11880 stream.
11881 <a name="7.19.10.3" href="#7.19.10.3"><b> 7.19.10.3 The ferror function</b></a>
11882 <b> Synopsis</b>
11883 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11884 int ferror(FILE *stream);
11885 <b> Description</b>
11886 2 The ferror function tests the error indicator for the stream pointed to by stream.
11887 <b> Returns</b>
11888 3 The ferror function returns nonzero if and only if the error indicator is set for
11889 stream.
11890 <a name="7.19.10.4" href="#7.19.10.4"><b> 7.19.10.4 The perror function</b></a>
11891 <b> Synopsis</b>
11892 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
11893 void perror(const char *s);
11894 <b> Description</b>
11895 2 The perror function maps the error number in the integer expression errno to an
11896 error message. It writes a sequence of characters to the standard error stream thus: first
11897 (if s is not a null pointer and the character pointed to by s is not the null character), the
11898 string pointed to by s followed by a colon (:) and a space; then an appropriate error
11899 message string followed by a new-line character. The contents of the error message
11900 strings are the same as those returned by the strerror function with argument errno.
11901 <b> Returns</b>
11902 3 The perror function returns no value.
11903 Forward references: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
11905 [<a name="p305" href="#p305">page 305</a>] (<a href="#Contents">Contents</a>)
11907 <a name="7.20" href="#7.20"><b> 7.20 General utilities &lt;stdlib.h&gt;</b></a>
11908 1 The header <a href="#7.20">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
11909 defines several macros.<sup><a href="#note257"><b>257)</b></a></sup>
11910 2 The types declared are size_t and wchar_t (both described in <a href="#7.17">7.17</a>),
11911 div_t
11912 which is a structure type that is the type of the value returned by the div function,
11913 ldiv_t
11914 which is a structure type that is the type of the value returned by the ldiv function, and
11915 lldiv_t
11916 which is a structure type that is the type of the value returned by the lldiv function.
11917 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>);
11918 EXIT_FAILURE
11920 EXIT_SUCCESS
11921 which expand to integer constant expressions that can be used as the argument to the
11922 exit function to return unsuccessful or successful termination status, respectively, to the
11923 host environment;
11924 RAND_MAX
11925 which expands to an integer constant expression that is the maximum value returned by
11926 the rand function; and
11927 MB_CUR_MAX
11928 which expands to a positive integer expression with type size_t that is the maximum
11929 number of bytes in a multibyte character for the extended character set specified by the
11930 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
11935 <sup><a name="note257" href="#note257"><b>257)</b></a></sup> See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
11937 [<a name="p306" href="#p306">page 306</a>] (<a href="#Contents">Contents</a>)
11939 <a name="7.20.1" href="#7.20.1"><b> 7.20.1 Numeric conversion functions</b></a>
11940 1 The functions atof, atoi, atol, and atoll need not affect the value of the integer
11941 expression errno on an error. If the value of the result cannot be represented, the
11942 behavior is undefined.
11943 <a name="7.20.1.1" href="#7.20.1.1"><b> 7.20.1.1 The atof function</b></a>
11944 <b> Synopsis</b>
11945 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
11946 double atof(const char *nptr);
11947 <b> Description</b>
11948 2 The atof function converts the initial portion of the string pointed to by nptr to
11949 double representation. Except for the behavior on error, it is equivalent to
11950 strtod(nptr, (char **)NULL)
11951 <b> Returns</b>
11952 3 The atof function returns the converted value.
11953 Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
11954 <a name="7.20.1.2" href="#7.20.1.2"><b> 7.20.1.2 The atoi, atol, and atoll functions</b></a>
11955 <b> Synopsis</b>
11956 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
11957 int atoi(const char *nptr);
11958 long int atol(const char *nptr);
11959 long long int atoll(const char *nptr);
11960 <b> Description</b>
11961 2 The atoi, atol, and atoll functions convert the initial portion of the string pointed
11962 to by nptr to int, long int, and long long int representation, respectively.
11963 Except for the behavior on error, they are equivalent to
11964 atoi: (int)strtol(nptr, (char **)NULL, 10)
11965 atol: strtol(nptr, (char **)NULL, 10)
11966 atoll: strtoll(nptr, (char **)NULL, 10)
11967 <b> Returns</b>
11968 3 The atoi, atol, and atoll functions return the converted value.
11969 Forward references: the strtol, strtoll, strtoul, and strtoull functions
11970 (<a href="#7.20.1.4">7.20.1.4</a>).
11972 [<a name="p307" href="#p307">page 307</a>] (<a href="#Contents">Contents</a>)
11974 <a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 The strtod, strtof, and strtold functions</b></a>
11975 <b> Synopsis</b>
11976 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
11977 double strtod(const char * restrict nptr,
11978 char ** restrict endptr);
11979 float strtof(const char * restrict nptr,
11980 char ** restrict endptr);
11981 long double strtold(const char * restrict nptr,
11982 char ** restrict endptr);
11983 <b> Description</b>
11984 2 The strtod, strtof, and strtold functions convert the initial portion of the string
11985 pointed to by nptr to double, float, and long double representation,
11986 respectively. First, they decompose the input string into three parts: an initial, possibly
11987 empty, sequence of white-space characters (as specified by the isspace function), a
11988 subject sequence resembling a floating-point constant or representing an infinity or NaN;
11989 and a final string of one or more unrecognized characters, including the terminating null
11990 character of the input string. Then, they attempt to convert the subject sequence to a
11991 floating-point number, and return the result.
11992 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
11993 the following:
11994 -- a nonempty sequence of decimal digits optionally containing a decimal-point
11995 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
11996 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
11997 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
11998 -- INF or INFINITY, ignoring case
11999 -- NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
12000 n-char-sequence:
12001 digit
12002 nondigit
12003 n-char-sequence digit
12004 n-char-sequence nondigit
12005 The subject sequence is defined as the longest initial subsequence of the input string,
12006 starting with the first non-white-space character, that is of the expected form. The subject
12007 sequence contains no characters if the input string is not of the expected form.
12008 4 If the subject sequence has the expected form for a floating-point number, the sequence of
12009 characters starting with the first digit or the decimal-point character (whichever occurs
12010 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
12012 [<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
12014 decimal-point character is used in place of a period, and that if neither an exponent part
12015 nor a decimal-point character appears in a decimal floating point number, or if a binary
12016 exponent part does not appear in a hexadecimal floating point number, an exponent part
12017 of the appropriate type with value zero is assumed to follow the last digit in the string. If
12018 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note258"><b>258)</b></a></sup>
12019 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
12020 the return type, else like a floating constant that is too large for the range of the return
12021 type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
12022 NaN, if supported in the return type, else like a subject sequence part that does not have
12023 the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note259"><b>259)</b></a></sup> A
12024 pointer to the final string is stored in the object pointed to by endptr, provided that
12025 endptr is not a null pointer.
12026 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
12027 value resulting from the conversion is correctly rounded.
12028 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
12029 accepted.
12030 7 If the subject sequence is empty or does not have the expected form, no conversion is
12031 performed; the value of nptr is stored in the object pointed to by endptr, provided
12032 that endptr is not a null pointer.
12033 Recommended practice
12034 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
12035 the result is not exactly representable, the result should be one of the two numbers in the
12036 appropriate internal format that are adjacent to the hexadecimal floating source value,
12037 with the extra stipulation that the error should have a correct sign for the current rounding
12038 direction.
12039 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
12040 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
12041 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
12042 consider the two bounding, adjacent decimal strings L and U, both having
12043 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
12044 The result should be one of the (equal or adjacent) values that would be obtained by
12045 correctly rounding L and U according to the current rounding direction, with the extra
12047 <sup><a name="note258" href="#note258"><b>258)</b></a></sup> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
12048 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
12049 methods may yield different results if rounding is toward positive or negative infinity. In either case,
12050 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
12051 <sup><a name="note259" href="#note259"><b>259)</b></a></sup> An implementation may use the n-char sequence to determine extra information to be represented in
12052 the NaN's significand.
12054 [<a name="p309" href="#p309">page 309</a>] (<a href="#Contents">Contents</a>)
12056 stipulation that the error with respect to D should have a correct sign for the current
12057 rounding direction.<sup><a href="#note260"><b>260)</b></a></sup>
12058 <b> Returns</b>
12059 10 The functions return the converted value, if any. If no conversion could be performed,
12060 zero is returned. If the correct value is outside the range of representable values, plus or
12061 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
12062 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
12063 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
12064 than the smallest normalized positive number in the return type; whether errno acquires
12065 the value ERANGE is implementation-defined.
12066 <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>
12067 <b> Synopsis</b>
12068 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12069 long int strtol(
12070 const char * restrict nptr,
12071 char ** restrict endptr,
12072 int base);
12073 long long int strtoll(
12074 const char * restrict nptr,
12075 char ** restrict endptr,
12076 int base);
12077 unsigned long int strtoul(
12078 const char * restrict nptr,
12079 char ** restrict endptr,
12080 int base);
12081 unsigned long long int strtoull(
12082 const char * restrict nptr,
12083 char ** restrict endptr,
12084 int base);
12085 <b> Description</b>
12086 2 The strtol, strtoll, strtoul, and strtoull functions convert the initial
12087 portion of the string pointed to by nptr to long int, long long int, unsigned
12088 long int, and unsigned long long int representation, respectively. First,
12089 they decompose the input string into three parts: an initial, possibly empty, sequence of
12090 white-space characters (as specified by the isspace function), a subject sequence
12093 <sup><a name="note260" href="#note260"><b>260)</b></a></sup> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
12094 to the same internal floating value, but if not will round to adjacent values.
12096 [<a name="p310" href="#p310">page 310</a>] (<a href="#Contents">Contents</a>)
12098 resembling an integer represented in some radix determined by the value of base, and a
12099 final string of one or more unrecognized characters, including the terminating null
12100 character of the input string. Then, they attempt to convert the subject sequence to an
12101 integer, and return the result.
12102 3 If the value of base is zero, the expected form of the subject sequence is that of an
12103 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
12104 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
12105 expected form of the subject sequence is a sequence of letters and digits representing an
12106 integer with the radix specified by base, optionally preceded by a plus or minus sign,
12107 but not including an integer suffix. The letters from a (or A) through z (or Z) are
12108 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
12109 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
12110 optionally precede the sequence of letters and digits, following the sign if present.
12111 4 The subject sequence is defined as the longest initial subsequence of the input string,
12112 starting with the first non-white-space character, that is of the expected form. The subject
12113 sequence contains no characters if the input string is empty or consists entirely of white
12114 space, or if the first non-white-space character is other than a sign or a permissible letter
12115 or digit.
12116 5 If the subject sequence has the expected form and the value of base is zero, the sequence
12117 of characters starting with the first digit is interpreted as an integer constant according to
12118 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
12119 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
12120 as given above. If the subject sequence begins with a minus sign, the value resulting from
12121 the conversion is negated (in the return type). A pointer to the final string is stored in the
12122 object pointed to by endptr, provided that endptr is not a null pointer.
12123 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
12124 accepted.
12125 7 If the subject sequence is empty or does not have the expected form, no conversion is
12126 performed; the value of nptr is stored in the object pointed to by endptr, provided
12127 that endptr is not a null pointer.
12128 <b> Returns</b>
12129 8 The strtol, strtoll, strtoul, and strtoull functions return the converted
12130 value, if any. If no conversion could be performed, zero is returned. If the correct value
12131 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
12132 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
12133 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
12135 [<a name="p311" href="#p311">page 311</a>] (<a href="#Contents">Contents</a>)
12137 <a name="7.20.2" href="#7.20.2"><b> 7.20.2 Pseudo-random sequence generation functions</b></a>
12138 <a name="7.20.2.1" href="#7.20.2.1"><b> 7.20.2.1 The rand function</b></a>
12139 <b> Synopsis</b>
12140 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12141 int rand(void);
12142 <b> Description</b>
12143 2 The rand function computes a sequence of pseudo-random integers in the range 0 to
12144 RAND_MAX.
12145 3 The implementation shall behave as if no library function calls the rand function.
12146 <b> Returns</b>
12147 4 The rand function returns a pseudo-random integer.
12148 Environmental limits
12149 5 The value of the RAND_MAX macro shall be at least 32767.
12150 <a name="7.20.2.2" href="#7.20.2.2"><b> 7.20.2.2 The srand function</b></a>
12151 <b> Synopsis</b>
12152 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12153 void srand(unsigned int seed);
12154 <b> Description</b>
12155 2 The srand function uses the argument as a seed for a new sequence of pseudo-random
12156 numbers to be returned by subsequent calls to rand. If srand is then called with the
12157 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
12158 called before any calls to srand have been made, the same sequence shall be generated
12159 as when srand is first called with a seed value of 1.
12160 3 The implementation shall behave as if no library function calls the srand function.
12161 <b> Returns</b>
12162 4 The srand function returns no value.
12163 5 EXAMPLE The following functions define a portable implementation of rand and srand.
12164 static unsigned long int next = 1;
12165 int rand(void) // RAND_MAX assumed to be 32767
12167 next = next * 1103515245 + 12345;
12168 return (unsigned int)(next/65536) % 32768;
12171 [<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
12173 void srand(unsigned int seed)
12175 next = seed;
12178 <a name="7.20.3" href="#7.20.3"><b> 7.20.3 Memory management functions</b></a>
12179 1 The order and contiguity of storage allocated by successive calls to the calloc,
12180 malloc, and realloc functions is unspecified. The pointer returned if the allocation
12181 succeeds is suitably aligned so that it may be assigned to a pointer to any type of object
12182 and then used to access such an object or an array of such objects in the space allocated
12183 (until the space is explicitly deallocated). The lifetime of an allocated object extends
12184 from the allocation until the deallocation. Each such allocation shall yield a pointer to an
12185 object disjoint from any other object. The pointer returned points to the start (lowest byte
12186 address) of the allocated space. If the space cannot be allocated, a null pointer is
12187 returned. If the size of the space requested is zero, the behavior is implementation-
12188 defined: either a null pointer is returned, or the behavior is as if the size were some
12189 nonzero value, except that the returned pointer shall not be used to access an object.
12190 <a name="7.20.3.1" href="#7.20.3.1"><b> 7.20.3.1 The calloc function</b></a>
12191 <b> Synopsis</b>
12192 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12193 void *calloc(size_t nmemb, size_t size);
12194 <b> Description</b>
12195 2 The calloc function allocates space for an array of nmemb objects, each of whose size
12196 is size. The space is initialized to all bits zero.<sup><a href="#note261"><b>261)</b></a></sup>
12197 <b> Returns</b>
12198 3 The calloc function returns either a null pointer or a pointer to the allocated space.
12199 <a name="7.20.3.2" href="#7.20.3.2"><b> 7.20.3.2 The free function</b></a>
12200 <b> Synopsis</b>
12201 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12202 void free(void *ptr);
12203 <b> Description</b>
12204 2 The free function causes the space pointed to by ptr to be deallocated, that is, made
12205 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
12206 the argument does not match a pointer earlier returned by the calloc, malloc, or
12209 <sup><a name="note261" href="#note261"><b>261)</b></a></sup> Note that this need not be the same as the representation of floating-point zero or a null pointer
12210 constant.
12212 [<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
12214 realloc function, or if the space has been deallocated by a call to free or realloc,
12215 the behavior is undefined.
12216 <b> Returns</b>
12217 3 The free function returns no value.
12218 <a name="7.20.3.3" href="#7.20.3.3"><b> 7.20.3.3 The malloc function</b></a>
12219 <b> Synopsis</b>
12220 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12221 void *malloc(size_t size);
12222 <b> Description</b>
12223 2 The malloc function allocates space for an object whose size is specified by size and
12224 whose value is indeterminate.
12225 <b> Returns</b>
12226 3 The malloc function returns either a null pointer or a pointer to the allocated space.
12227 <a name="7.20.3.4" href="#7.20.3.4"><b> 7.20.3.4 The realloc function</b></a>
12228 <b> Synopsis</b>
12229 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12230 void *realloc(void *ptr, size_t size);
12231 <b> Description</b>
12232 2 The realloc function deallocates the old object pointed to by ptr and returns a
12233 pointer to a new object that has the size specified by size. The contents of the new
12234 object shall be the same as that of the old object prior to deallocation, up to the lesser of
12235 the new and old sizes. Any bytes in the new object beyond the size of the old object have
12236 indeterminate values.
12237 3 If ptr is a null pointer, the realloc function behaves like the malloc function for the
12238 specified size. Otherwise, if ptr does not match a pointer earlier returned by the
12239 calloc, malloc, or realloc function, or if the space has been deallocated by a call
12240 to the free or realloc function, the behavior is undefined. If memory for the new
12241 object cannot be allocated, the old object is not deallocated and its value is unchanged.
12242 <b> Returns</b>
12243 4 The realloc function returns a pointer to the new object (which may have the same
12244 value as a pointer to the old object), or a null pointer if the new object could not be
12245 allocated.
12247 [<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
12249 <a name="7.20.4" href="#7.20.4"><b> 7.20.4 Communication with the environment</b></a>
12250 <a name="7.20.4.1" href="#7.20.4.1"><b> 7.20.4.1 The abort function</b></a>
12251 <b> Synopsis</b>
12252 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12253 void abort(void);
12254 <b> Description</b>
12255 2 The abort function causes abnormal program termination to occur, unless the signal
12256 SIGABRT is being caught and the signal handler does not return. Whether open streams
12257 with unwritten buffered data are flushed, open streams are closed, or temporary files are
12258 removed is implementation-defined. An implementation-defined form of the status
12259 unsuccessful termination is returned to the host environment by means of the function
12260 call raise(SIGABRT).
12261 <b> Returns</b>
12262 3 The abort function does not return to its caller.
12263 <a name="7.20.4.2" href="#7.20.4.2"><b> 7.20.4.2 The atexit function</b></a>
12264 <b> Synopsis</b>
12265 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12266 int atexit(void (*func)(void));
12267 <b> Description</b>
12268 2 The atexit function registers the function pointed to by func, to be called without
12269 arguments at normal program termination.
12270 Environmental limits
12271 3 The implementation shall support the registration of at least 32 functions.
12272 <b> Returns</b>
12273 4 The atexit function returns zero if the registration succeeds, nonzero if it fails.
12274 Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
12275 <a name="7.20.4.3" href="#7.20.4.3"><b> 7.20.4.3 The exit function</b></a>
12276 <b> Synopsis</b>
12277 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12278 void exit(int status);
12279 <b> Description</b>
12280 2 The exit function causes normal program termination to occur. If more than one call to
12281 the exit function is executed by a program, the behavior is undefined.
12283 [<a name="p315" href="#p315">page 315</a>] (<a href="#Contents">Contents</a>)
12285 3 First, all functions registered by the atexit function are called, in the reverse order of
12286 their registration,<sup><a href="#note262"><b>262)</b></a></sup> except that a function is called after any previously registered
12287 functions that had already been called at the time it was registered. If, during the call to
12288 any such function, a call to the longjmp function is made that would terminate the call
12289 to the registered function, the behavior is undefined.
12290 4 Next, all open streams with unwritten buffered data are flushed, all open streams are
12291 closed, and all files created by the tmpfile function are removed.
12292 5 Finally, control is returned to the host environment. If the value of status is zero or
12293 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
12294 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
12295 of the status unsuccessful termination is returned. Otherwise the status returned is
12296 implementation-defined.
12297 <b> Returns</b>
12298 6 The exit function cannot return to its caller.
12299 <a name="7.20.4.4" href="#7.20.4.4"><b> 7.20.4.4 The _Exit function</b></a>
12300 <b> Synopsis</b>
12301 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12302 void _Exit(int status);
12303 <b> Description</b>
12304 2 The _Exit function causes normal program termination to occur and control to be
12305 returned to the host environment. No functions registered by the atexit function or
12306 signal handlers registered by the signal function are called. The status returned to the
12307 host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
12308 Whether open streams with unwritten buffered data are flushed, open streams are closed,
12309 or temporary files are removed is implementation-defined.
12310 <b> Returns</b>
12311 3 The _Exit function cannot return to its caller.
12316 <sup><a name="note262" href="#note262"><b>262)</b></a></sup> Each function is called as many times as it was registered, and in the correct order with respect to
12317 other registered functions.
12319 [<a name="p316" href="#p316">page 316</a>] (<a href="#Contents">Contents</a>)
12321 <a name="7.20.4.5" href="#7.20.4.5"><b> 7.20.4.5 The getenv function</b></a>
12322 <b> Synopsis</b>
12323 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12324 char *getenv(const char *name);
12325 <b> Description</b>
12326 2 The getenv function searches an environment list, provided by the host environment,
12327 for a string that matches the string pointed to by name. The set of environment names
12328 and the method for altering the environment list are implementation-defined.
12329 3 The implementation shall behave as if no library function calls the getenv function.
12330 <b> Returns</b>
12331 4 The getenv function returns a pointer to a string associated with the matched list
12332 member. The string pointed to shall not be modified by the program, but may be
12333 overwritten by a subsequent call to the getenv function. If the specified name cannot
12334 be found, a null pointer is returned.
12335 <a name="7.20.4.6" href="#7.20.4.6"><b> 7.20.4.6 The system function</b></a>
12336 <b> Synopsis</b>
12337 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12338 int system(const char *string);
12339 <b> Description</b>
12340 2 If string is a null pointer, the system function determines whether the host
12341 environment has a command processor. If string is not a null pointer, the system
12342 function passes the string pointed to by string to that command processor to be
12343 executed in a manner which the implementation shall document; this might then cause the
12344 program calling system to behave in a non-conforming manner or to terminate.
12345 <b> Returns</b>
12346 3 If the argument is a null pointer, the system function returns nonzero only if a
12347 command processor is available. If the argument is not a null pointer, and the system
12348 function does return, it returns an implementation-defined value.
12350 [<a name="p317" href="#p317">page 317</a>] (<a href="#Contents">Contents</a>)
12352 <a name="7.20.5" href="#7.20.5"><b> 7.20.5 Searching and sorting utilities</b></a>
12353 1 These utilities make use of a comparison function to search or sort arrays of unspecified
12354 type. Where an argument declared as size_t nmemb specifies the length of the array
12355 for a function, nmemb can have the value zero on a call to that function; the comparison
12356 function is not called, a search finds no matching element, and sorting performs no
12357 rearrangement. Pointer arguments on such a call shall still have valid values, as described
12358 in <a href="#7.1.4">7.1.4</a>.
12359 2 The implementation shall ensure that the second argument of the comparison function
12360 (when called from bsearch), or both arguments (when called from qsort), are
12361 pointers to elements of the array.<sup><a href="#note263"><b>263)</b></a></sup> The first argument when called from bsearch
12362 shall equal key.
12363 3 The comparison function shall not alter the contents of the array. The implementation
12364 may reorder elements of the array between calls to the comparison function, but shall not
12365 alter the contents of any individual element.
12366 4 When the same objects (consisting of size bytes, irrespective of their current positions
12367 in the array) are passed more than once to the comparison function, the results shall be
12368 consistent with one another. That is, for qsort they shall define a total ordering on the
12369 array, and for bsearch the same object shall always compare the same way with the
12370 key.
12371 5 A sequence point occurs immediately before and immediately after each call to the
12372 comparison function, and also between any call to the comparison function and any
12373 movement of the objects passed as arguments to that call.
12374 <a name="7.20.5.1" href="#7.20.5.1"><b> 7.20.5.1 The bsearch function</b></a>
12375 <b> Synopsis</b>
12376 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12377 void *bsearch(const void *key, const void *base,
12378 size_t nmemb, size_t size,
12379 int (*compar)(const void *, const void *));
12380 <b> Description</b>
12381 2 The bsearch function searches an array of nmemb objects, the initial element of which
12382 is pointed to by base, for an element that matches the object pointed to by key. The
12385 <sup><a name="note263" href="#note263"><b>263)</b></a></sup> That is, if the value passed is p, then the following expressions are always nonzero:
12386 ((char *)p - (char *)base) % size == 0
12387 (char *)p &gt;= (char *)base
12388 (char *)p &lt; (char *)base + nmemb * size
12390 [<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
12392 size of each element of the array is specified by size.
12393 3 The comparison function pointed to by compar is called with two arguments that point
12394 to the key object and to an array element, in that order. The function shall return an
12395 integer less than, equal to, or greater than zero if the key object is considered,
12396 respectively, to be less than, to match, or to be greater than the array element. The array
12397 shall consist of: all the elements that compare less than, all the elements that compare
12398 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note264"><b>264)</b></a></sup>
12399 <b> Returns</b>
12400 4 The bsearch function returns a pointer to a matching element of the array, or a null
12401 pointer if no match is found. If two elements compare as equal, which element is
12402 matched is unspecified.
12403 <a name="7.20.5.2" href="#7.20.5.2"><b> 7.20.5.2 The qsort function</b></a>
12404 <b> Synopsis</b>
12405 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12406 void qsort(void *base, size_t nmemb, size_t size,
12407 int (*compar)(const void *, const void *));
12408 <b> Description</b>
12409 2 The qsort function sorts an array of nmemb objects, the initial element of which is
12410 pointed to by base. The size of each object is specified by size.
12411 3 The contents of the array are sorted into ascending order according to a comparison
12412 function pointed to by compar, which is called with two arguments that point to the
12413 objects being compared. The function shall return an integer less than, equal to, or
12414 greater than zero if the first argument is considered to be respectively less than, equal to,
12415 or greater than the second.
12416 4 If two elements compare as equal, their order in the resulting sorted array is unspecified.
12417 <b> Returns</b>
12418 5 The qsort function returns no value.
12423 <sup><a name="note264" href="#note264"><b>264)</b></a></sup> In practice, the entire array is sorted according to the comparison function.
12425 [<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
12427 <a name="7.20.6" href="#7.20.6"><b> 7.20.6 Integer arithmetic functions</b></a>
12428 <a name="7.20.6.1" href="#7.20.6.1"><b> 7.20.6.1 The abs, labs and llabs functions</b></a>
12429 <b> Synopsis</b>
12430 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12431 int abs(int j);
12432 long int labs(long int j);
12433 long long int llabs(long long int j);
12434 <b> Description</b>
12435 2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
12436 result cannot be represented, the behavior is undefined.<sup><a href="#note265"><b>265)</b></a></sup>
12437 <b> Returns</b>
12438 3 The abs, labs, and llabs, functions return the absolute value.
12439 <a name="7.20.6.2" href="#7.20.6.2"><b> 7.20.6.2 The div, ldiv, and lldiv functions</b></a>
12440 <b> Synopsis</b>
12441 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12442 div_t div(int numer, int denom);
12443 ldiv_t ldiv(long int numer, long int denom);
12444 lldiv_t lldiv(long long int numer, long long int denom);
12445 <b> Description</b>
12446 2 The div, ldiv, and lldiv, functions compute numer / denom and numer %
12447 denom in a single operation.
12448 <b> Returns</b>
12449 3 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
12450 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
12451 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
12452 each of which has the same type as the arguments numer and denom. If either part of
12453 the result cannot be represented, the behavior is undefined.
12458 <sup><a name="note265" href="#note265"><b>265)</b></a></sup> The absolute value of the most negative number cannot be represented in two's complement.
12460 [<a name="p320" href="#p320">page 320</a>] (<a href="#Contents">Contents</a>)
12462 <a name="7.20.7" href="#7.20.7"><b> 7.20.7 Multibyte/wide character conversion functions</b></a>
12463 1 The behavior of the multibyte character functions is affected by the LC_CTYPE category
12464 of the current locale. For a state-dependent encoding, each function is placed into its
12465 initial conversion state by a call for which its character pointer argument, s, is a null
12466 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
12467 state of the function to be altered as necessary. A call with s as a null pointer causes
12468 these functions to return a nonzero value if encodings have state dependency, and zero
12469 otherwise.<sup><a href="#note266"><b>266)</b></a></sup> Changing the LC_CTYPE category causes the conversion state of these
12470 functions to be indeterminate.
12471 <a name="7.20.7.1" href="#7.20.7.1"><b> 7.20.7.1 The mblen function</b></a>
12472 <b> Synopsis</b>
12473 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12474 int mblen(const char *s, size_t n);
12475 <b> Description</b>
12476 2 If s is not a null pointer, the mblen function determines the number of bytes contained
12477 in the multibyte character pointed to by s. Except that the conversion state of the
12478 mbtowc function is not affected, it is equivalent to
12479 mbtowc((wchar_t *)0, s, n);
12480 3 The implementation shall behave as if no library function calls the mblen function.
12481 <b> Returns</b>
12482 4 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
12483 character encodings, respectively, do or do not have state-dependent encodings. If s is
12484 not a null pointer, the mblen function either returns 0 (if s points to the null character),
12485 or returns the number of bytes that are contained in the multibyte character (if the next n
12486 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
12487 multibyte character).
12488 Forward references: the mbtowc function (<a href="#7.20.7.2">7.20.7.2</a>).
12493 <sup><a name="note266" href="#note266"><b>266)</b></a></sup> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
12494 character codes, but are grouped with an adjacent multibyte character.
12496 [<a name="p321" href="#p321">page 321</a>] (<a href="#Contents">Contents</a>)
12498 <a name="7.20.7.2" href="#7.20.7.2"><b> 7.20.7.2 The mbtowc function</b></a>
12499 <b> Synopsis</b>
12500 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12501 int mbtowc(wchar_t * restrict pwc,
12502 const char * restrict s,
12503 size_t n);
12504 <b> Description</b>
12505 2 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
12506 the byte pointed to by s to determine the number of bytes needed to complete the next
12507 multibyte character (including any shift sequences). If the function determines that the
12508 next multibyte character is complete and valid, it determines the value of the
12509 corresponding wide character and then, if pwc is not a null pointer, stores that value in
12510 the object pointed to by pwc. If the corresponding wide character is the null wide
12511 character, the function is left in the initial conversion state.
12512 3 The implementation shall behave as if no library function calls the mbtowc function.
12513 <b> Returns</b>
12514 4 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
12515 character encodings, respectively, do or do not have state-dependent encodings. If s is
12516 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
12517 or returns the number of bytes that are contained in the converted multibyte character (if
12518 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
12519 form a valid multibyte character).
12520 5 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
12521 macro.
12522 <a name="7.20.7.3" href="#7.20.7.3"><b> 7.20.7.3 The wctomb function</b></a>
12523 <b> Synopsis</b>
12524 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12525 int wctomb(char *s, wchar_t wc);
12526 <b> Description</b>
12527 2 The wctomb function determines the number of bytes needed to represent the multibyte
12528 character corresponding to the wide character given by wc (including any shift
12529 sequences), and stores the multibyte character representation in the array whose first
12530 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
12531 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
12532 sequence needed to restore the initial shift state, and the function is left in the initial
12533 conversion state.
12535 [<a name="p322" href="#p322">page 322</a>] (<a href="#Contents">Contents</a>)
12537 3 The implementation shall behave as if no library function calls the wctomb function.
12538 <b> Returns</b>
12539 4 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
12540 character encodings, respectively, do or do not have state-dependent encodings. If s is
12541 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
12542 to a valid multibyte character, or returns the number of bytes that are contained in the
12543 multibyte character corresponding to the value of wc.
12544 5 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
12545 <a name="7.20.8" href="#7.20.8"><b> 7.20.8 Multibyte/wide string conversion functions</b></a>
12546 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
12547 the current locale.
12548 <a name="7.20.8.1" href="#7.20.8.1"><b> 7.20.8.1 The mbstowcs function</b></a>
12549 <b> Synopsis</b>
12550 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12551 size_t mbstowcs(wchar_t * restrict pwcs,
12552 const char * restrict s,
12553 size_t n);
12554 <b> Description</b>
12555 2 The mbstowcs function converts a sequence of multibyte characters that begins in the
12556 initial shift state from the array pointed to by s into a sequence of corresponding wide
12557 characters and stores not more than n wide characters into the array pointed to by pwcs.
12558 No multibyte characters that follow a null character (which is converted into a null wide
12559 character) will be examined or converted. Each multibyte character is converted as if by
12560 a call to the mbtowc function, except that the conversion state of the mbtowc function is
12561 not affected.
12562 3 No more than n elements will be modified in the array pointed to by pwcs. If copying
12563 takes place between objects that overlap, the behavior is undefined.
12564 <b> Returns</b>
12565 4 If an invalid multibyte character is encountered, the mbstowcs function returns
12566 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
12567 elements modified, not including a terminating null wide character, if any.<sup><a href="#note267"><b>267)</b></a></sup>
12572 <sup><a name="note267" href="#note267"><b>267)</b></a></sup> The array will not be null-terminated if the value returned is n.
12574 [<a name="p323" href="#p323">page 323</a>] (<a href="#Contents">Contents</a>)
12576 <a name="7.20.8.2" href="#7.20.8.2"><b> 7.20.8.2 The wcstombs function</b></a>
12577 <b> Synopsis</b>
12578 1 #include <a href="#7.20">&lt;stdlib.h&gt;</a>
12579 size_t wcstombs(char * restrict s,
12580 const wchar_t * restrict pwcs,
12581 size_t n);
12582 <b> Description</b>
12583 2 The wcstombs function converts a sequence of wide characters from the array pointed
12584 to by pwcs into a sequence of corresponding multibyte characters that begins in the
12585 initial shift state, and stores these multibyte characters into the array pointed to by s,
12586 stopping if a multibyte character would exceed the limit of n total bytes or if a null
12587 character is stored. Each wide character is converted as if by a call to the wctomb
12588 function, except that the conversion state of the wctomb function is not affected.
12589 3 No more than n bytes will be modified in the array pointed to by s. If copying takes place
12590 between objects that overlap, the behavior is undefined.
12591 <b> Returns</b>
12592 4 If a wide character is encountered that does not correspond to a valid multibyte character,
12593 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
12594 returns the number of bytes modified, not including a terminating null character, if
12595 any.267)
12597 [<a name="p324" href="#p324">page 324</a>] (<a href="#Contents">Contents</a>)
12599 <a name="7.21" href="#7.21"><b> 7.21 String handling &lt;string.h&gt;</b></a>
12600 <a name="7.21.1" href="#7.21.1"><b> 7.21.1 String function conventions</b></a>
12601 1 The header <a href="#7.21">&lt;string.h&gt;</a> declares one type and several functions, and defines one
12602 macro useful for manipulating arrays of character type and other objects treated as arrays
12603 of character type.<sup><a href="#note268"><b>268)</b></a></sup> The type is size_t and the macro is NULL (both described in
12604 <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>
12605 a char * or void * argument points to the initial (lowest addressed) character of the
12606 array. If an array is accessed beyond the end of an object, the behavior is undefined.
12607 2 Where an argument declared as size_t n specifies the length of the array for a
12608 function, n can have the value zero on a call to that function. Unless explicitly stated
12609 otherwise in the description of a particular function in this subclause, pointer arguments
12610 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
12611 function that locates a character finds no occurrence, a function that compares two
12612 character sequences returns zero, and a function that copies characters copies zero
12613 characters.
12614 3 For all functions in this subclause, each character shall be interpreted as if it had the type
12615 unsigned char (and therefore every possible object representation is valid and has a
12616 different value).
12617 <a name="7.21.2" href="#7.21.2"><b> 7.21.2 Copying functions</b></a>
12618 <a name="7.21.2.1" href="#7.21.2.1"><b> 7.21.2.1 The memcpy function</b></a>
12619 <b> Synopsis</b>
12620 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12621 void *memcpy(void * restrict s1,
12622 const void * restrict s2,
12623 size_t n);
12624 <b> Description</b>
12625 2 The memcpy function copies n characters from the object pointed to by s2 into the
12626 object pointed to by s1. If copying takes place between objects that overlap, the behavior
12627 is undefined.
12628 <b> Returns</b>
12629 3 The memcpy function returns the value of s1.
12634 <sup><a name="note268" href="#note268"><b>268)</b></a></sup> See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
12636 [<a name="p325" href="#p325">page 325</a>] (<a href="#Contents">Contents</a>)
12638 <a name="7.21.2.2" href="#7.21.2.2"><b> 7.21.2.2 The memmove function</b></a>
12639 <b> Synopsis</b>
12640 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12641 void *memmove(void *s1, const void *s2, size_t n);
12642 <b> Description</b>
12643 2 The memmove function copies n characters from the object pointed to by s2 into the
12644 object pointed to by s1. Copying takes place as if the n characters from the object
12645 pointed to by s2 are first copied into a temporary array of n characters that does not
12646 overlap the objects pointed to by s1 and s2, and then the n characters from the
12647 temporary array are copied into the object pointed to by s1.
12648 <b> Returns</b>
12649 3 The memmove function returns the value of s1.
12650 <a name="7.21.2.3" href="#7.21.2.3"><b> 7.21.2.3 The strcpy function</b></a>
12651 <b> Synopsis</b>
12652 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12653 char *strcpy(char * restrict s1,
12654 const char * restrict s2);
12655 <b> Description</b>
12656 2 The strcpy function copies the string pointed to by s2 (including the terminating null
12657 character) into the array pointed to by s1. If copying takes place between objects that
12658 overlap, the behavior is undefined.
12659 <b> Returns</b>
12660 3 The strcpy function returns the value of s1.
12661 <a name="7.21.2.4" href="#7.21.2.4"><b> 7.21.2.4 The strncpy function</b></a>
12662 <b> Synopsis</b>
12663 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12664 char *strncpy(char * restrict s1,
12665 const char * restrict s2,
12666 size_t n);
12667 <b> Description</b>
12668 2 The strncpy function copies not more than n characters (characters that follow a null
12669 character are not copied) from the array pointed to by s2 to the array pointed to by
12671 [<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
12673 s1.<sup><a href="#note269"><b>269)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
12674 3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
12675 are appended to the copy in the array pointed to by s1, until n characters in all have been
12676 written.
12677 <b> Returns</b>
12678 4 The strncpy function returns the value of s1.
12679 <a name="7.21.3" href="#7.21.3"><b> 7.21.3 Concatenation functions</b></a>
12680 <a name="7.21.3.1" href="#7.21.3.1"><b> 7.21.3.1 The strcat function</b></a>
12681 <b> Synopsis</b>
12682 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12683 char *strcat(char * restrict s1,
12684 const char * restrict s2);
12685 <b> Description</b>
12686 2 The strcat function appends a copy of the string pointed to by s2 (including the
12687 terminating null character) to the end of the string pointed to by s1. The initial character
12688 of s2 overwrites the null character at the end of s1. If copying takes place between
12689 objects that overlap, the behavior is undefined.
12690 <b> Returns</b>
12691 3 The strcat function returns the value of s1.
12692 <a name="7.21.3.2" href="#7.21.3.2"><b> 7.21.3.2 The strncat function</b></a>
12693 <b> Synopsis</b>
12694 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12695 char *strncat(char * restrict s1,
12696 const char * restrict s2,
12697 size_t n);
12698 <b> Description</b>
12699 2 The strncat function appends not more than n characters (a null character and
12700 characters that follow it are not appended) from the array pointed to by s2 to the end of
12701 the string pointed to by s1. The initial character of s2 overwrites the null character at the
12702 end of s1. A terminating null character is always appended to the result.<sup><a href="#note270"><b>270)</b></a></sup> If copying
12704 <sup><a name="note269" href="#note269"><b>269)</b></a></sup> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
12705 not be null-terminated.
12706 <sup><a name="note270" href="#note270"><b>270)</b></a></sup> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
12707 strlen(s1)+n+1.
12709 [<a name="p327" href="#p327">page 327</a>] (<a href="#Contents">Contents</a>)
12711 takes place between objects that overlap, the behavior is undefined.
12712 <b> Returns</b>
12713 3 The strncat function returns the value of s1.
12714 Forward references: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
12715 <a name="7.21.4" href="#7.21.4"><b> 7.21.4 Comparison functions</b></a>
12716 1 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
12717 and strncmp is determined by the sign of the difference between the values of the first
12718 pair of characters (both interpreted as unsigned char) that differ in the objects being
12719 compared.
12720 <a name="7.21.4.1" href="#7.21.4.1"><b> 7.21.4.1 The memcmp function</b></a>
12721 <b> Synopsis</b>
12722 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12723 int memcmp(const void *s1, const void *s2, size_t n);
12724 <b> Description</b>
12725 2 The memcmp function compares the first n characters of the object pointed to by s1 to
12726 the first n characters of the object pointed to by s2.<sup><a href="#note271"><b>271)</b></a></sup>
12727 <b> Returns</b>
12728 3 The memcmp function returns an integer greater than, equal to, or less than zero,
12729 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
12730 pointed to by s2.
12731 <a name="7.21.4.2" href="#7.21.4.2"><b> 7.21.4.2 The strcmp function</b></a>
12732 <b> Synopsis</b>
12733 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12734 int strcmp(const char *s1, const char *s2);
12735 <b> Description</b>
12736 2 The strcmp function compares the string pointed to by s1 to the string pointed to by
12738 <b> Returns</b>
12739 3 The strcmp function returns an integer greater than, equal to, or less than zero,
12740 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
12742 <sup><a name="note271" href="#note271"><b>271)</b></a></sup> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
12743 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
12744 comparison.
12746 [<a name="p328" href="#p328">page 328</a>] (<a href="#Contents">Contents</a>)
12748 pointed to by s2.
12749 <a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The strcoll function</b></a>
12750 <b> Synopsis</b>
12751 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12752 int strcoll(const char *s1, const char *s2);
12753 <b> Description</b>
12754 2 The strcoll function compares the string pointed to by s1 to the string pointed to by
12755 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
12756 <b> Returns</b>
12757 3 The strcoll function returns an integer greater than, equal to, or less than zero,
12758 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
12759 pointed to by s2 when both are interpreted as appropriate to the current locale.
12760 <a name="7.21.4.4" href="#7.21.4.4"><b> 7.21.4.4 The strncmp function</b></a>
12761 <b> Synopsis</b>
12762 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12763 int strncmp(const char *s1, const char *s2, size_t n);
12764 <b> Description</b>
12765 2 The strncmp function compares not more than n characters (characters that follow a
12766 null character are not compared) from the array pointed to by s1 to the array pointed to
12767 by s2.
12768 <b> Returns</b>
12769 3 The strncmp function returns an integer greater than, equal to, or less than zero,
12770 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
12771 to, or less than the possibly null-terminated array pointed to by s2.
12772 <a name="7.21.4.5" href="#7.21.4.5"><b> 7.21.4.5 The strxfrm function</b></a>
12773 <b> Synopsis</b>
12774 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12775 size_t strxfrm(char * restrict s1,
12776 const char * restrict s2,
12777 size_t n);
12778 <b> Description</b>
12779 2 The strxfrm function transforms the string pointed to by s2 and places the resulting
12780 string into the array pointed to by s1. The transformation is such that if the strcmp
12781 function is applied to two transformed strings, it returns a value greater than, equal to, or
12783 [<a name="p329" href="#p329">page 329</a>] (<a href="#Contents">Contents</a>)
12785 less than zero, corresponding to the result of the strcoll function applied to the same
12786 two original strings. No more than n characters are placed into the resulting array
12787 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
12788 be a null pointer. If copying takes place between objects that overlap, the behavior is
12789 undefined.
12790 <b> Returns</b>
12791 3 The strxfrm function returns the length of the transformed string (not including the
12792 terminating null character). If the value returned is n or more, the contents of the array
12793 pointed to by s1 are indeterminate.
12794 4 EXAMPLE The value of the following expression is the size of the array needed to hold the
12795 transformation of the string pointed to by s.
12796 1 + strxfrm(NULL, s, 0)
12798 <a name="7.21.5" href="#7.21.5"><b> 7.21.5 Search functions</b></a>
12799 <a name="7.21.5.1" href="#7.21.5.1"><b> 7.21.5.1 The memchr function</b></a>
12800 <b> Synopsis</b>
12801 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12802 void *memchr(const void *s, int c, size_t n);
12803 <b> Description</b>
12804 2 The memchr function locates the first occurrence of c (converted to an unsigned
12805 char) in the initial n characters (each interpreted as unsigned char) of the object
12806 pointed to by s.
12807 <b> Returns</b>
12808 3 The memchr function returns a pointer to the located character, or a null pointer if the
12809 character does not occur in the object.
12810 <a name="7.21.5.2" href="#7.21.5.2"><b> 7.21.5.2 The strchr function</b></a>
12811 <b> Synopsis</b>
12812 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12813 char *strchr(const char *s, int c);
12814 <b> Description</b>
12815 2 The strchr function locates the first occurrence of c (converted to a char) in the
12816 string pointed to by s. The terminating null character is considered to be part of the
12817 string.
12818 <b> Returns</b>
12819 3 The strchr function returns a pointer to the located character, or a null pointer if the
12820 character does not occur in the string.
12822 [<a name="p330" href="#p330">page 330</a>] (<a href="#Contents">Contents</a>)
12824 <a name="7.21.5.3" href="#7.21.5.3"><b> 7.21.5.3 The strcspn function</b></a>
12825 <b> Synopsis</b>
12826 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12827 size_t strcspn(const char *s1, const char *s2);
12828 <b> Description</b>
12829 2 The strcspn function computes the length of the maximum initial segment of the string
12830 pointed to by s1 which consists entirely of characters not from the string pointed to by
12832 <b> Returns</b>
12833 3 The strcspn function returns the length of the segment.
12834 <a name="7.21.5.4" href="#7.21.5.4"><b> 7.21.5.4 The strpbrk function</b></a>
12835 <b> Synopsis</b>
12836 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12837 char *strpbrk(const char *s1, const char *s2);
12838 <b> Description</b>
12839 2 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
12840 character from the string pointed to by s2.
12841 <b> Returns</b>
12842 3 The strpbrk function returns a pointer to the character, or a null pointer if no character
12843 from s2 occurs in s1.
12844 <a name="7.21.5.5" href="#7.21.5.5"><b> 7.21.5.5 The strrchr function</b></a>
12845 <b> Synopsis</b>
12846 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12847 char *strrchr(const char *s, int c);
12848 <b> Description</b>
12849 2 The strrchr function locates the last occurrence of c (converted to a char) in the
12850 string pointed to by s. The terminating null character is considered to be part of the
12851 string.
12852 <b> Returns</b>
12853 3 The strrchr function returns a pointer to the character, or a null pointer if c does not
12854 occur in the string.
12856 [<a name="p331" href="#p331">page 331</a>] (<a href="#Contents">Contents</a>)
12858 <a name="7.21.5.6" href="#7.21.5.6"><b> 7.21.5.6 The strspn function</b></a>
12859 <b> Synopsis</b>
12860 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12861 size_t strspn(const char *s1, const char *s2);
12862 <b> Description</b>
12863 2 The strspn function computes the length of the maximum initial segment of the string
12864 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
12865 <b> Returns</b>
12866 3 The strspn function returns the length of the segment.
12867 <a name="7.21.5.7" href="#7.21.5.7"><b> 7.21.5.7 The strstr function</b></a>
12868 <b> Synopsis</b>
12869 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12870 char *strstr(const char *s1, const char *s2);
12871 <b> Description</b>
12872 2 The strstr function locates the first occurrence in the string pointed to by s1 of the
12873 sequence of characters (excluding the terminating null character) in the string pointed to
12874 by s2.
12875 <b> Returns</b>
12876 3 The strstr function returns a pointer to the located string, or a null pointer if the string
12877 is not found. If s2 points to a string with zero length, the function returns s1.
12878 <a name="7.21.5.8" href="#7.21.5.8"><b> 7.21.5.8 The strtok function</b></a>
12879 <b> Synopsis</b>
12880 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12881 char *strtok(char * restrict s1,
12882 const char * restrict s2);
12883 <b> Description</b>
12884 2 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
12885 sequence of tokens, each of which is delimited by a character from the string pointed to
12886 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
12887 sequence have a null first argument. The separator string pointed to by s2 may be
12888 different from call to call.
12889 3 The first call in the sequence searches the string pointed to by s1 for the first character
12890 that is not contained in the current separator string pointed to by s2. If no such character
12891 is found, then there are no tokens in the string pointed to by s1 and the strtok function
12893 [<a name="p332" href="#p332">page 332</a>] (<a href="#Contents">Contents</a>)
12895 returns a null pointer. If such a character is found, it is the start of the first token.
12896 4 The strtok function then searches from there for a character that is contained in the
12897 current separator string. If no such character is found, the current token extends to the
12898 end of the string pointed to by s1, and subsequent searches for a token will return a null
12899 pointer. If such a character is found, it is overwritten by a null character, which
12900 terminates the current token. The strtok function saves a pointer to the following
12901 character, from which the next search for a token will start.
12902 5 Each subsequent call, with a null pointer as the value of the first argument, starts
12903 searching from the saved pointer and behaves as described above.
12904 6 The implementation shall behave as if no library function calls the strtok function.
12905 <b> Returns</b>
12906 7 The strtok function returns a pointer to the first character of a token, or a null pointer
12907 if there is no token.
12908 8 EXAMPLE
12909 #include <a href="#7.21">&lt;string.h&gt;</a>
12910 static char str[] = "?a???b,,,#c";
12911 char *t;
12912 t = strtok(str, "?"); // t points to the token "a"
12913 t = strtok(NULL, ","); // t points to the token "??b"
12914 t = strtok(NULL, "#,"); // t points to the token "c"
12915 t = strtok(NULL, "?"); // t is a null pointer
12917 <a name="7.21.6" href="#7.21.6"><b> 7.21.6 Miscellaneous functions</b></a>
12918 <a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The memset function</b></a>
12919 <b> Synopsis</b>
12920 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12921 void *memset(void *s, int c, size_t n);
12922 <b> Description</b>
12923 2 The memset function copies the value of c (converted to an unsigned char) into
12924 each of the first n characters of the object pointed to by s.
12925 <b> Returns</b>
12926 3 The memset function returns the value of s.
12928 [<a name="p333" href="#p333">page 333</a>] (<a href="#Contents">Contents</a>)
12930 <a name="7.21.6.2" href="#7.21.6.2"><b> 7.21.6.2 The strerror function</b></a>
12931 <b> Synopsis</b>
12932 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12933 char *strerror(int errnum);
12934 <b> Description</b>
12935 2 The strerror function maps the number in errnum to a message string. Typically,
12936 the values for errnum come from errno, but strerror shall map any value of type
12937 int to a message.
12938 3 The implementation shall behave as if no library function calls the strerror function.
12939 <b> Returns</b>
12940 4 The strerror function returns a pointer to the string, the contents of which are locale-
12941 specific. The array pointed to shall not be modified by the program, but may be
12942 overwritten by a subsequent call to the strerror function.
12943 <a name="7.21.6.3" href="#7.21.6.3"><b> 7.21.6.3 The strlen function</b></a>
12944 <b> Synopsis</b>
12945 1 #include <a href="#7.21">&lt;string.h&gt;</a>
12946 size_t strlen(const char *s);
12947 <b> Description</b>
12948 2 The strlen function computes the length of the string pointed to by s.
12949 <b> Returns</b>
12950 3 The strlen function returns the number of characters that precede the terminating null
12951 character.
12953 [<a name="p334" href="#p334">page 334</a>] (<a href="#Contents">Contents</a>)
12955 <a name="7.22" href="#7.22"><b> 7.22 Type-generic math &lt;tgmath.h&gt;</b></a>
12956 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
12957 defines several type-generic macros.
12958 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
12959 double) suffix, several have one or more parameters whose corresponding real type is
12960 double. For each such function, except modf, there is a corresponding type-generic
12961 macro.<sup><a href="#note272"><b>272)</b></a></sup> The parameters whose corresponding real type is double in the function
12962 synopsis are generic parameters. Use of the macro invokes a function whose
12963 corresponding real type and type domain are determined by the arguments for the generic
12964 parameters.<sup><a href="#note273"><b>273)</b></a></sup>
12965 3 Use of the macro invokes a function whose generic parameters have the corresponding
12966 real type determined as follows:
12967 -- First, if any argument for generic parameters has type long double, the type
12968 determined is long double.
12969 -- Otherwise, if any argument for generic parameters has type double or is of integer
12970 type, the type determined is double.
12971 -- Otherwise, the type determined is float.
12972 4 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
12973 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
12974 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
12975 corresponding type-generic macro for fabs and cabs is fabs.
12980 <sup><a name="note272" href="#note272"><b>272)</b></a></sup> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
12981 make available the corresponding ordinary function.
12982 <sup><a name="note273" href="#note273"><b>273)</b></a></sup> If the type of the argument is not compatible with the type of the parameter for the selected function,
12983 the behavior is undefined.
12985 [<a name="p335" href="#p335">page 335</a>] (<a href="#Contents">Contents</a>)
12987 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
12988 function function macro
12989 acos cacos acos
12990 asin casin asin
12991 atan catan atan
12992 acosh cacosh acosh
12993 asinh casinh asinh
12994 atanh catanh atanh
12995 cos ccos cos
12996 sin csin sin
12997 tan ctan tan
12998 cosh ccosh cosh
12999 sinh csinh sinh
13000 tanh ctanh tanh
13001 exp cexp exp
13002 log clog log
13003 pow cpow pow
13004 sqrt csqrt sqrt
13005 fabs cabs fabs
13006 If at least one argument for a generic parameter is complex, then use of the macro invokes
13007 a complex function; otherwise, use of the macro invokes a real function.
13008 5 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
13009 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
13010 name as the function. These type-generic macros are:
13011 atan2 fma llround remainder
13012 cbrt fmax log10 remquo
13013 ceil fmin log1p rint
13014 copysign fmod log2 round
13015 erf frexp logb scalbn
13016 erfc hypot lrint scalbln
13017 exp2 ilogb lround tgamma
13018 expm1 ldexp nearbyint trunc
13019 fdim lgamma nextafter
13020 floor llrint nexttoward
13021 If all arguments for generic parameters are real, then use of the macro invokes a real
13022 function; otherwise, use of the macro results in undefined behavior.
13023 6 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
13024 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
13025 function. These type-generic macros are:
13027 [<a name="p336" href="#p336">page 336</a>] (<a href="#Contents">Contents</a>)
13029 carg conj creal
13030 cimag cproj
13031 Use of the macro with any real or complex argument invokes a complex function.
13032 7 EXAMPLE With the declarations
13033 #include <a href="#7.22">&lt;tgmath.h&gt;</a>
13034 int n;
13035 float f;
13036 double d;
13037 long double ld;
13038 float complex fc;
13039 double complex dc;
13040 long double complex ldc;
13041 functions invoked by use of type-generic macros are shown in the following table:
13042 macro use invokes
13043 exp(n) exp(n), the function
13044 acosh(f) acoshf(f)
13045 sin(d) sin(d), the function
13046 atan(ld) atanl(ld)
13047 log(fc) clogf(fc)
13048 sqrt(dc) csqrt(dc)
13049 pow(ldc, f) cpowl(ldc, f)
13050 remainder(n, n) remainder(n, n), the function
13051 nextafter(d, f) nextafter(d, f), the function
13052 nexttoward(f, ld) nexttowardf(f, ld)
13053 copysign(n, ld) copysignl(n, ld)
13054 ceil(fc) undefined behavior
13055 rint(dc) undefined behavior
13056 fmax(ldc, ld) undefined behavior
13057 carg(n) carg(n), the function
13058 cproj(f) cprojf(f)
13059 creal(d) creal(d), the function
13060 cimag(ld) cimagl(ld)
13061 fabs(fc) cabsf(fc)
13062 carg(dc) carg(dc), the function
13063 cproj(ldc) cprojl(ldc)
13065 [<a name="p337" href="#p337">page 337</a>] (<a href="#Contents">Contents</a>)
13067 <a name="7.23" href="#7.23"><b> 7.23 Date and time &lt;time.h&gt;</b></a>
13068 <a name="7.23.1" href="#7.23.1"><b> 7.23.1 Components of time</b></a>
13069 1 The header <a href="#7.23">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
13070 manipulating time. Many functions deal with a calendar time that represents the current
13071 date (according to the Gregorian calendar) and time. Some functions deal with local
13072 time, which is the calendar time expressed for some specific time zone, and with Daylight
13073 Saving Time, which is a temporary change in the algorithm for determining local time.
13074 The local time zone and Daylight Saving Time are implementation-defined.
13075 2 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
13076 CLOCKS_PER_SEC
13077 which expands to an expression with type clock_t (described below) that is the
13078 number per second of the value returned by the clock function.
13079 3 The types declared are size_t (described in <a href="#7.17">7.17</a>);
13080 clock_t
13082 time_t
13083 which are arithmetic types capable of representing times; and
13084 struct tm
13085 which holds the components of a calendar time, called the broken-down time.
13086 4 The range and precision of times representable in clock_t and time_t are
13087 implementation-defined. The tm structure shall contain at least the following members,
13088 in any order. The semantics of the members and their normal ranges are expressed in the
13089 comments.<sup><a href="#note274"><b>274)</b></a></sup>
13090 int tm_sec; // seconds after the minute -- [0, 60]
13091 int tm_min; // minutes after the hour -- [0, 59]
13092 int tm_hour; // hours since midnight -- [0, 23]
13093 int tm_mday; // day of the month -- [1, 31]
13094 int tm_mon; // months since January -- [0, 11]
13095 int tm_year; // years since 1900
13096 int tm_wday; // days since Sunday -- [0, 6]
13097 int tm_yday; // days since January 1 -- [0, 365]
13098 int tm_isdst; // Daylight Saving Time flag
13102 <sup><a name="note274" href="#note274"><b>274)</b></a></sup> The range [0, 60] for tm_sec allows for a positive leap second.
13104 [<a name="p338" href="#p338">page 338</a>] (<a href="#Contents">Contents</a>)
13106 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
13107 Saving Time is not in effect, and negative if the information is not available.
13108 <a name="7.23.2" href="#7.23.2"><b> 7.23.2 Time manipulation functions</b></a>
13109 <a name="7.23.2.1" href="#7.23.2.1"><b> 7.23.2.1 The clock function</b></a>
13110 <b> Synopsis</b>
13111 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13112 clock_t clock(void);
13113 <b> Description</b>
13114 2 The clock function determines the processor time used.
13115 <b> Returns</b>
13116 3 The clock function returns the implementation's best approximation to the processor
13117 time used by the program since the beginning of an implementation-defined era related
13118 only to the program invocation. To determine the time in seconds, the value returned by
13119 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
13120 the processor time used is not available or its value cannot be represented, the function
13121 returns the value (clock_t)(-1).<sup><a href="#note275"><b>275)</b></a></sup>
13122 <a name="7.23.2.2" href="#7.23.2.2"><b> 7.23.2.2 The difftime function</b></a>
13123 <b> Synopsis</b>
13124 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13125 double difftime(time_t time1, time_t time0);
13126 <b> Description</b>
13127 2 The difftime function computes the difference between two calendar times: time1 -
13128 time0.
13129 <b> Returns</b>
13130 3 The difftime function returns the difference expressed in seconds as a double.
13135 <sup><a name="note275" href="#note275"><b>275)</b></a></sup> In order to measure the time spent in a program, the clock function should be called at the start of
13136 the program and its return value subtracted from the value returned by subsequent calls.
13138 [<a name="p339" href="#p339">page 339</a>] (<a href="#Contents">Contents</a>)
13140 <a name="7.23.2.3" href="#7.23.2.3"><b> 7.23.2.3 The mktime function</b></a>
13141 <b> Synopsis</b>
13142 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13143 time_t mktime(struct tm *timeptr);
13144 <b> Description</b>
13145 2 The mktime function converts the broken-down time, expressed as local time, in the
13146 structure pointed to by timeptr into a calendar time value with the same encoding as
13147 that of the values returned by the time function. The original values of the tm_wday
13148 and tm_yday components of the structure are ignored, and the original values of the
13149 other components are not restricted to the ranges indicated above.<sup><a href="#note276"><b>276)</b></a></sup> On successful
13150 completion, the values of the tm_wday and tm_yday components of the structure are
13151 set appropriately, and the other components are set to represent the specified calendar
13152 time, but with their values forced to the ranges indicated above; the final value of
13153 tm_mday is not set until tm_mon and tm_year are determined.
13154 <b> Returns</b>
13155 3 The mktime function returns the specified calendar time encoded as a value of type
13156 time_t. If the calendar time cannot be represented, the function returns the value
13157 (time_t)(-1).
13158 4 EXAMPLE What day of the week is July 4, 2001?
13159 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13160 #include <a href="#7.23">&lt;time.h&gt;</a>
13161 static const char *const wday[] = {
13162 "Sunday", "Monday", "Tuesday", "Wednesday",
13163 "Thursday", "Friday", "Saturday", "-unknown-"
13165 struct tm time_str;
13166 /* ... */
13171 <sup><a name="note276" href="#note276"><b>276)</b></a></sup> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
13172 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
13173 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
13175 [<a name="p340" href="#p340">page 340</a>] (<a href="#Contents">Contents</a>)
13177 time_str.tm_year = 2001 - 1900;
13178 time_str.tm_mon = 7 - 1;
13179 time_str.tm_mday = 4;
13180 time_str.tm_hour = 0;
13181 time_str.tm_min = 0;
13182 time_str.tm_sec = 1;
13183 time_str.tm_isdst = -1;
13184 if (mktime(&amp;time_str) == (time_t)(-1))
13185 time_str.tm_wday = 7;
13186 printf("%s\n", wday[time_str.tm_wday]);
13188 <a name="7.23.2.4" href="#7.23.2.4"><b> 7.23.2.4 The time function</b></a>
13189 <b> Synopsis</b>
13190 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13191 time_t time(time_t *timer);
13192 <b> Description</b>
13193 2 The time function determines the current calendar time. The encoding of the value is
13194 unspecified.
13195 <b> Returns</b>
13196 3 The time function returns the implementation's best approximation to the current
13197 calendar time. The value (time_t)(-1) is returned if the calendar time is not
13198 available. If timer is not a null pointer, the return value is also assigned to the object it
13199 points to.
13200 <a name="7.23.3" href="#7.23.3"><b> 7.23.3 Time conversion functions</b></a>
13201 1 Except for the strftime function, these functions each return a pointer to one of two
13202 types of static objects: a broken-down time structure or an array of char. Execution of
13203 any of the functions that return a pointer to one of these object types may overwrite the
13204 information in any object of the same type pointed to by the value returned from any
13205 previous call to any of them. The implementation shall behave as if no other library
13206 functions call these functions.
13207 <a name="7.23.3.1" href="#7.23.3.1"><b> 7.23.3.1 The asctime function</b></a>
13208 <b> Synopsis</b>
13209 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13210 char *asctime(const struct tm *timeptr);
13211 <b> Description</b>
13212 2 The asctime function converts the broken-down time in the structure pointed to by
13213 timeptr into a string in the form
13214 Sun Sep 16 01:03:52 1973\n\0
13216 [<a name="p341" href="#p341">page 341</a>] (<a href="#Contents">Contents</a>)
13218 using the equivalent of the following algorithm.
13219 char *asctime(const struct tm *timeptr)
13221 static const char wday_name[7][3] = {
13222 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
13224 static const char mon_name[12][3] = {
13225 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
13226 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
13228 static char result[26];
13229 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
13230 wday_name[timeptr-&gt;tm_wday],
13231 mon_name[timeptr-&gt;tm_mon],
13232 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
13233 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
13234 1900 + timeptr-&gt;tm_year);
13235 return result;
13237 <b> Returns</b>
13238 3 The asctime function returns a pointer to the string.
13239 <a name="7.23.3.2" href="#7.23.3.2"><b> 7.23.3.2 The ctime function</b></a>
13240 <b> Synopsis</b>
13241 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13242 char *ctime(const time_t *timer);
13243 <b> Description</b>
13244 2 The ctime function converts the calendar time pointed to by timer to local time in the
13245 form of a string. It is equivalent to
13246 asctime(localtime(timer))
13247 <b> Returns</b>
13248 3 The ctime function returns the pointer returned by the asctime function with that
13249 broken-down time as argument.
13250 Forward references: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
13252 [<a name="p342" href="#p342">page 342</a>] (<a href="#Contents">Contents</a>)
13254 <a name="7.23.3.3" href="#7.23.3.3"><b> 7.23.3.3 The gmtime function</b></a>
13255 <b> Synopsis</b>
13256 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13257 struct tm *gmtime(const time_t *timer);
13258 <b> Description</b>
13259 2 The gmtime function converts the calendar time pointed to by timer into a broken-
13260 down time, expressed as UTC.
13261 <b> Returns</b>
13262 3 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
13263 specified time cannot be converted to UTC.
13264 <a name="7.23.3.4" href="#7.23.3.4"><b> 7.23.3.4 The localtime function</b></a>
13265 <b> Synopsis</b>
13266 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13267 struct tm *localtime(const time_t *timer);
13268 <b> Description</b>
13269 2 The localtime function converts the calendar time pointed to by timer into a
13270 broken-down time, expressed as local time.
13271 <b> Returns</b>
13272 3 The localtime function returns a pointer to the broken-down time, or a null pointer if
13273 the specified time cannot be converted to local time.
13274 <a name="7.23.3.5" href="#7.23.3.5"><b> 7.23.3.5 The strftime function</b></a>
13275 <b> Synopsis</b>
13276 1 #include <a href="#7.23">&lt;time.h&gt;</a>
13277 size_t strftime(char * restrict s,
13278 size_t maxsize,
13279 const char * restrict format,
13280 const struct tm * restrict timeptr);
13281 <b> Description</b>
13282 2 The strftime function places characters into the array pointed to by s as controlled by
13283 the string pointed to by format. The format shall be a multibyte character sequence,
13284 beginning and ending in its initial shift state. The format string consists of zero or
13285 more conversion specifiers and ordinary multibyte characters. A conversion specifier
13286 consists of a % character, possibly followed by an E or O modifier character (described
13287 below), followed by a character that determines the behavior of the conversion specifier.
13288 All ordinary multibyte characters (including the terminating null character) are copied
13290 [<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
13292 unchanged into the array. If copying takes place between objects that overlap, the
13293 behavior is undefined. No more than maxsize characters are placed into the array.
13294 3 Each conversion specifier is replaced by appropriate characters as described in the
13295 following list. The appropriate characters are determined using the LC_TIME category
13296 of the current locale and by the values of zero or more members of the broken-down time
13297 structure pointed to by timeptr, as specified in brackets in the description. If any of
13298 the specified values is outside the normal range, the characters stored are unspecified.
13299 %a is replaced by the locale's abbreviated weekday name. [tm_wday]
13300 %A is replaced by the locale's full weekday name. [tm_wday]
13301 %b is replaced by the locale's abbreviated month name. [tm_mon]
13302 %B is replaced by the locale's full month name. [tm_mon]
13303 %c is replaced by the locale's appropriate date and time representation. [all specified
13304 in <a href="#7.23.1">7.23.1</a>]
13305 %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
13306 number (00-99). [tm_year]
13307 %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
13308 %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
13309 %e is replaced by the day of the month as a decimal number (1-31); a single digit is
13310 preceded by a space. [tm_mday]
13311 %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
13312 tm_mday]
13313 %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
13314 number (00-99). [tm_year, tm_wday, tm_yday]
13315 %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
13316 [tm_year, tm_wday, tm_yday]
13317 %h is equivalent to ''%b''. [tm_mon]
13318 %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
13319 %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
13320 %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
13321 %m is replaced by the month as a decimal number (01-12). [tm_mon]
13322 %M is replaced by the minute as a decimal number (00-59). [tm_min]
13323 %n is replaced by a new-line character.
13324 %p is replaced by the locale's equivalent of the AM/PM designations associated with a
13325 12-hour clock. [tm_hour]
13326 %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
13327 %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
13328 %S is replaced by the second as a decimal number (00-60). [tm_sec]
13329 %t is replaced by a horizontal-tab character.
13330 %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
13331 tm_sec]
13333 [<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
13335 %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
13336 is 1. [tm_wday]
13337 %U is replaced by the week number of the year (the first Sunday as the first day of week
13338 <sup><a name="note1" href="#note1"><b>1)</b></a></sup> as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
13339 %V is replaced by the ISO 8601 week number (see below) as a decimal number
13340 (01-53). [tm_year, tm_wday, tm_yday]
13341 %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
13342 [tm_wday]
13343 %W is replaced by the week number of the year (the first Monday as the first day of
13344 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
13345 %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
13346 %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
13347 %y is replaced by the last 2 digits of the year as a decimal number (00-99).
13348 [tm_year]
13349 %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
13350 %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
13351 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
13352 zone is determinable. [tm_isdst]
13353 %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
13354 time zone is determinable. [tm_isdst]
13355 %% is replaced by %.
13356 4 Some conversion specifiers can be modified by the inclusion of an E or O modifier
13357 character to indicate an alternative format or specification. If the alternative format or
13358 specification does not exist for the current locale, the modifier is ignored.
13359 %Ec is replaced by the locale's alternative date and time representation.
13360 %EC is replaced by the name of the base year (period) in the locale's alternative
13361 representation.
13362 %Ex is replaced by the locale's alternative date representation.
13363 %EX is replaced by the locale's alternative time representation.
13364 %Ey is replaced by the offset from %EC (year only) in the locale's alternative
13365 representation.
13366 %EY is replaced by the locale's full alternative year representation.
13367 %Od is replaced by the day of the month, using the locale's alternative numeric symbols
13368 (filled as needed with leading zeros, or with leading spaces if there is no alternative
13369 symbol for zero).
13370 %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
13371 (filled as needed with leading spaces).
13372 %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
13373 symbols.
13375 [<a name="p345" href="#p345">page 345</a>] (<a href="#Contents">Contents</a>)
13377 %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
13378 symbols.
13379 %Om is replaced by the month, using the locale's alternative numeric symbols.
13380 %OM is replaced by the minutes, using the locale's alternative numeric symbols.
13381 %OS is replaced by the seconds, using the locale's alternative numeric symbols.
13382 %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
13383 representation, where Monday is 1.
13384 %OU is replaced by the week number, using the locale's alternative numeric symbols.
13385 %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
13386 symbols.
13387 %Ow is replaced by the weekday as a number, using the locale's alternative numeric
13388 symbols.
13389 %OW is replaced by the week number of the year, using the locale's alternative numeric
13390 symbols.
13391 %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
13392 symbols.
13393 5 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
13394 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
13395 which is also the week that includes the first Thursday of the year, and is also the first
13396 week that contains at least four days in the year. If the first Monday of January is the
13397 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
13398 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
13399 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
13400 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
13401 %V is replaced by 01.
13402 6 If a conversion specifier is not one of the above, the behavior is undefined.
13403 7 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
13404 following specifiers are:
13405 %a the first three characters of %A.
13406 %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
13407 %b the first three characters of %B.
13408 %B one of ''January'', ''February'', ... , ''December''.
13409 %c equivalent to ''%a %b %e %T %Y''.
13410 %p one of ''AM'' or ''PM''.
13411 %r equivalent to ''%I:%M:%S %p''.
13412 %x equivalent to ''%m/%d/%y''.
13413 %X equivalent to %T.
13414 %Z implementation-defined.
13416 [<a name="p346" href="#p346">page 346</a>] (<a href="#Contents">Contents</a>)
13418 <b> Returns</b>
13419 8 If the total number of resulting characters including the terminating null character is not
13420 more than maxsize, the strftime function returns the number of characters placed
13421 into the array pointed to by s not including the terminating null character. Otherwise,
13422 zero is returned and the contents of the array are indeterminate.
13424 [<a name="p347" href="#p347">page 347</a>] (<a href="#Contents">Contents</a>)
13426 <a name="7.24" href="#7.24"><b> 7.24 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
13427 <a name="7.24.1" href="#7.24.1"><b> 7.24.1 Introduction</b></a>
13428 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares four data types, one tag, four macros, and many
13429 functions.<sup><a href="#note277"><b>277)</b></a></sup>
13430 2 The types declared are wchar_t and size_t (both described in <a href="#7.17">7.17</a>);
13431 mbstate_t
13432 which is an object type other than an array type that can hold the conversion state
13433 information necessary to convert between sequences of multibyte characters and wide
13434 characters;
13435 wint_t
13436 which is an integer type unchanged by default argument promotions that can hold any
13437 value corresponding to members of the extended character set, as well as at least one
13438 value that does not correspond to any member of the extended character set (see WEOF
13439 below);<sup><a href="#note278"><b>278)</b></a></sup> and
13440 struct tm
13441 which is declared as an incomplete structure type (the contents are described in <a href="#7.23.1">7.23.1</a>).
13442 3 The macros defined are NULL (described in <a href="#7.17">7.17</a>); WCHAR_MIN and WCHAR_MAX
13443 (described in <a href="#7.18.3">7.18.3</a>); and
13444 WEOF
13445 which expands to a constant expression of type wint_t whose value does not
13446 correspond to any member of the extended character set.<sup><a href="#note279"><b>279)</b></a></sup> It is accepted (and returned)
13447 by several functions in this subclause to indicate end-of-file, that is, no more input from a
13448 stream. It is also used as a wide character value that does not correspond to any member
13449 of the extended character set.
13450 4 The functions declared are grouped as follows:
13451 -- Functions that perform input and output of wide characters, or multibyte characters,
13452 or both;
13453 -- Functions that provide wide string numeric conversion;
13454 -- Functions that perform general wide string manipulation;
13457 <sup><a name="note277" href="#note277"><b>277)</b></a></sup> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
13458 <sup><a name="note278" href="#note278"><b>278)</b></a></sup> wchar_t and wint_t can be the same integer type.
13459 <sup><a name="note279" href="#note279"><b>279)</b></a></sup> The value of the macro WEOF may differ from that of EOF and need not be negative.
13461 [<a name="p348" href="#p348">page 348</a>] (<a href="#Contents">Contents</a>)
13463 -- Functions for wide string date and time conversion; and
13464 -- Functions that provide extended capabilities for conversion between multibyte and
13465 wide character sequences.
13466 5 Unless explicitly stated otherwise, if the execution of a function described in this
13467 subclause causes copying to take place between objects that overlap, the behavior is
13468 undefined.
13469 <a name="7.24.2" href="#7.24.2"><b> 7.24.2 Formatted wide character input/output functions</b></a>
13470 1 The formatted wide character input/output functions shall behave as if there is a sequence
13471 point after the actions associated with each specifier.<sup><a href="#note280"><b>280)</b></a></sup>
13472 <a name="7.24.2.1" href="#7.24.2.1"><b> 7.24.2.1 The fwprintf function</b></a>
13473 <b> Synopsis</b>
13474 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13475 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13476 int fwprintf(FILE * restrict stream,
13477 const wchar_t * restrict format, ...);
13478 <b> Description</b>
13479 2 The fwprintf function writes output to the stream pointed to by stream, under
13480 control of the wide string pointed to by format that specifies how subsequent arguments
13481 are converted for output. If there are insufficient arguments for the format, the behavior
13482 is undefined. If the format is exhausted while arguments remain, the excess arguments
13483 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
13484 when the end of the format string is encountered.
13485 3 The format is composed of zero or more directives: ordinary wide characters (not %),
13486 which are copied unchanged to the output stream; and conversion specifications, each of
13487 which results in fetching zero or more subsequent arguments, converting them, if
13488 applicable, according to the corresponding conversion specifier, and then writing the
13489 result to the output stream.
13490 4 Each conversion specification is introduced by the wide character %. After the %, the
13491 following appear in sequence:
13492 -- Zero or more flags (in any order) that modify the meaning of the conversion
13493 specification.
13494 -- An optional minimum field width. If the converted value has fewer wide characters
13495 than the field width, it is padded with spaces (by default) on the left (or right, if the
13498 <sup><a name="note280" href="#note280"><b>280)</b></a></sup> The fwprintf functions perform writes to memory for the %n specifier.
13500 [<a name="p349" href="#p349">page 349</a>] (<a href="#Contents">Contents</a>)
13502 left adjustment flag, described later, has been given) to the field width. The field
13503 width takes the form of an asterisk * (described later) or a nonnegative decimal
13504 integer.<sup><a href="#note281"><b>281)</b></a></sup>
13505 -- An optional precision that gives the minimum number of digits to appear for the d, i,
13506 o, u, x, and X conversions, the number of digits to appear after the decimal-point
13507 wide character for a, A, e, E, f, and F conversions, the maximum number of
13508 significant digits for the g and G conversions, or the maximum number of wide
13509 characters to be written for s conversions. The precision takes the form of a period
13510 (.) followed either by an asterisk * (described later) or by an optional decimal
13511 integer; if only the period is specified, the precision is taken as zero. If a precision
13512 appears with any other conversion specifier, the behavior is undefined.
13513 -- An optional length modifier that specifies the size of the argument.
13514 -- A conversion specifier wide character that specifies the type of conversion to be
13515 applied.
13516 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
13517 this case, an int argument supplies the field width or precision. The arguments
13518 specifying field width, or precision, or both, shall appear (in that order) before the
13519 argument (if any) to be converted. A negative field width argument is taken as a - flag
13520 followed by a positive field width. A negative precision argument is taken as if the
13521 precision were omitted.
13522 6 The flag wide characters and their meanings are:
13523 - The result of the conversion is left-justified within the field. (It is right-justified if
13524 this flag is not specified.)
13525 + The result of a signed conversion always begins with a plus or minus sign. (It
13526 begins with a sign only when a negative value is converted if this flag is not
13527 specified.)<sup><a href="#note282"><b>282)</b></a></sup>
13528 space If the first wide character of a signed conversion is not a sign, or if a signed
13529 conversion results in no wide characters, a space is prefixed to the result. If the
13530 space and + flags both appear, the space flag is ignored.
13531 # The result is converted to an ''alternative form''. For o conversion, it increases
13532 the precision, if and only if necessary, to force the first digit of the result to be a
13533 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
13534 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
13536 <sup><a name="note281" href="#note281"><b>281)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
13537 <sup><a name="note282" href="#note282"><b>282)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
13538 include a minus sign.
13540 [<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
13542 and G conversions, the result of converting a floating-point number always
13543 contains a decimal-point wide character, even if no digits follow it. (Normally, a
13544 decimal-point wide character appears in the result of these conversions only if a
13545 digit follows it.) For g and G conversions, trailing zeros are not removed from the
13546 result. For other conversions, the behavior is undefined.
13547 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
13548 (following any indication of sign or base) are used to pad to the field width rather
13549 than performing space padding, except when converting an infinity or NaN. If the
13550 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
13551 conversions, if a precision is specified, the 0 flag is ignored. For other
13552 conversions, the behavior is undefined.
13553 7 The length modifiers and their meanings are:
13554 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13555 signed char or unsigned char argument (the argument will have
13556 been promoted according to the integer promotions, but its value shall be
13557 converted to signed char or unsigned char before printing); or that
13558 a following n conversion specifier applies to a pointer to a signed char
13559 argument.
13560 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13561 short int or unsigned short int argument (the argument will
13562 have been promoted according to the integer promotions, but its value shall
13563 be converted to short int or unsigned short int before printing);
13564 or that a following n conversion specifier applies to a pointer to a short
13565 int argument.
13566 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13567 long int or unsigned long int argument; that a following n
13568 conversion specifier applies to a pointer to a long int argument; that a
13569 following c conversion specifier applies to a wint_t argument; that a
13570 following s conversion specifier applies to a pointer to a wchar_t
13571 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
13572 specifier.
13573 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13574 long long int or unsigned long long int argument; or that a
13575 following n conversion specifier applies to a pointer to a long long int
13576 argument.
13577 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
13578 an intmax_t or uintmax_t argument; or that a following n conversion
13579 specifier applies to a pointer to an intmax_t argument.
13581 [<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
13583 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13584 size_t or the corresponding signed integer type argument; or that a
13585 following n conversion specifier applies to a pointer to a signed integer type
13586 corresponding to size_t argument.
13587 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
13588 ptrdiff_t or the corresponding unsigned integer type argument; or that a
13589 following n conversion specifier applies to a pointer to a ptrdiff_t
13590 argument.
13591 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13592 applies to a long double argument.
13593 If a length modifier appears with any conversion specifier other than as specified above,
13594 the behavior is undefined.
13595 8 The conversion specifiers and their meanings are:
13596 d,i The int argument is converted to signed decimal in the style [-]dddd. The
13597 precision specifies the minimum number of digits to appear; if the value
13598 being converted can be represented in fewer digits, it is expanded with
13599 leading zeros. The default precision is 1. The result of converting a zero
13600 value with a precision of zero is no wide characters.
13601 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
13602 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
13603 letters abcdef are used for x conversion and the letters ABCDEF for X
13604 conversion. The precision specifies the minimum number of digits to appear;
13605 if the value being converted can be represented in fewer digits, it is expanded
13606 with leading zeros. The default precision is 1. The result of converting a
13607 zero value with a precision of zero is no wide characters.
13608 f,F A double argument representing a floating-point number is converted to
13609 decimal notation in the style [-]ddd.ddd, where the number of digits after
13610 the decimal-point wide character is equal to the precision specification. If the
13611 precision is missing, it is taken as 6; if the precision is zero and the # flag is
13612 not specified, no decimal-point wide character appears. If a decimal-point
13613 wide character appears, at least one digit appears before it. The value is
13614 rounded to the appropriate number of digits.
13615 A double argument representing an infinity is converted in one of the styles
13616 [-]inf or [-]infinity -- which style is implementation-defined. A
13617 double argument representing a NaN is converted in one of the styles
13618 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
13619 any n-wchar-sequence, is implementation-defined. The F conversion
13620 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
13622 [<a name="p352" href="#p352">page 352</a>] (<a href="#Contents">Contents</a>)
13624 nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup>
13625 e,E A double argument representing a floating-point number is converted in the
13626 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
13627 argument is nonzero) before the decimal-point wide character and the number
13628 of digits after it is equal to the precision; if the precision is missing, it is taken
13629 as 6; if the precision is zero and the # flag is not specified, no decimal-point
13630 wide character appears. The value is rounded to the appropriate number of
13631 digits. The E conversion specifier produces a number with E instead of e
13632 introducing the exponent. The exponent always contains at least two digits,
13633 and only as many more digits as necessary to represent the exponent. If the
13634 value is zero, the exponent is zero.
13635 A double argument representing an infinity or NaN is converted in the style
13636 of an f or F conversion specifier.
13637 g,G A double argument representing a floating-point number is converted in
13638 style f or e (or in style F or E in the case of a G conversion specifier),
13639 depending on the value converted and the precision. Let P equal the
13640 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
13641 Then, if a conversion with style E would have an exponent of X :
13642 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
13643 P - (X + 1).
13644 -- otherwise, the conversion is with style e (or E) and precision P - 1.
13645 Finally, unless the # flag is used, any trailing zeros are removed from the
13646 fractional portion of the result and the decimal-point wide character is
13647 removed if there is no fractional portion remaining.
13648 A double argument representing an infinity or NaN is converted in the style
13649 of an f or F conversion specifier.
13650 a,A A double argument representing a floating-point number is converted in the
13651 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
13652 nonzero if the argument is a normalized floating-point number and is
13653 otherwise unspecified) before the decimal-point wide character<sup><a href="#note284"><b>284)</b></a></sup> and the
13654 number of hexadecimal digits after it is equal to the precision; if the precision
13655 is missing and FLT_RADIX is a power of 2, then the precision is sufficient
13658 <sup><a name="note283" href="#note283"><b>283)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
13659 meaning; the # and 0 flag wide characters have no effect.
13660 <sup><a name="note284" href="#note284"><b>284)</b></a></sup> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
13661 character so that subsequent digits align to nibble (4-bit) boundaries.
13663 [<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
13665 for an exact representation of the value; if the precision is missing and
13666 FLT_RADIX is not a power of 2, then the precision is sufficient to
13667 distinguish<sup><a href="#note285"><b>285)</b></a></sup> values of type double, except that trailing zeros may be
13668 omitted; if the precision is zero and the # flag is not specified, no decimal-
13669 point wide character appears. The letters abcdef are used for a conversion
13670 and the letters ABCDEF for A conversion. The A conversion specifier
13671 produces a number with X and P instead of x and p. The exponent always
13672 contains at least one digit, and only as many more digits as necessary to
13673 represent the decimal exponent of 2. If the value is zero, the exponent is
13674 zero.
13675 A double argument representing an infinity or NaN is converted in the style
13676 of an f or F conversion specifier.
13677 c If no l length modifier is present, the int argument is converted to a wide
13678 character as if by calling btowc and the resulting wide character is written.
13679 If an l length modifier is present, the wint_t argument is converted to
13680 wchar_t and written.
13681 s If no l length modifier is present, the argument shall be a pointer to the initial
13682 element of a character array containing a multibyte character sequence
13683 beginning in the initial shift state. Characters from the array are converted as
13684 if by repeated calls to the mbrtowc function, with the conversion state
13685 described by an mbstate_t object initialized to zero before the first
13686 multibyte character is converted, and written up to (but not including) the
13687 terminating null wide character. If the precision is specified, no more than
13688 that many wide characters are written. If the precision is not specified or is
13689 greater than the size of the converted array, the converted array shall contain a
13690 null wide character.
13691 If an l length modifier is present, the argument shall be a pointer to the initial
13692 element of an array of wchar_t type. Wide characters from the array are
13693 written up to (but not including) a terminating null wide character. If the
13694 precision is specified, no more than that many wide characters are written. If
13695 the precision is not specified or is greater than the size of the array, the array
13696 shall contain a null wide character.
13697 p The argument shall be a pointer to void. The value of the pointer is
13698 converted to a sequence of printing wide characters, in an implementation-
13700 <sup><a name="note285" href="#note285"><b>285)</b></a></sup> The precision p is sufficient to distinguish values of the source type if 16 p-1 &gt; b n where b is
13701 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
13702 might suffice depending on the implementation's scheme for determining the digit to the left of the
13703 decimal-point wide character.
13705 [<a name="p354" href="#p354">page 354</a>] (<a href="#Contents">Contents</a>)
13707 defined manner.
13708 n The argument shall be a pointer to signed integer into which is written the
13709 number of wide characters written to the output stream so far by this call to
13710 fwprintf. No argument is converted, but one is consumed. If the
13711 conversion specification includes any flags, a field width, or a precision, the
13712 behavior is undefined.
13713 % A % wide character is written. No argument is converted. The complete
13714 conversion specification shall be %%.
13715 9 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note286"><b>286)</b></a></sup> If any argument is
13716 not the correct type for the corresponding conversion specification, the behavior is
13717 undefined.
13718 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
13719 of a conversion is wider than the field width, the field is expanded to contain the
13720 conversion result.
13721 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
13722 to a hexadecimal floating number with the given precision.
13723 Recommended practice
13724 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
13725 representable in the given precision, the result should be one of the two adjacent numbers
13726 in hexadecimal floating style with the given precision, with the extra stipulation that the
13727 error should have a correct sign for the current rounding direction.
13728 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
13729 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note287"><b>287)</b></a></sup> If the number of
13730 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
13731 representable with DECIMAL_DIG digits, then the result should be an exact
13732 representation with trailing zeros. Otherwise, the source value is bounded by two
13733 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
13734 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
13735 the error should have a correct sign for the current rounding direction.
13736 <b> Returns</b>
13737 14 The fwprintf function returns the number of wide characters transmitted, or a negative
13738 value if an output or encoding error occurred.
13740 <sup><a name="note286" href="#note286"><b>286)</b></a></sup> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
13741 <sup><a name="note287" href="#note287"><b>287)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
13742 given format specifier. The number of significant digits is determined by the format specifier, and in
13743 the case of fixed-point conversion by the source value as well.
13745 [<a name="p355" href="#p355">page 355</a>] (<a href="#Contents">Contents</a>)
13747 Environmental limits
13748 15 The number of wide characters that can be produced by any single conversion shall be at
13749 least 4095.
13750 16 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
13751 places:
13752 #include <a href="#7.12">&lt;math.h&gt;</a>
13753 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13754 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13755 /* ... */
13756 wchar_t *weekday, *month; // pointers to wide strings
13757 int day, hour, min;
13758 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
13759 weekday, month, day, hour, min);
13760 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
13762 Forward references: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
13763 (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
13764 <a name="7.24.2.2" href="#7.24.2.2"><b> 7.24.2.2 The fwscanf function</b></a>
13765 <b> Synopsis</b>
13766 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13767 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13768 int fwscanf(FILE * restrict stream,
13769 const wchar_t * restrict format, ...);
13770 <b> Description</b>
13771 2 The fwscanf function reads input from the stream pointed to by stream, under
13772 control of the wide string pointed to by format that specifies the admissible input
13773 sequences and how they are to be converted for assignment, using subsequent arguments
13774 as pointers to the objects to receive the converted input. If there are insufficient
13775 arguments for the format, the behavior is undefined. If the format is exhausted while
13776 arguments remain, the excess arguments are evaluated (as always) but are otherwise
13777 ignored.
13778 3 The format is composed of zero or more directives: one or more white-space wide
13779 characters, an ordinary wide character (neither % nor a white-space wide character), or a
13780 conversion specification. Each conversion specification is introduced by the wide
13781 character %. After the %, the following appear in sequence:
13782 -- An optional assignment-suppressing wide character *.
13783 -- An optional decimal integer greater than zero that specifies the maximum field width
13784 (in wide characters).
13786 [<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
13788 -- An optional length modifier that specifies the size of the receiving object.
13789 -- A conversion specifier wide character that specifies the type of conversion to be
13790 applied.
13791 4 The fwscanf function executes each directive of the format in turn. If a directive fails,
13792 as detailed below, the function returns. Failures are described as input failures (due to the
13793 occurrence of an encoding error or the unavailability of input characters), or matching
13794 failures (due to inappropriate input).
13795 5 A directive composed of white-space wide character(s) is executed by reading input up to
13796 the first non-white-space wide character (which remains unread), or until no more wide
13797 characters can be read.
13798 6 A directive that is an ordinary wide character is executed by reading the next wide
13799 character of the stream. If that wide character differs from the directive, the directive
13800 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
13801 of-file, an encoding error, or a read error prevents a wide character from being read, the
13802 directive fails.
13803 7 A directive that is a conversion specification defines a set of matching input sequences, as
13804 described below for each specifier. A conversion specification is executed in the
13805 following steps:
13806 8 Input white-space wide characters (as specified by the iswspace function) are skipped,
13807 unless the specification includes a [, c, or n specifier.<sup><a href="#note288"><b>288)</b></a></sup>
13808 9 An input item is read from the stream, unless the specification includes an n specifier. An
13809 input item is defined as the longest sequence of input wide characters which does not
13810 exceed any specified field width and which is, or is a prefix of, a matching input
13811 sequence.<sup><a href="#note289"><b>289)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
13812 length of the input item is zero, the execution of the directive fails; this condition is a
13813 matching failure unless end-of-file, an encoding error, or a read error prevented input
13814 from the stream, in which case it is an input failure.
13815 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
13816 count of input wide characters) is converted to a type appropriate to the conversion
13817 specifier. If the input item is not a matching sequence, the execution of the directive fails:
13818 this condition is a matching failure. Unless assignment suppression was indicated by a *,
13819 the result of the conversion is placed in the object pointed to by the first argument
13820 following the format argument that has not already received a conversion result. If this
13823 <sup><a name="note288" href="#note288"><b>288)</b></a></sup> These white-space wide characters are not counted against a specified field width.
13824 <sup><a name="note289" href="#note289"><b>289)</b></a></sup> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
13825 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
13827 [<a name="p357" href="#p357">page 357</a>] (<a href="#Contents">Contents</a>)
13829 object does not have an appropriate type, or if the result of the conversion cannot be
13830 represented in the object, the behavior is undefined.
13831 11 The length modifiers and their meanings are:
13832 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13833 to an argument with type pointer to signed char or unsigned char.
13834 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13835 to an argument with type pointer to short int or unsigned short
13836 int.
13837 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13838 to an argument with type pointer to long int or unsigned long
13839 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
13840 an argument with type pointer to double; or that a following c, s, or [
13841 conversion specifier applies to an argument with type pointer to wchar_t.
13842 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13843 to an argument with type pointer to long long int or unsigned
13844 long long int.
13845 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13846 to an argument with type pointer to intmax_t or uintmax_t.
13847 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13848 to an argument with type pointer to size_t or the corresponding signed
13849 integer type.
13850 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
13851 to an argument with type pointer to ptrdiff_t or the corresponding
13852 unsigned integer type.
13853 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
13854 applies to an argument with type pointer to long double.
13855 If a length modifier appears with any conversion specifier other than as specified above,
13856 the behavior is undefined.
13857 12 The conversion specifiers and their meanings are:
13858 d Matches an optionally signed decimal integer, whose format is the same as
13859 expected for the subject sequence of the wcstol function with the value 10
13860 for the base argument. The corresponding argument shall be a pointer to
13861 signed integer.
13862 i Matches an optionally signed integer, whose format is the same as expected
13863 for the subject sequence of the wcstol function with the value 0 for the
13864 base argument. The corresponding argument shall be a pointer to signed
13866 [<a name="p358" href="#p358">page 358</a>] (<a href="#Contents">Contents</a>)
13868 integer.
13869 o Matches an optionally signed octal integer, whose format is the same as
13870 expected for the subject sequence of the wcstoul function with the value 8
13871 for the base argument. The corresponding argument shall be a pointer to
13872 unsigned integer.
13873 u Matches an optionally signed decimal integer, whose format is the same as
13874 expected for the subject sequence of the wcstoul function with the value 10
13875 for the base argument. The corresponding argument shall be a pointer to
13876 unsigned integer.
13877 x Matches an optionally signed hexadecimal integer, whose format is the same
13878 as expected for the subject sequence of the wcstoul function with the value
13879 16 for the base argument. The corresponding argument shall be a pointer to
13880 unsigned integer.
13881 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
13882 format is the same as expected for the subject sequence of the wcstod
13883 function. The corresponding argument shall be a pointer to floating.
13884 c Matches a sequence of wide characters of exactly the number specified by the
13885 field width (1 if no field width is present in the directive).
13886 If no l length modifier is present, characters from the input field are
13887 converted as if by repeated calls to the wcrtomb function, with the
13888 conversion state described by an mbstate_t object initialized to zero
13889 before the first wide character is converted. The corresponding argument
13890 shall be a pointer to the initial element of a character array large enough to
13891 accept the sequence. No null character is added.
13892 If an l length modifier is present, the corresponding argument shall be a
13893 pointer to the initial element of an array of wchar_t large enough to accept
13894 the sequence. No null wide character is added.
13895 s Matches a sequence of non-white-space wide characters.
13896 If no l length modifier is present, characters from the input field are
13897 converted as if by repeated calls to the wcrtomb function, with the
13898 conversion state described by an mbstate_t object initialized to zero
13899 before the first wide character is converted. The corresponding argument
13900 shall be a pointer to the initial element of a character array large enough to
13901 accept the sequence and a terminating null character, which will be added
13902 automatically.
13903 If an l length modifier is present, the corresponding argument shall be a
13904 pointer to the initial element of an array of wchar_t large enough to accept
13906 [<a name="p359" href="#p359">page 359</a>] (<a href="#Contents">Contents</a>)
13908 the sequence and the terminating null wide character, which will be added
13909 automatically.
13910 [ Matches a nonempty sequence of wide characters from a set of expected
13911 characters (the scanset).
13912 If no l length modifier is present, characters from the input field are
13913 converted as if by repeated calls to the wcrtomb function, with the
13914 conversion state described by an mbstate_t object initialized to zero
13915 before the first wide character is converted. The corresponding argument
13916 shall be a pointer to the initial element of a character array large enough to
13917 accept the sequence and a terminating null character, which will be added
13918 automatically.
13919 If an l length modifier is present, the corresponding argument shall be a
13920 pointer to the initial element of an array of wchar_t large enough to accept
13921 the sequence and the terminating null wide character, which will be added
13922 automatically.
13923 The conversion specifier includes all subsequent wide characters in the
13924 format string, up to and including the matching right bracket (]). The wide
13925 characters between the brackets (the scanlist) compose the scanset, unless the
13926 wide character after the left bracket is a circumflex (^), in which case the
13927 scanset contains all wide characters that do not appear in the scanlist between
13928 the circumflex and the right bracket. If the conversion specifier begins with
13929 [] or [^], the right bracket wide character is in the scanlist and the next
13930 following right bracket wide character is the matching right bracket that ends
13931 the specification; otherwise the first following right bracket wide character is
13932 the one that ends the specification. If a - wide character is in the scanlist and
13933 is not the first, nor the second where the first wide character is a ^, nor the
13934 last character, the behavior is implementation-defined.
13935 p Matches an implementation-defined set of sequences, which should be the
13936 same as the set of sequences that may be produced by the %p conversion of
13937 the fwprintf function. The corresponding argument shall be a pointer to a
13938 pointer to void. The input item is converted to a pointer value in an
13939 implementation-defined manner. If the input item is a value converted earlier
13940 during the same program execution, the pointer that results shall compare
13941 equal to that value; otherwise the behavior of the %p conversion is undefined.
13942 n No input is consumed. The corresponding argument shall be a pointer to
13943 signed integer into which is to be written the number of wide characters read
13944 from the input stream so far by this call to the fwscanf function. Execution
13945 of a %n directive does not increment the assignment count returned at the
13946 completion of execution of the fwscanf function. No argument is
13948 [<a name="p360" href="#p360">page 360</a>] (<a href="#Contents">Contents</a>)
13950 converted, but one is consumed. If the conversion specification includes an
13951 assignment-suppressing wide character or a field width, the behavior is
13952 undefined.
13953 % Matches a single % wide character; no conversion or assignment occurs. The
13954 complete conversion specification shall be %%.
13955 13 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note290"><b>290)</b></a></sup>
13956 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
13957 respectively, a, e, f, g, and x.
13958 15 Trailing white space (including new-line wide characters) is left unread unless matched
13959 by a directive. The success of literal matches and suppressed assignments is not directly
13960 determinable other than via the %n directive.
13961 <b> Returns</b>
13962 16 The fwscanf function returns the value of the macro EOF if an input failure occurs
13963 before any conversion. Otherwise, the function returns the number of input items
13964 assigned, which can be fewer than provided for, or even zero, in the event of an early
13965 matching failure.
13966 17 EXAMPLE 1 The call:
13967 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13968 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13969 /* ... */
13970 int n, i; float x; wchar_t name[50];
13971 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
13972 with the input line:
13973 25 54.32E-1 thompson
13974 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
13975 thompson\0.
13977 18 EXAMPLE 2 The call:
13978 #include <a href="#7.19">&lt;stdio.h&gt;</a>
13979 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13980 /* ... */
13981 int i; float x; double y;
13982 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
13983 with input:
13984 56789 0123 56a72
13985 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
13986 56.0. The next wide character read from the input stream will be a.
13989 <sup><a name="note290" href="#note290"><b>290)</b></a></sup> See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
13991 [<a name="p361" href="#p361">page 361</a>] (<a href="#Contents">Contents</a>)
13993 Forward references: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
13994 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
13995 function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
13996 <a name="7.24.2.3" href="#7.24.2.3"><b> 7.24.2.3 The swprintf function</b></a>
13997 <b> Synopsis</b>
13998 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
13999 int swprintf(wchar_t * restrict s,
14000 size_t n,
14001 const wchar_t * restrict format, ...);
14002 <b> Description</b>
14003 2 The swprintf function is equivalent to fwprintf, except that the argument s
14004 specifies an array of wide characters into which the generated output is to be written,
14005 rather than written to a stream. No more than n wide characters are written, including a
14006 terminating null wide character, which is always added (unless n is zero).
14007 <b> Returns</b>
14008 3 The swprintf function returns the number of wide characters written in the array, not
14009 counting the terminating null wide character, or a negative value if an encoding error
14010 occurred or if n or more wide characters were requested to be written.
14011 <a name="7.24.2.4" href="#7.24.2.4"><b> 7.24.2.4 The swscanf function</b></a>
14012 <b> Synopsis</b>
14013 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14014 int swscanf(const wchar_t * restrict s,
14015 const wchar_t * restrict format, ...);
14016 <b> Description</b>
14017 2 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
14018 wide string from which the input is to be obtained, rather than from a stream. Reaching
14019 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
14020 function.
14021 <b> Returns</b>
14022 3 The swscanf function returns the value of the macro EOF if an input failure occurs
14023 before any conversion. Otherwise, the swscanf function returns the number of input
14024 items assigned, which can be fewer than provided for, or even zero, in the event of an
14025 early matching failure.
14027 [<a name="p362" href="#p362">page 362</a>] (<a href="#Contents">Contents</a>)
14029 <a name="7.24.2.5" href="#7.24.2.5"><b> 7.24.2.5 The vfwprintf function</b></a>
14030 <b> Synopsis</b>
14031 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14032 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14033 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14034 int vfwprintf(FILE * restrict stream,
14035 const wchar_t * restrict format,
14036 va_list arg);
14037 <b> Description</b>
14038 2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
14039 replaced by arg, which shall have been initialized by the va_start macro (and
14040 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
14041 va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
14042 <b> Returns</b>
14043 3 The vfwprintf function returns the number of wide characters transmitted, or a
14044 negative value if an output or encoding error occurred.
14045 4 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
14046 routine.
14047 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14048 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14049 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14050 void error(char *function_name, wchar_t *format, ...)
14052 va_list args;
14053 va_start(args, format);
14054 // print out name of function causing error
14055 fwprintf(stderr, L"ERROR in %s: ", function_name);
14056 // print out remainder of message
14057 vfwprintf(stderr, format, args);
14058 va_end(args);
14064 <sup><a name="note291" href="#note291"><b>291)</b></a></sup> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
14065 invoke the va_arg macro, the value of arg after the return is indeterminate.
14067 [<a name="p363" href="#p363">page 363</a>] (<a href="#Contents">Contents</a>)
14069 <a name="7.24.2.6" href="#7.24.2.6"><b> 7.24.2.6 The vfwscanf function</b></a>
14070 <b> Synopsis</b>
14071 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14072 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14073 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14074 int vfwscanf(FILE * restrict stream,
14075 const wchar_t * restrict format,
14076 va_list arg);
14077 <b> Description</b>
14078 2 The vfwscanf function is equivalent to fwscanf, with the variable argument list
14079 replaced by arg, which shall have been initialized by the va_start macro (and
14080 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
14081 va_end macro.291)
14082 <b> Returns</b>
14083 3 The vfwscanf function returns the value of the macro EOF if an input failure occurs
14084 before any conversion. Otherwise, the vfwscanf function returns the number of input
14085 items assigned, which can be fewer than provided for, or even zero, in the event of an
14086 early matching failure.
14087 <a name="7.24.2.7" href="#7.24.2.7"><b> 7.24.2.7 The vswprintf function</b></a>
14088 <b> Synopsis</b>
14089 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14090 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14091 int vswprintf(wchar_t * restrict s,
14092 size_t n,
14093 const wchar_t * restrict format,
14094 va_list arg);
14095 <b> Description</b>
14096 2 The vswprintf function is equivalent to swprintf, with the variable argument list
14097 replaced by arg, which shall have been initialized by the va_start macro (and
14098 possibly subsequent va_arg calls). The vswprintf function does not invoke the
14099 va_end macro.291)
14100 <b> Returns</b>
14101 3 The vswprintf function returns the number of wide characters written in the array, not
14102 counting the terminating null wide character, or a negative value if an encoding error
14103 occurred or if n or more wide characters were requested to be generated.
14105 [<a name="p364" href="#p364">page 364</a>] (<a href="#Contents">Contents</a>)
14107 <a name="7.24.2.8" href="#7.24.2.8"><b> 7.24.2.8 The vswscanf function</b></a>
14108 <b> Synopsis</b>
14109 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14110 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14111 int vswscanf(const wchar_t * restrict s,
14112 const wchar_t * restrict format,
14113 va_list arg);
14114 <b> Description</b>
14115 2 The vswscanf function is equivalent to swscanf, with the variable argument list
14116 replaced by arg, which shall have been initialized by the va_start macro (and
14117 possibly subsequent va_arg calls). The vswscanf function does not invoke the
14118 va_end macro.291)
14119 <b> Returns</b>
14120 3 The vswscanf function returns the value of the macro EOF if an input failure occurs
14121 before any conversion. Otherwise, the vswscanf function returns the number of input
14122 items assigned, which can be fewer than provided for, or even zero, in the event of an
14123 early matching failure.
14124 <a name="7.24.2.9" href="#7.24.2.9"><b> 7.24.2.9 The vwprintf function</b></a>
14125 <b> Synopsis</b>
14126 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14127 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14128 int vwprintf(const wchar_t * restrict format,
14129 va_list arg);
14130 <b> Description</b>
14131 2 The vwprintf function is equivalent to wprintf, with the variable argument list
14132 replaced by arg, which shall have been initialized by the va_start macro (and
14133 possibly subsequent va_arg calls). The vwprintf function does not invoke the
14134 va_end macro.291)
14135 <b> Returns</b>
14136 3 The vwprintf function returns the number of wide characters transmitted, or a negative
14137 value if an output or encoding error occurred.
14139 [<a name="p365" href="#p365">page 365</a>] (<a href="#Contents">Contents</a>)
14141 <a name="7.24.2.10" href="#7.24.2.10"><b> 7.24.2.10 The vwscanf function</b></a>
14142 <b> Synopsis</b>
14143 1 #include <a href="#7.15">&lt;stdarg.h&gt;</a>
14144 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14145 int vwscanf(const wchar_t * restrict format,
14146 va_list arg);
14147 <b> Description</b>
14148 2 The vwscanf function is equivalent to wscanf, with the variable argument list
14149 replaced by arg, which shall have been initialized by the va_start macro (and
14150 possibly subsequent va_arg calls). The vwscanf function does not invoke the
14151 va_end macro.291)
14152 <b> Returns</b>
14153 3 The vwscanf function returns the value of the macro EOF if an input failure occurs
14154 before any conversion. Otherwise, the vwscanf function returns the number of input
14155 items assigned, which can be fewer than provided for, or even zero, in the event of an
14156 early matching failure.
14157 <a name="7.24.2.11" href="#7.24.2.11"><b> 7.24.2.11 The wprintf function</b></a>
14158 <b> Synopsis</b>
14159 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14160 int wprintf(const wchar_t * restrict format, ...);
14161 <b> Description</b>
14162 2 The wprintf function is equivalent to fwprintf with the argument stdout
14163 interposed before the arguments to wprintf.
14164 <b> Returns</b>
14165 3 The wprintf function returns the number of wide characters transmitted, or a negative
14166 value if an output or encoding error occurred.
14167 <a name="7.24.2.12" href="#7.24.2.12"><b> 7.24.2.12 The wscanf function</b></a>
14168 <b> Synopsis</b>
14169 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14170 int wscanf(const wchar_t * restrict format, ...);
14171 <b> Description</b>
14172 2 The wscanf function is equivalent to fwscanf with the argument stdin interposed
14173 before the arguments to wscanf.
14175 [<a name="p366" href="#p366">page 366</a>] (<a href="#Contents">Contents</a>)
14177 <b> Returns</b>
14178 3 The wscanf function returns the value of the macro EOF if an input failure occurs
14179 before any conversion. Otherwise, the wscanf function returns the number of input
14180 items assigned, which can be fewer than provided for, or even zero, in the event of an
14181 early matching failure.
14182 <a name="7.24.3" href="#7.24.3"><b> 7.24.3 Wide character input/output functions</b></a>
14183 <a name="7.24.3.1" href="#7.24.3.1"><b> 7.24.3.1 The fgetwc function</b></a>
14184 <b> Synopsis</b>
14185 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14186 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14187 wint_t fgetwc(FILE *stream);
14188 <b> Description</b>
14189 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
14190 next wide character is present, the fgetwc function obtains that wide character as a
14191 wchar_t converted to a wint_t and advances the associated file position indicator for
14192 the stream (if defined).
14193 <b> Returns</b>
14194 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
14195 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
14196 the fgetwc function returns the next wide character from the input stream pointed to by
14197 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
14198 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
14199 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note292"><b>292)</b></a></sup>
14200 <a name="7.24.3.2" href="#7.24.3.2"><b> 7.24.3.2 The fgetws function</b></a>
14201 <b> Synopsis</b>
14202 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14203 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14204 wchar_t *fgetws(wchar_t * restrict s,
14205 int n, FILE * restrict stream);
14206 <b> Description</b>
14207 2 The fgetws function reads at most one less than the number of wide characters
14208 specified by n from the stream pointed to by stream into the array pointed to by s. No
14211 <sup><a name="note292" href="#note292"><b>292)</b></a></sup> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
14212 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
14214 [<a name="p367" href="#p367">page 367</a>] (<a href="#Contents">Contents</a>)
14216 additional wide characters are read after a new-line wide character (which is retained) or
14217 after end-of-file. A null wide character is written immediately after the last wide
14218 character read into the array.
14219 <b> Returns</b>
14220 3 The fgetws function returns s if successful. If end-of-file is encountered and no
14221 characters have been read into the array, the contents of the array remain unchanged and a
14222 null pointer is returned. If a read or encoding error occurs during the operation, the array
14223 contents are indeterminate and a null pointer is returned.
14224 <a name="7.24.3.3" href="#7.24.3.3"><b> 7.24.3.3 The fputwc function</b></a>
14225 <b> Synopsis</b>
14226 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14227 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14228 wint_t fputwc(wchar_t c, FILE *stream);
14229 <b> Description</b>
14230 2 The fputwc function writes the wide character specified by c to the output stream
14231 pointed to by stream, at the position indicated by the associated file position indicator
14232 for the stream (if defined), and advances the indicator appropriately. If the file cannot
14233 support positioning requests, or if the stream was opened with append mode, the
14234 character is appended to the output stream.
14235 <b> Returns</b>
14236 3 The fputwc function returns the wide character written. If a write error occurs, the
14237 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
14238 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
14239 <a name="7.24.3.4" href="#7.24.3.4"><b> 7.24.3.4 The fputws function</b></a>
14240 <b> Synopsis</b>
14241 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14242 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14243 int fputws(const wchar_t * restrict s,
14244 FILE * restrict stream);
14245 <b> Description</b>
14246 2 The fputws function writes the wide string pointed to by s to the stream pointed to by
14247 stream. The terminating null wide character is not written.
14248 <b> Returns</b>
14249 3 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
14250 returns a nonnegative value.
14252 [<a name="p368" href="#p368">page 368</a>] (<a href="#Contents">Contents</a>)
14254 <a name="7.24.3.5" href="#7.24.3.5"><b> 7.24.3.5 The fwide function</b></a>
14255 <b> Synopsis</b>
14256 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14257 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14258 int fwide(FILE *stream, int mode);
14259 <b> Description</b>
14260 2 The fwide function determines the orientation of the stream pointed to by stream. If
14261 mode is greater than zero, the function first attempts to make the stream wide oriented. If
14262 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note293"><b>293)</b></a></sup>
14263 Otherwise, mode is zero and the function does not alter the orientation of the stream.
14264 <b> Returns</b>
14265 3 The fwide function returns a value greater than zero if, after the call, the stream has
14266 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
14267 stream has no orientation.
14268 <a name="7.24.3.6" href="#7.24.3.6"><b> 7.24.3.6 The getwc function</b></a>
14269 <b> Synopsis</b>
14270 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14271 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14272 wint_t getwc(FILE *stream);
14273 <b> Description</b>
14274 2 The getwc function is equivalent to fgetwc, except that if it is implemented as a
14275 macro, it may evaluate stream more than once, so the argument should never be an
14276 expression with side effects.
14277 <b> Returns</b>
14278 3 The getwc function returns the next wide character from the input stream pointed to by
14279 stream, or WEOF.
14280 <a name="7.24.3.7" href="#7.24.3.7"><b> 7.24.3.7 The getwchar function</b></a>
14281 <b> Synopsis</b>
14282 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14283 wint_t getwchar(void);
14288 <sup><a name="note293" href="#note293"><b>293)</b></a></sup> If the orientation of the stream has already been determined, fwide does not change it.
14290 [<a name="p369" href="#p369">page 369</a>] (<a href="#Contents">Contents</a>)
14292 <b> Description</b>
14293 2 The getwchar function is equivalent to getwc with the argument stdin.
14294 <b> Returns</b>
14295 3 The getwchar function returns the next wide character from the input stream pointed to
14296 by stdin, or WEOF.
14297 <a name="7.24.3.8" href="#7.24.3.8"><b> 7.24.3.8 The putwc function</b></a>
14298 <b> Synopsis</b>
14299 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14300 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14301 wint_t putwc(wchar_t c, FILE *stream);
14302 <b> Description</b>
14303 2 The putwc function is equivalent to fputwc, except that if it is implemented as a
14304 macro, it may evaluate stream more than once, so that argument should never be an
14305 expression with side effects.
14306 <b> Returns</b>
14307 3 The putwc function returns the wide character written, or WEOF.
14308 <a name="7.24.3.9" href="#7.24.3.9"><b> 7.24.3.9 The putwchar function</b></a>
14309 <b> Synopsis</b>
14310 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14311 wint_t putwchar(wchar_t c);
14312 <b> Description</b>
14313 2 The putwchar function is equivalent to putwc with the second argument stdout.
14314 <b> Returns</b>
14315 3 The putwchar function returns the character written, or WEOF.
14316 <a name="7.24.3.10" href="#7.24.3.10"><b> 7.24.3.10 The ungetwc function</b></a>
14317 <b> Synopsis</b>
14318 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14319 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14320 wint_t ungetwc(wint_t c, FILE *stream);
14321 <b> Description</b>
14322 2 The ungetwc function pushes the wide character specified by c back onto the input
14323 stream pointed to by stream. Pushed-back wide characters will be returned by
14324 subsequent reads on that stream in the reverse order of their pushing. A successful
14326 [<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
14328 intervening call (with the stream pointed to by stream) to a file positioning function
14329 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
14330 stream. The external storage corresponding to the stream is unchanged.
14331 3 One wide character of pushback is guaranteed, even if the call to the ungetwc function
14332 follows just after a call to a formatted wide character input function fwscanf,
14333 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
14334 on the same stream without an intervening read or file positioning operation on that
14335 stream, the operation may fail.
14336 4 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
14337 unchanged.
14338 5 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
14339 The value of the file position indicator for the stream after reading or discarding all
14340 pushed-back wide characters is the same as it was before the wide characters were pushed
14341 back. For a text or binary stream, the value of its file position indicator after a successful
14342 call to the ungetwc function is unspecified until all pushed-back wide characters are
14343 read or discarded.
14344 <b> Returns</b>
14345 6 The ungetwc function returns the wide character pushed back, or WEOF if the operation
14346 fails.
14347 <a name="7.24.4" href="#7.24.4"><b> 7.24.4 General wide string utilities</b></a>
14348 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
14349 manipulation. Various methods are used for determining the lengths of the arrays, but in
14350 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
14351 array. If an array is accessed beyond the end of an object, the behavior is undefined.
14352 2 Where an argument declared as size_t n determines the length of the array for a
14353 function, n can have the value zero on a call to that function. Unless explicitly stated
14354 otherwise in the description of a particular function in this subclause, pointer arguments
14355 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
14356 function that locates a wide character finds no occurrence, a function that compares two
14357 wide character sequences returns zero, and a function that copies wide characters copies
14358 zero wide characters.
14360 [<a name="p371" href="#p371">page 371</a>] (<a href="#Contents">Contents</a>)
14362 <a name="7.24.4.1" href="#7.24.4.1"><b> 7.24.4.1 Wide string numeric conversion functions</b></a>
14363 <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>
14364 <b> Synopsis</b>
14365 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14366 double wcstod(const wchar_t * restrict nptr,
14367 wchar_t ** restrict endptr);
14368 float wcstof(const wchar_t * restrict nptr,
14369 wchar_t ** restrict endptr);
14370 long double wcstold(const wchar_t * restrict nptr,
14371 wchar_t ** restrict endptr);
14372 <b> Description</b>
14373 2 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
14374 string pointed to by nptr to double, float, and long double representation,
14375 respectively. First, they decompose the input string into three parts: an initial, possibly
14376 empty, sequence of white-space wide characters (as specified by the iswspace
14377 function), a subject sequence resembling a floating-point constant or representing an
14378 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
14379 including the terminating null wide character of the input wide string. Then, they attempt
14380 to convert the subject sequence to a floating-point number, and return the result.
14381 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
14382 the following:
14383 -- a nonempty sequence of decimal digits optionally containing a decimal-point wide
14384 character, then an optional exponent part as defined for the corresponding single-byte
14385 characters in <a href="#6.4.4.2">6.4.4.2</a>;
14386 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
14387 decimal-point wide character, then an optional binary exponent part as defined in
14388 <a href="#6.4.4.2">6.4.4.2</a>;
14389 -- INF or INFINITY, or any other wide string equivalent except for case
14390 -- NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
14391 case in the NAN part, where:
14392 n-wchar-sequence:
14393 digit
14394 nondigit
14395 n-wchar-sequence digit
14396 n-wchar-sequence nondigit
14397 The subject sequence is defined as the longest initial subsequence of the input wide
14398 string, starting with the first non-white-space wide character, that is of the expected form.
14400 [<a name="p372" href="#p372">page 372</a>] (<a href="#Contents">Contents</a>)
14402 The subject sequence contains no wide characters if the input wide string is not of the
14403 expected form.
14404 4 If the subject sequence has the expected form for a floating-point number, the sequence of
14405 wide characters starting with the first digit or the decimal-point wide character
14406 (whichever occurs first) is interpreted as a floating constant according to the rules of
14407 <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
14408 if neither an exponent part nor a decimal-point wide character appears in a decimal
14409 floating point number, or if a binary exponent part does not appear in a hexadecimal
14410 floating point number, an exponent part of the appropriate type with value zero is
14411 assumed to follow the last digit in the string. If the subject sequence begins with a minus
14412 sign, the sequence is interpreted as negated.<sup><a href="#note294"><b>294)</b></a></sup> A wide character sequence INF or
14413 INFINITY is interpreted as an infinity, if representable in the return type, else like a
14414 floating constant that is too large for the range of the return type. A wide character
14415 sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
14416 in the return type, else like a subject sequence part that does not have the expected form;
14417 the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note295"><b>295)</b></a></sup> A pointer to the
14418 final wide string is stored in the object pointed to by endptr, provided that endptr is
14419 not a null pointer.
14420 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
14421 value resulting from the conversion is correctly rounded.
14422 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
14423 accepted.
14424 7 If the subject sequence is empty or does not have the expected form, no conversion is
14425 performed; the value of nptr is stored in the object pointed to by endptr, provided
14426 that endptr is not a null pointer.
14427 Recommended practice
14428 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
14429 the result is not exactly representable, the result should be one of the two numbers in the
14430 appropriate internal format that are adjacent to the hexadecimal floating source value,
14431 with the extra stipulation that the error should have a correct sign for the current rounding
14432 direction.
14436 <sup><a name="note294" href="#note294"><b>294)</b></a></sup> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
14437 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
14438 methods may yield different results if rounding is toward positive or negative infinity. In either case,
14439 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
14440 <sup><a name="note295" href="#note295"><b>295)</b></a></sup> An implementation may use the n-wchar sequence to determine extra information to be represented in
14441 the NaN's significand.
14443 [<a name="p373" href="#p373">page 373</a>] (<a href="#Contents">Contents</a>)
14445 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
14446 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
14447 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
14448 consider the two bounding, adjacent decimal strings L and U, both having
14449 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
14450 The result should be one of the (equal or adjacent) values that would be obtained by
14451 correctly rounding L and U according to the current rounding direction, with the extra
14452 stipulation that the error with respect to D should have a correct sign for the current
14453 rounding direction.<sup><a href="#note296"><b>296)</b></a></sup>
14454 <b> Returns</b>
14455 10 The functions return the converted value, if any. If no conversion could be performed,
14456 zero is returned. If the correct value is outside the range of representable values, plus or
14457 minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
14458 type and sign of the value), and the value of the macro ERANGE is stored in errno. If
14459 the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is no greater
14460 than the smallest normalized positive number in the return type; whether errno acquires
14461 the value ERANGE is implementation-defined.
14466 <sup><a name="note296" href="#note296"><b>296)</b></a></sup> DECIMAL_DIG, defined in <a href="#7.7">&lt;float.h&gt;</a>, should be sufficiently large that L and U will usually round
14467 to the same internal floating value, but if not will round to adjacent values.
14469 [<a name="p374" href="#p374">page 374</a>] (<a href="#Contents">Contents</a>)
14471 <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>
14472 <b> Synopsis</b>
14473 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14474 long int wcstol(
14475 const wchar_t * restrict nptr,
14476 wchar_t ** restrict endptr,
14477 int base);
14478 long long int wcstoll(
14479 const wchar_t * restrict nptr,
14480 wchar_t ** restrict endptr,
14481 int base);
14482 unsigned long int wcstoul(
14483 const wchar_t * restrict nptr,
14484 wchar_t ** restrict endptr,
14485 int base);
14486 unsigned long long int wcstoull(
14487 const wchar_t * restrict nptr,
14488 wchar_t ** restrict endptr,
14489 int base);
14490 <b> Description</b>
14491 2 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
14492 portion of the wide string pointed to by nptr to long int, long long int,
14493 unsigned long int, and unsigned long long int representation,
14494 respectively. First, they decompose the input string into three parts: an initial, possibly
14495 empty, sequence of white-space wide characters (as specified by the iswspace
14496 function), a subject sequence resembling an integer represented in some radix determined
14497 by the value of base, and a final wide string of one or more unrecognized wide
14498 characters, including the terminating null wide character of the input wide string. Then,
14499 they attempt to convert the subject sequence to an integer, and return the result.
14500 3 If the value of base is zero, the expected form of the subject sequence is that of an
14501 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
14502 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
14503 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
14504 is a sequence of letters and digits representing an integer with the radix specified by
14505 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
14506 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
14507 letters and digits whose ascribed values are less than that of base are permitted. If the
14508 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
14509 of letters and digits, following the sign if present.
14511 [<a name="p375" href="#p375">page 375</a>] (<a href="#Contents">Contents</a>)
14513 4 The subject sequence is defined as the longest initial subsequence of the input wide
14514 string, starting with the first non-white-space wide character, that is of the expected form.
14515 The subject sequence contains no wide characters if the input wide string is empty or
14516 consists entirely of white space, or if the first non-white-space wide character is other
14517 than a sign or a permissible letter or digit.
14518 5 If the subject sequence has the expected form and the value of base is zero, the sequence
14519 of wide characters starting with the first digit is interpreted as an integer constant
14520 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
14521 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
14522 letter its value as given above. If the subject sequence begins with a minus sign, the value
14523 resulting from the conversion is negated (in the return type). A pointer to the final wide
14524 string is stored in the object pointed to by endptr, provided that endptr is not a null
14525 pointer.
14526 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
14527 accepted.
14528 7 If the subject sequence is empty or does not have the expected form, no conversion is
14529 performed; the value of nptr is stored in the object pointed to by endptr, provided
14530 that endptr is not a null pointer.
14531 <b> Returns</b>
14532 8 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
14533 value, if any. If no conversion could be performed, zero is returned. If the correct value
14534 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
14535 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
14536 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
14537 <a name="7.24.4.2" href="#7.24.4.2"><b> 7.24.4.2 Wide string copying functions</b></a>
14538 <a name="7.24.4.2.1" href="#7.24.4.2.1"><b> 7.24.4.2.1 The wcscpy function</b></a>
14539 <b> Synopsis</b>
14540 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14541 wchar_t *wcscpy(wchar_t * restrict s1,
14542 const wchar_t * restrict s2);
14543 <b> Description</b>
14544 2 The wcscpy function copies the wide string pointed to by s2 (including the terminating
14545 null wide character) into the array pointed to by s1.
14546 <b> Returns</b>
14547 3 The wcscpy function returns the value of s1.
14549 [<a name="p376" href="#p376">page 376</a>] (<a href="#Contents">Contents</a>)
14551 <a name="7.24.4.2.2" href="#7.24.4.2.2"><b> 7.24.4.2.2 The wcsncpy function</b></a>
14552 <b> Synopsis</b>
14553 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14554 wchar_t *wcsncpy(wchar_t * restrict s1,
14555 const wchar_t * restrict s2,
14556 size_t n);
14557 <b> Description</b>
14558 2 The wcsncpy function copies not more than n wide characters (those that follow a null
14559 wide character are not copied) from the array pointed to by s2 to the array pointed to by
14560 s1.<sup><a href="#note297"><b>297)</b></a></sup>
14561 3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
14562 wide characters are appended to the copy in the array pointed to by s1, until n wide
14563 characters in all have been written.
14564 <b> Returns</b>
14565 4 The wcsncpy function returns the value of s1.
14566 <a name="7.24.4.2.3" href="#7.24.4.2.3"><b> 7.24.4.2.3 The wmemcpy function</b></a>
14567 <b> Synopsis</b>
14568 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14569 wchar_t *wmemcpy(wchar_t * restrict s1,
14570 const wchar_t * restrict s2,
14571 size_t n);
14572 <b> Description</b>
14573 2 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
14574 object pointed to by s1.
14575 <b> Returns</b>
14576 3 The wmemcpy function returns the value of s1.
14581 <sup><a name="note297" href="#note297"><b>297)</b></a></sup> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
14582 result will not be null-terminated.
14584 [<a name="p377" href="#p377">page 377</a>] (<a href="#Contents">Contents</a>)
14586 <a name="7.24.4.2.4" href="#7.24.4.2.4"><b> 7.24.4.2.4 The wmemmove function</b></a>
14587 <b> Synopsis</b>
14588 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14589 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
14590 size_t n);
14591 <b> Description</b>
14592 2 The wmemmove function copies n wide characters from the object pointed to by s2 to
14593 the object pointed to by s1. Copying takes place as if the n wide characters from the
14594 object pointed to by s2 are first copied into a temporary array of n wide characters that
14595 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
14596 the temporary array are copied into the object pointed to by s1.
14597 <b> Returns</b>
14598 3 The wmemmove function returns the value of s1.
14599 <a name="7.24.4.3" href="#7.24.4.3"><b> 7.24.4.3 Wide string concatenation functions</b></a>
14600 <a name="7.24.4.3.1" href="#7.24.4.3.1"><b> 7.24.4.3.1 The wcscat function</b></a>
14601 <b> Synopsis</b>
14602 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14603 wchar_t *wcscat(wchar_t * restrict s1,
14604 const wchar_t * restrict s2);
14605 <b> Description</b>
14606 2 The wcscat function appends a copy of the wide string pointed to by s2 (including the
14607 terminating null wide character) to the end of the wide string pointed to by s1. The initial
14608 wide character of s2 overwrites the null wide character at the end of s1.
14609 <b> Returns</b>
14610 3 The wcscat function returns the value of s1.
14611 <a name="7.24.4.3.2" href="#7.24.4.3.2"><b> 7.24.4.3.2 The wcsncat function</b></a>
14612 <b> Synopsis</b>
14613 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14614 wchar_t *wcsncat(wchar_t * restrict s1,
14615 const wchar_t * restrict s2,
14616 size_t n);
14617 <b> Description</b>
14618 2 The wcsncat function appends not more than n wide characters (a null wide character
14619 and those that follow it are not appended) from the array pointed to by s2 to the end of
14621 [<a name="p378" href="#p378">page 378</a>] (<a href="#Contents">Contents</a>)
14623 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
14624 wide character at the end of s1. A terminating null wide character is always appended to
14625 the result.<sup><a href="#note298"><b>298)</b></a></sup>
14626 <b> Returns</b>
14627 3 The wcsncat function returns the value of s1.
14628 <a name="7.24.4.4" href="#7.24.4.4"><b> 7.24.4.4 Wide string comparison functions</b></a>
14629 1 Unless explicitly stated otherwise, the functions described in this subclause order two
14630 wide characters the same way as two integers of the underlying integer type designated
14631 by wchar_t.
14632 <a name="7.24.4.4.1" href="#7.24.4.4.1"><b> 7.24.4.4.1 The wcscmp function</b></a>
14633 <b> Synopsis</b>
14634 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14635 int wcscmp(const wchar_t *s1, const wchar_t *s2);
14636 <b> Description</b>
14637 2 The wcscmp function compares the wide string pointed to by s1 to the wide string
14638 pointed to by s2.
14639 <b> Returns</b>
14640 3 The wcscmp function returns an integer greater than, equal to, or less than zero,
14641 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
14642 wide string pointed to by s2.
14643 <a name="7.24.4.4.2" href="#7.24.4.4.2"><b> 7.24.4.4.2 The wcscoll function</b></a>
14644 <b> Synopsis</b>
14645 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14646 int wcscoll(const wchar_t *s1, const wchar_t *s2);
14647 <b> Description</b>
14648 2 The wcscoll function compares the wide string pointed to by s1 to the wide string
14649 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
14650 current locale.
14651 <b> Returns</b>
14652 3 The wcscoll function returns an integer greater than, equal to, or less than zero,
14653 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
14656 <sup><a name="note298" href="#note298"><b>298)</b></a></sup> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
14657 wcslen(s1)+n+1.
14659 [<a name="p379" href="#p379">page 379</a>] (<a href="#Contents">Contents</a>)
14661 wide string pointed to by s2 when both are interpreted as appropriate to the current
14662 locale.
14663 <a name="7.24.4.4.3" href="#7.24.4.4.3"><b> 7.24.4.4.3 The wcsncmp function</b></a>
14664 <b> Synopsis</b>
14665 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14666 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
14667 size_t n);
14668 <b> Description</b>
14669 2 The wcsncmp function compares not more than n wide characters (those that follow a
14670 null wide character are not compared) from the array pointed to by s1 to the array
14671 pointed to by s2.
14672 <b> Returns</b>
14673 3 The wcsncmp function returns an integer greater than, equal to, or less than zero,
14674 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
14675 to, or less than the possibly null-terminated array pointed to by s2.
14676 <a name="7.24.4.4.4" href="#7.24.4.4.4"><b> 7.24.4.4.4 The wcsxfrm function</b></a>
14677 <b> Synopsis</b>
14678 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14679 size_t wcsxfrm(wchar_t * restrict s1,
14680 const wchar_t * restrict s2,
14681 size_t n);
14682 <b> Description</b>
14683 2 The wcsxfrm function transforms the wide string pointed to by s2 and places the
14684 resulting wide string into the array pointed to by s1. The transformation is such that if
14685 the wcscmp function is applied to two transformed wide strings, it returns a value greater
14686 than, equal to, or less than zero, corresponding to the result of the wcscoll function
14687 applied to the same two original wide strings. No more than n wide characters are placed
14688 into the resulting array pointed to by s1, including the terminating null wide character. If
14689 n is zero, s1 is permitted to be a null pointer.
14690 <b> Returns</b>
14691 3 The wcsxfrm function returns the length of the transformed wide string (not including
14692 the terminating null wide character). If the value returned is n or greater, the contents of
14693 the array pointed to by s1 are indeterminate.
14694 4 EXAMPLE The value of the following expression is the length of the array needed to hold the
14695 transformation of the wide string pointed to by s:
14697 [<a name="p380" href="#p380">page 380</a>] (<a href="#Contents">Contents</a>)
14699 1 + wcsxfrm(NULL, s, 0)
14701 <a name="7.24.4.4.5" href="#7.24.4.4.5"><b> 7.24.4.4.5 The wmemcmp function</b></a>
14702 <b> Synopsis</b>
14703 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14704 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
14705 size_t n);
14706 <b> Description</b>
14707 2 The wmemcmp function compares the first n wide characters of the object pointed to by
14708 s1 to the first n wide characters of the object pointed to by s2.
14709 <b> Returns</b>
14710 3 The wmemcmp function returns an integer greater than, equal to, or less than zero,
14711 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
14712 pointed to by s2.
14713 <a name="7.24.4.5" href="#7.24.4.5"><b> 7.24.4.5 Wide string search functions</b></a>
14714 <a name="7.24.4.5.1" href="#7.24.4.5.1"><b> 7.24.4.5.1 The wcschr function</b></a>
14715 <b> Synopsis</b>
14716 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14717 wchar_t *wcschr(const wchar_t *s, wchar_t c);
14718 <b> Description</b>
14719 2 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
14720 The terminating null wide character is considered to be part of the wide string.
14721 <b> Returns</b>
14722 3 The wcschr function returns a pointer to the located wide character, or a null pointer if
14723 the wide character does not occur in the wide string.
14724 <a name="7.24.4.5.2" href="#7.24.4.5.2"><b> 7.24.4.5.2 The wcscspn function</b></a>
14725 <b> Synopsis</b>
14726 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14727 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
14728 <b> Description</b>
14729 2 The wcscspn function computes the length of the maximum initial segment of the wide
14730 string pointed to by s1 which consists entirely of wide characters not from the wide
14731 string pointed to by s2.
14733 [<a name="p381" href="#p381">page 381</a>] (<a href="#Contents">Contents</a>)
14735 <b> Returns</b>
14736 3 The wcscspn function returns the length of the segment.
14737 <a name="7.24.4.5.3" href="#7.24.4.5.3"><b> 7.24.4.5.3 The wcspbrk function</b></a>
14738 <b> Synopsis</b>
14739 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14740 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
14741 <b> Description</b>
14742 2 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
14743 any wide character from the wide string pointed to by s2.
14744 <b> Returns</b>
14745 3 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
14746 no wide character from s2 occurs in s1.
14747 <a name="7.24.4.5.4" href="#7.24.4.5.4"><b> 7.24.4.5.4 The wcsrchr function</b></a>
14748 <b> Synopsis</b>
14749 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14750 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
14751 <b> Description</b>
14752 2 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
14753 s. The terminating null wide character is considered to be part of the wide string.
14754 <b> Returns</b>
14755 3 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
14756 not occur in the wide string.
14757 <a name="7.24.4.5.5" href="#7.24.4.5.5"><b> 7.24.4.5.5 The wcsspn function</b></a>
14758 <b> Synopsis</b>
14759 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14760 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
14761 <b> Description</b>
14762 2 The wcsspn function computes the length of the maximum initial segment of the wide
14763 string pointed to by s1 which consists entirely of wide characters from the wide string
14764 pointed to by s2.
14765 <b> Returns</b>
14766 3 The wcsspn function returns the length of the segment.
14768 [<a name="p382" href="#p382">page 382</a>] (<a href="#Contents">Contents</a>)
14770 <a name="7.24.4.5.6" href="#7.24.4.5.6"><b> 7.24.4.5.6 The wcsstr function</b></a>
14771 <b> Synopsis</b>
14772 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14773 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
14774 <b> Description</b>
14775 2 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
14776 the sequence of wide characters (excluding the terminating null wide character) in the
14777 wide string pointed to by s2.
14778 <b> Returns</b>
14779 3 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
14780 wide string is not found. If s2 points to a wide string with zero length, the function
14781 returns s1.
14782 <a name="7.24.4.5.7" href="#7.24.4.5.7"><b> 7.24.4.5.7 The wcstok function</b></a>
14783 <b> Synopsis</b>
14784 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14785 wchar_t *wcstok(wchar_t * restrict s1,
14786 const wchar_t * restrict s2,
14787 wchar_t ** restrict ptr);
14788 <b> Description</b>
14789 2 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
14790 a sequence of tokens, each of which is delimited by a wide character from the wide string
14791 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
14792 which the wcstok function stores information necessary for it to continue scanning the
14793 same wide string.
14794 3 The first call in a sequence has a non-null first argument and stores an initial value in the
14795 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
14796 the object pointed to by ptr is required to have the value stored by the previous call in
14797 the sequence, which is then updated. The separator wide string pointed to by s2 may be
14798 different from call to call.
14799 4 The first call in the sequence searches the wide string pointed to by s1 for the first wide
14800 character that is not contained in the current separator wide string pointed to by s2. If no
14801 such wide character is found, then there are no tokens in the wide string pointed to by s1
14802 and the wcstok function returns a null pointer. If such a wide character is found, it is
14803 the start of the first token.
14804 5 The wcstok function then searches from there for a wide character that is contained in
14805 the current separator wide string. If no such wide character is found, the current token
14807 [<a name="p383" href="#p383">page 383</a>] (<a href="#Contents">Contents</a>)
14809 extends to the end of the wide string pointed to by s1, and subsequent searches in the
14810 same wide string for a token return a null pointer. If such a wide character is found, it is
14811 overwritten by a null wide character, which terminates the current token.
14812 6 In all cases, the wcstok function stores sufficient information in the pointer pointed to
14813 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
14814 value for ptr, shall start searching just past the element overwritten by a null wide
14815 character (if any).
14816 <b> Returns</b>
14817 7 The wcstok function returns a pointer to the first wide character of a token, or a null
14818 pointer if there is no token.
14819 8 EXAMPLE
14820 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14821 static wchar_t str1[] = L"?a???b,,,#c";
14822 static wchar_t str2[] = L"\t \t";
14823 wchar_t *t, *ptr1, *ptr2;
14824 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
14825 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
14826 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
14827 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
14828 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer
14830 <a name="7.24.4.5.8" href="#7.24.4.5.8"><b> 7.24.4.5.8 The wmemchr function</b></a>
14831 <b> Synopsis</b>
14832 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14833 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
14834 size_t n);
14835 <b> Description</b>
14836 2 The wmemchr function locates the first occurrence of c in the initial n wide characters of
14837 the object pointed to by s.
14838 <b> Returns</b>
14839 3 The wmemchr function returns a pointer to the located wide character, or a null pointer if
14840 the wide character does not occur in the object.
14842 [<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
14844 <a name="7.24.4.6" href="#7.24.4.6"><b> 7.24.4.6 Miscellaneous functions</b></a>
14845 <a name="7.24.4.6.1" href="#7.24.4.6.1"><b> 7.24.4.6.1 The wcslen function</b></a>
14846 <b> Synopsis</b>
14847 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14848 size_t wcslen(const wchar_t *s);
14849 <b> Description</b>
14850 2 The wcslen function computes the length of the wide string pointed to by s.
14851 <b> Returns</b>
14852 3 The wcslen function returns the number of wide characters that precede the terminating
14853 null wide character.
14854 <a name="7.24.4.6.2" href="#7.24.4.6.2"><b> 7.24.4.6.2 The wmemset function</b></a>
14855 <b> Synopsis</b>
14856 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14857 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
14858 <b> Description</b>
14859 2 The wmemset function copies the value of c into each of the first n wide characters of
14860 the object pointed to by s.
14861 <b> Returns</b>
14862 3 The wmemset function returns the value of s.
14863 <a name="7.24.5" href="#7.24.5"><b> 7.24.5 Wide character time conversion functions</b></a>
14864 <a name="7.24.5.1" href="#7.24.5.1"><b> 7.24.5.1 The wcsftime function</b></a>
14865 <b> Synopsis</b>
14866 1 #include <a href="#7.23">&lt;time.h&gt;</a>
14867 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14868 size_t wcsftime(wchar_t * restrict s,
14869 size_t maxsize,
14870 const wchar_t * restrict format,
14871 const struct tm * restrict timeptr);
14872 <b> Description</b>
14873 2 The wcsftime function is equivalent to the strftime function, except that:
14874 -- The argument s points to the initial element of an array of wide characters into which
14875 the generated output is to be placed.
14877 [<a name="p385" href="#p385">page 385</a>] (<a href="#Contents">Contents</a>)
14879 -- The argument maxsize indicates the limiting number of wide characters.
14880 -- The argument format is a wide string and the conversion specifiers are replaced by
14881 corresponding sequences of wide characters.
14882 -- The return value indicates the number of wide characters.
14883 <b> Returns</b>
14884 3 If the total number of resulting wide characters including the terminating null wide
14885 character is not more than maxsize, the wcsftime function returns the number of
14886 wide characters placed into the array pointed to by s not including the terminating null
14887 wide character. Otherwise, zero is returned and the contents of the array are
14888 indeterminate.
14889 <a name="7.24.6" href="#7.24.6"><b> 7.24.6 Extended multibyte/wide character conversion utilities</b></a>
14890 1 The header <a href="#7.24">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
14891 between multibyte characters and wide characters.
14892 2 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.24.6.3">7.24.6.3</a> and
14893 <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
14894 to describe the current conversion state from a particular multibyte character sequence to
14895 a wide character sequence (or the reverse) under the rules of a particular setting for the
14896 LC_CTYPE category of the current locale.
14897 3 The initial conversion state corresponds, for a conversion in either direction, to the
14898 beginning of a new multibyte character in the initial shift state. A zero-valued
14899 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
14900 valued mbstate_t object can be used to initiate conversion involving any multibyte
14901 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
14902 been altered by any of the functions described in this subclause, and is then used with a
14903 different multibyte character sequence, or in the other conversion direction, or with a
14904 different LC_CTYPE category setting than on earlier function calls, the behavior is
14905 undefined.<sup><a href="#note299"><b>299)</b></a></sup>
14906 4 On entry, each function takes the described conversion state (either internal or pointed to
14907 by an argument) as current. The conversion state described by the pointed-to object is
14908 altered as needed to track the shift state, and the position within a multibyte character, for
14909 the associated multibyte character sequence.
14914 <sup><a name="note299" href="#note299"><b>299)</b></a></sup> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
14915 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
14916 character string.
14918 [<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
14920 <a name="7.24.6.1" href="#7.24.6.1"><b> 7.24.6.1 Single-byte/wide character conversion functions</b></a>
14921 <a name="7.24.6.1.1" href="#7.24.6.1.1"><b> 7.24.6.1.1 The btowc function</b></a>
14922 <b> Synopsis</b>
14923 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14924 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14925 wint_t btowc(int c);
14926 <b> Description</b>
14927 2 The btowc function determines whether c constitutes a valid single-byte character in the
14928 initial shift state.
14929 <b> Returns</b>
14930 3 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
14931 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
14932 returns the wide character representation of that character.
14933 <a name="7.24.6.1.2" href="#7.24.6.1.2"><b> 7.24.6.1.2 The wctob function</b></a>
14934 <b> Synopsis</b>
14935 1 #include <a href="#7.19">&lt;stdio.h&gt;</a>
14936 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14937 int wctob(wint_t c);
14938 <b> Description</b>
14939 2 The wctob function determines whether c corresponds to a member of the extended
14940 character set whose multibyte character representation is a single byte when in the initial
14941 shift state.
14942 <b> Returns</b>
14943 3 The wctob function returns EOF if c does not correspond to a multibyte character with
14944 length one in the initial shift state. Otherwise, it returns the single-byte representation of
14945 that character as an unsigned char converted to an int.
14946 <a name="7.24.6.2" href="#7.24.6.2"><b> 7.24.6.2 Conversion state functions</b></a>
14947 <a name="7.24.6.2.1" href="#7.24.6.2.1"><b> 7.24.6.2.1 The mbsinit function</b></a>
14948 <b> Synopsis</b>
14949 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14950 int mbsinit(const mbstate_t *ps);
14951 <b> Description</b>
14952 2 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
14953 mbstate_t object describes an initial conversion state.
14955 [<a name="p387" href="#p387">page 387</a>] (<a href="#Contents">Contents</a>)
14957 <b> Returns</b>
14958 3 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
14959 describes an initial conversion state; otherwise, it returns zero.
14960 <a name="7.24.6.3" href="#7.24.6.3"><b> 7.24.6.3 Restartable multibyte/wide character conversion functions</b></a>
14961 1 These functions differ from the corresponding multibyte character functions of <a href="#7.20.7">7.20.7</a>
14962 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
14963 pointer to mbstate_t that points to an object that can completely describe the current
14964 conversion state of the associated multibyte character sequence. If ps is a null pointer,
14965 each function uses its own internal mbstate_t object instead, which is initialized at
14966 program startup to the initial conversion state. The implementation behaves as if no
14967 library function calls these functions with a null pointer for ps.
14968 2 Also unlike their corresponding functions, the return value does not represent whether the
14969 encoding is state-dependent.
14970 <a name="7.24.6.3.1" href="#7.24.6.3.1"><b> 7.24.6.3.1 The mbrlen function</b></a>
14971 <b> Synopsis</b>
14972 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14973 size_t mbrlen(const char * restrict s,
14974 size_t n,
14975 mbstate_t * restrict ps);
14976 <b> Description</b>
14977 2 The mbrlen function is equivalent to the call:
14978 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
14979 where internal is the mbstate_t object for the mbrlen function, except that the
14980 expression designated by ps is evaluated only once.
14981 <b> Returns</b>
14982 3 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
14983 or (size_t)(-1).
14984 Forward references: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
14986 [<a name="p388" href="#p388">page 388</a>] (<a href="#Contents">Contents</a>)
14988 <a name="7.24.6.3.2" href="#7.24.6.3.2"><b> 7.24.6.3.2 The mbrtowc function</b></a>
14989 <b> Synopsis</b>
14990 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
14991 size_t mbrtowc(wchar_t * restrict pwc,
14992 const char * restrict s,
14993 size_t n,
14994 mbstate_t * restrict ps);
14995 <b> Description</b>
14996 2 If s is a null pointer, the mbrtowc function is equivalent to the call:
14997 mbrtowc(NULL, "", 1, ps)
14998 In this case, the values of the parameters pwc and n are ignored.
14999 3 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
15000 the byte pointed to by s to determine the number of bytes needed to complete the next
15001 multibyte character (including any shift sequences). If the function determines that the
15002 next multibyte character is complete and valid, it determines the value of the
15003 corresponding wide character and then, if pwc is not a null pointer, stores that value in
15004 the object pointed to by pwc. If the corresponding wide character is the null wide
15005 character, the resulting state described is the initial conversion state.
15006 <b> Returns</b>
15007 4 The mbrtowc function returns the first of the following that applies (given the current
15008 conversion state):
15009 0 if the next n or fewer bytes complete the multibyte character that
15010 corresponds to the null wide character (which is the value stored).
15011 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
15012 character (which is the value stored); the value returned is the number
15013 of bytes that complete the multibyte character.
15014 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
15015 multibyte character, and all n bytes have been processed (no value is
15016 stored).<sup><a href="#note300"><b>300)</b></a></sup>
15017 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
15018 do not contribute to a complete and valid multibyte character (no
15019 value is stored); the value of the macro EILSEQ is stored in errno,
15020 and the conversion state is unspecified.
15022 <sup><a name="note300" href="#note300"><b>300)</b></a></sup> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
15023 sequence of redundant shift sequences (for implementations with state-dependent encodings).
15025 [<a name="p389" href="#p389">page 389</a>] (<a href="#Contents">Contents</a>)
15027 <a name="7.24.6.3.3" href="#7.24.6.3.3"><b> 7.24.6.3.3 The wcrtomb function</b></a>
15028 <b> Synopsis</b>
15029 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15030 size_t wcrtomb(char * restrict s,
15031 wchar_t wc,
15032 mbstate_t * restrict ps);
15033 <b> Description</b>
15034 2 If s is a null pointer, the wcrtomb function is equivalent to the call
15035 wcrtomb(buf, L'\0', ps)
15036 where buf is an internal buffer.
15037 3 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
15038 to represent the multibyte character that corresponds to the wide character given by wc
15039 (including any shift sequences), and stores the multibyte character representation in the
15040 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
15041 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
15042 to restore the initial shift state; the resulting state described is the initial conversion state.
15043 <b> Returns</b>
15044 4 The wcrtomb function returns the number of bytes stored in the array object (including
15045 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
15046 the function stores the value of the macro EILSEQ in errno and returns
15047 (size_t)(-1); the conversion state is unspecified.
15048 <a name="7.24.6.4" href="#7.24.6.4"><b> 7.24.6.4 Restartable multibyte/wide string conversion functions</b></a>
15049 1 These functions differ from the corresponding multibyte string functions of <a href="#7.20.8">7.20.8</a>
15050 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
15051 mbstate_t that points to an object that can completely describe the current conversion
15052 state of the associated multibyte character sequence. If ps is a null pointer, each function
15053 uses its own internal mbstate_t object instead, which is initialized at program startup
15054 to the initial conversion state. The implementation behaves as if no library function calls
15055 these functions with a null pointer for ps.
15056 2 Also unlike their corresponding functions, the conversion source parameter, src, has a
15057 pointer-to-pointer type. When the function is storing the results of conversions (that is,
15058 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
15059 to reflect the amount of the source processed by that invocation.
15061 [<a name="p390" href="#p390">page 390</a>] (<a href="#Contents">Contents</a>)
15063 <a name="7.24.6.4.1" href="#7.24.6.4.1"><b> 7.24.6.4.1 The mbsrtowcs function</b></a>
15064 <b> Synopsis</b>
15065 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15066 size_t mbsrtowcs(wchar_t * restrict dst,
15067 const char ** restrict src,
15068 size_t len,
15069 mbstate_t * restrict ps);
15070 <b> Description</b>
15071 2 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
15072 conversion state described by the object pointed to by ps, from the array indirectly
15073 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
15074 pointer, the converted characters are stored into the array pointed to by dst. Conversion
15075 continues up to and including a terminating null character, which is also stored.
15076 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
15077 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
15078 characters have been stored into the array pointed to by dst.<sup><a href="#note301"><b>301)</b></a></sup> Each conversion takes
15079 place as if by a call to the mbrtowc function.
15080 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
15081 pointer (if conversion stopped due to reaching a terminating null character) or the address
15082 just past the last multibyte character converted (if any). If conversion stopped due to
15083 reaching a terminating null character and if dst is not a null pointer, the resulting state
15084 described is the initial conversion state.
15085 <b> Returns</b>
15086 4 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
15087 character, an encoding error occurs: the mbsrtowcs function stores the value of the
15088 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
15089 unspecified. Otherwise, it returns the number of multibyte characters successfully
15090 converted, not including the terminating null character (if any).
15095 <sup><a name="note301" href="#note301"><b>301)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
15097 [<a name="p391" href="#p391">page 391</a>] (<a href="#Contents">Contents</a>)
15099 <a name="7.24.6.4.2" href="#7.24.6.4.2"><b> 7.24.6.4.2 The wcsrtombs function</b></a>
15100 <b> Synopsis</b>
15101 1 #include <a href="#7.24">&lt;wchar.h&gt;</a>
15102 size_t wcsrtombs(char * restrict dst,
15103 const wchar_t ** restrict src,
15104 size_t len,
15105 mbstate_t * restrict ps);
15106 <b> Description</b>
15107 2 The wcsrtombs function converts a sequence of wide characters from the array
15108 indirectly pointed to by src into a sequence of corresponding multibyte characters that
15109 begins in the conversion state described by the object pointed to by ps. If dst is not a
15110 null pointer, the converted characters are then stored into the array pointed to by dst.
15111 Conversion continues up to and including a terminating null wide character, which is also
15112 stored. Conversion stops earlier in two cases: when a wide character is reached that does
15113 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
15114 next multibyte character would exceed the limit of len total bytes to be stored into the
15115 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
15116 function.<sup><a href="#note302"><b>302)</b></a></sup>
15117 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
15118 pointer (if conversion stopped due to reaching a terminating null wide character) or the
15119 address just past the last wide character converted (if any). If conversion stopped due to
15120 reaching a terminating null wide character, the resulting state described is the initial
15121 conversion state.
15122 <b> Returns</b>
15123 4 If conversion stops because a wide character is reached that does not correspond to a
15124 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
15125 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
15126 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
15127 character sequence, not including the terminating null character (if any).
15132 <sup><a name="note302" href="#note302"><b>302)</b></a></sup> If conversion stops because a terminating null wide character has been reached, the bytes stored
15133 include those necessary to reach the initial shift state immediately before the null byte.
15135 [<a name="p392" href="#p392">page 392</a>] (<a href="#Contents">Contents</a>)
15137 <a name="7.25" href="#7.25"><b> 7.25 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
15138 <a name="7.25.1" href="#7.25.1"><b> 7.25.1 Introduction</b></a>
15139 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares three data types, one macro, and many functions.<sup><a href="#note303"><b>303)</b></a></sup>
15140 2 The types declared are
15141 wint_t
15142 described in <a href="#7.24.1">7.24.1</a>;
15143 wctrans_t
15144 which is a scalar type that can hold values which represent locale-specific character
15145 mappings; and
15146 wctype_t
15147 which is a scalar type that can hold values which represent locale-specific character
15148 classifications.
15149 3 The macro defined is WEOF (described in <a href="#7.24.1">7.24.1</a>).
15150 4 The functions declared are grouped as follows:
15151 -- Functions that provide wide character classification;
15152 -- Extensible functions that provide wide character classification;
15153 -- Functions that provide wide character case mapping;
15154 -- Extensible functions that provide wide character mapping.
15155 5 For all functions described in this subclause that accept an argument of type wint_t, the
15156 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
15157 this argument has any other value, the behavior is undefined.
15158 6 The behavior of these functions is affected by the LC_CTYPE category of the current
15159 locale.
15164 <sup><a name="note303" href="#note303"><b>303)</b></a></sup> See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
15166 [<a name="p393" href="#p393">page 393</a>] (<a href="#Contents">Contents</a>)
15168 <a name="7.25.2" href="#7.25.2"><b> 7.25.2 Wide character classification utilities</b></a>
15169 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
15170 characters.
15171 2 The term printing wide character refers to a member of a locale-specific set of wide
15172 characters, each of which occupies at least one printing position on a display device. The
15173 term control wide character refers to a member of a locale-specific set of wide characters
15174 that are not printing wide characters.
15175 <a name="7.25.2.1" href="#7.25.2.1"><b> 7.25.2.1 Wide character classification functions</b></a>
15176 1 The functions in this subclause return nonzero (true) if and only if the value of the
15177 argument wc conforms to that in the description of the function.
15178 2 Each of the following functions returns true for each wide character that corresponds (as
15179 if by a call to the wctob function) to a single-byte character for which the corresponding
15180 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
15181 iswpunct functions may differ with respect to wide characters other than L' ' that are
15182 both printing and white-space wide characters.<sup><a href="#note304"><b>304)</b></a></sup>
15183 Forward references: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
15184 <a name="7.25.2.1.1" href="#7.25.2.1.1"><b> 7.25.2.1.1 The iswalnum function</b></a>
15185 <b> Synopsis</b>
15186 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15187 int iswalnum(wint_t wc);
15188 <b> Description</b>
15189 2 The iswalnum function tests for any wide character for which iswalpha or
15190 iswdigit is true.
15191 <a name="7.25.2.1.2" href="#7.25.2.1.2"><b> 7.25.2.1.2 The iswalpha function</b></a>
15192 <b> Synopsis</b>
15193 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15194 int iswalpha(wint_t wc);
15195 <b> Description</b>
15196 2 The iswalpha function tests for any wide character for which iswupper or
15197 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
15199 <sup><a name="note304" href="#note304"><b>304)</b></a></sup> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
15200 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
15201 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
15202 &amp;&amp; iswspace(wc) is true, but not both.
15204 [<a name="p394" href="#p394">page 394</a>] (<a href="#Contents">Contents</a>)
15206 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
15207 is true.<sup><a href="#note305"><b>305)</b></a></sup>
15208 <a name="7.25.2.1.3" href="#7.25.2.1.3"><b> 7.25.2.1.3 The iswblank function</b></a>
15209 <b> Synopsis</b>
15210 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15211 int iswblank(wint_t wc);
15212 <b> Description</b>
15213 2 The iswblank function tests for any wide character that is a standard blank wide
15214 character or is one of a locale-specific set of wide characters for which iswspace is true
15215 and that is used to separate words within a line of text. The standard blank wide
15216 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
15217 locale, iswblank returns true only for the standard blank characters.
15218 <a name="7.25.2.1.4" href="#7.25.2.1.4"><b> 7.25.2.1.4 The iswcntrl function</b></a>
15219 <b> Synopsis</b>
15220 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15221 int iswcntrl(wint_t wc);
15222 <b> Description</b>
15223 2 The iswcntrl function tests for any control wide character.
15224 <a name="7.25.2.1.5" href="#7.25.2.1.5"><b> 7.25.2.1.5 The iswdigit function</b></a>
15225 <b> Synopsis</b>
15226 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15227 int iswdigit(wint_t wc);
15228 <b> Description</b>
15229 2 The iswdigit function tests for any wide character that corresponds to a decimal-digit
15230 character (as defined in <a href="#5.2.1">5.2.1</a>).
15231 <a name="7.25.2.1.6" href="#7.25.2.1.6"><b> 7.25.2.1.6 The iswgraph function</b></a>
15232 <b> Synopsis</b>
15233 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15234 int iswgraph(wint_t wc);
15239 <sup><a name="note305" href="#note305"><b>305)</b></a></sup> The functions iswlower and iswupper test true or false separately for each of these additional
15240 wide characters; all four combinations are possible.
15242 [<a name="p395" href="#p395">page 395</a>] (<a href="#Contents">Contents</a>)
15244 <b> Description</b>
15245 2 The iswgraph function tests for any wide character for which iswprint is true and
15246 iswspace is false.<sup><a href="#note306"><b>306)</b></a></sup>
15247 <a name="7.25.2.1.7" href="#7.25.2.1.7"><b> 7.25.2.1.7 The iswlower function</b></a>
15248 <b> Synopsis</b>
15249 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15250 int iswlower(wint_t wc);
15251 <b> Description</b>
15252 2 The iswlower function tests for any wide character that corresponds to a lowercase
15253 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
15254 iswdigit, iswpunct, or iswspace is true.
15255 <a name="7.25.2.1.8" href="#7.25.2.1.8"><b> 7.25.2.1.8 The iswprint function</b></a>
15256 <b> Synopsis</b>
15257 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15258 int iswprint(wint_t wc);
15259 <b> Description</b>
15260 2 The iswprint function tests for any printing wide character.
15261 <a name="7.25.2.1.9" href="#7.25.2.1.9"><b> 7.25.2.1.9 The iswpunct function</b></a>
15262 <b> Synopsis</b>
15263 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15264 int iswpunct(wint_t wc);
15265 <b> Description</b>
15266 2 The iswpunct function tests for any printing wide character that is one of a locale-
15267 specific set of punctuation wide characters for which neither iswspace nor iswalnum
15268 is true.306)
15269 <a name="7.25.2.1.10" href="#7.25.2.1.10"><b> 7.25.2.1.10 The iswspace function</b></a>
15270 <b> Synopsis</b>
15271 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15272 int iswspace(wint_t wc);
15276 <sup><a name="note306" href="#note306"><b>306)</b></a></sup> Note that the behavior of the iswgraph and iswpunct functions may differ from their
15277 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
15278 characters other than ' '.
15280 [<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
15282 <b> Description</b>
15283 2 The iswspace function tests for any wide character that corresponds to a locale-specific
15284 set of white-space wide characters for which none of iswalnum, iswgraph, or
15285 iswpunct is true.
15286 <a name="7.25.2.1.11" href="#7.25.2.1.11"><b> 7.25.2.1.11 The iswupper function</b></a>
15287 <b> Synopsis</b>
15288 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15289 int iswupper(wint_t wc);
15290 <b> Description</b>
15291 2 The iswupper function tests for any wide character that corresponds to an uppercase
15292 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
15293 iswdigit, iswpunct, or iswspace is true.
15294 <a name="7.25.2.1.12" href="#7.25.2.1.12"><b> 7.25.2.1.12 The iswxdigit function</b></a>
15295 <b> Synopsis</b>
15296 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15297 int iswxdigit(wint_t wc);
15298 <b> Description</b>
15299 2 The iswxdigit function tests for any wide character that corresponds to a
15300 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
15301 <a name="7.25.2.2" href="#7.25.2.2"><b> 7.25.2.2 Extensible wide character classification functions</b></a>
15302 1 The functions wctype and iswctype provide extensible wide character classification
15303 as well as testing equivalent to that performed by the functions described in the previous
15304 subclause (<a href="#7.25.2.1">7.25.2.1</a>).
15305 <a name="7.25.2.2.1" href="#7.25.2.2.1"><b> 7.25.2.2.1 The iswctype function</b></a>
15306 <b> Synopsis</b>
15307 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15308 int iswctype(wint_t wc, wctype_t desc);
15309 <b> Description</b>
15310 2 The iswctype function determines whether the wide character wc has the property
15311 described by desc. The current setting of the LC_CTYPE category shall be the same as
15312 during the call to wctype that returned the value desc.
15313 3 Each of the following expressions has a truth-value equivalent to the call to the wide
15314 character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
15316 [<a name="p397" href="#p397">page 397</a>] (<a href="#Contents">Contents</a>)
15318 iswctype(wc, wctype("alnum")) // iswalnum(wc)
15319 iswctype(wc, wctype("alpha")) // iswalpha(wc)
15320 iswctype(wc, wctype("blank")) // iswblank(wc)
15321 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
15322 iswctype(wc, wctype("digit")) // iswdigit(wc)
15323 iswctype(wc, wctype("graph")) // iswgraph(wc)
15324 iswctype(wc, wctype("lower")) // iswlower(wc)
15325 iswctype(wc, wctype("print")) // iswprint(wc)
15326 iswctype(wc, wctype("punct")) // iswpunct(wc)
15327 iswctype(wc, wctype("space")) // iswspace(wc)
15328 iswctype(wc, wctype("upper")) // iswupper(wc)
15329 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
15330 <b> Returns</b>
15331 4 The iswctype function returns nonzero (true) if and only if the value of the wide
15332 character wc has the property described by desc.
15333 Forward references: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
15334 <a name="7.25.2.2.2" href="#7.25.2.2.2"><b> 7.25.2.2.2 The wctype function</b></a>
15335 <b> Synopsis</b>
15336 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15337 wctype_t wctype(const char *property);
15338 <b> Description</b>
15339 2 The wctype function constructs a value with type wctype_t that describes a class of
15340 wide characters identified by the string argument property.
15341 3 The strings listed in the description of the iswctype function shall be valid in all
15342 locales as property arguments to the wctype function.
15343 <b> Returns</b>
15344 4 If property identifies a valid class of wide characters according to the LC_CTYPE
15345 category of the current locale, the wctype function returns a nonzero value that is valid
15346 as the second argument to the iswctype function; otherwise, it returns zero. *
15348 [<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
15350 <a name="7.25.3" href="#7.25.3"><b> 7.25.3 Wide character case mapping utilities</b></a>
15351 1 The header <a href="#7.25">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
15352 <a name="7.25.3.1" href="#7.25.3.1"><b> 7.25.3.1 Wide character case mapping functions</b></a>
15353 <a name="7.25.3.1.1" href="#7.25.3.1.1"><b> 7.25.3.1.1 The towlower function</b></a>
15354 <b> Synopsis</b>
15355 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15356 wint_t towlower(wint_t wc);
15357 <b> Description</b>
15358 2 The towlower function converts an uppercase letter to a corresponding lowercase letter.
15359 <b> Returns</b>
15360 3 If the argument is a wide character for which iswupper is true and there are one or
15361 more corresponding wide characters, as specified by the current locale, for which
15362 iswlower is true, the towlower function returns one of the corresponding wide
15363 characters (always the same one for any given locale); otherwise, the argument is
15364 returned unchanged.
15365 <a name="7.25.3.1.2" href="#7.25.3.1.2"><b> 7.25.3.1.2 The towupper function</b></a>
15366 <b> Synopsis</b>
15367 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15368 wint_t towupper(wint_t wc);
15369 <b> Description</b>
15370 2 The towupper function converts a lowercase letter to a corresponding uppercase letter.
15371 <b> Returns</b>
15372 3 If the argument is a wide character for which iswlower is true and there are one or
15373 more corresponding wide characters, as specified by the current locale, for which
15374 iswupper is true, the towupper function returns one of the corresponding wide
15375 characters (always the same one for any given locale); otherwise, the argument is
15376 returned unchanged.
15377 <a name="7.25.3.2" href="#7.25.3.2"><b> 7.25.3.2 Extensible wide character case mapping functions</b></a>
15378 1 The functions wctrans and towctrans provide extensible wide character mapping as
15379 well as case mapping equivalent to that performed by the functions described in the
15380 previous subclause (<a href="#7.25.3.1">7.25.3.1</a>).
15382 [<a name="p399" href="#p399">page 399</a>] (<a href="#Contents">Contents</a>)
15384 <a name="7.25.3.2.1" href="#7.25.3.2.1"><b> 7.25.3.2.1 The towctrans function</b></a>
15385 <b> Synopsis</b>
15386 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15387 wint_t towctrans(wint_t wc, wctrans_t desc);
15388 <b> Description</b>
15389 2 The towctrans function maps the wide character wc using the mapping described by
15390 desc. The current setting of the LC_CTYPE category shall be the same as during the call
15391 to wctrans that returned the value desc.
15392 3 Each of the following expressions behaves the same as the call to the wide character case
15393 mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
15394 towctrans(wc, wctrans("tolower")) // towlower(wc)
15395 towctrans(wc, wctrans("toupper")) // towupper(wc)
15396 <b> Returns</b>
15397 4 The towctrans function returns the mapped value of wc using the mapping described
15398 by desc.
15399 <a name="7.25.3.2.2" href="#7.25.3.2.2"><b> 7.25.3.2.2 The wctrans function</b></a>
15400 <b> Synopsis</b>
15401 1 #include <a href="#7.25">&lt;wctype.h&gt;</a>
15402 wctrans_t wctrans(const char *property);
15403 <b> Description</b>
15404 2 The wctrans function constructs a value with type wctrans_t that describes a
15405 mapping between wide characters identified by the string argument property.
15406 3 The strings listed in the description of the towctrans function shall be valid in all
15407 locales as property arguments to the wctrans function.
15408 <b> Returns</b>
15409 4 If property identifies a valid mapping of wide characters according to the LC_CTYPE
15410 category of the current locale, the wctrans function returns a nonzero value that is valid
15411 as the second argument to the towctrans function; otherwise, it returns zero.
15413 [<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
15415 <a name="7.26" href="#7.26"><b> 7.26 Future library directions</b></a>
15416 1 The following names are grouped under individual headers for convenience. All external
15417 names described below are reserved no matter what headers are included by the program.
15418 <a name="7.26.1" href="#7.26.1"><b> 7.26.1 Complex arithmetic &lt;complex.h&gt;</b></a>
15419 1 The function names
15420 cerf cexpm1 clog2
15421 cerfc clog10 clgamma
15422 cexp2 clog1p ctgamma
15423 and the same names suffixed with f or l may be added to the declarations in the
15424 <a href="#7.3">&lt;complex.h&gt;</a> header.
15425 <a name="7.26.2" href="#7.26.2"><b> 7.26.2 Character handling &lt;ctype.h&gt;</b></a>
15426 1 Function names that begin with either is or to, and a lowercase letter may be added to
15427 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
15428 <a name="7.26.3" href="#7.26.3"><b> 7.26.3 Errors &lt;errno.h&gt;</b></a>
15429 1 Macros that begin with E and a digit or E and an uppercase letter may be added to the
15430 declarations in the <a href="#7.5">&lt;errno.h&gt;</a> header.
15431 <a name="7.26.4" href="#7.26.4"><b> 7.26.4 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
15432 1 Macro names beginning with PRI or SCN followed by any lowercase letter or X may be
15433 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
15434 <a name="7.26.5" href="#7.26.5"><b> 7.26.5 Localization &lt;locale.h&gt;</b></a>
15435 1 Macros that begin with LC_ and an uppercase letter may be added to the definitions in
15436 the <a href="#7.11">&lt;locale.h&gt;</a> header.
15437 <a name="7.26.6" href="#7.26.6"><b> 7.26.6 Signal handling &lt;signal.h&gt;</b></a>
15438 1 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
15439 letter may be added to the definitions in the <a href="#7.14">&lt;signal.h&gt;</a> header.
15440 <a name="7.26.7" href="#7.26.7"><b> 7.26.7 Boolean type and values &lt;stdbool.h&gt;</b></a>
15441 1 The ability to undefine and perhaps then redefine the macros bool, true, and false is
15442 an obsolescent feature.
15443 <a name="7.26.8" href="#7.26.8"><b> 7.26.8 Integer types &lt;stdint.h&gt;</b></a>
15444 1 Typedef names beginning with int or uint and ending with _t may be added to the
15445 types defined in the <a href="#7.18">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
15446 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
15447 <a href="#7.18">&lt;stdint.h&gt;</a> header.
15449 [<a name="p401" href="#p401">page 401</a>] (<a href="#Contents">Contents</a>)
15451 <a name="7.26.9" href="#7.26.9"><b> 7.26.9 Input/output &lt;stdio.h&gt;</b></a>
15452 1 Lowercase letters may be added to the conversion specifiers and length modifiers in
15453 fprintf and fscanf. Other characters may be used in extensions.
15454 2 The gets function is obsolescent, and is deprecated.
15455 3 The use of ungetc on a binary stream where the file position indicator is zero prior to
15456 the call is an obsolescent feature.
15457 <a name="7.26.10" href="#7.26.10"><b> 7.26.10 General utilities &lt;stdlib.h&gt;</b></a>
15458 1 Function names that begin with str and a lowercase letter may be added to the
15459 declarations in the <a href="#7.20">&lt;stdlib.h&gt;</a> header.
15460 <a name="7.26.11" href="#7.26.11"><b> 7.26.11 String handling &lt;string.h&gt;</b></a>
15461 1 Function names that begin with str, mem, or wcs and a lowercase letter may be added
15462 to the declarations in the <a href="#7.21">&lt;string.h&gt;</a> header.
15463 <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>
15464 1 Function names that begin with wcs and a lowercase letter may be added to the
15465 declarations in the <a href="#7.24">&lt;wchar.h&gt;</a> header.
15466 2 Lowercase letters may be added to the conversion specifiers and length modifiers in
15467 fwprintf and fwscanf. Other characters may be used in extensions.
15468 <a name="7.26.13" href="#7.26.13"><b> 7.26.13 Wide character classification and mapping utilities</b></a>
15469 <a href="#7.25">&lt;wctype.h&gt;</a>
15470 1 Function names that begin with is or to and a lowercase letter may be added to the
15471 declarations in the <a href="#7.25">&lt;wctype.h&gt;</a> header.
15473 [<a name="p402" href="#p402">page 402</a>] (<a href="#Contents">Contents</a>)
15475 <a name="A" href="#A"><b> Annex A</b></a>
15476 (informative)
15477 Language syntax summary
15478 1 NOTE The notation is described in <a href="#6.1">6.1</a>.
15480 <a name="A.1" href="#A.1"><b> A.1 Lexical grammar</b></a>
15481 <a name="A.1.1" href="#A.1.1"><b> A.1.1 Lexical elements</b></a>
15482 (<a href="#6.4">6.4</a>) token:
15483 keyword
15484 identifier
15485 constant
15486 string-literal
15487 punctuator
15488 (<a href="#6.4">6.4</a>) preprocessing-token:
15489 header-name
15490 identifier
15491 pp-number
15492 character-constant
15493 string-literal
15494 punctuator
15495 each non-white-space character that cannot be one of the above
15496 <a name="A.1.2" href="#A.1.2"><b> A.1.2 Keywords</b></a>
15497 (<a href="#6.4.1">6.4.1</a>) keyword: one of
15498 auto enum restrict unsigned
15499 break extern return void
15500 case float short volatile
15501 char for signed while
15502 const goto sizeof _Bool
15503 continue if static _Complex
15504 default inline struct _Imaginary
15505 do int switch
15506 double long typedef
15507 else register union
15509 [<a name="p403" href="#p403">page 403</a>] (<a href="#Contents">Contents</a>)
15511 <a name="A.1.3" href="#A.1.3"><b>A.1.3 Identifiers</b></a>
15512 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
15513 identifier-nondigit
15514 identifier identifier-nondigit
15515 identifier digit
15516 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
15517 nondigit
15518 universal-character-name
15519 other implementation-defined characters
15520 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
15521 _ a b c d e f g h i j k l m
15522 n o p q r s t u v w x y z
15523 A B C D E F G H I J K L M
15524 N O P Q R S T U V W X Y Z
15525 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
15526 0 1 2 3 4 5 6 7 8 9
15527 <a name="A.1.4" href="#A.1.4"><b>A.1.4 Universal character names</b></a>
15528 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
15529 \u hex-quad
15530 \U hex-quad hex-quad
15531 (<a href="#6.4.3">6.4.3</a>) hex-quad:
15532 hexadecimal-digit hexadecimal-digit
15533 hexadecimal-digit hexadecimal-digit
15534 <a name="A.1.5" href="#A.1.5"><b>A.1.5 Constants</b></a>
15535 (<a href="#6.4.4">6.4.4</a>) constant:
15536 integer-constant
15537 floating-constant
15538 enumeration-constant
15539 character-constant
15540 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
15541 decimal-constant integer-suffixopt
15542 octal-constant integer-suffixopt
15543 hexadecimal-constant integer-suffixopt
15544 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
15545 nonzero-digit
15546 decimal-constant digit
15548 [<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
15550 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
15552 octal-constant octal-digit
15553 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
15554 hexadecimal-prefix hexadecimal-digit
15555 hexadecimal-constant hexadecimal-digit
15556 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
15557 0x 0X
15558 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
15559 1 2 3 4 5 6 7 8 9
15560 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
15561 0 1 2 3 4 5 6 7
15562 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
15563 0 1 2 3 4 5 6 7 8 9
15564 a b c d e f
15565 A B C D E F
15566 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
15567 unsigned-suffix long-suffixopt
15568 unsigned-suffix long-long-suffix
15569 long-suffix unsigned-suffixopt
15570 long-long-suffix unsigned-suffixopt
15571 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
15573 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
15575 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
15576 ll LL
15577 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
15578 decimal-floating-constant
15579 hexadecimal-floating-constant
15580 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
15581 fractional-constant exponent-partopt floating-suffixopt
15582 digit-sequence exponent-part floating-suffixopt
15584 [<a name="p405" href="#p405">page 405</a>] (<a href="#Contents">Contents</a>)
15586 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
15587 hexadecimal-prefix hexadecimal-fractional-constant
15588 binary-exponent-part floating-suffixopt
15589 hexadecimal-prefix hexadecimal-digit-sequence
15590 binary-exponent-part floating-suffixopt
15591 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
15592 digit-sequenceopt . digit-sequence
15593 digit-sequence .
15594 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
15595 e signopt digit-sequence
15596 E signopt digit-sequence
15597 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
15599 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
15600 digit
15601 digit-sequence digit
15602 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
15603 hexadecimal-digit-sequenceopt .
15604 hexadecimal-digit-sequence
15605 hexadecimal-digit-sequence .
15606 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
15607 p signopt digit-sequence
15608 P signopt digit-sequence
15609 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
15610 hexadecimal-digit
15611 hexadecimal-digit-sequence hexadecimal-digit
15612 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
15613 f l F L
15614 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
15615 identifier
15616 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
15617 ' c-char-sequence '
15618 L' c-char-sequence '
15620 [<a name="p406" href="#p406">page 406</a>] (<a href="#Contents">Contents</a>)
15622 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
15623 c-char
15624 c-char-sequence c-char
15625 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
15626 any member of the source character set except
15627 the single-quote ', backslash \, or new-line character
15628 escape-sequence
15629 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
15630 simple-escape-sequence
15631 octal-escape-sequence
15632 hexadecimal-escape-sequence
15633 universal-character-name
15634 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
15635 \' \" \? \\
15636 \a \b \f \n \r \t \v
15637 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
15638 \ octal-digit
15639 \ octal-digit octal-digit
15640 \ octal-digit octal-digit octal-digit
15641 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
15642 \x hexadecimal-digit
15643 hexadecimal-escape-sequence hexadecimal-digit
15644 <a name="A.1.6" href="#A.1.6"><b>A.1.6 String literals</b></a>
15645 (<a href="#6.4.5">6.4.5</a>) string-literal:
15646 " s-char-sequenceopt "
15647 L" s-char-sequenceopt "
15648 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
15649 s-char
15650 s-char-sequence s-char
15651 (<a href="#6.4.5">6.4.5</a>) s-char:
15652 any member of the source character set except
15653 the double-quote ", backslash \, or new-line character
15654 escape-sequence
15656 [<a name="p407" href="#p407">page 407</a>] (<a href="#Contents">Contents</a>)
15658 <a name="A.1.7" href="#A.1.7"><b>A.1.7 Punctuators</b></a>
15659 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
15660 [ ] ( ) { } . -&gt;
15661 ++ -- &amp; * + - ~ !
15662 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
15663 ? : ; ...
15664 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
15665 , # ##
15666 &lt;: :&gt; &lt;% %&gt; %: %:%:
15667 <a name="A.1.8" href="#A.1.8"><b>A.1.8 Header names</b></a>
15668 (<a href="#6.4.7">6.4.7</a>) header-name:
15669 &lt; h-char-sequence &gt;
15670 " q-char-sequence "
15671 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
15672 h-char
15673 h-char-sequence h-char
15674 (<a href="#6.4.7">6.4.7</a>) h-char:
15675 any member of the source character set except
15676 the new-line character and &gt;
15677 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
15678 q-char
15679 q-char-sequence q-char
15680 (<a href="#6.4.7">6.4.7</a>) q-char:
15681 any member of the source character set except
15682 the new-line character and "
15683 <a name="A.1.9" href="#A.1.9"><b>A.1.9 Preprocessing numbers</b></a>
15684 (<a href="#6.4.8">6.4.8</a>) pp-number:
15685 digit
15686 . digit
15687 pp-number digit
15688 pp-number identifier-nondigit
15689 pp-number e sign
15690 pp-number E sign
15691 pp-number p sign
15692 pp-number P sign
15693 pp-number .
15695 [<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
15697 <a name="A.2" href="#A.2"><b>A.2 Phrase structure grammar</b></a>
15698 <a name="A.2.1" href="#A.2.1"><b>A.2.1 Expressions</b></a>
15699 (<a href="#6.5.1">6.5.1</a>) primary-expression:
15700 identifier
15701 constant
15702 string-literal
15703 ( expression )
15704 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
15705 primary-expression
15706 postfix-expression [ expression ]
15707 postfix-expression ( argument-expression-listopt )
15708 postfix-expression . identifier
15709 postfix-expression -&gt; identifier
15710 postfix-expression ++
15711 postfix-expression --
15712 ( type-name ) { initializer-list }
15713 ( type-name ) { initializer-list , }
15714 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
15715 assignment-expression
15716 argument-expression-list , assignment-expression
15717 (<a href="#6.5.3">6.5.3</a>) unary-expression:
15718 postfix-expression
15719 ++ unary-expression
15720 -- unary-expression
15721 unary-operator cast-expression
15722 sizeof unary-expression
15723 sizeof ( type-name )
15724 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
15725 &amp; * + - ~ !
15726 (<a href="#6.5.4">6.5.4</a>) cast-expression:
15727 unary-expression
15728 ( type-name ) cast-expression
15729 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
15730 cast-expression
15731 multiplicative-expression * cast-expression
15732 multiplicative-expression / cast-expression
15733 multiplicative-expression % cast-expression
15735 [<a name="p409" href="#p409">page 409</a>] (<a href="#Contents">Contents</a>)
15737 (<a href="#6.5.6">6.5.6</a>) additive-expression:
15738 multiplicative-expression
15739 additive-expression + multiplicative-expression
15740 additive-expression - multiplicative-expression
15741 (<a href="#6.5.7">6.5.7</a>) shift-expression:
15742 additive-expression
15743 shift-expression &lt;&lt; additive-expression
15744 shift-expression &gt;&gt; additive-expression
15745 (<a href="#6.5.8">6.5.8</a>) relational-expression:
15746 shift-expression
15747 relational-expression &lt; shift-expression
15748 relational-expression &gt; shift-expression
15749 relational-expression &lt;= shift-expression
15750 relational-expression &gt;= shift-expression
15751 (<a href="#6.5.9">6.5.9</a>) equality-expression:
15752 relational-expression
15753 equality-expression == relational-expression
15754 equality-expression != relational-expression
15755 (<a href="#6.5.10">6.5.10</a>) AND-expression:
15756 equality-expression
15757 AND-expression &amp; equality-expression
15758 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
15759 AND-expression
15760 exclusive-OR-expression ^ AND-expression
15761 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
15762 exclusive-OR-expression
15763 inclusive-OR-expression | exclusive-OR-expression
15764 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
15765 inclusive-OR-expression
15766 logical-AND-expression &amp;&amp; inclusive-OR-expression
15767 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
15768 logical-AND-expression
15769 logical-OR-expression || logical-AND-expression
15770 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
15771 logical-OR-expression
15772 logical-OR-expression ? expression : conditional-expression
15774 [<a name="p410" href="#p410">page 410</a>] (<a href="#Contents">Contents</a>)
15776 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
15777 conditional-expression
15778 unary-expression assignment-operator assignment-expression
15779 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
15780 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
15781 (<a href="#6.5.17">6.5.17</a>) expression:
15782 assignment-expression
15783 expression , assignment-expression
15784 (<a href="#6.6">6.6</a>) constant-expression:
15785 conditional-expression
15786 <a name="A.2.2" href="#A.2.2"><b>A.2.2 Declarations</b></a>
15787 (<a href="#6.7">6.7</a>) declaration:
15788 declaration-specifiers init-declarator-listopt ;
15789 (<a href="#6.7">6.7</a>) declaration-specifiers:
15790 storage-class-specifier declaration-specifiersopt
15791 type-specifier declaration-specifiersopt
15792 type-qualifier declaration-specifiersopt
15793 function-specifier declaration-specifiersopt
15794 (<a href="#6.7">6.7</a>) init-declarator-list:
15795 init-declarator
15796 init-declarator-list , init-declarator
15797 (<a href="#6.7">6.7</a>) init-declarator:
15798 declarator
15799 declarator = initializer
15800 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
15801 typedef
15802 extern
15803 static
15804 auto
15805 register
15807 [<a name="p411" href="#p411">page 411</a>] (<a href="#Contents">Contents</a>)
15809 (<a href="#6.7.2">6.7.2</a>) type-specifier:
15810 void
15811 char
15812 short
15814 long
15815 float
15816 double
15817 signed
15818 unsigned
15819 _Bool
15820 _Complex
15821 struct-or-union-specifier *
15822 enum-specifier
15823 typedef-name
15824 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
15825 struct-or-union identifieropt { struct-declaration-list }
15826 struct-or-union identifier
15827 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
15828 struct
15829 union
15830 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
15831 struct-declaration
15832 struct-declaration-list struct-declaration
15833 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
15834 specifier-qualifier-list struct-declarator-list ;
15835 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
15836 type-specifier specifier-qualifier-listopt
15837 type-qualifier specifier-qualifier-listopt
15838 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
15839 struct-declarator
15840 struct-declarator-list , struct-declarator
15841 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
15842 declarator
15843 declaratoropt : constant-expression
15845 [<a name="p412" href="#p412">page 412</a>] (<a href="#Contents">Contents</a>)
15847 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
15848 enum identifieropt { enumerator-list }
15849 enum identifieropt { enumerator-list , }
15850 enum identifier
15851 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
15852 enumerator
15853 enumerator-list , enumerator
15854 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
15855 enumeration-constant
15856 enumeration-constant = constant-expression
15857 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
15858 const
15859 restrict
15860 volatile
15861 (<a href="#6.7.4">6.7.4</a>) function-specifier:
15862 inline
15863 (<a href="#6.7.5">6.7.5</a>) declarator:
15864 pointeropt direct-declarator
15865 (<a href="#6.7.5">6.7.5</a>) direct-declarator:
15866 identifier
15867 ( declarator )
15868 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
15869 direct-declarator [ static type-qualifier-listopt assignment-expression ]
15870 direct-declarator [ type-qualifier-list static assignment-expression ]
15871 direct-declarator [ type-qualifier-listopt * ]
15872 direct-declarator ( parameter-type-list )
15873 direct-declarator ( identifier-listopt )
15874 (<a href="#6.7.5">6.7.5</a>) pointer:
15875 * type-qualifier-listopt
15876 * type-qualifier-listopt pointer
15877 (<a href="#6.7.5">6.7.5</a>) type-qualifier-list:
15878 type-qualifier
15879 type-qualifier-list type-qualifier
15880 (<a href="#6.7.5">6.7.5</a>) parameter-type-list:
15881 parameter-list
15882 parameter-list , ...
15884 [<a name="p413" href="#p413">page 413</a>] (<a href="#Contents">Contents</a>)
15886 (<a href="#6.7.5">6.7.5</a>) parameter-list:
15887 parameter-declaration
15888 parameter-list , parameter-declaration
15889 (<a href="#6.7.5">6.7.5</a>) parameter-declaration:
15890 declaration-specifiers declarator
15891 declaration-specifiers abstract-declaratoropt
15892 (<a href="#6.7.5">6.7.5</a>) identifier-list:
15893 identifier
15894 identifier-list , identifier
15895 (<a href="#6.7.6">6.7.6</a>) type-name:
15896 specifier-qualifier-list abstract-declaratoropt
15897 (<a href="#6.7.6">6.7.6</a>) abstract-declarator:
15898 pointer
15899 pointeropt direct-abstract-declarator
15900 (<a href="#6.7.6">6.7.6</a>) direct-abstract-declarator:
15901 ( abstract-declarator )
15902 direct-abstract-declaratoropt [ type-qualifier-listopt
15903 assignment-expressionopt ]
15904 direct-abstract-declaratoropt [ static type-qualifier-listopt
15905 assignment-expression ]
15906 direct-abstract-declaratoropt [ type-qualifier-list static
15907 assignment-expression ]
15908 direct-abstract-declaratoropt [ * ]
15909 direct-abstract-declaratoropt ( parameter-type-listopt )
15910 (<a href="#6.7.7">6.7.7</a>) typedef-name:
15911 identifier
15912 (<a href="#6.7.8">6.7.8</a>) initializer:
15913 assignment-expression
15914 { initializer-list }
15915 { initializer-list , }
15916 (<a href="#6.7.8">6.7.8</a>) initializer-list:
15917 designationopt initializer
15918 initializer-list , designationopt initializer
15919 (<a href="#6.7.8">6.7.8</a>) designation:
15920 designator-list =
15922 [<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
15924 (<a href="#6.7.8">6.7.8</a>) designator-list:
15925 designator
15926 designator-list designator
15927 (<a href="#6.7.8">6.7.8</a>) designator:
15928 [ constant-expression ]
15929 . identifier
15930 <a name="A.2.3" href="#A.2.3"><b>A.2.3 Statements</b></a>
15931 (<a href="#6.8">6.8</a>) statement:
15932 labeled-statement
15933 compound-statement
15934 expression-statement
15935 selection-statement
15936 iteration-statement
15937 jump-statement
15938 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
15939 identifier : statement
15940 case constant-expression : statement
15941 default : statement
15942 (<a href="#6.8.2">6.8.2</a>) compound-statement:
15943 { block-item-listopt }
15944 (<a href="#6.8.2">6.8.2</a>) block-item-list:
15945 block-item
15946 block-item-list block-item
15947 (<a href="#6.8.2">6.8.2</a>) block-item:
15948 declaration
15949 statement
15950 (<a href="#6.8.3">6.8.3</a>) expression-statement:
15951 expressionopt ;
15952 (<a href="#6.8.4">6.8.4</a>) selection-statement:
15953 if ( expression ) statement
15954 if ( expression ) statement else statement
15955 switch ( expression ) statement
15957 [<a name="p415" href="#p415">page 415</a>] (<a href="#Contents">Contents</a>)
15959 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
15960 while ( expression ) statement
15961 do statement while ( expression ) ;
15962 for ( expressionopt ; expressionopt ; expressionopt ) statement
15963 for ( declaration expressionopt ; expressionopt ) statement
15964 (<a href="#6.8.6">6.8.6</a>) jump-statement:
15965 goto identifier ;
15966 continue ;
15967 break ;
15968 return expressionopt ;
15969 <a name="A.2.4" href="#A.2.4"><b>A.2.4 External definitions</b></a>
15970 (<a href="#6.9">6.9</a>) translation-unit:
15971 external-declaration
15972 translation-unit external-declaration
15973 (<a href="#6.9">6.9</a>) external-declaration:
15974 function-definition
15975 declaration
15976 (<a href="#6.9.1">6.9.1</a>) function-definition:
15977 declaration-specifiers declarator declaration-listopt compound-statement
15978 (<a href="#6.9.1">6.9.1</a>) declaration-list:
15979 declaration
15980 declaration-list declaration
15981 <a name="A.3" href="#A.3"><b>A.3 Preprocessing directives</b></a>
15982 (<a href="#6.10">6.10</a>) preprocessing-file:
15983 groupopt
15984 (<a href="#6.10">6.10</a>) group:
15985 group-part
15986 group group-part
15987 (<a href="#6.10">6.10</a>) group-part:
15988 if-section
15989 control-line
15990 text-line
15991 # non-directive
15992 (<a href="#6.10">6.10</a>) if-section:
15993 if-group elif-groupsopt else-groupopt endif-line
15995 [<a name="p416" href="#p416">page 416</a>] (<a href="#Contents">Contents</a>)
15997 (<a href="#6.10">6.10</a>) if-group:
15998 # if constant-expression new-line groupopt
15999 # ifdef identifier new-line groupopt
16000 # ifndef identifier new-line groupopt
16001 (<a href="#6.10">6.10</a>) elif-groups:
16002 elif-group
16003 elif-groups elif-group
16004 (<a href="#6.10">6.10</a>) elif-group:
16005 # elif constant-expression new-line groupopt
16006 (<a href="#6.10">6.10</a>) else-group:
16007 # else new-line groupopt
16008 (<a href="#6.10">6.10</a>) endif-line:
16009 # endif new-line
16010 (<a href="#6.10">6.10</a>) control-line:
16011 # include pp-tokens new-line
16012 # define identifier replacement-list new-line
16013 # define identifier lparen identifier-listopt )
16014 replacement-list new-line
16015 # define identifier lparen ... ) replacement-list new-line
16016 # define identifier lparen identifier-list , ... )
16017 replacement-list new-line
16018 # undef identifier new-line
16019 # line pp-tokens new-line
16020 # error pp-tokensopt new-line
16021 # pragma pp-tokensopt new-line
16022 # new-line
16023 (<a href="#6.10">6.10</a>) text-line:
16024 pp-tokensopt new-line
16025 (<a href="#6.10">6.10</a>) non-directive:
16026 pp-tokens new-line
16027 (<a href="#6.10">6.10</a>) lparen:
16028 a ( character not immediately preceded by white-space
16029 (<a href="#6.10">6.10</a>) replacement-list:
16030 pp-tokensopt
16032 [<a name="p417" href="#p417">page 417</a>] (<a href="#Contents">Contents</a>)
16034 (<a href="#6.10">6.10</a>) pp-tokens:
16035 preprocessing-token
16036 pp-tokens preprocessing-token
16037 (<a href="#6.10">6.10</a>) new-line:
16038 the new-line character
16040 [<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
16042 <a name="B" href="#B"><b> Annex B</b></a>
16043 (informative)
16044 Library summary
16045 <a name="B.1" href="#B.1"><b>B.1 Diagnostics &lt;assert.h&gt;</b></a>
16046 NDEBUG
16047 void assert(scalar expression);
16048 <a name="B.2" href="#B.2"><b>B.2 Complex &lt;complex.h&gt;</b></a>
16049 complex imaginary I
16050 _Complex_I _Imaginary_I
16051 #pragma STDC CX_LIMITED_RANGE on-off-switch
16052 double complex cacos(double complex z);
16053 float complex cacosf(float complex z);
16054 long double complex cacosl(long double complex z);
16055 double complex casin(double complex z);
16056 float complex casinf(float complex z);
16057 long double complex casinl(long double complex z);
16058 double complex catan(double complex z);
16059 float complex catanf(float complex z);
16060 long double complex catanl(long double complex z);
16061 double complex ccos(double complex z);
16062 float complex ccosf(float complex z);
16063 long double complex ccosl(long double complex z);
16064 double complex csin(double complex z);
16065 float complex csinf(float complex z);
16066 long double complex csinl(long double complex z);
16067 double complex ctan(double complex z);
16068 float complex ctanf(float complex z);
16069 long double complex ctanl(long double complex z);
16070 double complex cacosh(double complex z);
16071 float complex cacoshf(float complex z);
16072 long double complex cacoshl(long double complex z);
16073 double complex casinh(double complex z);
16074 float complex casinhf(float complex z);
16075 long double complex casinhl(long double complex z);
16076 double complex catanh(double complex z);
16077 float complex catanhf(float complex z);
16078 long double complex catanhl(long double complex z);
16080 [<a name="p419" href="#p419">page 419</a>] (<a href="#Contents">Contents</a>)
16082 double complex ccosh(double complex z);
16083 float complex ccoshf(float complex z);
16084 long double complex ccoshl(long double complex z);
16085 double complex csinh(double complex z);
16086 float complex csinhf(float complex z);
16087 long double complex csinhl(long double complex z);
16088 double complex ctanh(double complex z);
16089 float complex ctanhf(float complex z);
16090 long double complex ctanhl(long double complex z);
16091 double complex cexp(double complex z);
16092 float complex cexpf(float complex z);
16093 long double complex cexpl(long double complex z);
16094 double complex clog(double complex z);
16095 float complex clogf(float complex z);
16096 long double complex clogl(long double complex z);
16097 double cabs(double complex z);
16098 float cabsf(float complex z);
16099 long double cabsl(long double complex z);
16100 double complex cpow(double complex x, double complex y);
16101 float complex cpowf(float complex x, float complex y);
16102 long double complex cpowl(long double complex x,
16103 long double complex y);
16104 double complex csqrt(double complex z);
16105 float complex csqrtf(float complex z);
16106 long double complex csqrtl(long double complex z);
16107 double carg(double complex z);
16108 float cargf(float complex z);
16109 long double cargl(long double complex z);
16110 double cimag(double complex z);
16111 float cimagf(float complex z);
16112 long double cimagl(long double complex z);
16113 double complex conj(double complex z);
16114 float complex conjf(float complex z);
16115 long double complex conjl(long double complex z);
16116 double complex cproj(double complex z);
16117 float complex cprojf(float complex z);
16118 long double complex cprojl(long double complex z);
16119 double creal(double complex z);
16120 float crealf(float complex z);
16121 long double creall(long double complex z);
16123 [<a name="p420" href="#p420">page 420</a>] (<a href="#Contents">Contents</a>)
16125 <a name="B.3" href="#B.3"><b>B.3 Character handling &lt;ctype.h&gt;</b></a>
16126 int isalnum(int c);
16127 int isalpha(int c);
16128 int isblank(int c);
16129 int iscntrl(int c);
16130 int isdigit(int c);
16131 int isgraph(int c);
16132 int islower(int c);
16133 int isprint(int c);
16134 int ispunct(int c);
16135 int isspace(int c);
16136 int isupper(int c);
16137 int isxdigit(int c);
16138 int tolower(int c);
16139 int toupper(int c);
16140 <a name="B.4" href="#B.4"><b>B.4 Errors &lt;errno.h&gt;</b></a>
16141 EDOM EILSEQ ERANGE errno
16142 <a name="B.5" href="#B.5"><b>B.5 Floating-point environment &lt;fenv.h&gt;</b></a>
16143 fenv_t FE_OVERFLOW FE_TOWARDZERO
16144 fexcept_t FE_UNDERFLOW FE_UPWARD
16145 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
16146 FE_INEXACT FE_DOWNWARD
16147 FE_INVALID FE_TONEAREST
16148 #pragma STDC FENV_ACCESS on-off-switch
16149 int feclearexcept(int excepts);
16150 int fegetexceptflag(fexcept_t *flagp, int excepts);
16151 int feraiseexcept(int excepts);
16152 int fesetexceptflag(const fexcept_t *flagp,
16153 int excepts);
16154 int fetestexcept(int excepts);
16155 int fegetround(void);
16156 int fesetround(int round);
16157 int fegetenv(fenv_t *envp);
16158 int feholdexcept(fenv_t *envp);
16159 int fesetenv(const fenv_t *envp);
16160 int feupdateenv(const fenv_t *envp);
16162 [<a name="p421" href="#p421">page 421</a>] (<a href="#Contents">Contents</a>)
16164 <a name="B.6" href="#B.6"><b>B.6 Characteristics of floating types &lt;float.h&gt;</b></a>
16165 FLT_ROUNDS DBL_MIN_EXP FLT_MAX
16166 FLT_EVAL_METHOD LDBL_MIN_EXP DBL_MAX
16167 FLT_RADIX FLT_MIN_10_EXP LDBL_MAX
16168 FLT_MANT_DIG DBL_MIN_10_EXP FLT_EPSILON
16169 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_EPSILON
16170 LDBL_MANT_DIG FLT_MAX_EXP LDBL_EPSILON
16171 DECIMAL_DIG DBL_MAX_EXP FLT_MIN
16172 FLT_DIG LDBL_MAX_EXP DBL_MIN
16173 DBL_DIG FLT_MAX_10_EXP LDBL_MIN
16174 LDBL_DIG DBL_MAX_10_EXP
16175 FLT_MIN_EXP LDBL_MAX_10_EXP
16176 <a name="B.7" href="#B.7"><b>B.7 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
16177 imaxdiv_t
16178 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
16179 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
16180 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
16181 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
16182 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
16183 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
16184 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
16185 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
16186 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
16187 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
16188 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
16189 intmax_t imaxabs(intmax_t j);
16190 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
16191 intmax_t strtoimax(const char * restrict nptr,
16192 char ** restrict endptr, int base);
16193 uintmax_t strtoumax(const char * restrict nptr,
16194 char ** restrict endptr, int base);
16195 intmax_t wcstoimax(const wchar_t * restrict nptr,
16196 wchar_t ** restrict endptr, int base);
16197 uintmax_t wcstoumax(const wchar_t * restrict nptr,
16198 wchar_t ** restrict endptr, int base);
16200 [<a name="p422" href="#p422">page 422</a>] (<a href="#Contents">Contents</a>)
16202 <a name="B.8" href="#B.8"><b>B.8 Alternative spellings &lt;iso646.h&gt;</b></a>
16203 and bitor not_eq xor
16204 and_eq compl or xor_eq
16205 bitand not or_eq
16206 <a name="B.9" href="#B.9"><b>B.9 Sizes of integer types &lt;limits.h&gt;</b></a>
16207 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
16208 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
16209 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
16210 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
16211 CHAR_MIN USHRT_MAX LONG_MAX
16212 <a name="B.10" href="#B.10"><b>B.10 Localization &lt;locale.h&gt;</b></a>
16213 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
16214 NULL LC_COLLATE LC_MONETARY LC_TIME
16215 char *setlocale(int category, const char *locale);
16216 struct lconv *localeconv(void);
16217 <a name="B.11" href="#B.11"><b>B.11 Mathematics &lt;math.h&gt;</b></a>
16218 float_t FP_INFINITE FP_FAST_FMAL
16219 double_t FP_NAN FP_ILOGB0
16220 HUGE_VAL FP_NORMAL FP_ILOGBNAN
16221 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
16222 HUGE_VALL FP_ZERO MATH_ERREXCEPT
16223 INFINITY FP_FAST_FMA math_errhandling
16224 NAN FP_FAST_FMAF
16225 #pragma STDC FP_CONTRACT on-off-switch
16226 int fpclassify(real-floating x);
16227 int isfinite(real-floating x);
16228 int isinf(real-floating x);
16229 int isnan(real-floating x);
16230 int isnormal(real-floating x);
16231 int signbit(real-floating x);
16232 double acos(double x);
16233 float acosf(float x);
16234 long double acosl(long double x);
16235 double asin(double x);
16236 float asinf(float x);
16237 long double asinl(long double x);
16238 double atan(double x);
16240 [<a name="p423" href="#p423">page 423</a>] (<a href="#Contents">Contents</a>)
16242 float atanf(float x);
16243 long double atanl(long double x);
16244 double atan2(double y, double x);
16245 float atan2f(float y, float x);
16246 long double atan2l(long double y, long double x);
16247 double cos(double x);
16248 float cosf(float x);
16249 long double cosl(long double x);
16250 double sin(double x);
16251 float sinf(float x);
16252 long double sinl(long double x);
16253 double tan(double x);
16254 float tanf(float x);
16255 long double tanl(long double x);
16256 double acosh(double x);
16257 float acoshf(float x);
16258 long double acoshl(long double x);
16259 double asinh(double x);
16260 float asinhf(float x);
16261 long double asinhl(long double x);
16262 double atanh(double x);
16263 float atanhf(float x);
16264 long double atanhl(long double x);
16265 double cosh(double x);
16266 float coshf(float x);
16267 long double coshl(long double x);
16268 double sinh(double x);
16269 float sinhf(float x);
16270 long double sinhl(long double x);
16271 double tanh(double x);
16272 float tanhf(float x);
16273 long double tanhl(long double x);
16274 double exp(double x);
16275 float expf(float x);
16276 long double expl(long double x);
16277 double exp2(double x);
16278 float exp2f(float x);
16279 long double exp2l(long double x);
16280 double expm1(double x);
16281 float expm1f(float x);
16282 long double expm1l(long double x);
16284 [<a name="p424" href="#p424">page 424</a>] (<a href="#Contents">Contents</a>)
16286 double frexp(double value, int *exp);
16287 float frexpf(float value, int *exp);
16288 long double frexpl(long double value, int *exp);
16289 int ilogb(double x);
16290 int ilogbf(float x);
16291 int ilogbl(long double x);
16292 double ldexp(double x, int exp);
16293 float ldexpf(float x, int exp);
16294 long double ldexpl(long double x, int exp);
16295 double log(double x);
16296 float logf(float x);
16297 long double logl(long double x);
16298 double log10(double x);
16299 float log10f(float x);
16300 long double log10l(long double x);
16301 double log1p(double x);
16302 float log1pf(float x);
16303 long double log1pl(long double x);
16304 double log2(double x);
16305 float log2f(float x);
16306 long double log2l(long double x);
16307 double logb(double x);
16308 float logbf(float x);
16309 long double logbl(long double x);
16310 double modf(double value, double *iptr);
16311 float modff(float value, float *iptr);
16312 long double modfl(long double value, long double *iptr);
16313 double scalbn(double x, int n);
16314 float scalbnf(float x, int n);
16315 long double scalbnl(long double x, int n);
16316 double scalbln(double x, long int n);
16317 float scalblnf(float x, long int n);
16318 long double scalblnl(long double x, long int n);
16319 double cbrt(double x);
16320 float cbrtf(float x);
16321 long double cbrtl(long double x);
16322 double fabs(double x);
16323 float fabsf(float x);
16324 long double fabsl(long double x);
16325 double hypot(double x, double y);
16326 float hypotf(float x, float y);
16328 [<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
16330 long double hypotl(long double x, long double y);
16331 double pow(double x, double y);
16332 float powf(float x, float y);
16333 long double powl(long double x, long double y);
16334 double sqrt(double x);
16335 float sqrtf(float x);
16336 long double sqrtl(long double x);
16337 double erf(double x);
16338 float erff(float x);
16339 long double erfl(long double x);
16340 double erfc(double x);
16341 float erfcf(float x);
16342 long double erfcl(long double x);
16343 double lgamma(double x);
16344 float lgammaf(float x);
16345 long double lgammal(long double x);
16346 double tgamma(double x);
16347 float tgammaf(float x);
16348 long double tgammal(long double x);
16349 double ceil(double x);
16350 float ceilf(float x);
16351 long double ceill(long double x);
16352 double floor(double x);
16353 float floorf(float x);
16354 long double floorl(long double x);
16355 double nearbyint(double x);
16356 float nearbyintf(float x);
16357 long double nearbyintl(long double x);
16358 double rint(double x);
16359 float rintf(float x);
16360 long double rintl(long double x);
16361 long int lrint(double x);
16362 long int lrintf(float x);
16363 long int lrintl(long double x);
16364 long long int llrint(double x);
16365 long long int llrintf(float x);
16366 long long int llrintl(long double x);
16367 double round(double x);
16368 float roundf(float x);
16369 long double roundl(long double x);
16370 long int lround(double x);
16372 [<a name="p426" href="#p426">page 426</a>] (<a href="#Contents">Contents</a>)
16374 long int lroundf(float x);
16375 long int lroundl(long double x);
16376 long long int llround(double x);
16377 long long int llroundf(float x);
16378 long long int llroundl(long double x);
16379 double trunc(double x);
16380 float truncf(float x);
16381 long double truncl(long double x);
16382 double fmod(double x, double y);
16383 float fmodf(float x, float y);
16384 long double fmodl(long double x, long double y);
16385 double remainder(double x, double y);
16386 float remainderf(float x, float y);
16387 long double remainderl(long double x, long double y);
16388 double remquo(double x, double y, int *quo);
16389 float remquof(float x, float y, int *quo);
16390 long double remquol(long double x, long double y,
16391 int *quo);
16392 double copysign(double x, double y);
16393 float copysignf(float x, float y);
16394 long double copysignl(long double x, long double y);
16395 double nan(const char *tagp);
16396 float nanf(const char *tagp);
16397 long double nanl(const char *tagp);
16398 double nextafter(double x, double y);
16399 float nextafterf(float x, float y);
16400 long double nextafterl(long double x, long double y);
16401 double nexttoward(double x, long double y);
16402 float nexttowardf(float x, long double y);
16403 long double nexttowardl(long double x, long double y);
16404 double fdim(double x, double y);
16405 float fdimf(float x, float y);
16406 long double fdiml(long double x, long double y);
16407 double fmax(double x, double y);
16408 float fmaxf(float x, float y);
16409 long double fmaxl(long double x, long double y);
16410 double fmin(double x, double y);
16411 float fminf(float x, float y);
16412 long double fminl(long double x, long double y);
16413 double fma(double x, double y, double z);
16414 float fmaf(float x, float y, float z);
16416 [<a name="p427" href="#p427">page 427</a>] (<a href="#Contents">Contents</a>)
16418 long double fmal(long double x, long double y,
16419 long double z);
16420 int isgreater(real-floating x, real-floating y);
16421 int isgreaterequal(real-floating x, real-floating y);
16422 int isless(real-floating x, real-floating y);
16423 int islessequal(real-floating x, real-floating y);
16424 int islessgreater(real-floating x, real-floating y);
16425 int isunordered(real-floating x, real-floating y);
16426 <a name="B.12" href="#B.12"><b>B.12 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
16427 jmp_buf
16428 int setjmp(jmp_buf env);
16429 void longjmp(jmp_buf env, int val);
16430 <a name="B.13" href="#B.13"><b>B.13 Signal handling &lt;signal.h&gt;</b></a>
16431 sig_atomic_t SIG_IGN SIGILL SIGTERM
16432 SIG_DFL SIGABRT SIGINT
16433 SIG_ERR SIGFPE SIGSEGV
16434 void (*signal(int sig, void (*func)(int)))(int);
16435 int raise(int sig);
16436 <a name="B.14" href="#B.14"><b>B.14 Variable arguments &lt;stdarg.h&gt;</b></a>
16437 va_list
16438 type va_arg(va_list ap, type);
16439 void va_copy(va_list dest, va_list src);
16440 void va_end(va_list ap);
16441 void va_start(va_list ap, parmN);
16442 <a name="B.15" href="#B.15"><b>B.15 Boolean type and values &lt;stdbool.h&gt;</b></a>
16443 bool
16444 true
16445 false
16446 __bool_true_false_are_defined
16448 [<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
16450 <a name="B.16" href="#B.16"><b>B.16 Common definitions &lt;stddef.h&gt;</b></a>
16451 ptrdiff_t size_t wchar_t NULL
16452 offsetof(type, member-designator)
16453 <a name="B.17" href="#B.17"><b>B.17 Integer types &lt;stdint.h&gt;</b></a>
16454 intN_t INT_LEASTN_MIN PTRDIFF_MAX
16455 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
16456 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
16457 uint_leastN_t INT_FASTN_MIN SIZE_MAX
16458 int_fastN_t INT_FASTN_MAX WCHAR_MIN
16459 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
16460 intptr_t INTPTR_MIN WINT_MIN
16461 uintptr_t INTPTR_MAX WINT_MAX
16462 intmax_t UINTPTR_MAX INTN_C(value)
16463 uintmax_t INTMAX_MIN UINTN_C(value)
16464 INTN_MIN INTMAX_MAX INTMAX_C(value)
16465 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
16466 UINTN_MAX PTRDIFF_MIN
16467 <a name="B.18" href="#B.18"><b>B.18 Input/output &lt;stdio.h&gt;</b></a>
16468 size_t _IOLBF FILENAME_MAX TMP_MAX
16469 FILE _IONBF L_tmpnam stderr
16470 fpos_t BUFSIZ SEEK_CUR stdin
16471 NULL EOF SEEK_END stdout
16472 _IOFBF FOPEN_MAX SEEK_SET
16473 int remove(const char *filename);
16474 int rename(const char *old, const char *new);
16475 FILE *tmpfile(void);
16476 char *tmpnam(char *s);
16477 int fclose(FILE *stream);
16478 int fflush(FILE *stream);
16479 FILE *fopen(const char * restrict filename,
16480 const char * restrict mode);
16481 FILE *freopen(const char * restrict filename,
16482 const char * restrict mode,
16483 FILE * restrict stream);
16484 void setbuf(FILE * restrict stream,
16485 char * restrict buf);
16487 [<a name="p429" href="#p429">page 429</a>] (<a href="#Contents">Contents</a>)
16489 int setvbuf(FILE * restrict stream,
16490 char * restrict buf,
16491 int mode, size_t size);
16492 int fprintf(FILE * restrict stream,
16493 const char * restrict format, ...);
16494 int fscanf(FILE * restrict stream,
16495 const char * restrict format, ...);
16496 int printf(const char * restrict format, ...);
16497 int scanf(const char * restrict format, ...);
16498 int snprintf(char * restrict s, size_t n,
16499 const char * restrict format, ...);
16500 int sprintf(char * restrict s,
16501 const char * restrict format, ...);
16502 int sscanf(const char * restrict s,
16503 const char * restrict format, ...);
16504 int vfprintf(FILE * restrict stream,
16505 const char * restrict format, va_list arg);
16506 int vfscanf(FILE * restrict stream,
16507 const char * restrict format, va_list arg);
16508 int vprintf(const char * restrict format, va_list arg);
16509 int vscanf(const char * restrict format, va_list arg);
16510 int vsnprintf(char * restrict s, size_t n,
16511 const char * restrict format, va_list arg);
16512 int vsprintf(char * restrict s,
16513 const char * restrict format, va_list arg);
16514 int vsscanf(const char * restrict s,
16515 const char * restrict format, va_list arg);
16516 int fgetc(FILE *stream);
16517 char *fgets(char * restrict s, int n,
16518 FILE * restrict stream);
16519 int fputc(int c, FILE *stream);
16520 int fputs(const char * restrict s,
16521 FILE * restrict stream);
16522 int getc(FILE *stream);
16523 int getchar(void);
16524 char *gets(char *s);
16525 int putc(int c, FILE *stream);
16526 int putchar(int c);
16527 int puts(const char *s);
16528 int ungetc(int c, FILE *stream);
16530 [<a name="p430" href="#p430">page 430</a>] (<a href="#Contents">Contents</a>)
16532 size_t fread(void * restrict ptr,
16533 size_t size, size_t nmemb,
16534 FILE * restrict stream);
16535 size_t fwrite(const void * restrict ptr,
16536 size_t size, size_t nmemb,
16537 FILE * restrict stream);
16538 int fgetpos(FILE * restrict stream,
16539 fpos_t * restrict pos);
16540 int fseek(FILE *stream, long int offset, int whence);
16541 int fsetpos(FILE *stream, const fpos_t *pos);
16542 long int ftell(FILE *stream);
16543 void rewind(FILE *stream);
16544 void clearerr(FILE *stream);
16545 int feof(FILE *stream);
16546 int ferror(FILE *stream);
16547 void perror(const char *s);
16548 <a name="B.19" href="#B.19"><b>B.19 General utilities &lt;stdlib.h&gt;</b></a>
16549 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
16550 wchar_t lldiv_t EXIT_SUCCESS
16551 div_t NULL RAND_MAX
16552 double atof(const char *nptr);
16553 int atoi(const char *nptr);
16554 long int atol(const char *nptr);
16555 long long int atoll(const char *nptr);
16556 double strtod(const char * restrict nptr,
16557 char ** restrict endptr);
16558 float strtof(const char * restrict nptr,
16559 char ** restrict endptr);
16560 long double strtold(const char * restrict nptr,
16561 char ** restrict endptr);
16562 long int strtol(const char * restrict nptr,
16563 char ** restrict endptr, int base);
16564 long long int strtoll(const char * restrict nptr,
16565 char ** restrict endptr, int base);
16566 unsigned long int strtoul(
16567 const char * restrict nptr,
16568 char ** restrict endptr, int base);
16570 [<a name="p431" href="#p431">page 431</a>] (<a href="#Contents">Contents</a>)
16572 unsigned long long int strtoull(
16573 const char * restrict nptr,
16574 char ** restrict endptr, int base);
16575 int rand(void);
16576 void srand(unsigned int seed);
16577 void *calloc(size_t nmemb, size_t size);
16578 void free(void *ptr);
16579 void *malloc(size_t size);
16580 void *realloc(void *ptr, size_t size);
16581 void abort(void);
16582 int atexit(void (*func)(void));
16583 void exit(int status);
16584 void _Exit(int status);
16585 char *getenv(const char *name);
16586 int system(const char *string);
16587 void *bsearch(const void *key, const void *base,
16588 size_t nmemb, size_t size,
16589 int (*compar)(const void *, const void *));
16590 void qsort(void *base, size_t nmemb, size_t size,
16591 int (*compar)(const void *, const void *));
16592 int abs(int j);
16593 long int labs(long int j);
16594 long long int llabs(long long int j);
16595 div_t div(int numer, int denom);
16596 ldiv_t ldiv(long int numer, long int denom);
16597 lldiv_t lldiv(long long int numer,
16598 long long int denom);
16599 int mblen(const char *s, size_t n);
16600 int mbtowc(wchar_t * restrict pwc,
16601 const char * restrict s, size_t n);
16602 int wctomb(char *s, wchar_t wchar);
16603 size_t mbstowcs(wchar_t * restrict pwcs,
16604 const char * restrict s, size_t n);
16605 size_t wcstombs(char * restrict s,
16606 const wchar_t * restrict pwcs, size_t n);
16608 [<a name="p432" href="#p432">page 432</a>] (<a href="#Contents">Contents</a>)
16610 <a name="B.20" href="#B.20"><b>B.20 String handling &lt;string.h&gt;</b></a>
16611 size_t
16612 NULL
16613 void *memcpy(void * restrict s1,
16614 const void * restrict s2, size_t n);
16615 void *memmove(void *s1, const void *s2, size_t n);
16616 char *strcpy(char * restrict s1,
16617 const char * restrict s2);
16618 char *strncpy(char * restrict s1,
16619 const char * restrict s2, size_t n);
16620 char *strcat(char * restrict s1,
16621 const char * restrict s2);
16622 char *strncat(char * restrict s1,
16623 const char * restrict s2, size_t n);
16624 int memcmp(const void *s1, const void *s2, size_t n);
16625 int strcmp(const char *s1, const char *s2);
16626 int strcoll(const char *s1, const char *s2);
16627 int strncmp(const char *s1, const char *s2, size_t n);
16628 size_t strxfrm(char * restrict s1,
16629 const char * restrict s2, size_t n);
16630 void *memchr(const void *s, int c, size_t n);
16631 char *strchr(const char *s, int c);
16632 size_t strcspn(const char *s1, const char *s2);
16633 char *strpbrk(const char *s1, const char *s2);
16634 char *strrchr(const char *s, int c);
16635 size_t strspn(const char *s1, const char *s2);
16636 char *strstr(const char *s1, const char *s2);
16637 char *strtok(char * restrict s1,
16638 const char * restrict s2);
16639 void *memset(void *s, int c, size_t n);
16640 char *strerror(int errnum);
16641 size_t strlen(const char *s);
16643 [<a name="p433" href="#p433">page 433</a>] (<a href="#Contents">Contents</a>)
16645 <a name="B.21" href="#B.21"><b>B.21 Type-generic math &lt;tgmath.h&gt;</b></a>
16646 acos sqrt fmod nextafter
16647 asin fabs frexp nexttoward
16648 atan atan2 hypot remainder
16649 acosh cbrt ilogb remquo
16650 asinh ceil ldexp rint
16651 atanh copysign lgamma round
16652 cos erf llrint scalbn
16653 sin erfc llround scalbln
16654 tan exp2 log10 tgamma
16655 cosh expm1 log1p trunc
16656 sinh fdim log2 carg
16657 tanh floor logb cimag
16658 exp fma lrint conj
16659 log fmax lround cproj
16660 pow fmin nearbyint creal
16661 <a name="B.22" href="#B.22"><b>B.22 Date and time &lt;time.h&gt;</b></a>
16662 NULL size_t time_t
16663 CLOCKS_PER_SEC clock_t struct tm
16664 clock_t clock(void);
16665 double difftime(time_t time1, time_t time0);
16666 time_t mktime(struct tm *timeptr);
16667 time_t time(time_t *timer);
16668 char *asctime(const struct tm *timeptr);
16669 char *ctime(const time_t *timer);
16670 struct tm *gmtime(const time_t *timer);
16671 struct tm *localtime(const time_t *timer);
16672 size_t strftime(char * restrict s,
16673 size_t maxsize,
16674 const char * restrict format,
16675 const struct tm * restrict timeptr);
16677 [<a name="p434" href="#p434">page 434</a>] (<a href="#Contents">Contents</a>)
16679 <a name="B.23" href="#B.23"><b>B.23 Extended multibyte/wide character utilities &lt;wchar.h&gt;</b></a>
16680 wchar_t wint_t WCHAR_MAX
16681 size_t struct tm WCHAR_MIN
16682 mbstate_t NULL WEOF
16683 int fwprintf(FILE * restrict stream,
16684 const wchar_t * restrict format, ...);
16685 int fwscanf(FILE * restrict stream,
16686 const wchar_t * restrict format, ...);
16687 int swprintf(wchar_t * restrict s, size_t n,
16688 const wchar_t * restrict format, ...);
16689 int swscanf(const wchar_t * restrict s,
16690 const wchar_t * restrict format, ...);
16691 int vfwprintf(FILE * restrict stream,
16692 const wchar_t * restrict format, va_list arg);
16693 int vfwscanf(FILE * restrict stream,
16694 const wchar_t * restrict format, va_list arg);
16695 int vswprintf(wchar_t * restrict s, size_t n,
16696 const wchar_t * restrict format, va_list arg);
16697 int vswscanf(const wchar_t * restrict s,
16698 const wchar_t * restrict format, va_list arg);
16699 int vwprintf(const wchar_t * restrict format,
16700 va_list arg);
16701 int vwscanf(const wchar_t * restrict format,
16702 va_list arg);
16703 int wprintf(const wchar_t * restrict format, ...);
16704 int wscanf(const wchar_t * restrict format, ...);
16705 wint_t fgetwc(FILE *stream);
16706 wchar_t *fgetws(wchar_t * restrict s, int n,
16707 FILE * restrict stream);
16708 wint_t fputwc(wchar_t c, FILE *stream);
16709 int fputws(const wchar_t * restrict s,
16710 FILE * restrict stream);
16711 int fwide(FILE *stream, int mode);
16712 wint_t getwc(FILE *stream);
16713 wint_t getwchar(void);
16714 wint_t putwc(wchar_t c, FILE *stream);
16715 wint_t putwchar(wchar_t c);
16716 wint_t ungetwc(wint_t c, FILE *stream);
16718 [<a name="p435" href="#p435">page 435</a>] (<a href="#Contents">Contents</a>)
16720 double wcstod(const wchar_t * restrict nptr,
16721 wchar_t ** restrict endptr);
16722 float wcstof(const wchar_t * restrict nptr,
16723 wchar_t ** restrict endptr);
16724 long double wcstold(const wchar_t * restrict nptr,
16725 wchar_t ** restrict endptr);
16726 long int wcstol(const wchar_t * restrict nptr,
16727 wchar_t ** restrict endptr, int base);
16728 long long int wcstoll(const wchar_t * restrict nptr,
16729 wchar_t ** restrict endptr, int base);
16730 unsigned long int wcstoul(const wchar_t * restrict nptr,
16731 wchar_t ** restrict endptr, int base);
16732 unsigned long long int wcstoull(
16733 const wchar_t * restrict nptr,
16734 wchar_t ** restrict endptr, int base);
16735 wchar_t *wcscpy(wchar_t * restrict s1,
16736 const wchar_t * restrict s2);
16737 wchar_t *wcsncpy(wchar_t * restrict s1,
16738 const wchar_t * restrict s2, size_t n);
16739 wchar_t *wmemcpy(wchar_t * restrict s1,
16740 const wchar_t * restrict s2, size_t n);
16741 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
16742 size_t n);
16743 wchar_t *wcscat(wchar_t * restrict s1,
16744 const wchar_t * restrict s2);
16745 wchar_t *wcsncat(wchar_t * restrict s1,
16746 const wchar_t * restrict s2, size_t n);
16747 int wcscmp(const wchar_t *s1, const wchar_t *s2);
16748 int wcscoll(const wchar_t *s1, const wchar_t *s2);
16749 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
16750 size_t n);
16751 size_t wcsxfrm(wchar_t * restrict s1,
16752 const wchar_t * restrict s2, size_t n);
16753 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
16754 size_t n);
16755 wchar_t *wcschr(const wchar_t *s, wchar_t c);
16756 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
16757 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); *
16758 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
16759 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
16760 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
16762 [<a name="p436" href="#p436">page 436</a>] (<a href="#Contents">Contents</a>)
16764 wchar_t *wcstok(wchar_t * restrict s1,
16765 const wchar_t * restrict s2,
16766 wchar_t ** restrict ptr);
16767 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
16768 size_t wcslen(const wchar_t *s);
16769 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
16770 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
16771 const wchar_t * restrict format,
16772 const struct tm * restrict timeptr);
16773 wint_t btowc(int c);
16774 int wctob(wint_t c);
16775 int mbsinit(const mbstate_t *ps);
16776 size_t mbrlen(const char * restrict s, size_t n,
16777 mbstate_t * restrict ps);
16778 size_t mbrtowc(wchar_t * restrict pwc,
16779 const char * restrict s, size_t n,
16780 mbstate_t * restrict ps);
16781 size_t wcrtomb(char * restrict s, wchar_t wc,
16782 mbstate_t * restrict ps);
16783 size_t mbsrtowcs(wchar_t * restrict dst,
16784 const char ** restrict src, size_t len,
16785 mbstate_t * restrict ps);
16786 size_t wcsrtombs(char * restrict dst,
16787 const wchar_t ** restrict src, size_t len,
16788 mbstate_t * restrict ps);
16789 <a name="B.24" href="#B.24"><b>B.24 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
16790 wint_t wctrans_t wctype_t WEOF
16791 int iswalnum(wint_t wc);
16792 int iswalpha(wint_t wc);
16793 int iswblank(wint_t wc);
16794 int iswcntrl(wint_t wc);
16795 int iswdigit(wint_t wc);
16796 int iswgraph(wint_t wc);
16797 int iswlower(wint_t wc);
16798 int iswprint(wint_t wc);
16799 int iswpunct(wint_t wc);
16800 int iswspace(wint_t wc);
16801 int iswupper(wint_t wc);
16802 int iswxdigit(wint_t wc);
16803 int iswctype(wint_t wc, wctype_t desc);
16805 [<a name="p437" href="#p437">page 437</a>] (<a href="#Contents">Contents</a>)
16807 wctype_t wctype(const char *property);
16808 wint_t towlower(wint_t wc);
16809 wint_t towupper(wint_t wc);
16810 wint_t towctrans(wint_t wc, wctrans_t desc);
16811 wctrans_t wctrans(const char *property);
16813 [<a name="p438" href="#p438">page 438</a>] (<a href="#Contents">Contents</a>)
16815 <a name="C" href="#C"><b> Annex C</b></a>
16816 (informative)
16817 Sequence points
16818 1 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
16819 -- The call to a function, after the arguments have been evaluated (<a href="#6.5.2.2">6.5.2.2</a>).
16820 -- The end of the first operand of the following operators: logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>);
16821 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>).
16822 -- The end of a full declarator: declarators (<a href="#6.7.5">6.7.5</a>);
16823 -- The end of a full expression: an initializer (<a href="#6.7.8">6.7.8</a>); the expression in an expression
16824 statement (<a href="#6.8.3">6.8.3</a>); the controlling expression of a selection statement (if or switch)
16825 (<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
16826 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the expression in a return statement
16827 (<a href="#6.8.6.4">6.8.6.4</a>).
16828 -- Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
16829 -- After the actions associated with each formatted input/output function conversion
16830 specifier (<a href="#7.19.6">7.19.6</a>, <a href="#7.24.2">7.24.2</a>).
16831 -- Immediately before and immediately after each call to a comparison function, and
16832 also between any call to a comparison function and any movement of the objects
16833 passed as arguments to that call (<a href="#7.20.5">7.20.5</a>).
16835 [<a name="p439" href="#p439">page 439</a>] (<a href="#Contents">Contents</a>)
16837 <a name="D" href="#D"><b> Annex D</b></a>
16838 (normative)
16839 Universal character names for identifiers
16840 1 This clause lists the hexadecimal code values that are valid in universal character names
16841 in identifiers.
16842 2 This table is reproduced unchanged from ISO/IEC TR 10176:1998, produced by ISO/IEC
16843 JTC 1/SC 22/WG 20, except for the omission of ranges that are part of the basic character
16844 sets.
16845 Latin: 00AA, 00BA, 00C0-00D6, 00D8-00F6, 00F8-01F5, 01FA-0217,
16846 0250-02A8, 1E00-1E9B, 1EA0-1EF9, 207F
16847 Greek: 0386, 0388-038A, 038C, 038E-03A1, 03A3-03CE, 03D0-03D6,
16848 03DA, 03DC, 03DE, 03E0, 03E2-03F3, 1F00-1F15, 1F18-1F1D,
16849 1F20-1F45, 1F48-1F4D, 1F50-1F57, 1F59, 1F5B, 1F5D,
16850 1F5F-1F7D, 1F80-1FB4, 1FB6-1FBC, 1FC2-1FC4, 1FC6-1FCC,
16851 1FD0-1FD3, 1FD6-1FDB, 1FE0-1FEC, 1FF2-1FF4, 1FF6-1FFC
16852 Cyrillic: 0401-040C, 040E-044F, 0451-045C, 045E-0481, 0490-04C4,
16853 04C7-04C8, 04CB-04CC, 04D0-04EB, 04EE-04F5, 04F8-04F9
16854 Armenian: 0531-0556, 0561-0587
16855 Hebrew: 05B0-05B9, 05BB-05BD, 05BF, 05C1-05C2, 05D0-05EA,
16856 05F0-05F2
16857 Arabic: 0621-063A, 0640-0652, 0670-06B7, 06BA-06BE, 06C0-06CE,
16858 06D0-06DC, 06E5-06E8, 06EA-06ED
16859 Devanagari: 0901-0903, 0905-0939, 093E-094D, 0950-0952, 0958-0963
16860 Bengali: 0981-0983, 0985-098C, 098F-0990, 0993-09A8, 09AA-09B0,
16861 09B2, 09B6-09B9, 09BE-09C4, 09C7-09C8, 09CB-09CD,
16862 09DC-09DD, 09DF-09E3, 09F0-09F1
16863 Gurmukhi: 0A02, 0A05-0A0A, 0A0F-0A10, 0A13-0A28, 0A2A-0A30,
16864 0A32-0A33, 0A35-0A36, 0A38-0A39, 0A3E-0A42, 0A47-0A48,
16865 0A4B-0A4D, 0A59-0A5C, 0A5E, 0A74
16866 Gujarati: 0A81-0A83, 0A85-0A8B, 0A8D, 0A8F-0A91, 0A93-0AA8,
16867 0AAA-0AB0, 0AB2-0AB3, 0AB5-0AB9, 0ABD-0AC5,
16868 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0
16869 Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
16870 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
16872 [<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
16874 0B5C-0B5D, 0B5F-0B61
16875 Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
16876 0B9C, 0B9E-0B9F, 0BA3-0BA4, 0BA8-0BAA, 0BAE-0BB5,
16877 0BB7-0BB9, 0BBE-0BC2, 0BC6-0BC8, 0BCA-0BCD
16878 Telugu: 0C01-0C03, 0C05-0C0C, 0C0E-0C10, 0C12-0C28, 0C2A-0C33,
16879 0C35-0C39, 0C3E-0C44, 0C46-0C48, 0C4A-0C4D, 0C60-0C61
16880 Kannada: 0C82-0C83, 0C85-0C8C, 0C8E-0C90, 0C92-0CA8, 0CAA-0CB3,
16881 0CB5-0CB9, 0CBE-0CC4, 0CC6-0CC8, 0CCA-0CCD, 0CDE,
16882 0CE0-0CE1
16883 Malayalam: 0D02-0D03, 0D05-0D0C, 0D0E-0D10, 0D12-0D28, 0D2A-0D39,
16884 0D3E-0D43, 0D46-0D48, 0D4A-0D4D, 0D60-0D61
16885 Thai: 0E01-0E3A, 0E40-0E5B
16886 Lao: 0E81-0E82, 0E84, 0E87-0E88, 0E8A, 0E8D, 0E94-0E97,
16887 0E99-0E9F, 0EA1-0EA3, 0EA5, 0EA7, 0EAA-0EAB,
16888 0EAD-0EAE, 0EB0-0EB9, 0EBB-0EBD, 0EC0-0EC4, 0EC6,
16889 0EC8-0ECD, 0EDC-0EDD
16890 Tibetan: 0F00, 0F18-0F19, 0F35, 0F37, 0F39, 0F3E-0F47, 0F49-0F69,
16891 0F71-0F84, 0F86-0F8B, 0F90-0F95, 0F97, 0F99-0FAD,
16892 0FB1-0FB7, 0FB9
16893 Georgian: 10A0-10C5, 10D0-10F6
16894 Hiragana: 3041-3093, 309B-309C
16895 Katakana: 30A1-30F6, 30FB-30FC
16896 Bopomofo: 3105-312C
16897 CJK Unified Ideographs: 4E00-9FA5
16898 Hangul: AC00-D7A3
16899 Digits: 0660-0669, 06F0-06F9, 0966-096F, 09E6-09EF, 0A66-0A6F,
16900 0AE6-0AEF, 0B66-0B6F, 0BE7-0BEF, 0C66-0C6F, 0CE6-0CEF,
16901 0D66-0D6F, 0E50-0E59, 0ED0-0ED9, 0F20-0F33
16902 Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1,
16903 02E0-02E4, 037A, 0559, 093D, 0B3D, 1FBE, 203F-2040, 2102,
16904 2107, 210A-2113, 2115, 2118-211D, 2124, 2126, 2128, 212A-2131,
16905 2133-2138, 2160-2182, 3005-3007, 3021-3029
16907 [<a name="p441" href="#p441">page 441</a>] (<a href="#Contents">Contents</a>)
16909 <a name="E" href="#E"><b> Annex E</b></a>
16910 (informative)
16911 Implementation limits
16912 1 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
16913 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
16914 with the same sign. The values shall all be constant expressions suitable for use in #if
16915 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
16916 #define CHAR_BIT 8
16917 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
16918 #define CHAR_MIN 0 or SCHAR_MIN
16919 #define INT_MAX +32767
16920 #define INT_MIN -32767
16921 #define LONG_MAX +2147483647
16922 #define LONG_MIN -2147483647
16923 #define LLONG_MAX +9223372036854775807
16924 #define LLONG_MIN -9223372036854775807
16925 #define MB_LEN_MAX 1
16926 #define SCHAR_MAX +127
16927 #define SCHAR_MIN -127
16928 #define SHRT_MAX +32767
16929 #define SHRT_MIN -32767
16930 #define UCHAR_MAX 255
16931 #define USHRT_MAX 65535
16932 #define UINT_MAX 65535
16933 #define ULONG_MAX 4294967295
16934 #define ULLONG_MAX 18446744073709551615
16935 2 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
16936 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
16937 directives; all floating values shall be constant expressions. The components are
16938 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
16939 3 The values given in the following list shall be replaced by implementation-defined
16940 expressions:
16941 #define FLT_EVAL_METHOD
16942 #define FLT_ROUNDS
16943 4 The values given in the following list shall be replaced by implementation-defined
16944 constant expressions that are greater or equal in magnitude (absolute value) to those
16945 shown, with the same sign:
16947 [<a name="p442" href="#p442">page 442</a>] (<a href="#Contents">Contents</a>)
16949 #define DBL_DIG 10
16950 #define DBL_MANT_DIG
16951 #define DBL_MAX_10_EXP +37
16952 #define DBL_MAX_EXP
16953 #define DBL_MIN_10_EXP -37
16954 #define DBL_MIN_EXP
16955 #define DECIMAL_DIG 10
16956 #define FLT_DIG 6
16957 #define FLT_MANT_DIG
16958 #define FLT_MAX_10_EXP +37
16959 #define FLT_MAX_EXP
16960 #define FLT_MIN_10_EXP -37
16961 #define FLT_MIN_EXP
16962 #define FLT_RADIX 2
16963 #define LDBL_DIG 10
16964 #define LDBL_MANT_DIG
16965 #define LDBL_MAX_10_EXP +37
16966 #define LDBL_MAX_EXP
16967 #define LDBL_MIN_10_EXP -37
16968 #define LDBL_MIN_EXP
16969 5 The values given in the following list shall be replaced by implementation-defined
16970 constant expressions with values that are greater than or equal to those shown:
16971 #define DBL_MAX 1E+37
16972 #define FLT_MAX 1E+37
16973 #define LDBL_MAX 1E+37
16974 6 The values given in the following list shall be replaced by implementation-defined
16975 constant expressions with (positive) values that are less than or equal to those shown:
16976 #define DBL_EPSILON 1E-9
16977 #define DBL_MIN 1E-37
16978 #define FLT_EPSILON 1E-5
16979 #define FLT_MIN 1E-37
16980 #define LDBL_EPSILON 1E-9
16981 #define LDBL_MIN 1E-37
16983 [<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
16985 <a name="F" href="#F"><b> Annex F</b></a>
16986 (normative)
16987 IEC 60559 floating-point arithmetic
16988 <a name="F.1" href="#F.1"><b> F.1 Introduction</b></a>
16989 1 This annex specifies C language support for the IEC 60559 floating-point standard. The
16990 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
16991 microprocessor systems, second edition (IEC 60559:1989), previously designated
16992 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
16993 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
16994 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
16995 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
16996 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
16997 defines __STDC_IEC_559__ shall conform to the specifications in this annex. Where
16998 a binding between the C language and IEC 60559 is indicated, the IEC 60559-specified
16999 behavior is adopted by reference, unless stated otherwise.
17000 <a name="F.2" href="#F.2"><b> F.2 Types</b></a>
17001 1 The C floating types match the IEC 60559 formats as follows:
17002 -- The float type matches the IEC 60559 single format.
17003 -- The double type matches the IEC 60559 double format.
17004 -- The long double type matches an IEC 60559 extended format,<sup><a href="#note307"><b>307)</b></a></sup> else a
17005 non-IEC 60559 extended format, else the IEC 60559 double format.
17006 Any non-IEC 60559 extended format used for the long double type shall have more
17007 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note308"><b>308)</b></a></sup>
17008 Recommended practice
17009 2 The long double type should match an IEC 60559 extended format.
17014 <sup><a name="note307" href="#note307"><b>307)</b></a></sup> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
17015 and quadruple 128-bit IEC 60559 formats.
17016 <sup><a name="note308" href="#note308"><b>308)</b></a></sup> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
17017 all double values.
17019 [<a name="p444" href="#p444">page 444</a>] (<a href="#Contents">Contents</a>)
17021 <a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
17022 1 This specification does not define the behavior of signaling NaNs.<sup><a href="#note309"><b>309)</b></a></sup> It generally uses
17023 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
17024 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
17025 <a name="F.3" href="#F.3"><b> F.3 Operators and functions</b></a>
17026 1 C operators and functions provide IEC 60559 required and recommended facilities as
17027 listed below.
17028 -- The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
17029 divide operations.
17030 -- The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
17031 -- The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
17032 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
17033 with additional information.
17034 -- The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
17035 floating-point number to an integer value (in the same precision). The nearbyint
17036 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
17037 Appendix to ANSI/IEEE 854.
17038 -- The conversions for floating types provide the IEC 60559 conversions between
17039 floating-point precisions.
17040 -- The conversions from integer to floating types provide the IEC 60559 conversions
17041 from integer to floating point.
17042 -- The conversions from floating to integer types provide IEC 60559-like conversions
17043 but always round toward zero.
17044 -- The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
17045 conversions, which honor the directed rounding mode, from floating point to the
17046 long int and long long int integer formats. The lrint and llrint
17047 functions can be used to implement IEC 60559 conversions from floating to other
17048 integer formats.
17049 -- The translation time conversion of floating constants and the strtod, strtof,
17050 strtold, fprintf, fscanf, and related library functions in <a href="#7.20">&lt;stdlib.h&gt;</a>,
17051 <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
17052 strtold function in <a href="#7.20">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
17053 Appendix to ANSI/IEEE 854.
17055 <sup><a name="note309" href="#note309"><b>309)</b></a></sup> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
17056 sufficient for closure of the arithmetic.
17058 [<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
17060 -- The relational and equality operators provide IEC 60559 comparisons. IEC 60559
17061 identifies a need for additional comparison predicates to facilitate writing code that
17062 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
17063 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
17064 supplement the language operators to address this need. The islessgreater and
17065 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
17066 the unordered predicate recommended in the Appendix to IEC 60559.
17067 -- The feclearexcept, feraiseexcept, and fetestexcept functions in
17068 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
17069 exception status flags. The fegetexceptflag and fesetexceptflag
17070 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
17071 one time. These functions are used in conjunction with the type fexcept_t and the
17072 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
17073 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
17074 -- The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
17075 to select among the IEC 60559 directed rounding modes represented by the rounding
17076 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
17077 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
17078 IEC 60559 directed rounding modes.
17079 -- The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
17080 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
17081 the IEC 60559 status flags and control modes.
17082 -- The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
17083 recommended in the Appendix to IEC 60559.
17084 -- The unary minus (-) operator provides the minus (-) operation recommended in the
17085 Appendix to IEC 60559.
17086 -- The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
17087 recommended in the Appendix to IEC 60559.
17088 -- The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
17089 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
17090 -- The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
17091 function recommended in the Appendix to IEC 60559 (but with a minor change to
17092 better handle signed zeros).
17093 -- The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
17094 the Appendix to IEC 60559.
17095 -- The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
17096 Appendix to IEC 60559.
17098 [<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
17100 -- The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
17101 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
17102 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
17103 function recommended in the Appendix to IEC 60559 (except that the classification
17104 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
17105 <a name="F.4" href="#F.4"><b> F.4 Floating to integer conversion</b></a>
17106 1 If the floating value is infinite or NaN or if the integral part of the floating value exceeds
17107 the range of the integer type, then the ''invalid'' floating-point exception is raised and the
17108 resulting value is unspecified. Whether conversion of non-integer floating values whose
17109 integral part is within the range of the integer type raises the ''inexact'' floating-point
17110 exception is unspecified.<sup><a href="#note310"><b>310)</b></a></sup>
17111 <a name="F.5" href="#F.5"><b> F.5 Binary-decimal conversion</b></a>
17112 1 Conversion from the widest supported IEC 60559 format to decimal with
17113 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note311"><b>311)</b></a></sup>
17114 2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
17115 particular, conversion between any supported IEC 60559 format and decimal with
17116 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
17117 rounding mode), which assures that conversion from the widest supported IEC 60559
17118 format to decimal with DECIMAL_DIG digits and back is the identity function.
17119 3 Functions such as strtod that convert character sequences to floating types honor the
17120 rounding direction. Hence, if the rounding direction might be upward or downward, the
17121 implementation cannot convert a minus-signed sequence by negating the converted
17122 unsigned sequence.
17127 <sup><a name="note310" href="#note310"><b>310)</b></a></sup> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
17128 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
17129 cases where it matters, library functions can be used to effect such conversions with or without raising
17130 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
17131 <a href="#7.12">&lt;math.h&gt;</a>.
17132 <sup><a name="note311" href="#note311"><b>311)</b></a></sup> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
17133 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
17134 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
17135 DBL_DIG are 18 and 15, respectively, for these formats.)
17137 [<a name="p447" href="#p447">page 447</a>] (<a href="#Contents">Contents</a>)
17139 <a name="F.6" href="#F.6"><b> F.6 Contracted expressions</b></a>
17140 1 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
17141 rounding directions in a manner consistent with the basic arithmetic operations covered
17142 by IEC 60559.
17143 Recommended practice
17144 2 A contracted expression should raise floating-point exceptions in a manner generally
17145 consistent with the basic arithmetic operations. A contracted expression should deliver
17146 the same value as its uncontracted counterpart, else should be correctly rounded (once).
17147 <a name="F.7" href="#F.7"><b> F.7 Floating-point environment</b></a>
17148 1 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
17149 point exception status flags and directed-rounding control modes. It includes also
17150 IEC 60559 dynamic rounding precision and trap enablement modes, if the
17151 implementation supports them.<sup><a href="#note312"><b>312)</b></a></sup>
17152 <a name="F.7.1" href="#F.7.1"><b> F.7.1 Environment management</b></a>
17153 1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
17154 status flags, and that rounding control modes can be set explicitly to affect result values of
17155 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
17156 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
17157 which respect sequence points.<sup><a href="#note313"><b>313)</b></a></sup>
17158 <a name="F.7.2" href="#F.7.2"><b> F.7.2 Translation</b></a>
17159 1 During translation the IEC 60559 default modes are in effect:
17160 -- The rounding direction mode is rounding to nearest.
17161 -- The rounding precision mode (if supported) is set so that results are not shortened.
17162 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
17163 Recommended practice
17164 2 The implementation should produce a diagnostic message for each translation-time
17169 <sup><a name="note312" href="#note312"><b>312)</b></a></sup> This specification does not require dynamic rounding precision nor trap enablement modes.
17170 <sup><a name="note313" href="#note313"><b>313)</b></a></sup> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
17171 point control modes will be the default ones and the floating-point status flags will not be tested,
17172 which allows certain optimizations (see <a href="#F.8">F.8</a>).
17174 [<a name="p448" href="#p448">page 448</a>] (<a href="#Contents">Contents</a>)
17176 floating-point exception, other than ''inexact'';<sup><a href="#note314"><b>314)</b></a></sup> the implementation should then
17177 proceed with the translation of the program.
17178 <a name="F.7.3" href="#F.7.3"><b> F.7.3 Execution</b></a>
17179 1 At program startup the floating-point environment is initialized as prescribed by
17180 IEC 60559:
17181 -- All floating-point exception status flags are cleared.
17182 -- The rounding direction mode is rounding to nearest.
17183 -- The dynamic rounding precision mode (if supported) is set so that results are not
17184 shortened.
17185 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
17186 <a name="F.7.4" href="#F.7.4"><b> F.7.4 Constant expressions</b></a>
17187 1 An arithmetic constant expression of floating type, other than one in an initializer for an
17188 object that has static storage duration, is evaluated (as if) during execution; thus, it is
17189 affected by any operative floating-point control modes and raises floating-point
17190 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
17191 is ''on'').<sup><a href="#note315"><b>315)</b></a></sup>
17192 2 EXAMPLE
17193 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17194 #pragma STDC FENV_ACCESS ON
17195 void f(void)
17197 float w[] = { 0.0/0.0 }; // raises an exception
17198 static float x = 0.0/0.0; // does not raise an exception
17199 float y = 0.0/0.0; // raises an exception
17200 double z = 0.0/0.0; // raises an exception
17201 /* ... */
17203 3 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
17204 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
17207 <sup><a name="note314" href="#note314"><b>314)</b></a></sup> As floating constants are converted to appropriate internal representations at translation time, their
17208 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
17209 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
17210 strtod, provide execution-time conversion of numeric strings.
17211 <sup><a name="note315" href="#note315"><b>315)</b></a></sup> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
17212 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
17213 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
17214 efficiency of translation-time evaluation through static initialization, such as
17215 const static double one_third = 1.0/3.0;
17217 [<a name="p449" href="#p449">page 449</a>] (<a href="#Contents">Contents</a>)
17219 execution time.
17221 <a name="F.7.5" href="#F.7.5"><b> F.7.5 Initialization</b></a>
17222 1 All computation for automatic initialization is done (as if) at execution time; thus, it is
17223 affected by any operative modes and raises floating-point exceptions as required by
17224 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
17225 for initialization of objects that have static storage duration is done (as if) at translation
17226 time.
17227 2 EXAMPLE
17228 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17229 #pragma STDC FENV_ACCESS ON
17230 void f(void)
17232 float u[] = { 1.1e75 }; // raises exceptions
17233 static float v = 1.1e75; // does not raise exceptions
17234 float w = 1.1e75; // raises exceptions
17235 double x = 1.1e75; // may raise exceptions
17236 float y = 1.1e75f; // may raise exceptions
17237 long double z = 1.1e75; // does not raise exceptions
17238 /* ... */
17240 3 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
17241 done at translation time. The automatic initialization of u and w require an execution-time conversion to
17242 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
17243 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
17244 conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note316"><b>316)</b></a></sup> The
17245 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
17246 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
17247 their internal representations occur at translation time in all cases.
17252 <sup><a name="note316" href="#note316"><b>316)</b></a></sup> Use of float_t and double_t variables increases the likelihood of translation-time computation.
17253 For example, the automatic initialization
17254 double_t x = 1.1e75;
17255 could be done at translation time, regardless of the expression evaluation method.
17257 [<a name="p450" href="#p450">page 450</a>] (<a href="#Contents">Contents</a>)
17259 <a name="F.7.6" href="#F.7.6"><b> F.7.6 Changing the environment</b></a>
17260 1 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
17261 change floating-point status flags and control modes just as indicated by their
17262 specifications (including conformance to IEC 60559). They do not change flags or modes
17263 (so as to be detectable by the user) in any other cases.
17264 2 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
17265 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
17266 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
17267 before ''inexact''.
17268 <a name="F.8" href="#F.8"><b> F.8 Optimization</b></a>
17269 1 This section identifies code transformations that might subvert IEC 60559-specified
17270 behavior, and others that do not.
17271 <a name="F.8.1" href="#F.8.1"><b> F.8.1 Global transformations</b></a>
17272 1 Floating-point arithmetic operations and external function calls may entail side effects
17273 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
17274 ''on''. The flags and modes in the floating-point environment may be regarded as global
17275 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
17276 flags.
17277 2 Concern about side effects may inhibit code motion and removal of seemingly useless
17278 code. For example, in
17279 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17280 #pragma STDC FENV_ACCESS ON
17281 void f(double x)
17283 /* ... */
17284 for (i = 0; i &lt; n; i++) x + 1;
17285 /* ... */
17287 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
17288 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
17289 course these optimizations are valid if the implementation can rule out the nettlesome
17290 cases.)
17291 3 This specification does not require support for trap handlers that maintain information
17292 about the order or count of floating-point exceptions. Therefore, between function calls,
17293 floating-point exceptions need not be precise: the actual order and number of occurrences
17294 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
17295 the preceding loop could be treated as
17297 [<a name="p451" href="#p451">page 451</a>] (<a href="#Contents">Contents</a>)
17299 if (0 &lt; n) x + 1;
17300 <a name="F.8.2" href="#F.8.2"><b> F.8.2 Expression transformations</b></a>
17301 1 x / 2 &lt;-&gt; x * 0.5 Although similar transformations involving inexact
17302 constants generally do not yield numerically equivalent
17303 expressions, if the constants are exact then such
17304 transformations can be made on IEC 60559 machines
17305 and others that round perfectly.
17306 1 * x and x / 1 -&gt; x The expressions 1 * x, x / 1, and x are equivalent
17307 (on IEC 60559 machines, among others).<sup><a href="#note317"><b>317)</b></a></sup>
17308 x / x -&gt; 1.0 The expressions x / x and 1.0 are not equivalent if x
17309 can be zero, infinite, or NaN.
17310 x - y &lt;-&gt; x + (-y) The expressions x - y, x + (-y), and (-y) + x
17311 are equivalent (on IEC 60559 machines, among others).
17312 x - y &lt;-&gt; -(y - x) The expressions x - y and -(y - x) are not
17313 equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the
17314 default rounding direction).<sup><a href="#note318"><b>318)</b></a></sup>
17315 x - x -&gt; 0.0 The expressions x - x and 0.0 are not equivalent if
17316 x is a NaN or infinite.
17317 0 * x -&gt; 0.0 The expressions 0 * x and 0.0 are not equivalent if
17318 x is a NaN, infinite, or -0.
17319 x + 0-&gt;x The expressions x + 0 and x are not equivalent if x is
17320 -0, because (-0) + (+0) yields +0 (in the default
17321 rounding direction), not -0.
17322 x - 0-&gt;x (+0) - (+0) yields -0 when rounding is downward
17323 (toward -(inf)), but +0 otherwise, and (-0) - (+0) always
17324 yields -0; so, if the state of the FENV_ACCESS pragma
17325 is ''off'', promising default rounding, then the
17326 implementation can replace x - 0 by x, even if x
17329 <sup><a name="note317" href="#note317"><b>317)</b></a></sup> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
17330 other transformations that remove arithmetic operators.
17331 <sup><a name="note318" href="#note318"><b>318)</b></a></sup> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
17332 Examples include:
17333 1/(1/ (+-) (inf)) is (+-) (inf)
17335 conj(csqrt(z)) is csqrt(conj(z)),
17336 for complex z.
17338 [<a name="p452" href="#p452">page 452</a>] (<a href="#Contents">Contents</a>)
17340 might be zero.
17341 -x &lt;-&gt; 0 - x The expressions -x and 0 - x are not equivalent if x
17342 is +0, because -(+0) yields -0, but 0 - (+0) yields +0
17343 (unless rounding is downward).
17344 <a name="F.8.3" href="#F.8.3"><b> F.8.3 Relational operators</b></a>
17345 1 x != x -&gt; false The statement x != x is true if x is a NaN.
17346 x == x -&gt; true The statement x == x is false if x is a NaN.
17347 x &lt; y -&gt; isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically
17348 equal, these expressions are not equivalent because of
17349 side effects when x or y is a NaN and the state of the
17350 FENV_ACCESS pragma is ''on''. This transformation,
17351 which would be desirable if extra code were required to
17352 cause the ''invalid'' floating-point exception for
17353 unordered cases, could be performed provided the state
17354 of the FENV_ACCESS pragma is ''off''.
17355 The sense of relational operators shall be maintained. This includes handling unordered
17356 cases as expressed by the source code.
17357 2 EXAMPLE
17358 // calls g and raises ''invalid'' if a and b are unordered
17359 if (a &lt; b)
17360 f();
17361 else
17362 g();
17363 is not equivalent to
17364 // calls f and raises ''invalid'' if a and b are unordered
17365 if (a &gt;= b)
17366 g();
17367 else
17368 f();
17369 nor to
17370 // calls f without raising ''invalid'' if a and b are unordered
17371 if (isgreaterequal(a,b))
17372 g();
17373 else
17374 f();
17375 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
17377 [<a name="p453" href="#p453">page 453</a>] (<a href="#Contents">Contents</a>)
17379 // calls g without raising ''invalid'' if a and b are unordered
17380 if (isless(a,b))
17381 f();
17382 else
17383 g();
17384 but is equivalent to
17385 if (!(a &lt; b))
17386 g();
17387 else
17388 f();
17390 <a name="F.8.4" href="#F.8.4"><b> F.8.4 Constant arithmetic</b></a>
17391 1 The implementation shall honor floating-point exceptions raised by execution-time
17392 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.7.4">F.7.4</a>
17393 and <a href="#F.7.5">F.7.5</a>.) An operation on constants that raises no floating-point exception can be
17394 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
17395 further check is required to assure that changing the rounding direction to downward does
17396 not alter the sign of the result,<sup><a href="#note319"><b>319)</b></a></sup> and implementations that support dynamic rounding
17397 precision modes shall assure further that the result of the operation raises no floating-
17398 point exception when converted to the semantic type of the operation.
17399 <a name="F.9" href="#F.9"><b> F.9 Mathematics &lt;math.h&gt;</b></a>
17400 1 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
17401 for IEC 60559 implementations.
17402 2 The Standard C macro HUGE_VAL and its float and long double analogs,
17403 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
17404 infinities.
17405 3 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
17406 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
17407 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
17408 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
17409 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
17410 4 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
17411 nonzero value.
17412 5 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
17413 subsequent subclauses of this annex.
17414 6 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
17415 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
17418 <sup><a name="note319" href="#note319"><b>319)</b></a></sup> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
17420 [<a name="p454" href="#p454">page 454</a>] (<a href="#Contents">Contents</a>)
17422 whose magnitude is too large.
17423 7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
17424 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note320"><b>320)</b></a></sup>
17425 8 Whether or when library functions raise the ''inexact'' floating-point exception is
17426 unspecified, unless explicitly specified otherwise.
17427 9 Whether or when library functions raise an undeserved ''underflow'' floating-point
17428 exception is unspecified.<sup><a href="#note321"><b>321)</b></a></sup> Otherwise, as implied by <a href="#F.7.6">F.7.6</a>, the <a href="#7.12">&lt;math.h&gt;</a> functions do
17429 not raise spurious floating-point exceptions (detectable by the user), other than the
17430 ''inexact'' floating-point exception.
17431 10 Whether the functions honor the rounding direction mode is implementation-defined,
17432 unless explicitly specified otherwise.
17433 11 Functions with a NaN argument return a NaN result and raise no floating-point exception,
17434 except where stated otherwise.
17435 12 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
17436 For families of functions, the specifications apply to all of the functions even though only
17437 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
17438 occurs in both an argument and the result, the result has the same sign as the argument.
17439 Recommended practice
17440 13 If a function with one or more NaN arguments returns a NaN result, the result should be
17441 the same as one of the NaN arguments (after possible type conversion), except perhaps
17442 for the sign.
17443 <a name="F.9.1" href="#F.9.1"><b> F.9.1 Trigonometric functions</b></a>
17444 <a name="F.9.1.1" href="#F.9.1.1"><b> F.9.1.1 The acos functions</b></a>
17445 1 -- acos(1) returns +0.
17446 -- acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
17447 | x | &gt; 1.
17452 <sup><a name="note320" href="#note320"><b>320)</b></a></sup> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
17453 when the floating-point exception is raised.
17454 <sup><a name="note321" href="#note321"><b>321)</b></a></sup> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
17455 avoiding them would be too costly.
17457 [<a name="p455" href="#p455">page 455</a>] (<a href="#Contents">Contents</a>)
17459 <a name="F.9.1.2" href="#F.9.1.2"><b> F.9.1.2 The asin functions</b></a>
17460 1 -- asin((+-)0) returns (+-)0.
17461 -- asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
17462 | x | &gt; 1.
17463 <a name="F.9.1.3" href="#F.9.1.3"><b> F.9.1.3 The atan functions</b></a>
17464 1 -- atan((+-)0) returns (+-)0.
17465 -- atan((+-)(inf)) returns (+-)pi /2.
17466 <a name="F.9.1.4" href="#F.9.1.4"><b> F.9.1.4 The atan2 functions</b></a>
17467 1 -- atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note322"><b>322)</b></a></sup>
17468 -- atan2((+-)0, +0) returns (+-)0.
17469 -- atan2((+-)0, x) returns (+-)pi for x &lt; 0.
17470 -- atan2((+-)0, x) returns (+-)0 for x &gt; 0.
17471 -- atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
17472 -- atan2(y, (+-)0) returns pi /2 for y &gt; 0.
17473 -- atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
17474 -- atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
17475 -- atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
17476 -- atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
17477 -- atan2((+-)(inf), +(inf)) returns (+-)pi /4.
17478 <a name="F.9.1.5" href="#F.9.1.5"><b> F.9.1.5 The cos functions</b></a>
17479 1 -- cos((+-)0) returns 1.
17480 -- cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17481 <a name="F.9.1.6" href="#F.9.1.6"><b> F.9.1.6 The sin functions</b></a>
17482 1 -- sin((+-)0) returns (+-)0.
17483 -- sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17488 <sup><a name="note322" href="#note322"><b>322)</b></a></sup> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
17489 the ''divide-by-zero'' floating-point exception.
17491 [<a name="p456" href="#p456">page 456</a>] (<a href="#Contents">Contents</a>)
17493 <a name="F.9.1.7" href="#F.9.1.7"><b> F.9.1.7 The tan functions</b></a>
17494 1 -- tan((+-)0) returns (+-)0.
17495 -- tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17496 <a name="F.9.2" href="#F.9.2"><b> F.9.2 Hyperbolic functions</b></a>
17497 <a name="F.9.2.1" href="#F.9.2.1"><b> F.9.2.1 The acosh functions</b></a>
17498 1 -- acosh(1) returns +0.
17499 -- acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
17500 -- acosh(+(inf)) returns +(inf).
17501 <a name="F.9.2.2" href="#F.9.2.2"><b> F.9.2.2 The asinh functions</b></a>
17502 1 -- asinh((+-)0) returns (+-)0.
17503 -- asinh((+-)(inf)) returns (+-)(inf).
17504 <a name="F.9.2.3" href="#F.9.2.3"><b> F.9.2.3 The atanh functions</b></a>
17505 1 -- atanh((+-)0) returns (+-)0.
17506 -- atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
17507 -- atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
17508 | x | &gt; 1.
17509 <a name="F.9.2.4" href="#F.9.2.4"><b> F.9.2.4 The cosh functions</b></a>
17510 1 -- cosh((+-)0) returns 1.
17511 -- cosh((+-)(inf)) returns +(inf).
17512 <a name="F.9.2.5" href="#F.9.2.5"><b> F.9.2.5 The sinh functions</b></a>
17513 1 -- sinh((+-)0) returns (+-)0.
17514 -- sinh((+-)(inf)) returns (+-)(inf).
17515 <a name="F.9.2.6" href="#F.9.2.6"><b> F.9.2.6 The tanh functions</b></a>
17516 1 -- tanh((+-)0) returns (+-)0.
17517 -- tanh((+-)(inf)) returns (+-)1.
17519 [<a name="p457" href="#p457">page 457</a>] (<a href="#Contents">Contents</a>)
17521 <a name="F.9.3" href="#F.9.3"><b> F.9.3 Exponential and logarithmic functions</b></a>
17522 <a name="F.9.3.1" href="#F.9.3.1"><b> F.9.3.1 The exp functions</b></a>
17523 1 -- exp((+-)0) returns 1.
17524 -- exp(-(inf)) returns +0.
17525 -- exp(+(inf)) returns +(inf).
17526 <a name="F.9.3.2" href="#F.9.3.2"><b> F.9.3.2 The exp2 functions</b></a>
17527 1 -- exp2((+-)0) returns 1.
17528 -- exp2(-(inf)) returns +0.
17529 -- exp2(+(inf)) returns +(inf).
17530 <a name="F.9.3.3" href="#F.9.3.3"><b> F.9.3.3 The expm1 functions</b></a>
17531 1 -- expm1((+-)0) returns (+-)0.
17532 -- expm1(-(inf)) returns -1.
17533 -- expm1(+(inf)) returns +(inf).
17534 <a name="F.9.3.4" href="#F.9.3.4"><b> F.9.3.4 The frexp functions</b></a>
17535 1 -- frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
17536 -- frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
17537 pointed to by exp.
17538 -- frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
17539 (and returns a NaN).
17540 2 frexp raises no floating-point exceptions.
17541 3 On a binary system, the body of the frexp function might be
17543 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
17544 return scalbn(value, -(*exp));
17546 <a name="F.9.3.5" href="#F.9.3.5"><b> F.9.3.5 The ilogb functions</b></a>
17547 1 If the correct result is outside the range of the return type, the numeric result is
17548 unspecified and the ''invalid'' floating-point exception is raised.
17550 [<a name="p458" href="#p458">page 458</a>] (<a href="#Contents">Contents</a>)
17552 <a name="F.9.3.6" href="#F.9.3.6"><b> F.9.3.6 The ldexp functions</b></a>
17553 1 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
17554 <a name="F.9.3.7" href="#F.9.3.7"><b> F.9.3.7 The log functions</b></a>
17555 1 -- log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17556 -- log(1) returns +0.
17557 -- log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17558 -- log(+(inf)) returns +(inf).
17559 <a name="F.9.3.8" href="#F.9.3.8"><b> F.9.3.8 The log10 functions</b></a>
17560 1 -- log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17561 -- log10(1) returns +0.
17562 -- log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17563 -- log10(+(inf)) returns +(inf).
17564 <a name="F.9.3.9" href="#F.9.3.9"><b> F.9.3.9 The log1p functions</b></a>
17565 1 -- log1p((+-)0) returns (+-)0.
17566 -- log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17567 -- log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
17568 x &lt; -1.
17569 -- log1p(+(inf)) returns +(inf).
17570 <a name="F.9.3.10" href="#F.9.3.10"><b> F.9.3.10 The log2 functions</b></a>
17571 1 -- log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17572 -- log2(1) returns +0.
17573 -- log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
17574 -- log2(+(inf)) returns +(inf).
17575 <a name="F.9.3.11" href="#F.9.3.11"><b> F.9.3.11 The logb functions</b></a>
17576 1 -- logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
17577 -- logb((+-)(inf)) returns +(inf).
17579 [<a name="p459" href="#p459">page 459</a>] (<a href="#Contents">Contents</a>)
17581 <a name="F.9.3.12" href="#F.9.3.12"><b> F.9.3.12 The modf functions</b></a>
17582 1 -- modf((+-)x, iptr) returns a result with the same sign as x.
17583 -- modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
17584 -- modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
17585 NaN).
17586 2 modf behaves as though implemented by
17587 #include <a href="#7.12">&lt;math.h&gt;</a>
17588 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17589 #pragma STDC FENV_ACCESS ON
17590 double modf(double value, double *iptr)
17592 int save_round = fegetround();
17593 fesetround(FE_TOWARDZERO);
17594 *iptr = nearbyint(value);
17595 fesetround(save_round);
17596 return copysign(
17597 isinf(value) ? 0.0 :
17598 value - (*iptr), value);
17600 <a name="F.9.3.13" href="#F.9.3.13"><b> F.9.3.13 The scalbn and scalbln functions</b></a>
17601 1 -- scalbn((+-)0, n) returns (+-)0.
17602 -- scalbn(x, 0) returns x.
17603 -- scalbn((+-)(inf), n) returns (+-)(inf).
17604 <a name="F.9.4" href="#F.9.4"><b> F.9.4 Power and absolute value functions</b></a>
17605 <a name="F.9.4.1" href="#F.9.4.1"><b> F.9.4.1 The cbrt functions</b></a>
17606 1 -- cbrt((+-)0) returns (+-)0.
17607 -- cbrt((+-)(inf)) returns (+-)(inf).
17608 <a name="F.9.4.2" href="#F.9.4.2"><b> F.9.4.2 The fabs functions</b></a>
17609 1 -- fabs((+-)0) returns +0.
17610 -- fabs((+-)(inf)) returns +(inf).
17612 [<a name="p460" href="#p460">page 460</a>] (<a href="#Contents">Contents</a>)
17614 <a name="F.9.4.3" href="#F.9.4.3"><b> F.9.4.3 The hypot functions</b></a>
17615 1 -- hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
17616 -- hypot(x, (+-)0) is equivalent to fabs(x).
17617 -- hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
17618 <a name="F.9.4.4" href="#F.9.4.4"><b> F.9.4.4 The pow functions</b></a>
17619 1 -- pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
17620 for y an odd integer &lt; 0.
17621 -- pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
17622 for y &lt; 0 and not an odd integer.
17623 -- pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
17624 -- pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
17625 -- pow(-1, (+-)(inf)) returns 1.
17626 -- pow(+1, y) returns 1 for any y, even a NaN.
17627 -- pow(x, (+-)0) returns 1 for any x, even a NaN.
17628 -- pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
17629 finite x &lt; 0 and finite non-integer y.
17630 -- pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
17631 -- pow(x, -(inf)) returns +0 for | x | &gt; 1.
17632 -- pow(x, +(inf)) returns +0 for | x | &lt; 1.
17633 -- pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
17634 -- pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
17635 -- pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
17636 -- pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
17637 -- pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
17638 -- pow(+(inf), y) returns +0 for y &lt; 0.
17639 -- pow(+(inf), y) returns +(inf) for y &gt; 0.
17641 [<a name="p461" href="#p461">page 461</a>] (<a href="#Contents">Contents</a>)
17643 <a name="F.9.4.5" href="#F.9.4.5"><b> F.9.4.5 The sqrt functions</b></a>
17644 1 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
17645 <a name="F.9.5" href="#F.9.5"><b> F.9.5 Error and gamma functions</b></a>
17646 <a name="F.9.5.1" href="#F.9.5.1"><b> F.9.5.1 The erf functions</b></a>
17647 1 -- erf((+-)0) returns (+-)0.
17648 -- erf((+-)(inf)) returns (+-)1.
17649 <a name="F.9.5.2" href="#F.9.5.2"><b> F.9.5.2 The erfc functions</b></a>
17650 1 -- erfc(-(inf)) returns 2.
17651 -- erfc(+(inf)) returns +0.
17652 <a name="F.9.5.3" href="#F.9.5.3"><b> F.9.5.3 The lgamma functions</b></a>
17653 1 -- lgamma(1) returns +0.
17654 -- lgamma(2) returns +0.
17655 -- lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
17656 x a negative integer or zero.
17657 -- lgamma(-(inf)) returns +(inf).
17658 -- lgamma(+(inf)) returns +(inf).
17659 <a name="F.9.5.4" href="#F.9.5.4"><b> F.9.5.4 The tgamma functions</b></a>
17660 1 -- tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
17661 -- tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
17662 negative integer.
17663 -- tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
17664 -- tgamma(+(inf)) returns +(inf).
17665 <a name="F.9.6" href="#F.9.6"><b> F.9.6 Nearest integer functions</b></a>
17666 <a name="F.9.6.1" href="#F.9.6.1"><b> F.9.6.1 The ceil functions</b></a>
17667 1 -- ceil((+-)0) returns (+-)0.
17668 -- ceil((+-)(inf)) returns (+-)(inf).
17669 2 The double version of ceil behaves as though implemented by
17671 [<a name="p462" href="#p462">page 462</a>] (<a href="#Contents">Contents</a>)
17673 #include <a href="#7.12">&lt;math.h&gt;</a>
17674 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17675 #pragma STDC FENV_ACCESS ON
17676 double ceil(double x)
17678 double result;
17679 int save_round = fegetround();
17680 fesetround(FE_UPWARD);
17681 result = rint(x); // or nearbyint instead of rint
17682 fesetround(save_round);
17683 return result;
17685 <a name="F.9.6.2" href="#F.9.6.2"><b> F.9.6.2 The floor functions</b></a>
17686 1 -- floor((+-)0) returns (+-)0.
17687 -- floor((+-)(inf)) returns (+-)(inf).
17688 2 See the sample implementation for ceil in <a href="#F.9.6.1">F.9.6.1</a>.
17689 <a name="F.9.6.3" href="#F.9.6.3"><b> F.9.6.3 The nearbyint functions</b></a>
17690 1 The nearbyint functions use IEC 60559 rounding according to the current rounding
17691 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
17692 value from the argument.
17693 -- nearbyint((+-)0) returns (+-)0 (for all rounding directions).
17694 -- nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
17695 <a name="F.9.6.4" href="#F.9.6.4"><b> F.9.6.4 The rint functions</b></a>
17696 1 The rint functions differ from the nearbyint functions only in that they do raise the
17697 ''inexact'' floating-point exception if the result differs in value from the argument.
17698 <a name="F.9.6.5" href="#F.9.6.5"><b> F.9.6.5 The lrint and llrint functions</b></a>
17699 1 The lrint and llrint functions provide floating-to-integer conversion as prescribed
17700 by IEC 60559. They round according to the current rounding direction. If the rounded
17701 value is outside the range of the return type, the numeric result is unspecified and the
17702 ''invalid'' floating-point exception is raised. When they raise no other floating-point
17703 exception and the result differs from the argument, they raise the ''inexact'' floating-point
17704 exception.
17706 [<a name="p463" href="#p463">page 463</a>] (<a href="#Contents">Contents</a>)
17708 <a name="F.9.6.6" href="#F.9.6.6"><b> F.9.6.6 The round functions</b></a>
17709 1 -- round((+-)0) returns (+-)0.
17710 -- round((+-)(inf)) returns (+-)(inf).
17711 2 The double version of round behaves as though implemented by
17712 #include <a href="#7.12">&lt;math.h&gt;</a>
17713 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17714 #pragma STDC FENV_ACCESS ON
17715 double round(double x)
17717 double result;
17718 fenv_t save_env;
17719 feholdexcept(&amp;save_env);
17720 result = rint(x);
17721 if (fetestexcept(FE_INEXACT)) {
17722 fesetround(FE_TOWARDZERO);
17723 result = rint(copysign(0.5 + fabs(x), x));
17725 feupdateenv(&amp;save_env);
17726 return result;
17728 The round functions may, but are not required to, raise the ''inexact'' floating-point
17729 exception for non-integer numeric arguments, as this implementation does.
17730 <a name="F.9.6.7" href="#F.9.6.7"><b> F.9.6.7 The lround and llround functions</b></a>
17731 1 The lround and llround functions differ from the lrint and llrint functions
17732 with the default rounding direction just in that the lround and llround functions
17733 round halfway cases away from zero and need not raise the ''inexact'' floating-point
17734 exception for non-integer arguments that round to within the range of the return type.
17735 <a name="F.9.6.8" href="#F.9.6.8"><b> F.9.6.8 The trunc functions</b></a>
17736 1 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
17737 rounding direction).
17738 -- trunc((+-)0) returns (+-)0.
17739 -- trunc((+-)(inf)) returns (+-)(inf).
17741 [<a name="p464" href="#p464">page 464</a>] (<a href="#Contents">Contents</a>)
17743 <a name="F.9.7" href="#F.9.7"><b> F.9.7 Remainder functions</b></a>
17744 <a name="F.9.7.1" href="#F.9.7.1"><b> F.9.7.1 The fmod functions</b></a>
17745 1 -- fmod((+-)0, y) returns (+-)0 for y not zero.
17746 -- fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
17747 infinite or y zero.
17748 -- fmod(x, (+-)(inf)) returns x for x not infinite.
17749 2 The double version of fmod behaves as though implemented by
17750 #include <a href="#7.12">&lt;math.h&gt;</a>
17751 #include <a href="#7.6">&lt;fenv.h&gt;</a>
17752 #pragma STDC FENV_ACCESS ON
17753 double fmod(double x, double y)
17755 double result;
17756 result = remainder(fabs(x), (y = fabs(y)));
17757 if (signbit(result)) result += y;
17758 return copysign(result, x);
17760 <a name="F.9.7.2" href="#F.9.7.2"><b> F.9.7.2 The remainder functions</b></a>
17761 1 The remainder functions are fully specified as a basic arithmetic operation in
17762 IEC 60559.
17763 <a name="F.9.7.3" href="#F.9.7.3"><b> F.9.7.3 The remquo functions</b></a>
17764 1 The remquo functions follow the specifications for the remainder functions. They
17765 have no further specifications special to IEC 60559 implementations.
17766 <a name="F.9.8" href="#F.9.8"><b> F.9.8 Manipulation functions</b></a>
17767 <a name="F.9.8.1" href="#F.9.8.1"><b> F.9.8.1 The copysign functions</b></a>
17768 1 copysign is specified in the Appendix to IEC 60559.
17769 <a name="F.9.8.2" href="#F.9.8.2"><b> F.9.8.2 The nan functions</b></a>
17770 1 All IEC 60559 implementations support quiet NaNs, in all floating formats.
17772 [<a name="p465" href="#p465">page 465</a>] (<a href="#Contents">Contents</a>)
17774 <a name="F.9.8.3" href="#F.9.8.3"><b> F.9.8.3 The nextafter functions</b></a>
17775 1 -- nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
17776 for x finite and the function value infinite.
17777 -- nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
17778 exceptions for the function value subnormal or zero and x != y.
17779 <a name="F.9.8.4" href="#F.9.8.4"><b> F.9.8.4 The nexttoward functions</b></a>
17780 1 No additional requirements beyond those on nextafter.
17781 <a name="F.9.9" href="#F.9.9"><b> F.9.9 Maximum, minimum, and positive difference functions</b></a>
17782 <a name="F.9.9.1" href="#F.9.9.1"><b> F.9.9.1 The fdim functions</b></a>
17783 1 No additional requirements.
17784 <a name="F.9.9.2" href="#F.9.9.2"><b> F.9.9.2 The fmax functions</b></a>
17785 1 If just one argument is a NaN, the fmax functions return the other argument (if both
17786 arguments are NaNs, the functions return a NaN).
17787 2 The body of the fmax function might be<sup><a href="#note323"><b>323)</b></a></sup>
17788 { return (isgreaterequal(x, y) ||
17789 isnan(y)) ? x : y; }
17790 <a name="F.9.9.3" href="#F.9.9.3"><b> F.9.9.3 The fmin functions</b></a>
17791 1 The fmin functions are analogous to the fmax functions (see <a href="#F.9.9.2">F.9.9.2</a>).
17792 <a name="F.9.10" href="#F.9.10"><b> F.9.10 Floating multiply-add</b></a>
17793 <a name="F.9.10.1" href="#F.9.10.1"><b> F.9.10.1 The fma functions</b></a>
17794 1 -- fma(x, y, z) computes xy + z, correctly rounded once.
17795 -- fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
17796 exception if one of x and y is infinite, the other is zero, and z is a NaN.
17797 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
17798 one of x and y is infinite, the other is zero, and z is not a NaN.
17799 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
17800 times y is an exact infinity and z is also an infinity but with the opposite sign.
17805 <sup><a name="note323" href="#note323"><b>323)</b></a></sup> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
17806 return +0; however, implementation in software might be impractical.
17808 [<a name="p466" href="#p466">page 466</a>] (<a href="#Contents">Contents</a>)
17810 <a name="G" href="#G"><b> Annex G</b></a>
17811 (informative)
17812 IEC 60559-compatible complex arithmetic
17813 <a name="G.1" href="#G.1"><b> G.1 Introduction</b></a>
17814 1 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
17815 IEC 60559 real floating-point arithmetic. Although these specifications have been
17816 carefully designed, there is little existing practice to validate the design decisions.
17817 Therefore, these specifications are not normative, but should be viewed more as
17818 recommended practice. An implementation that defines
17819 __STDC_IEC_559_COMPLEX__ should conform to the specifications in this annex.
17820 <a name="G.2" href="#G.2"><b> G.2 Types</b></a>
17821 1 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
17822 used as a type specifier within declaration specifiers in the same way as _Complex is
17823 (thus, _Imaginary float is a valid type name).
17824 2 There are three imaginary types, designated as float _Imaginary, double
17825 _Imaginary, and long double _Imaginary. The imaginary types (along with
17826 the real floating and complex types) are floating types.
17827 3 For imaginary types, the corresponding real type is given by deleting the keyword
17828 _Imaginary from the type name.
17829 4 Each imaginary type has the same representation and alignment requirements as the
17830 corresponding real type. The value of an object of imaginary type is the value of the real
17831 representation times the imaginary unit.
17832 5 The imaginary type domain comprises the imaginary types.
17833 <a name="G.3" href="#G.3"><b> G.3 Conventions</b></a>
17834 1 A complex or imaginary value with at least one infinite part is regarded as an infinity
17835 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
17836 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
17837 a zero if each of its parts is a zero.
17839 [<a name="p467" href="#p467">page 467</a>] (<a href="#Contents">Contents</a>)
17841 <a name="G.4" href="#G.4"><b> G.4 Conversions</b></a>
17842 <a name="G.4.1" href="#G.4.1"><b> G.4.1 Imaginary types</b></a>
17843 1 Conversions among imaginary types follow rules analogous to those for real floating
17844 types.
17845 <a name="G.4.2" href="#G.4.2"><b> G.4.2 Real and imaginary</b></a>
17846 1 When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note324"><b>324)</b></a></sup> the
17847 result is a positive zero.
17848 2 When a value of real type is converted to an imaginary type, the result is a positive
17849 imaginary zero.
17850 <a name="G.4.3" href="#G.4.3"><b> G.4.3 Imaginary and complex</b></a>
17851 1 When a value of imaginary type is converted to a complex type, the real part of the
17852 complex result value is a positive zero and the imaginary part of the complex result value
17853 is determined by the conversion rules for the corresponding real types.
17854 2 When a value of complex type is converted to an imaginary type, the real part of the
17855 complex value is discarded and the value of the imaginary part is converted according to
17856 the conversion rules for the corresponding real types.
17857 <a name="G.5" href="#G.5"><b> G.5 Binary operators</b></a>
17858 1 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
17859 operation with an imaginary operand.
17860 2 For most operand types, the value of the result of a binary operator with an imaginary or
17861 complex operand is completely determined, with reference to real arithmetic, by the usual
17862 mathematical formula. For some operand types, the usual mathematical formula is
17863 problematic because of its treatment of infinities and because of undue overflow or
17864 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
17865 not completely determined.
17870 <sup><a name="note324" href="#note324"><b>324)</b></a></sup> See <a href="#6.3.1.2">6.3.1.2</a>.
17872 [<a name="p468" href="#p468">page 468</a>] (<a href="#Contents">Contents</a>)
17874 <a name="G.5.1" href="#G.5.1"><b> G.5.1 Multiplicative operators</b></a>
17875 <b> Semantics</b>
17876 1 If one operand has real type and the other operand has imaginary type, then the result has
17877 imaginary type. If both operands have imaginary type, then the result has real type. (If
17878 either operand has complex type, then the result has complex type.)
17879 2 If the operands are not both complex, then the result and floating-point exception
17880 behavior of the * operator is defined by the usual mathematical formula:
17881 * u iv u + iv
17883 x xu i(xv) (xu) + i(xv)
17885 iy i(yu) -yv (-yv) + i(yu)
17887 x + iy (xu) + i(yu) (-yv) + i(xv)
17888 3 If the second operand is not complex, then the result and floating-point exception
17889 behavior of the / operator is defined by the usual mathematical formula:
17890 / u iv
17892 x x/u i(-x/v)
17894 iy i(y/u) y/v
17896 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
17897 4 The * and / operators satisfy the following infinity properties for all real, imaginary, and
17898 complex operands:<sup><a href="#note325"><b>325)</b></a></sup>
17899 -- if one operand is an infinity and the other operand is a nonzero finite number or an
17900 infinity, then the result of the * operator is an infinity;
17901 -- if the first operand is an infinity and the second operand is a finite number, then the
17902 result of the / operator is an infinity;
17903 -- if the first operand is a finite number and the second operand is an infinity, then the
17904 result of the / operator is a zero;
17909 <sup><a name="note325" href="#note325"><b>325)</b></a></sup> These properties are already implied for those cases covered in the tables, but are required for all cases
17910 (at least where the state for CX_LIMITED_RANGE is ''off'').
17912 [<a name="p469" href="#p469">page 469</a>] (<a href="#Contents">Contents</a>)
17914 -- if the first operand is a nonzero finite number or an infinity and the second operand is
17915 a zero, then the result of the / operator is an infinity.
17916 5 If both operands of the * operator are complex or if the second operand of the / operator
17917 is complex, the operator raises floating-point exceptions if appropriate for the calculation
17918 of the parts of the result, and may raise spurious floating-point exceptions.
17919 6 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
17920 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
17921 #include <a href="#7.12">&lt;math.h&gt;</a>
17922 #include <a href="#7.3">&lt;complex.h&gt;</a>
17923 /* Multiply z * w ... */
17924 double complex _Cmultd(double complex z, double complex w)
17926 #pragma STDC FP_CONTRACT OFF
17927 double a, b, c, d, ac, bd, ad, bc, x, y;
17928 a = creal(z); b = cimag(z);
17929 c = creal(w); d = cimag(w);
17930 ac = a * c; bd = b * d;
17931 ad = a * d; bc = b * c;
17932 x = ac - bd; y = ad + bc;
17933 if (isnan(x) &amp;&amp; isnan(y)) {
17934 /* Recover infinities that computed as NaN+iNaN ... */
17935 int recalc = 0;
17936 if ( isinf(a) || isinf(b) ) { // z is infinite
17937 /* "Box" the infinity and change NaNs in the other factor to 0 */
17938 a = copysign(isinf(a) ? 1.0 : 0.0, a);
17939 b = copysign(isinf(b) ? 1.0 : 0.0, b);
17940 if (isnan(c)) c = copysign(0.0, c);
17941 if (isnan(d)) d = copysign(0.0, d);
17942 recalc = 1;
17944 if ( isinf(c) || isinf(d) ) { // w is infinite
17945 /* "Box" the infinity and change NaNs in the other factor to 0 */
17946 c = copysign(isinf(c) ? 1.0 : 0.0, c);
17947 d = copysign(isinf(d) ? 1.0 : 0.0, d);
17948 if (isnan(a)) a = copysign(0.0, a);
17949 if (isnan(b)) b = copysign(0.0, b);
17950 recalc = 1;
17952 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
17953 isinf(ad) || isinf(bc))) {
17954 /* Recover infinities from overflow by changing NaNs to 0 ... */
17955 if (isnan(a)) a = copysign(0.0, a);
17956 if (isnan(b)) b = copysign(0.0, b);
17957 if (isnan(c)) c = copysign(0.0, c);
17958 if (isnan(d)) d = copysign(0.0, d);
17959 recalc = 1;
17961 if (recalc) {
17963 [<a name="p470" href="#p470">page 470</a>] (<a href="#Contents">Contents</a>)
17965 x = INFINITY * ( a * c - b * d );
17966 y = INFINITY * ( a * d + b * c );
17969 return x + I * y;
17971 7 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
17972 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
17974 8 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
17975 #include <a href="#7.12">&lt;math.h&gt;</a>
17976 #include <a href="#7.3">&lt;complex.h&gt;</a>
17977 /* Divide z / w ... */
17978 double complex _Cdivd(double complex z, double complex w)
17980 #pragma STDC FP_CONTRACT OFF
17981 double a, b, c, d, logbw, denom, x, y;
17982 int ilogbw = 0;
17983 a = creal(z); b = cimag(z);
17984 c = creal(w); d = cimag(w);
17985 logbw = logb(fmax(fabs(c), fabs(d)));
17986 if (isfinite(logbw)) {
17987 ilogbw = (int)logbw;
17988 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
17990 denom = c * c + d * d;
17991 x = scalbn((a * c + b * d) / denom, -ilogbw);
17992 y = scalbn((b * c - a * d) / denom, -ilogbw);
17993 /* Recover infinities and zeros that computed as NaN+iNaN; */
17994 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
17995 if (isnan(x) &amp;&amp; isnan(y)) {
17996 if ((denom == 0.0) &amp;&amp;
17997 (!isnan(a) || !isnan(b))) {
17998 x = copysign(INFINITY, c) * a;
17999 y = copysign(INFINITY, c) * b;
18001 else if ((isinf(a) || isinf(b)) &amp;&amp;
18002 isfinite(c) &amp;&amp; isfinite(d)) {
18003 a = copysign(isinf(a) ? 1.0 : 0.0, a);
18004 b = copysign(isinf(b) ? 1.0 : 0.0, b);
18005 x = INFINITY * ( a * c + b * d );
18006 y = INFINITY * ( b * c - a * d );
18008 else if (isinf(logbw) &amp;&amp;
18009 isfinite(a) &amp;&amp; isfinite(b)) {
18010 c = copysign(isinf(c) ? 1.0 : 0.0, c);
18011 d = copysign(isinf(d) ? 1.0 : 0.0, d);
18012 x = 0.0 * ( a * c + b * d );
18013 y = 0.0 * ( b * c - a * d );
18015 [<a name="p471" href="#p471">page 471</a>] (<a href="#Contents">Contents</a>)
18019 return x + I * y;
18021 9 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
18022 for multiplication. In the spirit of the multiplication example above, this code does not defend against
18023 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
18024 with division, provides better roundoff characteristics.
18026 <a name="G.5.2" href="#G.5.2"><b> G.5.2 Additive operators</b></a>
18027 <b> Semantics</b>
18028 1 If both operands have imaginary type, then the result has imaginary type. (If one operand
18029 has real type and the other operand has imaginary type, or if either operand has complex
18030 type, then the result has complex type.)
18031 2 In all cases the result and floating-point exception behavior of a + or - operator is defined
18032 by the usual mathematical formula:
18033 + or - u iv u + iv
18035 x x(+-)u x (+-) iv (x (+-) u) (+-) iv
18037 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
18039 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
18040 <a name="G.6" href="#G.6"><b> G.6 Complex arithmetic &lt;complex.h&gt;</b></a>
18041 1 The macros
18042 imaginary
18044 _Imaginary_I
18045 are defined, respectively, as _Imaginary and a constant expression of type const
18046 float _Imaginary with the value of the imaginary unit. The macro
18048 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
18049 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
18050 imaginary.
18051 2 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
18052 particularly suited to IEC 60559 implementations. For families of functions, the
18053 specifications apply to all of the functions even though only the principal function is
18055 [<a name="p472" href="#p472">page 472</a>] (<a href="#Contents">Contents</a>)
18057 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
18058 and the result, the result has the same sign as the argument.
18059 3 The functions are continuous onto both sides of their branch cuts, taking into account the
18060 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2. ???
18061 4 Since complex and imaginary values are composed of real values, each function may be
18062 regarded as computing real values from real values. Except as noted, the functions treat
18063 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
18064 manner consistent with the specifications for real functions in F.9.<sup><a href="#note326"><b>326)</b></a></sup>
18065 5 The functions cimag, conj, cproj, and creal are fully specified for all
18066 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
18067 point exceptions.
18068 6 Each of the functions cabs and carg is specified by a formula in terms of a real
18069 function (whose special cases are covered in <a href="#F">annex F</a>):
18070 cabs(x + iy) = hypot(x, y)
18071 carg(x + iy) = atan2(y, x)
18072 7 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
18073 a formula in terms of other complex functions (whose special cases are specified below):
18074 casin(z) = -i casinh(iz)
18075 catan(z) = -i catanh(iz)
18076 ccos(z) = ccosh(iz)
18077 csin(z) = -i csinh(iz)
18078 ctan(z) = -i ctanh(iz)
18079 8 For the other functions, the following subclauses specify behavior for special cases,
18080 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
18081 families of functions, the specifications apply to all of the functions even though only the
18082 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
18083 specifications for the upper half-plane imply the specifications for the lower half-plane; if
18084 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
18085 specifications for the first quadrant imply the specifications for the other three quadrants.
18086 9 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
18091 <sup><a name="note326" href="#note326"><b>326)</b></a></sup> 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
18092 other part is a NaN.
18094 [<a name="p473" href="#p473">page 473</a>] (<a href="#Contents">Contents</a>)
18096 <a name="G.6.1" href="#G.6.1"><b> G.6.1 Trigonometric functions</b></a>
18097 <a name="G.6.1.1" href="#G.6.1.1"><b> G.6.1.1 The cacos functions</b></a>
18098 1 -- cacos(conj(z)) = conj(cacos(z)).
18099 -- cacos((+-)0 + i0) returns pi /2 - i0.
18100 -- cacos((+-)0 + iNaN) returns pi /2 + iNaN.
18101 -- cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
18102 -- cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18103 point exception, for nonzero finite x.
18104 -- cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
18105 -- cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
18106 -- cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
18107 -- cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
18108 -- cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
18109 result is unspecified).
18110 -- cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18111 point exception, for finite y.
18112 -- cacos(NaN + i (inf)) returns NaN - i (inf).
18113 -- cacos(NaN + iNaN) returns NaN + iNaN.
18114 <a name="G.6.2" href="#G.6.2"><b> G.6.2 Hyperbolic functions</b></a>
18115 <a name="G.6.2.1" href="#G.6.2.1"><b> G.6.2.1 The cacosh functions</b></a>
18116 1 -- cacosh(conj(z)) = conj(cacosh(z)).
18117 -- cacosh((+-)0 + i0) returns +0 + ipi /2.
18118 -- cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
18119 -- cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18120 floating-point exception, for finite x.
18121 -- cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
18122 -- cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
18123 -- cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
18124 -- cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
18125 -- cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
18127 [<a name="p474" href="#p474">page 474</a>] (<a href="#Contents">Contents</a>)
18129 -- cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18130 floating-point exception, for finite y.
18131 -- cacosh(NaN + i (inf)) returns +(inf) + iNaN.
18132 -- cacosh(NaN + iNaN) returns NaN + iNaN.
18133 <a name="G.6.2.2" href="#G.6.2.2"><b> G.6.2.2 The casinh functions</b></a>
18134 1 -- casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
18135 -- casinh(+0 + i0) returns 0 + i0.
18136 -- casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
18137 -- casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18138 floating-point exception, for finite x.
18139 -- casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
18140 -- casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
18141 -- casinh(+(inf) + iNaN) returns +(inf) + iNaN.
18142 -- casinh(NaN + i0) returns NaN + i0.
18143 -- casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18144 floating-point exception, for finite nonzero y.
18145 -- casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18146 is unspecified).
18147 -- casinh(NaN + iNaN) returns NaN + iNaN.
18148 <a name="G.6.2.3" href="#G.6.2.3"><b> G.6.2.3 The catanh functions</b></a>
18149 1 -- catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
18150 -- catanh(+0 + i0) returns +0 + i0.
18151 -- catanh(+0 + iNaN) returns +0 + iNaN.
18152 -- catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
18153 exception.
18154 -- catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
18155 -- catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
18156 floating-point exception, for nonzero finite x.
18157 -- catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
18158 -- catanh(+(inf) + i (inf)) returns +0 + ipi /2.
18159 -- catanh(+(inf) + iNaN) returns +0 + iNaN.
18161 [<a name="p475" href="#p475">page 475</a>] (<a href="#Contents">Contents</a>)
18163 -- catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
18164 floating-point exception, for finite y.
18165 -- catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
18166 unspecified).
18167 -- catanh(NaN + iNaN) returns NaN + iNaN.
18168 <a name="G.6.2.4" href="#G.6.2.4"><b> G.6.2.4 The ccosh functions</b></a>
18169 1 -- ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
18170 -- ccosh(+0 + i0) returns 1 + i0.
18171 -- ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
18172 result is unspecified) and raises the ''invalid'' floating-point exception.
18173 -- ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
18174 result is unspecified).
18175 -- ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18176 exception, for finite nonzero x.
18177 -- ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18178 point exception, for finite nonzero x.
18179 -- ccosh(+(inf) + i0) returns +(inf) + i0.
18180 -- ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
18181 -- ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
18182 unspecified) and raises the ''invalid'' floating-point exception.
18183 -- ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
18184 -- ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
18185 result is unspecified).
18186 -- ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18187 point exception, for all nonzero numbers y.
18188 -- ccosh(NaN + iNaN) returns NaN + iNaN.
18189 <a name="G.6.2.5" href="#G.6.2.5"><b> G.6.2.5 The csinh functions</b></a>
18190 1 -- csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
18191 -- csinh(+0 + i0) returns +0 + i0.
18192 -- csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
18193 unspecified) and raises the ''invalid'' floating-point exception.
18194 -- csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
18195 unspecified).
18197 [<a name="p476" href="#p476">page 476</a>] (<a href="#Contents">Contents</a>)
18199 -- csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18200 exception, for positive finite x.
18201 -- csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18202 point exception, for finite nonzero x.
18203 -- csinh(+(inf) + i0) returns +(inf) + i0.
18204 -- csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
18205 -- csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
18206 unspecified) and raises the ''invalid'' floating-point exception.
18207 -- csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18208 is unspecified).
18209 -- csinh(NaN + i0) returns NaN + i0.
18210 -- csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18211 point exception, for all nonzero numbers y.
18212 -- csinh(NaN + iNaN) returns NaN + iNaN.
18213 <a name="G.6.2.6" href="#G.6.2.6"><b> G.6.2.6 The ctanh functions</b></a>
18214 1 -- ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
18215 -- ctanh(+0 + i0) returns +0 + i0.
18216 -- ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18217 exception, for finite x.
18218 -- ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18219 point exception, for finite x.
18220 -- ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
18221 -- ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
18222 is unspecified).
18223 -- ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
18224 result is unspecified).
18225 -- ctanh(NaN + i0) returns NaN + i0.
18226 -- ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18227 point exception, for all nonzero numbers y.
18228 -- ctanh(NaN + iNaN) returns NaN + iNaN.
18230 [<a name="p477" href="#p477">page 477</a>] (<a href="#Contents">Contents</a>)
18232 <a name="G.6.3" href="#G.6.3"><b> G.6.3 Exponential and logarithmic functions</b></a>
18233 <a name="G.6.3.1" href="#G.6.3.1"><b> G.6.3.1 The cexp functions</b></a>
18234 1 -- cexp(conj(z)) = conj(cexp(z)).
18235 -- cexp((+-)0 + i0) returns 1 + i0.
18236 -- cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
18237 exception, for finite x.
18238 -- cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18239 point exception, for finite x.
18240 -- cexp(+(inf) + i0) returns +(inf) + i0.
18241 -- cexp(-(inf) + iy) returns +0 cis(y), for finite y.
18242 -- cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
18243 -- cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
18244 the result are unspecified).
18245 -- cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
18246 exception (where the sign of the real part of the result is unspecified).
18247 -- cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
18248 of the result are unspecified).
18249 -- cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
18250 is unspecified).
18251 -- cexp(NaN + i0) returns NaN + i0.
18252 -- cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18253 point exception, for all nonzero numbers y.
18254 -- cexp(NaN + iNaN) returns NaN + iNaN.
18255 <a name="G.6.3.2" href="#G.6.3.2"><b> G.6.3.2 The clog functions</b></a>
18256 1 -- clog(conj(z)) = conj(clog(z)).
18257 -- clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
18258 exception.
18259 -- clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
18260 exception.
18261 -- clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
18262 -- clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18263 point exception, for finite x.
18265 [<a name="p478" href="#p478">page 478</a>] (<a href="#Contents">Contents</a>)
18267 -- clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
18268 -- clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
18269 -- clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
18270 -- clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
18271 -- clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
18272 -- clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18273 point exception, for finite y.
18274 -- clog(NaN + i (inf)) returns +(inf) + iNaN.
18275 -- clog(NaN + iNaN) returns NaN + iNaN.
18276 <a name="G.6.4" href="#G.6.4"><b> G.6.4 Power and absolute-value functions</b></a>
18277 <a name="G.6.4.1" href="#G.6.4.1"><b> G.6.4.1 The cpow functions</b></a>
18278 1 The cpow functions raise floating-point exceptions if appropriate for the calculation of
18279 the parts of the result, and may raise spurious exceptions.<sup><a href="#note327"><b>327)</b></a></sup>
18280 <a name="G.6.4.2" href="#G.6.4.2"><b> G.6.4.2 The csqrt functions</b></a>
18281 1 -- csqrt(conj(z)) = conj(csqrt(z)).
18282 -- csqrt((+-)0 + i0) returns +0 + i0.
18283 -- csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
18284 -- csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18285 point exception, for finite x.
18286 -- csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
18287 -- csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
18288 -- csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
18289 result is unspecified).
18290 -- csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
18291 -- csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
18292 point exception, for finite y.
18293 -- csqrt(NaN + iNaN) returns NaN + iNaN.
18298 <sup><a name="note327" href="#note327"><b>327)</b></a></sup> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
18299 implementations that treat special cases more carefully.
18301 [<a name="p479" href="#p479">page 479</a>] (<a href="#Contents">Contents</a>)
18303 <a name="G.7" href="#G.7"><b> G.7 Type-generic math &lt;tgmath.h&gt;</b></a>
18304 1 Type-generic macros that accept complex arguments also accept imaginary arguments. If
18305 an argument is imaginary, the macro expands to an expression whose type is real,
18306 imaginary, or complex, as appropriate for the particular function: if the argument is
18307 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
18308 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
18309 the types of the others are complex.
18310 2 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
18311 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
18312 functions:
18313 cos(iy) = cosh(y)
18314 sin(iy) = i sinh(y)
18315 tan(iy) = i tanh(y)
18316 cosh(iy) = cos(y)
18317 sinh(iy) = i sin(y)
18318 tanh(iy) = i tan(y)
18319 asin(iy) = i asinh(y)
18320 atan(iy) = i atanh(y)
18321 asinh(iy) = i asin(y)
18322 atanh(iy) = i atan(y)
18324 [<a name="p480" href="#p480">page 480</a>] (<a href="#Contents">Contents</a>)
18326 <a name="H" href="#H"><b> Annex H</b></a>
18327 (informative)
18328 Language independent arithmetic
18329 <a name="H.1" href="#H.1"><b> H.1 Introduction</b></a>
18330 1 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
18331 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
18332 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
18333 <a name="H.2" href="#H.2"><b> H.2 Types</b></a>
18334 1 The relevant C arithmetic types meet the requirements of LIA-1 types if an
18335 implementation adds notification of exceptional arithmetic operations and meets the 1
18336 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
18337 <a name="H.2.1" href="#H.2.1"><b> H.2.1 Boolean type</b></a>
18338 1 The LIA-1 data type Boolean is implemented by the C data type bool with values of
18339 true and false, all from <a href="#7.16">&lt;stdbool.h&gt;</a>.
18340 <a name="H.2.2" href="#H.2.2"><b> H.2.2 Integer types</b></a>
18341 1 The signed C integer types int, long int, long long int, and the corresponding
18342 unsigned types are compatible with LIA-1. If an implementation adds support for the
18343 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
18344 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
18345 in that overflows or out-of-bounds results silently wrap. An implementation that defines
18346 signed integer types as also being modulo need not detect integer overflow, in which case,
18347 only integer divide-by-zero need be detected.
18348 2 The parameters for the integer data types can be accessed by the following:
18349 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
18350 ULLONG_MAX
18351 minint INT_MIN, LONG_MIN, LLONG_MIN
18352 3 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
18353 is always 0 for the unsigned types, and is not provided for those types.
18355 [<a name="p481" href="#p481">page 481</a>] (<a href="#Contents">Contents</a>)
18357 <a name="H.2.2.1" href="#H.2.2.1"><b> H.2.2.1 Integer operations</b></a>
18358 1 The integer operations on integer types are the following:
18359 addI x + y
18360 subI x - y
18361 mulI x * y
18362 divI, divtI x / y
18363 remI, remtI x % y
18364 negI -x
18365 absI abs(x), labs(x), llabs(x)
18366 eqI x == y
18367 neqI x != y
18368 lssI x &lt; y
18369 leqI x &lt;= y
18370 gtrI x &gt; y
18371 geqI x &gt;= y
18372 where x and y are expressions of the same integer type.
18373 <a name="H.2.3" href="#H.2.3"><b> H.2.3 Floating-point types</b></a>
18374 1 The C floating-point types float, double, and long double are compatible with
18375 LIA-1. If an implementation adds support for the LIA-1 exceptional values
18376 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
18377 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
18378 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
18379 conformant types.
18380 <a name="H.2.3.1" href="#H.2.3.1"><b> H.2.3.1 Floating-point parameters</b></a>
18381 1 The parameters for a floating point data type can be accessed by the following:
18382 r FLT_RADIX
18383 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
18384 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
18385 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
18386 2 The derived constants for the floating point types are accessed by the following:
18388 [<a name="p482" href="#p482">page 482</a>] (<a href="#Contents">Contents</a>)
18390 fmax FLT_MAX, DBL_MAX, LDBL_MAX
18391 fminN FLT_MIN, DBL_MIN, LDBL_MIN
18392 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
18393 rnd_style FLT_ROUNDS
18394 <a name="H.2.3.2" href="#H.2.3.2"><b> H.2.3.2 Floating-point operations</b></a>
18395 1 The floating-point operations on floating-point types are the following:
18396 addF x + y
18397 subF x - y
18398 mulF x * y
18399 divF x / y
18400 negF -x
18401 absF fabsf(x), fabs(x), fabsl(x)
18402 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
18403 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
18404 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
18405 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
18406 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
18407 eqF x == y
18408 neqF x != y
18409 lssF x &lt; y
18410 leqF x &lt;= y
18411 gtrF x &gt; y
18412 geqF x &gt;= y
18413 where x and y are expressions of the same floating point type, n is of type int, and li
18414 is of type long int.
18415 <a name="H.2.3.3" href="#H.2.3.3"><b> H.2.3.3 Rounding styles</b></a>
18416 1 The C Standard requires all floating types to use the same radix and rounding style, so
18417 that only one identifier for each is provided to map to LIA-1.
18418 2 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
18419 truncate FLT_ROUNDS == 0
18421 [<a name="p483" href="#p483">page 483</a>] (<a href="#Contents">Contents</a>)
18423 nearest FLT_ROUNDS == 1
18424 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
18425 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
18426 in all relevant LIA-1 operations, not just addition as in C.
18427 <a name="H.2.4" href="#H.2.4"><b> H.2.4 Type conversions</b></a>
18428 1 The LIA-1 type conversions are the following type casts:
18429 cvtI' -&gt; I (int)i, (long int)i, (long long int)i,
18430 (unsigned int)i, (unsigned long int)i,
18431 (unsigned long long int)i
18432 cvtF -&gt; I (int)x, (long int)x, (long long int)x,
18433 (unsigned int)x, (unsigned long int)x,
18434 (unsigned long long int)x
18435 cvtI -&gt; F (float)i, (double)i, (long double)i
18436 cvtF' -&gt; F (float)x, (double)x, (long double)x
18437 2 In the above conversions from floating to integer, the use of (cast)x can be replaced with
18438 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
18439 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
18440 conversion functions, lrint(), llrint(), lround(), and llround(), can be
18441 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
18442 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
18443 3 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
18444 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
18445 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
18446 to 65535.0 which can then be cast to unsigned short int. But, the
18447 remainder() function is not useful for doing silent wrapping to signed integer types,
18448 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
18449 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
18450 int.
18451 4 C's conversions (casts) from floating-point to floating-point can meet LIA-1
18452 requirements if an implementation uses round-to-nearest (IEC 60559 default).
18453 5 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
18454 implementation uses round-to-nearest.
18456 [<a name="p484" href="#p484">page 484</a>] (<a href="#Contents">Contents</a>)
18458 <a name="H.3" href="#H.3"><b> H.3 Notification</b></a>
18459 1 Notification is the process by which a user or program is informed that an exceptional
18460 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
18461 allows an implementation to cause a notification to occur when any arithmetic operation
18462 returns an exceptional value as defined in LIA-1 clause 5.
18463 <a name="H.3.1" href="#H.3.1"><b> H.3.1 Notification alternatives</b></a>
18464 1 LIA-1 requires at least the following two alternatives for handling of notifications:
18465 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
18466 resume.
18467 2 An implementation need only support a given notification alternative for the entire
18468 program. An implementation may support the ability to switch between notification
18469 alternatives during execution, but is not required to do so. An implementation can
18470 provide separate selection for each kind of notification, but this is not required.
18471 3 C allows an implementation to provide notification. C's SIGFPE (for traps) and
18472 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
18473 can provide LIA-1 notification.
18474 4 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
18475 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
18476 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
18477 and-resume behavior with the same constraint.
18478 <a name="H.3.1.1" href="#H.3.1.1"><b> H.3.1.1 Indicators</b></a>
18479 1 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
18480 2 The following mapping is for floating-point types:
18481 undefined FE_INVALID, FE_DIVBYZERO
18482 floating_overflow FE_OVERFLOW
18483 underflow FE_UNDERFLOW
18484 3 The floating-point indicator interrogation and manipulation operations are:
18485 set_indicators feraiseexcept(i)
18486 clear_indicators feclearexcept(i)
18487 test_indicators fetestexcept(i)
18488 current_indicators fetestexcept(FE_ALL_EXCEPT)
18489 where i is an expression of type int representing a subset of the LIA-1 indicators.
18490 4 C allows an implementation to provide the following LIA-1 required behavior: at
18491 program termination if any indicator is set the implementation shall send an unambiguous
18493 [<a name="p485" href="#p485">page 485</a>] (<a href="#Contents">Contents</a>)
18495 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
18496 5 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
18497 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
18498 point indicators.
18499 <a name="H.3.1.2" href="#H.3.1.2"><b> H.3.1.2 Traps</b></a>
18500 1 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
18501 math library functions (which are not permitted to generate any externally visible
18502 exceptional conditions). An implementation can provide an alternative of notification
18503 through termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
18504 2 LIA-1 does not require that traps be precise.
18505 3 C does require that SIGFPE be the signal corresponding to arithmetic exceptions, if there
18506 is any signal raised for them.
18507 4 C supports signal handlers for SIGFPE and allows trapping of arithmetic exceptions.
18508 When arithmetic exceptions do trap, C's signal-handler mechanism allows trap-and-
18509 terminate (either default implementation behavior or user replacement for it) or trap-and-
18510 resume, at the programmer's option.
18512 [<a name="p486" href="#p486">page 486</a>] (<a href="#Contents">Contents</a>)
18514 <a name="I" href="#I"><b> Annex I</b></a>
18515 (informative)
18516 Common warnings
18517 1 An implementation may generate warnings in many situations, none of which are
18518 specified as part of this International Standard. The following are a few of the more
18519 common situations.
18520 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>).
18521 -- A block with initialization of an object that has automatic storage duration is jumped
18522 into (<a href="#6.2.4">6.2.4</a>).
18523 -- An implicit narrowing conversion is encountered, such as the assignment of a long
18524 int or a double to an int, or a pointer to void to a pointer to any type other than
18525 a character type (<a href="#6.3">6.3</a>).
18526 -- A hexadecimal floating constant cannot be represented exactly in its evaluation format
18527 (<a href="#6.4.4.2">6.4.4.2</a>).
18528 -- An integer character constant includes more than one character or a wide character
18529 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
18530 -- The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
18531 -- An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
18532 lvalue in one operand, and a side effect to, or an access to the value of, the identical
18533 lvalue in the other operand (<a href="#6.5">6.5</a>).
18534 -- A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
18535 -- The arguments in a function call do not agree in number and type with those of the
18536 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
18537 -- An object is defined but not used (<a href="#6.7">6.7</a>).
18538 -- A value is given to an object of an enumerated type other than by assignment of an
18539 enumeration constant that is a member of that type, or an enumeration object that has
18540 the same type, or the value of a function that returns the same enumerated type
18541 (<a href="#6.7.2.2">6.7.2.2</a>).
18542 -- An aggregate has a partly bracketed initialization (<a href="#6.7.7">6.7.7</a>).
18543 -- A statement cannot be reached (<a href="#6.8">6.8</a>).
18544 -- A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
18545 -- A constant expression is used as the controlling expression of a selection statement
18546 (<a href="#6.8.4">6.8.4</a>).
18548 [<a name="p487" href="#p487">page 487</a>] (<a href="#Contents">Contents</a>)
18550 -- An incorrectly formed preprocessing group is encountered while skipping a
18551 preprocessing group (<a href="#6.10.1">6.10.1</a>).
18552 -- An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
18554 [<a name="p488" href="#p488">page 488</a>] (<a href="#Contents">Contents</a>)
18556 <a name="J" href="#J"><b> Annex J</b></a>
18557 (informative)
18558 Portability issues
18559 1 This annex collects some information about portability that appears in this International
18560 Standard.
18561 <a name="J.1" href="#J.1"><b> J.1 Unspecified behavior</b></a>
18562 1 The following are unspecified:
18563 -- The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
18564 -- The termination status returned to the hosted environment if the return type of main
18565 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
18566 -- The behavior of the display device if a printing character is written when the active
18567 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
18568 -- The behavior of the display device if a backspace character is written when the active
18569 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
18570 -- The behavior of the display device if a horizontal tab character is written when the
18571 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
18572 -- The behavior of the display device if a vertical tab character is written when the active
18573 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
18574 -- How an extended source character that does not correspond to a universal character
18575 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
18576 -- Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
18577 -- The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
18578 -- The value of a union member other than the last one stored into (<a href="#6.2.6.1">6.2.6.1</a>).
18579 -- The representation used when storing a value in an object that has more than one
18580 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
18581 -- The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
18582 -- Whether certain operators can generate negative zeros and whether a negative zero
18583 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
18584 -- Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
18585 -- The order in which subexpressions are evaluated and the order in which side effects
18586 take place, except as specified for the function-call (), &amp;&amp;, ||, ?:, and comma
18587 operators (<a href="#6.5">6.5</a>).
18589 [<a name="p489" href="#p489">page 489</a>] (<a href="#Contents">Contents</a>)
18591 -- The order in which the function designator, arguments, and subexpressions within the
18592 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
18593 -- The order of side effects among compound literal initialization list expressions
18594 (<a href="#6.5.2.5">6.5.2.5</a>).
18595 -- The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
18596 -- The alignment of the addressable storage unit allocated to hold a bit-field (<a href="#6.7.2.1">6.7.2.1</a>).
18597 -- Whether a call to an inline function uses the inline definition or the external definition
18598 of the function (<a href="#6.7.4">6.7.4</a>).
18599 -- Whether or not a size expression is evaluated when it is part of the operand of a
18600 sizeof operator and changing the value of the size expression would not affect the
18601 result of the operator (<a href="#6.7.5.2">6.7.5.2</a>).
18602 -- The order in which any side effects occur among the initialization list expressions in
18603 an initializer (<a href="#6.7.8">6.7.8</a>).
18604 -- The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
18605 -- When a fully expanded macro replacement list contains a function-like macro name
18606 as its last preprocessing token and the next preprocessing token from the source file is
18607 a (, and the fully expanded replacement of that macro ends with the name of the first
18608 macro and the next preprocessing token from the source file is again a (, whether that
18609 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
18610 -- The order in which # and ## operations are evaluated during macro substitution
18611 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
18612 -- Whether errno is a macro or an identifier with external linkage (<a href="#7.5">7.5</a>).
18613 -- The state of the floating-point status flags when execution passes from a part of the
18614 program translated with FENV_ACCESS ''off'' to a part translated with
18615 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
18616 -- The order in which feraiseexcept raises floating-point exceptions, except as
18617 stated in <a href="#F.7.6">F.7.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
18618 -- Whether math_errhandling is a macro or an identifier with external linkage
18619 (<a href="#7.12">7.12</a>).
18620 -- The results of the frexp functions when the specified value is not a floating-point
18621 number (<a href="#7.12.6.4">7.12.6.4</a>).
18622 -- The numeric result of the ilogb functions when the correct value is outside the
18623 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>).
18624 -- 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>).
18626 [<a name="p490" href="#p490">page 490</a>] (<a href="#Contents">Contents</a>)
18628 -- The value stored by the remquo functions in the object pointed to by quo when y is
18629 zero (<a href="#7.12.10.3">7.12.10.3</a>).
18630 -- Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
18631 -- Whether va_copy and va_end are macros or identifiers with external linkage
18632 (<a href="#7.15.1">7.15.1</a>).
18633 -- The hexadecimal digit before the decimal point when a non-normalized floating-point
18634 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>).
18635 -- The value of the file position indicator after a successful call to the ungetc function
18636 for a text stream, or the ungetwc function for any stream, until all pushed-back
18637 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>).
18638 -- The details of the value stored by the fgetpos function (<a href="#7.19.9.1">7.19.9.1</a>).
18639 -- 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>).
18640 -- Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
18641 functions convert a minus-signed sequence to a negative number directly or by
18642 negating the value resulting from converting the corresponding unsigned sequence
18643 (<a href="#7.20.1.3">7.20.1.3</a>, <a href="#7.24.4.1.1">7.24.4.1.1</a>).
18644 -- The order and contiguity of storage allocated by successive calls to the calloc,
18645 malloc, and realloc functions (<a href="#7.20.3">7.20.3</a>).
18646 -- The amount of storage allocated by a successful call to the calloc, malloc, or
18647 realloc function when 0 bytes was requested (<a href="#7.20.3">7.20.3</a>).
18648 -- Which of two elements that compare as equal is matched by the bsearch function
18649 (<a href="#7.20.5.1">7.20.5.1</a>).
18650 -- The order of two elements that compare as equal in an array sorted by the qsort
18651 function (<a href="#7.20.5.2">7.20.5.2</a>).
18652 -- The encoding of the calendar time returned by the time function (<a href="#7.23.2.4">7.23.2.4</a>).
18653 -- The characters stored by the strftime or wcsftime function if any of the time
18654 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>).
18655 -- 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>,
18656 <a href="#7.24.6.4.2">7.24.6.4.2</a>,
18657 -- The resulting value when the ''invalid'' floating-point exception is raised during
18658 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
18659 -- Whether conversion of non-integer IEC 60559 floating values to integer raises the
18660 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
18662 [<a name="p491" href="#p491">page 491</a>] (<a href="#Contents">Contents</a>)
18664 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
18665 exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
18666 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
18667 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
18668 -- The exponent value stored by frexp for a NaN or infinity (<a href="#F.9.3.4">F.9.3.4</a>).
18669 -- The numeric result returned by the lrint, llrint, lround, and llround
18670 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>).
18671 -- The sign of one part of the complex result of several math functions for certain
18672 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>,
18673 <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>).
18674 <a name="J.2" href="#J.2"><b> J.2 Undefined behavior</b></a>
18675 1 The behavior is undefined in the following circumstances:
18676 -- A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
18677 (clause 4).
18678 -- A nonempty source file does not end in a new-line character which is not immediately
18679 preceded by a backslash character or ends in a partial preprocessing token or
18680 comment (<a href="#5.1.1.2">5.1.1.2</a>).
18681 -- Token concatenation produces a character sequence matching the syntax of a
18682 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
18683 -- A program in a hosted environment does not define a function named main using one
18684 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
18685 -- A character not in the basic source character set is encountered in a source file, except
18686 in an identifier, a character constant, a string literal, a header name, a comment, or a
18687 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
18688 -- An identifier, comment, string literal, character constant, or header name contains an
18689 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>).
18690 -- The same identifier has both internal and external linkage in the same translation unit
18691 (<a href="#6.2.2">6.2.2</a>).
18692 -- An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
18693 -- The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
18694 -- The value of an object with automatic storage duration is used while it is
18695 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>).
18696 -- A trap representation is read by an lvalue expression that does not have character type
18697 (<a href="#6.2.6.1">6.2.6.1</a>).
18699 [<a name="p492" href="#p492">page 492</a>] (<a href="#Contents">Contents</a>)
18701 -- A trap representation is produced by a side effect that modifies any part of the object
18702 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
18703 -- The arguments to certain operators are such that could produce a negative zero result,
18704 but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
18705 -- Two declarations of the same object or function specify types that are not compatible
18706 (<a href="#6.2.7">6.2.7</a>).
18707 -- Conversion to or from an integer type produces a value outside the range that can be
18708 represented (<a href="#6.3.1.4">6.3.1.4</a>).
18709 -- Demotion of one real floating type to another produces a value outside the range that
18710 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
18711 -- An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
18712 -- A non-array lvalue with an incomplete type is used in a context that requires the value
18713 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
18714 -- An lvalue having array type is converted to a pointer to the initial element of the
18715 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
18716 -- An attempt is made to use the value of a void expression, or an implicit or explicit
18717 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
18718 -- Conversion of a pointer to an integer type produces a value outside the range that can
18719 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
18720 -- Conversion between two pointer types produces a result that is incorrectly aligned
18721 (<a href="#6.3.2.3">6.3.2.3</a>).
18722 -- A pointer is used to call a function whose type is not compatible with the pointed-to
18723 type (<a href="#6.3.2.3">6.3.2.3</a>).
18724 -- An unmatched ' or " character is encountered on a logical source line during
18725 tokenization (<a href="#6.4">6.4</a>).
18726 -- A reserved keyword token is used in translation phase 7 or 8 for some purpose other
18727 than as a keyword (<a href="#6.4.1">6.4.1</a>).
18728 -- A universal character name in an identifier does not designate a character whose
18729 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
18730 -- The initial character of an identifier is a universal character name designating a digit
18731 (<a href="#6.4.2.1">6.4.2.1</a>).
18732 -- Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
18733 -- The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
18735 [<a name="p493" href="#p493">page 493</a>] (<a href="#Contents">Contents</a>)
18737 -- The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
18738 -- The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
18739 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
18740 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
18741 -- Between two sequence points, an object is modified more than once, or is modified
18742 and the prior value is read other than to determine the value to be stored (<a href="#6.5">6.5</a>).
18743 -- An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
18744 -- An object has its stored value accessed other than by an lvalue of an allowable type
18745 (<a href="#6.5">6.5</a>).
18746 -- An attempt is made to modify the result of a function call, a conditional operator, an
18747 assignment operator, or a comma operator, or to access it after the next sequence
18748 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>).
18749 -- For a call to a function without a function prototype in scope, the number of
18750 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
18751 -- For call to a function without a function prototype in scope where the function is
18752 defined with a function prototype, either the prototype ends with an ellipsis or the
18753 types of the arguments after promotion are not compatible with the types of the
18754 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
18755 -- For a call to a function without a function prototype in scope where the function is not
18756 defined with a function prototype, the types of the arguments after promotion are not
18757 compatible with those of the parameters after promotion (with certain exceptions)
18758 (<a href="#6.5.2.2">6.5.2.2</a>).
18759 -- A function is defined with a type that is not compatible with the type (of the
18760 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
18761 -- The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
18762 -- A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
18763 -- The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
18764 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
18765 integer type produces a result that does not point into, or just beyond, the same array
18766 object (<a href="#6.5.6">6.5.6</a>).
18767 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
18768 integer type produces a result that points just beyond the array object and is used as
18769 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
18770 -- Pointers that do not point into, or just beyond, the same array object are subtracted
18771 (<a href="#6.5.6">6.5.6</a>).
18773 [<a name="p494" href="#p494">page 494</a>] (<a href="#Contents">Contents</a>)
18775 -- An array subscript is out of range, even if an object is apparently accessible with the
18776 given subscript (as in the lvalue expression a[1][7] given the declaration int
18777 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
18778 -- The result of subtracting two pointers is not representable in an object of type
18779 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
18780 -- An expression is shifted by a negative number or by an amount greater than or equal
18781 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
18782 -- An expression having signed promoted type is left-shifted and either the value of the
18783 expression is negative or the result of shifting would be not be representable in the
18784 promoted type (<a href="#6.5.7">6.5.7</a>).
18785 -- Pointers that do not point to the same aggregate or union (nor just beyond the same
18786 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
18787 -- An object is assigned to an inexactly overlapping object or to an exactly overlapping
18788 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
18789 -- An expression that is required to be an integer constant expression does not have an
18790 integer type; has operands that are not integer constants, enumeration constants,
18791 character constants, sizeof expressions whose results are integer constants, or
18792 immediately-cast floating constants; or contains casts (outside operands to sizeof
18793 operators) other than conversions of arithmetic types to integer types (<a href="#6.6">6.6</a>).
18794 -- A constant expression in an initializer is not, or does not evaluate to, one of the
18795 following: an arithmetic constant expression, a null pointer constant, an address
18796 constant, or an address constant for an object type plus or minus an integer constant
18797 expression (<a href="#6.6">6.6</a>).
18798 -- An arithmetic constant expression does not have arithmetic type; has operands that
18799 are not integer constants, floating constants, enumeration constants, character
18800 constants, or sizeof expressions; or contains casts (outside operands to sizeof
18801 operators) other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
18802 -- The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
18803 address &amp;, or indirection * operator or a pointer cast in creating an address constant
18804 (<a href="#6.6">6.6</a>).
18805 -- An identifier for an object is declared with no linkage and the type of the object is
18806 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
18807 -- A function is declared at block scope with an explicit storage-class specifier other
18808 than extern (<a href="#6.7.1">6.7.1</a>).
18809 -- A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
18811 [<a name="p495" href="#p495">page 495</a>] (<a href="#Contents">Contents</a>)
18813 -- An attempt is made to access, or generate a pointer to just past, a flexible array
18814 member of a structure when the referenced object provides no elements for that array
18815 (<a href="#6.7.2.1">6.7.2.1</a>).
18816 -- When the complete type is needed, an incomplete structure or union type is not
18817 completed in the same scope by another declaration of the tag that defines the content
18818 (<a href="#6.7.2.3">6.7.2.3</a>).
18819 -- An attempt is made to modify an object defined with a const-qualified type through
18820 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
18821 -- An attempt is made to refer to an object defined with a volatile-qualified type through
18822 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
18823 -- The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
18824 -- Two qualified types that are required to be compatible do not have the identically
18825 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
18826 -- An object which has been modified is accessed through a restrict-qualified pointer to
18827 a const-qualified type, or through a restrict-qualified pointer and another pointer that
18828 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
18829 -- A restrict-qualified pointer is assigned a value based on another restricted pointer
18830 whose associated block neither began execution before the block associated with this
18831 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
18832 -- A function with external linkage is declared with an inline function specifier, but is
18833 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
18834 -- Two pointer types that are required to be compatible are not identically qualified, or
18835 are not pointers to compatible types (<a href="#6.7.5.1">6.7.5.1</a>).
18836 -- The size expression in an array declaration is not a constant expression and evaluates
18837 at program execution time to a nonpositive value (<a href="#6.7.5.2">6.7.5.2</a>).
18838 -- In a context requiring two array types to be compatible, they do not have compatible
18839 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.5.2">6.7.5.2</a>).
18840 -- A declaration of an array parameter includes the keyword static within the [ and
18841 ] and the corresponding argument does not provide access to the first element of an
18842 array with at least the specified number of elements (<a href="#6.7.5.3">6.7.5.3</a>).
18843 -- A storage-class specifier or type qualifier modifies the keyword void as a function
18844 parameter type list (<a href="#6.7.5.3">6.7.5.3</a>).
18845 -- In a context requiring two function types to be compatible, they do not have
18846 compatible return types, or their parameters disagree in use of the ellipsis terminator
18847 or the number and type of parameters (after default argument promotion, when there
18848 is no parameter type list or when one type is specified by a function definition with an
18850 [<a name="p496" href="#p496">page 496</a>] (<a href="#Contents">Contents</a>)
18852 identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
18853 -- The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
18854 -- The initializer for a scalar is neither a single expression nor a single expression
18855 enclosed in braces (<a href="#6.7.8">6.7.8</a>).
18856 -- The initializer for a structure or union object that has automatic storage duration is
18857 neither an initializer list nor a single expression that has compatible structure or union
18858 type (<a href="#6.7.8">6.7.8</a>).
18859 -- The initializer for an aggregate or union, other than an array initialized by a string
18860 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.8">6.7.8</a>).
18861 -- An identifier with external linkage is used, but in the program there does not exist
18862 exactly one external definition for the identifier, or the identifier is not used and there
18863 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
18864 -- A function definition includes an identifier list, but the types of the parameters are not
18865 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
18866 -- An adjusted parameter type in a function definition is not an object type (<a href="#6.9.1">6.9.1</a>).
18867 -- A function that accepts a variable number of arguments is defined without a
18868 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
18869 -- The } that terminates a function is reached, and the value of the function call is used
18870 by the caller (<a href="#6.9.1">6.9.1</a>).
18871 -- An identifier for an object with internal linkage and an incomplete type is declared
18872 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
18873 -- The token defined is generated during the expansion of a #if or #elif
18874 preprocessing directive, or the use of the defined unary operator does not match
18875 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
18876 -- The #include preprocessing directive that results after expansion does not match
18877 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
18878 -- The character sequence in an #include preprocessing directive does not start with a
18879 letter (<a href="#6.10.2">6.10.2</a>).
18880 -- There are sequences of preprocessing tokens within the list of macro arguments that
18881 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
18882 -- The result of the preprocessing operator # is not a valid character string literal
18883 (<a href="#6.10.3.2">6.10.3.2</a>).
18884 -- The result of the preprocessing operator ## is not a valid preprocessing token
18885 (<a href="#6.10.3.3">6.10.3.3</a>).
18887 [<a name="p497" href="#p497">page 497</a>] (<a href="#Contents">Contents</a>)
18889 -- The #line preprocessing directive that results after expansion does not match one of
18890 the two well-defined forms, or its digit sequence specifies zero or a number greater
18891 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
18892 -- A non-STDC #pragma preprocessing directive that is documented as causing
18893 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
18894 -- A #pragma STDC preprocessing directive does not match one of the well-defined
18895 forms (<a href="#6.10.6">6.10.6</a>).
18896 -- The name of a predefined macro, or the identifier defined, is the subject of a
18897 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
18898 -- An attempt is made to copy an object to an overlapping object by use of a library
18899 function, other than as explicitly allowed (e.g., memmove) (clause 7).
18900 -- A file with the same name as one of the standard headers, not provided as part of the
18901 implementation, is placed in any of the standard places that are searched for included
18902 source files (<a href="#7.1.2">7.1.2</a>).
18903 -- A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
18904 -- A function, object, type, or macro that is specified as being declared or defined by
18905 some standard header is used before any header that declares or defines it is included
18906 (<a href="#7.1.2">7.1.2</a>).
18907 -- A standard header is included while a macro is defined with the same name as a
18908 keyword (<a href="#7.1.2">7.1.2</a>).
18909 -- The program attempts to declare a library function itself, rather than via a standard
18910 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
18911 -- The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
18912 (<a href="#7.1.3">7.1.3</a>).
18913 -- The program removes the definition of a macro whose name begins with an
18914 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
18915 -- An argument to a library function has an invalid value or a type not expected by a
18916 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
18917 -- The pointer passed to a library function array parameter does not have a value such
18918 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
18919 -- The macro definition of assert is suppressed in order to access an actual function
18920 (<a href="#7.2">7.2</a>).
18921 -- The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
18922 -- The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
18923 any context other than outside all external declarations or preceding all explicit
18925 [<a name="p498" href="#p498">page 498</a>] (<a href="#Contents">Contents</a>)
18927 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>).
18928 -- The value of an argument to a character handling function is neither equal to the value
18929 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
18930 -- A macro definition of errno is suppressed in order to access an actual object, or the
18931 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
18932 -- Part of the program tests floating-point status flags, sets floating-point control modes,
18933 or runs under non-default mode settings, but was translated with the state for the
18934 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
18935 -- The exception-mask argument for one of the functions that provide access to the
18936 floating-point status flags has a nonzero value not obtained by bitwise OR of the
18937 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
18938 -- The fesetexceptflag function is used to set floating-point status flags that were
18939 not specified in the call to the fegetexceptflag function that provided the value
18940 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
18941 -- The argument to fesetenv or feupdateenv is neither an object set by a call to
18942 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>).
18943 -- The value of the result of an integer arithmetic or conversion function cannot be
18944 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>).
18945 -- The program modifies the string pointed to by the value returned by the setlocale
18946 function (<a href="#7.11.1.1">7.11.1.1</a>).
18947 -- The program modifies the structure pointed to by the value returned by the
18948 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
18949 -- A macro definition of math_errhandling is suppressed or the program defines
18950 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
18951 -- An argument to a floating-point classification or comparison macro is not of real
18952 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
18953 -- A macro definition of setjmp is suppressed in order to access an actual function, or
18954 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
18955 -- An invocation of the setjmp macro occurs other than in an allowed context
18956 (<a href="#7.13.2.1">7.13.2.1</a>).
18957 -- The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
18958 -- After a longjmp, there is an attempt to access the value of an object of automatic
18959 storage class with non-volatile-qualified type, local to the function containing the
18960 invocation of the corresponding setjmp macro, that was changed between the
18961 setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
18963 [<a name="p499" href="#p499">page 499</a>] (<a href="#Contents">Contents</a>)
18965 -- The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
18966 -- A signal handler returns when the signal corresponded to a computational exception
18967 (<a href="#7.14.1.1">7.14.1.1</a>).
18968 -- A signal occurs as the result of calling the abort or raise function, and the signal
18969 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
18970 -- A signal occurs other than as the result of calling the abort or raise function, and
18971 the signal handler refers to an object with static storage duration other than by
18972 assigning a value to an object declared as volatile sig_atomic_t, or calls any
18973 function in the standard library other than the abort function, the _Exit function,
18974 or the signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
18975 -- The value of errno is referred to after a signal occurred other than as the result of
18976 calling the abort or raise function and the corresponding signal handler obtained
18977 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
18978 -- A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
18979 -- A function with a variable number of arguments attempts to access its varying
18980 arguments other than through a properly declared and initialized va_list object, or
18981 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>).
18982 -- The macro va_arg is invoked using the parameter ap that was passed to a function
18983 that invoked the macro va_arg with the same parameter (<a href="#7.15">7.15</a>).
18984 -- A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
18985 order to access an actual function, or the program defines an external identifier with
18986 the name va_copy or va_end (<a href="#7.15.1">7.15.1</a>).
18987 -- The va_start or va_copy macro is invoked without a corresponding invocation
18988 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>,
18989 <a href="#7.15.1.4">7.15.1.4</a>).
18990 -- The type parameter to the va_arg macro is not such that a pointer to an object of
18991 that type can be obtained simply by postfixing a * (<a href="#7.15.1.1">7.15.1.1</a>).
18992 -- The va_arg macro is invoked when there is no actual next argument, or with a
18993 specified type that is not compatible with the promoted type of the actual next
18994 argument, with certain exceptions (<a href="#7.15.1.1">7.15.1.1</a>).
18995 -- The va_copy or va_start macro is called to initialize a va_list that was
18996 previously initialized by either macro without an intervening invocation of the
18997 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>).
18998 -- The parameter parmN of a va_start macro is declared with the register
18999 storage class, with a function or array type, or with a type that is not compatible with
19000 the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
19002 [<a name="p500" href="#p500">page 500</a>] (<a href="#Contents">Contents</a>)
19004 -- The member designator parameter of an offsetof macro is an invalid right
19005 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
19006 -- The argument in an instance of one of the integer-constant macros is not a decimal,
19007 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
19008 corresponding type (<a href="#7.18.4">7.18.4</a>).
19009 -- A byte input/output function is applied to a wide-oriented stream, or a wide character
19010 input/output function is applied to a byte-oriented stream (<a href="#7.19.2">7.19.2</a>).
19011 -- Use is made of any portion of a file beyond the most recent wide character written to
19012 a wide-oriented stream (<a href="#7.19.2">7.19.2</a>).
19013 -- The value of a pointer to a FILE object is used after the associated file is closed
19014 (<a href="#7.19.3">7.19.3</a>).
19015 -- The stream for the fflush function points to an input stream or to an update stream
19016 in which the most recent operation was input (<a href="#7.19.5.2">7.19.5.2</a>).
19017 -- The string pointed to by the mode argument in a call to the fopen function does not
19018 exactly match one of the specified character sequences (<a href="#7.19.5.3">7.19.5.3</a>).
19019 -- An output operation on an update stream is followed by an input operation without an
19020 intervening call to the fflush function or a file positioning function, or an input
19021 operation on an update stream is followed by an output operation with an intervening
19022 call to a file positioning function (<a href="#7.19.5.3">7.19.5.3</a>).
19023 -- An attempt is made to use the contents of the array that was supplied in a call to the
19024 setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
19025 -- There are insufficient arguments for the format in a call to one of the formatted
19026 input/output functions, or an argument does not have an appropriate type (<a href="#7.19.6.1">7.19.6.1</a>,
19027 <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>).
19028 -- The format in a call to one of the formatted input/output functions or to the
19029 strftime or wcsftime function is not a valid multibyte character sequence that
19030 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>,
19031 <a href="#7.24.5.1">7.24.5.1</a>).
19032 -- In a call to one of the formatted output functions, a precision appears with a
19033 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>).
19034 -- A conversion specification for a formatted output function uses an asterisk to denote
19035 an argument-supplied field width or precision, but the corresponding argument is not
19036 provided (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
19037 -- A conversion specification for a formatted output function uses a # or 0 flag with a
19038 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>).
19040 [<a name="p501" href="#p501">page 501</a>] (<a href="#Contents">Contents</a>)
19042 -- A conversion specification for one of the formatted input/output functions uses a
19043 length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
19044 <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>).
19045 -- An s conversion specifier is encountered by one of the formatted output functions,
19046 and the argument is missing the null terminator (unless a precision is specified that
19047 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>).
19048 -- An n conversion specification for one of the formatted input/output functions includes
19049 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.19.6.1">7.19.6.1</a>,
19050 <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>).
19051 -- A % conversion specifier is encountered by one of the formatted input/output
19052 functions, but the complete conversion specification is not exactly %% (<a href="#7.19.6.1">7.19.6.1</a>,
19053 <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>).
19054 -- An invalid conversion specification is found in the format for one of the formatted
19055 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>,
19056 <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>).
19057 -- The number of characters transmitted by a formatted output function is greater than
19058 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>).
19059 -- The result of a conversion by one of the formatted input functions cannot be
19060 represented in the corresponding object, or the receiving object does not have an
19061 appropriate type (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
19062 -- A c, s, or [ conversion specifier is encountered by one of the formatted input
19063 functions, and the array pointed to by the corresponding argument is not large enough
19064 to accept the input sequence (and a null terminator if the conversion specifier is s or
19065 [) (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
19066 -- A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
19067 formatted input functions, but the input is not a valid multibyte character sequence
19068 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>).
19069 -- The input item for a %p conversion by one of the formatted input functions is not a
19070 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>).
19071 -- The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
19072 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
19073 vwscanf function is called with an improperly initialized va_list argument, or
19074 the argument is used (other than in an invocation of va_end) after the function
19075 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>,
19076 <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>).
19077 -- The contents of the array supplied in a call to the fgets, gets, or fgetws function
19078 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>).
19080 [<a name="p502" href="#p502">page 502</a>] (<a href="#Contents">Contents</a>)
19082 -- The file position indicator for a binary stream is used after a call to the ungetc
19083 function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
19084 -- The file position indicator for a stream is used after an error occurred during a call to
19085 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>).
19086 -- A partial element read by a call to the fread function is used (<a href="#7.19.8.1">7.19.8.1</a>).
19087 -- The fseek function is called for a text stream with a nonzero offset and either the
19088 offset was not returned by a previous successful call to the ftell function on a
19089 stream associated with the same file or whence is not SEEK_SET (<a href="#7.19.9.2">7.19.9.2</a>).
19090 -- The fsetpos function is called to set a position that was not returned by a previous
19091 successful call to the fgetpos function on a stream associated with the same file
19092 (<a href="#7.19.9.3">7.19.9.3</a>).
19093 -- A non-null pointer returned by a call to the calloc, malloc, or realloc function
19094 with a zero requested size is used to access an object (<a href="#7.20.3">7.20.3</a>).
19095 -- The value of a pointer that refers to space deallocated by a call to the free or
19096 realloc function is used (<a href="#7.20.3">7.20.3</a>).
19097 -- The pointer argument to the free or realloc function does not match a pointer
19098 earlier returned by calloc, malloc, or realloc, or the space has been
19099 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>).
19100 -- The value of the object allocated by the malloc function is used (<a href="#7.20.3.3">7.20.3.3</a>).
19101 -- The value of any bytes in a new object allocated by the realloc function beyond
19102 the size of the old object are used (<a href="#7.20.3.4">7.20.3.4</a>).
19103 -- The program executes more than one call to the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
19104 -- During the call to a function registered with the atexit function, a call is made to
19105 the longjmp function that would terminate the call to the registered function
19106 (<a href="#7.20.4.3">7.20.4.3</a>).
19107 -- The string set up by the getenv or strerror function is modified by the program
19108 (<a href="#7.20.4.5">7.20.4.5</a>, <a href="#7.21.6.2">7.21.6.2</a>).
19109 -- A command is executed through the system function in a way that is documented as
19110 causing termination or some other form of undefined behavior (<a href="#7.20.4.6">7.20.4.6</a>).
19111 -- A searching or sorting utility function is called with an invalid pointer argument, even
19112 if the number of elements is zero (<a href="#7.20.5">7.20.5</a>).
19113 -- The comparison function called by a searching or sorting utility function alters the
19114 contents of the array being searched or sorted, or returns ordering values
19115 inconsistently (<a href="#7.20.5">7.20.5</a>).
19117 [<a name="p503" href="#p503">page 503</a>] (<a href="#Contents">Contents</a>)
19119 -- The array being searched by the bsearch function does not have its elements in
19120 proper order (<a href="#7.20.5.1">7.20.5.1</a>).
19121 -- The current conversion state is used by a multibyte/wide character conversion
19122 function after changing the LC_CTYPE category (<a href="#7.20.7">7.20.7</a>).
19123 -- A string or wide string utility function is instructed to access an array beyond the end
19124 of an object (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
19125 -- A string or wide string utility function is called with an invalid pointer argument, even
19126 if the length is zero (<a href="#7.21.1">7.21.1</a>, <a href="#7.24.4">7.24.4</a>).
19127 -- The contents of the destination array are used after a call to the strxfrm,
19128 strftime, wcsxfrm, or wcsftime function in which the specified length was
19129 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>,
19130 <a href="#7.24.5.1">7.24.5.1</a>).
19131 -- The first argument in the very first call to the strtok or wcstok is a null pointer
19132 (<a href="#7.21.5.8">7.21.5.8</a>, <a href="#7.24.4.5.7">7.24.4.5.7</a>).
19133 -- The type of an argument to a type-generic macro is not compatible with the type of
19134 the corresponding parameter of the selected function (<a href="#7.22">7.22</a>).
19135 -- A complex argument is supplied for a generic parameter of a type-generic macro that
19136 has no corresponding complex function (<a href="#7.22">7.22</a>).
19137 -- The argument corresponding to an s specifier without an l qualifier in a call to the
19138 fwprintf function does not point to a valid multibyte character sequence that
19139 begins in the initial shift state (<a href="#7.24.2.11">7.24.2.11</a>).
19140 -- In a call to the wcstok function, the object pointed to by ptr does not have the
19141 value stored by the previous call for the same wide string (<a href="#7.24.4.5.7">7.24.4.5.7</a>).
19142 -- An mbstate_t object is used inappropriately (<a href="#7.24.6">7.24.6</a>).
19143 -- The value of an argument of type wint_t to a wide character classification or case
19144 mapping function is neither equal to the value of WEOF nor representable as a
19145 wchar_t (<a href="#7.25.1">7.25.1</a>).
19146 -- The iswctype function is called using a different LC_CTYPE category from the
19147 one in effect for the call to the wctype function that returned the description
19148 (<a href="#7.25.2.2.1">7.25.2.2.1</a>).
19149 -- The towctrans function is called using a different LC_CTYPE category from the
19150 one in effect for the call to the wctrans function that returned the description
19151 (<a href="#7.25.3.2.1">7.25.3.2.1</a>).
19153 [<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
19155 <a name="J.3" href="#J.3"><b> J.3 Implementation-defined behavior</b></a>
19156 1 A conforming implementation is required to document its choice of behavior in each of
19157 the areas listed in this subclause. The following are implementation-defined:
19158 <a name="J.3.1" href="#J.3.1"><b> J.3.1 Translation</b></a>
19159 1 -- How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
19160 -- Whether each nonempty sequence of white-space characters other than new-line is
19161 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
19162 <a name="J.3.2" href="#J.3.2"><b> J.3.2 Environment</b></a>
19163 1 -- The mapping between physical source file multibyte characters and the source
19164 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
19165 -- The name and type of the function called at program startup in a freestanding
19166 environment (<a href="#5.1.2.1">5.1.2.1</a>).
19167 -- The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
19168 -- An alternative manner in which the main function may be defined (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
19169 -- 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>).
19170 -- What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
19171 -- The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
19172 -- Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
19173 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
19174 -- Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
19175 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
19176 -- The set of environment names and the method for altering the environment list used
19177 by the getenv function (<a href="#7.20.4.5">7.20.4.5</a>).
19178 -- The manner of execution of the string by the system function (<a href="#7.20.4.6">7.20.4.6</a>).
19179 <a name="J.3.3" href="#J.3.3"><b> J.3.3 Identifiers</b></a>
19180 1 -- Which additional multibyte characters may appear in identifiers and their
19181 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
19182 -- 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>).
19184 [<a name="p505" href="#p505">page 505</a>] (<a href="#Contents">Contents</a>)
19186 <a name="J.3.4" href="#J.3.4"><b> J.3.4 Characters</b></a>
19187 1 -- The number of bits in a byte (<a href="#3.6">3.6</a>).
19188 -- The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
19189 -- The unique value of the member of the execution character set produced for each of
19190 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
19191 -- The value of a char object into which has been stored any character other than a
19192 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
19193 -- Which of signed char or unsigned char has the same range, representation,
19194 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>).
19195 -- The mapping of members of the source character set (in character constants and string
19196 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>).
19197 -- The value of an integer character constant containing more than one character or
19198 containing a character or escape sequence that does not map to a single-byte
19199 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
19200 -- The value of a wide character constant containing more than one multibyte character,
19201 or containing a multibyte character or escape sequence not represented in the
19202 extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
19203 -- The current locale used to convert a wide character constant consisting of a single
19204 multibyte character that maps to a member of the extended execution character set
19205 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
19206 -- The current locale used to convert a wide string literal into corresponding wide
19207 character codes (<a href="#6.4.5">6.4.5</a>).
19208 -- The value of a string literal containing a multibyte character or escape sequence not
19209 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
19210 <a name="J.3.5" href="#J.3.5"><b> J.3.5 Integers</b></a>
19211 1 -- Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
19212 -- Whether signed integer types are represented using sign and magnitude, two's
19213 complement, or ones' complement, and whether the extraordinary value is a trap
19214 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
19215 -- The rank of any extended integer type relative to another extended integer type with
19216 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
19217 -- The result of, or the signal raised by, converting an integer to a signed integer type
19218 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
19220 [<a name="p506" href="#p506">page 506</a>] (<a href="#Contents">Contents</a>)
19222 -- The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
19223 <a name="J.3.6" href="#J.3.6"><b> J.3.6 Floating point</b></a>
19224 1 -- The accuracy of the floating-point operations and of the library functions in
19225 <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>).
19226 -- The accuracy of the conversions between floating-point internal representations and
19227 string representations performed by the library functions in <a href="#7.19">&lt;stdio.h&gt;</a>,
19228 <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>).
19229 -- The rounding behaviors characterized by non-standard values of FLT_ROUNDS
19230 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
19231 -- The evaluation methods characterized by non-standard negative values of
19232 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
19233 -- The direction of rounding when an integer is converted to a floating-point number that
19234 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
19235 -- The direction of rounding when a floating-point number is converted to a narrower
19236 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
19237 -- How the nearest representable value or the larger or smaller representable value
19238 immediately adjacent to the nearest representable value is chosen for certain floating
19239 constants (<a href="#6.4.4.2">6.4.4.2</a>).
19240 -- Whether and how floating expressions are contracted when not disallowed by the
19241 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
19242 -- The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
19243 -- Additional floating-point exceptions, rounding modes, environments, and
19244 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
19245 -- The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>). *
19246 <a name="J.3.7" href="#J.3.7"><b> J.3.7 Arrays and pointers</b></a>
19247 1 -- The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
19248 -- The size of the result of subtracting two pointers to elements of the same array
19249 (<a href="#6.5.6">6.5.6</a>).
19251 [<a name="p507" href="#p507">page 507</a>] (<a href="#Contents">Contents</a>)
19253 <a name="J.3.8" href="#J.3.8"><b> J.3.8 Hints</b></a>
19254 1 -- The extent to which suggestions made by using the register storage-class
19255 specifier are effective (<a href="#6.7.1">6.7.1</a>).
19256 -- The extent to which suggestions made by using the inline function specifier are
19257 effective (<a href="#6.7.4">6.7.4</a>).
19258 <a name="J.3.9" href="#J.3.9"><b> J.3.9 Structures, unions, enumerations, and bit-fields</b></a>
19259 1 -- Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
19260 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
19261 -- Allowable bit-field types other than _Bool, signed int, and unsigned int
19262 (<a href="#6.7.2.1">6.7.2.1</a>).
19263 -- Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
19264 -- The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
19265 -- The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
19266 no problem unless binary data written by one implementation is read by another.
19267 -- The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
19268 <a name="J.3.10" href="#J.3.10"><b> J.3.10 Qualifiers</b></a>
19269 1 -- What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
19270 <a name="J.3.11" href="#J.3.11"><b> J.3.11 Preprocessing directives</b></a>
19271 1 -- The locations within #pragma directives where header name preprocessing tokens
19272 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
19273 -- How sequences in both forms of header names are mapped to headers or external
19274 source file names (<a href="#6.4.7">6.4.7</a>).
19275 -- Whether the value of a character constant in a constant expression that controls
19276 conditional inclusion matches the value of the same character constant in the
19277 execution character set (<a href="#6.10.1">6.10.1</a>).
19278 -- Whether the value of a single-character character constant in a constant expression
19279 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
19280 -- The places that are searched for an included &lt; &gt; delimited header, and how the places
19281 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
19282 -- How the named source file is searched for in an included " " delimited header
19283 (<a href="#6.10.2">6.10.2</a>).
19284 -- The method by which preprocessing tokens (possibly resulting from macro
19285 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
19287 [<a name="p508" href="#p508">page 508</a>] (<a href="#Contents">Contents</a>)
19289 -- The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
19290 -- Whether the # operator inserts a \ character before the \ character that begins a
19291 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
19292 -- The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
19293 -- The definitions for __DATE__ and __TIME__ when respectively, the date and
19294 time of translation are not available (<a href="#6.10.8">6.10.8</a>).
19295 <a name="J.3.12" href="#J.3.12"><b> J.3.12 Library functions</b></a>
19296 1 -- Any library facilities available to a freestanding program, other than the minimal set
19297 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
19298 -- The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
19299 -- The representation of the floating-point status flags stored by the
19300 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
19301 -- Whether the feraiseexcept function raises the ''inexact'' floating-point
19302 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
19303 (<a href="#7.6.2.3">7.6.2.3</a>).
19304 -- Strings other than "C" and "" that may be passed as the second argument to the
19305 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
19306 -- The types defined for float_t and double_t when the value of the
19307 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
19308 -- Domain errors for the mathematics functions, other than those required by this
19309 International Standard (<a href="#7.12.1">7.12.1</a>).
19310 -- The values returned by the mathematics functions on domain errors (<a href="#7.12.1">7.12.1</a>).
19311 -- The values returned by the mathematics functions on underflow range errors, whether
19312 errno is set to the value of the macro ERANGE when the integer expression
19313 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
19314 floating-point exception is raised when the integer expression math_errhandling
19315 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
19316 -- Whether a domain error occurs or zero is returned when an fmod function has a
19317 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
19318 -- Whether a domain error occurs or zero is returned when a remainder function has
19319 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
19320 -- The base-2 logarithm of the modulus used by the remquo functions in reducing the
19321 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
19323 [<a name="p509" href="#p509">page 509</a>] (<a href="#Contents">Contents</a>)
19325 -- Whether a domain error occurs or zero is returned when a remquo function has a
19326 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
19327 -- Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
19328 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>).
19329 -- The null pointer constant to which the macro NULL expands (<a href="#7.17">7.17</a>).
19330 -- Whether the last line of a text stream requires a terminating new-line character
19331 (<a href="#7.19.2">7.19.2</a>).
19332 -- Whether space characters that are written out to a text stream immediately before a
19333 new-line character appear when read in (<a href="#7.19.2">7.19.2</a>).
19334 -- The number of null characters that may be appended to data written to a binary
19335 stream (<a href="#7.19.2">7.19.2</a>).
19336 -- Whether the file position indicator of an append-mode stream is initially positioned at
19337 the beginning or end of the file (<a href="#7.19.3">7.19.3</a>).
19338 -- Whether a write on a text stream causes the associated file to be truncated beyond that
19339 point (<a href="#7.19.3">7.19.3</a>).
19340 -- The characteristics of file buffering (<a href="#7.19.3">7.19.3</a>).
19341 -- Whether a zero-length file actually exists (<a href="#7.19.3">7.19.3</a>).
19342 -- The rules for composing valid file names (<a href="#7.19.3">7.19.3</a>).
19343 -- Whether the same file can be simultaneously open multiple times (<a href="#7.19.3">7.19.3</a>).
19344 -- The nature and choice of encodings used for multibyte characters in files (<a href="#7.19.3">7.19.3</a>).
19345 -- The effect of the remove function on an open file (<a href="#7.19.4.1">7.19.4.1</a>).
19346 -- The effect if a file with the new name exists prior to a call to the rename function
19347 (<a href="#7.19.4.2">7.19.4.2</a>).
19348 -- Whether an open temporary file is removed upon abnormal program termination
19349 (<a href="#7.19.4.3">7.19.4.3</a>).
19350 -- Which changes of mode are permitted (if any), and under what circumstances
19351 (<a href="#7.19.5.4">7.19.5.4</a>).
19352 -- The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
19353 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>).
19354 -- The output for %p conversion in the fprintf or fwprintf function (<a href="#7.19.6.1">7.19.6.1</a>,
19355 <a href="#7.24.2.1">7.24.2.1</a>).
19356 -- The interpretation of a - character that is neither the first nor the last character, nor
19357 the second where a ^ character is the first, in the scanlist for %[ conversion in the
19358 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>).
19360 [<a name="p510" href="#p510">page 510</a>] (<a href="#Contents">Contents</a>)
19362 -- The set of sequences matched by a %p conversion and the interpretation of the
19363 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>).
19364 -- The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
19365 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>).
19366 -- The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
19367 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
19368 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>).
19369 -- Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
19370 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>).
19371 -- Whether the calloc, malloc, and realloc functions return a null pointer or a
19372 pointer to an allocated object when the size requested is zero (<a href="#7.20.3">7.20.3</a>).
19373 -- Whether open streams with unwritten buffered data are flushed, open streams are
19374 closed, or temporary files are removed when the abort or _Exit function is called
19375 (<a href="#7.20.4.1">7.20.4.1</a>, <a href="#7.20.4.4">7.20.4.4</a>).
19376 -- The termination status returned to the host environment by the abort, exit, or
19377 _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>).
19378 -- The value returned by the system function when its argument is not a null pointer
19379 (<a href="#7.20.4.6">7.20.4.6</a>).
19380 -- The local time zone and Daylight Saving Time (<a href="#7.23.1">7.23.1</a>).
19381 -- The range and precision of times representable in clock_t and time_t (<a href="#7.23">7.23</a>).
19382 -- The era for the clock function (<a href="#7.23.2.1">7.23.2.1</a>).
19383 -- The replacement string for the %Z specifier to the strftime, and wcsftime
19384 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>).
19385 -- Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
19386 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.9">F.9</a>).
19387 <a name="J.3.13" href="#J.3.13"><b> J.3.13 Architecture</b></a>
19388 1 -- The values or expressions assigned to the macros specified in the headers
19389 <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>).
19390 -- The number, order, and encoding of bytes in any object (when not explicitly specified
19391 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
19392 -- The value of the result of the sizeof operator (<a href="#6.5.3.4">6.5.3.4</a>).
19394 [<a name="p511" href="#p511">page 511</a>] (<a href="#Contents">Contents</a>)
19396 <a name="J.4" href="#J.4"><b> J.4 Locale-specific behavior</b></a>
19397 1 The following characteristics of a hosted environment are locale-specific and are required
19398 to be documented by the implementation:
19399 -- Additional members of the source and execution character sets beyond the basic
19400 character set (<a href="#5.2.1">5.2.1</a>).
19401 -- The presence, meaning, and representation of additional multibyte characters in the
19402 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
19403 -- The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
19404 -- The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
19405 -- The decimal-point character (<a href="#7.1.1">7.1.1</a>).
19406 -- The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
19407 -- The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.25.2">7.25.2</a>).
19408 -- The sets of characters tested for by the isalpha, isblank, islower, ispunct,
19409 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
19410 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>,
19411 <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>).
19412 -- The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
19413 -- Additional subject sequences accepted by the numeric conversion functions (<a href="#7.20.1">7.20.1</a>,
19414 <a href="#7.24.4.1">7.24.4.1</a>).
19415 -- 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>).
19416 -- The contents of the error message strings set up by the strerror function
19417 (<a href="#7.21.6.2">7.21.6.2</a>).
19418 -- 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>).
19419 -- Character mappings that are supported by the towctrans function (<a href="#7.25.1">7.25.1</a>).
19420 -- Character classifications that are supported by the iswctype function (<a href="#7.25.1">7.25.1</a>).
19422 [<a name="p512" href="#p512">page 512</a>] (<a href="#Contents">Contents</a>)
19424 <a name="J.5" href="#J.5"><b> J.5 Common extensions</b></a>
19425 1 The following extensions are widely used in many systems, but are not portable to all
19426 implementations. The inclusion of any extension that may cause a strictly conforming
19427 program to become invalid renders an implementation nonconforming. Examples of such
19428 extensions are new keywords, extra library functions declared in standard headers, or
19429 predefined macros with names that do not begin with an underscore.
19430 <a name="J.5.1" href="#J.5.1"><b> J.5.1 Environment arguments</b></a>
19431 1 In a hosted environment, the main function receives a third argument, char *envp[],
19432 that points to a null-terminated array of pointers to char, each of which points to a string
19433 that provides information about the environment for this execution of the program
19434 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
19435 <a name="J.5.2" href="#J.5.2"><b> J.5.2 Specialized identifiers</b></a>
19436 1 Characters other than the underscore _, letters, and digits, that are not part of the basic
19437 source character set (such as the dollar sign $, or characters in national character sets)
19438 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
19439 <a name="J.5.3" href="#J.5.3"><b> J.5.3 Lengths and cases of identifiers</b></a>
19440 1 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
19441 <a name="J.5.4" href="#J.5.4"><b> J.5.4 Scopes of identifiers</b></a>
19442 1 A function identifier, or the identifier of an object the declaration of which contains the
19443 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
19444 <a name="J.5.5" href="#J.5.5"><b> J.5.5 Writable string literals</b></a>
19445 1 String literals are modifiable (in which case, identical string literals should denote distinct
19446 objects) (<a href="#6.4.5">6.4.5</a>).
19447 <a name="J.5.6" href="#J.5.6"><b> J.5.6 Other arithmetic types</b></a>
19448 1 Additional arithmetic types, such as __int128 or double double, and their
19449 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
19450 more range or precision than long double, may be used for evaluating expressions of
19451 other floating types, and may be used to define float_t or double_t.
19453 [<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
19455 <a name="J.5.7" href="#J.5.7"><b> J.5.7 Function pointer casts</b></a>
19456 1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
19457 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
19458 2 A pointer to a function may be cast to a pointer to an object or to void, allowing a
19459 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
19460 <a name="J.5.8" href="#J.5.8"><b> J.5.8 Extended bit-field types</b></a>
19461 1 A bit-field may be declared with a type other than _Bool, unsigned int, or
19462 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
19463 <a name="J.5.9" href="#J.5.9"><b> J.5.9 The fortran keyword</b></a>
19464 1 The fortran function specifier may be used in a function declaration to indicate that
19465 calls suitable for FORTRAN should be generated, or that a different representation for the
19466 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
19467 <a name="J.5.10" href="#J.5.10"><b> J.5.10 The asm keyword</b></a>
19468 1 The asm keyword may be used to insert assembly language directly into the translator
19469 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
19470 asm ( character-string-literal );
19471 <a name="J.5.11" href="#J.5.11"><b> J.5.11 Multiple external definitions</b></a>
19472 1 There may be more than one external definition for the identifier of an object, with or
19473 without the explicit use of the keyword extern; if the definitions disagree, or more than
19474 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
19475 <a name="J.5.12" href="#J.5.12"><b> J.5.12 Predefined macro names</b></a>
19476 1 Macro names that do not begin with an underscore, describing the translation and
19477 execution environments, are defined by the implementation before translation begins
19478 (<a href="#6.10.8">6.10.8</a>).
19479 <a name="J.5.13" href="#J.5.13"><b> J.5.13 Floating-point status flags</b></a>
19480 1 If any floating-point status flags are set on normal termination after all calls to functions
19481 registered by the atexit function have been made (see <a href="#7.20.4.3">7.20.4.3</a>), the implementation
19482 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
19484 [<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
19486 <a name="J.5.14" href="#J.5.14"><b> J.5.14 Extra arguments for signal handlers</b></a>
19487 1 Handlers for specific signals are called with extra arguments in addition to the signal
19488 number (<a href="#7.14.1.1">7.14.1.1</a>).
19489 <a name="J.5.15" href="#J.5.15"><b> J.5.15 Additional stream types and file-opening modes</b></a>
19490 1 Additional mappings from files to streams are supported (<a href="#7.19.2">7.19.2</a>).
19491 2 Additional file-opening modes may be specified by characters appended to the mode
19492 argument of the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
19493 <a name="J.5.16" href="#J.5.16"><b> J.5.16 Defined file position indicator</b></a>
19494 1 The file position indicator is decremented by each successful call to the ungetc or
19495 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>,
19496 <a name="7.24.3.10)" href="#7.24.3.10)"><b> 7.24.3.10).</b></a>
19497 <a name="J.5.17" href="#J.5.17"><b> J.5.17 Math error reporting</b></a>
19498 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
19499 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
19500 <a name="7.12)" href="#7.12)"><b> 7.12).</b></a>
19502 [<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
19505 <a name="Bibliography" href="#Bibliography"><b> Bibliography</b></a>
19506 1. ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
19507 published in The C Programming Language by Brian W. Kernighan and Dennis
19508 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
19509 2. 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
19510 California, USA, November 1984.
19511 3. ANSI X3/TR-1-82 (1982), American National Dictionary for Information
19512 Processing Systems, Information Processing Systems Technical Report.
19513 4. ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
19514 Arithmetic.
19515 5. ANSI/IEEE 854-1988, American National Standard for Radix-Independent
19516 Floating-Point Arithmetic.
19517 6. IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
19518 second edition (previously designated IEC 559:1989).
19519 7. ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
19520 symbols for use in the physical sciences and technology.
19521 8. ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
19522 information interchange.
19523 9. ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
19524 Fundamental terms.
19525 10. ISO 4217:1995, Codes for the representation of currencies and funds.
19526 11. ISO 8601:1988, Data elements and interchange formats -- Information
19527 interchange -- Representation of dates and times.
19528 12. ISO/IEC 9899:1990, Programming languages -- C.
19529 13. ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
19530 14. ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
19531 15. ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
19532 16. ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
19533 Interface (POSIX) -- Part 2: Shell and Utilities.
19534 17. ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
19535 preparation of programming language standards.
19536 18. ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
19537 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
19539 [<a name="p516" href="#p516">page 516</a>] (<a href="#Contents">Contents</a>)
19541 19. ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
19542 ISO/IEC 10646-1:1993.
19543 20. ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
19544 ISO/IEC 10646-1:1993.
19545 21. ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
19546 Transformation Format for 16 planes of group 00 (UTF-16).
19547 22. ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
19548 Transformation Format 8 (UTF-8).
19549 23. ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
19550 24. ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
19551 25. ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
19552 syllables.
19553 26. ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993 Tibetan.
19554 27. ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
19555 additional characters.
19556 28. ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
19557 29. ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
19558 Identifiers for characters.
19559 30. ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
19560 Ethiopic.
19561 31. ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
19562 Unified Canadian Aboriginal Syllabics.
19563 32. ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
19564 Cherokee.
19565 33. ISO/IEC 10967-1:1994, Information technology -- Language independent
19566 arithmetic -- Part 1: Integer and floating point arithmetic.
19568 [<a name="p517" href="#p517">page 517</a>] (<a href="#Contents">Contents</a>)
19571 [<a name="p518" href="#p518">page 518</a>] (<a href="#Contents">Contents</a>)
19574 <a name="Index" href="#Index"><b>Index</b></a>
19575 ??? 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>,
19576 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.8">6.7.8</a>
19577 ??? 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>
19578 ! (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>
19579 != (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>
19580 # 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>
19581 # 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>
19582 # punctuator, <a href="#6.10">6.10</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
19583 ## 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>,
19584 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> <a href="#6.5.2.3">6.5.2.3</a>
19585 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.8">6.7.8</a>
19586 #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>
19587 #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>
19588 #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>
19589 #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>
19590 <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>
19591 #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>
19592 #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>
19593 #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>,
19594 <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>
19595 #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>
19596 #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>
19597 #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>
19598 <a href="#7.1.4">7.1.4</a> &lt;&lt; (left-shift operator), <a href="#6.5.7">6.5.7</a>
19599 % (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>
19600 %: (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>
19601 %:%: (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>
19602 %= (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>,
19603 %&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>
19604 &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>
19605 &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>
19606 &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>,
19607 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#H">H</a>
19608 ' ' (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>,
19609 <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>
19610 ( ) (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>
19611 ( ) (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>
19612 ( ) (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>
19613 ( ){ } (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>
19614 * (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>,
19615 * (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>
19616 * (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>
19617 *= (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>
19618 + (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>
19619 <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>
19620 + (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>,
19621 ++ (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>
19622 ++ (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>,
19623 += (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>
19624 , (comma operator), <a href="#6.5.17">6.5.17</a>
19626 [<a name="p519" href="#p519">page 519</a>] (<a href="#Contents">Contents</a>)
19628 <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>
19629 <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>
19630 <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>
19631 <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>
19632 <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>
19633 <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>
19634 <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>
19635 <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>
19636 = (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>
19637 = (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>
19638 == (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>
19639 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
19640 &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>
19641 &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>
19642 &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>,
19643 ? : (conditional operator), <a href="#6.5.15">6.5.15</a> <a href="#7.18.3">7.18.3</a>
19644 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
19645 [ ] (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>
19646 [ ] (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>
19647 \ (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>
19648 \ (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>
19649 \" (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>
19650 <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>
19651 \\ (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>
19652 \' (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>
19653 \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>
19654 padding of binary stream, <a href="#7.19.2">7.19.2</a> _Imaginary keyword, <a href="#G.2">G.2</a>
19655 \? (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>
19656 \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>
19657 \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>
19658 \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>
19659 <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>
19660 \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>
19661 <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>,
19662 \octal digits (octal-character escape sequence), <a href="#6.8.2">6.8.2</a>
19663 <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>
19664 \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>
19665 <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),
19666 \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>
19667 <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>
19668 \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>
19669 \u (universal character names), <a href="#6.4.3">6.4.3</a>
19670 \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>,
19671 <a href="#7.4.1.10">7.4.1.10</a> <a href="#7.20.4.1">7.20.4.1</a>
19672 \x hexadecimal digits (hexadecimal-character abs function, <a href="#7.20.6.1">7.20.6.1</a>
19673 escape sequence), <a href="#6.4.4.4">6.4.4.4</a> absolute-value functions
19674 ^ (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>
19675 ^= (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>
19676 <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>
19677 __bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
19678 macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
19680 [<a name="p520" href="#p520">page 520</a>] (<a href="#Contents">Contents</a>)
19682 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
19683 accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
19684 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>
19685 acos type-generic macro, <a href="#7.22">7.22</a> initialization, <a href="#6.7.8">6.7.8</a>
19686 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>
19687 acosh type-generic macro, <a href="#7.22">7.22</a> parameter, <a href="#6.9.1">6.9.1</a>
19688 active position, <a href="#5.2.2">5.2.2</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
19689 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>
19690 actual parameter (deprecated), <a href="#3.3">3.3</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
19691 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> type, <a href="#6.2.5">6.2.5</a>
19692 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>
19693 <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>
19694 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>
19695 address constant, <a href="#6.6">6.6</a> as-if rule, <a href="#5.1.2.3">5.1.2.3</a>
19696 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>
19697 aggregate initialization, <a href="#6.7.8">6.7.8</a> asctime function, <a href="#7.23.3.1">7.23.3.1</a>
19698 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>
19699 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>
19700 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>
19701 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>
19702 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>
19703 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>
19704 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>
19705 and macro, <a href="#7.9">7.9</a> assignment
19706 AND operators compound, <a href="#6.5.16.2">6.5.16.2</a>
19707 bitwise (&amp;), <a href="#6.5.10">6.5.10</a> conversion, <a href="#6.5.16.1">6.5.16.1</a>
19708 bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a> expression, <a href="#6.5.16">6.5.16</a>
19709 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>
19710 and_eq macro, <a href="#7.9">7.9</a> simple, <a href="#6.5.16.1">6.5.16.1</a>
19711 ANSI/IEEE 754, <a href="#F.1">F.1</a> associativity of operators, <a href="#6.5">6.5</a>
19712 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>
19713 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>
19714 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>
19715 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>
19716 default promotions, <a href="#6.5.2.2">6.5.2.2</a> atan2 type-generic macro, <a href="#7.22">7.22</a>
19717 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>
19718 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>
19719 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>,
19720 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>
19721 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>
19722 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>
19723 conversions atol function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
19724 arithmetic operators atoll function, <a href="#7.20.1">7.20.1</a>, <a href="#7.20.1.2">7.20.1.2</a>
19725 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>
19726 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>
19727 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>
19728 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>
19729 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>
19730 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>
19731 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>
19732 arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
19734 [<a name="p521" href="#p521">page 521</a>] (<a href="#Contents">Contents</a>)
19736 behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
19737 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>,
19738 <a href="#7.19.9.4">7.19.9.4</a> <a href="#7.20.3.4">7.20.3.4</a>
19739 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>
19740 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>
19741 low order, <a href="#3.6">3.6</a> carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>,
19742 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>
19743 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>
19744 bitor macro, <a href="#7.9">7.9</a> case mapping functions
19745 bitwise operators, <a href="#6.5">6.5</a> character, <a href="#7.4.2">7.4.2</a>
19746 AND, <a href="#6.5.10">6.5.10</a> wide character, <a href="#7.25.3.1">7.25.3.1</a>
19747 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>
19748 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>
19749 exclusive OR, <a href="#6.5.11">6.5.11</a> type-generic macro for, <a href="#7.22">7.22</a>
19750 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>
19751 inclusive OR, <a href="#6.5.12">6.5.12</a> type-generic macro for, <a href="#7.22">7.22</a>
19752 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>
19753 shift, <a href="#6.5.7">6.5.7</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
19754 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>
19755 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>
19756 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>
19757 block structure, <a href="#6.2.1">6.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
19758 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>
19759 bool macro, <a href="#7.16">7.16</a> cbrt type-generic macro, <a href="#7.22">7.22</a>
19760 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>
19761 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>
19762 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>
19763 <a href="#6.8.2">6.8.2</a> type-generic macro for, <a href="#7.22">7.22</a>
19764 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>
19765 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>
19766 branch cuts, <a href="#7.3.3">7.3.3</a> cerf function, <a href="#7.26.1">7.26.1</a>
19767 break statement, <a href="#6.8.6.3">6.8.6.3</a> cerfc function, <a href="#7.26.1">7.26.1</a>
19768 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>
19769 <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>
19770 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>
19771 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>
19772 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>
19773 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>,
19774 byte input/output functions, <a href="#7.19.1">7.19.1</a> <a href="#6.3.1.8">6.3.1.8</a>
19775 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>
19776 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>
19777 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>
19778 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>
19779 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>
19780 type-generic macro for, <a href="#7.22">7.22</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
19781 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>
19782 type-generic macro for, <a href="#7.22">7.22</a> extensible, <a href="#7.25.3.2">7.25.3.2</a>
19783 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>
19784 type-generic macro for, <a href="#7.22">7.22</a> wide character, <a href="#7.25.2.1">7.25.2.1</a>
19785 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>
19786 <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>
19788 [<a name="p522" href="#p522">page 522</a>] (<a href="#Contents">Contents</a>)
19790 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>,
19791 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>
19792 character input/output functions, <a href="#7.19.7">7.19.7</a> compliance, see conformance
19793 wide character, <a href="#7.24.3">7.24.3</a> components of time, <a href="#7.23.1">7.23.1</a>
19794 character sets, <a href="#5.2.1">5.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
19795 character string literal, see string literal compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
19796 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>
19797 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>
19798 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>
19799 cimag type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> concatenation functions
19800 cis function, <a href="#G.6">G.6</a> string, <a href="#7.21.3">7.21.3</a>
19801 classification functions wide string, <a href="#7.24.4.3">7.24.4.3</a>
19802 character, <a href="#7.4.1">7.4.1</a> concatenation, preprocessing, see preprocessing
19803 floating-point, <a href="#7.12.3">7.12.3</a> concatenation
19804 wide character, <a href="#7.25.2.1">7.25.2.1</a> conceptual models, <a href="#5.1">5.1</a>
19805 extensible, <a href="#7.25.2.2">7.25.2.2</a> conditional inclusion, <a href="#6.10.1">6.10.1</a>
19806 clearerr function, <a href="#7.19.10.1">7.19.10.1</a> conditional operator (? :), <a href="#6.5.15">6.5.15</a>
19807 clgamma function, <a href="#7.26.1">7.26.1</a> conformance, <a href="#4">4</a>
19808 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>
19809 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>
19810 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>
19811 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>
19812 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>
19813 clog10 function, <a href="#7.26.1">7.26.1</a> constants, <a href="#6.4.4">6.4.4</a>
19814 clog1p function, <a href="#7.26.1">7.26.1</a> as primary expression, <a href="#6.5.1">6.5.1</a>
19815 clog2 function, <a href="#7.26.1">7.26.1</a> character, <a href="#6.4.4.4">6.4.4.4</a>
19816 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>
19817 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>
19818 comma operator (,), <a href="#6.5.17">6.5.17</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
19819 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>
19820 <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>
19821 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>
19822 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>
19823 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>
19824 common extensions, <a href="#J.5">J.5</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
19825 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>
19826 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>
19827 common warnings, <a href="#I">I</a> control wide character, <a href="#7.25.2">7.25.2</a>
19828 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>
19829 string, <a href="#7.21.4">7.21.4</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
19830 wide string, <a href="#7.24.4.4">7.24.4.4</a> array argument, <a href="#6.9.1">6.9.1</a> *
19831 comparison macros, <a href="#7.12.14">7.12.14</a> array parameter, <a href="#6.9.1">6.9.1</a>
19832 comparison, pointer, <a href="#6.5.8">6.5.8</a> arrays, <a href="#6.3.2.1">6.3.2.1</a>
19833 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>
19834 compl macro, <a href="#7.9">7.9</a> boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a>
19835 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>
19836 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>
19837 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>
19838 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>
19839 complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
19840 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>
19842 [<a name="p523" href="#p523">page 523</a>] (<a href="#Contents">Contents</a>)
19844 function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
19845 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>
19846 imaginary, <a href="#G.4.1">G.4.1</a> type-generic macro for, <a href="#7.22">7.22</a>
19847 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>
19848 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.22">7.22</a>
19849 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>
19850 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>
19851 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>
19852 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.22">7.22</a>
19853 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>
19854 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>
19855 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>
19856 usual arithmetic, see usual arithmetic current object, <a href="#6.7.8">6.7.8</a>
19857 conversions CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
19858 void type, <a href="#6.3.2.2">6.3.2.2</a>
19859 conversion functions data stream, see streams
19860 multibyte/wide character, <a href="#7.20.7">7.20.7</a> date and time header, <a href="#7.23">7.23</a>
19861 extended, <a href="#7.24.6">7.24.6</a> Daylight Saving Time, <a href="#7.23.1">7.23.1</a>
19862 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>
19863 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>
19864 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>
19865 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>
19866 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>
19867 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>
19868 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>
19869 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>
19870 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>
19871 <a href="#7.24.2.2">7.24.2.2</a> decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
19872 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>
19873 <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>
19874 <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>,
19875 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>
19876 copying functions declaration specifiers, <a href="#6.7">6.7</a>
19877 string, <a href="#7.21.2">7.21.2</a> declarations, <a href="#6.7">6.7</a>
19878 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>
19879 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>
19880 <a href="#F.9.8.1">F.9.8.1</a> structure/union, <a href="#6.7.2.1">6.7.2.1</a>
19881 copysign type-generic macro, <a href="#7.22">7.22</a> typedef, <a href="#6.7.7">6.7.7</a>
19882 correctly rounded result, <a href="#3.9">3.9</a> declarator, <a href="#6.7.5">6.7.5</a>
19883 corresponding real type, <a href="#6.2.5">6.2.5</a> abstract, <a href="#6.7.6">6.7.6</a>
19884 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>
19885 cos type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> decrement operators, see arithmetic operators,
19886 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
19887 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>
19888 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>
19889 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>
19890 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>
19891 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>
19892 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>
19893 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>
19894 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>
19896 [<a name="p524" href="#p524">page 524</a>] (<a href="#Contents">Contents</a>)
19898 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>,
19899 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>,
19900 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>,
19901 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>
19902 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
19903 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>
19904 diagnostics header, <a href="#7.2">7.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
19905 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>
19906 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>
19907 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>
19908 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>
19909 display device, <a href="#5.2.2">5.2.2</a> enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
19910 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>
19911 div_t type, <a href="#7.20">7.20</a> enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
19912 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>
19913 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>
19914 do statement, <a href="#6.8.5.2">6.8.5.2</a> environment, <a href="#5">5</a>
19915 documentation of implementation, <a href="#4">4</a> environment functions, <a href="#7.20.4">7.20.4</a>
19916 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>
19917 <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>
19918 <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>,
19919 <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>,
19920 <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>
19921 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>,
19922 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>,
19923 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>,
19924 <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>,
19925 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>,
19926 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>,
19927 <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>
19928 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>
19929 <a href="#6.3.1.8">6.3.1.8</a> equal-to operator, see equality operator
19930 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>
19931 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>
19932 <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>,
19933 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
19934 also range error
19935 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>
19936 effective type, <a href="#6.5">6.5</a> erf type-generic macro, <a href="#7.22">7.22</a>
19937 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>
19938 <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>
19939 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>,
19940 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>,
19941 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>,
19942 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>,
19943 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>
19944 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>
19945 empty statement, <a href="#6.8.3">6.8.3</a> error
19946 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
19947 <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
19948 end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
19950 [<a name="p525" href="#p525">page 525</a>] (<a href="#Contents">Contents</a>)
19952 error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
19953 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>,
19954 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>
19955 <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
19956 <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>
19957 <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,
19958 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>
19959 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,
19960 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.25.2.2">7.25.2.2</a>
19961 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>
19962 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>
19963 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>
19964 evaluation order, <a href="#6.5">6.5</a> external linkage, <a href="#6.2.2">6.2.2</a>
19965 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>
19966 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>
19967 <a href="#6.8.6.4">6.8.6.4</a>
19968 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>
19969 exclusive OR operators fabs type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a>
19970 bitwise (^), <a href="#6.5.11">6.5.11</a> false macro, <a href="#7.16">7.16</a>
19971 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>
19972 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>
19973 execution character set, <a href="#5.2.1">5.2.1</a> fdim type-generic macro, <a href="#7.22">7.22</a>
19974 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>
19975 environmental limits FE_DFL_ENV macro, <a href="#7.6">7.6</a>
19976 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>
19977 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>
19978 <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>
19979 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>
19980 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>
19981 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>
19982 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>
19983 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>
19984 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>
19985 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>
19986 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>
19987 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>
19988 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>
19989 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>,
19990 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>
19991 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>
19992 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>,
19993 assignment, <a href="#6.5.16">6.5.16</a> <a href="#F.9">F.9</a>
19994 cast, <a href="#6.5.4">6.5.4</a> fenv_t type, <a href="#7.6">7.6</a>
19995 constant, <a href="#6.6">6.6</a> feof function, <a href="#7.19.10.2">7.19.10.2</a>
19996 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>
19997 order of evaluation, <a href="#6.5">6.5</a> ferror function, <a href="#7.19.10.3">7.19.10.3</a>
19998 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>
19999 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>
20000 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>
20001 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>
20002 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>
20004 [<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
20006 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>
20007 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>
20008 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>
20009 <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>
20010 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>
20011 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>,
20012 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>
20013 <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>
20014 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>
20015 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>
20016 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>
20017 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>
20018 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>
20019 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>
20020 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>,
20021 <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>
20022 <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>
20023 <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>
20024 <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>
20025 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>
20026 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>
20027 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>
20028 FILENAME_MAX macro, <a href="#7.19.1">7.19.1</a> fmin type-generic macro, <a href="#7.22">7.22</a>
20029 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>
20030 floating-point status, see floating-point status fmod type-generic macro, <a href="#7.22">7.22</a>
20031 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>
20032 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>
20033 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>
20034 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>
20035 <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>,
20036 float _Imaginary type, <a href="#G.2">G.2</a> <a href="#7.4.1.10">7.4.1.10</a>
20037 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>
20038 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>
20039 <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>
20040 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>
20041 <a href="#7.24.4.1.1">7.24.4.1.1</a> fortran keyword, <a href="#J.5.9">J.5.9</a>
20042 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>
20043 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
20044 floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a> also contracted expression
20045 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>
20046 <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>
20047 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>
20048 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>
20049 <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>
20050 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>
20051 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>
20052 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>
20053 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>
20054 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>
20055 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>
20056 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>
20058 [<a name="p527" href="#p527">page 527</a>] (<a href="#Contents">Contents</a>)
20060 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>
20061 <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>
20062 <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>
20063 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>,
20064 <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>,
20065 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>
20066 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>
20067 <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>,
20068 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>
20069 fread function, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.8.1">7.19.8.1</a>
20070 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>
20071 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>
20072 <a href="#5.1.2.1">5.1.2.1</a> wide string, <a href="#7.24.4">7.24.4</a>
20073 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>
20074 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>
20075 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>
20076 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>
20077 <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>
20078 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>
20079 <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>
20080 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>
20081 <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>
20082 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>
20083 full declarator, <a href="#6.7.5">6.7.5</a> graphic characters, <a href="#5.2.1">5.2.1</a>
20084 full expression, <a href="#6.8">6.8</a> greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a>
20085 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>
20086 function
20087 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
20088 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>
20089 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>
20090 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>
20091 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>
20092 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
20093 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>
20094 image, <a href="#5.2.3">5.2.3</a> high-order bit, <a href="#3.6">3.6</a>
20095 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>
20096 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>
20097 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>,
20098 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>
20099 <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>
20100 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>,
20101 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>
20102 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>,
20103 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>
20104 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>,
20105 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>
20106 function specifiers, <a href="#6.7.4">6.7.4</a> hyperbolic functions
20107 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>
20108 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>
20109 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>
20110 future directions hypot type-generic macro, <a href="#7.22">7.22</a>
20112 [<a name="p528" href="#p528">page 528</a>] (<a href="#Contents">Contents</a>)
20114 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>
20115 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>
20116 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>,
20117 maximum length, <a href="#6.4.2.1">6.4.2.1</a> <a href="#F.7.5">F.7.5</a>
20118 name spaces, <a href="#6.2.3">6.2.3</a> in blocks, <a href="#6.8">6.8</a>
20119 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>
20120 scope, <a href="#6.2.1">6.2.1</a> permitted form, <a href="#6.6">6.6</a>
20121 type, <a href="#6.2.5">6.2.5</a> string literal, <a href="#6.3.2.1">6.3.2.1</a>
20122 identifier list, <a href="#6.7.5">6.7.5</a> inline, <a href="#6.7.4">6.7.4</a>
20123 identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a> inner scope, <a href="#6.2.1">6.2.1</a>
20124 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>
20125 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
20126 <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>
20127 IEEE 754, <a href="#F.1">F.1</a> direct, <a href="#7.19.8">7.19.8</a>
20128 IEEE 854, <a href="#F.1">F.1</a> formatted, <a href="#7.19.6">7.19.6</a>
20129 IEEE floating-point arithmetic standard, see wide character, <a href="#7.24.2">7.24.2</a>
20130 IEC 60559, ANSI/IEEE 754, wide character, <a href="#7.24.3">7.24.3</a>
20131 ANSI/IEEE 854 formatted, <a href="#7.24.2">7.24.2</a>
20132 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>
20133 <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>
20134 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>
20135 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>,
20136 ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.3.1.8">6.3.1.8</a>
20137 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>
20138 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>
20139 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>
20140 imaginary numbers, <a href="#G">G</a> INT_LEASTN_MAX macros, <a href="#7.18.2.2">7.18.2.2</a>
20141 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>
20142 imaginary types, <a href="#G">G</a> int_leastN_t types, <a href="#7.18.1.2">7.18.1.2</a>
20143 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>
20144 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>
20145 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>,
20146 implementation, <a href="#3.12">3.12</a> <a href="#7.20.6">7.20.6</a>
20147 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>
20148 <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>
20149 limits integer constant expression, <a href="#6.6">6.6</a>
20150 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>
20151 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>,
20152 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>,
20153 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>
20154 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>
20155 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>,
20156 bitwise (|), <a href="#6.5.12">6.5.12</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
20157 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>
20158 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>
20159 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>
20160 increment and decrement internal linkage, <a href="#6.2.2">6.2.2</a>
20161 indeterminate value, <a href="#3.17.2">3.17.2</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
20162 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>
20163 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>
20164 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>
20166 [<a name="p529" href="#p529">page 529</a>] (<a href="#Contents">Contents</a>)
20168 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>,
20169 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>
20170 <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>
20171 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>,
20172 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>
20173 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>
20174 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>,
20175 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>
20176 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>,
20177 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>
20178 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>,
20179 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>
20180 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>,
20181 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>
20182 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>,
20183 <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>,
20184 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>
20185 <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>,
20186 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>,
20187 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>,
20188 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>
20189 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>,
20190 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>
20191 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>
20192 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>
20193 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>
20194 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>
20195 <a href="#7.4.2.2">7.4.2.2</a>
20196 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>
20197 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a> jump statements, <a href="#6.8.6">6.8.6</a>
20198 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a>
20199 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>
20200 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>
20201 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>
20202 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>
20203 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>
20204 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>
20205 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labs function, <a href="#7.20.6.1">7.20.6.1</a>
20206 ISO/IEC TR 10176, <a href="#D">D</a> language, <a href="#6">6</a>
20207 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> future directions, <a href="#6.11">6.11</a>
20208 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>
20209 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>
20210 <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>
20211 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>,
20212 <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>
20213 <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>,
20214 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>,
20215 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>
20216 <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>
20217 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>
20218 <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>
20220 [<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
20222 lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
20223 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>
20224 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>
20225 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>,
20226 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>
20227 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>,
20228 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>
20229 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>
20230 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>
20231 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>
20232 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>
20233 ldexp type-generic macro, <a href="#7.22">7.22</a> local time, <a href="#7.23.1">7.23.1</a>
20234 ldiv function, <a href="#7.20.6.2">7.20.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
20235 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>
20236 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>
20237 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>
20238 left-shift operator (&lt;&lt;), <a href="#6.5.7">6.5.7</a> localization, <a href="#7.11">7.11</a>
20239 length localtime function, <a href="#7.23.3.4">7.23.3.4</a>
20240 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>
20241 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>
20242 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>
20243 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>
20244 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>
20245 <a href="#7.24.6.3.1">7.24.6.3.1</a> log1p type-generic macro, <a href="#7.22">7.22</a>
20246 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>
20247 <a href="#7.24.2.2">7.24.2.2</a> log2 type-generic macro, <a href="#7.22">7.22</a>
20248 less-than operator (&lt;), <a href="#6.5.8">6.5.8</a> logarithmic functions
20249 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>
20250 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>
20251 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>
20252 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>
20253 lgamma type-generic macro, <a href="#7.22">7.22</a> logical operators
20254 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>
20255 future directions, <a href="#7.26">7.26</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
20256 summary, <a href="#B">B</a> OR (||), <a href="#6.5.14">6.5.14</a>
20257 terms, <a href="#7.1.1">7.1.1</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
20258 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>
20259 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type conversion,
20260 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>
20261 environmental, see environmental limits long double _Imaginary type, <a href="#G.2">G.2</a>
20262 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>
20263 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>,
20264 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>
20265 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>,
20266 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>
20267 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>,
20268 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>
20269 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>,
20270 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>
20271 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>
20272 <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>,
20274 [<a name="p531" href="#p531">page 531</a>] (<a href="#Contents">Contents</a>)
20276 <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>
20277 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>
20278 <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>,
20279 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>,
20280 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>
20281 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>
20282 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>,
20283 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.24.6.3">7.24.6.3</a>
20284 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>
20285 lowercase letter, <a href="#5.2.1">5.2.1</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
20286 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>
20287 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>
20288 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>
20289 lround type-generic macro, <a href="#7.22">7.22</a> memmove function, <a href="#7.21.2.2">7.21.2.2</a>
20290 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>
20291 memset function, <a href="#7.21.6.1">7.21.6.1</a>
20292 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>
20293 macro definition minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
20294 library function, <a href="#7.1.4">7.1.4</a> miscellaneous functions
20295 macro invocation, <a href="#6.10.3">6.10.3</a> string, <a href="#7.21.6">7.21.6</a>
20296 macro name, <a href="#6.10.3">6.10.3</a> wide string, <a href="#7.24.4.6">7.24.4.6</a>
20297 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>
20298 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>
20299 redefinition, <a href="#6.10.3">6.10.3</a> modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
20300 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>
20301 macro parameter, <a href="#6.10.3">6.10.3</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
20302 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>
20303 macro replacement, <a href="#6.10.3">6.10.3</a> multibyte conversion functions
20304 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> wide character, <a href="#7.20.7">7.20.7</a>
20305 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>
20306 <a href="#7.19.3">7.19.3</a> restartable, <a href="#7.24.6.3">7.24.6.3</a>
20307 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>
20308 <a href="#7.20.3.4">7.20.3.4</a> restartable, <a href="#7.24.6.4">7.24.6.4</a>
20309 manipulation functions multibyte string, <a href="#7.1.1">7.1.1</a>
20310 complex, <a href="#7.3.9">7.3.9</a> multibyte/wide character conversion functions,
20311 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>
20312 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>
20313 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>
20314 <a href="#J.5.17">J.5.17</a> multibyte/wide string conversion functions, <a href="#7.20.8">7.20.8</a>
20315 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>
20316 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>
20317 MATH_ERRNO macro, <a href="#7.12">7.12</a> multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a>
20318 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>
20319 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>
20320 <a href="#7.20.7.3">7.20.7.3</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>
20321 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>
20322 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>
20323 mbrlen function, <a href="#7.24.6.3.1">7.24.6.3.1</a> name
20324 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>
20325 <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>
20326 <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>
20328 [<a name="p532" href="#p532">page 532</a>] (<a href="#Contents">Contents</a>)
20330 label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
20331 structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
20332 name spaces, <a href="#6.2.3">6.2.3</a> offsetof macro, <a href="#7.17">7.17</a>
20333 named label, <a href="#6.8.1">6.8.1</a> on-off switch, <a href="#6.10.6">6.10.6</a>
20334 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>
20335 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>
20336 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>
20337 NDEBUG macro, <a href="#7.2">7.2</a> operations on files, <a href="#7.19.4">7.19.4</a>
20338 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>
20339 <a href="#F.9.6.3">F.9.6.3</a> operators, <a href="#6.5">6.5</a>
20340 nearbyint type-generic macro, <a href="#7.22">7.22</a> assignment, <a href="#6.5.16">6.5.16</a>
20341 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>
20342 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> equality, <a href="#6.5.9">6.5.9</a>
20343 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>
20344 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>
20345 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>
20346 <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>
20347 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>
20348 <a href="#F.9.8.3">F.9.8.3</a> shift, <a href="#6.5.7">6.5.7</a>
20349 nextafter type-generic macro, <a href="#7.22">7.22</a> unary, <a href="#6.5.3">6.5.3</a>
20350 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>
20351 nexttoward type-generic macro, <a href="#7.22">7.22</a> or macro, <a href="#7.9">7.9</a>
20352 no linkage, <a href="#6.2.2">6.2.2</a> OR operators
20353 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>
20354 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>
20355 nonlocal jumps header, <a href="#7.13">7.13</a> bitwise inclusive (|), <a href="#6.5.12">6.5.12</a>
20356 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>
20357 not macro, <a href="#7.9">7.9</a> logical (||), <a href="#6.5.14">6.5.14</a>
20358 not-equal-to operator, see inequality operator or_eq macro, <a href="#7.9">7.9</a>
20359 not_eq macro, <a href="#7.9">7.9</a> order of allocated storage, <a href="#7.20.3">7.20.3</a>
20360 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>
20361 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>
20362 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>
20363 <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>
20364 null pointer, <a href="#6.3.2.3">6.3.2.3</a>
20365 null pointer constant, <a href="#6.3.2.3">6.3.2.3</a> padding
20366 null preprocessing directive, <a href="#6.10.7">6.10.7</a> binary stream, <a href="#7.19.2">7.19.2</a>
20367 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>
20368 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>
20369 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>
20370 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>
20371 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>
20372 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>
20373 macro, <a href="#6.10.3">6.10.3</a>
20374 object, <a href="#3.14">3.14</a> main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>
20375 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>
20376 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>
20377 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>
20378 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>
20379 octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</a>
20380 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>
20382 [<a name="p533" href="#p533">page 533</a>] (<a href="#Contents">Contents</a>)
20384 perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
20385 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>
20386 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>
20387 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>
20388 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>
20389 pointer arithmetic, <a href="#6.5.6">6.5.6</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
20390 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>
20391 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>
20392 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>
20393 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>
20394 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>
20395 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>
20396 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>
20397 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>,
20398 position indicator, file, see file position indicator <a href="#5.1.2.3">5.1.2.3</a>
20399 positive difference, <a href="#7.12.12.1">7.12.12.1</a> program, conforming, <a href="#4">4</a>
20400 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>
20401 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
20402 postfix expressions, <a href="#6.5.2">6.5.2</a> default argument, <a href="#6.5.2.2">6.5.2.2</a>
20403 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>
20404 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
20405 pow type-generic macro, <a href="#7.22">7.22</a> pseudo-random sequence functions, <a href="#7.20.2">7.20.2</a>
20406 power functions PTRDIFF_MAX macro, <a href="#7.18.3">7.18.3</a>
20407 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>
20408 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>,
20409 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>
20410 pragma operator, <a href="#6.10.9">6.10.9</a> punctuators, <a href="#6.4.6">6.4.6</a>
20411 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>
20412 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>
20413 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>
20414 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>
20415 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>
20416 predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
20417 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>
20418 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>
20419 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>
20420 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>
20421 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>
20422 preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
20423 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>
20424 #, <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>
20425 ##, <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>
20426 _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> range
20427 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>
20428 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>,
20429 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>,
20430 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>,
20431 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>,
20432 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>,
20433 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>,
20434 PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
20436 [<a name="p534" href="#p534">page 534</a>] (<a href="#Contents">Contents</a>)
20438 rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
20439 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>
20440 <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>
20441 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>
20442 real type domain, <a href="#6.2.5">6.2.5</a> scalbln type-generic macro, <a href="#7.22">7.22</a>
20443 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>
20444 real-floating, <a href="#7.12.3">7.12.3</a> scalbn type-generic macro, <a href="#7.22">7.22</a>
20445 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>
20446 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>
20447 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>
20448 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>
20449 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>
20450 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>
20451 library functions, <a href="#7.1.4">7.1.4</a> SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a>
20452 referenced type, <a href="#6.2.5">6.2.5</a> SCNcMAX macros, <a href="#7.8.1">7.8.1</a>
20453 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>
20454 relational expressions, <a href="#6.5.8">6.5.8</a> SCNcPTR macros, <a href="#7.8.1">7.8.1</a>
20455 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>
20456 remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a> search functions
20457 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>
20458 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>
20459 <a href="#F.9.7.2">F.9.7.2</a> wide string, <a href="#7.24.4.5">7.24.4.5</a>
20460 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>
20461 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>
20462 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>
20463 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>
20464 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>
20465 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>,
20466 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>
20467 pointer, <a href="#6.2.5">6.2.5</a> separate compilation, <a href="#5.1.1.1">5.1.1.1</a>
20468 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>
20469 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>,
20470 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>
20471 functions, <a href="#7.24.6.3">7.24.6.3</a> sequencing of statements, <a href="#6.8">6.8</a>
20472 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>
20473 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>
20474 restore calling environment function, <a href="#7.13.2">7.13.2</a> setjmp.h header, <a href="#7.13">7.13</a>
20475 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>
20476 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>,
20477 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>
20478 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>
20479 <a href="#7.24.3.10">7.24.3.10</a> shift expressions, <a href="#6.5.7">6.5.7</a>
20480 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>
20481 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>
20482 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>
20483 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>,
20484 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>
20485 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>,
20486 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>
20487 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>
20488 SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
20490 [<a name="p535" href="#p535">page 535</a>] (<a href="#Contents">Contents</a>)
20492 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>
20493 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>
20494 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>,
20495 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>
20496 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>
20497 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>
20498 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>
20499 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>
20500 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>
20501 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>
20502 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>
20503 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>
20504 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>,
20505 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>
20506 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>
20507 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>
20508 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>
20509 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>,
20510 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>
20511 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>
20512 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>
20513 <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>
20514 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>
20515 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>,
20516 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>
20517 <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>
20518 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>
20519 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>
20520 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>
20521 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>,
20522 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>
20523 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>,
20524 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>
20525 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>
20526 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>
20527 <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>
20528 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>
20529 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>
20530 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>,
20531 sinh type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> <a href="#F">F</a>
20532 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>
20533 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>
20534 <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>
20535 <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>
20536 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>
20537 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>
20538 sorting utility functions, <a href="#7.20.5">7.20.5</a> statements, <a href="#6.8">6.8</a>
20539 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>
20540 source file, <a href="#5.1.1.1">5.1.1.1</a> compound, <a href="#6.8.2">6.8.2</a>
20541 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>
20542 source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
20544 [<a name="p536" href="#p536">page 536</a>] (<a href="#Contents">Contents</a>)
20546 else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
20547 expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
20548 for, <a href="#6.8.5.3">6.8.5.3</a> comparison functions, <a href="#7.21.4">7.21.4</a>
20549 goto, <a href="#6.8.6.1">6.8.6.1</a> concatenation functions, <a href="#7.21.3">7.21.3</a>
20550 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>
20551 iteration, <a href="#6.8.5">6.8.5</a> copying functions, <a href="#7.21.2">7.21.2</a>
20552 jump, <a href="#6.8.6">6.8.6</a> library function conventions, <a href="#7.21.1">7.21.1</a>
20553 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>
20554 null, <a href="#6.8.3">6.8.3</a> miscellaneous functions, <a href="#7.21.6">7.21.6</a>
20555 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>
20556 selection, <a href="#6.8.4">6.8.4</a> search functions, <a href="#7.21.5">7.21.5</a>
20557 sequencing, <a href="#6.8">6.8</a> string handling header, <a href="#7.21">7.21</a>
20558 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>
20559 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>
20560 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>
20561 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>
20562 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>
20563 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>
20564 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>
20565 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>
20566 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>
20567 <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>
20568 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>,
20569 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>
20570 <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>
20571 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>
20572 <a href="#7.26.8">7.26.8</a> strtok function, <a href="#7.21.5.8">7.21.5.8</a>
20573 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>,
20574 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>
20575 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>
20576 <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>
20577 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>,
20578 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>
20579 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>
20580 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>
20581 strchr function, <a href="#7.21.5.2">7.21.5.2</a> struct hack, see flexible array member
20582 strcmp function, <a href="#7.21.4">7.21.4</a>, <a href="#7.21.4.2">7.21.4.2</a> structure
20583 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>
20584 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>
20585 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>
20586 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>
20587 fully buffered, <a href="#7.19.3">7.19.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
20588 line buffered, <a href="#7.19.3">7.19.3</a> member name space, <a href="#6.2.3">6.2.3</a>
20589 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>
20590 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>
20591 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>
20592 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>
20593 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>
20594 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>
20595 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>
20596 <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>
20598 [<a name="p537" href="#p537">page 537</a>] (<a href="#Contents">Contents</a>)
20600 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>
20601 suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
20602 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>
20603 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>
20604 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>
20605 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>
20606 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>
20607 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>
20608 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>
20609 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>,
20610 symbols, <a href="#3">3</a> <a href="#6.5.2.3">6.5.2.3</a>
20611 syntactic categories, <a href="#6.1">6.1</a> trigonometric functions
20612 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>
20613 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>
20614 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>
20615 system function, <a href="#7.20.4.6">7.20.4.6</a> true macro, <a href="#7.16">7.16</a>
20616 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.9.6.8">F.9.6.8</a>
20617 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>
20618 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>
20619 tag name space, <a href="#6.2.3">6.2.3</a> truncation toward zero, <a href="#6.5.5">6.5.5</a>
20620 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>
20621 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>
20622 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>
20623 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>
20624 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>
20625 tentative definition, <a href="#6.9.2">6.9.2</a> type names, <a href="#6.7.6">6.7.6</a>
20626 terms, <a href="#3">3</a> type punning, <a href="#6.5.2.3">6.5.2.3</a>
20627 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>
20628 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>
20629 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>
20630 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>
20631 time typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.7">6.7.7</a>
20632 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>
20633 <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>
20634 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>
20635 <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>
20636 components, <a href="#7.23.1">7.23.1</a> composite, <a href="#6.2.7">6.2.7</a>
20637 conversion functions, <a href="#7.23.3">7.23.3</a> const qualified, <a href="#6.7.3">6.7.3</a>
20638 wide character, <a href="#7.24.5">7.24.5</a> conversions, <a href="#6.3">6.3</a>
20639 local, <a href="#7.23.1">7.23.1</a> imaginary, <a href="#G">G</a>
20640 manipulation functions, <a href="#7.23.2">7.23.2</a> restrict qualified, <a href="#6.7.3">6.7.3</a>
20641 time function, <a href="#7.23.2.4">7.23.2.4</a> volatile qualified, <a href="#6.7.3">6.7.3</a>
20642 time.h header, <a href="#7.23">7.23</a>
20643 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>
20644 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>
20645 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>
20646 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>
20647 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>
20648 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>
20649 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>
20650 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>
20652 [<a name="p538" href="#p538">page 538</a>] (<a href="#Contents">Contents</a>)
20654 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>
20655 <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>,
20656 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>
20657 UINTN_MAX macros, <a href="#7.18.2.1">7.18.2.1</a> utilities, general, <a href="#7.20">7.20</a>
20658 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>
20659 UINTPTR_MAX macro, <a href="#7.18.2.4">7.18.2.4</a>
20660 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>,
20661 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>,
20662 <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>,
20663 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>,
20664 <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>
20665 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>,
20666 unary expression, <a href="#6.5.3">6.5.3</a> <a href="#7.15.1.3">7.15.1.3</a>
20667 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>,
20668 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>,
20669 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>,
20670 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>,
20671 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>
20672 <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>
20673 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>,
20674 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>,
20675 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>,
20676 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>,
20677 <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>
20678 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>
20679 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>
20680 union variable arguments, <a href="#6.10.3">6.10.3</a>, <a href="#7.15">7.15</a>
20681 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> variable arguments header, <a href="#7.15">7.15</a>
20682 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>
20683 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>
20684 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>
20685 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>,
20686 member name space, <a href="#6.2.3">6.2.3</a> <a href="#7.4.1.10">7.4.1.10</a>
20687 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>
20688 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>
20689 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>
20690 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>
20691 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>
20692 universal character name, <a href="#6.4.3">6.4.3</a> VLA, see variable length array
20693 unqualified type, <a href="#6.2.5">6.2.5</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
20694 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>
20695 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>
20696 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>
20697 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>
20698 <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>
20699 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>
20700 <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>
20701 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>
20702 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>
20703 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>
20704 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>
20706 [<a name="p539" href="#p539">page 539</a>] (<a href="#Contents">Contents</a>)
20708 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>
20709 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>
20710 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>,
20711 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>,
20712 <a href="#7.24.6.1.1">7.24.6.1.1</a>, <a href="#7.25.1">7.25.1</a>
20713 warnings, <a href="#I">I</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
20714 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>,
20715 <a href="#F">F</a> <a href="#7.25.2.1.10">7.25.2.1.10</a>
20716 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>
20717 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>
20718 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>
20719 <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>
20720 <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>
20721 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>
20722 <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>
20723 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>
20724 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>
20725 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>
20726 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>
20727 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>
20728 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>
20729 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>
20730 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>
20731 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>
20732 wcsncmp function, <a href="#7.24.4.4.3">7.24.4.4.3</a> wide string literal, see string literal
20733 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>
20734 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>,
20735 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>
20736 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>
20737 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>
20738 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>
20739 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>
20740 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>
20741 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>,
20742 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#7.25.1">7.25.1</a>
20743 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>
20744 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>
20745 <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>
20746 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>
20747 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>
20748 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>
20749 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>,
20750 <a href="#7.24.4.1.2">7.24.4.1.2</a> <a href="#7.24.3.10">7.24.3.10</a>
20751 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>
20752 wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a> xor macro, <a href="#7.9">7.9</a>
20753 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>
20754 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>
20755 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>
20756 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>
20757 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>
20758 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>
20760 [<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
20761 </pre></body></html>