fix formula for logb in n1570.html
[c-standard.git] / n1570.pre.html
blob6be6baf0c5bced9344b9d74e330a73c545057777
1 <html><head><title>N1570 Committee Draft -- April 12, 2011 ISO/IEC 9899:201x</title></head><body><pre>
2 N1570 Committee Draft -- April 12, 2011 ISO/IEC 9899:201x
7 INTERNATIONAL STANDARD (C)ISO/IEC ISO/IEC 9899:201x
12 Programming languages -- C
15 ABSTRACT
19 (Cover sheet to be provided by ISO Secretariat.)
21 This International Standard specifies the form and establishes the interpretation of
22 programs expressed in the programming language C. Its purpose is to promote
23 portability, reliability, maintainability, and efficient execution of C language programs on
24 a variety of computing systems.
26 Clauses are included that detail the C language itself and the contents of the C language
27 execution library. Annexes summarize aspects of both of them, and enumerate factors
28 that influence the portability of C programs.
30 Although this International Standard is intended to guide knowledgeable C language
31 programmers as well as implementors of C language translation systems, the document
32 itself is not designed to serve as a tutorial.
34 Recipients of this draft are invited to submit, with their comments, notification of any
35 relevant patent rights of which they are aware and to provide supporting documentation.
37 Changes from the previous draft (N1539) are indicated by ''diff marks'' in the right
38 margin: deleted text is marked with ''*'', new or changed text with '' ''.
40 [page i]
43 [page ii]
45 <a name="Contents" href="#Contents">Contents</a>
46 <a href="#Foreword">Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii</a>
47 <a href="#Introduction">Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii</a>
48 <a href="#1">1. Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1</a>
49 <a href="#2">2. Normative references . . . . . . . . . . . . . . . . . . . . . . . 2</a>
50 <a href="#3">3. Terms, definitions, and symbols . . . . . . . . . . . . . . . . . . . 3</a>
51 <a href="#4">4. Conformance . . . . . . . . . . . . . . . . . . . . . . . . . . 8</a>
52 <a href="#5">5. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 10</a>
53 <a href="#5.1"> 5.1 Conceptual models . . . . . . . . . . . . . . . . . . . . . 10</a>
54 <a href="#5.1.1"> 5.1.1 Translation environment . . . . . . . . . . . . . . . . 10</a>
55 <a href="#5.1.2"> 5.1.2 Execution environments . . . . . . . . . . . . . . . . 12</a>
56 <a href="#5.2"> 5.2 Environmental considerations . . . . . . . . . . . . . . . . . 22</a>
57 <a href="#5.2.1"> 5.2.1 Character sets . . . . . . . . . . . . . . . . . . . . 22</a>
58 <a href="#5.2.2"> 5.2.2 Character display semantics . . . . . . . . . . . . . . 24</a>
59 <a href="#5.2.3"> 5.2.3 Signals and interrupts . . . . . . . . . . . . . . . . . 25</a>
60 <a href="#5.2.4"> 5.2.4 Environmental limits . . . . . . . . . . . . . . . . . 25</a>
61 <a href="#6">6. Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35</a>
62 <a href="#6.1"> 6.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . 35</a>
63 <a href="#6.2"> 6.2 Concepts . . . . . . . . . . . . . . . . . . . . . . . . . 35</a>
64 <a href="#6.2.1"> 6.2.1 Scopes of identifiers . . . . . . . . . . . . . . . . . 35</a>
65 <a href="#6.2.2"> 6.2.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 36</a>
66 <a href="#6.2.3"> 6.2.3 Name spaces of identifiers . . . . . . . . . . . . . . . 37</a>
67 <a href="#6.2.4"> 6.2.4 Storage durations of objects . . . . . . . . . . . . . . 38</a>
68 <a href="#6.2.5"> 6.2.5 Types . . . . . . . . . . . . . . . . . . . . . . . 39</a>
69 <a href="#6.2.6"> 6.2.6 Representations of types . . . . . . . . . . . . . . . . 44</a>
70 <a href="#6.2.7"> 6.2.7 Compatible type and composite type . . . . . . . . . . . 47</a>
71 <a href="#6.2.8"> 6.2.8 Alignment of objects . . . . . . . . . . . . . . . . . 48</a>
72 <a href="#6.3"> 6.3 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 50</a>
73 <a href="#6.3.1"> 6.3.1 Arithmetic operands . . . . . . . . . . . . . . . . . 50</a>
74 <a href="#6.3.2"> 6.3.2 Other operands . . . . . . . . . . . . . . . . . . . 54</a>
75 <a href="#6.4"> 6.4 Lexical elements . . . . . . . . . . . . . . . . . . . . . . 57</a>
76 <a href="#6.4.1"> 6.4.1 Keywords . . . . . . . . . . . . . . . . . . . . . . 58</a>
77 <a href="#6.4.2"> 6.4.2 Identifiers . . . . . . . . . . . . . . . . . . . . . . 59</a>
78 <a href="#6.4.3"> 6.4.3 Universal character names . . . . . . . . . . . . . . . 61</a>
79 <a href="#6.4.4"> 6.4.4 Constants . . . . . . . . . . . . . . . . . . . . . . 62</a>
80 <a href="#6.4.5"> 6.4.5 String literals . . . . . . . . . . . . . . . . . . . . 70</a>
81 <a href="#6.4.6"> 6.4.6 Punctuators . . . . . . . . . . . . . . . . . . . . . 72</a>
82 <a href="#6.4.7"> 6.4.7 Header names . . . . . . . . . . . . . . . . . . . . 73</a>
83 <a href="#6.4.8"> 6.4.8 Preprocessing numbers . . . . . . . . . . . . . . . . 74</a>
84 <a href="#6.4.9"> 6.4.9 Comments . . . . . . . . . . . . . . . . . . . . . 75</a>
86 [page iii]
88 <a href="#6.5"> 6.5 Expressions . . . . . . . . . . . . . . . . . . . . . . . . 76</a>
89 <a href="#6.5.1"> 6.5.1 Primary expressions . . . . . . . . . . . . . . . . . 78</a>
90 <a href="#6.5.2"> 6.5.2 Postfix operators . . . . . . . . . . . . . . . . . . . 79</a>
91 <a href="#6.5.3"> 6.5.3 Unary operators . . . . . . . . . . . . . . . . . . . 88</a>
92 <a href="#6.5.4"> 6.5.4 Cast operators . . . . . . . . . . . . . . . . . . . . 91</a>
93 <a href="#6.5.5"> 6.5.5 Multiplicative operators . . . . . . . . . . . . . . . . 92</a>
94 <a href="#6.5.6"> 6.5.6 Additive operators . . . . . . . . . . . . . . . . . . 92</a>
95 <a href="#6.5.7"> 6.5.7 Bitwise shift operators . . . . . . . . . . . . . . . . . 94</a>
96 <a href="#6.5.8"> 6.5.8 Relational operators . . . . . . . . . . . . . . . . . . 95</a>
97 <a href="#6.5.9"> 6.5.9 Equality operators . . . . . . . . . . . . . . . . . . 96</a>
98 <a href="#6.5.10"> 6.5.10 Bitwise AND operator . . . . . . . . . . . . . . . . . 97</a>
99 <a href="#6.5.11"> 6.5.11 Bitwise exclusive OR operator . . . . . . . . . . . . . 98</a>
100 <a href="#6.5.12"> 6.5.12 Bitwise inclusive OR operator . . . . . . . . . . . . . . 98</a>
101 <a href="#6.5.13"> 6.5.13 Logical AND operator . . . . . . . . . . . . . . . . . 99</a>
102 <a href="#6.5.14"> 6.5.14 Logical OR operator . . . . . . . . . . . . . . . . . 99</a>
103 <a href="#6.5.15"> 6.5.15 Conditional operator . . . . . . . . . . . . . . . . . 100</a>
104 <a href="#6.5.16"> 6.5.16 Assignment operators . . . . . . . . . . . . . . . . . 101</a>
105 <a href="#6.5.17"> 6.5.17 Comma operator . . . . . . . . . . . . . . . . . . . 105</a>
106 <a href="#6.6"> 6.6 Constant expressions . . . . . . . . . . . . . . . . . . . . . 106</a>
107 <a href="#6.7"> 6.7 Declarations . . . . . . . . . . . . . . . . . . . . . . . . 108</a>
108 <a href="#6.7.1"> 6.7.1 Storage-class specifiers . . . . . . . . . . . . . . . . 109</a>
109 <a href="#6.7.2"> 6.7.2 Type specifiers . . . . . . . . . . . . . . . . . . . . 111</a>
110 <a href="#6.7.3"> 6.7.3 Type qualifiers . . . . . . . . . . . . . . . . . . . . 121</a>
111 <a href="#6.7.4"> 6.7.4 Function specifiers . . . . . . . . . . . . . . . . . . 125</a>
112 <a href="#6.7.5"> 6.7.5 Alignment specifier . . . . . . . . . . . . . . . . . . 127</a>
113 <a href="#6.7.6"> 6.7.6 Declarators . . . . . . . . . . . . . . . . . . . . . 128</a>
114 <a href="#6.7.7"> 6.7.7 Type names . . . . . . . . . . . . . . . . . . . . . 136</a>
115 <a href="#6.7.8"> 6.7.8 Type definitions . . . . . . . . . . . . . . . . . . . 137</a>
116 <a href="#6.7.9"> 6.7.9 Initialization . . . . . . . . . . . . . . . . . . . . 139</a>
117 <a href="#6.7.10"> 6.7.10 Static assertions . . . . . . . . . . . . . . . . . . . 145</a>
118 <a href="#6.8"> 6.8 Statements and blocks . . . . . . . . . . . . . . . . . . . . 146</a>
119 <a href="#6.8.1"> 6.8.1 Labeled statements . . . . . . . . . . . . . . . . . . 146</a>
120 <a href="#6.8.2"> 6.8.2 Compound statement . . . . . . . . . . . . . . . . . 147</a>
121 <a href="#6.8.3"> 6.8.3 Expression and null statements . . . . . . . . . . . . . 147</a>
122 <a href="#6.8.4"> 6.8.4 Selection statements . . . . . . . . . . . . . . . . . 148</a>
123 <a href="#6.8.5"> 6.8.5 Iteration statements . . . . . . . . . . . . . . . . . . 150</a>
124 <a href="#6.8.6"> 6.8.6 Jump statements . . . . . . . . . . . . . . . . . . . 151</a>
125 <a href="#6.9"> 6.9 External definitions . . . . . . . . . . . . . . . . . . . . . 155</a>
126 <a href="#6.9.1"> 6.9.1 Function definitions . . . . . . . . . . . . . . . . . . 156</a>
127 <a href="#6.9.2"> 6.9.2 External object definitions . . . . . . . . . . . . . . . 158</a>
128 <a href="#6.10"> 6.10 Preprocessing directives . . . . . . . . . . . . . . . . . . . 160</a>
129 <a href="#6.10.1"> 6.10.1 Conditional inclusion . . . . . . . . . . . . . . . . . 162</a>
130 <a href="#6.10.2"> 6.10.2 Source file inclusion . . . . . . . . . . . . . . . . . 164</a>
131 <a href="#6.10.3"> 6.10.3 Macro replacement . . . . . . . . . . . . . . . . . . 166</a>
133 [page iv]
135 <a href="#6.10.4"> 6.10.4 Line control . . . . . . . . . . . . . . . . . . . . . 173</a>
136 <a href="#6.10.5"> 6.10.5 Error directive . . . . . . . . . . . . . . . . . . . . 174</a>
137 <a href="#6.10.6"> 6.10.6 Pragma directive . . . . . . . . . . . . . . . . . . . 174</a>
138 <a href="#6.10.7"> 6.10.7 Null directive . . . . . . . . . . . . . . . . . . . . 175</a>
139 <a href="#6.10.8"> 6.10.8 Predefined macro names . . . . . . . . . . . . . . . . 175</a>
140 <a href="#6.10.9"> 6.10.9 Pragma operator . . . . . . . . . . . . . . . . . . . 178</a>
141 <a href="#6.11"> 6.11 Future language directions . . . . . . . . . . . . . . . . . . 179</a>
142 <a href="#6.11.1"> 6.11.1 Floating types . . . . . . . . . . . . . . . . . . . . 179</a>
143 <a href="#6.11.2"> 6.11.2 Linkages of identifiers . . . . . . . . . . . . . . . . . 179</a>
144 <a href="#6.11.3"> 6.11.3 External names . . . . . . . . . . . . . . . . . . . 179</a>
145 <a href="#6.11.4"> 6.11.4 Character escape sequences . . . . . . . . . . . . . . 179</a>
146 <a href="#6.11.5"> 6.11.5 Storage-class specifiers . . . . . . . . . . . . . . . . 179</a>
147 <a href="#6.11.6"> 6.11.6 Function declarators . . . . . . . . . . . . . . . . . 179</a>
148 <a href="#6.11.7"> 6.11.7 Function definitions . . . . . . . . . . . . . . . . . . 179</a>
149 <a href="#6.11.8"> 6.11.8 Pragma directives . . . . . . . . . . . . . . . . . . 179</a>
150 <a href="#6.11.9"> 6.11.9 Predefined macro names . . . . . . . . . . . . . . . . 179</a>
151 <a href="#7">7. Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180</a>
152 <a href="#7.1"> 7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 180</a>
153 <a href="#7.1.1"> 7.1.1 Definitions of terms . . . . . . . . . . . . . . . . . . 180</a>
154 <a href="#7.1.2"> 7.1.2 Standard headers . . . . . . . . . . . . . . . . . . . 181</a>
155 <a href="#7.1.3"> 7.1.3 Reserved identifiers . . . . . . . . . . . . . . . . . . 182</a>
156 <a href="#7.1.4"> 7.1.4 Use of library functions . . . . . . . . . . . . . . . . 183</a>
157 <a href="#7.2"> 7.2 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 186</a>
158 <a href="#7.2.1"> 7.2.1 Program diagnostics . . . . . . . . . . . . . . . . . 186</a>
159 <a href="#7.3"> 7.3 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 188</a>
160 <a href="#7.3.1"> 7.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . 188</a>
161 <a href="#7.3.2"> 7.3.2 Conventions . . . . . . . . . . . . . . . . . . . . . 189</a>
162 <a href="#7.3.3"> 7.3.3 Branch cuts . . . . . . . . . . . . . . . . . . . . . 189</a>
163 <a href="#7.3.4"> 7.3.4 The CX_LIMITED_RANGE pragma . . . . . . . . . . . 189</a>
164 <a href="#7.3.5"> 7.3.5 Trigonometric functions . . . . . . . . . . . . . . . . 190</a>
165 <a href="#7.3.6"> 7.3.6 Hyperbolic functions . . . . . . . . . . . . . . . . . 192</a>
166 <a href="#7.3.7"> 7.3.7 Exponential and logarithmic functions . . . . . . . . . . 194</a>
167 <a href="#7.3.8"> 7.3.8 Power and absolute-value functions . . . . . . . . . . . 195</a>
168 <a href="#7.3.9"> 7.3.9 Manipulation functions . . . . . . . . . . . . . . . . 196</a>
169 <a href="#7.4"> 7.4 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 200</a>
170 <a href="#7.4.1"> 7.4.1 Character classification functions . . . . . . . . . . . . 200</a>
171 <a href="#7.4.2"> 7.4.2 Character case mapping functions . . . . . . . . . . . . 203</a>
172 <a href="#7.5"> 7.5 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 205</a>
173 <a href="#7.6"> 7.6 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 206</a>
174 <a href="#7.6.1"> 7.6.1 The FENV_ACCESS pragma . . . . . . . . . . . . . . 208</a>
175 <a href="#7.6.2"> 7.6.2 Floating-point exceptions . . . . . . . . . . . . . . . 209</a>
176 <a href="#7.6.3"> 7.6.3 Rounding . . . . . . . . . . . . . . . . . . . . . . 212</a>
177 <a href="#7.6.4"> 7.6.4 Environment . . . . . . . . . . . . . . . . . . . . 213</a>
178 <a href="#7.7"> 7.7 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 216</a>
180 [page v]
182 <a href="#7.8"> 7.8 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 217</a>
183 <a href="#7.8.1"> 7.8.1 Macros for format specifiers . . . . . . . . . . . . . . 217</a>
184 <a href="#7.8.2"> 7.8.2 Functions for greatest-width integer types . . . . . . . . . 218</a>
185 <a href="#7.9"> 7.9 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 221</a>
186 <a href="#7.10"> 7.10 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 222</a>
187 <a href="#7.11"> 7.11 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 223</a>
188 <a href="#7.11.1"> 7.11.1 Locale control . . . . . . . . . . . . . . . . . . . . 224</a>
189 <a href="#7.11.2"> 7.11.2 Numeric formatting convention inquiry . . . . . . . . . . 225</a>
190 <a href="#7.12"> 7.12 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 231</a>
191 <a href="#7.12.1"> 7.12.1 Treatment of error conditions . . . . . . . . . . . . . . 233</a>
192 <a href="#7.12.2"> 7.12.2 The FP_CONTRACT pragma . . . . . . . . . . . . . . 235</a>
193 <a href="#7.12.3"> 7.12.3 Classification macros . . . . . . . . . . . . . . . . . 235</a>
194 <a href="#7.12.4"> 7.12.4 Trigonometric functions . . . . . . . . . . . . . . . . 238</a>
195 <a href="#7.12.5"> 7.12.5 Hyperbolic functions . . . . . . . . . . . . . . . . . 240</a>
196 <a href="#7.12.6"> 7.12.6 Exponential and logarithmic functions . . . . . . . . . . 242</a>
197 <a href="#7.12.7"> 7.12.7 Power and absolute-value functions . . . . . . . . . . . 247</a>
198 <a href="#7.12.8"> 7.12.8 Error and gamma functions . . . . . . . . . . . . . . . 249</a>
199 <a href="#7.12.9"> 7.12.9 Nearest integer functions . . . . . . . . . . . . . . . . 251</a>
200 <a href="#7.12.10"> 7.12.10 Remainder functions . . . . . . . . . . . . . . . . . 254</a>
201 <a href="#7.12.11"> 7.12.11 Manipulation functions . . . . . . . . . . . . . . . . 255</a>
202 <a href="#7.12.12"> 7.12.12 Maximum, minimum, and positive difference functions . . . 257</a>
203 <a href="#7.12.13"> 7.12.13 Floating multiply-add . . . . . . . . . . . . . . . . . 258</a>
204 <a href="#7.12.14"> 7.12.14 Comparison macros . . . . . . . . . . . . . . . . . . 259</a>
205 <a href="#7.13"> 7.13 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 262</a>
206 <a href="#7.13.1"> 7.13.1 Save calling environment . . . . . . . . . . . . . . . 262</a>
207 <a href="#7.13.2"> 7.13.2 Restore calling environment . . . . . . . . . . . . . . 263</a>
208 <a href="#7.14"> 7.14 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 265</a>
209 <a href="#7.14.1"> 7.14.1 Specify signal handling . . . . . . . . . . . . . . . . 266</a>
210 <a href="#7.14.2"> 7.14.2 Send signal . . . . . . . . . . . . . . . . . . . . . 267</a>
211 <a href="#7.15"> 7.15 Alignment &lt;stdalign.h&gt; . . . . . . . . . . . . . . . . . 268</a>
212 <a href="#7.16"> 7.16 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 269</a>
213 <a href="#7.16.1"> 7.16.1 Variable argument list access macros . . . . . . . . . . . 269</a>
214 <a href="#7.17"> 7.17 Atomics &lt;stdatomic.h&gt; . . . . . . . . . . . . . . . . . . 273</a>
215 <a href="#7.17.1"> 7.17.1 Introduction . . . . . . . . . . . . . . . . . . . . . 273</a>
216 <a href="#7.17.2"> 7.17.2 Initialization . . . . . . . . . . . . . . . . . . . . 274</a>
217 <a href="#7.17.3"> 7.17.3 Order and consistency . . . . . . . . . . . . . . . . . 275</a>
218 <a href="#7.17.4"> 7.17.4 Fences . . . . . . . . . . . . . . . . . . . . . . . 278</a>
219 <a href="#7.17.5"> 7.17.5 Lock-free property . . . . . . . . . . . . . . . . . . 279</a>
220 <a href="#7.17.6"> 7.17.6 Atomic integer types . . . . . . . . . . . . . . . . . 280</a>
221 <a href="#7.17.7"> 7.17.7 Operations on atomic types . . . . . . . . . . . . . . . 282</a>
222 <a href="#7.17.8"> 7.17.8 Atomic flag type and operations . . . . . . . . . . . . . 285</a>
223 <a href="#7.18"> 7.18 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 287</a>
224 <a href="#7.19"> 7.19 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 288</a>
225 <a href="#7.20"> 7.20 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 289</a>
227 [page vi]
229 <a href="#7.20.1"> 7.20.1 Integer types . . . . . . . . . . . . . . . . . . . . 289</a>
230 <a href="#7.20.2"> 7.20.2 Limits of specified-width integer types . . . . . . . . . . 291</a>
231 <a href="#7.20.3"> 7.20.3 Limits of other integer types . . . . . . . . . . . . . . 293</a>
232 <a href="#7.20.4"> 7.20.4 Macros for integer constants . . . . . . . . . . . . . . 294</a>
233 <a href="#7.21"> 7.21 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 296</a>
234 <a href="#7.21.1"> 7.21.1 Introduction . . . . . . . . . . . . . . . . . . . . . 296</a>
235 <a href="#7.21.2"> 7.21.2 Streams . . . . . . . . . . . . . . . . . . . . . . 298</a>
236 <a href="#7.21.3"> 7.21.3 Files . . . . . . . . . . . . . . . . . . . . . . . . 300</a>
237 <a href="#7.21.4"> 7.21.4 Operations on files . . . . . . . . . . . . . . . . . . 302</a>
238 <a href="#7.21.5"> 7.21.5 File access functions . . . . . . . . . . . . . . . . . 304</a>
239 <a href="#7.21.6"> 7.21.6 Formatted input/output functions . . . . . . . . . . . . 309</a>
240 <a href="#7.21.7"> 7.21.7 Character input/output functions . . . . . . . . . . . . . 330</a>
241 <a href="#7.21.8"> 7.21.8 Direct input/output functions . . . . . . . . . . . . . . 335</a>
242 <a href="#7.21.9"> 7.21.9 File positioning functions . . . . . . . . . . . . . . . 336</a>
243 <a href="#7.21.10"> 7.21.10 Error-handling functions . . . . . . . . . . . . . . . . 338</a>
244 <a href="#7.22"> 7.22 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 340</a>
245 <a href="#7.22.1"> 7.22.1 Numeric conversion functions . . . . . . . . . . . . . . 341</a>
246 <a href="#7.22.2"> 7.22.2 Pseudo-random sequence generation functions . . . . . . . 346</a>
247 <a href="#7.22.3"> 7.22.3 Memory management functions . . . . . . . . . . . . . 347</a>
248 <a href="#7.22.4"> 7.22.4 Communication with the environment . . . . . . . . . . 350</a>
249 <a href="#7.22.5"> 7.22.5 Searching and sorting utilities . . . . . . . . . . . . . . 354</a>
250 <a href="#7.22.6"> 7.22.6 Integer arithmetic functions . . . . . . . . . . . . . . 356</a>
251 <a href="#7.22.7"> 7.22.7 Multibyte/wide character conversion functions . . . . . . . 357</a>
252 <a href="#7.22.8"> 7.22.8 Multibyte/wide string conversion functions . . . . . . . . 359</a>
253 <a href="#7.23"> 7.23 _Noreturn &lt;stdnoreturn.h&gt; . . . . . . . . . . . . . . 361</a>
254 <a href="#7.24"> 7.24 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 362</a>
255 <a href="#7.24.1"> 7.24.1 String function conventions . . . . . . . . . . . . . . . 362</a>
256 <a href="#7.24.2"> 7.24.2 Copying functions . . . . . . . . . . . . . . . . . . 362</a>
257 <a href="#7.24.3"> 7.24.3 Concatenation functions . . . . . . . . . . . . . . . . 364</a>
258 <a href="#7.24.4"> 7.24.4 Comparison functions . . . . . . . . . . . . . . . . . 365</a>
259 <a href="#7.24.5"> 7.24.5 Search functions . . . . . . . . . . . . . . . . . . . 367</a>
260 <a href="#7.24.6"> 7.24.6 Miscellaneous functions . . . . . . . . . . . . . . . . 371</a>
261 <a href="#7.25"> 7.25 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 373</a>
262 <a href="#7.26"> 7.26 Threads &lt;threads.h&gt; . . . . . . . . . . . . . . . . . . . 376</a>
263 <a href="#7.26.1"> 7.26.1 Introduction . . . . . . . . . . . . . . . . . . . . . 376</a>
264 <a href="#7.26.2"> 7.26.2 Initialization functions . . . . . . . . . . . . . . . . . 378</a>
265 <a href="#7.26.3"> 7.26.3 Condition variable functions . . . . . . . . . . . . . . 378</a>
266 <a href="#7.26.4"> 7.26.4 Mutex functions . . . . . . . . . . . . . . . . . . . 380</a>
267 <a href="#7.26.5"> 7.26.5 Thread functions . . . . . . . . . . . . . . . . . . . 383</a>
268 <a href="#7.26.6"> 7.26.6 Thread-specific storage functions . . . . . . . . . . . . 386</a>
269 <a href="#7.27"> 7.27 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 388</a>
270 <a href="#7.27.1"> 7.27.1 Components of time . . . . . . . . . . . . . . . . . 388</a>
271 <a href="#7.27.2"> 7.27.2 Time manipulation functions . . . . . . . . . . . . . . 389</a>
272 <a href="#7.27.3"> 7.27.3 Time conversion functions . . . . . . . . . . . . . . . 392</a>
274 [page vii]
276 <a href="#7.28"> 7.28 Unicode utilities &lt;uchar.h&gt; . . . . . . . . . . . . . . . . . 398</a>
277 <a href="#7.28.1"> 7.28.1 Restartable multibyte/wide character conversion functions . . 398</a>
278 <a href="#7.29"> 7.29 Extended multibyte and wide character utilities &lt;wchar.h&gt; . . . . . 402</a>
279 <a href="#7.29.1"> 7.29.1 Introduction . . . . . . . . . . . . . . . . . . . . . 402</a>
280 <a href="#7.29.2"> 7.29.2 Formatted wide character input/output functions . . . . . . 403</a>
281 <a href="#7.29.3"> 7.29.3 Wide character input/output functions . . . . . . . . . . 421</a>
282 <a href="#7.29.4"> 7.29.4 General wide string utilities . . . . . . . . . . . . . . 426</a>
283 <a href="#7.29.4.1"> 7.29.4.1 Wide string numeric conversion functions . . . . . 426</a>
284 <a href="#7.29.4.2"> 7.29.4.2 Wide string copying functions . . . . . . . . . . 430</a>
285 <a href="#7.29.4.3"> 7.29.4.3 Wide string concatenation functions . . . . . . . 432</a>
286 <a href="#7.29.4.4"> 7.29.4.4 Wide string comparison functions . . . . . . . . 433</a>
287 <a href="#7.29.4.5"> 7.29.4.5 Wide string search functions . . . . . . . . . . 435</a>
288 <a href="#7.29.4.6"> 7.29.4.6 Miscellaneous functions . . . . . . . . . . . . 439</a>
289 <a href="#7.29.5"> 7.29.5 Wide character time conversion functions . . . . . . . . . 439</a>
290 <a href="#7.29.6"> 7.29.6 Extended multibyte/wide character conversion utilities . . . . 440</a>
291 <a href="#7.29.6.1"> 7.29.6.1 Single-byte/wide character conversion functions . . . 441</a>
292 <a href="#7.29.6.2"> 7.29.6.2 Conversion state functions . . . . . . . . . . . 441</a>
293 <a href="#7.29.6.3"> 7.29.6.3 Restartable multibyte/wide character conversion
294 functions . . . . . . . . . . . . . . . . . . 442</a>
295 <a href="#7.29.6.4"> 7.29.6.4 Restartable multibyte/wide string conversion
296 functions . . . . . . . . . . . . . . . . . . 444</a>
297 <a href="#7.30"> 7.30 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 447</a>
298 <a href="#7.30.1"> 7.30.1 Introduction . . . . . . . . . . . . . . . . . . . . . 447</a>
299 <a href="#7.30.2"> 7.30.2 Wide character classification utilities . . . . . . . . . . . 448</a>
300 <a href="#7.30.2.1"> 7.30.2.1 Wide character classification functions . . . . . . 448</a>
301 <a href="#7.30.2.2"> 7.30.2.2 Extensible wide character classification
302 functions . . . . . . . . . . . . . . . . . . 451</a>
303 <a href="#7.30.3"> 7.30.3 Wide character case mapping utilities . . . . . . . . . . . 453</a>
304 <a href="#7.30.3.1"> 7.30.3.1 Wide character case mapping functions . . . . . . 453</a>
305 <a href="#7.30.3.2"> 7.30.3.2 Extensible wide character case mapping
306 functions . . . . . . . . . . . . . . . . . . 453</a>
307 <a href="#7.31"> 7.31 Future library directions . . . . . . . . . . . . . . . . . . . 455</a>
308 <a href="#7.31.1"> 7.31.1 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . 455</a>
309 <a href="#7.31.2"> 7.31.2 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . 455</a>
310 <a href="#7.31.3"> 7.31.3 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . 455</a>
311 <a href="#7.31.4"> 7.31.4 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . 455</a>
312 <a href="#7.31.5"> 7.31.5 Format conversion of integer types &lt;inttypes.h&gt; . . . . 455</a>
313 <a href="#7.31.6"> 7.31.6 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . 455</a>
314 <a href="#7.31.7"> 7.31.7 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . 455</a>
315 <a href="#7.31.8"> 7.31.8 Atomics &lt;stdatomic.h&gt; . . . . . . . . . . . . . . 455</a>
316 <a href="#7.31.9"> 7.31.9 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . 456</a>
317 <a href="#7.31.10"> 7.31.10 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . 456</a>
318 <a href="#7.31.11"> 7.31.11 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . 456</a>
319 <a href="#7.31.12"> 7.31.12 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . 456</a>
321 [page viii]
323 <a href="#7.31.13"> 7.31.13 String handling &lt;string.h&gt; . . . . . . . . . . . . . 456</a>
324 <a href="#7.31.14"> 7.31.14 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . 456</a>
325 <a href="#7.31.15"> 7.31.15 Threads &lt;threads.h&gt; . . . . . . . . . . . . . . . . 456</a>
326 <a href="#7.31.16"> 7.31.16 Extended multibyte and wide character utilities
327 &lt;wchar.h&gt; . . . . . . . . . . . . . . . . . . . . 456</a>
328 <a href="#7.31.17"> 7.31.17 Wide character classification and mapping utilities
329 &lt;wctype.h&gt; . . . . . . . . . . . . . . . . . . . . 457</a>
330 <a href="#A">Annex A (informative) Language syntax summary . . . . . . . . . . . . 458</a>
331 <a href="#A.1"> A.1 Lexical grammar . . . . . . . . . . . . . . . . . . . . . . 458</a>
332 <a href="#A.2"> A.2 Phrase structure grammar . . . . . . . . . . . . . . . . . . . 465</a>
333 <a href="#A.3"> A.3 Preprocessing directives . . . . . . . . . . . . . . . . . . . 473</a>
334 <a href="#B">Annex B (informative) Library summary . . . . . . . . . . . . . . . . 475</a>
335 <a href="#B.1"> B.1 Diagnostics &lt;assert.h&gt; . . . . . . . . . . . . . . . . . . 475</a>
336 <a href="#B.2"> B.2 Complex &lt;complex.h&gt; . . . . . . . . . . . . . . . . . . . 475</a>
337 <a href="#B.3"> B.3 Character handling &lt;ctype.h&gt; . . . . . . . . . . . . . . . . 477</a>
338 <a href="#B.4"> B.4 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . . . . . 477</a>
339 <a href="#B.5"> B.5 Floating-point environment &lt;fenv.h&gt; . . . . . . . . . . . . . 477</a>
340 <a href="#B.6"> B.6 Characteristics of floating types &lt;float.h&gt; . . . . . . . . . . . 478</a>
341 <a href="#B.7"> B.7 Format conversion of integer types &lt;inttypes.h&gt; . . . . . . . . 478</a>
342 <a href="#B.8"> B.8 Alternative spellings &lt;iso646.h&gt; . . . . . . . . . . . . . . . 479</a>
343 <a href="#B.9"> B.9 Sizes of integer types &lt;limits.h&gt; . . . . . . . . . . . . . . 479</a>
344 <a href="#B.10"> B.10 Localization &lt;locale.h&gt; . . . . . . . . . . . . . . . . . . 479</a>
345 <a href="#B.11"> B.11 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 479</a>
346 <a href="#B.12"> B.12 Nonlocal jumps &lt;setjmp.h&gt; . . . . . . . . . . . . . . . . 484</a>
347 <a href="#B.13"> B.13 Signal handling &lt;signal.h&gt; . . . . . . . . . . . . . . . . . 484</a>
348 <a href="#B.14"> B.14 Alignment &lt;stdalign.h&gt; . . . . . . . . . . . . . . . . . 485</a>
349 <a href="#B.15"> B.15 Variable arguments &lt;stdarg.h&gt; . . . . . . . . . . . . . . . 485</a>
350 <a href="#B.16"> B.16 Atomics &lt;stdatomic.h&gt; . . . . . . . . . . . . . . . . . . 485</a>
351 <a href="#B.17"> B.17 Boolean type and values &lt;stdbool.h&gt; . . . . . . . . . . . . 487</a>
352 <a href="#B.18"> B.18 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . . . . . 487</a>
353 <a href="#B.19"> B.19 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . . . . . 487</a>
354 <a href="#B.20"> B.20 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . . . . 488</a>
355 <a href="#B.21"> B.21 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . . . . 491</a>
356 <a href="#B.22"> B.22 _Noreturn &lt;stdnoreturn.h&gt; . . . . . . . . . . . . . . 493</a>
357 <a href="#B.23"> B.23 String handling &lt;string.h&gt; . . . . . . . . . . . . . . . . . 493</a>
358 <a href="#B.24"> B.24 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 495</a>
359 <a href="#B.25"> B.25 Threads &lt;threads.h&gt; . . . . . . . . . . . . . . . . . . . 495</a>
360 <a href="#B.26"> B.26 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . . . . 496</a>
361 <a href="#B.27"> B.27 Unicode utilities &lt;uchar.h&gt; . . . . . . . . . . . . . . . . . 497</a>
362 <a href="#B.28"> B.28 Extended multibyte/wide character utilities &lt;wchar.h&gt; . . . . . . 497</a>
363 <a href="#B.29"> B.29 Wide character classification and mapping utilities &lt;wctype.h&gt; . . . 502</a>
364 <a href="#C">Annex C (informative) Sequence points . . . . . . . . . . . . . . . . . 503</a>
366 [page ix]
368 <a href="#D">Annex D (normative) Universal character names for identifiers . . . . . . . 504</a>
369 <a href="#D.1"> D.1 Ranges of characters allowed . . . . . . . . . . . . . . . . . 504</a>
370 <a href="#D.2"> D.2 Ranges of characters disallowed initially . . . . . . . . . . . . . 504</a>
371 <a href="#E">Annex E (informative) Implementation limits . . . . . . . . . . . . . . 505</a>
372 <a href="#F">Annex F (normative) IEC 60559 floating-point arithmetic . . . . . . . . . . 507</a>
373 <a href="#F.1"> F.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 507</a>
374 <a href="#F.2"> F.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 507</a>
375 <a href="#F.3"> F.3 Operators and functions . . . . . . . . . . . . . . . . . . . 508</a>
376 <a href="#F.4"> F.4 Floating to integer conversion . . . . . . . . . . . . . . . . . 510</a>
377 <a href="#F.5"> F.5 Binary-decimal conversion . . . . . . . . . . . . . . . . . . 510</a>
378 <a href="#F.6"> F.6 The return statement . . . . . . . . . . . . . . . . . . . . 511</a>
379 <a href="#F.7"> F.7 Contracted expressions . . . . . . . . . . . . . . . . . . . . 511</a>
380 <a href="#F.8"> F.8 Floating-point environment . . . . . . . . . . . . . . . . . . 511</a>
381 <a href="#F.9"> F.9 Optimization . . . . . . . . . . . . . . . . . . . . . . . . 514</a>
382 <a href="#F.10"> F.10 Mathematics &lt;math.h&gt; . . . . . . . . . . . . . . . . . . . 517</a>
383 <a href="#F.10.1"> F.10.1 Trigonometric functions . . . . . . . . . . . . . . . . 518</a>
384 <a href="#F.10.2"> F.10.2 Hyperbolic functions . . . . . . . . . . . . . . . . . 520</a>
385 <a href="#F.10.3"> F.10.3 Exponential and logarithmic functions . . . . . . . . . . 520</a>
386 <a href="#F.10.4"> F.10.4 Power and absolute value functions . . . . . . . . . . . 524</a>
387 <a href="#F.10.5"> F.10.5 Error and gamma functions . . . . . . . . . . . . . . . 525</a>
388 <a href="#F.10.6"> F.10.6 Nearest integer functions . . . . . . . . . . . . . . . . 526</a>
389 <a href="#F.10.7"> F.10.7 Remainder functions . . . . . . . . . . . . . . . . . 528</a>
390 <a href="#F.10.8"> F.10.8 Manipulation functions . . . . . . . . . . . . . . . . 529</a>
391 <a href="#F.10.9"> F.10.9 Maximum, minimum, and positive difference functions . . . 530</a>
392 <a href="#F.10.10"> F.10.10 Floating multiply-add . . . . . . . . . . . . . . . . . 530</a>
393 <a href="#F.10.11"> F.10.11 Comparison macros . . . . . . . . . . . . . . . . . . 531</a>
394 <a href="#G">Annex G (normative) IEC 60559-compatible complex arithmetic . . . . . . . 532</a>
395 <a href="#G.1"> G.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 532</a>
396 <a href="#G.2"> G.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 532</a>
397 <a href="#G.3"> G.3 Conventions . . . . . . . . . . . . . . . . . . . . . . . . 532</a>
398 <a href="#G.4"> G.4 Conversions . . . . . . . . . . . . . . . . . . . . . . . . 533</a>
399 <a href="#G.4.1"> G.4.1 Imaginary types . . . . . . . . . . . . . . . . . . . 533</a>
400 <a href="#G.4.2"> G.4.2 Real and imaginary . . . . . . . . . . . . . . . . . . 533</a>
401 <a href="#G.4.3"> G.4.3 Imaginary and complex . . . . . . . . . . . . . . . . 533</a>
402 <a href="#G.5"> G.5 Binary operators . . . . . . . . . . . . . . . . . . . . . . 533</a>
403 <a href="#G.5.1"> G.5.1 Multiplicative operators . . . . . . . . . . . . . . . . 534</a>
404 <a href="#G.5.2"> G.5.2 Additive operators . . . . . . . . . . . . . . . . . . 537</a>
405 <a href="#G.6"> G.6 Complex arithmetic &lt;complex.h&gt; . . . . . . . . . . . . . . 537</a>
406 <a href="#G.6.1"> G.6.1 Trigonometric functions . . . . . . . . . . . . . . . . 539</a>
407 <a href="#G.6.2"> G.6.2 Hyperbolic functions . . . . . . . . . . . . . . . . . 539</a>
408 <a href="#G.6.3"> G.6.3 Exponential and logarithmic functions . . . . . . . . . . 543</a>
409 <a href="#G.6.4"> G.6.4 Power and absolute-value functions . . . . . . . . . . . 544</a>
410 <a href="#G.7"> G.7 Type-generic math &lt;tgmath.h&gt; . . . . . . . . . . . . . . . 545</a>
412 [page x]
414 <a href="#H">Annex H (informative) Language independent arithmetic . . . . . . . . . . 546</a>
415 <a href="#H.1"> H.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . 546</a>
416 <a href="#H.2"> H.2 Types . . . . . . . . . . . . . . . . . . . . . . . . . . . 546</a>
417 <a href="#H.3"> H.3 Notification . . . . . . . . . . . . . . . . . . . . . . . . 550</a>
418 <a href="#I">Annex I (informative) Common warnings . . . . . . . . . . . . . . . . 552</a>
419 <a href="#J">Annex J (informative) Portability issues . . . . . . . . . . . . . . . . . 554</a>
420 <a href="#J.1"> J.1 Unspecified behavior . . . . . . . . . . . . . . . . . . . . . 554</a>
421 <a href="#J.2"> J.2 Undefined behavior . . . . . . . . . . . . . . . . . . . . . 557</a>
422 <a href="#J.3"> J.3 Implementation-defined behavior . . . . . . . . . . . . . . . . 571</a>
423 <a href="#J.4"> J.4 Locale-specific behavior . . . . . . . . . . . . . . . . . . . 578</a>
424 <a href="#J.5"> J.5 Common extensions . . . . . . . . . . . . . . . . . . . . . 579</a>
425 <a href="#K">Annex K (normative) Bounds-checking interfaces . . . . . . . . . . . . . 582</a>
426 <a href="#K.1"> K.1 Background . . . . . . . . . . . . . . . . . . . . . . . . 582</a>
427 <a href="#K.2"> K.2 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . 583</a>
428 <a href="#K.3"> K.3 Library . . . . . . . . . . . . . . . . . . . . . . . . . . 583</a>
429 <a href="#K.3.1"> K.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . 583</a>
430 <a href="#K.3.1.1"> K.3.1.1 Standard headers . . . . . . . . . . . . . . . 583</a>
431 <a href="#K.3.1.2"> K.3.1.2 Reserved identifiers . . . . . . . . . . . . . . 584</a>
432 <a href="#K.3.1.3"> K.3.1.3 Use of errno . . . . . . . . . . . . . . . . . 584</a>
433 <a href="#K.3.1.4"> K.3.1.4 Runtime-constraint violations . . . . . . . . . . 584</a>
434 <a href="#K.3.2"> K.3.2 Errors &lt;errno.h&gt; . . . . . . . . . . . . . . . . . 585</a>
435 <a href="#K.3.3"> K.3.3 Common definitions &lt;stddef.h&gt; . . . . . . . . . . . 585</a>
436 <a href="#K.3.4"> K.3.4 Integer types &lt;stdint.h&gt; . . . . . . . . . . . . . . 585</a>
437 <a href="#K.3.5"> K.3.5 Input/output &lt;stdio.h&gt; . . . . . . . . . . . . . . . 586</a>
438 <a href="#K.3.5.1"> K.3.5.1 Operations on files . . . . . . . . . . . . . . 586</a>
439 <a href="#K.3.5.2"> K.3.5.2 File access functions . . . . . . . . . . . . . . 588</a>
440 <a href="#K.3.5.3"> K.3.5.3 Formatted input/output functions . . . . . . . . . 591</a>
441 <a href="#K.3.5.4"> K.3.5.4 Character input/output functions . . . . . . . . . 602</a>
442 <a href="#K.3.6"> K.3.6 General utilities &lt;stdlib.h&gt; . . . . . . . . . . . . . 604</a>
443 <a href="#K.3.6.1"> K.3.6.1 Runtime-constraint handling . . . . . . . . . . 604</a>
444 <a href="#K.3.6.2"> K.3.6.2 Communication with the environment . . . . . . . 606</a>
445 <a href="#K.3.6.3"> K.3.6.3 Searching and sorting utilities . . . . . . . . . . 607</a>
446 <a href="#K.3.6.4"> K.3.6.4 Multibyte/wide character conversion functions . . . 610</a>
447 <a href="#K.3.6.5"> K.3.6.5 Multibyte/wide string conversion functions . . . . . 611</a>
448 <a href="#K.3.7"> K.3.7 String handling &lt;string.h&gt; . . . . . . . . . . . . . 614</a>
449 <a href="#K.3.7.1"> K.3.7.1 Copying functions . . . . . . . . . . . . . . 614</a>
450 <a href="#K.3.7.2"> K.3.7.2 Concatenation functions . . . . . . . . . . . . 617</a>
451 <a href="#K.3.7.3"> K.3.7.3 Search functions . . . . . . . . . . . . . . . 620</a>
452 <a href="#K.3.7.4"> K.3.7.4 Miscellaneous functions . . . . . . . . . . . . 621</a>
453 <a href="#K.3.8"> K.3.8 Date and time &lt;time.h&gt; . . . . . . . . . . . . . . . 624</a>
454 <a href="#K.3.8.1"> K.3.8.1 Components of time . . . . . . . . . . . . . . 624</a>
455 <a href="#K.3.8.2"> K.3.8.2 Time conversion functions . . . . . . . . . . . 624</a>
457 [page xi]
459 <a href="#K.3.9"> K.3.9 Extended multibyte and wide character utilities
460 &lt;wchar.h&gt; . . . . . . . . . . . . . . . . . . . . 627</a>
461 <a href="#K.3.9.1"> K.3.9.1 Formatted wide character input/output functions . . . 628</a>
462 <a href="#K.3.9.2"> K.3.9.2 General wide string utilities . . . . . . . . . . . 639</a>
463 <a href="#K.3.9.3"> K.3.9.3 Extended multibyte/wide character conversion
464 utilities . . . . . . . . . . . . . . . . . . . 647</a>
465 <a href="#L">Annex L (normative) Analyzability . . . . . . . . . . . . . . . . . . 652</a>
466 <a href="#L.1"> L.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . 652</a>
467 <a href="#L.2"> L.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . 652</a>
468 <a href="#L.3"> L.3 Requirements . . . . . . . . . . . . . . . . . . . . . . . . 653</a>
469 <a href="#Bibliography">Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . 654</a>
470 <a href="#Index">Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657</a>
472 [<a name="pxii" href="#pxii">page xii</a>] (<a href="#Contents">Contents</a>)
474 <a name="Foreword" href="#Foreword"><b> Foreword</b></a>
475 1 ISO (the International Organization for Standardization) and IEC (the International
476 Electrotechnical Commission) form the specialized system for worldwide
477 standardization. National bodies that are member of ISO or IEC participate in the
478 development of International Standards through technical committees established by the
479 respective organization to deal with particular fields of technical activity. ISO and IEC
480 technical committees collaborate in fields of mutual interest. Other international
481 organizations, governmental and non-governmental, in liaison with ISO and IEC, also
482 take part in the work.
483 2 International Standards are drafted in accordance with the rules given in the ISO/IEC
484 Directives, Part 2. This International Standard was drafted in accordance with the fifth
485 edition (2004).
486 3 In the field of information technology, ISO and IEC have established a joint technical
487 committee, ISO/IEC JTC 1. Draft International Standards adopted by the joint technical
488 committee are circulated to national bodies for voting. Publication as an International
489 Standard requires approval by at least 75% of the national bodies casting a vote.
490 4 Attention is drawn to the possibility that some of the elements of this document may be
491 the subject of patent rights. ISO and IEC shall not be held responsible for identifying any
492 or all such patent rights.
493 5 This International Standard was prepared by Joint Technical Committee ISO/IEC JTC 1,
494 Information technology, Subcommittee SC 22, Programming languages, their
495 environments and system software interfaces. The Working Group responsible for this
496 standard (WG 14) maintains a site on the World Wide Web at http://www.open-
497 std.org/JTC1/SC22/WG14/ containing additional information relevant to this
498 standard such as a Rationale for many of the decisions made during its preparation and a
499 log of Defect Reports and Responses.
500 6 This third edition cancels and replaces the second edition, ISO/IEC 9899:1999, as
501 corrected by ISO/IEC 9899:1999/Cor 1:2001, ISO/IEC 9899:1999/Cor 2:2004, and
502 ISO/IEC 9899:1999/Cor 3:2007. Major changes from the previous edition include:
503 -- conditional (optional) features (including some that were previously mandatory)
504 -- support for multiple threads of execution including an improved memory sequencing
505 model, atomic objects, and thread-local storage (<a href="#7.17">&lt;stdatomic.h&gt;</a> and
506 <a href="#7.26">&lt;threads.h&gt;</a>)
507 -- additional floating-point characteristic macros (<a href="#7.7">&lt;float.h&gt;</a>)
508 -- querying and specifying alignment of objects (<a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#7.22">&lt;stdlib.h&gt;</a>)
509 -- Unicode characters and strings (<a href="#7.28">&lt;uchar.h&gt;</a>) (originally specified in
510 ISO/IEC TR 19769:2004)
511 -- type-generic expressions
513 [<a name="pxiii" href="#pxiii">page xiii</a>] (<a href="#Contents">Contents</a>)
515 -- static assertions
516 -- anonymous structures and unions
517 -- no-return functions
518 -- macros to create complex numbers (<a href="#7.3">&lt;complex.h&gt;</a>)
519 -- support for opening files for exclusive access
520 -- removed the gets function (<a href="#7.21">&lt;stdio.h&gt;</a>)
521 -- added the aligned_alloc, at_quick_exit, and quick_exit functions
522 (<a href="#7.22">&lt;stdlib.h&gt;</a>)
523 -- (conditional) support for bounds-checking interfaces (originally specified in
524 ISO/IEC TR 24731-1:2007)
525 -- (conditional) support for analyzability
526 7 Major changes in the second edition included:
527 -- restricted character set support via digraphs and <a href="#7.9">&lt;iso646.h&gt;</a> (originally specified
528 in AMD1)
529 -- wide character library support in <a href="#7.29">&lt;wchar.h&gt;</a> and <a href="#7.30">&lt;wctype.h&gt;</a> (originally
530 specified in AMD1)
531 -- more precise aliasing rules via effective type
532 -- restricted pointers
533 -- variable length arrays
534 -- flexible array members
535 -- static and type qualifiers in parameter array declarators
536 -- complex (and imaginary) support in <a href="#7.3">&lt;complex.h&gt;</a>
537 -- type-generic math macros in <a href="#7.25">&lt;tgmath.h&gt;</a>
538 -- the long long int type and library functions
539 -- increased minimum translation limits
540 -- additional floating-point characteristics in <a href="#7.7">&lt;float.h&gt;</a>
541 -- remove implicit int
542 -- reliable integer division
543 -- universal character names (\u and \U)
544 -- extended identifiers
545 -- hexadecimal floating-point constants and %a and %A printf/scanf conversion
546 specifiers
548 [<a name="pxiv" href="#pxiv">page xiv</a>] (<a href="#Contents">Contents</a>)
550 -- compound literals
551 -- designated initializers
552 -- // comments
553 -- extended integer types and library functions in <a href="#7.8">&lt;inttypes.h&gt;</a> and <a href="#7.20">&lt;stdint.h&gt;</a>
554 -- remove implicit function declaration
555 -- preprocessor arithmetic done in intmax_t/uintmax_t
556 -- mixed declarations and code
557 -- new block scopes for selection and iteration statements
558 -- integer constant type rules
559 -- integer promotion rules
560 -- macros with a variable number of arguments
561 -- the vscanf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a> and <a href="#7.29">&lt;wchar.h&gt;</a>
562 -- additional math library functions in <a href="#7.12">&lt;math.h&gt;</a>
563 -- treatment of error conditions by math library functions (math_errhandling)
564 -- floating-point environment access in <a href="#7.6">&lt;fenv.h&gt;</a>
565 -- IEC 60559 (also known as IEC 559 or IEEE arithmetic) support
566 -- trailing comma allowed in enum declaration
567 -- %lf conversion specifier allowed in printf
568 -- inline functions
569 -- the snprintf family of functions in <a href="#7.21">&lt;stdio.h&gt;</a>
570 -- boolean type in <a href="#7.18">&lt;stdbool.h&gt;</a>
571 -- idempotent type qualifiers
572 -- empty macro arguments
573 -- new structure type compatibility rules (tag compatibility)
574 -- additional predefined macro names
575 -- _Pragma preprocessing operator
576 -- standard pragmas
577 -- __func__ predefined identifier
578 -- va_copy macro
579 -- additional strftime conversion specifiers
580 -- LIA compatibility annex
582 [<a name="pxv" href="#pxv">page xv</a>] (<a href="#Contents">Contents</a>)
584 -- deprecate ungetc at the beginning of a binary file
585 -- remove deprecation of aliased array parameters
586 -- conversion of array to pointer not limited to lvalues
587 -- relaxed constraints on aggregate and union initialization
588 -- relaxed restrictions on portable header names
589 -- return without expression not permitted in function that returns a value (and vice
590 versa)
591 8 Annexes D, F, G, K, and L form a normative part of this standard; annexes A, B, C, E, H,
592 I, J, the bibliography, and the index are for information only. In accordance with Part 2 of
593 the ISO/IEC Directives, this foreword, the introduction, notes, footnotes, and examples
594 are also for information only.
596 [<a name="pxvi" href="#pxvi">page xvi</a>] (<a href="#Contents">Contents</a>)
598 <a name="Introduction" href="#Introduction"><b> Introduction</b></a>
599 1 With the introduction of new devices and extended character sets, new features may be
600 added to this International Standard. Subclauses in the language and library clauses warn
601 implementors and programmers of usages which, though valid in themselves, may
602 conflict with future additions.
603 2 Certain features are obsolescent, which means that they may be considered for
604 withdrawal in future revisions of this International Standard. They are retained because
605 of their widespread use, but their use in new implementations (for implementation
606 features) or new programs (for language [6.11] or library features [7.31]) is discouraged.
607 3 This International Standard is divided into four major subdivisions:
608 -- preliminary elements (clauses 1-4);
609 -- the characteristics of environments that translate and execute C programs (clause 5);
610 -- the language syntax, constraints, and semantics (clause 6);
611 -- the library facilities (clause 7).
612 4 Examples are provided to illustrate possible forms of the constructions described.
613 Footnotes are provided to emphasize consequences of the rules described in that
614 subclause or elsewhere in this International Standard. References are used to refer to
615 other related subclauses. Recommendations are provided to give advice or guidance to
616 implementors. Annexes provide additional information and summarize the information
617 contained in this International Standard. A bibliography lists documents that were
618 referred to during the preparation of the standard.
619 5 The language clause (clause 6) is derived from ''The C Reference Manual''.
620 6 The library clause (clause 7) is based on the 1984 /usr/group Standard.
622 [<a name="pxvii" href="#pxvii">page xvii</a>] (<a href="#Contents">Contents</a>)
625 [<a name="pxviii" href="#pxviii">page xviii</a>] (<a href="#Contents">Contents</a>)
629 Programming languages -- C
633 <a name="1" href="#1"><b> 1. Scope</b></a>
634 1 This International Standard specifies the form and establishes the interpretation of
635 programs written in the C programming language.<sup><a href="#note1"><b>1)</b></a></sup> It specifies
636 -- the representation of C programs;
637 -- the syntax and constraints of the C language;
638 -- the semantic rules for interpreting C programs;
639 -- the representation of input data to be processed by C programs;
640 -- the representation of output data produced by C programs;
641 -- the restrictions and limits imposed by a conforming implementation of C.
642 2 This International Standard does not specify
643 -- the mechanism by which C programs are transformed for use by a data-processing
644 system;
645 -- the mechanism by which C programs are invoked for use by a data-processing
646 system;
647 -- the mechanism by which input data are transformed for use by a C program;
648 -- the mechanism by which output data are transformed after being produced by a C
649 program;
650 -- the size or complexity of a program and its data that will exceed the capacity of any
651 specific data-processing system or the capacity of a particular processor;
652 -- all minimal requirements of a data-processing system that is capable of supporting a
653 conforming implementation.
656 <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
657 data-processing systems. It is intended for use by implementors and programmers.
659 [<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
662 <a name="2" href="#2"><b> 2. Normative references</b></a>
663 1 The following referenced documents are indispensable for the application of this
664 document. For dated references, only the edition cited applies. For undated references,
665 the latest edition of the referenced document (including any amendments) applies.
666 2 ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and symbols for
667 use in the physical sciences and technology.
668 3 ISO/IEC 646, Information technology -- ISO 7-bit coded character set for information
669 interchange.
670 4 ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1: Fundamental
671 terms.
672 5 ISO 4217, Codes for the representation of currencies and funds.
673 6 ISO 8601, Data elements and interchange formats -- Information interchange --
674 Representation of dates and times.
675 7 ISO/IEC 10646 (all parts), Information technology -- Universal Multiple-Octet Coded
676 Character Set (UCS).
677 8 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems (previously
678 designated IEC 559:1989).
680 [<a name="p2" href="#p2">page 2</a>] (<a href="#Contents">Contents</a>)
683 <a name="3" href="#3"><b> 3. Terms, definitions, and symbols</b></a>
684 1 For the purposes of this International Standard, the following definitions apply. Other
685 terms are defined where they appear in italic type or on the left side of a syntax rule.
686 Terms explicitly defined in this International Standard are not to be presumed to refer
687 implicitly to similar terms defined elsewhere. Terms not defined in this International
688 Standard are to be interpreted according to ISO/IEC 2382-1. Mathematical symbols not
689 defined in this International Standard are to be interpreted according to ISO 31-11.
690 <a name="3.1" href="#3.1"><b> 3.1</b></a>
691 1 access
692 &lt;execution-time action&gt; to read or modify the value of an object
693 2 NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
695 3 NOTE 2 ''Modify'' includes the case where the new value being stored is the same as the previous value.
697 4 NOTE 3 Expressions that are not evaluated do not access objects.
699 <a name="3.2" href="#3.2"><b> 3.2</b></a>
700 1 alignment
701 requirement that objects of a particular type be located on storage boundaries with
702 addresses that are particular multiples of a byte address
703 <a name="3.3" href="#3.3"><b> 3.3</b></a>
704 1 argument
705 actual argument
706 actual parameter (deprecated)
707 expression in the comma-separated list bounded by the parentheses in a function call
708 expression, or a sequence of preprocessing tokens in the comma-separated list bounded
709 by the parentheses in a function-like macro invocation
710 <a name="3.4" href="#3.4"><b> 3.4</b></a>
711 1 behavior
712 external appearance or action
713 <a name="3.4.1" href="#3.4.1"><b> 3.4.1</b></a>
714 1 implementation-defined behavior
715 unspecified behavior where each implementation documents how the choice is made
716 2 EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
717 when a signed integer is shifted right.
719 <a name="3.4.2" href="#3.4.2"><b> 3.4.2</b></a>
720 1 locale-specific behavior
721 behavior that depends on local conventions of nationality, culture, and language that each
722 implementation documents
724 [<a name="p3" href="#p3">page 3</a>] (<a href="#Contents">Contents</a>)
726 2 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
727 characters other than the 26 lowercase Latin letters.
729 <a name="3.4.3" href="#3.4.3"><b> 3.4.3</b></a>
730 1 undefined behavior
731 behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
732 for which this International Standard imposes no requirements
733 2 NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
734 results, to behaving during translation or program execution in a documented manner characteristic of the
735 environment (with or without the issuance of a diagnostic message), to terminating a translation or
736 execution (with the issuance of a diagnostic message).
738 3 EXAMPLE An example of undefined behavior is the behavior on integer overflow.
740 <a name="3.4.4" href="#3.4.4"><b> 3.4.4</b></a>
741 1 unspecified behavior
742 use of an unspecified value, or other behavior where this International Standard provides
743 two or more possibilities and imposes no further requirements on which is chosen in any
744 instance
745 2 EXAMPLE An example of unspecified behavior is the order in which the arguments to a function are
746 evaluated.
748 <a name="3.5" href="#3.5"><b> 3.5</b></a>
749 1 bit
750 unit of data storage in the execution environment large enough to hold an object that may
751 have one of two values
752 2 NOTE It need not be possible to express the address of each individual bit of an object.
754 <a name="3.6" href="#3.6"><b> 3.6</b></a>
755 1 byte
756 addressable unit of data storage large enough to hold any member of the basic character
757 set of the execution environment
758 2 NOTE 1 It is possible to express the address of each individual byte of an object uniquely.
760 3 NOTE 2 A byte is composed of a contiguous sequence of bits, the number of which is implementation-
761 defined. The least significant bit is called the low-order bit; the most significant bit is called the high-order
762 bit.
764 <a name="3.7" href="#3.7"><b> 3.7</b></a>
765 1 character
766 &lt;abstract&gt; member of a set of elements used for the organization, control, or
767 representation of data
768 <a name="3.7.1" href="#3.7.1"><b> 3.7.1</b></a>
769 1 character
770 single-byte character
771 &lt;C&gt; bit representation that fits in a byte
773 [<a name="p4" href="#p4">page 4</a>] (<a href="#Contents">Contents</a>)
775 <a name="3.7.2" href="#3.7.2"><b> 3.7.2</b></a>
776 1 multibyte character
777 sequence of one or more bytes representing a member of the extended character set of
778 either the source or the execution environment
779 2 NOTE The extended character set is a superset of the basic character set.
781 <a name="3.7.3" href="#3.7.3"><b> 3.7.3</b></a>
782 1 wide character
783 value representable by an object of type wchar_t, capable of representing any character
784 in the current locale
785 <a name="3.8" href="#3.8"><b> 3.8</b></a>
786 1 constraint
787 restriction, either syntactic or semantic, by which the exposition of language elements is
788 to be interpreted
789 <a name="3.9" href="#3.9"><b> 3.9</b></a>
790 1 correctly rounded result
791 representation in the result format that is nearest in value, subject to the current rounding
792 mode, to what the result would be given unlimited range and precision
793 <a name="3.10" href="#3.10"><b> 3.10</b></a>
794 1 diagnostic message
795 message belonging to an implementation-defined subset of the implementation's message
796 output
797 <a name="3.11" href="#3.11"><b> 3.11</b></a>
798 1 forward reference
799 reference to a later subclause of this International Standard that contains additional
800 information relevant to this subclause
801 <a name="3.12" href="#3.12"><b> 3.12</b></a>
802 1 implementation
803 particular set of software, running in a particular translation environment under particular
804 control options, that performs translation of programs for, and supports execution of
805 functions in, a particular execution environment
806 <a name="3.13" href="#3.13"><b> 3.13</b></a>
807 1 implementation limit
808 restriction imposed upon programs by the implementation
809 <a name="3.14" href="#3.14"><b> 3.14</b></a>
810 1 memory location
811 either an object of scalar type, or a maximal sequence of adjacent bit-fields all having
812 nonzero width
814 [<a name="p5" href="#p5">page 5</a>] (<a href="#Contents">Contents</a>)
816 2 NOTE 1 Two threads of execution can update and access separate memory locations without interfering
817 with each other.
819 3 NOTE 2 A bit-field and an adjacent non-bit-field member are in separate memory locations. The same
820 applies to two bit-fields, if one is declared inside a nested structure declaration and the other is not, or if the
821 two are separated by a zero-length bit-field declaration, or if they are separated by a non-bit-field member
822 declaration. It is not safe to concurrently update two non-atomic bit-fields in the same structure if all
823 members declared between them are also (non-zero-length) bit-fields, no matter what the sizes of those
824 intervening bit-fields happen to be.
826 4 EXAMPLE A structure declared as
827 struct {
828 char a;
829 int b:5, c:11, :0, d:8;
830 struct { int ee:8; } e;
832 contains four separate memory locations: The member a, and bit-fields d and e.ee are each separate
833 memory locations, and can be modified concurrently without interfering with each other. The bit-fields b
834 and c together constitute the fourth memory location. The bit-fields b and c cannot be concurrently
835 modified, but b and a, for example, can be.
837 <a name="3.15" href="#3.15"><b> 3.15</b></a>
838 1 object
839 region of data storage in the execution environment, the contents of which can represent
840 values
841 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>.
843 <a name="3.16" href="#3.16"><b> 3.16</b></a>
844 1 parameter
845 formal parameter
846 formal argument (deprecated)
847 object declared as part of a function declaration or definition that acquires a value on
848 entry to the function, or an identifier from the comma-separated list bounded by the
849 parentheses immediately following the macro name in a function-like macro definition
850 <a name="3.17" href="#3.17"><b> 3.17</b></a>
851 1 recommended practice
852 specification that is strongly recommended as being in keeping with the intent of the
853 standard, but that may be impractical for some implementations
854 <a name="3.18" href="#3.18"><b> 3.18</b></a>
855 1 runtime-constraint
856 requirement on a program when calling a library function
857 2 NOTE 1 Despite the similar terms, a runtime-constraint is not a kind of constraint as defined by <a href="#3.8">3.8</a>, and
858 need not be diagnosed at translation time.
860 3 NOTE 2 Implementations that support the extensions in <a href="#K">annex K</a> are required to verify that the runtime-
861 constraints for a library function are not violated by the program; see <a href="#K.3.1.4">K.3.1.4</a>.
863 [<a name="p6" href="#p6">page 6</a>] (<a href="#Contents">Contents</a>)
865 <a name="3.19" href="#3.19"><b> 3.19</b></a>
866 1 value
867 precise meaning of the contents of an object when interpreted as having a specific type
868 <a name="3.19.1" href="#3.19.1"><b> 3.19.1</b></a>
869 1 implementation-defined value
870 unspecified value where each implementation documents how the choice is made
871 <a name="3.19.2" href="#3.19.2"><b> 3.19.2</b></a>
872 1 indeterminate value
873 either an unspecified value or a trap representation
874 <a name="3.19.3" href="#3.19.3"><b> 3.19.3</b></a>
875 1 unspecified value
876 valid value of the relevant type where this International Standard imposes no
877 requirements on which value is chosen in any instance
878 2 NOTE An unspecified value cannot be a trap representation.
880 <a name="3.19.4" href="#3.19.4"><b> 3.19.4</b></a>
881 1 trap representation
882 an object representation that need not represent a value of the object type
883 <a name="3.19.5" href="#3.19.5"><b> 3.19.5</b></a>
884 1 perform a trap
885 interrupt execution of the program such that no further operations are performed
886 2 NOTE In this International Standard, when the word ''trap'' is not immediately followed by
887 ''representation'', this is the intended usage.<sup><a href="#note2"><b>2)</b></a></sup>
889 <a name="3.20" href="#3.20"><b> 3.20</b></a>
890 1 [^ x^]
891 ceiling of x: the least integer greater than or equal to x
892 2 EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
894 <a name="3.21" href="#3.21"><b> 3.21</b></a>
895 1 [_ x_]
896 floor of x: the greatest integer less than or equal to x
897 2 EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
902 <sup><a name="note2" href="#note2"><b>2)</b></a></sup> For example, ''Trapping or stopping (if supported) is disabled...'' (<a href="#F.8.2">F.8.2</a>). Note that fetching a trap
903 representation might perform a trap but is not required to (see <a href="#6.2.6.1">6.2.6.1</a>).
905 [<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
908 <a name="4" href="#4"><b> 4. Conformance</b></a>
909 1 In this International Standard, ''shall'' is to be interpreted as a requirement on an
910 implementation or on a program; conversely, ''shall not'' is to be interpreted as a
911 prohibition.
912 2 If a ''shall'' or ''shall not'' requirement that appears outside of a constraint or runtime-
913 constraint is violated, the behavior is undefined. Undefined behavior is otherwise
914 indicated in this International Standard by the words ''undefined behavior'' or by the
915 omission of any explicit definition of behavior. There is no difference in emphasis among
916 these three; they all describe ''behavior that is undefined''.
917 3 A program that is correct in all other aspects, operating on correct data, containing
918 unspecified behavior shall be a correct program and act in accordance with <a href="#5.1.2.3">5.1.2.3</a>.
919 4 The implementation shall not successfully translate a preprocessing translation unit
920 containing a #error preprocessing directive unless it is part of a group skipped by
921 conditional inclusion.
922 5 A strictly conforming program shall use only those features of the language and library
923 specified in this International Standard.<sup><a href="#note3"><b>3)</b></a></sup> It shall not produce output dependent on any
924 unspecified, undefined, or implementation-defined behavior, and shall not exceed any
925 minimum implementation limit.
926 6 The two forms of conforming implementation are hosted and freestanding. A conforming
927 hosted implementation shall accept any strictly conforming program. A conforming
928 freestanding implementation shall accept any strictly conforming program in which the *
929 use of the features specified in the library clause (clause 7) is confined to the contents of
930 the standard headers <a href="#7.7">&lt;float.h&gt;</a>, <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#7.15">&lt;stdalign.h&gt;</a>,
931 <a href="#7.16">&lt;stdarg.h&gt;</a>, <a href="#7.18">&lt;stdbool.h&gt;</a>, <a href="#7.19">&lt;stddef.h&gt;</a>, <a href="#7.20">&lt;stdint.h&gt;</a>, and
932 <a href="#7.23">&lt;stdnoreturn.h&gt;</a>. A conforming implementation may have extensions (including
933 additional library functions), provided they do not alter the behavior of any strictly
934 conforming program.<sup><a href="#note4"><b>4)</b></a></sup>
938 <sup><a name="note3" href="#note3"><b>3)</b></a></sup> A strictly conforming program can use conditional features (see <a href="#6.10.8.3">6.10.8.3</a>) provided the use is guarded
939 by an appropriate conditional inclusion preprocessing directive using the related macro. For example:
940 #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
941 /* ... */
942 fesetround(FE_UPWARD);
943 /* ... */
944 #endif
946 <sup><a name="note4" href="#note4"><b>4)</b></a></sup> This implies that a conforming implementation reserves no identifiers other than those explicitly
947 reserved in this International Standard.
949 [<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
951 7 A conforming program is one that is acceptable to a conforming implementation.<sup><a href="#note5"><b>5)</b></a></sup>
952 8 An implementation shall be accompanied by a document that defines all implementation-
953 defined and locale-specific characteristics and all extensions.
954 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
955 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>
956 (<a href="#7.9">7.9</a>), sizes of integer types <a href="#7.10">&lt;limits.h&gt;</a> (<a href="#7.10">7.10</a>), alignment <a href="#7.15">&lt;stdalign.h&gt;</a> (<a href="#7.15">7.15</a>),
957 variable arguments <a href="#7.16">&lt;stdarg.h&gt;</a> (<a href="#7.16">7.16</a>), boolean type and values <a href="#7.18">&lt;stdbool.h&gt;</a>
958 (<a href="#7.18">7.18</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>),
959 <a href="#7.23">&lt;stdnoreturn.h&gt;</a> (<a href="#7.23">7.23</a>).
964 <sup><a name="note5" href="#note5"><b>5)</b></a></sup> Strictly conforming programs are intended to be maximally portable among conforming
965 implementations. Conforming programs may depend upon nonportable features of a conforming
966 implementation.
968 [<a name="p9" href="#p9">page 9</a>] (<a href="#Contents">Contents</a>)
971 <a name="5" href="#5"><b> 5. Environment</b></a>
972 1 An implementation translates C source files and executes C programs in two data-
973 processing-system environments, which will be called the translation environment and
974 the execution environment in this International Standard. Their characteristics define and
975 constrain the results of executing conforming C programs constructed according to the
976 syntactic and semantic rules for conforming implementations.
977 Forward references: In this clause, only a few of many possible forward references
978 have been noted.
979 <a name="5.1" href="#5.1"><b> 5.1 Conceptual models</b></a>
980 <a name="5.1.1" href="#5.1.1"><b> 5.1.1 Translation environment</b></a>
981 <a name="5.1.1.1" href="#5.1.1.1"><b> 5.1.1.1 Program structure</b></a>
982 1 A C program need not all be translated at the same time. The text of the program is kept
983 in units called source files, (or preprocessing files) in this International Standard. A
984 source file together with all the headers and source files included via the preprocessing
985 directive #include is known as a preprocessing translation unit. After preprocessing, a
986 preprocessing translation unit is called a translation unit. Previously translated translation
987 units may be preserved individually or in libraries. The separate translation units of a
988 program communicate by (for example) calls to functions whose identifiers have external
989 linkage, manipulation of objects whose identifiers have external linkage, or manipulation
990 of data files. Translation units may be separately translated and then later linked to
991 produce an executable program.
992 Forward references: linkages of identifiers (<a href="#6.2.2">6.2.2</a>), external definitions (<a href="#6.9">6.9</a>),
993 preprocessing directives (<a href="#6.10">6.10</a>).
994 <a name="5.1.1.2" href="#5.1.1.2"><b> 5.1.1.2 Translation phases</b></a>
995 1 The precedence among the syntax rules of translation is specified by the following
996 phases.<sup><a href="#note6"><b>6)</b></a></sup>
997 1. Physical source file multibyte characters are mapped, in an implementation-
998 defined manner, to the source character set (introducing new-line characters for
999 end-of-line indicators) if necessary. Trigraph sequences are replaced by
1000 corresponding single-character internal representations.
1004 <sup><a name="note6" href="#note6"><b>6)</b></a></sup> Implementations shall behave as if these separate phases occur, even though many are typically folded
1005 together in practice. Source files, translation units, and translated translation units need not
1006 necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
1007 and any external representation. The description is conceptual only, and does not specify any
1008 particular implementation.
1010 [<a name="p10" href="#p10">page 10</a>] (<a href="#Contents">Contents</a>)
1012 2. Each instance of a backslash character (\) immediately followed by a new-line
1013 character is deleted, splicing physical source lines to form logical source lines.
1014 Only the last backslash on any physical source line shall be eligible for being part
1015 of such a splice. A source file that is not empty shall end in a new-line character,
1016 which shall not be immediately preceded by a backslash character before any such
1017 splicing takes place.
1018 3. The source file is decomposed into preprocessing tokens<sup><a href="#note7"><b>7)</b></a></sup> and sequences of
1019 white-space characters (including comments). A source file shall not end in a
1020 partial preprocessing token or in a partial comment. Each comment is replaced by
1021 one space character. New-line characters are retained. Whether each nonempty
1022 sequence of white-space characters other than new-line is retained or replaced by
1023 one space character is implementation-defined.
1024 4. Preprocessing directives are executed, macro invocations are expanded, and
1025 _Pragma unary operator expressions are executed. If a character sequence that
1026 matches the syntax of a universal character name is produced by token
1027 concatenation (<a href="#6.10.3.3">6.10.3.3</a>), the behavior is undefined. A #include preprocessing
1028 directive causes the named header or source file to be processed from phase 1
1029 through phase 4, recursively. All preprocessing directives are then deleted.
1030 5. Each source character set member and escape sequence in character constants and
1031 string literals is converted to the corresponding member of the execution character
1032 set; if there is no corresponding member, it is converted to an implementation-
1033 defined member other than the null (wide) character.<sup><a href="#note8"><b>8)</b></a></sup>
1034 6. Adjacent string literal tokens are concatenated.
1035 7. White-space characters separating tokens are no longer significant. Each
1036 preprocessing token is converted into a token. The resulting tokens are
1037 syntactically and semantically analyzed and translated as a translation unit.
1038 8. All external object and function references are resolved. Library components are
1039 linked to satisfy external references to functions and objects not defined in the
1040 current translation. All such translator output is collected into a program image
1041 which contains information needed for execution in its execution environment.
1042 Forward references: universal character names (<a href="#6.4.3">6.4.3</a>), lexical elements (<a href="#6.4">6.4</a>),
1043 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>).
1047 <sup><a name="note7" href="#note7"><b>7)</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
1048 context-dependent. For example, see the handling of &lt; within a #include preprocessing directive.
1049 <sup><a name="note8" href="#note8"><b>8)</b></a></sup> An implementation need not convert all non-corresponding source characters to the same execution
1050 character.
1052 [<a name="p11" href="#p11">page 11</a>] (<a href="#Contents">Contents</a>)
1054 <a name="5.1.1.3" href="#5.1.1.3"><b> 5.1.1.3 Diagnostics</b></a>
1055 1 A conforming implementation shall produce at least one diagnostic message (identified in
1056 an implementation-defined manner) if a preprocessing translation unit or translation unit
1057 contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
1058 specified as undefined or implementation-defined. Diagnostic messages need not be
1059 produced in other circumstances.<sup><a href="#note9"><b>9)</b></a></sup>
1060 2 EXAMPLE An implementation shall issue a diagnostic for the translation unit:
1061 char i;
1062 int i;
1063 because in those cases where wording in this International Standard describes the behavior for a construct
1064 as being both a constraint error and resulting in undefined behavior, the constraint error shall be diagnosed.
1066 <a name="5.1.2" href="#5.1.2"><b> 5.1.2 Execution environments</b></a>
1067 1 Two execution environments are defined: freestanding and hosted. In both cases,
1068 program startup occurs when a designated C function is called by the execution
1069 environment. All objects with static storage duration shall be initialized (set to their
1070 initial values) before program startup. The manner and timing of such initialization are
1071 otherwise unspecified. Program termination returns control to the execution
1072 environment.
1073 Forward references: storage durations of objects (<a href="#6.2.4">6.2.4</a>), initialization (<a href="#6.7.9">6.7.9</a>).
1074 <a name="5.1.2.1" href="#5.1.2.1"><b> 5.1.2.1 Freestanding environment</b></a>
1075 1 In a freestanding environment (in which C program execution may take place without any
1076 benefit of an operating system), the name and type of the function called at program
1077 startup are implementation-defined. Any library facilities available to a freestanding
1078 program, other than the minimal set required by clause 4, are implementation-defined.
1079 2 The effect of program termination in a freestanding environment is implementation-
1080 defined.
1081 <a name="5.1.2.2" href="#5.1.2.2"><b> 5.1.2.2 Hosted environment</b></a>
1082 1 A hosted environment need not be provided, but shall conform to the following
1083 specifications if present.
1088 <sup><a name="note9" href="#note9"><b>9)</b></a></sup> The intent is that an implementation should identify the nature of, and where possible localize, each
1089 violation. Of course, an implementation is free to produce any number of diagnostics as long as a
1090 valid program is still correctly translated. It may also successfully translate an invalid program.
1092 [<a name="p12" href="#p12">page 12</a>] (<a href="#Contents">Contents</a>)
1094 <a name="5.1.2.2.1" href="#5.1.2.2.1"><b> 5.1.2.2.1 Program startup</b></a>
1095 1 The function called at program startup is named main. The implementation declares no
1096 prototype for this function. It shall be defined with a return type of int and with no
1097 parameters:
1098 int main(void) { /* ... */ }
1099 or with two parameters (referred to here as argc and argv, though any names may be
1100 used, as they are local to the function in which they are declared):
1101 int main(int argc, char *argv[]) { /* ... */ }
1102 or equivalent;<sup><a href="#note10"><b>10)</b></a></sup> or in some other implementation-defined manner.
1103 2 If they are declared, the parameters to the main function shall obey the following
1104 constraints:
1105 -- The value of argc shall be nonnegative.
1106 -- argv[argc] shall be a null pointer.
1107 -- If the value of argc is greater than zero, the array members argv[0] through
1108 argv[argc-1] inclusive shall contain pointers to strings, which are given
1109 implementation-defined values by the host environment prior to program startup. The
1110 intent is to supply to the program information determined prior to program startup
1111 from elsewhere in the hosted environment. If the host environment is not capable of
1112 supplying strings with letters in both uppercase and lowercase, the implementation
1113 shall ensure that the strings are received in lowercase.
1114 -- If the value of argc is greater than zero, the string pointed to by argv[0]
1115 represents the program name; argv[0][0] shall be the null character if the
1116 program name is not available from the host environment. If the value of argc is
1117 greater than one, the strings pointed to by argv[1] through argv[argc-1]
1118 represent the program parameters.
1119 -- The parameters argc and argv and the strings pointed to by the argv array shall
1120 be modifiable by the program, and retain their last-stored values between program
1121 startup and program termination.
1122 <a name="5.1.2.2.2" href="#5.1.2.2.2"><b> 5.1.2.2.2 Program execution</b></a>
1123 1 In a hosted environment, a program may use all the functions, macros, type definitions,
1124 and objects described in the library clause (clause 7).
1129 <sup><a name="note10" href="#note10"><b>10)</b></a></sup> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
1130 char ** argv, and so on.
1132 [<a name="p13" href="#p13">page 13</a>] (<a href="#Contents">Contents</a>)
1134 <a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
1135 1 If the return type of the main function is a type compatible with int, a return from the
1136 initial call to the main function is equivalent to calling the exit function with the value
1137 returned by the main function as its argument;<sup><a href="#note11"><b>11)</b></a></sup> reaching the } that terminates the
1138 main function returns a value of 0. If the return type is not compatible with int, the
1139 termination status returned to the host environment is unspecified.
1140 Forward references: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>).
1141 <a name="5.1.2.3" href="#5.1.2.3"><b> 5.1.2.3 Program execution</b></a>
1142 1 The semantic descriptions in this International Standard describe the behavior of an
1143 abstract machine in which issues of optimization are irrelevant.
1144 2 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1145 that does any of those operations are all side effects,<sup><a href="#note12"><b>12)</b></a></sup> which are changes in the state of
1146 the execution environment. Evaluation of an expression in general includes both value
1147 computations and initiation of side effects. Value computation for an lvalue expression
1148 includes determining the identity of the designated object.
1149 3 Sequenced before is an asymmetric, transitive, pair-wise relation between evaluations
1150 executed by a single thread, which induces a partial order among those evaluations.
1151 Given any two evaluations A and B, if A is sequenced before B, then the execution of A
1152 shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
1153 sequenced after A.) If A is not sequenced before or after B, then A and B are
1154 unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
1155 either before or after B, but it is unspecified which.<sup><a href="#note13"><b>13)</b></a></sup> The presence of a sequence point
1156 between the evaluation of expressions A and B implies that every value computation and
1157 side effect associated with A is sequenced before every value computation and side effect
1158 associated with B. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
1159 4 In the abstract machine, all expressions are evaluated as specified by the semantics. An
1160 actual implementation need not evaluate part of an expression if it can deduce that its
1161 value is not used and that no needed side effects are produced (including any caused by
1163 <sup><a name="note11" href="#note11"><b>11)</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
1164 will have ended in the former case, even where they would not have in the latter.
1165 <sup><a name="note12" href="#note12"><b>12)</b></a></sup> The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
1166 flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
1167 values of floating-point operations. Implementations that support such floating-point state are
1168 required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
1169 environment library <a href="#7.6">&lt;fenv.h&gt;</a> provides a programming facility for indicating when these side
1170 effects matter, freeing the implementations in other cases.
1171 <sup><a name="note13" href="#note13"><b>13)</b></a></sup> The executions of unsequenced evaluations can interleave. Indeterminately sequenced evaluations
1172 cannot interleave, but can be executed in any order.
1174 [<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
1176 calling a function or accessing a volatile object).
1177 5 When the processing of the abstract machine is interrupted by receipt of a signal, the
1178 values of objects that are neither lock-free atomic objects nor of type volatile
1179 sig_atomic_t are unspecified, as is the state of the floating-point environment. The
1180 value of any object modified by the handler that is neither a lock-free atomic object nor of
1181 type volatile sig_atomic_t becomes indeterminate when the handler exits, as
1182 does the state of the floating-point environment if it is modified by the handler and not
1183 restored to its original state.
1184 6 The least requirements on a conforming implementation are:
1185 -- Accesses to volatile objects are evaluated strictly according to the rules of the abstract
1186 machine.
1187 -- At program termination, all data written into files shall be identical to the result that
1188 execution of the program according to the abstract semantics would have produced.
1189 -- The input and output dynamics of interactive devices shall take place as specified in
1190 <a name="7.21.3" href="#7.21.3"><b> 7.21.3. The intent of these requirements is that unbuffered or line-buffered output</b></a>
1191 appear as soon as possible, to ensure that prompting messages actually appear prior to
1192 a program waiting for input.
1193 This is the observable behavior of the program.
1194 7 What constitutes an interactive device is implementation-defined.
1195 8 More stringent correspondences between abstract and actual semantics may be defined by
1196 each implementation.
1197 9 EXAMPLE 1 An implementation might define a one-to-one correspondence between abstract and actual
1198 semantics: at every sequence point, the values of the actual objects would agree with those specified by the
1199 abstract semantics. The keyword volatile would then be redundant.
1200 10 Alternatively, an implementation might perform various optimizations within each translation unit, such
1201 that the actual semantics would agree with the abstract semantics only when making function calls across
1202 translation unit boundaries. In such an implementation, at the time of each function entry and function
1203 return where the calling function and the called function are in different translation units, the values of all
1204 externally linked objects and of all objects accessible via pointers therein would agree with the abstract
1205 semantics. Furthermore, at the time of each such function entry the values of the parameters of the called
1206 function and of all objects accessible via pointers therein would agree with the abstract semantics. In this
1207 type of implementation, objects referred to by interrupt service routines activated by the signal function
1208 would require explicit specification of volatile storage, as well as other implementation-defined
1209 restrictions.
1211 11 EXAMPLE 2 In executing the fragment
1212 char c1, c2;
1213 /* ... */
1214 c1 = c1 + c2;
1215 the ''integer promotions'' require that the abstract machine promote the value of each variable to int size
1216 and then add the two ints and truncate the sum. Provided the addition of two chars can be done without
1218 [<a name="p15" href="#p15">page 15</a>] (<a href="#Contents">Contents</a>)
1220 overflow, or with overflow wrapping silently to produce the correct result, the actual execution need only
1221 produce the same result, possibly omitting the promotions.
1223 12 EXAMPLE 3 Similarly, in the fragment
1224 float f1, f2;
1225 double d;
1226 /* ... */
1227 f1 = f2 * d;
1228 the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
1229 that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
1230 were replaced by the constant 2.0, which has type double).
1232 13 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
1233 semantics. Values are independent of whether they are represented in a register or in memory. For
1234 example, an implicit spilling of a register is not permitted to alter the value. Also, an explicit store and load
1235 is required to round to the precision of the storage type. In particular, casts and assignments are required to
1236 perform their specified conversion. For the fragment
1237 double d1, d2;
1238 float f;
1239 d1 = f = expression;
1240 d2 = (float) expression;
1241 the values assigned to d1 and d2 are required to have been converted to float.
1243 14 EXAMPLE 5 Rearrangement for floating-point expressions is often restricted because of limitations in
1244 precision as well as range. The implementation cannot generally apply the mathematical associative rules
1245 for addition or multiplication, nor the distributive rule, because of roundoff error, even in the absence of
1246 overflow and underflow. Likewise, implementations cannot generally replace decimal constants in order to
1247 rearrange expressions. In the following fragment, rearrangements suggested by mathematical rules for real
1248 numbers are often not valid (see <a href="#F.9">F.9</a>).
1249 double x, y, z;
1250 /* ... */
1251 x = (x * y) * z; // not equivalent to x *= y * z;
1252 z = (x - y) + y ; // not equivalent to z = x;
1253 z = x + x * y; // not equivalent to z = x * (1.0 + y);
1254 y = x / 5.0; // not equivalent to y = x * 0.2;
1256 15 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
1257 int a, b;
1258 /* ... */
1259 a = a + 32760 + b + 5;
1260 the expression statement behaves exactly the same as
1261 a = (((a + 32760) + b) + 5);
1262 due to the associativity and precedence of these operators. Thus, the result of the sum (a + 32760) is
1263 next added to b, and that result is then added to 5 which results in the value assigned to a. On a machine in
1264 which overflows produce an explicit trap and in which the range of values representable by an int is
1265 [-32768, +32767], the implementation cannot rewrite this expression as
1266 a = ((a + b) + 32765);
1267 since if the values for a and b were, respectively, -32754 and -15, the sum a + b would produce a trap
1269 [<a name="p16" href="#p16">page 16</a>] (<a href="#Contents">Contents</a>)
1271 while the original expression would not; nor can the expression be rewritten either as
1272 a = ((a + 32765) + b);
1274 a = (a + (b + 32765));
1275 since the values for a and b might have been, respectively, 4 and -8 or -17 and 12. However, on a machine
1276 in which overflow silently generates some value and where positive and negative overflows cancel, the
1277 above expression statement can be rewritten by the implementation in any of the above ways because the
1278 same result will occur.
1280 16 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
1281 following fragment
1282 #include <a href="#7.21">&lt;stdio.h&gt;</a>
1283 int sum;
1284 char *p;
1285 /* ... */
1286 sum = sum * 10 - '0' + (*p++ = getchar());
1287 the expression statement is grouped as if it were written as
1288 sum = (((sum * 10) - '0') + ((*(p++)) = (getchar())));
1289 but the actual increment of p can occur at any time between the previous sequence point and the next
1290 sequence point (the ;), and the call to getchar can occur at any point prior to the need of its returned
1291 value.
1293 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>), floating-
1294 point environment <a href="#7.6">&lt;fenv.h&gt;</a> (<a href="#7.6">7.6</a>), the signal function (<a href="#7.14">7.14</a>), files (<a href="#7.21.3">7.21.3</a>).
1295 <a name="5.1.2.4" href="#5.1.2.4"><b> 5.1.2.4 Multi-threaded executions and data races</b></a>
1296 1 Under a hosted implementation, a program can have more than one thread of execution
1297 (or thread) running concurrently. The execution of each thread proceeds as defined by
1298 the remainder of this standard. The execution of the entire program consists of an
1299 execution of all of its threads.<sup><a href="#note14"><b>14)</b></a></sup> Under a freestanding implementation, it is
1300 implementation-defined whether a program can have more than one thread of execution.
1301 2 The value of an object visible to a thread T at a particular point is the initial value of the
1302 object, a value stored in the object by T , or a value stored in the object by another thread,
1303 according to the rules below.
1304 3 NOTE 1 In some cases, there may instead be undefined behavior. Much of this section is motivated by
1305 the desire to support atomic operations with explicit and detailed visibility constraints. However, it also
1306 implicitly supports a simpler view for more restricted programs.
1308 4 Two expression evaluations conflict if one of them modifies a memory location and the
1309 other one reads or modifies the same memory location.
1312 <sup><a name="note14" href="#note14"><b>14)</b></a></sup> The execution can usually be viewed as an interleaving of all of the threads. However, some kinds of
1313 atomic operations, for example, allow executions inconsistent with a simple interleaving as described
1314 below.
1316 [<a name="p17" href="#p17">page 17</a>] (<a href="#Contents">Contents</a>)
1318 5 The library defines a number of atomic operations (<a href="#7.17">7.17</a>) and operations on mutexes
1319 (<a href="#7.26.4">7.26.4</a>) that are specially identified as synchronization operations. These operations play
1320 a special role in making assignments in one thread visible to another. A synchronization
1321 operation on one or more memory locations is either an acquire operation, a release
1322 operation, both an acquire and release operation, or a consume operation. A
1323 synchronization operation without an associated memory location is a fence and can be
1324 either an acquire fence, a release fence, or both an acquire and release fence. In addition,
1325 there are relaxed atomic operations, which are not synchronization operations, and
1326 atomic read-modify-write operations, which have special characteristics.
1327 6 NOTE 2 For example, a call that acquires a mutex will perform an acquire operation on the locations
1328 composing the mutex. Correspondingly, a call that releases the same mutex will perform a release
1329 operation on those same locations. Informally, performing a release operation on A forces prior side effects
1330 on other memory locations to become visible to other threads that later perform an acquire or consume
1331 operation on A. We do not include relaxed atomic operations as synchronization operations although, like
1332 synchronization operations, they cannot contribute to data races.
1334 7 All modifications to a particular atomic object M occur in some particular total order,
1335 called the modification order of M. If A and B are modifications of an atomic object M,
1336 and A happens before B, then A shall precede B in the modification order of M, which is
1337 defined below.
1338 8 NOTE 3 This states that the modification orders must respect the ''happens before'' relation.
1340 9 NOTE 4 There is a separate order for each atomic object. There is no requirement that these can be
1341 combined into a single total order for all objects. In general this will be impossible since different threads
1342 may observe modifications to different variables in inconsistent orders.
1344 10 A release sequence headed by a release operation A on an atomic object M is a maximal
1345 contiguous sub-sequence of side effects in the modification order of M, where the first
1346 operation is A and every subsequent operation either is performed by the same thread that
1347 performed the release or is an atomic read-modify-write operation.
1348 11 Certain library calls synchronize with other library calls performed by another thread. In
1349 particular, an atomic operation A that performs a release operation on an object M
1350 synchronizes with an atomic operation B that performs an acquire operation on M and
1351 reads a value written by any side effect in the release sequence headed by A.
1352 12 NOTE 5 Except in the specified cases, reading a later value does not necessarily ensure visibility as
1353 described below. Such a requirement would sometimes interfere with efficient implementation.
1355 13 NOTE 6 The specifications of the synchronization operations define when one reads the value written by
1356 another. For atomic variables, the definition is clear. All operations on a given mutex occur in a single total
1357 order. Each mutex acquisition ''reads the value written'' by the last mutex release.
1359 14 An evaluation A carries a dependency <sup><a href="#note15"><b>15)</b></a></sup> to an evaluation B if:
1362 <sup><a name="note15" href="#note15"><b>15)</b></a></sup> The ''carries a dependency'' relation is a subset of the ''sequenced before'' relation, and is similarly
1363 strictly intra-thread.
1365 [<a name="p18" href="#p18">page 18</a>] (<a href="#Contents">Contents</a>)
1367 -- the value of A is used as an operand of B, unless:
1368 o B is an invocation of the kill_dependency macro,
1370 o A is the left operand of a &amp;&amp; or || operator,
1372 o A is the left operand of a ? : operator, or
1374 o A is the left operand of a , operator;
1376 -- A writes a scalar object or bit-field M, B reads from M the value written by A, and A
1377 is sequenced before B, or
1378 -- for some evaluation X, A carries a dependency to X and X carries a dependency to B.
1379 15 An evaluation A is dependency-ordered before<sup><a href="#note16"><b>16)</b></a></sup> an evaluation B if:
1380 -- A performs a release operation on an atomic object M, and, in another thread, B
1381 performs a consume operation on M and reads a value written by any side effect in
1382 the release sequence headed by A, or
1383 -- for some evaluation X, A is dependency-ordered before X and X carries a
1384 dependency to B.
1385 16 An evaluation A inter-thread happens before an evaluation B if A synchronizes with B, A
1386 is dependency-ordered before B, or, for some evaluation X:
1387 -- A synchronizes with X and X is sequenced before B,
1388 -- A is sequenced before X and X inter-thread happens before B, or
1389 -- A inter-thread happens before X and X inter-thread happens before B.
1390 17 NOTE 7 The ''inter-thread happens before'' relation describes arbitrary concatenations of ''sequenced
1391 before'', ''synchronizes with'', and ''dependency-ordered before'' relationships, with two exceptions. The
1392 first exception is that a concatenation is not permitted to end with ''dependency-ordered before'' followed
1393 by ''sequenced before''. The reason for this limitation is that a consume operation participating in a
1394 ''dependency-ordered before'' relationship provides ordering only with respect to operations to which this
1395 consume operation actually carries a dependency. The reason that this limitation applies only to the end of
1396 such a concatenation is that any subsequent release operation will provide the required ordering for a prior
1397 consume operation. The second exception is that a concatenation is not permitted to consist entirely of
1398 ''sequenced before''. The reasons for this limitation are (1) to permit ''inter-thread happens before'' to be
1399 transitively closed and (2) the ''happens before'' relation, defined below, provides for relationships
1400 consisting entirely of ''sequenced before''.
1402 18 An evaluation A happens before an evaluation B if A is sequenced before B or A inter-
1403 thread happens before B.
1407 <sup><a name="note16" href="#note16"><b>16)</b></a></sup> The ''dependency-ordered before'' relation is analogous to the ''synchronizes with'' relation, but uses
1408 release/consume in place of release/acquire.
1410 [<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
1412 19 A visible side effect A on an object M with respect to a value computation B of M
1413 satisfies the conditions:
1414 -- A happens before B, and
1415 -- there is no other side effect X to M such that A happens before X and X happens
1416 before B.
1417 The value of a non-atomic scalar object M, as determined by evaluation B, shall be the
1418 value stored by the visible side effect A.
1419 20 NOTE 8 If there is ambiguity about which side effect to a non-atomic object is visible, then there is a data
1420 race and the behavior is undefined.
1422 21 NOTE 9 This states that operations on ordinary variables are not visibly reordered. This is not actually
1423 detectable without data races, but it is necessary to ensure that data races, as defined here, and with suitable
1424 restrictions on the use of atomics, correspond to data races in a simple interleaved (sequentially consistent)
1425 execution.
1427 22 The visible sequence of side effects on an atomic object M, with respect to a value
1428 computation B of M, is a maximal contiguous sub-sequence of side effects in the
1429 modification order of M, where the first side effect is visible with respect to B, and for
1430 every subsequent side effect, it is not the case that B happens before it. The value of an
1431 atomic object M, as determined by evaluation B, shall be the value stored by some
1432 operation in the visible sequence of M with respect to B. Furthermore, if a value
1433 computation A of an atomic object M happens before a value computation B of M, and
1434 the value computed by A corresponds to the value stored by side effect X, then the value
1435 computed by B shall either equal the value computed by A, or be the value stored by side
1436 effect Y , where Y follows X in the modification order of M.
1437 23 NOTE 10 This effectively disallows compiler reordering of atomic operations to a single object, even if
1438 both operations are ''relaxed'' loads. By doing so, we effectively make the ''cache coherence'' guarantee
1439 provided by most hardware available to C atomic operations.
1441 24 NOTE 11 The visible sequence depends on the ''happens before'' relation, which in turn depends on the
1442 values observed by loads of atomics, which we are restricting here. The intended reading is that there must
1443 exist an association of atomic loads with modifications they observe that, together with suitably chosen
1444 modification orders and the ''happens before'' relation derived as described above, satisfy the resulting
1445 constraints as imposed here.
1447 25 The execution of a program contains a data race if it contains two conflicting actions in
1448 different threads, at least one of which is not atomic, and neither happens before the
1449 other. Any such data race results in undefined behavior.
1450 26 NOTE 12 It can be shown that programs that correctly use simple mutexes and
1451 memory_order_seq_cst operations to prevent all data races, and use no other synchronization
1452 operations, behave as though the operations executed by their constituent threads were simply interleaved,
1453 with each value computation of an object being the last value stored in that interleaving. This is normally
1454 referred to as ''sequential consistency''. However, this applies only to data-race-free programs, and data-
1455 race-free programs cannot observe most program transformations that do not change single-threaded
1456 program semantics. In fact, most single-threaded program transformations continue to be allowed, since
1457 any program that behaves differently as a result must contain undefined behavior.
1459 [<a name="p20" href="#p20">page 20</a>] (<a href="#Contents">Contents</a>)
1461 27 NOTE 13 Compiler transformations that introduce assignments to a potentially shared memory location
1462 that would not be modified by the abstract machine are generally precluded by this standard, since such an
1463 assignment might overwrite another assignment by a different thread in cases in which an abstract machine
1464 execution would not have encountered a data race. This includes implementations of data member
1465 assignment that overwrite adjacent members in separate memory locations. We also generally preclude
1466 reordering of atomic loads in cases in which the atomics in question may alias, since this may violate the
1467 "visible sequence" rules.
1469 28 NOTE 14 Transformations that introduce a speculative read of a potentially shared memory location may
1470 not preserve the semantics of the program as defined in this standard, since they potentially introduce a data
1471 race. However, they are typically valid in the context of an optimizing compiler that targets a specific
1472 machine with well-defined semantics for data races. They would be invalid for a hypothetical machine that
1473 is not tolerant of races or provides hardware race detection.
1475 [<a name="p21" href="#p21">page 21</a>] (<a href="#Contents">Contents</a>)
1477 <a name="5.2" href="#5.2"><b> 5.2 Environmental considerations</b></a>
1478 <a name="5.2.1" href="#5.2.1"><b> 5.2.1 Character sets</b></a>
1479 1 Two sets of characters and their associated collating sequences shall be defined: the set in
1480 which source files are written (the source character set), and the set interpreted in the
1481 execution environment (the execution character set). Each set is further divided into a
1482 basic character set, whose contents are given by this subclause, and a set of zero or more
1483 locale-specific members (which are not members of the basic character set) called
1484 extended characters. The combined set is also called the extended character set. The
1485 values of the members of the execution character set are implementation-defined.
1486 2 In a character constant or string literal, members of the execution character set shall be
1487 represented by corresponding members of the source character set or by escape
1488 sequences consisting of the backslash \ followed by one or more characters. A byte with
1489 all bits set to 0, called the null character, shall exist in the basic execution character set; it
1490 is used to terminate a character string.
1491 3 Both the basic source and basic execution character sets shall have the following
1492 members: the 26 uppercase letters of the Latin alphabet
1493 A B C D E F G H I J K L M
1494 N O P Q R S T U V W X Y Z
1495 the 26 lowercase letters of the Latin alphabet
1496 a b c d e f g h i j k l m
1497 n o p q r s t u v w x y z
1498 the 10 decimal digits
1499 0 1 2 3 4 5 6 7 8 9
1500 the following 29 graphic characters
1501 ! " # % &amp; ' ( ) * + , - . / :
1502 ; &lt; = &gt; ? [ \ ] ^ _ { | } ~
1503 the space character, and control characters representing horizontal tab, vertical tab, and
1504 form feed. The representation of each member of the source and execution basic
1505 character sets shall fit in a byte. In both the source and execution basic character sets, the
1506 value of each character after 0 in the above list of decimal digits shall be one greater than
1507 the value of the previous. In source files, there shall be some way of indicating the end of
1508 each line of text; this International Standard treats such an end-of-line indicator as if it
1509 were a single new-line character. In the basic execution character set, there shall be
1510 control characters representing alert, backspace, carriage return, and new line. If any
1511 other characters are encountered in a source file (except in an identifier, a character
1512 constant, a string literal, a header name, a comment, or a preprocessing token that is never
1514 [<a name="p22" href="#p22">page 22</a>] (<a href="#Contents">Contents</a>)
1516 converted to a token), the behavior is undefined.
1517 4 A letter is an uppercase letter or a lowercase letter as defined above; in this International
1518 Standard the term does not include other characters that are letters in other alphabets.
1519 5 The universal character name construct provides a way to name other characters.
1520 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>),
1521 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>).
1522 <a name="5.2.1.1" href="#5.2.1.1"><b> 5.2.1.1 Trigraph sequences</b></a>
1523 1 Before any other processing takes place, each occurrence of one of the following
1524 sequences of three characters (called trigraph sequences<sup><a href="#note17"><b>17)</b></a></sup>) is replaced with the
1525 corresponding single character.
1526 ??= # ??) ] ??! |
1527 ??( [ ??' ^ ??&gt; }
1528 ??/ \ ??&lt; { ??- ~
1529 No other trigraph sequences exist. Each ? that does not begin one of the trigraphs listed
1530 above is not changed.
1531 2 EXAMPLE 1
1532 ??=define arraycheck(a, b) a??(b??) ??!??! b??(a??)
1533 becomes
1534 #define arraycheck(a, b) a[b] || b[a]
1536 3 EXAMPLE 2 The following source line
1537 printf("Eh???/n");
1538 becomes (after replacement of the trigraph sequence ??/)
1539 printf("Eh?\n");
1541 <a name="5.2.1.2" href="#5.2.1.2"><b> 5.2.1.2 Multibyte characters</b></a>
1542 1 The source character set may contain multibyte characters, used to represent members of
1543 the extended character set. The execution character set may also contain multibyte
1544 characters, which need not have the same encoding as for the source character set. For
1545 both character sets, the following shall hold:
1546 -- The basic character set shall be present and each character shall be encoded as a
1547 single byte.
1548 -- The presence, meaning, and representation of any additional members is locale-
1549 specific.
1551 <sup><a name="note17" href="#note17"><b>17)</b></a></sup> The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
1552 described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
1554 [<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
1556 -- A multibyte character set may have a state-dependent encoding, wherein each
1557 sequence of multibyte characters begins in an initial shift state and enters other
1558 locale-specific shift states when specific multibyte characters are encountered in the
1559 sequence. While in the initial shift state, all single-byte characters retain their usual
1560 interpretation and do not alter the shift state. The interpretation for subsequent bytes
1561 in the sequence is a function of the current shift state.
1562 -- A byte with all bits zero shall be interpreted as a null character independent of shift
1563 state. Such a byte shall not occur as part of any other multibyte character.
1564 2 For source files, the following shall hold:
1565 -- An identifier, comment, string literal, character constant, or header name shall begin
1566 and end in the initial shift state.
1567 -- An identifier, comment, string literal, character constant, or header name shall consist
1568 of a sequence of valid multibyte characters.
1569 <a name="5.2.2" href="#5.2.2"><b> 5.2.2 Character display semantics</b></a>
1570 1 The active position is that location on a display device where the next character output by
1571 the fputc function would appear. The intent of writing a printing character (as defined
1572 by the isprint function) to a display device is to display a graphic representation of
1573 that character at the active position and then advance the active position to the next
1574 position on the current line. The direction of writing is locale-specific. If the active
1575 position is at the final position of a line (if there is one), the behavior of the display device
1576 is unspecified.
1577 2 Alphabetic escape sequences representing nongraphic characters in the execution
1578 character set are intended to produce actions on display devices as follows:
1579 \a (alert) Produces an audible or visible alert without changing the active position.
1580 \b (backspace) Moves the active position to the previous position on the current line. If
1581 the active position is at the initial position of a line, the behavior of the display
1582 device is unspecified.
1583 \f ( form feed) Moves the active position to the initial position at the start of the next
1584 logical page.
1585 \n (new line) Moves the active position to the initial position of the next line.
1586 \r (carriage return) Moves the active position to the initial position of the current line.
1587 \t (horizontal tab) Moves the active position to the next horizontal tabulation position
1588 on the current line. If the active position is at or past the last defined horizontal
1589 tabulation position, the behavior of the display device is unspecified.
1590 \v (vertical tab) Moves the active position to the initial position of the next vertical
1591 tabulation position. If the active position is at or past the last defined vertical
1593 [<a name="p24" href="#p24">page 24</a>] (<a href="#Contents">Contents</a>)
1595 tabulation position, the behavior of the display device is unspecified.
1596 3 Each of these escape sequences shall produce a unique implementation-defined value
1597 which can be stored in a single char object. The external representations in a text file
1598 need not be identical to the internal representations, and are outside the scope of this
1599 International Standard.
1600 Forward references: the isprint function (<a href="#7.4.1.8">7.4.1.8</a>), the fputc function (<a href="#7.21.7.3">7.21.7.3</a>).
1601 <a name="5.2.3" href="#5.2.3"><b> 5.2.3 Signals and interrupts</b></a>
1602 1 Functions shall be implemented such that they may be interrupted at any time by a signal,
1603 or may be called by a signal handler, or both, with no alteration to earlier, but still active,
1604 invocations' control flow (after the interruption), function return values, or objects with
1605 automatic storage duration. All such objects shall be maintained outside the function
1606 image (the instructions that compose the executable representation of a function) on a
1607 per-invocation basis.
1608 <a name="5.2.4" href="#5.2.4"><b> 5.2.4 Environmental limits</b></a>
1609 1 Both the translation and execution environments constrain the implementation of
1610 language translators and libraries. The following summarizes the language-related
1611 environmental limits on a conforming implementation; the library-related limits are
1612 discussed in clause 7.
1613 <a name="5.2.4.1" href="#5.2.4.1"><b> 5.2.4.1 Translation limits</b></a>
1614 1 The implementation shall be able to translate and execute at least one program that
1615 contains at least one instance of every one of the following limits:<sup><a href="#note18"><b>18)</b></a></sup>
1616 -- 127 nesting levels of blocks
1617 -- 63 nesting levels of conditional inclusion
1618 -- 12 pointer, array, and function declarators (in any combinations) modifying an
1619 arithmetic, structure, union, or void type in a declaration
1620 -- 63 nesting levels of parenthesized declarators within a full declarator
1621 -- 63 nesting levels of parenthesized expressions within a full expression
1622 -- 63 significant initial characters in an internal identifier or a macro name (each
1623 universal character name or extended source character is considered a single
1624 character)
1625 -- 31 significant initial characters in an external identifier (each universal character name
1626 specifying a short identifier of 0000FFFF or less is considered 6 characters, each
1629 <sup><a name="note18" href="#note18"><b>18)</b></a></sup> Implementations should avoid imposing fixed translation limits whenever possible.
1631 [<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
1633 universal character name specifying a short identifier of 00010000 or more is
1634 considered 10 characters, and each extended source character is considered the same
1635 number of characters as the corresponding universal character name, if any)<sup><a href="#note19"><b>19)</b></a></sup>
1636 -- 4095 external identifiers in one translation unit
1637 -- 511 identifiers with block scope declared in one block
1638 -- 4095 macro identifiers simultaneously defined in one preprocessing translation unit
1639 -- 127 parameters in one function definition
1640 -- 127 arguments in one function call
1641 -- 127 parameters in one macro definition
1642 -- 127 arguments in one macro invocation
1643 -- 4095 characters in a logical source line
1644 -- 4095 characters in a string literal (after concatenation)
1645 -- 65535 bytes in an object (in a hosted environment only)
1646 -- 15 nesting levels for #included files
1647 -- 1023 case labels for a switch statement (excluding those for any nested switch
1648 statements)
1649 -- 1023 members in a single structure or union
1650 -- 1023 enumeration constants in a single enumeration
1651 -- 63 levels of nested structure or union definitions in a single struct-declaration-list
1652 <a name="5.2.4.2" href="#5.2.4.2"><b> 5.2.4.2 Numerical limits</b></a>
1653 1 An implementation is required to document all the limits specified in this subclause,
1654 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
1655 specified in <a href="#7.20">&lt;stdint.h&gt;</a>.
1656 Forward references: integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>).
1657 <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>
1658 1 The values given below shall be replaced by constant expressions suitable for use in #if
1659 preprocessing directives. Moreover, except for CHAR_BIT and MB_LEN_MAX, the
1660 following shall be replaced by expressions that have the same type as would an
1661 expression that is an object of the corresponding type converted according to the integer
1662 promotions. Their implementation-defined values shall be equal or greater in magnitude
1665 <sup><a name="note19" href="#note19"><b>19)</b></a></sup> See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
1667 [<a name="p26" href="#p26">page 26</a>] (<a href="#Contents">Contents</a>)
1669 (absolute value) to those shown, with the same sign.
1670 -- number of bits for smallest object that is not a bit-field (byte)
1671 CHAR_BIT 8
1672 -- minimum value for an object of type signed char
1673 SCHAR_MIN -127 // -(27 - 1)
1674 -- maximum value for an object of type signed char
1675 SCHAR_MAX +127 // 27 - 1
1676 -- maximum value for an object of type unsigned char
1677 UCHAR_MAX 255 // 28 - 1
1678 -- minimum value for an object of type char
1679 CHAR_MIN see below
1680 -- maximum value for an object of type char
1681 CHAR_MAX see below
1682 -- maximum number of bytes in a multibyte character, for any supported locale
1683 MB_LEN_MAX 1
1684 -- minimum value for an object of type short int
1685 SHRT_MIN -32767 // -(215 - 1)
1686 -- maximum value for an object of type short int
1687 SHRT_MAX +32767 // 215 - 1
1688 -- maximum value for an object of type unsigned short int
1689 USHRT_MAX 65535 // 216 - 1
1690 -- minimum value for an object of type int
1691 INT_MIN -32767 // -(215 - 1)
1692 -- maximum value for an object of type int
1693 INT_MAX +32767 // 215 - 1
1694 -- maximum value for an object of type unsigned int
1695 UINT_MAX 65535 // 216 - 1
1696 -- minimum value for an object of type long int
1697 LONG_MIN -2147483647 // -(231 - 1)
1698 -- maximum value for an object of type long int
1699 LONG_MAX +2147483647 // 231 - 1
1700 -- maximum value for an object of type unsigned long int
1701 ULONG_MAX 4294967295 // 232 - 1
1703 [<a name="p27" href="#p27">page 27</a>] (<a href="#Contents">Contents</a>)
1705 -- minimum value for an object of type long long int
1706 LLONG_MIN -9223372036854775807 // -(263 - 1)
1707 -- maximum value for an object of type long long int
1708 LLONG_MAX +9223372036854775807 // 263 - 1
1709 -- maximum value for an object of type unsigned long long int
1710 ULLONG_MAX 18446744073709551615 // 264 - 1
1711 2 If the value of an object of type char is treated as a signed integer when used in an
1712 expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
1713 value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
1714 CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
1715 UCHAR_MAX.<sup><a href="#note20"><b>20)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
1716 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>).
1717 <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>
1718 1 The characteristics of floating types are defined in terms of a model that describes a
1719 representation of floating-point numbers and values that provide information about an
1720 implementation's floating-point arithmetic.<sup><a href="#note21"><b>21)</b></a></sup> The following parameters are used to
1721 define the model for each floating-point type:
1722 s sign ((+-)1)
1723 b base or radix of exponent representation (an integer &gt; 1)
1724 e exponent (an integer between a minimum emin and a maximum emax )
1725 p precision (the number of base-b digits in the significand)
1726 fk nonnegative integers less than b (the significand digits)
1727 2 A floating-point number (x) is defined by the following model:
1729 x = sb e (Sum) f k b-k ,
1731 emin &lt;= e &lt;= emax
1733 3 In addition to normalized floating-point numbers ( f 1 &gt; 0 if x != 0), floating types may be
1734 able to contain other kinds of floating-point numbers, such as subnormal floating-point
1735 numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
1736 e &gt; emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
1737 NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
1738 through almost every arithmetic operation without raising a floating-point exception; a
1739 signaling NaN generally raises a floating-point exception when occurring as an
1742 <sup><a name="note20" href="#note20"><b>20)</b></a></sup> See <a href="#6.2.5">6.2.5</a>.
1743 <sup><a name="note21" href="#note21"><b>21)</b></a></sup> The floating-point model is intended to clarify the description of each floating-point characteristic and
1744 does not require the floating-point arithmetic of the implementation to be identical.
1746 [<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
1748 arithmetic operand.<sup><a href="#note22"><b>22)</b></a></sup>
1749 4 An implementation may give zero and values that are not floating-point numbers (such as
1750 infinities and NaNs) a sign or may leave them unsigned. Wherever such values are
1751 unsigned, any requirement in this International Standard to retrieve the sign shall produce
1752 an unspecified sign, and any requirement to set the sign shall be ignored.
1753 5 The minimum range of representable values for a floating type is the most negative finite
1754 floating-point number representable in that type through the most positive finite floating-
1755 point number representable in that type. In addition, if negative infinity is representable
1756 in a type, the range of that type is extended to all negative real numbers; likewise, if
1757 positive infinity is representable in a type, the range of that type is extended to all positive
1758 real numbers.
1759 6 The accuracy of the floating-point operations (+, -, *, /) and of the library functions in
1760 <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-
1761 defined, as is the accuracy of the conversion between floating-point internal
1762 representations and string representations performed by the library functions in
1763 <a href="#7.21">&lt;stdio.h&gt;</a>, <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a>. The implementation may state that the
1764 accuracy is unknown.
1765 7 All integer values in the <a href="#7.7">&lt;float.h&gt;</a> header, except FLT_ROUNDS, shall be constant
1766 expressions suitable for use in #if preprocessing directives; all floating values shall be
1767 constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
1768 and FLT_ROUNDS have separate names for all three floating-point types. The floating-
1769 point model representation is provided for all values except FLT_EVAL_METHOD and
1770 FLT_ROUNDS.
1771 8 The rounding mode for floating-point addition is characterized by the implementation-
1772 defined value of FLT_ROUNDS:<sup><a href="#note23"><b>23)</b></a></sup>
1773 -1 indeterminable
1774 0 toward zero
1775 1 to nearest
1776 2 toward positive infinity
1777 3 toward negative infinity
1778 All other values for FLT_ROUNDS characterize implementation-defined rounding
1779 behavior.
1782 <sup><a name="note22" href="#note22"><b>22)</b></a></sup> IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support
1783 IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with
1784 similar behavior.
1785 <sup><a name="note23" href="#note23"><b>23)</b></a></sup> Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
1786 the function fesetround in <a href="#7.6">&lt;fenv.h&gt;</a>.
1788 [<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
1790 9 Except for assignment and cast (which remove all extra range and precision), the values
1791 yielded by operators with floating operands and values subject to the usual arithmetic
1792 conversions and of floating constants are evaluated to a format whose range and precision
1793 may be greater than required by the type. The use of evaluation formats is characterized
1794 by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note24"><b>24)</b></a></sup>
1795 -1 indeterminable;
1796 0 evaluate all operations and constants just to the range and precision of the
1797 type;
1798 1 evaluate operations and constants of type float and double to the
1799 range and precision of the double type, evaluate long double
1800 operations and constants to the range and precision of the long double
1801 type;
1802 2 evaluate all operations and constants to the range and precision of the
1803 long double type.
1804 All other negative values for FLT_EVAL_METHOD characterize implementation-defined
1805 behavior.
1806 10 The presence or absence of subnormal numbers is characterized by the implementation-
1807 defined values of FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, and
1808 LDBL_HAS_SUBNORM:
1809 -1 indeterminable<sup><a href="#note25"><b>25)</b></a></sup>
1810 0 absent<sup><a href="#note26"><b>26)</b></a></sup> (type does not support subnormal numbers)
1811 1 present (type does support subnormal numbers)
1812 11 The values given in the following list shall be replaced by constant expressions with
1813 implementation-defined values that are greater or equal in magnitude (absolute value) to
1814 those shown, with the same sign:
1815 -- radix of exponent representation, b
1816 FLT_RADIX 2
1821 <sup><a name="note24" href="#note24"><b>24)</b></a></sup> The evaluation method determines evaluation formats of expressions involving all floating types, not
1822 just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
1823 _Complex operands is represented in the double _Complex format, and its parts are evaluated to
1824 double.
1825 <sup><a name="note25" href="#note25"><b>25)</b></a></sup> Characterization as indeterminable is intended if floating-point operations do not consistently interpret
1826 subnormal representations as zero, nor as nonzero.
1827 <sup><a name="note26" href="#note26"><b>26)</b></a></sup> Characterization as absent is intended if no floating-point operations produce subnormal results from
1828 non-subnormal inputs, even if the type format includes representations of subnormal numbers.
1830 [<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
1832 -- number of base-FLT_RADIX digits in the floating-point significand, p
1833 FLT_MANT_DIG
1834 DBL_MANT_DIG
1835 LDBL_MANT_DIG
1836 -- number of decimal digits, n, such that any floating-point number with p radix b digits
1837 can be rounded to a floating-point number with n decimal digits and back again
1838 without change to the value,
1839 { p log10 b if b is a power of 10
1841 { [^1 + p log10 b^] otherwise
1842 FLT_DECIMAL_DIG 6
1843 DBL_DECIMAL_DIG 10
1844 LDBL_DECIMAL_DIG 10
1845 -- number of decimal digits, n, such that any floating-point number in the widest
1846 supported floating type with pmax radix b digits can be rounded to a floating-point
1847 number with n decimal digits and back again without change to the value,
1848 { pmax log10 b if b is a power of 10
1850 { [^1 + pmax log10 b^] otherwise
1851 DECIMAL_DIG 10
1852 -- number of decimal digits, q, such that any floating-point number with q decimal digits
1853 can be rounded into a floating-point number with p radix b digits and back again
1854 without change to the q decimal digits,
1855 { p log10 b if b is a power of 10
1857 { [_( p - 1) log10 b_] otherwise
1858 FLT_DIG 6
1859 DBL_DIG 10
1860 LDBL_DIG 10
1861 -- minimum negative integer such that FLT_RADIX raised to one less than that power is
1862 a normalized floating-point number, emin
1863 FLT_MIN_EXP
1864 DBL_MIN_EXP
1865 LDBL_MIN_EXP
1867 [<a name="p31" href="#p31">page 31</a>] (<a href="#Contents">Contents</a>)
1869 -- minimum negative integer such that 10 raised to that power is in the range of
1870 normalized floating-point numbers, [^log10 b emin -1 ^]
1872 FLT_MIN_10_EXP -37
1873 DBL_MIN_10_EXP -37
1874 LDBL_MIN_10_EXP -37
1875 -- maximum integer such that FLT_RADIX raised to one less than that power is a
1876 representable finite floating-point number, emax
1877 FLT_MAX_EXP
1878 DBL_MAX_EXP
1879 LDBL_MAX_EXP
1880 -- maximum integer such that 10 raised to that power is in the range of representable
1881 finite floating-point numbers, [_log10 ((1 - b- p )b emax )_]
1882 FLT_MAX_10_EXP +37
1883 DBL_MAX_10_EXP +37
1884 LDBL_MAX_10_EXP +37
1885 12 The values given in the following list shall be replaced by constant expressions with
1886 implementation-defined values that are greater than or equal to those shown:
1887 -- maximum representable finite floating-point number, (1 - b- p )b emax
1888 FLT_MAX 1E+37
1889 DBL_MAX 1E+37
1890 LDBL_MAX 1E+37
1891 13 The values given in the following list shall be replaced by constant expressions with
1892 implementation-defined (positive) values that are less than or equal to those shown:
1893 -- the difference between 1 and the least value greater than 1 that is representable in the
1894 given floating point type, b1- p
1895 FLT_EPSILON 1E-5
1896 DBL_EPSILON 1E-9
1897 LDBL_EPSILON 1E-9
1898 -- minimum normalized positive floating-point number, b emin -1
1899 FLT_MIN 1E-37
1900 DBL_MIN 1E-37
1901 LDBL_MIN 1E-37
1903 [<a name="p32" href="#p32">page 32</a>] (<a href="#Contents">Contents</a>)
1905 -- minimum positive floating-point number<sup><a href="#note27"><b>27)</b></a></sup>
1906 FLT_TRUE_MIN 1E-37
1907 DBL_TRUE_MIN 1E-37
1908 LDBL_TRUE_MIN 1E-37
1909 Recommended practice
1910 14 Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
1911 should be the identity function.
1912 15 EXAMPLE 1 The following describes an artificial floating-point representation that meets the minimum
1913 requirements of this International Standard, and the appropriate values in a <a href="#7.7">&lt;float.h&gt;</a> header for type
1914 float:
1916 x = s16e (Sum) f k 16-k ,
1918 -31 &lt;= e &lt;= +32
1920 FLT_RADIX 16
1921 FLT_MANT_DIG 6
1922 FLT_EPSILON 9.53674316E-07F
1923 FLT_DECIMAL_DIG 9
1924 FLT_DIG 6
1925 FLT_MIN_EXP -31
1926 FLT_MIN 2.93873588E-39F
1927 FLT_MIN_10_EXP -38
1928 FLT_MAX_EXP +32
1929 FLT_MAX 3.40282347E+38F
1930 FLT_MAX_10_EXP +38
1932 16 EXAMPLE 2 The following describes floating-point representations that also meet the requirements for
1933 single-precision and double-precision numbers in IEC 60559,<sup><a href="#note28"><b>28)</b></a></sup> and the appropriate values in a
1934 <a href="#7.7">&lt;float.h&gt;</a> header for types float and double:
1936 x f = s2e (Sum) f k 2-k ,
1938 -125 &lt;= e &lt;= +128
1941 x d = s2e (Sum) f k 2-k ,
1943 -1021 &lt;= e &lt;= +1024
1945 FLT_RADIX 2
1946 DECIMAL_DIG 17
1947 FLT_MANT_DIG 24
1948 FLT_EPSILON 1.19209290E-07F // decimal constant
1949 FLT_EPSILON 0X1P-23F // hex constant
1950 FLT_DECIMAL_DIG 9
1953 <sup><a name="note27" href="#note27"><b>27)</b></a></sup> If the presence or absence of subnormal numbers is indeterminable, then the value is intended to be a
1954 positive number no greater than the minimum normalized positive number for the type.
1955 <sup><a name="note28" href="#note28"><b>28)</b></a></sup> The floating-point model in that standard sums powers of b from zero, so the values of the exponent
1956 limits are one less than shown here.
1958 [<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
1960 FLT_DIG 6
1961 FLT_MIN_EXP -125
1962 FLT_MIN 1.17549435E-38F // decimal constant
1963 FLT_MIN 0X1P-126F // hex constant
1964 FLT_TRUE_MIN 1.40129846E-45F // decimal constant
1965 FLT_TRUE_MIN 0X1P-149F // hex constant
1966 FLT_HAS_SUBNORM 1
1967 FLT_MIN_10_EXP -37
1968 FLT_MAX_EXP +128
1969 FLT_MAX 3.40282347E+38F // decimal constant
1970 FLT_MAX 0X1.fffffeP127F // hex constant
1971 FLT_MAX_10_EXP +38
1972 DBL_MANT_DIG 53
1973 DBL_EPSILON 2.2204460492503131E-16 // decimal constant
1974 DBL_EPSILON 0X1P-52 // hex constant
1975 DBL_DECIMAL_DIG 17
1976 DBL_DIG 15
1977 DBL_MIN_EXP -1021
1978 DBL_MIN 2.2250738585072014E-308 // decimal constant
1979 DBL_MIN 0X1P-1022 // hex constant
1980 DBL_TRUE_MIN 4.9406564584124654E-324 // decimal constant
1981 DBL_TRUE_MIN 0X1P-1074 // hex constant
1982 DBL_HAS_SUBNORM 1
1983 DBL_MIN_10_EXP -307
1984 DBL_MAX_EXP +1024
1985 DBL_MAX 1.7976931348623157E+308 // decimal constant
1986 DBL_MAX 0X1.fffffffffffffP1023 // hex constant
1987 DBL_MAX_10_EXP +308
1988 If a type wider than double were supported, then DECIMAL_DIG would be greater than 17. For
1989 example, if the widest type were to use the minimal-width IEC 60559 double-extended format (64 bits of
1990 precision), then DECIMAL_DIG would be 21.
1992 Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), complex arithmetic
1993 <a href="#7.3">&lt;complex.h&gt;</a> (<a href="#7.3">7.3</a>), extended multibyte and wide character utilities <a href="#7.29">&lt;wchar.h&gt;</a>
1994 (<a href="#7.29">7.29</a>), floating-point environment <a href="#7.6">&lt;fenv.h&gt;</a> (<a href="#7.6">7.6</a>), general utilities <a href="#7.22">&lt;stdlib.h&gt;</a>
1995 (<a href="#7.22">7.22</a>), input/output <a href="#7.21">&lt;stdio.h&gt;</a> (<a href="#7.21">7.21</a>), mathematics <a href="#7.12">&lt;math.h&gt;</a> (<a href="#7.12">7.12</a>).
1997 [<a name="p34" href="#p34">page 34</a>] (<a href="#Contents">Contents</a>)
2000 <a name="6" href="#6"><b> 6. Language</b></a>
2001 <a name="6.1" href="#6.1"><b> 6.1 Notation</b></a>
2002 1 In the syntax notation used in this clause, syntactic categories (nonterminals) are
2003 indicated by italic type, and literal words and character set members (terminals) by bold
2004 type. A colon (:) following a nonterminal introduces its definition. Alternative
2005 definitions are listed on separate lines, except when prefaced by the words ''one of''. An
2006 optional symbol is indicated by the subscript ''opt'', so that
2007 { expressionopt }
2008 indicates an optional expression enclosed in braces.
2009 2 When syntactic categories are referred to in the main text, they are not italicized and
2010 words are separated by spaces instead of hyphens.
2011 3 A summary of the language syntax is given in <a href="#A">annex A</a>.
2012 <a name="6.2" href="#6.2"><b> 6.2 Concepts</b></a>
2013 <a name="6.2.1" href="#6.2.1"><b> 6.2.1 Scopes of identifiers</b></a>
2014 1 An identifier can denote an object; a function; a tag or a member of a structure, union, or
2015 enumeration; a typedef name; a label name; a macro name; or a macro parameter. The
2016 same identifier can denote different entities at different points in the program. A member
2017 of an enumeration is called an enumeration constant. Macro names and macro
2018 parameters are not considered further here, because prior to the semantic phase of
2019 program translation any occurrences of macro names in the source file are replaced by the
2020 preprocessing token sequences that constitute their macro definitions.
2021 2 For each different entity that an identifier designates, the identifier is visible (i.e., can be
2022 used) only within a region of program text called its scope. Different entities designated
2023 by the same identifier either have different scopes, or are in different name spaces. There
2024 are four kinds of scopes: function, file, block, and function prototype. (A function
2025 prototype is a declaration of a function that declares the types of its parameters.)
2026 3 A label name is the only kind of identifier that has function scope. It can be used (in a
2027 goto statement) anywhere in the function in which it appears, and is declared implicitly
2028 by its syntactic appearance (followed by a : and a statement).
2029 4 Every other identifier has scope determined by the placement of its declaration (in a
2030 declarator or type specifier). If the declarator or type specifier that declares the identifier
2031 appears outside of any block or list of parameters, the identifier has file scope, which
2032 terminates at the end of the translation unit. If the declarator or type specifier that
2033 declares the identifier appears inside a block or within the list of parameter declarations in
2034 a function definition, the identifier has block scope, which terminates at the end of the
2035 associated block. If the declarator or type specifier that declares the identifier appears
2037 [<a name="p35" href="#p35">page 35</a>] (<a href="#Contents">Contents</a>)
2039 within the list of parameter declarations in a function prototype (not part of a function
2040 definition), the identifier has function prototype scope, which terminates at the end of the
2041 function declarator. If an identifier designates two different entities in the same name
2042 space, the scopes might overlap. If so, the scope of one entity (the inner scope) will end
2043 strictly before the scope of the other entity (the outer scope). Within the inner scope, the
2044 identifier designates the entity declared in the inner scope; the entity declared in the outer
2045 scope is hidden (and not visible) within the inner scope.
2046 5 Unless explicitly stated otherwise, where this International Standard uses the term
2047 ''identifier'' to refer to some entity (as opposed to the syntactic construct), it refers to the
2048 entity in the relevant name space whose declaration is visible at the point the identifier
2049 occurs.
2050 6 Two identifiers have the same scope if and only if their scopes terminate at the same
2051 point.
2052 7 Structure, union, and enumeration tags have scope that begins just after the appearance of
2053 the tag in a type specifier that declares the tag. Each enumeration constant has scope that
2054 begins just after the appearance of its defining enumerator in an enumerator list. Any
2055 other identifier has scope that begins just after the completion of its declarator.
2056 8 As a special case, a type name (which is not a declaration of an identifier) is considered to
2057 have a scope that begins just after the place within the type name where the omitted
2058 identifier would appear were it not omitted.
2059 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
2060 (<a href="#6.9.1">6.9.1</a>), identifiers (<a href="#6.4.2">6.4.2</a>), macro replacement (<a href="#6.10.3">6.10.3</a>), name spaces of identifiers (<a href="#6.2.3">6.2.3</a>),
2061 source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
2062 <a name="6.2.2" href="#6.2.2"><b> 6.2.2 Linkages of identifiers</b></a>
2063 1 An identifier declared in different scopes or in the same scope more than once can be
2064 made to refer to the same object or function by a process called linkage.<sup><a href="#note29"><b>29)</b></a></sup> There are
2065 three kinds of linkage: external, internal, and none.
2066 2 In the set of translation units and libraries that constitutes an entire program, each
2067 declaration of a particular identifier with external linkage denotes the same object or
2068 function. Within one translation unit, each declaration of an identifier with internal
2069 linkage denotes the same object or function. Each declaration of an identifier with no
2070 linkage denotes a unique entity.
2071 3 If the declaration of a file scope identifier for an object or a function contains the storage-
2072 class specifier static, the identifier has internal linkage.<sup><a href="#note30"><b>30)</b></a></sup>
2076 <sup><a name="note29" href="#note29"><b>29)</b></a></sup> There is no linkage between different identifiers.
2078 [<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
2080 4 For an identifier declared with the storage-class specifier extern in a scope in which a
2081 prior declaration of that identifier is visible,<sup><a href="#note31"><b>31)</b></a></sup> if the prior declaration specifies internal or
2082 external linkage, the linkage of the identifier at the later declaration is the same as the
2083 linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
2084 declaration specifies no linkage, then the identifier has external linkage.
2085 5 If the declaration of an identifier for a function has no storage-class specifier, its linkage
2086 is determined exactly as if it were declared with the storage-class specifier extern. If
2087 the declaration of an identifier for an object has file scope and no storage-class specifier,
2088 its linkage is external.
2089 6 The following identifiers have no linkage: an identifier declared to be anything other than
2090 an object or a function; an identifier declared to be a function parameter; a block scope
2091 identifier for an object declared without the storage-class specifier extern.
2092 7 If, within a translation unit, the same identifier appears with both internal and external
2093 linkage, the behavior is undefined.
2094 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>),
2095 statements (<a href="#6.8">6.8</a>).
2096 <a name="6.2.3" href="#6.2.3"><b> 6.2.3 Name spaces of identifiers</b></a>
2097 1 If more than one declaration of a particular identifier is visible at any point in a
2098 translation unit, the syntactic context disambiguates uses that refer to different entities.
2099 Thus, there are separate name spaces for various categories of identifiers, as follows:
2100 -- label names (disambiguated by the syntax of the label declaration and use);
2101 -- the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note32"><b>32)</b></a></sup>
2102 of the keywords struct, union, or enum);
2103 -- the members of structures or unions; each structure or union has a separate name
2104 space for its members (disambiguated by the type of the expression used to access the
2105 member via the . or -&gt; operator);
2106 -- all other identifiers, called ordinary identifiers (declared in ordinary declarators or as
2107 enumeration constants).
2108 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>),
2109 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
2110 (<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>).
2112 <sup><a name="note30" href="#note30"><b>30)</b></a></sup> A function declaration can contain the storage-class specifier static only if it is at file scope; see
2113 <a href="#6.7.1">6.7.1</a>.
2114 <sup><a name="note31" href="#note31"><b>31)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2115 <sup><a name="note32" href="#note32"><b>32)</b></a></sup> There is only one name space for tags even though three are possible.
2117 [<a name="p37" href="#p37">page 37</a>] (<a href="#Contents">Contents</a>)
2119 <a name="6.2.4" href="#6.2.4"><b> 6.2.4 Storage durations of objects</b></a>
2120 1 An object has a storage duration that determines its lifetime. There are four storage
2121 durations: static, thread, automatic, and allocated. Allocated storage is described in
2122 <a href="#7.22.3">7.22.3</a>.
2123 2 The lifetime of an object is the portion of program execution during which storage is
2124 guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note33"><b>33)</b></a></sup> and retains
2125 its last-stored value throughout its lifetime.<sup><a href="#note34"><b>34)</b></a></sup> If an object is referred to outside of its
2126 lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
2127 the object it points to (or just past) reaches the end of its lifetime.
2128 3 An object whose identifier is declared without the storage-class specifier
2129 _Thread_local, and either with external or internal linkage or with the storage-class
2130 specifier static, has static storage duration. Its lifetime is the entire execution of the
2131 program and its stored value is initialized only once, prior to program startup.
2132 4 An object whose identifier is declared with the storage-class specifier _Thread_local
2133 has thread storage duration. Its lifetime is the entire execution of the thread for which it
2134 is created, and its stored value is initialized when the thread is started. There is a distinct
2135 object per thread, and use of the declared name in an expression refers to the object
2136 associated with the thread evaluating the expression. The result of attempting to
2137 indirectly access an object with thread storage duration from a thread other than the one
2138 with which the object is associated is implementation-defined.
2139 5 An object whose identifier is declared with no linkage and without the storage-class
2140 specifier static has automatic storage duration, as do some compound literals. The
2141 result of attempting to indirectly access an object with automatic storage duration from a
2142 thread other than the one with which the object is associated is implementation-defined.
2143 6 For such an object that does not have a variable length array type, its lifetime extends
2144 from entry into the block with which it is associated until execution of that block ends in
2145 any way. (Entering an enclosed block or calling a function suspends, but does not end,
2146 execution of the current block.) If the block is entered recursively, a new instance of the
2147 object is created each time. The initial value of the object is indeterminate. If an
2148 initialization is specified for the object, it is performed each time the declaration or
2149 compound literal is reached in the execution of the block; otherwise, the value becomes
2150 indeterminate each time the declaration is reached.
2154 <sup><a name="note33" href="#note33"><b>33)</b></a></sup> The term ''constant address'' means that two pointers to the object constructed at possibly different
2155 times will compare equal. The address may be different during two different executions of the same
2156 program.
2157 <sup><a name="note34" href="#note34"><b>34)</b></a></sup> In the case of a volatile object, the last store need not be explicit in the program.
2159 [<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
2161 7 For such an object that does have a variable length array type, its lifetime extends from
2162 the declaration of the object until execution of the program leaves the scope of the
2163 declaration.<sup><a href="#note35"><b>35)</b></a></sup> If the scope is entered recursively, a new instance of the object is created
2164 each time. The initial value of the object is indeterminate.
2165 8 A non-lvalue expression with structure or union type, where the structure or union
2166 contains a member with array type (including, recursively, members of all contained
2167 structures and unions) refers to an object with automatic storage duration and temporary
2168 lifetime.<sup><a href="#note36"><b>36)</b></a></sup> Its lifetime begins when the expression is evaluated and its initial value is the
2169 value of the expression. Its lifetime ends when the evaluation of the containing full
2170 expression or full declarator ends. Any attempt to modify an object with temporary
2171 lifetime results in undefined behavior.
2172 Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), compound literals (<a href="#6.5.2.5">6.5.2.5</a>), declarators
2173 (<a href="#6.7.6">6.7.6</a>), function calls (<a href="#6.5.2.2">6.5.2.2</a>), initialization (<a href="#6.7.9">6.7.9</a>), statements (<a href="#6.8">6.8</a>).
2174 <a name="6.2.5" href="#6.2.5"><b> 6.2.5 Types</b></a>
2175 1 The meaning of a value stored in an object or returned by a function is determined by the
2176 type of the expression used to access it. (An identifier declared to be an object is the
2177 simplest such expression; the type is specified in the declaration of the identifier.) Types
2178 are partitioned into object types (types that describe objects) and function types (types
2179 that describe functions). At various points within a translation unit an object type may be
2180 incomplete (lacking sufficient information to determine the size of objects of that type) or
2181 complete (having sufficient information).<sup><a href="#note37"><b>37)</b></a></sup>
2182 2 An object declared as type _Bool is large enough to store the values 0 and 1.
2183 3 An object declared as type char is large enough to store any member of the basic
2184 execution character set. If a member of the basic execution character set is stored in a
2185 char object, its value is guaranteed to be nonnegative. If any other character is stored in
2186 a char object, the resulting value is implementation-defined but shall be within the range
2187 of values that can be represented in that type.
2188 4 There are five standard signed integer types, designated as signed char, short
2189 int, int, long int, and long long int. (These and other types may be
2190 designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
2191 implementation-defined extended signed integer types.<sup><a href="#note38"><b>38)</b></a></sup> The standard and extended
2192 signed integer types are collectively called signed integer types.<sup><a href="#note39"><b>39)</b></a></sup>
2194 <sup><a name="note35" href="#note35"><b>35)</b></a></sup> Leaving the innermost block containing the declaration, or jumping to a point in that block or an
2195 embedded block prior to the declaration, leaves the scope of the declaration.
2196 <sup><a name="note36" href="#note36"><b>36)</b></a></sup> The address of such an object is taken implicitly when an array member is accessed.
2197 <sup><a name="note37" href="#note37"><b>37)</b></a></sup> A type may be incomplete or complete throughout an entire translation unit, or it may change states at
2198 different points within a translation unit.
2200 [<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
2202 5 An object declared as type signed char occupies the same amount of storage as a
2203 ''plain'' char object. A ''plain'' int object has the natural size suggested by the
2204 architecture of the execution environment (large enough to contain any value in the range
2205 INT_MIN to INT_MAX as defined in the header <a href="#7.10">&lt;limits.h&gt;</a>).
2206 6 For each of the signed integer types, there is a corresponding (but different) unsigned
2207 integer type (designated with the keyword unsigned) that uses the same amount of
2208 storage (including sign information) and has the same alignment requirements. The type
2209 _Bool and the unsigned integer types that correspond to the standard signed integer
2210 types are the standard unsigned integer types. The unsigned integer types that
2211 correspond to the extended signed integer types are the extended unsigned integer types.
2212 The standard and extended unsigned integer types are collectively called unsigned integer
2213 types.<sup><a href="#note40"><b>40)</b></a></sup>
2214 7 The standard signed integer types and standard unsigned integer types are collectively
2215 called the standard integer types, the extended signed integer types and extended
2216 unsigned integer types are collectively called the extended integer types.
2217 8 For any two integer types with the same signedness and different integer conversion rank
2218 (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
2219 subrange of the values of the other type.
2220 9 The range of nonnegative values of a signed integer type is a subrange of the
2221 corresponding unsigned integer type, and the representation of the same value in each
2222 type is the same.<sup><a href="#note41"><b>41)</b></a></sup> A computation involving unsigned operands can never overflow,
2223 because a result that cannot be represented by the resulting unsigned integer type is
2224 reduced modulo the number that is one greater than the largest value that can be
2225 represented by the resulting type.
2226 10 There are three real floating types, designated as float, double, and long
2227 double.<sup><a href="#note42"><b>42)</b></a></sup> The set of values of the type float is a subset of the set of values of the
2228 type double; the set of values of the type double is a subset of the set of values of the
2229 type long double.
2232 <sup><a name="note38" href="#note38"><b>38)</b></a></sup> Implementation-defined keywords shall have the form of an identifier reserved for any use as
2233 described in <a href="#7.1.3">7.1.3</a>.
2234 <sup><a name="note39" href="#note39"><b>39)</b></a></sup> Therefore, any statement in this Standard about signed integer types also applies to the extended
2235 signed integer types.
2236 <sup><a name="note40" href="#note40"><b>40)</b></a></sup> Therefore, any statement in this Standard about unsigned integer types also applies to the extended
2237 unsigned integer types.
2238 <sup><a name="note41" href="#note41"><b>41)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
2239 arguments to functions, return values from functions, and members of unions.
2240 <sup><a name="note42" href="#note42"><b>42)</b></a></sup> See ''future language directions'' (<a href="#6.11.1">6.11.1</a>).
2242 [<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
2244 11 There are three complex types, designated as float _Complex, double
2245 _Complex, and long double _Complex.<sup><a href="#note43"><b>43)</b></a></sup> (Complex types are a conditional
2246 feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.) The real floating and
2247 complex types are collectively called the floating types.
2248 12 For each floating type there is a corresponding real type, which is always a real floating
2249 type. For real floating types, it is the same type. For complex types, it is the type given
2250 by deleting the keyword _Complex from the type name.
2251 13 Each complex type has the same representation and alignment requirements as an array
2252 type containing exactly two elements of the corresponding real type; the first element is
2253 equal to the real part, and the second element to the imaginary part, of the complex
2254 number.
2255 14 The type char, the signed and unsigned integer types, and the floating types are
2256 collectively called the basic types. The basic types are complete object types. Even if the
2257 implementation defines two or more basic types to have the same representation, they are
2258 nevertheless different types.<sup><a href="#note44"><b>44)</b></a></sup>
2259 15 The three types char, signed char, and unsigned char are collectively called
2260 the character types. The implementation shall define char to have the same range,
2261 representation, and behavior as either signed char or unsigned char.<sup><a href="#note45"><b>45)</b></a></sup>
2262 16 An enumeration comprises a set of named integer constant values. Each distinct
2263 enumeration constitutes a different enumerated type.
2264 17 The type char, the signed and unsigned integer types, and the enumerated types are
2265 collectively called integer types. The integer and real floating types are collectively called
2266 real types.
2267 18 Integer and floating types are collectively called arithmetic types. Each arithmetic type
2268 belongs to one type domain: the real type domain comprises the real types, the complex
2269 type domain comprises the complex types.
2270 19 The void type comprises an empty set of values; it is an incomplete object type that
2271 cannot be completed.
2275 <sup><a name="note43" href="#note43"><b>43)</b></a></sup> A specification for imaginary types is in <a href="#G">annex G</a>.
2276 <sup><a name="note44" href="#note44"><b>44)</b></a></sup> An implementation may define new keywords that provide alternative ways to designate a basic (or
2277 any other) type; this does not violate the requirement that all basic types be different.
2278 Implementation-defined keywords shall have the form of an identifier reserved for any use as
2279 described in <a href="#7.1.3">7.1.3</a>.
2280 <sup><a name="note45" href="#note45"><b>45)</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
2281 used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
2282 other two and is not compatible with either.
2284 [<a name="p41" href="#p41">page 41</a>] (<a href="#Contents">Contents</a>)
2286 20 Any number of derived types can be constructed from the object and function types, as
2287 follows:
2288 -- An array type describes a contiguously allocated nonempty set of objects with a
2289 particular member object type, called the element type. The element type shall be
2290 complete whenever the array type is specified. Array types are characterized by their
2291 element type and by the number of elements in the array. An array type is said to be
2292 derived from its element type, and if its element type is T , the array type is sometimes
2293 called ''array of T ''. The construction of an array type from an element type is called
2294 ''array type derivation''.
2295 -- A structure type describes a sequentially allocated nonempty set of member objects
2296 (and, in certain circumstances, an incomplete array), each of which has an optionally
2297 specified name and possibly distinct type.
2298 -- A union type describes an overlapping nonempty set of member objects, each of
2299 which has an optionally specified name and possibly distinct type.
2300 -- A function type describes a function with specified return type. A function type is
2301 characterized by its return type and the number and types of its parameters. A
2302 function type is said to be derived from its return type, and if its return type is T , the
2303 function type is sometimes called ''function returning T ''. The construction of a
2304 function type from a return type is called ''function type derivation''.
2305 -- A pointer type may be derived from a function type or an object type, called the
2306 referenced type. A pointer type describes an object whose value provides a reference
2307 to an entity of the referenced type. A pointer type derived from the referenced type T
2308 is sometimes called ''pointer to T ''. The construction of a pointer type from a
2309 referenced type is called ''pointer type derivation''. A pointer type is a complete
2310 object type.
2311 -- An atomic type describes the type designated by the construct _Atomic ( type-
2312 name ). (Atomic types are a conditional feature that implementations need not
2313 support; see <a href="#6.10.8.3">6.10.8.3</a>.)
2314 These methods of constructing derived types can be applied recursively.
2315 21 Arithmetic types and pointer types are collectively called scalar types. Array and
2316 structure types are collectively called aggregate types.<sup><a href="#note46"><b>46)</b></a></sup>
2317 22 An array type of unknown size is an incomplete type. It is completed, for an identifier of
2318 that type, by specifying the size in a later declaration (with internal or external linkage).
2319 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
2322 <sup><a name="note46" href="#note46"><b>46)</b></a></sup> Note that aggregate type does not include union type because an object with union type can only
2323 contain one member at a time.
2325 [<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
2327 type. It is completed, for all declarations of that type, by declaring the same structure or
2328 union tag with its defining content later in the same scope.
2329 23 A type has known constant size if the type is not incomplete and is not a variable length
2330 array type.
2331 24 Array, function, and pointer types are collectively called derived declarator types. A
2332 declarator type derivation from a type T is the construction of a derived declarator type
2333 from T by the application of an array-type, a function-type, or a pointer-type derivation to
2335 25 A type is characterized by its type category, which is either the outermost derivation of a
2336 derived type (as noted above in the construction of derived types), or the type itself if the
2337 type consists of no derived types.
2338 26 Any type so far mentioned is an unqualified type. Each unqualified type has several
2339 qualified versions of its type,<sup><a href="#note47"><b>47)</b></a></sup> corresponding to the combinations of one, two, or all
2340 three of the const, volatile, and restrict qualifiers. The qualified or unqualified
2341 versions of a type are distinct types that belong to the same type category and have the
2342 same representation and alignment requirements.<sup><a href="#note48"><b>48)</b></a></sup> A derived type is not qualified by the
2343 qualifiers (if any) of the type from which it is derived.
2344 27 Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier
2345 designates an atomic type. The size, representation, and alignment of an atomic type
2346 need not be the same as those of the corresponding unqualified type. Therefore, this
2347 Standard explicitly uses the phrase ''atomic, qualified or unqualified type'' whenever the
2348 atomic version of a type is permitted along with the other qualified versions of a type.
2349 The phrase ''qualified or unqualified type'', without specific mention of atomic, does not
2350 include the atomic types.
2351 28 A pointer to void shall have the same representation and alignment requirements as a
2352 pointer to a character type.48) Similarly, pointers to qualified or unqualified versions of
2353 compatible types shall have the same representation and alignment requirements. All
2354 pointers to structure types shall have the same representation and alignment requirements
2355 as each other. All pointers to union types shall have the same representation and
2356 alignment requirements as each other. Pointers to other types need not have the same
2357 representation or alignment requirements.
2358 29 EXAMPLE 1 The type designated as ''float *'' has type ''pointer to float''. Its type category is
2359 pointer, not a floating type. The const-qualified version of this type is designated as ''float * const''
2360 whereas the type designated as ''const float *'' is not a qualified type -- its type is ''pointer to const-
2363 <sup><a name="note47" href="#note47"><b>47)</b></a></sup> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
2364 <sup><a name="note48" href="#note48"><b>48)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
2365 arguments to functions, return values from functions, and members of unions.
2367 [<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
2369 qualified float'' and is a pointer to a qualified type.
2371 30 EXAMPLE 2 The type designated as ''struct tag (*[5])(float)'' has type ''array of pointer to
2372 function returning struct tag''. The array has length five and the function has a single parameter of type
2373 float. Its type category is array.
2375 Forward references: compatible type and composite type (<a href="#6.2.7">6.2.7</a>), declarations (<a href="#6.7">6.7</a>).
2376 <a name="6.2.6" href="#6.2.6"><b> 6.2.6 Representations of types</b></a>
2377 <a name="6.2.6.1" href="#6.2.6.1"><b> 6.2.6.1 General</b></a>
2378 1 The representations of all types are unspecified except as stated in this subclause.
2379 2 Except for bit-fields, objects are composed of contiguous sequences of one or more bytes,
2380 the number, order, and encoding of which are either explicitly specified or
2381 implementation-defined.
2382 3 Values stored in unsigned bit-fields and objects of type unsigned char shall be
2383 represented using a pure binary notation.<sup><a href="#note49"><b>49)</b></a></sup>
2384 4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
2385 bits, where n is the size of an object of that type, in bytes. The value may be copied into
2386 an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
2387 called the object representation of the value. Values stored in bit-fields consist of m bits,
2388 where m is the size specified for the bit-field. The object representation is the set of m
2389 bits the bit-field comprises in the addressable storage unit holding it. Two values (other
2390 than NaNs) with the same object representation compare equal, but values that compare
2391 equal may have different object representations.
2392 5 Certain object representations need not represent a value of the object type. If the stored
2393 value of an object has such a representation and is read by an lvalue expression that does
2394 not have character type, the behavior is undefined. If such a representation is produced
2395 by a side effect that modifies all or any part of the object by an lvalue expression that
2396 does not have character type, the behavior is undefined.<sup><a href="#note50"><b>50)</b></a></sup> Such a representation is called
2397 a trap representation.
2398 6 When a value is stored in an object of structure or union type, including in a member
2399 object, the bytes of the object representation that correspond to any padding bytes take
2400 unspecified values.<sup><a href="#note51"><b>51)</b></a></sup> The value of a structure or union object is never a trap
2403 <sup><a name="note49" href="#note49"><b>49)</b></a></sup> A positional representation for integers that uses the binary digits 0 and 1, in which the values
2404 represented by successive bits are additive, begin with 1, and are multiplied by successive integral
2405 powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
2406 Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
2407 type unsigned char range from 0 to 2
2408 CHAR_BIT
2409 - 1.
2410 <sup><a name="note50" href="#note50"><b>50)</b></a></sup> Thus, an automatic variable can be initialized to a trap representation without causing undefined
2411 behavior, but the value of the variable cannot be used until a proper value is stored in it.
2413 [<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
2415 representation, even though the value of a member of the structure or union object may be
2416 a trap representation.
2417 7 When a value is stored in a member of an object of union type, the bytes of the object
2418 representation that do not correspond to that member but do correspond to other members
2419 take unspecified values.
2420 8 Where an operator is applied to a value that has more than one object representation,
2421 which object representation is used shall not affect the value of the result.<sup><a href="#note52"><b>52)</b></a></sup> Where a
2422 value is stored in an object using a type that has more than one object representation for
2423 that value, it is unspecified which representation is used, but a trap representation shall
2424 not be generated.
2425 9 Loads and stores of objects with atomic types are done with
2426 memory_order_seq_cst semantics.
2427 Forward references: declarations (<a href="#6.7">6.7</a>), expressions (<a href="#6.5">6.5</a>), lvalues, arrays, and function
2428 designators (<a href="#6.3.2.1">6.3.2.1</a>), order and consistency (<a href="#7.17.3">7.17.3</a>).
2429 <a name="6.2.6.2" href="#6.2.6.2"><b> 6.2.6.2 Integer types</b></a>
2430 1 For unsigned integer types other than unsigned char, the bits of the object
2431 representation shall be divided into two groups: value bits and padding bits (there need
2432 not be any of the latter). If there are N value bits, each bit shall represent a different
2433 power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
2434 representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
2435 known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note53"><b>53)</b></a></sup>
2436 2 For signed integer types, the bits of the object representation shall be divided into three
2437 groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
2438 signed char shall not have any padding bits. There shall be exactly one sign bit.
2439 Each bit that is a value bit shall have the same value as the same bit in the object
2440 representation of the corresponding unsigned type (if there are M value bits in the signed
2441 type and N in the unsigned type, then M &lt;= N ). If the sign bit is zero, it shall not affect
2443 <sup><a name="note51" href="#note51"><b>51)</b></a></sup> Thus, for example, structure assignment need not copy any padding bits.
2444 <sup><a name="note52" href="#note52"><b>52)</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
2445 accessed as objects of type T, but to have different values in other contexts. In particular, if == is
2446 defined for type T, then x == y does not imply that memcmp(&amp;x, &amp;y, sizeof (T)) == 0.
2447 Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
2448 on values of type T may distinguish between them.
2449 <sup><a name="note53" href="#note53"><b>53)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
2450 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2451 representation other than as part of an exceptional condition such as an overflow, and this cannot occur
2452 with unsigned types. All other combinations of padding bits are alternative object representations of
2453 the value specified by the value bits.
2455 [<a name="p45" href="#p45">page 45</a>] (<a href="#Contents">Contents</a>)
2457 the resulting value. If the sign bit is one, the value shall be modified in one of the
2458 following ways:
2459 -- the corresponding value with sign bit 0 is negated (sign and magnitude);
2460 -- the sign bit has the value -(2 M ) (two's complement);
2461 -- the sign bit has the value -(2 M - 1) (ones' complement).
2462 Which of these applies is implementation-defined, as is whether the value with sign bit 1
2463 and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
2464 complement), is a trap representation or a normal value. In the case of sign and
2465 magnitude and ones' complement, if this representation is a normal value it is called a
2466 negative zero.
2467 3 If the implementation supports negative zeros, they shall be generated only by:
2468 -- the &amp;, |, ^, ~, &lt;&lt;, and &gt;&gt; operators with operands that produce such a value;
2469 -- the +, -, *, /, and % operators where one operand is a negative zero and the result is
2470 zero;
2471 -- compound assignment operators based on the above cases.
2472 It is unspecified whether these cases actually generate a negative zero or a normal zero,
2473 and whether a negative zero becomes a normal zero when stored in an object.
2474 4 If the implementation does not support negative zeros, the behavior of the &amp;, |, ^, ~, &lt;&lt;,
2475 and &gt;&gt; operators with operands that would produce such a value is undefined.
2476 5 The values of any padding bits are unspecified.<sup><a href="#note54"><b>54)</b></a></sup> A valid (non-trap) object representation
2477 of a signed integer type where the sign bit is zero is a valid object representation of the
2478 corresponding unsigned type, and shall represent the same value. For any integer type,
2479 the object representation where all the bits are zero shall be a representation of the value
2480 zero in that type.
2481 6 The precision of an integer type is the number of bits it uses to represent values,
2482 excluding any sign and padding bits. The width of an integer type is the same but
2483 including any sign bit; thus for unsigned integer types the two values are the same, while
2484 for signed integer types the width is one greater than the precision.
2489 <sup><a name="note54" href="#note54"><b>54)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
2490 bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
2491 representation other than as part of an exceptional condition such as an overflow. All other
2492 combinations of padding bits are alternative object representations of the value specified by the value
2493 bits.
2495 [<a name="p46" href="#p46">page 46</a>] (<a href="#Contents">Contents</a>)
2497 <a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
2498 1 Two types have compatible type if their types are the same. Additional rules for
2499 determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
2500 in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.6">6.7.6</a> for declarators.<sup><a href="#note55"><b>55)</b></a></sup> Moreover, two structure,
2501 union, or enumerated types declared in separate translation units are compatible if their
2502 tags and members satisfy the following requirements: If one is declared with a tag, the
2503 other shall be declared with the same tag. If both are completed anywhere within their
2504 respective translation units, then the following additional requirements apply: there shall
2505 be a one-to-one correspondence between their members such that each pair of
2506 corresponding members are declared with compatible types; if one member of the pair is
2507 declared with an alignment specifier, the other is declared with an equivalent alignment
2508 specifier; and if one member of the pair is declared with a name, the other is declared
2509 with the same name. For two structures, corresponding members shall be declared in the
2510 same order. For two structures or unions, corresponding bit-fields shall have the same
2511 widths. For two enumerations, corresponding members shall have the same values.
2512 2 All declarations that refer to the same object or function shall have compatible type;
2513 otherwise, the behavior is undefined.
2514 3 A composite type can be constructed from two types that are compatible; it is a type that
2515 is compatible with both of the two types and satisfies the following conditions:
2516 -- If both types are array types, the following rules are applied:
2517 o If one type is an array of known constant size, the composite type is an array of
2518 that size.
2519 o Otherwise, if one type is a variable length array whose size is specified by an
2520 expression that is not evaluated, the behavior is undefined.
2521 o Otherwise, if one type is a variable length array whose size is specified, the
2522 composite type is a variable length array of that size.
2523 o Otherwise, if one type is a variable length array of unspecified size, the composite
2524 type is a variable length array of unspecified size.
2525 o Otherwise, both types are arrays of unknown size and the composite type is an
2526 array of unknown size.
2527 The element type of the composite type is the composite type of the two element
2528 types.
2529 -- If only one type is a function type with a parameter type list (a function prototype),
2530 the composite type is a function prototype with the parameter type list.
2533 <sup><a name="note55" href="#note55"><b>55)</b></a></sup> Two types need not be identical to be compatible.
2535 [<a name="p47" href="#p47">page 47</a>] (<a href="#Contents">Contents</a>)
2537 -- If both types are function types with parameter type lists, the type of each parameter
2538 in the composite parameter type list is the composite type of the corresponding
2539 parameters.
2540 These rules apply recursively to the types from which the two types are derived.
2541 4 For an identifier with internal or external linkage declared in a scope in which a prior
2542 declaration of that identifier is visible,<sup><a href="#note56"><b>56)</b></a></sup> if the prior declaration specifies internal or
2543 external linkage, the type of the identifier at the later declaration becomes the composite
2544 type.
2545 Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
2546 5 EXAMPLE Given the following two file scope declarations:
2547 int f(int (*)(), double (*)[3]);
2548 int f(int (*)(char *), double (*)[]);
2549 The resulting composite type for the function is:
2550 int f(int (*)(char *), double (*)[3]);
2552 <a name="6.2.8" href="#6.2.8"><b> 6.2.8 Alignment of objects</b></a>
2553 1 Complete object types have alignment requirements which place restrictions on the
2554 addresses at which objects of that type may be allocated. An alignment is an
2555 implementation-defined integer value representing the number of bytes between
2556 successive addresses at which a given object can be allocated. An object type imposes an
2557 alignment requirement on every object of that type: stricter alignment can be requested
2558 using the _Alignas keyword.
2559 2 A fundamental alignment is represented by an alignment less than or equal to the greatest
2560 alignment supported by the implementation in all contexts, which is equal to
2561 _Alignof (max_align_t).
2562 3 An extended alignment is represented by an alignment greater than
2563 _Alignof (max_align_t). It is implementation-defined whether any extended
2564 alignments are supported and the contexts in which they are supported. A type having an
2565 extended alignment requirement is an over-aligned type.<sup><a href="#note57"><b>57)</b></a></sup>
2566 4 Alignments are represented as values of the type size_t. Valid alignments include only
2567 those values returned by an _Alignof expression for fundamental types, plus an
2568 additional implementation-defined set of values, which may be empty. Every valid
2569 alignment value shall be a nonnegative integral power of two.
2572 <sup><a name="note56" href="#note56"><b>56)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
2573 <sup><a name="note57" href="#note57"><b>57)</b></a></sup> Every over-aligned type is, or contains, a structure or union type with a member to which an extended
2574 alignment has been applied.
2576 [<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
2578 5 Alignments have an order from weaker to stronger or stricter alignments. Stricter
2579 alignments have larger alignment values. An address that satisfies an alignment
2580 requirement also satisfies any weaker valid alignment requirement.
2581 6 The alignment requirement of a complete type can be queried using an _Alignof
2582 expression. The types char, signed char, and unsigned char shall have the
2583 weakest alignment requirement.
2584 7 Comparing alignments is meaningful and provides the obvious results:
2585 -- Two alignments are equal when their numeric values are equal.
2586 -- Two alignments are different when their numeric values are not equal.
2587 -- When an alignment is larger than another it represents a stricter alignment.
2589 [<a name="p49" href="#p49">page 49</a>] (<a href="#Contents">Contents</a>)
2591 <a name="6.3" href="#6.3"><b> 6.3 Conversions</b></a>
2592 1 Several operators convert operand values from one type to another automatically. This
2593 subclause specifies the result required from such an implicit conversion, as well as those
2594 that result from a cast operation (an explicit conversion). The list in <a href="#6.3.1.8">6.3.1.8</a> summarizes
2595 the conversions performed by most ordinary operators; it is supplemented as required by
2596 the discussion of each operator in <a href="#6.5">6.5</a>.
2597 2 Conversion of an operand value to a compatible type causes no change to the value or the
2598 representation.
2599 Forward references: cast operators (<a href="#6.5.4">6.5.4</a>).
2600 <a name="6.3.1" href="#6.3.1"><b> 6.3.1 Arithmetic operands</b></a>
2601 <a name="6.3.1.1" href="#6.3.1.1"><b> 6.3.1.1 Boolean, characters, and integers</b></a>
2602 1 Every integer type has an integer conversion rank defined as follows:
2603 -- No two signed integer types shall have the same rank, even if they have the same
2604 representation.
2605 -- The rank of a signed integer type shall be greater than the rank of any signed integer
2606 type with less precision.
2607 -- The rank of long long int shall be greater than the rank of long int, which
2608 shall be greater than the rank of int, which shall be greater than the rank of short
2609 int, which shall be greater than the rank of signed char.
2610 -- The rank of any unsigned integer type shall equal the rank of the corresponding
2611 signed integer type, if any.
2612 -- The rank of any standard integer type shall be greater than the rank of any extended
2613 integer type with the same width.
2614 -- The rank of char shall equal the rank of signed char and unsigned char.
2615 -- The rank of _Bool shall be less than the rank of all other standard integer types.
2616 -- The rank of any enumerated type shall equal the rank of the compatible integer type
2617 (see <a href="#6.7.2.2">6.7.2.2</a>).
2618 -- The rank of any extended signed integer type relative to another extended signed
2619 integer type with the same precision is implementation-defined, but still subject to the
2620 other rules for determining the integer conversion rank.
2621 -- For all integer types T1, T2, and T3, if T1 has greater rank than T2 and T2 has
2622 greater rank than T3, then T1 has greater rank than T3.
2623 2 The following may be used in an expression wherever an int or unsigned int may
2624 be used:
2626 [<a name="p50" href="#p50">page 50</a>] (<a href="#Contents">Contents</a>)
2628 -- An object or expression with an integer type (other than int or unsigned int)
2629 whose integer conversion rank is less than or equal to the rank of int and
2630 unsigned int.
2631 -- A bit-field of type _Bool, int, signed int, or unsigned int.
2632 If an int can represent all values of the original type (as restricted by the width, for a
2633 bit-field), the value is converted to an int; otherwise, it is converted to an unsigned
2634 int. These are called the integer promotions.<sup><a href="#note58"><b>58)</b></a></sup> All other types are unchanged by the
2635 integer promotions.
2636 3 The integer promotions preserve value including sign. As discussed earlier, whether a
2637 ''plain'' char is treated as signed is implementation-defined.
2638 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), structure and union specifiers
2639 (<a href="#6.7.2.1">6.7.2.1</a>).
2640 <a name="6.3.1.2" href="#6.3.1.2"><b> 6.3.1.2 Boolean type</b></a>
2641 1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
2642 to 0; otherwise, the result is 1.<sup><a href="#note59"><b>59)</b></a></sup>
2643 <a name="6.3.1.3" href="#6.3.1.3"><b> 6.3.1.3 Signed and unsigned integers</b></a>
2644 1 When a value with integer type is converted to another integer type other than _Bool, if
2645 the value can be represented by the new type, it is unchanged.
2646 2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
2647 subtracting one more than the maximum value that can be represented in the new type
2648 until the value is in the range of the new type.<sup><a href="#note60"><b>60)</b></a></sup>
2649 3 Otherwise, the new type is signed and the value cannot be represented in it; either the
2650 result is implementation-defined or an implementation-defined signal is raised.
2651 <a name="6.3.1.4" href="#6.3.1.4"><b> 6.3.1.4 Real floating and integer</b></a>
2652 1 When a finite value of real floating type is converted to an integer type other than _Bool,
2653 the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
2654 the integral part cannot be represented by the integer type, the behavior is undefined.<sup><a href="#note61"><b>61)</b></a></sup>
2657 <sup><a name="note58" href="#note58"><b>58)</b></a></sup> The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
2658 argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
2659 shift operators, as specified by their respective subclauses.
2660 <sup><a name="note59" href="#note59"><b>59)</b></a></sup> NaNs do not compare equal to 0 and thus convert to 1.
2661 <sup><a name="note60" href="#note60"><b>60)</b></a></sup> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
2662 <sup><a name="note61" href="#note61"><b>61)</b></a></sup> The remaindering operation performed when a value of integer type is converted to unsigned type
2663 need not be performed when a value of real floating type is converted to unsigned type. Thus, the
2664 range of portable real floating values is (-1, Utype_MAX+1).
2666 [<a name="p51" href="#p51">page 51</a>] (<a href="#Contents">Contents</a>)
2668 2 When a value of integer type is converted to a real floating type, if the value being
2669 converted can be represented exactly in the new type, it is unchanged. If the value being
2670 converted is in the range of values that can be represented but cannot be represented
2671 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2672 in an implementation-defined manner. If the value being converted is outside the range of
2673 values that can be represented, the behavior is undefined. Results of some implicit
2674 conversions may be represented in greater range and precision than that required by the
2675 new type (see <a href="#6.3.1.8">6.3.1.8</a> and <a href="#6.8.6.4">6.8.6.4</a>).
2676 <a name="6.3.1.5" href="#6.3.1.5"><b> 6.3.1.5 Real floating types</b></a>
2677 1 When a value of real floating type is converted to a real floating type, if the value being
2678 converted can be represented exactly in the new type, it is unchanged. If the value being
2679 converted is in the range of values that can be represented but cannot be represented
2680 exactly, the result is either the nearest higher or nearest lower representable value, chosen
2681 in an implementation-defined manner. If the value being converted is outside the range of
2682 values that can be represented, the behavior is undefined. Results of some implicit
2683 conversions may be represented in greater range and precision than that required by the
2684 new type (see <a href="#6.3.1.8">6.3.1.8</a> and <a href="#6.8.6.4">6.8.6.4</a>).
2685 <a name="6.3.1.6" href="#6.3.1.6"><b> 6.3.1.6 Complex types</b></a>
2686 1 When a value of complex type is converted to another complex type, both the real and
2687 imaginary parts follow the conversion rules for the corresponding real types.
2688 <a name="6.3.1.7" href="#6.3.1.7"><b> 6.3.1.7 Real and complex</b></a>
2689 1 When a value of real type is converted to a complex type, the real part of the complex
2690 result value is determined by the rules of conversion to the corresponding real type and
2691 the imaginary part of the complex result value is a positive zero or an unsigned zero.
2692 2 When a value of complex type is converted to a real type, the imaginary part of the
2693 complex value is discarded and the value of the real part is converted according to the
2694 conversion rules for the corresponding real type.
2695 <a name="6.3.1.8" href="#6.3.1.8"><b> 6.3.1.8 Usual arithmetic conversions</b></a>
2696 1 Many operators that expect operands of arithmetic type cause conversions and yield result
2697 types in a similar way. The purpose is to determine a common real type for the operands
2698 and result. For the specified operands, each operand is converted, without change of type
2699 domain, to a type whose corresponding real type is the common real type. Unless
2700 explicitly stated otherwise, the common real type is also the corresponding real type of
2701 the result, whose type domain is the type domain of the operands if they are the same,
2702 and complex otherwise. This pattern is called the usual arithmetic conversions:
2703 First, if the corresponding real type of either operand is long double, the other
2704 operand is converted, without change of type domain, to a type whose
2706 [<a name="p52" href="#p52">page 52</a>] (<a href="#Contents">Contents</a>)
2708 corresponding real type is long double.
2709 Otherwise, if the corresponding real type of either operand is double, the other
2710 operand is converted, without change of type domain, to a type whose
2711 corresponding real type is double.
2712 Otherwise, if the corresponding real type of either operand is float, the other
2713 operand is converted, without change of type domain, to a type whose
2714 corresponding real type is float.<sup><a href="#note62"><b>62)</b></a></sup>
2715 Otherwise, the integer promotions are performed on both operands. Then the
2716 following rules are applied to the promoted operands:
2717 If both operands have the same type, then no further conversion is needed.
2718 Otherwise, if both operands have signed integer types or both have unsigned
2719 integer types, the operand with the type of lesser integer conversion rank is
2720 converted to the type of the operand with greater rank.
2721 Otherwise, if the operand that has unsigned integer type has rank greater or
2722 equal to the rank of the type of the other operand, then the operand with
2723 signed integer type is converted to the type of the operand with unsigned
2724 integer type.
2725 Otherwise, if the type of the operand with signed integer type can represent
2726 all of the values of the type of the operand with unsigned integer type, then
2727 the operand with unsigned integer type is converted to the type of the
2728 operand with signed integer type.
2729 Otherwise, both operands are converted to the unsigned integer type
2730 corresponding to the type of the operand with signed integer type.
2731 2 The values of floating operands and of the results of floating expressions may be
2732 represented in greater range and precision than that required by the type; the types are not
2733 changed thereby.<sup><a href="#note63"><b>63)</b></a></sup>
2738 <sup><a name="note62" href="#note62"><b>62)</b></a></sup> For example, addition of a double _Complex and a float entails just the conversion of the
2739 float operand to double (and yields a double _Complex result).
2740 <sup><a name="note63" href="#note63"><b>63)</b></a></sup> The cast and assignment operators are still required to remove extra range and precision.
2742 [<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
2744 <a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
2745 <a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
2746 1 An lvalue is an expression (with an object type other than void) that potentially
2747 designates an object;<sup><a href="#note64"><b>64)</b></a></sup> if an lvalue does not designate an object when it is evaluated, the
2748 behavior is undefined. When an object is said to have a particular type, the type is
2749 specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that
2750 does not have array type, does not have an incomplete type, does not have a const-
2751 qualified type, and if it is a structure or union, does not have any member (including,
2752 recursively, any member or element of all contained aggregates or unions) with a const-
2753 qualified type.
2754 2 Except when it is the operand of the sizeof operator, the _Alignof operator, the
2755 unary &amp; operator, the ++ operator, the -- operator, or the left operand of the . operator
2756 or an assignment operator, an lvalue that does not have array type is converted to the
2757 value stored in the designated object (and is no longer an lvalue); this is called lvalue
2758 conversion. If the lvalue has qualified type, the value has the unqualified version of the
2759 type of the lvalue; additionally, if the lvalue has atomic type, the value has the non-atomic
2760 version of the type of the lvalue; otherwise, the value has the type of the lvalue. If the
2761 lvalue has an incomplete type and does not have array type, the behavior is undefined. If
2762 the lvalue designates an object of automatic storage duration that could have been
2763 declared with the register storage class (never had its address taken), and that object
2764 is uninitialized (not declared with an initializer and no assignment to it has been
2765 performed prior to use), the behavior is undefined.
2766 3 Except when it is the operand of the sizeof operator, the _Alignof operator, or the
2767 unary &amp; operator, or is a string literal used to initialize an array, an expression that has
2768 type ''array of type'' is converted to an expression with type ''pointer to type'' that points
2769 to the initial element of the array object and is not an lvalue. If the array object has
2770 register storage class, the behavior is undefined.
2771 4 A function designator is an expression that has function type. Except when it is the
2772 operand of the sizeof operator, the _Alignof operator,<sup><a href="#note65"><b>65)</b></a></sup> or the unary &amp; operator, a
2773 function designator with type ''function returning type'' is converted to an expression that
2776 <sup><a name="note64" href="#note64"><b>64)</b></a></sup> The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left
2777 operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
2778 object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
2779 as the ''value of an expression''.
2780 An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
2781 expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
2782 <sup><a name="note65" href="#note65"><b>65)</b></a></sup> Because this conversion does not occur, the operand of the sizeof or _Alignof operator remains
2783 a function designator and violates the constraints in <a href="#6.5.3.4">6.5.3.4</a>.
2785 [<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
2787 has type ''pointer to function returning type''.
2788 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), assignment operators
2789 (<a href="#6.5.16">6.5.16</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), initialization (<a href="#6.7.9">6.7.9</a>), postfix
2790 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2791 (<a href="#6.5.3.1">6.5.3.1</a>), the sizeof and _Alignof operators (<a href="#6.5.3.4">6.5.3.4</a>), structure and union members
2792 (<a href="#6.5.2.3">6.5.2.3</a>).
2793 <a name="6.3.2.2" href="#6.3.2.2"><b> 6.3.2.2 void</b></a>
2794 1 The (nonexistent) value of a void expression (an expression that has type void) shall not
2795 be used in any way, and implicit or explicit conversions (except to void) shall not be
2796 applied to such an expression. If an expression of any other type is evaluated as a void
2797 expression, its value or designator is discarded. (A void expression is evaluated for its
2798 side effects.)
2799 <a name="6.3.2.3" href="#6.3.2.3"><b> 6.3.2.3 Pointers</b></a>
2800 1 A pointer to void may be converted to or from a pointer to any object type. A pointer to
2801 any object type may be converted to a pointer to void and back again; the result shall
2802 compare equal to the original pointer.
2803 2 For any qualifier q, a pointer to a non-q-qualified type may be converted to a pointer to
2804 the q-qualified version of the type; the values stored in the original and converted pointers
2805 shall compare equal.
2806 3 An integer constant expression with the value 0, or such an expression cast to type
2807 void *, is called a null pointer constant.<sup><a href="#note66"><b>66)</b></a></sup> If a null pointer constant is converted to a
2808 pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
2809 to a pointer to any object or function.
2810 4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
2811 Any two null pointers shall compare equal.
2812 5 An integer may be converted to any pointer type. Except as previously specified, the
2813 result is implementation-defined, might not be correctly aligned, might not point to an
2814 entity of the referenced type, and might be a trap representation.<sup><a href="#note67"><b>67)</b></a></sup>
2815 6 Any pointer type may be converted to an integer type. Except as previously specified, the
2816 result is implementation-defined. If the result cannot be represented in the integer type,
2817 the behavior is undefined. The result need not be in the range of values of any integer
2818 type.
2821 <sup><a name="note66" href="#note66"><b>66)</b></a></sup> The macro NULL is defined in <a href="#7.19">&lt;stddef.h&gt;</a> (and other headers) as a null pointer constant; see <a href="#7.19">7.19</a>.
2822 <sup><a name="note67" href="#note67"><b>67)</b></a></sup> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
2823 be consistent with the addressing structure of the execution environment.
2825 [<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
2827 7 A pointer to an object type may be converted to a pointer to a different object type. If the
2828 resulting pointer is not correctly aligned<sup><a href="#note68"><b>68)</b></a></sup> for the referenced type, the behavior is
2829 undefined. Otherwise, when converted back again, the result shall compare equal to the
2830 original pointer. When a pointer to an object is converted to a pointer to a character type,
2831 the result points to the lowest addressed byte of the object. Successive increments of the
2832 result, up to the size of the object, yield pointers to the remaining bytes of the object.
2833 8 A pointer to a function of one type may be converted to a pointer to a function of another
2834 type and back again; the result shall compare equal to the original pointer. If a converted
2835 pointer is used to call a function whose type is not compatible with the referenced type,
2836 the behavior is undefined.
2837 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
2838 capable of holding object pointers (<a href="#7.20.1.4">7.20.1.4</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>).
2843 <sup><a name="note68" href="#note68"><b>68)</b></a></sup> In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
2844 pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
2845 correctly aligned for a pointer to type C.
2847 [<a name="p56" href="#p56">page 56</a>] (<a href="#Contents">Contents</a>)
2849 <a name="6.4" href="#6.4"><b> 6.4 Lexical elements</b></a>
2850 <b> Syntax</b>
2851 1 token:
2852 keyword
2853 identifier
2854 constant
2855 string-literal
2856 punctuator
2857 preprocessing-token:
2858 header-name
2859 identifier
2860 pp-number
2861 character-constant
2862 string-literal
2863 punctuator
2864 each non-white-space character that cannot be one of the above
2865 <b> Constraints</b>
2866 2 Each preprocessing token that is converted to a token shall have the lexical form of a
2867 keyword, an identifier, a constant, a string literal, or a punctuator.
2868 <b> Semantics</b>
2869 3 A token is the minimal lexical element of the language in translation phases 7 and 8. The
2870 categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
2871 A preprocessing token is the minimal lexical element of the language in translation
2872 phases 3 through 6. The categories of preprocessing tokens are: header names,
2873 identifiers, preprocessing numbers, character constants, string literals, punctuators, and
2874 single non-white-space characters that do not lexically match the other preprocessing
2875 token categories.<sup><a href="#note69"><b>69)</b></a></sup> If a ' or a " character matches the last category, the behavior is
2876 undefined. Preprocessing tokens can be separated by white space; this consists of
2877 comments (described later), or white-space characters (space, horizontal tab, new-line,
2878 vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
2879 during translation phase 4, white space (or the absence thereof) serves as more than
2880 preprocessing token separation. White space may appear within a preprocessing token
2881 only as part of a header name or between the quotation characters in a character constant
2882 or string literal.
2886 <sup><a name="note69" href="#note69"><b>69)</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
2887 occur in source files.
2889 [<a name="p57" href="#p57">page 57</a>] (<a href="#Contents">Contents</a>)
2891 4 If the input stream has been parsed into preprocessing tokens up to a given character, the
2892 next preprocessing token is the longest sequence of characters that could constitute a
2893 preprocessing token. There is one exception to this rule: header name preprocessing
2894 tokens are recognized only within #include preprocessing directives and in
2895 implementation-defined locations within #pragma directives. In such contexts, a
2896 sequence of characters that could be either a header name or a string literal is recognized
2897 as the former.
2898 5 EXAMPLE 1 The program fragment 1Ex is parsed as a preprocessing number token (one that is not a
2899 valid floating or integer constant token), even though a parse as the pair of preprocessing tokens 1 and Ex
2900 might produce a valid expression (for example, if Ex were a macro defined as +1). Similarly, the program
2901 fragment 1E1 is parsed as a preprocessing number (one that is a valid floating constant token), whether or
2902 not E is a macro name.
2904 6 EXAMPLE 2 The program fragment x+++++y is parsed as x ++ ++ + y, which violates a constraint on
2905 increment operators, even though the parse x ++ + ++ y might yield a correct expression.
2907 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>),
2908 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
2909 increment and decrement operators (<a href="#6.5.2.4">6.5.2.4</a>), prefix increment and decrement operators
2910 (<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
2911 (<a href="#6.4.5">6.4.5</a>).
2912 <a name="6.4.1" href="#6.4.1"><b> 6.4.1 Keywords</b></a>
2913 <b> Syntax</b>
2914 1 keyword: one of
2915 auto * if unsigned
2916 break inline void
2917 case int volatile
2918 char long while
2919 const register _Alignas
2920 continue restrict _Alignof
2921 default return _Atomic
2922 do short _Bool
2923 double signed _Complex
2924 else sizeof _Generic
2925 enum static _Imaginary
2926 extern struct _Noreturn
2927 float switch _Static_assert
2928 for typedef _Thread_local
2929 goto union
2930 <b> Semantics</b>
2931 2 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
2932 keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
2934 [<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
2936 specifying imaginary types.<sup><a href="#note70"><b>70)</b></a></sup>
2937 <a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
2938 <a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
2939 <b> Syntax</b>
2940 1 identifier:
2941 identifier-nondigit
2942 identifier identifier-nondigit
2943 identifier digit
2944 identifier-nondigit:
2945 nondigit
2946 universal-character-name
2947 other implementation-defined characters
2948 nondigit: one of
2949 _ a b c d e f g h i j k l m
2950 n o p q r s t u v w x y z
2951 A B C D E F G H I J K L M
2952 N O P Q R S T U V W X Y Z
2953 digit: one of
2954 0 1 2 3 4 5 6 7 8 9
2955 <b> Semantics</b>
2956 2 An identifier is a sequence of nondigit characters (including the underscore _, the
2957 lowercase and uppercase Latin letters, and other characters) and digits, which designates
2958 one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
2959 There is no specific limit on the maximum length of an identifier.
2960 3 Each universal character name in an identifier shall designate a character whose encoding
2961 in ISO/IEC 10646 falls into one of the ranges specified in D.1.<sup><a href="#note71"><b>71)</b></a></sup> The initial character
2962 shall not be a universal character name designating a character whose encoding falls into
2963 one of the ranges specified in <a href="#D.2">D.2</a>. An implementation may allow multibyte characters
2964 that are not part of the basic source character set to appear in identifiers; which characters
2965 and their correspondence to universal character names is implementation-defined.
2969 <sup><a name="note70" href="#note70"><b>70)</b></a></sup> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
2970 <sup><a name="note71" href="#note71"><b>71)</b></a></sup> On systems in which linkers cannot accept extended characters, an encoding of the universal character
2971 name may be used in forming valid external identifiers. For example, some otherwise unused
2972 character or sequence of characters may be used to encode the \u in a universal character name.
2973 Extended characters may produce a long external identifier.
2975 [<a name="p59" href="#p59">page 59</a>] (<a href="#Contents">Contents</a>)
2977 4 When preprocessing tokens are converted to tokens during translation phase 7, if a
2978 preprocessing token could be converted to either a keyword or an identifier, it is converted
2979 to a keyword.
2980 Implementation limits
2981 5 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
2982 characters in an identifier; the limit for an external name (an identifier that has external
2983 linkage) may be more restrictive than that for an internal name (a macro name or an
2984 identifier that does not have external linkage). The number of significant characters in an
2985 identifier is implementation-defined.
2986 6 Any identifiers that differ in a significant character are different identifiers. If two
2987 identifiers differ only in nonsignificant characters, the behavior is undefined.
2988 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>).
2989 <a name="6.4.2.2" href="#6.4.2.2"><b> 6.4.2.2 Predefined identifiers</b></a>
2990 <b> Semantics</b>
2991 1 The identifier __func__ shall be implicitly declared by the translator as if,
2992 immediately following the opening brace of each function definition, the declaration
2993 static const char __func__[] = "function-name";
2994 appeared, where function-name is the name of the lexically-enclosing function.<sup><a href="#note72"><b>72)</b></a></sup>
2995 2 This name is encoded as if the implicit declaration had been written in the source
2996 character set and then translated into the execution character set as indicated in translation
2997 phase 5.
2998 3 EXAMPLE Consider the code fragment:
2999 #include <a href="#7.21">&lt;stdio.h&gt;</a>
3000 void myfunc(void)
3002 printf("%s\n", __func__);
3003 /* ... */
3005 Each time the function is called, it will print to the standard output stream:
3006 myfunc
3008 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
3013 <sup><a name="note72" href="#note72"><b>72)</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
3014 identifier is explicitly declared using the name __func__, the behavior is undefined.
3016 [<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
3018 <a name="6.4.3" href="#6.4.3"><b> 6.4.3 Universal character names</b></a>
3019 <b> Syntax</b>
3020 1 universal-character-name:
3021 \u hex-quad
3022 \U hex-quad hex-quad
3023 hex-quad:
3024 hexadecimal-digit hexadecimal-digit
3025 hexadecimal-digit hexadecimal-digit
3026 <b> Constraints</b>
3027 2 A universal character name shall not specify a character whose short identifier is less than
3028 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
3029 DFFF inclusive.<sup><a href="#note73"><b>73)</b></a></sup>
3030 <b> Description</b>
3031 3 Universal character names may be used in identifiers, character constants, and string
3032 literals to designate characters that are not in the basic character set.
3033 <b> Semantics</b>
3034 4 The universal character name \Unnnnnnnn designates the character whose eight-digit
3035 short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.<sup><a href="#note74"><b>74)</b></a></sup> Similarly, the universal
3036 character name \unnnn designates the character whose four-digit short identifier is nnnn
3037 (and whose eight-digit short identifier is 0000nnnn).
3042 <sup><a name="note73" href="#note73"><b>73)</b></a></sup> The disallowed characters are the characters in the basic character set and the code positions reserved
3043 by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by
3044 UTF-16).
3046 <sup><a name="note74" href="#note74"><b>74)</b></a></sup> Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
3048 [<a name="p61" href="#p61">page 61</a>] (<a href="#Contents">Contents</a>)
3050 <a name="6.4.4" href="#6.4.4"><b> 6.4.4 Constants</b></a>
3051 <b> Syntax</b>
3052 1 constant:
3053 integer-constant
3054 floating-constant
3055 enumeration-constant
3056 character-constant
3057 <b> Constraints</b>
3058 2 Each constant shall have a type and the value of a constant shall be in the range of
3059 representable values for its type.
3060 <b> Semantics</b>
3061 3 Each constant has a type, determined by its form and value, as detailed later.
3062 <a name="6.4.4.1" href="#6.4.4.1"><b> 6.4.4.1 Integer constants</b></a>
3063 <b> Syntax</b>
3064 1 integer-constant:
3065 decimal-constant integer-suffixopt
3066 octal-constant integer-suffixopt
3067 hexadecimal-constant integer-suffixopt
3068 decimal-constant:
3069 nonzero-digit
3070 decimal-constant digit
3071 octal-constant:
3073 octal-constant octal-digit
3074 hexadecimal-constant:
3075 hexadecimal-prefix hexadecimal-digit
3076 hexadecimal-constant hexadecimal-digit
3077 hexadecimal-prefix: one of
3078 0x 0X
3079 nonzero-digit: one of
3080 1 2 3 4 5 6 7 8 9
3081 octal-digit: one of
3082 0 1 2 3 4 5 6 7
3084 [<a name="p62" href="#p62">page 62</a>] (<a href="#Contents">Contents</a>)
3086 hexadecimal-digit: one of
3087 0 1 2 3 4 5 6 7 8 9
3088 a b c d e f
3089 A B C D E F
3090 integer-suffix:
3091 unsigned-suffix long-suffixopt
3092 unsigned-suffix long-long-suffix
3093 long-suffix unsigned-suffixopt
3094 long-long-suffix unsigned-suffixopt
3095 unsigned-suffix: one of
3097 long-suffix: one of
3099 long-long-suffix: one of
3100 ll LL
3101 <b> Description</b>
3102 2 An integer constant begins with a digit, but has no period or exponent part. It may have a
3103 prefix that specifies its base and a suffix that specifies its type.
3104 3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
3105 digits. An octal constant consists of the prefix 0 optionally followed by a sequence of the
3106 digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
3107 by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
3108 10 through 15 respectively.
3109 <b> Semantics</b>
3110 4 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
3111 that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
3112 5 The type of an integer constant is the first of the corresponding list in which its value can
3113 be represented.
3115 [<a name="p63" href="#p63">page 63</a>] (<a href="#Contents">Contents</a>)
3117 Octal or Hexadecimal
3118 Suffix Decimal Constant Constant
3120 none int int
3121 long int unsigned int
3122 long long int long int
3123 unsigned long int
3124 long long int
3125 unsigned long long int
3127 u or U unsigned int unsigned int
3128 unsigned long int unsigned long int
3129 unsigned long long int unsigned long long int
3131 l or L long int long int
3132 long long int unsigned long int
3133 long long int
3134 unsigned long long int
3136 Both u or U unsigned long int unsigned long int
3137 and l or L unsigned long long int unsigned long long int
3139 ll or LL long long int long long int
3140 unsigned long long int
3142 Both u or U unsigned long long int unsigned long long int
3143 and ll or LL
3144 6 If an integer constant cannot be represented by any type in its list, it may have an
3145 extended integer type, if the extended integer type can represent its value. If all of the
3146 types in the list for the constant are signed, the extended integer type shall be signed. If
3147 all of the types in the list for the constant are unsigned, the extended integer type shall be
3148 unsigned. If the list contains both signed and unsigned types, the extended integer type
3149 may be signed or unsigned. If an integer constant cannot be represented by any type in
3150 its list and has no extended integer type, then the integer constant has no type.
3152 [<a name="p64" href="#p64">page 64</a>] (<a href="#Contents">Contents</a>)
3154 <a name="6.4.4.2" href="#6.4.4.2"><b> 6.4.4.2 Floating constants</b></a>
3155 <b> Syntax</b>
3156 1 floating-constant:
3157 decimal-floating-constant
3158 hexadecimal-floating-constant
3159 decimal-floating-constant:
3160 fractional-constant exponent-partopt floating-suffixopt
3161 digit-sequence exponent-part floating-suffixopt
3162 hexadecimal-floating-constant:
3163 hexadecimal-prefix hexadecimal-fractional-constant
3164 binary-exponent-part floating-suffixopt
3165 hexadecimal-prefix hexadecimal-digit-sequence
3166 binary-exponent-part floating-suffixopt
3167 fractional-constant:
3168 digit-sequenceopt . digit-sequence
3169 digit-sequence .
3170 exponent-part:
3171 e signopt digit-sequence
3172 E signopt digit-sequence
3173 sign: one of
3175 digit-sequence:
3176 digit
3177 digit-sequence digit
3178 hexadecimal-fractional-constant:
3179 hexadecimal-digit-sequenceopt .
3180 hexadecimal-digit-sequence
3181 hexadecimal-digit-sequence .
3182 binary-exponent-part:
3183 p signopt digit-sequence
3184 P signopt digit-sequence
3185 hexadecimal-digit-sequence:
3186 hexadecimal-digit
3187 hexadecimal-digit-sequence hexadecimal-digit
3188 floating-suffix: one of
3189 f l F L
3191 [<a name="p65" href="#p65">page 65</a>] (<a href="#Contents">Contents</a>)
3193 <b> Description</b>
3194 2 A floating constant has a significand part that may be followed by an exponent part and a
3195 suffix that specifies its type. The components of the significand part may include a digit
3196 sequence representing the whole-number part, followed by a period (.), followed by a
3197 digit sequence representing the fraction part. The components of the exponent part are an
3198 e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
3199 Either the whole-number part or the fraction part has to be present; for decimal floating
3200 constants, either the period or the exponent part has to be present.
3201 <b> Semantics</b>
3202 3 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
3203 digit sequence in the exponent part is interpreted as a decimal integer. For decimal
3204 floating constants, the exponent indicates the power of 10 by which the significand part is
3205 to be scaled. For hexadecimal floating constants, the exponent indicates the power of 2
3206 by which the significand part is to be scaled. For decimal floating constants, and also for
3207 hexadecimal floating constants when FLT_RADIX is not a power of 2, the result is either
3208 the nearest representable value, or the larger or smaller representable value immediately
3209 adjacent to the nearest representable value, chosen in an implementation-defined manner.
3210 For hexadecimal floating constants when FLT_RADIX is a power of 2, the result is
3211 correctly rounded.
3212 4 An unsuffixed floating constant has type double. If suffixed by the letter f or F, it has
3213 type float. If suffixed by the letter l or L, it has type long double.
3214 5 Floating constants are converted to internal format as if at translation-time. The
3215 conversion of a floating constant shall not raise an exceptional condition or a floating-
3216 point exception at execution time. All floating constants of the same source form<sup><a href="#note75"><b>75)</b></a></sup> shall
3217 convert to the same internal format with the same value.
3218 Recommended practice
3219 6 The implementation should produce a diagnostic message if a hexadecimal constant
3220 cannot be represented exactly in its evaluation format; the implementation should then
3221 proceed with the translation of the program.
3222 7 The translation-time conversion of floating constants should match the execution-time
3223 conversion of character strings by library functions, such as strtod, given matching
3224 inputs suitable for both conversions, the same result format, and default execution-time
3225 rounding.<sup><a href="#note76"><b>76)</b></a></sup>
3227 <sup><a name="note75" href="#note75"><b>75)</b></a></sup> <a href="#1.23">1.23</a>, 1.230, 123e-2, 123e-02, and 1.23L are all different source forms and thus need not
3228 convert to the same internal format and value.
3229 <sup><a name="note76" href="#note76"><b>76)</b></a></sup> The specification for the library functions recommends more accurate conversion than required for
3230 floating constants (see <a href="#7.22.1.3">7.22.1.3</a>).
3232 [<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
3234 <a name="6.4.4.3" href="#6.4.4.3"><b> 6.4.4.3 Enumeration constants</b></a>
3235 <b> Syntax</b>
3236 1 enumeration-constant:
3237 identifier
3238 <b> Semantics</b>
3239 2 An identifier declared as an enumeration constant has type int.
3240 Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
3241 <a name="6.4.4.4" href="#6.4.4.4"><b> 6.4.4.4 Character constants</b></a>
3242 <b> Syntax</b>
3243 1 character-constant:
3244 ' c-char-sequence '
3245 L' c-char-sequence '
3246 u' c-char-sequence '
3247 U' c-char-sequence '
3248 c-char-sequence:
3249 c-char
3250 c-char-sequence c-char
3251 c-char:
3252 any member of the source character set except
3253 the single-quote ', backslash \, or new-line character
3254 escape-sequence
3255 escape-sequence:
3256 simple-escape-sequence
3257 octal-escape-sequence
3258 hexadecimal-escape-sequence
3259 universal-character-name
3260 simple-escape-sequence: one of
3261 \' \" \? \\
3262 \a \b \f \n \r \t \v
3263 octal-escape-sequence:
3264 \ octal-digit
3265 \ octal-digit octal-digit
3266 \ octal-digit octal-digit octal-digit
3268 [<a name="p67" href="#p67">page 67</a>] (<a href="#Contents">Contents</a>)
3270 hexadecimal-escape-sequence:
3271 \x hexadecimal-digit
3272 hexadecimal-escape-sequence hexadecimal-digit
3273 <b> Description</b>
3274 2 An integer character constant is a sequence of one or more multibyte characters enclosed
3275 in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
3276 letter L, u, or U. With a few exceptions detailed later, the elements of the sequence are
3277 any members of the source character set; they are mapped in an implementation-defined
3278 manner to members of the execution character set.
3279 3 The single-quote ', the double-quote ", the question-mark ?, the backslash \, and
3280 arbitrary integer values are representable according to the following table of escape
3281 sequences:
3282 single quote ' \'
3283 double quote " \"
3284 question mark ? \?
3285 backslash \ \\
3286 octal character \octal digits
3287 hexadecimal character \x hexadecimal digits
3288 4 The double-quote " and question-mark ? are representable either by themselves or by the
3289 escape sequences \" and \?, respectively, but the single-quote ' and the backslash \
3290 shall be represented, respectively, by the escape sequences \' and \\.
3291 5 The octal digits that follow the backslash in an octal escape sequence are taken to be part
3292 of the construction of a single character for an integer character constant or of a single
3293 wide character for a wide character constant. The numerical value of the octal integer so
3294 formed specifies the value of the desired character or wide character.
3295 6 The hexadecimal digits that follow the backslash and the letter x in a hexadecimal escape
3296 sequence are taken to be part of the construction of a single character for an integer
3297 character constant or of a single wide character for a wide character constant. The
3298 numerical value of the hexadecimal integer so formed specifies the value of the desired
3299 character or wide character.
3300 7 Each octal or hexadecimal escape sequence is the longest sequence of characters that can
3301 constitute the escape sequence.
3302 8 In addition, characters not in the basic character set are representable by universal
3303 character names and certain nongraphic characters are representable by escape sequences
3304 consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
3305 and \v.<sup><a href="#note77"><b>77)</b></a></sup>
3307 [<a name="p68" href="#p68">page 68</a>] (<a href="#Contents">Contents</a>)
3309 <b> Constraints</b>
3310 9 The value of an octal or hexadecimal escape sequence shall be in the range of
3311 representable values for the corresponding type:
3312 Prefix Corresponding Type
3313 none unsigned char
3314 L the unsigned type corresponding to wchar_t
3315 u char16_t
3316 U char32_t
3317 <b> Semantics</b>
3318 10 An integer character constant has type int. The value of an integer character constant
3319 containing a single character that maps to a single-byte execution character is the
3320 numerical value of the representation of the mapped character interpreted as an integer.
3321 The value of an integer character constant containing more than one character (e.g.,
3322 'ab'), or containing a character or escape sequence that does not map to a single-byte
3323 execution character, is implementation-defined. If an integer character constant contains
3324 a single character or escape sequence, its value is the one that results when an object with
3325 type char whose value is that of the single character or escape sequence is converted to
3326 type int.
3327 11 A wide character constant prefixed by the letter L has type wchar_t, an integer type
3328 defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header; a wide character constant prefixed by the letter u or
3329 U has type char16_t or char32_t, respectively, unsigned integer types defined in the
3330 <a href="#7.28">&lt;uchar.h&gt;</a> header. The value of a wide character constant containing a single
3331 multibyte character that maps to a single member of the extended execution character set
3332 is the wide character corresponding to that multibyte character, as defined by the
3333 mbtowc, mbrtoc16, or mbrtoc32 function as appropriate for its type, with an
3334 implementation-defined current locale. The value of a wide character constant containing
3335 more than one multibyte character or a single multibyte character that maps to multiple
3336 members of the extended execution character set, or containing a multibyte character or
3337 escape sequence not represented in the extended execution character set, is
3338 implementation-defined.
3339 12 EXAMPLE 1 The construction '\0' is commonly used to represent the null character.
3341 13 EXAMPLE 2 Consider implementations that use two's complement representation for integers and eight
3342 bits for objects that have type char. In an implementation in which type char has the same range of
3343 values as signed char, the integer character constant '\xFF' has the value -1; if type char has the
3344 same range of values as unsigned char, the character constant '\xFF' has the value +255.
3349 <sup><a name="note77" href="#note77"><b>77)</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,
3350 the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
3352 [<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
3354 14 EXAMPLE 3 Even if eight bits are used for objects that have type char, the construction '\x123'
3355 specifies an integer character constant containing only one character, since a hexadecimal escape sequence
3356 is terminated only by a non-hexadecimal character. To specify an integer character constant containing the
3357 two characters whose values are '\x12' and '3', the construction '\0223' may be used, since an octal
3358 escape sequence is terminated after three octal digits. (The value of this two-character integer character
3359 constant is implementation-defined.)
3361 15 EXAMPLE 4 Even if 12 or more bits are used for objects that have type wchar_t, the construction
3362 L'\1234' specifies the implementation-defined value that results from the combination of the values
3363 0123 and '4'.
3365 Forward references: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), the mbtowc function
3366 (<a href="#7.22.7.2">7.22.7.2</a>), Unicode utilities <a href="#7.28">&lt;uchar.h&gt;</a> (<a href="#7.28">7.28</a>).
3367 <a name="6.4.5" href="#6.4.5"><b> 6.4.5 String literals</b></a>
3368 <b> Syntax</b>
3369 1 string-literal:
3370 encoding-prefixopt " s-char-sequenceopt "
3371 encoding-prefix:
3376 s-char-sequence:
3377 s-char
3378 s-char-sequence s-char
3379 s-char:
3380 any member of the source character set except
3381 the double-quote ", backslash \, or new-line character
3382 escape-sequence
3383 <b> Constraints</b>
3384 2 A sequence of adjacent string literal tokens shall not include both a wide string literal and
3385 a UTF-8 string literal.
3386 <b> Description</b>
3387 3 A character string literal is a sequence of zero or more multibyte characters enclosed in
3388 double-quotes, as in "xyz". A UTF-8 string literal is the same, except prefixed by u8.
3389 A wide string literal is the same, except prefixed by the letter L, u, or U.
3390 4 The same considerations apply to each element of the sequence in a string literal as if it
3391 were in an integer character constant (for a character or UTF-8 string literal) or a wide
3392 character constant (for a wide string literal), except that the single-quote ' is
3393 representable either by itself or by the escape sequence \', but the double-quote " shall
3395 [<a name="p70" href="#p70">page 70</a>] (<a href="#Contents">Contents</a>)
3397 be represented by the escape sequence \".
3398 <b> Semantics</b>
3399 5 In translation phase 6, the multibyte character sequences specified by any sequence of
3400 adjacent character and identically-prefixed string literal tokens are concatenated into a
3401 single multibyte character sequence. If any of the tokens has an encoding prefix, the
3402 resulting multibyte character sequence is treated as having the same prefix; otherwise, it
3403 is treated as a character string literal. Whether differently-prefixed wide string literal
3404 tokens can be concatenated and, if so, the treatment of the resulting multibyte character
3405 sequence are implementation-defined.
3406 6 In translation phase 7, a byte or code of value zero is appended to each multibyte
3407 character sequence that results from a string literal or literals.<sup><a href="#note78"><b>78)</b></a></sup> The multibyte character
3408 sequence is then used to initialize an array of static storage duration and length just
3409 sufficient to contain the sequence. For character string literals, the array elements have
3410 type char, and are initialized with the individual bytes of the multibyte character
3411 sequence. For UTF-8 string literals, the array elements have type char, and are
3412 initialized with the characters of the multibyte character sequence, as encoded in UTF-8.
3413 For wide string literals prefixed by the letter L, the array elements have type wchar_t
3414 and are initialized with the sequence of wide characters corresponding to the multibyte
3415 character sequence, as defined by the mbstowcs function with an implementation-
3416 defined current locale. For wide string literals prefixed by the letter u or U, the array
3417 elements have type char16_t or char32_t, respectively, and are initialized with the
3418 sequence of wide characters corresponding to the multibyte character sequence, as
3419 defined by successive calls to the mbrtoc16, or mbrtoc32 function as appropriate for
3420 its type, with an implementation-defined current locale. The value of a string literal
3421 containing a multibyte character or escape sequence not represented in the execution
3422 character set is implementation-defined.
3423 7 It is unspecified whether these arrays are distinct provided their elements have the
3424 appropriate values. If the program attempts to modify such an array, the behavior is
3425 undefined.
3426 8 EXAMPLE 1 This pair of adjacent character string literals
3427 "\x12" "3"
3428 produces a single character string literal containing the two characters whose values are '\x12' and '3',
3429 because escape sequences are converted into single members of the execution character set just prior to
3430 adjacent string literal concatenation.
3432 9 EXAMPLE 2 Each of the sequences of adjacent string literal tokens
3436 <sup><a name="note78" href="#note78"><b>78)</b></a></sup> A string literal need not be a string (see <a href="#7.1.1">7.1.1</a>), because a null character may be embedded in it by a
3437 \0 escape sequence.
3439 [<a name="p71" href="#p71">page 71</a>] (<a href="#Contents">Contents</a>)
3441 "a" "b" L"c"
3442 "a" L"b" "c"
3443 L"a" "b" L"c"
3444 L"a" L"b" L"c"
3445 is equivalent to the string literal
3446 L"abc"
3447 Likewise, each of the sequences
3448 "a" "b" u"c"
3449 "a" u"b" "c"
3450 u"a" "b" u"c"
3451 u"a" u"b" u"c"
3452 is equivalent to
3453 u"abc"
3455 Forward references: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), the mbstowcs
3456 function (<a href="#7.22.8.1">7.22.8.1</a>), Unicode utilities <a href="#7.28">&lt;uchar.h&gt;</a> (<a href="#7.28">7.28</a>).
3457 <a name="6.4.6" href="#6.4.6"><b> 6.4.6 Punctuators</b></a>
3458 <b> Syntax</b>
3459 1 punctuator: one of
3460 [ ] ( ) { } . -&gt;
3461 ++ -- &amp; * + - ~ !
3462 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
3463 ? : ; ...
3464 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
3465 , # ##
3466 &lt;: :&gt; &lt;% %&gt; %: %:%:
3467 <b> Semantics</b>
3468 2 A punctuator is a symbol that has independent syntactic and semantic significance.
3469 Depending on context, it may specify an operation to be performed (which in turn may
3470 yield a value or a function designator, produce a side effect, or some combination thereof)
3471 in which case it is known as an operator (other forms of operator also exist in some
3472 contexts). An operand is an entity on which an operator acts.
3474 [<a name="p72" href="#p72">page 72</a>] (<a href="#Contents">Contents</a>)
3476 3 In all aspects of the language, the six tokens<sup><a href="#note79"><b>79)</b></a></sup>
3477 &lt;: :&gt; &lt;% %&gt; %: %:%:
3478 behave, respectively, the same as the six tokens
3479 [ ] { } # ##
3480 except for their spelling.<sup><a href="#note80"><b>80)</b></a></sup>
3481 Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
3482 (<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
3483 <a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
3484 <b> Syntax</b>
3485 1 header-name:
3486 &lt; h-char-sequence &gt;
3487 " q-char-sequence "
3488 h-char-sequence:
3489 h-char
3490 h-char-sequence h-char
3491 h-char:
3492 any member of the source character set except
3493 the new-line character and &gt;
3494 q-char-sequence:
3495 q-char
3496 q-char-sequence q-char
3497 q-char:
3498 any member of the source character set except
3499 the new-line character and "
3500 <b> Semantics</b>
3501 2 The sequences in both forms of header names are mapped in an implementation-defined
3502 manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
3503 3 If the characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt; delimiters,
3504 the behavior is undefined. Similarly, if the characters ', \, //, or /* occur in the
3509 <sup><a name="note79" href="#note79"><b>79)</b></a></sup> These tokens are sometimes called ''digraphs''.
3510 <sup><a name="note80" href="#note80"><b>80)</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
3511 interchanged.
3513 [<a name="p73" href="#p73">page 73</a>] (<a href="#Contents">Contents</a>)
3515 sequence between the " delimiters, the behavior is undefined.<sup><a href="#note81"><b>81)</b></a></sup> Header name
3516 preprocessing tokens are recognized only within #include preprocessing directives and
3517 in implementation-defined locations within #pragma directives.<sup><a href="#note82"><b>82)</b></a></sup>
3518 4 EXAMPLE The following sequence of characters:
3519 0x3&lt;1/a.h&gt;1e2
3520 #include &lt;1/a.h&gt;
3521 #define const.member@$
3522 forms the following sequence of preprocessing tokens (with each individual preprocessing token delimited
3523 by a { on the left and a } on the right).
3524 {0x3}{&lt;}{1}{/}{a}{.}{h}{&gt;}{1e2}
3525 {#}{include} {&lt;1/a.h&gt;}
3526 {#}{define} {const}{.}{member}{@}{$}
3528 Forward references: source file inclusion (<a href="#6.10.2">6.10.2</a>).
3529 <a name="6.4.8" href="#6.4.8"><b> 6.4.8 Preprocessing numbers</b></a>
3530 <b> Syntax</b>
3531 1 pp-number:
3532 digit
3533 . digit
3534 pp-number digit
3535 pp-number identifier-nondigit
3536 pp-number e sign
3537 pp-number E sign
3538 pp-number p sign
3539 pp-number P sign
3540 pp-number .
3541 <b> Description</b>
3542 2 A preprocessing number begins with a digit optionally preceded by a period (.) and may
3543 be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
3544 p+, p-, P+, or P-.
3545 3 Preprocessing number tokens lexically include all floating and integer constant tokens.
3546 <b> Semantics</b>
3547 4 A preprocessing number does not have type or a value; it acquires both after a successful
3548 conversion (as part of translation phase 7) to a floating constant token or an integer
3549 constant token.
3552 <sup><a name="note81" href="#note81"><b>81)</b></a></sup> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
3553 <sup><a name="note82" href="#note82"><b>82)</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>.
3555 [<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
3557 <a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
3558 1 Except within a character constant, a string literal, or a comment, the characters /*
3559 introduce a comment. The contents of such a comment are examined only to identify
3560 multibyte characters and to find the characters */ that terminate it.<sup><a href="#note83"><b>83)</b></a></sup>
3561 2 Except within a character constant, a string literal, or a comment, the characters //
3562 introduce a comment that includes all multibyte characters up to, but not including, the
3563 next new-line character. The contents of such a comment are examined only to identify
3564 multibyte characters and to find the terminating new-line character.
3565 3 EXAMPLE
3566 "a//b" // four-character string literal
3567 #include "//e" // undefined behavior
3568 // */ // comment, not syntax error
3569 f = g/**//h; // equivalent to f = g / h;
3571 i(); // part of a two-line comment
3573 / j(); // part of a two-line comment
3574 #define glue(x,y) x##y
3575 glue(/,/) k(); // syntax error, not comment
3576 /*//*/ l(); // equivalent to l();
3577 m = n//**/o
3578 + p; // equivalent to m = n + p;
3583 <sup><a name="note83" href="#note83"><b>83)</b></a></sup> Thus, /* ... */ comments do not nest.
3585 [<a name="p75" href="#p75">page 75</a>] (<a href="#Contents">Contents</a>)
3587 <a name="6.5" href="#6.5"><b> 6.5 Expressions</b></a>
3588 1 An expression is a sequence of operators and operands that specifies computation of a
3589 value, or that designates an object or a function, or that generates side effects, or that
3590 performs a combination thereof. The value computations of the operands of an operator
3591 are sequenced before the value computation of the result of the operator.
3592 2 If a side effect on a scalar object is unsequenced relative to either a different side effect
3593 on the same scalar object or a value computation using the value of the same scalar
3594 object, the behavior is undefined. If there are multiple allowable orderings of the
3595 subexpressions of an expression, the behavior is undefined if such an unsequenced side
3596 effect occurs in any of the orderings.<sup><a href="#note84"><b>84)</b></a></sup>
3597 3 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note85"><b>85)</b></a></sup> Except as specified
3598 later, side effects and value computations of subexpressions are unsequenced.<sup><a href="#note86"><b>86)</b></a></sup>
3599 4 Some operators (the unary operator ~, and the binary operators &lt;&lt;, &gt;&gt;, &amp;, ^, and |,
3600 collectively described as bitwise operators) are required to have operands that have
3601 integer type. These operators yield values that depend on the internal representations of
3602 integers, and have implementation-defined and undefined aspects for signed types.
3603 5 If an exceptional condition occurs during the evaluation of an expression (that is, if the
3604 result is not mathematically defined or not in the range of representable values for its
3605 type), the behavior is undefined.
3609 <sup><a name="note84" href="#note84"><b>84)</b></a></sup> This paragraph renders undefined statement expressions such as
3610 i = ++i + 1;
3611 a[i++] = i;
3612 while allowing
3613 i = i + 1;
3614 a[i] = i;
3616 <sup><a name="note85" href="#note85"><b>85)</b></a></sup> The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
3617 as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
3618 expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
3619 <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
3620 (<a href="#6.5.3">6.5.3</a>), and an operand contained between any of the following pairs of operators: grouping
3621 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
3622 the conditional operator ? : (<a href="#6.5.15">6.5.15</a>).
3623 Within each major subclause, the operators have the same precedence. Left- or right-associativity is
3624 indicated in each subclause by the syntax for the expressions discussed therein.
3625 <sup><a name="note86" href="#note86"><b>86)</b></a></sup> In an expression that is evaluated more than once during the execution of a program, unsequenced and
3626 indeterminately sequenced evaluations of its subexpressions need not be performed consistently in
3627 different evaluations.
3629 [<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
3631 6 The effective type of an object for an access to its stored value is the declared type of the
3632 object, if any.<sup><a href="#note87"><b>87)</b></a></sup> If a value is stored into an object having no declared type through an
3633 lvalue having a type that is not a character type, then the type of the lvalue becomes the
3634 effective type of the object for that access and for subsequent accesses that do not modify
3635 the stored value. If a value is copied into an object having no declared type using
3636 memcpy or memmove, or is copied as an array of character type, then the effective type
3637 of the modified object for that access and for subsequent accesses that do not modify the
3638 value is the effective type of the object from which the value is copied, if it has one. For
3639 all other accesses to an object having no declared type, the effective type of the object is
3640 simply the type of the lvalue used for the access.
3641 7 An object shall have its stored value accessed only by an lvalue expression that has one of
3642 the following types:<sup><a href="#note88"><b>88)</b></a></sup>
3643 -- a type compatible with the effective type of the object,
3644 -- a qualified version of a type compatible with the effective type of the object,
3645 -- a type that is the signed or unsigned type corresponding to the effective type of the
3646 object,
3647 -- a type that is the signed or unsigned type corresponding to a qualified version of the
3648 effective type of the object,
3649 -- an aggregate or union type that includes one of the aforementioned types among its
3650 members (including, recursively, a member of a subaggregate or contained union), or
3651 -- a character type.
3652 8 A floating expression may be contracted, that is, evaluated as though it were a single
3653 operation, thereby omitting rounding errors implied by the source code and the
3654 expression evaluation method.<sup><a href="#note89"><b>89)</b></a></sup> The FP_CONTRACT pragma in <a href="#7.12">&lt;math.h&gt;</a> provides a
3655 way to disallow contracted expressions. Otherwise, whether and how expressions are
3656 contracted is implementation-defined.<sup><a href="#note90"><b>90)</b></a></sup>
3657 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), copying functions (<a href="#7.24.2">7.24.2</a>).
3660 <sup><a name="note87" href="#note87"><b>87)</b></a></sup> Allocated objects have no declared type.
3661 <sup><a name="note88" href="#note88"><b>88)</b></a></sup> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
3662 <sup><a name="note89" href="#note89"><b>89)</b></a></sup> The intermediate operations in the contracted expression are evaluated as if to infinite range and
3663 precision, while the final operation is rounded to the format determined by the expression evaluation
3664 method. A contracted expression might also omit the raising of floating-point exceptions.
3665 <sup><a name="note90" href="#note90"><b>90)</b></a></sup> This license is specifically intended to allow implementations to exploit fast machine instructions that
3666 combine multiple C operators. As contractions potentially undermine predictability, and can even
3667 decrease accuracy for containing expressions, their use needs to be well-defined and clearly
3668 documented.
3670 [<a name="p77" href="#p77">page 77</a>] (<a href="#Contents">Contents</a>)
3672 <a name="6.5.1" href="#6.5.1"><b> 6.5.1 Primary expressions</b></a>
3673 <b> Syntax</b>
3674 1 primary-expression:
3675 identifier
3676 constant
3677 string-literal
3678 ( expression )
3679 generic-selection
3680 <b> Semantics</b>
3681 2 An identifier is a primary expression, provided it has been declared as designating an
3682 object (in which case it is an lvalue) or a function (in which case it is a function
3683 designator).<sup><a href="#note91"><b>91)</b></a></sup>
3684 3 A constant is a primary expression. Its type depends on its form and value, as detailed in
3685 <a href="#6.4.4">6.4.4</a>.
3686 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>.
3687 5 A parenthesized expression is a primary expression. Its type and value are identical to
3688 those of the unparenthesized expression. It is an lvalue, a function designator, or a void
3689 expression if the unparenthesized expression is, respectively, an lvalue, a function
3690 designator, or a void expression.
3691 6 A generic selection is a primary expression. Its type and value depend on the selected
3692 generic association, as detailed in the following subclause.
3693 Forward references: declarations (<a href="#6.7">6.7</a>).
3694 <a name="6.5.1.1" href="#6.5.1.1"><b> 6.5.1.1 Generic selection</b></a>
3695 <b> Syntax</b>
3696 1 generic-selection:
3697 _Generic ( assignment-expression , generic-assoc-list )
3698 generic-assoc-list:
3699 generic-association
3700 generic-assoc-list , generic-association
3701 generic-association:
3702 type-name : assignment-expression
3703 default : assignment-expression
3707 <sup><a name="note91" href="#note91"><b>91)</b></a></sup> Thus, an undeclared identifier is a violation of the syntax.
3709 [<a name="p78" href="#p78">page 78</a>] (<a href="#Contents">Contents</a>)
3711 <b> Constraints</b>
3712 2 A generic selection shall have no more than one default generic association. The type
3713 name in a generic association shall specify a complete object type other than a variably
3714 modified type. No two generic associations in the same generic selection shall specify
3715 compatible types. The controlling expression of a generic selection shall have type
3716 compatible with at most one of the types named in its generic association list. If a
3717 generic selection has no default generic association, its controlling expression shall
3718 have type compatible with exactly one of the types named in its generic association list.
3719 <b> Semantics</b>
3720 3 The controlling expression of a generic selection is not evaluated. If a generic selection
3721 has a generic association with a type name that is compatible with the type of the
3722 controlling expression, then the result expression of the generic selection is the
3723 expression in that generic association. Otherwise, the result expression of the generic
3724 selection is the expression in the default generic association. None of the expressions
3725 from any other generic association of the generic selection is evaluated.
3726 4 The type and value of a generic selection are identical to those of its result expression. It
3727 is an lvalue, a function designator, or a void expression if its result expression is,
3728 respectively, an lvalue, a function designator, or a void expression.
3729 5 EXAMPLE The cbrt type-generic macro could be implemented as follows:
3730 #define cbrt(X) _Generic((X), \
3731 long double: cbrtl, \
3732 default: cbrt, \
3733 float: cbrtf \
3734 )(X)
3736 <a name="6.5.2" href="#6.5.2"><b> 6.5.2 Postfix operators</b></a>
3737 <b> Syntax</b>
3738 1 postfix-expression:
3739 primary-expression
3740 postfix-expression [ expression ]
3741 postfix-expression ( argument-expression-listopt )
3742 postfix-expression . identifier
3743 postfix-expression -&gt; identifier
3744 postfix-expression ++
3745 postfix-expression --
3746 ( type-name ) { initializer-list }
3747 ( type-name ) { initializer-list , }
3749 [<a name="p79" href="#p79">page 79</a>] (<a href="#Contents">Contents</a>)
3751 argument-expression-list:
3752 assignment-expression
3753 argument-expression-list , assignment-expression
3754 <a name="6.5.2.1" href="#6.5.2.1"><b> 6.5.2.1 Array subscripting</b></a>
3755 <b> Constraints</b>
3756 1 One of the expressions shall have type ''pointer to complete object type'', the other
3757 expression shall have integer type, and the result has type ''type''.
3758 <b> Semantics</b>
3759 2 A postfix expression followed by an expression in square brackets [] is a subscripted
3760 designation of an element of an array object. The definition of the subscript operator []
3761 is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
3762 apply to the binary + operator, if E1 is an array object (equivalently, a pointer to the
3763 initial element of an array object) and E2 is an integer, E1[E2] designates the E2-th
3764 element of E1 (counting from zero).
3765 3 Successive subscript operators designate an element of a multidimensional array object.
3766 If E is an n-dimensional array (n &gt;= 2) with dimensions i x j x . . . x k, then E (used as
3767 other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with
3768 dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or
3769 implicitly as a result of subscripting, the result is the referenced (n - 1)-dimensional
3770 array, which itself is converted into a pointer if used as other than an lvalue. It follows
3771 from this that arrays are stored in row-major order (last subscript varies fastest).
3772 4 EXAMPLE Consider the array object defined by the declaration
3773 int x[3][5];
3774 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
3775 array of five ints. In the expression x[i], which is equivalent to (*((x)+(i))), x is first converted to
3776 a pointer to the initial array of five ints. Then i is adjusted according to the type of x, which conceptually
3777 entails multiplying i by the size of the object to which the pointer points, namely an array of five int
3778 objects. The results are added and indirection is applied to yield an array of five ints. When used in the
3779 expression x[i][j], that array is in turn converted to a pointer to the first of the ints, so x[i][j]
3780 yields an int.
3782 Forward references: additive operators (<a href="#6.5.6">6.5.6</a>), address and indirection operators
3783 (<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
3785 [<a name="p80" href="#p80">page 80</a>] (<a href="#Contents">Contents</a>)
3787 <a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
3788 <b> Constraints</b>
3789 1 The expression that denotes the called function<sup><a href="#note92"><b>92)</b></a></sup> shall have type pointer to function
3790 returning void or returning a complete object type other than an array type.
3791 2 If the expression that denotes the called function has a type that includes a prototype, the
3792 number of arguments shall agree with the number of parameters. Each argument shall
3793 have a type such that its value may be assigned to an object with the unqualified version
3794 of the type of its corresponding parameter.
3795 <b> Semantics</b>
3796 3 A postfix expression followed by parentheses () containing a possibly empty, comma-
3797 separated list of expressions is a function call. The postfix expression denotes the called
3798 function. The list of expressions specifies the arguments to the function.
3799 4 An argument may be an expression of any complete object type. In preparing for the call
3800 to a function, the arguments are evaluated, and each parameter is assigned the value of the
3801 corresponding argument.<sup><a href="#note93"><b>93)</b></a></sup>
3802 5 If the expression that denotes the called function has type pointer to function returning an
3803 object type, the function call expression has the same type as that object type, and has the
3804 value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void.
3805 6 If the expression that denotes the called function has a type that does not include a
3806 prototype, the integer promotions are performed on each argument, and arguments that
3807 have type float are promoted to double. These are called the default argument
3808 promotions. If the number of arguments does not equal the number of parameters, the
3809 behavior is undefined. If the function is defined with a type that includes a prototype, and
3810 either the prototype ends with an ellipsis (, ...) or the types of the arguments after
3811 promotion are not compatible with the types of the parameters, the behavior is undefined.
3812 If the function is defined with a type that does not include a prototype, and the types of
3813 the arguments after promotion are not compatible with those of the parameters after
3814 promotion, the behavior is undefined, except for the following cases:
3815 -- one promoted type is a signed integer type, the other promoted type is the
3816 corresponding unsigned integer type, and the value is representable in both types;
3820 <sup><a name="note92" href="#note92"><b>92)</b></a></sup> Most often, this is the result of converting an identifier that is a function designator.
3821 <sup><a name="note93" href="#note93"><b>93)</b></a></sup> A function may change the values of its parameters, but these changes cannot affect the values of the
3822 arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
3823 change the value of the object pointed to. A parameter declared to have array or function type is
3824 adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
3826 [<a name="p81" href="#p81">page 81</a>] (<a href="#Contents">Contents</a>)
3828 -- both types are pointers to qualified or unqualified versions of a character type or
3829 void.
3830 7 If the expression that denotes the called function has a type that does include a prototype,
3831 the arguments are implicitly converted, as if by assignment, to the types of the
3832 corresponding parameters, taking the type of each parameter to be the unqualified version
3833 of its declared type. The ellipsis notation in a function prototype declarator causes
3834 argument type conversion to stop after the last declared parameter. The default argument
3835 promotions are performed on trailing arguments.
3836 8 No other conversions are performed implicitly; in particular, the number and types of
3837 arguments are not compared with those of the parameters in a function definition that
3838 does not include a function prototype declarator.
3839 9 If the function is defined with a type that is not compatible with the type (of the
3840 expression) pointed to by the expression that denotes the called function, the behavior is
3841 undefined.
3842 10 There is a sequence point after the evaluations of the function designator and the actual
3843 arguments but before the actual call. Every evaluation in the calling function (including
3844 other function calls) that is not otherwise specifically sequenced before or after the
3845 execution of the body of the called function is indeterminately sequenced with respect to
3846 the execution of the called function.<sup><a href="#note94"><b>94)</b></a></sup>
3847 11 Recursive function calls shall be permitted, both directly and indirectly through any chain
3848 of other functions.
3849 12 EXAMPLE In the function call
3850 (*pf[f1()]) (f2(), f3() + f4())
3851 the functions f1, f2, f3, and f4 may be called in any order. All side effects have to be completed before
3852 the function pointed to by pf[f1()] is called.
3854 Forward references: function declarators (including prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), function
3855 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>).
3856 <a name="6.5.2.3" href="#6.5.2.3"><b> 6.5.2.3 Structure and union members</b></a>
3857 <b> Constraints</b>
3858 1 The first operand of the . operator shall have an atomic, qualified, or unqualified
3859 structure or union type, and the second operand shall name a member of that type.
3860 2 The first operand of the -&gt; operator shall have type ''pointer to atomic, qualified, or
3861 unqualified structure'' or ''pointer to atomic, qualified, or unqualified union'', and the
3862 second operand shall name a member of the type pointed to.
3865 <sup><a name="note94" href="#note94"><b>94)</b></a></sup> In other words, function executions do not ''interleave'' with each other.
3867 [<a name="p82" href="#p82">page 82</a>] (<a href="#Contents">Contents</a>)
3869 <b> Semantics</b>
3870 3 A postfix expression followed by the . operator and an identifier designates a member of
3871 a structure or union object. The value is that of the named member,<sup><a href="#note95"><b>95)</b></a></sup> and is an lvalue if
3872 the first expression is an lvalue. If the first expression has qualified type, the result has
3873 the so-qualified version of the type of the designated member.
3874 4 A postfix expression followed by the -&gt; operator and an identifier designates a member
3875 of a structure or union object. The value is that of the named member of the object to
3876 which the first expression points, and is an lvalue.<sup><a href="#note96"><b>96)</b></a></sup> If the first expression is a pointer to
3877 a qualified type, the result has the so-qualified version of the type of the designated
3878 member.
3879 5 Accessing a member of an atomic structure or union object results in undefined
3880 behavior.<sup><a href="#note97"><b>97)</b></a></sup>
3881 6 One special guarantee is made in order to simplify the use of unions: if a union contains
3882 several structures that share a common initial sequence (see below), and if the union
3883 object currently contains one of these structures, it is permitted to inspect the common
3884 initial part of any of them anywhere that a declaration of the completed type of the union
3885 is visible. Two structures share a common initial sequence if corresponding members
3886 have compatible types (and, for bit-fields, the same widths) for a sequence of one or more
3887 initial members.
3888 7 EXAMPLE 1 If f is a function returning a structure or union, and x is a member of that structure or
3889 union, f().x is a valid postfix expression but is not an lvalue.
3891 8 EXAMPLE 2 In:
3892 struct s { int i; const int ci; };
3893 struct s s;
3894 const struct s cs;
3895 volatile struct s vs;
3896 the various members have the types:
3901 <sup><a name="note95" href="#note95"><b>95)</b></a></sup> If the member used to read the contents of a union object is not the same as the member last used to
3902 store a value in the object, the appropriate part of the object representation of the value is reinterpreted
3903 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
3904 punning''). This might be a trap representation.
3905 <sup><a name="note96" href="#note96"><b>96)</b></a></sup> If &amp;E is a valid pointer expression (where &amp; is the ''address-of '' operator, which generates a pointer to
3906 its operand), the expression (&amp;E)-&gt;MOS is the same as E.MOS.
3907 <sup><a name="note97" href="#note97"><b>97)</b></a></sup> For example, a data race would occur if access to the entire structure or union in one thread conflicts
3908 with access to a member from another thread, where at least one access is a modification. Members
3909 can be safely accessed using a non-atomic object which is assigned to or from the atomic object.
3911 [<a name="p83" href="#p83">page 83</a>] (<a href="#Contents">Contents</a>)
3913 s.i int
3914 s.ci const int
3915 cs.i const int
3916 cs.ci const int
3917 vs.i volatile int
3918 vs.ci volatile const int
3920 9 EXAMPLE 3 The following is a valid fragment:
3921 union {
3922 struct {
3923 int alltypes;
3924 } n;
3925 struct {
3926 int type;
3927 int intnode;
3928 } ni;
3929 struct {
3930 int type;
3931 double doublenode;
3932 } nf;
3933 } u;
3934 u.nf.type = 1;
3935 u.nf.doublenode = <a href="#3.14">3.14</a>;
3936 /* ... */
3937 if (u.n.alltypes == 1)
3938 if (sin(u.nf.doublenode) == 0.0)
3939 /* ... */
3940 The following is not a valid fragment (because the union type is not visible within function f):
3941 struct t1 { int m; };
3942 struct t2 { int m; };
3943 int f(struct t1 *p1, struct t2 *p2)
3945 if (p1-&gt;m &lt; 0)
3946 p2-&gt;m = -p2-&gt;m;
3947 return p1-&gt;m;
3949 int g()
3951 union {
3952 struct t1 s1;
3953 struct t2 s2;
3954 } u;
3955 /* ... */
3956 return f(&amp;u.s1, &amp;u.s2);
3959 Forward references: address and indirection operators (<a href="#6.5.3.2">6.5.3.2</a>), structure and union
3960 specifiers (<a href="#6.7.2.1">6.7.2.1</a>).
3962 [<a name="p84" href="#p84">page 84</a>] (<a href="#Contents">Contents</a>)
3964 <a name="6.5.2.4" href="#6.5.2.4"><b> 6.5.2.4 Postfix increment and decrement operators</b></a>
3965 <b> Constraints</b>
3966 1 The operand of the postfix increment or decrement operator shall have atomic, qualified,
3967 or unqualified real or pointer type, and shall be a modifiable lvalue.
3968 <b> Semantics</b>
3969 2 The result of the postfix ++ operator is the value of the operand. As a side effect, the
3970 value of the operand object is incremented (that is, the value 1 of the appropriate type is
3971 added to it). See the discussions of additive operators and compound assignment for
3972 information on constraints, types, and conversions and the effects of operations on
3973 pointers. The value computation of the result is sequenced before the side effect of
3974 updating the stored value of the operand. With respect to an indeterminately-sequenced
3975 function call, the operation of postfix ++ is a single evaluation. Postfix ++ on an object
3976 with atomic type is a read-modify-write operation with memory_order_seq_cst
3977 memory order semantics.<sup><a href="#note98"><b>98)</b></a></sup>
3978 3 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
3979 the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
3980 it).
3981 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>).
3982 <a name="6.5.2.5" href="#6.5.2.5"><b> 6.5.2.5 Compound literals</b></a>
3983 <b> Constraints</b>
3984 1 The type name shall specify a complete object type or an array of unknown size, but not a
3985 variable length array type.
3986 2 All the constraints for initializer lists in <a href="#6.7.9">6.7.9</a> also apply to compound literals.
3987 <b> Semantics</b>
3988 3 A postfix expression that consists of a parenthesized type name followed by a brace-
3989 enclosed list of initializers is a compound literal. It provides an unnamed object whose
3991 <sup><a name="note98" href="#note98"><b>98)</b></a></sup> Where a pointer to an atomic object can be formed and E has integer type, E++ is equivalent to the
3992 following code sequence where T is the type of E:
3993 T *addr = &amp;E;
3994 T old = *addr;
3995 T new;
3996 do {
3997 new = old + 1;
3998 } while (!atomic_compare_exchange_strong(addr, &amp;old, new));
3999 with old being the result of the operation.
4000 Special care must be taken if E has floating type; see <a href="#6.5.16.2">6.5.16.2</a>.
4002 [<a name="p85" href="#p85">page 85</a>] (<a href="#Contents">Contents</a>)
4004 value is given by the initializer list.<sup><a href="#note99"><b>99)</b></a></sup>
4005 4 If the type name specifies an array of unknown size, the size is determined by the
4006 initializer list as specified in <a href="#6.7.9">6.7.9</a>, and the type of the compound literal is that of the
4007 completed array type. Otherwise (when the type name specifies an object type), the type
4008 of the compound literal is that specified by the type name. In either case, the result is an
4009 lvalue.
4010 5 The value of the compound literal is that of an unnamed object initialized by the
4011 initializer list. If the compound literal occurs outside the body of a function, the object
4012 has static storage duration; otherwise, it has automatic storage duration associated with
4013 the enclosing block.
4014 6 All the semantic rules for initializer lists in <a href="#6.7.9">6.7.9</a> also apply to compound literals.<sup><a href="#note100"><b>100)</b></a></sup>
4015 7 String literals, and compound literals with const-qualified types, need not designate
4016 distinct objects.<sup><a href="#note101"><b>101)</b></a></sup>
4017 8 EXAMPLE 1 The file scope definition
4018 int *p = (int []){2, 4};
4019 initializes p to point to the first element of an array of two ints, the first having the value two and the
4020 second, four. The expressions in this compound literal are required to be constant. The unnamed object
4021 has static storage duration.
4023 9 EXAMPLE 2 In contrast, in
4024 void f(void)
4026 int *p;
4027 /*...*/
4028 p = (int [2]){*p};
4029 /*...*/
4031 p is assigned the address of the first element of an array of two ints, the first having the value previously
4032 pointed to by p and the second, zero. The expressions in this compound literal need not be constant. The
4033 unnamed object has automatic storage duration.
4035 10 EXAMPLE 3 Initializers with designations can be combined with compound literals. Structure objects
4036 created using compound literals can be passed to functions without depending on member order:
4037 drawline((struct point){.x=1, .y=1},
4038 (struct point){.x=3, .y=4});
4042 <sup><a name="note99" href="#note99"><b>99)</b></a></sup> Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
4043 or void only, and the result of a cast expression is not an lvalue.
4044 <sup><a name="note100" href="#note100"><b>100)</b></a></sup> For example, subobjects without explicit initializers are initialized to zero.
4045 <sup><a name="note101" href="#note101"><b>101)</b></a></sup> This allows implementations to share storage for string literals and constant compound literals with
4046 the same or overlapping representations.
4048 [<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
4050 Or, if drawline instead expected pointers to struct point:
4051 drawline(&amp;(struct point){.x=1, .y=1},
4052 &amp;(struct point){.x=3, .y=4});
4054 11 EXAMPLE 4 A read-only compound literal can be specified through constructions like:
4055 (const float []){1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6}
4057 12 EXAMPLE 5 The following three expressions have different meanings:
4058 "/tmp/fileXXXXXX"
4059 (char []){"/tmp/fileXXXXXX"}
4060 (const char []){"/tmp/fileXXXXXX"}
4061 The first always has static storage duration and has type array of char, but need not be modifiable; the last
4062 two have automatic storage duration when they occur within the body of a function, and the first of these
4063 two is modifiable.
4065 13 EXAMPLE 6 Like string literals, const-qualified compound literals can be placed into read-only memory
4066 and can even be shared. For example,
4067 (const char []){"abc"} == "abc"
4068 might yield 1 if the literals' storage is shared.
4070 14 EXAMPLE 7 Since compound literals are unnamed, a single compound literal cannot specify a circularly
4071 linked object. For example, there is no way to write a self-referential compound literal that could be used
4072 as the function argument in place of the named object endless_zeros below:
4073 struct int_list { int car; struct int_list *cdr; };
4074 struct int_list endless_zeros = {0, &amp;endless_zeros};
4075 eval(endless_zeros);
4077 15 EXAMPLE 8 Each compound literal creates only a single object in a given scope:
4078 struct s { int i; };
4079 int f (void)
4081 struct s *p = 0, *q;
4082 int j = 0;
4083 again:
4084 q = p, p = &amp;((struct s){ j++ });
4085 if (j &lt; 2) goto again;
4086 return p == q &amp;&amp; q-&gt;i == 1;
4088 The function f() always returns the value 1.
4089 16 Note that if an iteration statement were used instead of an explicit goto and a labeled statement, the
4090 lifetime of the unnamed object would be the body of the loop only, and on entry next time around p would
4091 have an indeterminate value, which would result in undefined behavior.
4093 Forward references: type names (<a href="#6.7.7">6.7.7</a>), initialization (<a href="#6.7.9">6.7.9</a>).
4095 [<a name="p87" href="#p87">page 87</a>] (<a href="#Contents">Contents</a>)
4097 <a name="6.5.3" href="#6.5.3"><b> 6.5.3 Unary operators</b></a>
4098 <b> Syntax</b>
4099 1 unary-expression:
4100 postfix-expression
4101 ++ unary-expression
4102 -- unary-expression
4103 unary-operator cast-expression
4104 sizeof unary-expression
4105 sizeof ( type-name )
4106 _Alignof ( type-name )
4107 unary-operator: one of
4108 &amp; * + - ~ !
4109 <a name="6.5.3.1" href="#6.5.3.1"><b> 6.5.3.1 Prefix increment and decrement operators</b></a>
4110 <b> Constraints</b>
4111 1 The operand of the prefix increment or decrement operator shall have atomic, qualified,
4112 or unqualified real or pointer type, and shall be a modifiable lvalue.
4113 <b> Semantics</b>
4114 2 The value of the operand of the prefix ++ operator is incremented. The result is the new
4115 value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
4116 See the discussions of additive operators and compound assignment for information on
4117 constraints, types, side effects, and conversions and the effects of operations on pointers.
4118 3 The prefix -- operator is analogous to the prefix ++ operator, except that the value of the
4119 operand is decremented.
4120 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>).
4121 <a name="6.5.3.2" href="#6.5.3.2"><b> 6.5.3.2 Address and indirection operators</b></a>
4122 <b> Constraints</b>
4123 1 The operand of the unary &amp; operator shall be either a function designator, the result of a
4124 [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
4125 not declared with the register storage-class specifier.
4126 2 The operand of the unary * operator shall have pointer type.
4127 <b> Semantics</b>
4128 3 The unary &amp; operator yields the address of its operand. If the operand has type ''type'',
4129 the result has type ''pointer to type''. If the operand is the result of a unary * operator,
4130 neither that operator nor the &amp; operator is evaluated and the result is as if both were
4131 omitted, except that the constraints on the operators still apply and the result is not an
4133 [<a name="p88" href="#p88">page 88</a>] (<a href="#Contents">Contents</a>)
4135 lvalue. Similarly, if the operand is the result of a [] operator, neither the &amp; operator nor
4136 the unary * that is implied by the [] is evaluated and the result is as if the &amp; operator
4137 were removed and the [] operator were changed to a + operator. Otherwise, the result is
4138 a pointer to the object or function designated by its operand.
4139 4 The unary * operator denotes indirection. If the operand points to a function, the result is
4140 a function designator; if it points to an object, the result is an lvalue designating the
4141 object. If the operand has type ''pointer to type'', the result has type ''type''. If an
4142 invalid value has been assigned to the pointer, the behavior of the unary * operator is
4143 undefined.<sup><a href="#note102"><b>102)</b></a></sup>
4144 Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
4145 (<a href="#6.7.2.1">6.7.2.1</a>).
4146 <a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
4147 <b> Constraints</b>
4148 1 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
4149 integer type; of the ! operator, scalar type.
4150 <b> Semantics</b>
4151 2 The result of the unary + operator is the value of its (promoted) operand. The integer
4152 promotions are performed on the operand, and the result has the promoted type.
4153 3 The result of the unary - operator is the negative of its (promoted) operand. The integer
4154 promotions are performed on the operand, and the result has the promoted type.
4155 4 The result of the ~ operator is the bitwise complement of its (promoted) operand (that is,
4156 each bit in the result is set if and only if the corresponding bit in the converted operand is
4157 not set). The integer promotions are performed on the operand, and the result has the
4158 promoted type. If the promoted type is an unsigned type, the expression ~E is equivalent
4159 to the maximum value representable in that type minus E.
4160 5 The result of the logical negation operator ! is 0 if the value of its operand compares
4161 unequal to 0, 1 if the value of its operand compares equal to 0. The result has type int.
4162 The expression !E is equivalent to (0==E).
4166 <sup><a name="note102" href="#note102"><b>102)</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
4167 always true that if E is a function designator or an lvalue that is a valid operand of the unary &amp;
4168 operator, *&amp;E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
4169 an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
4170 Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
4171 address inappropriately aligned for the type of object pointed to, and the address of an object after the
4172 end of its lifetime.
4174 [<a name="p89" href="#p89">page 89</a>] (<a href="#Contents">Contents</a>)
4176 <a name="6.5.3.4" href="#6.5.3.4"><b> 6.5.3.4 The sizeof and _Alignof operators</b></a>
4177 <b> Constraints</b>
4178 1 The sizeof operator shall not be applied to an expression that has function type or an
4179 incomplete type, to the parenthesized name of such a type, or to an expression that
4180 designates a bit-field member. The _Alignof operator shall not be applied to a
4181 function type or an incomplete type.
4182 <b> Semantics</b>
4183 2 The sizeof operator yields the size (in bytes) of its operand, which may be an
4184 expression or the parenthesized name of a type. The size is determined from the type of
4185 the operand. The result is an integer. If the type of the operand is a variable length array
4186 type, the operand is evaluated; otherwise, the operand is not evaluated and the result is an
4187 integer constant.
4188 3 The _Alignof operator yields the alignment requirement of its operand type. The
4189 operand is not evaluated and the result is an integer constant. When applied to an array
4190 type, the result is the alignment requirement of the element type.
4191 4 When sizeof is applied to an operand that has type char, unsigned char, or
4192 signed char, (or a qualified version thereof) the result is 1. When applied to an
4193 operand that has array type, the result is the total number of bytes in the array.<sup><a href="#note103"><b>103)</b></a></sup> When
4194 applied to an operand that has structure or union type, the result is the total number of
4195 bytes in such an object, including internal and trailing padding.
4196 5 The value of the result of both operators is implementation-defined, and its type (an
4197 unsigned integer type) is size_t, defined in <a href="#7.19">&lt;stddef.h&gt;</a> (and other headers).
4198 6 EXAMPLE 1 A principal use of the sizeof operator is in communication with routines such as storage
4199 allocators and I/O systems. A storage-allocation function might accept a size (in bytes) of an object to
4200 allocate and return a pointer to void. For example:
4201 extern void *alloc(size_t);
4202 double *dp = alloc(sizeof *dp);
4203 The implementation of the alloc function should ensure that its return value is aligned suitably for
4204 conversion to a pointer to double.
4206 7 EXAMPLE 2 Another use of the sizeof operator is to compute the number of elements in an array:
4207 sizeof array / sizeof array[0]
4209 8 EXAMPLE 3 In this example, the size of a variable length array is computed and returned from a
4210 function:
4211 #include <a href="#7.19">&lt;stddef.h&gt;</a>
4215 <sup><a name="note103" href="#note103"><b>103)</b></a></sup> When applied to a parameter declared to have array or function type, the sizeof operator yields the
4216 size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
4218 [<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
4220 size_t fsize3(int n)
4222 char b[n+3]; // variable length array
4223 return sizeof b; // execution time sizeof
4225 int main()
4227 size_t size;
4228 size = fsize3(10); // fsize3 returns 13
4229 return 0;
4232 Forward references: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>), declarations (<a href="#6.7">6.7</a>),
4233 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), type names (<a href="#6.7.7">6.7.7</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
4234 <a name="6.5.4" href="#6.5.4"><b> 6.5.4 Cast operators</b></a>
4235 <b> Syntax</b>
4236 1 cast-expression:
4237 unary-expression
4238 ( type-name ) cast-expression
4239 <b> Constraints</b>
4240 2 Unless the type name specifies a void type, the type name shall specify atomic, qualified,
4241 or unqualified scalar type, and the operand shall have scalar type.
4242 3 Conversions that involve pointers, other than where permitted by the constraints of
4243 <a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
4244 4 A pointer type shall not be converted to any floating type. A floating type shall not be
4245 converted to any pointer type.
4246 <b> Semantics</b>
4247 5 Preceding an expression by a parenthesized type name converts the value of the
4248 expression to the named type. This construction is called a cast.<sup><a href="#note104"><b>104)</b></a></sup> A cast that specifies
4249 no conversion has no effect on the type or value of an expression.
4250 6 If the value of the expression is represented with greater range or precision than required
4251 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
4252 type of the expression is the same as the named type and removes any extra range and
4253 precision.
4254 Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
4255 prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
4257 <sup><a name="note104" href="#note104"><b>104)</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
4258 unqualified version of the type.
4260 [<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
4262 <a name="6.5.5" href="#6.5.5"><b> 6.5.5 Multiplicative operators</b></a>
4263 <b> Syntax</b>
4264 1 multiplicative-expression:
4265 cast-expression
4266 multiplicative-expression * cast-expression
4267 multiplicative-expression / cast-expression
4268 multiplicative-expression % cast-expression
4269 <b> Constraints</b>
4270 2 Each of the operands shall have arithmetic type. The operands of the % operator shall
4271 have integer type.
4272 <b> Semantics</b>
4273 3 The usual arithmetic conversions are performed on the operands.
4274 4 The result of the binary * operator is the product of the operands.
4275 5 The result of the / operator is the quotient from the division of the first operand by the
4276 second; the result of the % operator is the remainder. In both operations, if the value of
4277 the second operand is zero, the behavior is undefined.
4278 6 When integers are divided, the result of the / operator is the algebraic quotient with any
4279 fractional part discarded.<sup><a href="#note105"><b>105)</b></a></sup> If the quotient a/b is representable, the expression
4280 (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is
4281 undefined.
4282 <a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
4283 <b> Syntax</b>
4284 1 additive-expression:
4285 multiplicative-expression
4286 additive-expression + multiplicative-expression
4287 additive-expression - multiplicative-expression
4288 <b> Constraints</b>
4289 2 For addition, either both operands shall have arithmetic type, or one operand shall be a
4290 pointer to a complete object type and the other shall have integer type. (Incrementing is
4291 equivalent to adding 1.)
4292 3 For subtraction, one of the following shall hold:
4297 <sup><a name="note105" href="#note105"><b>105)</b></a></sup> This is often called ''truncation toward zero''.
4299 [<a name="p92" href="#p92">page 92</a>] (<a href="#Contents">Contents</a>)
4301 -- both operands have arithmetic type;
4302 -- both operands are pointers to qualified or unqualified versions of compatible complete
4303 object types; or
4304 -- the left operand is a pointer to a complete object type and the right operand has
4305 integer type.
4306 (Decrementing is equivalent to subtracting 1.)
4307 <b> Semantics</b>
4308 4 If both operands have arithmetic type, the usual arithmetic conversions are performed on
4309 them.
4310 5 The result of the binary + operator is the sum of the operands.
4311 6 The result of the binary - operator is the difference resulting from the subtraction of the
4312 second operand from the first.
4313 7 For the purposes of these operators, a pointer to an object that is not an element of an
4314 array behaves the same as a pointer to the first element of an array of length one with the
4315 type of the object as its element type.
4316 8 When an expression that has integer type is added to or subtracted from a pointer, the
4317 result has the type of the pointer operand. If the pointer operand points to an element of
4318 an array object, and the array is large enough, the result points to an element offset from
4319 the original element such that the difference of the subscripts of the resulting and original
4320 array elements equals the integer expression. In other words, if the expression P points to
4321 the i-th element of an array object, the expressions (P)+N (equivalently, N+(P)) and
4322 (P)-N (where N has the value n) point to, respectively, the i+n-th and i-n-th elements of
4323 the array object, provided they exist. Moreover, if the expression P points to the last
4324 element of an array object, the expression (P)+1 points one past the last element of the
4325 array object, and if the expression Q points one past the last element of an array object,
4326 the expression (Q)-1 points to the last element of the array object. If both the pointer
4327 operand and the result point to elements of the same array object, or one past the last
4328 element of the array object, the evaluation shall not produce an overflow; otherwise, the
4329 behavior is undefined. If the result points one past the last element of the array object, it
4330 shall not be used as the operand of a unary * operator that is evaluated.
4331 9 When two pointers are subtracted, both shall point to elements of the same array object,
4332 or one past the last element of the array object; the result is the difference of the
4333 subscripts of the two array elements. The size of the result is implementation-defined,
4334 and its type (a signed integer type) is ptrdiff_t defined in the <a href="#7.19">&lt;stddef.h&gt;</a> header.
4335 If the result is not representable in an object of that type, the behavior is undefined. In
4336 other words, if the expressions P and Q point to, respectively, the i-th and j-th elements of
4337 an array object, the expression (P)-(Q) has the value i-j provided the value fits in an
4339 [<a name="p93" href="#p93">page 93</a>] (<a href="#Contents">Contents</a>)
4341 object of type ptrdiff_t. Moreover, if the expression P points either to an element of
4342 an array object or one past the last element of an array object, and the expression Q points
4343 to the last element of the same array object, the expression ((Q)+1)-(P) has the same
4344 value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
4345 expression P points one past the last element of the array object, even though the
4346 expression (Q)+1 does not point to an element of the array object.<sup><a href="#note106"><b>106)</b></a></sup>
4347 10 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types.
4349 int n = 4, m = 3;
4350 int a[n][m];
4351 int (*p)[m] = a; // p == &amp;a[0]
4352 p += 1; // p == &amp;a[1]
4353 (*p)[2] = 99; // a[1][2] == 99
4354 n = p - a; // n == 1
4356 11 If array a in the above example were declared to be an array of known constant size, and pointer p were
4357 declared to be a pointer to an array of the same known constant size (pointing to a), the results would be
4358 the same.
4360 Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), common definitions <a href="#7.19">&lt;stddef.h&gt;</a>
4361 (<a href="#7.19">7.19</a>).
4362 <a name="6.5.7" href="#6.5.7"><b> 6.5.7 Bitwise shift operators</b></a>
4363 <b> Syntax</b>
4364 1 shift-expression:
4365 additive-expression
4366 shift-expression &lt;&lt; additive-expression
4367 shift-expression &gt;&gt; additive-expression
4368 <b> Constraints</b>
4369 2 Each of the operands shall have integer type.
4370 <b> Semantics</b>
4371 3 The integer promotions are performed on each of the operands. The type of the result is
4372 that of the promoted left operand. If the value of the right operand is negative or is
4374 <sup><a name="note106" href="#note106"><b>106)</b></a></sup> Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
4375 this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
4376 by the size of the object originally pointed to, and the resulting pointer is converted back to the
4377 original type. For pointer subtraction, the result of the difference between the character pointers is
4378 similarly divided by the size of the object originally pointed to.
4379 When viewed in this way, an implementation need only provide one extra byte (which may overlap
4380 another object in the program) just after the end of the object in order to satisfy the ''one past the last
4381 element'' requirements.
4383 [<a name="p94" href="#p94">page 94</a>] (<a href="#Contents">Contents</a>)
4385 greater than or equal to the width of the promoted left operand, the behavior is undefined.
4386 4 The result of E1 &lt;&lt; E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
4387 zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
4388 one more than the maximum value representable in the result type. If E1 has a signed
4389 type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
4390 the resulting value; otherwise, the behavior is undefined.
4391 5 The result of E1 &gt;&gt; E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
4392 or if E1 has a signed type and a nonnegative value, the value of the result is the integral
4393 part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
4394 resulting value is implementation-defined.
4395 <a name="6.5.8" href="#6.5.8"><b> 6.5.8 Relational operators</b></a>
4396 <b> Syntax</b>
4397 1 relational-expression:
4398 shift-expression
4399 relational-expression &lt; shift-expression
4400 relational-expression &gt; shift-expression
4401 relational-expression &lt;= shift-expression
4402 relational-expression &gt;= shift-expression
4403 <b> Constraints</b>
4404 2 One of the following shall hold:
4405 -- both operands have real type; or
4406 -- both operands are pointers to qualified or unqualified versions of compatible object
4407 types.
4408 <b> Semantics</b>
4409 3 If both of the operands have arithmetic type, the usual arithmetic conversions are
4410 performed.
4411 4 For the purposes of these operators, a pointer to an object that is not an element of an
4412 array behaves the same as a pointer to the first element of an array of length one with the
4413 type of the object as its element type.
4414 5 When two pointers are compared, the result depends on the relative locations in the
4415 address space of the objects pointed to. If two pointers to object types both point to the
4416 same object, or both point one past the last element of the same array object, they
4417 compare equal. If the objects pointed to are members of the same aggregate object,
4418 pointers to structure members declared later compare greater than pointers to members
4419 declared earlier in the structure, and pointers to array elements with larger subscript
4420 values compare greater than pointers to elements of the same array with lower subscript
4422 [<a name="p95" href="#p95">page 95</a>] (<a href="#Contents">Contents</a>)
4424 values. All pointers to members of the same union object compare equal. If the
4425 expression P points to an element of an array object and the expression Q points to the
4426 last element of the same array object, the pointer expression Q+1 compares greater than
4427 P. In all other cases, the behavior is undefined.
4428 6 Each of the operators &lt; (less than), &gt; (greater than), &lt;= (less than or equal to), and &gt;=
4429 (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is
4430 false.<sup><a href="#note107"><b>107)</b></a></sup> The result has type int.
4431 <a name="6.5.9" href="#6.5.9"><b> 6.5.9 Equality operators</b></a>
4432 <b> Syntax</b>
4433 1 equality-expression:
4434 relational-expression
4435 equality-expression == relational-expression
4436 equality-expression != relational-expression
4437 <b> Constraints</b>
4438 2 One of the following shall hold:
4439 -- both operands have arithmetic type;
4440 -- both operands are pointers to qualified or unqualified versions of compatible types;
4441 -- one operand is a pointer to an object type and the other is a pointer to a qualified or
4442 unqualified version of void; or
4443 -- one operand is a pointer and the other is a null pointer constant.
4444 <b> Semantics</b>
4445 3 The == (equal to) and != (not equal to) operators are analogous to the relational
4446 operators except for their lower precedence.<sup><a href="#note108"><b>108)</b></a></sup> Each of the operators yields 1 if the
4447 specified relation is true and 0 if it is false. The result has type int. For any pair of
4448 operands, exactly one of the relations is true.
4449 4 If both of the operands have arithmetic type, the usual arithmetic conversions are
4450 performed. Values of complex types are equal if and only if both their real parts are equal
4451 and also their imaginary parts are equal. Any two values of arithmetic types from
4452 different type domains are equal if and only if the results of their conversions to the
4453 (complex) result type determined by the usual arithmetic conversions are equal.
4457 <sup><a name="note107" href="#note107"><b>107)</b></a></sup> The expression a&lt;b&lt;c is not interpreted as in ordinary mathematics. As the syntax indicates, it
4458 means (a&lt;b)&lt;c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
4459 <sup><a name="note108" href="#note108"><b>108)</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.
4461 [<a name="p96" href="#p96">page 96</a>] (<a href="#Contents">Contents</a>)
4463 5 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
4464 null pointer constant, the null pointer constant is converted to the type of the pointer. If
4465 one operand is a pointer to an object type and the other is a pointer to a qualified or
4466 unqualified version of void, the former is converted to the type of the latter.
4467 6 Two pointers compare equal if and only if both are null pointers, both are pointers to the
4468 same object (including a pointer to an object and a subobject at its beginning) or function,
4469 both are pointers to one past the last element of the same array object, or one is a pointer
4470 to one past the end of one array object and the other is a pointer to the start of a different
4471 array object that happens to immediately follow the first array object in the address
4472 space.<sup><a href="#note109"><b>109)</b></a></sup>
4473 7 For the purposes of these operators, a pointer to an object that is not an element of an
4474 array behaves the same as a pointer to the first element of an array of length one with the
4475 type of the object as its element type.
4476 <a name="6.5.10" href="#6.5.10"><b> 6.5.10 Bitwise AND operator</b></a>
4477 <b> Syntax</b>
4478 1 AND-expression:
4479 equality-expression
4480 AND-expression &amp; equality-expression
4481 <b> Constraints</b>
4482 2 Each of the operands shall have integer type.
4483 <b> Semantics</b>
4484 3 The usual arithmetic conversions are performed on the operands.
4485 4 The result of the binary &amp; operator is the bitwise AND of the operands (that is, each bit in
4486 the result is set if and only if each of the corresponding bits in the converted operands is
4487 set).
4492 <sup><a name="note109" href="#note109"><b>109)</b></a></sup> Two objects may be adjacent in memory because they are adjacent elements of a larger array or
4493 adjacent members of a structure with no padding between them, or because the implementation chose
4494 to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
4495 outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
4496 behavior.
4498 [<a name="p97" href="#p97">page 97</a>] (<a href="#Contents">Contents</a>)
4500 <a name="6.5.11" href="#6.5.11"><b> 6.5.11 Bitwise exclusive OR operator</b></a>
4501 <b> Syntax</b>
4502 1 exclusive-OR-expression:
4503 AND-expression
4504 exclusive-OR-expression ^ AND-expression
4505 <b> Constraints</b>
4506 2 Each of the operands shall have integer type.
4507 <b> Semantics</b>
4508 3 The usual arithmetic conversions are performed on the operands.
4509 4 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
4510 in the result is set if and only if exactly one of the corresponding bits in the converted
4511 operands is set).
4512 <a name="6.5.12" href="#6.5.12"><b> 6.5.12 Bitwise inclusive OR operator</b></a>
4513 <b> Syntax</b>
4514 1 inclusive-OR-expression:
4515 exclusive-OR-expression
4516 inclusive-OR-expression | exclusive-OR-expression
4517 <b> Constraints</b>
4518 2 Each of the operands shall have integer type.
4519 <b> Semantics</b>
4520 3 The usual arithmetic conversions are performed on the operands.
4521 4 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
4522 the result is set if and only if at least one of the corresponding bits in the converted
4523 operands is set).
4525 [<a name="p98" href="#p98">page 98</a>] (<a href="#Contents">Contents</a>)
4527 <a name="6.5.13" href="#6.5.13"><b> 6.5.13 Logical AND operator</b></a>
4528 <b> Syntax</b>
4529 1 logical-AND-expression:
4530 inclusive-OR-expression
4531 logical-AND-expression &amp;&amp; inclusive-OR-expression
4532 <b> Constraints</b>
4533 2 Each of the operands shall have scalar type.
4534 <b> Semantics</b>
4535 3 The &amp;&amp; operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
4536 yields 0. The result has type int.
4537 4 Unlike the bitwise binary &amp; operator, the &amp;&amp; operator guarantees left-to-right evaluation;
4538 if the second operand is evaluated, there is a sequence point between the evaluations of
4539 the first and second operands. If the first operand compares equal to 0, the second
4540 operand is not evaluated.
4541 <a name="6.5.14" href="#6.5.14"><b> 6.5.14 Logical OR operator</b></a>
4542 <b> Syntax</b>
4543 1 logical-OR-expression:
4544 logical-AND-expression
4545 logical-OR-expression || logical-AND-expression
4546 <b> Constraints</b>
4547 2 Each of the operands shall have scalar type.
4548 <b> Semantics</b>
4549 3 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
4550 yields 0. The result has type int.
4551 4 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; if the
4552 second operand is evaluated, there is a sequence point between the evaluations of the first
4553 and second operands. If the first operand compares unequal to 0, the second operand is
4554 not evaluated.
4556 [<a name="p99" href="#p99">page 99</a>] (<a href="#Contents">Contents</a>)
4558 <a name="6.5.15" href="#6.5.15"><b> 6.5.15 Conditional operator</b></a>
4559 <b> Syntax</b>
4560 1 conditional-expression:
4561 logical-OR-expression
4562 logical-OR-expression ? expression : conditional-expression
4563 <b> Constraints</b>
4564 2 The first operand shall have scalar type.
4565 3 One of the following shall hold for the second and third operands:
4566 -- both operands have arithmetic type;
4567 -- both operands have the same structure or union type;
4568 -- both operands have void type;
4569 -- both operands are pointers to qualified or unqualified versions of compatible types;
4570 -- one operand is a pointer and the other is a null pointer constant; or
4571 -- one operand is a pointer to an object type and the other is a pointer to a qualified or
4572 unqualified version of void.
4573 <b> Semantics</b>
4574 4 The first operand is evaluated; there is a sequence point between its evaluation and the
4575 evaluation of the second or third operand (whichever is evaluated). The second operand
4576 is evaluated only if the first compares unequal to 0; the third operand is evaluated only if
4577 the first compares equal to 0; the result is the value of the second or third operand
4578 (whichever is evaluated), converted to the type described below.<sup><a href="#note110"><b>110)</b></a></sup>
4579 5 If both the second and third operands have arithmetic type, the result type that would be
4580 determined by the usual arithmetic conversions, were they applied to those two operands,
4581 is the type of the result. If both the operands have structure or union type, the result has
4582 that type. If both operands have void type, the result has void type.
4583 6 If both the second and third operands are pointers or one is a null pointer constant and the
4584 other is a pointer, the result type is a pointer to a type qualified with all the type qualifiers
4585 of the types referenced by both operands. Furthermore, if both operands are pointers to
4586 compatible types or to differently qualified versions of compatible types, the result type is
4587 a pointer to an appropriately qualified version of the composite type; if one operand is a
4588 null pointer constant, the result has the type of the other operand; otherwise, one operand
4589 is a pointer to void or a qualified version of void, in which case the result type is a
4590 pointer to an appropriately qualified version of void.
4592 <sup><a name="note110" href="#note110"><b>110)</b></a></sup> A conditional expression does not yield an lvalue.
4594 [<a name="p100" href="#p100">page 100</a>] (<a href="#Contents">Contents</a>)
4596 7 EXAMPLE The common type that results when the second and third operands are pointers is determined
4597 in two independent stages. The appropriate qualifiers, for example, do not depend on whether the two
4598 pointers have compatible types.
4599 8 Given the declarations
4600 const void *c_vp;
4601 void *vp;
4602 const int *c_ip;
4603 volatile int *v_ip;
4604 int *ip;
4605 const char *c_cp;
4606 the third column in the following table is the common type that is the result of a conditional expression in
4607 which the first two columns are the second and third operands (in either order):
4608 c_vp c_ip const void *
4609 v_ip 0 volatile int *
4610 c_ip v_ip const volatile int *
4611 vp c_cp const void *
4612 ip c_ip const int *
4613 vp ip void *
4615 <a name="6.5.16" href="#6.5.16"><b> 6.5.16 Assignment operators</b></a>
4616 <b> Syntax</b>
4617 1 assignment-expression:
4618 conditional-expression
4619 unary-expression assignment-operator assignment-expression
4620 assignment-operator: one of
4621 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
4622 <b> Constraints</b>
4623 2 An assignment operator shall have a modifiable lvalue as its left operand.
4624 <b> Semantics</b>
4625 3 An assignment operator stores a value in the object designated by the left operand. An
4626 assignment expression has the value of the left operand after the assignment,<sup><a href="#note111"><b>111)</b></a></sup> but is not
4627 an lvalue. The type of an assignment expression is the type the left operand would have
4628 after lvalue conversion. The side effect of updating the stored value of the left operand is
4629 sequenced after the value computations of the left and right operands. The evaluations of
4630 the operands are unsequenced.
4635 <sup><a name="note111" href="#note111"><b>111)</b></a></sup> The implementation is permitted to read the object to determine the value but is not required to, even
4636 when the object has volatile-qualified type.
4638 [<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
4640 <a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
4641 <b> Constraints</b>
4642 1 One of the following shall hold:<sup><a href="#note112"><b>112)</b></a></sup>
4643 -- the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
4644 arithmetic type;
4645 -- the left operand has an atomic, qualified, or unqualified version of a structure or union
4646 type compatible with the type of the right;
4647 -- the left operand has atomic, qualified, or unqualified pointer type, and (considering
4648 the type the left operand would have after lvalue conversion) both operands are
4649 pointers to qualified or unqualified versions of compatible types, and the type pointed
4650 to by the left has all the qualifiers of the type pointed to by the right;
4651 -- the left operand has atomic, qualified, or unqualified pointer type, and (considering
4652 the type the left operand would have after lvalue conversion) one operand is a pointer
4653 to an object type, and the other is a pointer to a qualified or unqualified version of
4654 void, and the type pointed to by the left has all the qualifiers of the type pointed to
4655 by the right;
4656 -- the left operand is an atomic, qualified, or unqualified pointer, and the right is a null
4657 pointer constant; or
4658 -- the left operand has type atomic, qualified, or unqualified _Bool, and the right is a
4659 pointer.
4660 <b> Semantics</b>
4661 2 In simple assignment (=), the value of the right operand is converted to the type of the
4662 assignment expression and replaces the value stored in the object designated by the left
4663 operand.
4664 3 If the value being stored in an object is read from another object that overlaps in any way
4665 the storage of the first object, then the overlap shall be exact and the two objects shall
4666 have qualified or unqualified versions of a compatible type; otherwise, the behavior is
4667 undefined.
4668 4 EXAMPLE 1 In the program fragment
4673 <sup><a name="note112" href="#note112"><b>112)</b></a></sup> The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
4674 (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
4675 qualifiers that were applied to the type category of the expression (for example, it removes const but
4676 not volatile from the type int volatile * const).
4678 [<a name="p102" href="#p102">page 102</a>] (<a href="#Contents">Contents</a>)
4680 int f(void);
4681 char c;
4682 /* ... */
4683 if ((c = f()) == -1)
4684 /* ... */
4685 the int value returned by the function may be truncated when stored in the char, and then converted back
4686 to int width prior to the comparison. In an implementation in which ''plain'' char has the same range of
4687 values as unsigned char (and char is narrower than int), the result of the conversion cannot be
4688 negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
4689 variable c should be declared as int.
4691 5 EXAMPLE 2 In the fragment:
4692 char c;
4693 int i;
4694 long l;
4695 l = (c = i);
4696 the value of i is converted to the type of the assignment expression c = i, that is, char type. The value
4697 of the expression enclosed in parentheses is then converted to the type of the outer assignment expression,
4698 that is, long int type.
4700 6 EXAMPLE 3 Consider the fragment:
4701 const char **cpp;
4702 char *p;
4703 const char c = 'A';
4704 cpp = &amp;p; // constraint violation
4705 *cpp = &amp;c; // valid
4706 *p = 0; // valid
4707 The first assignment is unsafe because it would allow the following valid code to attempt to change the
4708 value of the const object c.
4710 <a name="6.5.16.2" href="#6.5.16.2"><b> 6.5.16.2 Compound assignment</b></a>
4711 <b> Constraints</b>
4712 1 For the operators += and -= only, either the left operand shall be an atomic, qualified, or
4713 unqualified pointer to a complete object type, and the right shall have integer type; or the
4714 left operand shall have atomic, qualified, or unqualified arithmetic type, and the right
4715 shall have arithmetic type.
4716 2 For the other operators, the left operand shall have atomic, qualified, or unqualified
4717 arithmetic type, and (considering the type the left operand would have after lvalue
4718 conversion) each operand shall have arithmetic type consistent with those allowed by the
4719 corresponding binary operator.
4720 <b> Semantics</b>
4721 3 A compound assignment of the form E1 op = E2 is equivalent to the simple assignment
4722 expression E1 = E1 op (E2), except that the lvalue E1 is evaluated only once, and with
4723 respect to an indeterminately-sequenced function call, the operation of a compound
4725 [<a name="p103" href="#p103">page 103</a>] (<a href="#Contents">Contents</a>)
4727 assignment is a single evaluation. If E1 has an atomic type, compound assignment is a
4728 read-modify-write operation with memory_order_seq_cst memory order
4729 semantics.<sup><a href="#note113"><b>113)</b></a></sup>
4734 <sup><a name="note113" href="#note113"><b>113)</b></a></sup> Where a pointer to an atomic object can be formed and E1 and E2 have integer type, this is equivalent
4735 to the following code sequence where T1 is the type of E1 and T2 is the type of E2:
4736 T1 *addr = &amp;E1;
4737 T2 val = (E2);
4738 T1 old = *addr;
4739 T1 new;
4740 do {
4741 new = old op val;
4742 } while (!atomic_compare_exchange_strong(addr, &amp;old, new));
4743 with new being the result of the operation.
4744 If E1 or E2 has floating type, then exceptional conditions or floating-point exceptions encountered
4745 during discarded evaluations of new should also be discarded in order to satisfy the equivalence of E1
4746 op = E2 and E1 = E1 op (E2). For example, if <a href="#F">annex F</a> is in effect, the floating types involved have
4747 IEC 60559 formats, and FLT_EVAL_METHOD is 0, the equivalent code would be:
4748 #include <a href="#7.6">&lt;fenv.h&gt;</a>
4749 #pragma STDC FENV_ACCESS ON
4750 /* ... */
4751 fenv_t fenv;
4752 T1 *addr = &amp;E1;
4753 T2 val = E2;
4754 T1 old = *addr;
4755 T1 new;
4756 feholdexcept(&amp;fenv);
4757 for (;;) {
4758 new = old op val;
4759 if (atomic_compare_exchange_strong(addr, &amp;old, new))
4760 break;
4761 feclearexcept(FE_ALL_EXCEPT);
4763 feupdateenv(&amp;fenv);
4764 If FLT_EVAL_METHOD is not 0, then T2 must be a type with the range and precision to which E2 is
4765 evaluated in order to satisfy the equivalence.
4767 [<a name="p104" href="#p104">page 104</a>] (<a href="#Contents">Contents</a>)
4769 <a name="6.5.17" href="#6.5.17"><b> 6.5.17 Comma operator</b></a>
4770 <b> Syntax</b>
4771 1 expression:
4772 assignment-expression
4773 expression , assignment-expression
4774 <b> Semantics</b>
4775 2 The left operand of a comma operator is evaluated as a void expression; there is a
4776 sequence point between its evaluation and that of the right operand. Then the right
4777 operand is evaluated; the result has its type and value.<sup><a href="#note114"><b>114)</b></a></sup>
4778 3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
4779 appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
4780 of initializers). On the other hand, it can be used within a parenthesized expression or within the second
4781 expression of a conditional operator in such contexts. In the function call
4782 f(a, (t=3, t+2), c)
4783 the function has three arguments, the second of which has the value 5.
4785 Forward references: initialization (<a href="#6.7.9">6.7.9</a>).
4790 <sup><a name="note114" href="#note114"><b>114)</b></a></sup> A comma operator does not yield an lvalue.
4792 [<a name="p105" href="#p105">page 105</a>] (<a href="#Contents">Contents</a>)
4794 <a name="6.6" href="#6.6"><b> 6.6 Constant expressions</b></a>
4795 <b> Syntax</b>
4796 1 constant-expression:
4797 conditional-expression
4798 <b> Description</b>
4799 2 A constant expression can be evaluated during translation rather than runtime, and
4800 accordingly may be used in any place that a constant may be.
4801 <b> Constraints</b>
4802 3 Constant expressions shall not contain assignment, increment, decrement, function-call,
4803 or comma operators, except when they are contained within a subexpression that is not
4804 evaluated.<sup><a href="#note115"><b>115)</b></a></sup>
4805 4 Each constant expression shall evaluate to a constant that is in the range of representable
4806 values for its type.
4807 <b> Semantics</b>
4808 5 An expression that evaluates to a constant is required in several contexts. If a floating
4809 expression is evaluated in the translation environment, the arithmetic range and precision
4810 shall be at least as great as if the expression were being evaluated in the execution
4811 environment.<sup><a href="#note116"><b>116)</b></a></sup>
4812 6 An integer constant expression<sup><a href="#note117"><b>117)</b></a></sup> shall have integer type and shall only have operands
4813 that are integer constants, enumeration constants, character constants, sizeof
4814 expressions whose results are integer constants, _Alignof expressions, and floating
4815 constants that are the immediate operands of casts. Cast operators in an integer constant
4816 expression shall only convert arithmetic types to integer types, except as part of an
4817 operand to the sizeof or _Alignof operator.
4818 7 More latitude is permitted for constant expressions in initializers. Such a constant
4819 expression shall be, or evaluate to, one of the following:
4820 -- an arithmetic constant expression,
4824 <sup><a name="note115" href="#note115"><b>115)</b></a></sup> The operand of a sizeof or _Alignof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
4825 <sup><a name="note116" href="#note116"><b>116)</b></a></sup> The use of evaluation formats as characterized by FLT_EVAL_METHOD also applies to evaluation in
4826 the translation environment.
4827 <sup><a name="note117" href="#note117"><b>117)</b></a></sup> An integer constant expression is required in a number of contexts such as the size of a bit-field
4828 member of a structure, the value of an enumeration constant, and the size of a non-variable length
4829 array. Further constraints that apply to the integer constant expressions used in conditional-inclusion
4830 preprocessing directives are discussed in <a href="#6.10.1">6.10.1</a>.
4832 [<a name="p106" href="#p106">page 106</a>] (<a href="#Contents">Contents</a>)
4834 -- a null pointer constant,
4835 -- an address constant, or
4836 -- an address constant for a complete object type plus or minus an integer constant
4837 expression.
4838 8 An arithmetic constant expression shall have arithmetic type and shall only have
4839 operands that are integer constants, floating constants, enumeration constants, character
4840 constants, sizeof expressions whose results are integer constants, and _Alignof
4841 expressions. Cast operators in an arithmetic constant expression shall only convert
4842 arithmetic types to arithmetic types, except as part of an operand to a sizeof or
4843 _Alignof operator.
4844 9 An address constant is a null pointer, a pointer to an lvalue designating an object of static
4845 storage duration, or a pointer to a function designator; it shall be created explicitly using
4846 the unary &amp; operator or an integer constant cast to pointer type, or implicitly by the use of
4847 an expression of array or function type. The array-subscript [] and member-access .
4848 and -&gt; operators, the address &amp; and indirection * unary operators, and pointer casts may
4849 be used in the creation of an address constant, but the value of an object shall not be
4850 accessed by use of these operators.
4851 10 An implementation may accept other forms of constant expressions.
4852 11 The semantic rules for the evaluation of a constant expression are the same as for
4853 nonconstant expressions.<sup><a href="#note118"><b>118)</b></a></sup>
4854 Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), initialization (<a href="#6.7.9">6.7.9</a>).
4859 <sup><a name="note118" href="#note118"><b>118)</b></a></sup> Thus, in the following initialization,
4860 static int i = 2 || 1 / 0;
4861 the expression is a valid integer constant expression with value one.
4863 [<a name="p107" href="#p107">page 107</a>] (<a href="#Contents">Contents</a>)
4865 <a name="6.7" href="#6.7"><b> 6.7 Declarations</b></a>
4866 <b> Syntax</b>
4867 1 declaration:
4868 declaration-specifiers init-declarator-listopt ;
4869 static_assert-declaration
4870 declaration-specifiers:
4871 storage-class-specifier declaration-specifiersopt
4872 type-specifier declaration-specifiersopt
4873 type-qualifier declaration-specifiersopt
4874 function-specifier declaration-specifiersopt
4875 alignment-specifier declaration-specifiersopt
4876 init-declarator-list:
4877 init-declarator
4878 init-declarator-list , init-declarator
4879 init-declarator:
4880 declarator
4881 declarator = initializer
4882 <b> Constraints</b>
4883 2 A declaration other than a static_assert declaration shall declare at least a declarator
4884 (other than the parameters of a function or the members of a structure or union), a tag, or
4885 the members of an enumeration.
4886 3 If an identifier has no linkage, there shall be no more than one declaration of the identifier
4887 (in a declarator or type specifier) with the same scope and in the same name space, except
4888 that:
4889 -- a typedef name may be redefined to denote the same type as it currently does,
4890 provided that type is not a variably modified type;
4891 -- tags may be redeclared as specified in <a href="#6.7.2.3">6.7.2.3</a>.
4892 4 All declarations in the same scope that refer to the same object or function shall specify
4893 compatible types.
4894 <b> Semantics</b>
4895 5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
4896 of an identifier is a declaration for that identifier that:
4897 -- for an object, causes storage to be reserved for that object;
4898 -- for a function, includes the function body;<sup><a href="#note119"><b>119)</b></a></sup>
4900 [<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
4902 -- for an enumeration constant, is the (only) declaration of the identifier;
4903 -- for a typedef name, is the first (or only) declaration of the identifier.
4904 6 The declaration specifiers consist of a sequence of specifiers that indicate the linkage,
4905 storage duration, and part of the type of the entities that the declarators denote. The init-
4906 declarator-list is a comma-separated sequence of declarators, each of which may have
4907 additional type information, or an initializer, or both. The declarators contain the
4908 identifiers (if any) being declared.
4909 7 If an identifier for an object is declared with no linkage, the type for the object shall be
4910 complete by the end of its declarator, or by the end of its init-declarator if it has an
4911 initializer; in the case of function parameters (including in prototypes), it is the adjusted
4912 type (see <a href="#6.7.6.3">6.7.6.3</a>) that is required to be complete.
4913 Forward references: declarators (<a href="#6.7.6">6.7.6</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
4914 (<a href="#6.7.9">6.7.9</a>), type names (<a href="#6.7.7">6.7.7</a>), type qualifiers (<a href="#6.7.3">6.7.3</a>).
4915 <a name="6.7.1" href="#6.7.1"><b> 6.7.1 Storage-class specifiers</b></a>
4916 <b> Syntax</b>
4917 1 storage-class-specifier:
4918 typedef
4919 extern
4920 static
4921 _Thread_local
4922 auto
4923 register
4924 <b> Constraints</b>
4925 2 At most, one storage-class specifier may be given in the declaration specifiers in a
4926 declaration, except that _Thread_local may appear with static or extern.<sup><a href="#note120"><b>120)</b></a></sup>
4927 3 In the declaration of an object with block scope, if the declaration specifiers include
4928 _Thread_local, they shall also include either static or extern. If
4929 _Thread_local appears in any declaration of an object, it shall be present in every
4930 declaration of that object.
4931 4 _Thread_local shall not appear in the declaration specifiers of a function declaration.
4936 <sup><a name="note119" href="#note119"><b>119)</b></a></sup> Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
4937 <sup><a name="note120" href="#note120"><b>120)</b></a></sup> See ''future language directions'' (<a href="#6.11.5">6.11.5</a>).
4939 [<a name="p109" href="#p109">page 109</a>] (<a href="#Contents">Contents</a>)
4941 <b> Semantics</b>
4942 5 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
4943 only; it is discussed in <a href="#6.7.8">6.7.8</a>. The meanings of the various linkages and storage durations
4944 were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
4945 6 A declaration of an identifier for an object with storage-class specifier register
4946 suggests that access to the object be as fast as possible. The extent to which such
4947 suggestions are effective is implementation-defined.<sup><a href="#note121"><b>121)</b></a></sup>
4948 7 The declaration of an identifier for a function that has block scope shall have no explicit
4949 storage-class specifier other than extern.
4950 8 If an aggregate or union object is declared with a storage-class specifier other than
4951 typedef, the properties resulting from the storage-class specifier, except with respect to
4952 linkage, also apply to the members of the object, and so on recursively for any aggregate
4953 or union member objects.
4954 Forward references: type definitions (<a href="#6.7.8">6.7.8</a>).
4959 <sup><a name="note121" href="#note121"><b>121)</b></a></sup> The implementation may treat any register declaration simply as an auto declaration. However,
4960 whether or not addressable storage is actually used, the address of any part of an object declared with
4961 storage-class specifier register cannot be computed, either explicitly (by use of the unary &amp;
4962 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
4963 <a href="#6.3.2.1">6.3.2.1</a>). Thus, the only operators that can be applied to an array declared with storage-class specifier
4964 register are sizeof and _Alignof.
4966 [<a name="p110" href="#p110">page 110</a>] (<a href="#Contents">Contents</a>)
4968 <a name="6.7.2" href="#6.7.2"><b> 6.7.2 Type specifiers</b></a>
4969 <b> Syntax</b>
4970 1 type-specifier:
4971 void
4972 char
4973 short
4975 long
4976 float
4977 double
4978 signed
4979 unsigned
4980 _Bool
4981 _Complex
4982 atomic-type-specifier
4983 struct-or-union-specifier
4984 enum-specifier
4985 typedef-name
4986 <b> Constraints</b>
4987 2 At least one type specifier shall be given in the declaration specifiers in each declaration,
4988 and in the specifier-qualifier list in each struct declaration and type name. Each list of
4989 type specifiers shall be one of the following multisets (delimited by commas, when there
4990 is more than one multiset per item); the type specifiers may occur in any order, possibly
4991 intermixed with the other declaration specifiers.
4992 -- void
4993 -- char
4994 -- signed char
4995 -- unsigned char
4996 -- short, signed short, short int, or signed short int
4997 -- unsigned short, or unsigned short int
4998 -- int, signed, or signed int
4999 -- unsigned, or unsigned int
5000 -- long, signed long, long int, or signed long int
5001 -- unsigned long, or unsigned long int
5003 [<a name="p111" href="#p111">page 111</a>] (<a href="#Contents">Contents</a>)
5005 -- long long, signed long long, long long int, or
5006 signed long long int
5007 -- unsigned long long, or unsigned long long int
5008 -- float
5009 -- double
5010 -- long double
5011 -- _Bool
5012 -- float _Complex
5013 -- double _Complex
5014 -- long double _Complex
5015 -- atomic type specifier
5016 -- struct or union specifier
5017 -- enum specifier
5018 -- typedef name
5019 3 The type specifier _Complex shall not be used if the implementation does not support
5020 complex types (see <a href="#6.10.8.3">6.10.8.3</a>).
5021 <b> Semantics</b>
5022 4 Specifiers for structures, unions, enumerations, and atomic types are discussed in <a href="#6.7.2.1">6.7.2.1</a>
5023 through <a href="#6.7.2.4">6.7.2.4</a>. Declarations of typedef names are discussed in <a href="#6.7.8">6.7.8</a>. The
5024 characteristics of the other types are discussed in <a href="#6.2.5">6.2.5</a>.
5025 5 Each of the comma-separated multisets designates the same type, except that for bit-
5026 fields, it is implementation-defined whether the specifier int designates the same type as
5027 signed int or the same type as unsigned int.
5028 Forward references: atomic type specifiers (<a href="#6.7.2.4">6.7.2.4</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>),
5029 structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), tags (<a href="#6.7.2.3">6.7.2.3</a>), type definitions (<a href="#6.7.8">6.7.8</a>).
5030 <a name="6.7.2.1" href="#6.7.2.1"><b> 6.7.2.1 Structure and union specifiers</b></a>
5031 <b> Syntax</b>
5032 1 struct-or-union-specifier:
5033 struct-or-union identifieropt { struct-declaration-list }
5034 struct-or-union identifier
5036 [<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
5038 struct-or-union:
5039 struct
5040 union
5041 struct-declaration-list:
5042 struct-declaration
5043 struct-declaration-list struct-declaration
5044 struct-declaration:
5045 specifier-qualifier-list struct-declarator-listopt ;
5046 static_assert-declaration
5047 specifier-qualifier-list:
5048 type-specifier specifier-qualifier-listopt
5049 type-qualifier specifier-qualifier-listopt
5050 struct-declarator-list:
5051 struct-declarator
5052 struct-declarator-list , struct-declarator
5053 struct-declarator:
5054 declarator
5055 declaratoropt : constant-expression
5056 <b> Constraints</b>
5057 2 A struct-declaration that does not declare an anonymous structure or anonymous union
5058 shall contain a struct-declarator-list.
5059 3 A structure or union shall not contain a member with incomplete or function type (hence,
5060 a structure shall not contain an instance of itself, but may contain a pointer to an instance
5061 of itself), except that the last member of a structure with more than one named member
5062 may have incomplete array type; such a structure (and any union containing, possibly
5063 recursively, a member that is such a structure) shall not be a member of a structure or an
5064 element of an array.
5065 4 The expression that specifies the width of a bit-field shall be an integer constant
5066 expression with a nonnegative value that does not exceed the width of an object of the
5067 type that would be specified were the colon and expression omitted.<sup><a href="#note122"><b>122)</b></a></sup> If the value is
5068 zero, the declaration shall have no declarator.
5069 5 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
5070 int, unsigned int, or some other implementation-defined type. It is
5071 implementation-defined whether atomic types are permitted.
5073 <sup><a name="note122" href="#note122"><b>122)</b></a></sup> While the number of bits in a _Bool object is at least CHAR_BIT, the width (number of sign and
5074 value bits) of a _Bool may be just 1 bit.
5076 [<a name="p113" href="#p113">page 113</a>] (<a href="#Contents">Contents</a>)
5078 <b> Semantics</b>
5079 6 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
5080 storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
5081 of members whose storage overlap.
5082 7 Structure and union specifiers have the same form. The keywords struct and union
5083 indicate that the type being specified is, respectively, a structure type or a union type.
5084 8 The presence of a struct-declaration-list in a struct-or-union-specifier declares a new type,
5085 within a translation unit. The struct-declaration-list is a sequence of declarations for the
5086 members of the structure or union. If the struct-declaration-list does not contain any
5087 named members, either directly or via an anonymous structure or anonymous union, the
5088 behavior is undefined. The type is incomplete until immediately after the } that
5089 terminates the list, and complete thereafter.
5090 9 A member of a structure or union may have any complete object type other than a
5091 variably modified type.<sup><a href="#note123"><b>123)</b></a></sup> In addition, a member may be declared to consist of a
5092 specified number of bits (including a sign bit, if any). Such a member is called a
5093 bit-field;<sup><a href="#note124"><b>124)</b></a></sup> its width is preceded by a colon.
5094 10 A bit-field is interpreted as having a signed or unsigned integer type consisting of the
5095 specified number of bits.<sup><a href="#note125"><b>125)</b></a></sup> If the value 0 or 1 is stored into a nonzero-width bit-field of
5096 type _Bool, the value of the bit-field shall compare equal to the value stored; a _Bool
5097 bit-field has the semantics of a _Bool.
5098 11 An implementation may allocate any addressable storage unit large enough to hold a bit-
5099 field. If enough space remains, a bit-field that immediately follows another bit-field in a
5100 structure shall be packed into adjacent bits of the same unit. If insufficient space remains,
5101 whether a bit-field that does not fit is put into the next unit or overlaps adjacent units is
5102 implementation-defined. The order of allocation of bit-fields within a unit (high-order to
5103 low-order or low-order to high-order) is implementation-defined. The alignment of the
5104 addressable storage unit is unspecified.
5105 12 A bit-field declaration with no declarator, but only a colon and a width, indicates an
5106 unnamed bit-field.<sup><a href="#note126"><b>126)</b></a></sup> As a special case, a bit-field structure member with a width of 0
5109 <sup><a name="note123" href="#note123"><b>123)</b></a></sup> A structure or union cannot contain a member with a variably modified type because member names
5110 are not ordinary identifiers as defined in <a href="#6.2.3">6.2.3</a>.
5111 <sup><a name="note124" href="#note124"><b>124)</b></a></sup> The unary &amp; (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to
5112 or arrays of bit-field objects.
5113 <sup><a name="note125" href="#note125"><b>125)</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,
5114 then it is implementation-defined whether the bit-field is signed or unsigned.
5115 <sup><a name="note126" href="#note126"><b>126)</b></a></sup> An unnamed bit-field structure member is useful for padding to conform to externally imposed
5116 layouts.
5118 [<a name="p114" href="#p114">page 114</a>] (<a href="#Contents">Contents</a>)
5120 indicates that no further bit-field is to be packed into the unit in which the previous bit-
5121 field, if any, was placed.
5122 13 An unnamed member whose type specifier is a structure specifier with no tag is called an
5123 anonymous structure; an unnamed member whose type specifier is a union specifier with
5124 no tag is called an anonymous union. The members of an anonymous structure or union
5125 are considered to be members of the containing structure or union. This applies
5126 recursively if the containing structure or union is also anonymous.
5127 14 Each non-bit-field member of a structure or union object is aligned in an implementation-
5128 defined manner appropriate to its type.
5129 15 Within a structure object, the non-bit-field members and the units in which bit-fields
5130 reside have addresses that increase in the order in which they are declared. A pointer to a
5131 structure object, suitably converted, points to its initial member (or if that member is a
5132 bit-field, then to the unit in which it resides), and vice versa. There may be unnamed
5133 padding within a structure object, but not at its beginning.
5134 16 The size of a union is sufficient to contain the largest of its members. The value of at
5135 most one of the members can be stored in a union object at any time. A pointer to a
5136 union object, suitably converted, points to each of its members (or if a member is a bit-
5137 field, then to the unit in which it resides), and vice versa.
5138 17 There may be unnamed padding at the end of a structure or union.
5139 18 As a special case, the last element of a structure with more than one named member may
5140 have an incomplete array type; this is called a flexible array member. In most situations,
5141 the flexible array member is ignored. In particular, the size of the structure is as if the
5142 flexible array member were omitted except that it may have more trailing padding than
5143 the omission would imply. However, when a . (or -&gt;) operator has a left operand that is
5144 (a pointer to) a structure with a flexible array member and the right operand names that
5145 member, it behaves as if that member were replaced with the longest array (with the same
5146 element type) that would not make the structure larger than the object being accessed; the
5147 offset of the array shall remain that of the flexible array member, even if this would differ
5148 from that of the replacement array. If this array would have no elements, it behaves as if
5149 it had one element but the behavior is undefined if any attempt is made to access that
5150 element or to generate a pointer one past it.
5151 19 EXAMPLE 1 The following illustrates anonymous structures and unions:
5152 struct v {
5153 union { // anonymous union
5154 struct { int i, j; }; // anonymous structure
5155 struct { long k, l; } w;
5157 int m;
5158 } v1;
5160 [<a name="p115" href="#p115">page 115</a>] (<a href="#Contents">Contents</a>)
5162 v1.i = 2; // valid
5163 v1.k = 3; // invalid: inner structure is not anonymous
5164 v1.w.k = 5; // valid
5166 20 EXAMPLE 2 After the declaration:
5167 struct s { int n; double d[]; };
5168 the structure struct s has a flexible array member d. A typical way to use this is:
5169 int m = /* some value */;
5170 struct s *p = malloc(sizeof (struct s) + sizeof (double [m]));
5171 and assuming that the call to malloc succeeds, the object pointed to by p behaves, for most purposes, as if
5172 p had been declared as:
5173 struct { int n; double d[m]; } *p;
5174 (there are circumstances in which this equivalence is broken; in particular, the offsets of member d might
5175 not be the same).
5176 21 Following the above declaration:
5177 struct s t1 = { 0 }; // valid
5178 struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
5179 t1.n = 4; // valid
5180 t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
5181 The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
5182 contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
5183 sizeof (struct s) &gt;= offsetof(struct s, d) + sizeof (double)
5184 in which case the assignment would be legitimate. Nevertheless, it cannot appear in strictly conforming
5185 code.
5186 22 After the further declaration:
5187 struct ss { int n; };
5188 the expressions:
5189 sizeof (struct s) &gt;= sizeof (struct ss)
5190 sizeof (struct s) &gt;= offsetof(struct s, d)
5191 are always equal to 1.
5192 23 If sizeof (double) is 8, then after the following code is executed:
5193 struct s *s1;
5194 struct s *s2;
5195 s1 = malloc(sizeof (struct s) + 64);
5196 s2 = malloc(sizeof (struct s) + 46);
5197 and assuming that the calls to malloc succeed, the objects pointed to by s1 and s2 behave, for most
5198 purposes, as if the identifiers had been declared as:
5199 struct { int n; double d[8]; } *s1;
5200 struct { int n; double d[5]; } *s2;
5201 24 Following the further successful assignments:
5203 [<a name="p116" href="#p116">page 116</a>] (<a href="#Contents">Contents</a>)
5205 s1 = malloc(sizeof (struct s) + 10);
5206 s2 = malloc(sizeof (struct s) + 6);
5207 they then behave as if the declarations were:
5208 struct { int n; double d[1]; } *s1, *s2;
5209 and:
5210 double *dp;
5211 dp = &amp;(s1-&gt;d[0]); // valid
5212 *dp = 42; // valid
5213 dp = &amp;(s2-&gt;d[0]); // valid
5214 *dp = 42; // undefined behavior
5215 25 The assignment:
5216 *s1 = *s2;
5217 only copies the member n; if any of the array elements are within the first sizeof (struct s) bytes
5218 of the structure, they might be copied or simply overwritten with indeterminate values.
5220 26 EXAMPLE 3 Because members of anonymous structures and unions are considered to be members of the
5221 containing structure or union, struct s in the following example has more than one named member and
5222 thus the use of a flexible array member is valid:
5223 struct s {
5224 struct { int i; };
5225 int a[];
5228 Forward references: declarators (<a href="#6.7.6">6.7.6</a>), tags (<a href="#6.7.2.3">6.7.2.3</a>).
5229 <a name="6.7.2.2" href="#6.7.2.2"><b> 6.7.2.2 Enumeration specifiers</b></a>
5230 <b> Syntax</b>
5231 1 enum-specifier:
5232 enum identifieropt { enumerator-list }
5233 enum identifieropt { enumerator-list , }
5234 enum identifier
5235 enumerator-list:
5236 enumerator
5237 enumerator-list , enumerator
5238 enumerator:
5239 enumeration-constant
5240 enumeration-constant = constant-expression
5241 <b> Constraints</b>
5242 2 The expression that defines the value of an enumeration constant shall be an integer
5243 constant expression that has a value representable as an int.
5245 [<a name="p117" href="#p117">page 117</a>] (<a href="#Contents">Contents</a>)
5247 <b> Semantics</b>
5248 3 The identifiers in an enumerator list are declared as constants that have type int and
5249 may appear wherever such are permitted.<sup><a href="#note127"><b>127)</b></a></sup> An enumerator with = defines its
5250 enumeration constant as the value of the constant expression. If the first enumerator has
5251 no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
5252 defines its enumeration constant as the value of the constant expression obtained by
5253 adding 1 to the value of the previous enumeration constant. (The use of enumerators with
5254 = may produce enumeration constants with values that duplicate other values in the same
5255 enumeration.) The enumerators of an enumeration are also known as its members.
5256 4 Each enumerated type shall be compatible with char, a signed integer type, or an
5257 unsigned integer type. The choice of type is implementation-defined,<sup><a href="#note128"><b>128)</b></a></sup> but shall be
5258 capable of representing the values of all the members of the enumeration. The
5259 enumerated type is incomplete until immediately after the } that terminates the list of
5260 enumerator declarations, and complete thereafter.
5261 5 EXAMPLE The following fragment:
5262 enum hue { chartreuse, burgundy, claret=20, winedark };
5263 enum hue col, *cp;
5264 col = claret;
5265 cp = &amp;col;
5266 if (*cp != burgundy)
5267 /* ... */
5268 makes hue the tag of an enumeration, and then declares col as an object that has that type and cp as a
5269 pointer to an object that has that type. The enumerated values are in the set { 0, 1, 20, 21 }.
5271 Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
5272 <a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3 Tags</b></a>
5273 <b> Constraints</b>
5274 1 A specific type shall have its content defined at most once.
5275 2 Where two declarations that use the same tag declare the same type, they shall both use
5276 the same choice of struct, union, or enum.
5277 3 A type specifier of the form
5278 enum identifier
5279 without an enumerator list shall only appear after the type it specifies is complete.
5282 <sup><a name="note127" href="#note127"><b>127)</b></a></sup> Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from
5283 each other and from other identifiers declared in ordinary declarators.
5284 <sup><a name="note128" href="#note128"><b>128)</b></a></sup> An implementation may delay the choice of which integer type until all enumeration constants have
5285 been seen.
5287 [<a name="p118" href="#p118">page 118</a>] (<a href="#Contents">Contents</a>)
5289 <b> Semantics</b>
5290 4 All declarations of structure, union, or enumerated types that have the same scope and
5291 use the same tag declare the same type. Irrespective of whether there is a tag or what
5292 other declarations of the type are in the same translation unit, the type is incomplete<sup><a href="#note129"><b>129)</b></a></sup>
5293 until immediately after the closing brace of the list defining the content, and complete
5294 thereafter.
5295 5 Two declarations of structure, union, or enumerated types which are in different scopes or
5296 use different tags declare distinct types. Each declaration of a structure, union, or
5297 enumerated type which does not include a tag declares a distinct type.
5298 6 A type specifier of the form
5299 struct-or-union identifieropt { struct-declaration-list }
5301 enum identifieropt { enumerator-list }
5303 enum identifieropt { enumerator-list , }
5304 declares a structure, union, or enumerated type. The list defines the structure content,
5305 union content, or enumeration content. If an identifier is provided,<sup><a href="#note130"><b>130)</b></a></sup> the type specifier
5306 also declares the identifier to be the tag of that type.
5307 7 A declaration of the form
5308 struct-or-union identifier ;
5309 specifies a structure or union type and declares the identifier as a tag of that type.<sup><a href="#note131"><b>131)</b></a></sup>
5310 8 If a type specifier of the form
5311 struct-or-union identifier
5312 occurs other than as part of one of the above forms, and no other declaration of the
5313 identifier as a tag is visible, then it declares an incomplete structure or union type, and
5314 declares the identifier as the tag of that type.131)
5318 <sup><a name="note129" href="#note129"><b>129)</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
5319 needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
5320 when a pointer to or a function returning a structure or union is being declared. (See incomplete types
5321 in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
5322 <sup><a name="note130" href="#note130"><b>130)</b></a></sup> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
5323 of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
5324 can make use of that typedef name to declare objects having the specified structure, union, or
5325 enumerated type.
5326 <sup><a name="note131" href="#note131"><b>131)</b></a></sup> A similar construction with enum does not exist.
5328 [<a name="p119" href="#p119">page 119</a>] (<a href="#Contents">Contents</a>)
5330 9 If a type specifier of the form
5331 struct-or-union identifier
5333 enum identifier
5334 occurs other than as part of one of the above forms, and a declaration of the identifier as a
5335 tag is visible, then it specifies the same type as that other declaration, and does not
5336 redeclare the tag.
5337 10 EXAMPLE 1 This mechanism allows declaration of a self-referential structure.
5338 struct tnode {
5339 int count;
5340 struct tnode *left, *right;
5342 specifies a structure that contains an integer and two pointers to objects of the same type. Once this
5343 declaration has been given, the declaration
5344 struct tnode s, *sp;
5345 declares s to be an object of the given type and sp to be a pointer to an object of the given type. With
5346 these declarations, the expression sp-&gt;left refers to the left struct tnode pointer of the object to
5347 which sp points; the expression s.right-&gt;count designates the count member of the right struct
5348 tnode pointed to from s.
5349 11 The following alternative formulation uses the typedef mechanism:
5350 typedef struct tnode TNODE;
5351 struct tnode {
5352 int count;
5353 TNODE *left, *right;
5355 TNODE s, *sp;
5357 12 EXAMPLE 2 To illustrate the use of prior declaration of a tag to specify a pair of mutually referential
5358 structures, the declarations
5359 struct s1 { struct s2 *s2p; /* ... */ }; // D1
5360 struct s2 { struct s1 *s1p; /* ... */ }; // D2
5361 specify a pair of structures that contain pointers to each other. Note, however, that if s2 were already
5362 declared as a tag in an enclosing scope, the declaration D1 would refer to it, not to the tag s2 declared in
5363 D2. To eliminate this context sensitivity, the declaration
5364 struct s2;
5365 may be inserted ahead of D1. This declares a new tag s2 in the inner scope; the declaration D2 then
5366 completes the specification of the new type.
5368 Forward references: declarators (<a href="#6.7.6">6.7.6</a>), type definitions (<a href="#6.7.8">6.7.8</a>).
5370 [<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
5372 <a name="6.7.2.4" href="#6.7.2.4"><b> 6.7.2.4 Atomic type specifiers</b></a>
5373 <b> Syntax</b>
5374 1 atomic-type-specifier:
5375 _Atomic ( type-name )
5376 <b> Constraints</b>
5377 2 Atomic type specifiers shall not be used if the implementation does not support atomic
5378 types (see <a href="#6.10.8.3">6.10.8.3</a>).
5379 3 The type name in an atomic type specifier shall not refer to an array type, a function type,
5380 an atomic type, or a qualified type.
5381 <b> Semantics</b>
5382 4 The properties associated with atomic types are meaningful only for expressions that are
5383 lvalues. If the _Atomic keyword is immediately followed by a left parenthesis, it is
5384 interpreted as a type specifier (with a type name), not as a type qualifier.
5385 <a name="6.7.3" href="#6.7.3"><b> 6.7.3 Type qualifiers</b></a>
5386 <b> Syntax</b>
5387 1 type-qualifier:
5388 const
5389 restrict
5390 volatile
5391 _Atomic
5392 <b> Constraints</b>
5393 2 Types other than pointer types whose referenced type is an object type shall not be
5394 restrict-qualified.
5395 3 The type modified by the _Atomic qualifier shall not be an array type or a function
5396 type.
5397 <b> Semantics</b>
5398 4 The properties associated with qualified types are meaningful only for expressions that
5399 are lvalues.<sup><a href="#note132"><b>132)</b></a></sup>
5400 5 If the same qualifier appears more than once in the same specifier-qualifier-list, either
5401 directly or via one or more typedefs, the behavior is the same as if it appeared only
5402 once. If other qualifiers appear along with the _Atomic qualifier in a specifier-qualifier-
5404 <sup><a name="note132" href="#note132"><b>132)</b></a></sup> The implementation may place a const object that is not volatile in a read-only region of
5405 storage. Moreover, the implementation need not allocate storage for such an object if its address is
5406 never used.
5408 [<a name="p121" href="#p121">page 121</a>] (<a href="#Contents">Contents</a>)
5410 list, the resulting type is the so-qualified atomic type.
5411 6 If an attempt is made to modify an object defined with a const-qualified type through use
5412 of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
5413 made to refer to an object defined with a volatile-qualified type through use of an lvalue
5414 with non-volatile-qualified type, the behavior is undefined.<sup><a href="#note133"><b>133)</b></a></sup>
5415 7 An object that has volatile-qualified type may be modified in ways unknown to the
5416 implementation or have other unknown side effects. Therefore any expression referring
5417 to such an object shall be evaluated strictly according to the rules of the abstract machine,
5418 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
5419 object shall agree with that prescribed by the abstract machine, except as modified by the
5420 unknown factors mentioned previously.<sup><a href="#note134"><b>134)</b></a></sup> What constitutes an access to an object that
5421 has volatile-qualified type is implementation-defined.
5422 8 An object that is accessed through a restrict-qualified pointer has a special association
5423 with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
5424 that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note135"><b>135)</b></a></sup> The intended
5425 use of the restrict qualifier (like the register storage class) is to promote
5426 optimization, and deleting all instances of the qualifier from all preprocessing translation
5427 units composing a conforming program does not change its meaning (i.e., observable
5428 behavior).
5429 9 If the specification of an array type includes any type qualifiers, the element type is so-
5430 qualified, not the array type. If the specification of a function type includes any type
5431 qualifiers, the behavior is undefined.<sup><a href="#note136"><b>136)</b></a></sup>
5432 10 For two qualified types to be compatible, both shall have the identically qualified version
5433 of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
5434 does not affect the specified type.
5435 11 EXAMPLE 1 An object declared
5436 extern const volatile int real_time_clock;
5440 <sup><a name="note133" href="#note133"><b>133)</b></a></sup> This applies to those objects that behave as if they were defined with qualified types, even if they are
5441 never actually defined as objects in the program (such as an object at a memory-mapped input/output
5442 address).
5443 <sup><a name="note134" href="#note134"><b>134)</b></a></sup> A volatile declaration may be used to describe an object corresponding to a memory-mapped
5444 input/output port or an object accessed by an asynchronously interrupting function. Actions on
5445 objects so declared shall not be ''optimized out'' by an implementation or reordered except as
5446 permitted by the rules for evaluating expressions.
5447 <sup><a name="note135" href="#note135"><b>135)</b></a></sup> For example, a statement that assigns a value returned by malloc to a single pointer establishes this
5448 association between the allocated object and the pointer.
5449 <sup><a name="note136" href="#note136"><b>136)</b></a></sup> Both of these can occur through the use of typedefs.
5451 [<a name="p122" href="#p122">page 122</a>] (<a href="#Contents">Contents</a>)
5453 may be modifiable by hardware, but cannot be assigned to, incremented, or decremented.
5455 12 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
5456 modify an aggregate type:
5457 const struct s { int mem; } cs = { 1 };
5458 struct s ncs; // the object ncs is modifiable
5459 typedef int A[2][3];
5460 const A a = {{4, 5, 6}, {7, 8, 9}}; // array of array of const int
5461 int *pi;
5462 const int *pci;
5463 ncs = cs; // valid
5464 cs = ncs; // violates modifiable lvalue constraint for =
5465 pi = &amp;ncs.mem; // valid
5466 pi = &amp;cs.mem; // violates type constraints for =
5467 pci = &amp;cs.mem; // valid
5468 pi = a[0]; // invalid: a[0] has type ''const int *''
5470 13 EXAMPLE 3 The declaration
5471 _Atomic volatile int *p;
5472 specifies that p has the type ''pointer to volatile atomic int'', a pointer to a volatile-qualified atomic type.
5474 <a name="6.7.3.1" href="#6.7.3.1"><b> 6.7.3.1 Formal definition of restrict</b></a>
5475 1 Let D be a declaration of an ordinary identifier that provides a means of designating an
5476 object P as a restrict-qualified pointer to type T.
5477 2 If D appears inside a block and does not have storage class extern, let B denote the
5478 block. If D appears in the list of parameter declarations of a function definition, let B
5479 denote the associated block. Otherwise, let B denote the block of main (or the block of
5480 whatever function is called at program startup in a freestanding environment).
5481 3 In what follows, a pointer expression E is said to be based on object P if (at some
5482 sequence point in the execution of B prior to the evaluation of E) modifying P to point to
5483 a copy of the array object into which it formerly pointed would change the value of E.<sup><a href="#note137"><b>137)</b></a></sup>
5484 Note that ''based'' is defined only for expressions with pointer types.
5485 4 During each execution of B, let L be any lvalue that has &amp;L based on P. If L is used to
5486 access the value of the object X that it designates, and X is also modified (by any means),
5487 then the following requirements apply: T shall not be const-qualified. Every other lvalue
5488 used to access the value of X shall also have its address based on P. Every access that
5489 modifies X shall be considered also to modify P, for the purposes of this subclause. If P
5490 is assigned the value of a pointer expression E that is based on another restricted pointer
5493 <sup><a name="note137" href="#note137"><b>137)</b></a></sup> In other words, E depends on the value of P itself rather than on the value of an object referenced
5494 indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
5495 expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
5496 expressions *p and p[1] are not.
5498 [<a name="p123" href="#p123">page 123</a>] (<a href="#Contents">Contents</a>)
5500 object P2, associated with block B2, then either the execution of B2 shall begin before
5501 the execution of B, or the execution of B2 shall end prior to the assignment. If these
5502 requirements are not met, then the behavior is undefined.
5503 5 Here an execution of B means that portion of the execution of the program that would
5504 correspond to the lifetime of an object with scalar type and automatic storage duration
5505 associated with B.
5506 6 A translator is free to ignore any or all aliasing implications of uses of restrict.
5507 7 EXAMPLE 1 The file scope declarations
5508 int * restrict a;
5509 int * restrict b;
5510 extern int c[];
5511 assert that if an object is accessed using one of a, b, or c, and that object is modified anywhere in the
5512 program, then it is never accessed using either of the other two.
5514 8 EXAMPLE 2 The function parameter declarations in the following example
5515 void f(int n, int * restrict p, int * restrict q)
5517 while (n-- &gt; 0)
5518 *p++ = *q++;
5520 assert that, during each execution of the function, if an object is accessed through one of the pointer
5521 parameters, then it is not also accessed through the other.
5522 9 The benefit of the restrict qualifiers is that they enable a translator to make an effective dependence
5523 analysis of function f without examining any of the calls of f in the program. The cost is that the
5524 programmer has to examine all of those calls to ensure that none give undefined behavior. For example, the
5525 second call of f in g has undefined behavior because each of d[1] through d[49] is accessed through
5526 both p and q.
5527 void g(void)
5529 extern int d[100];
5530 f(50, d + 50, d); // valid
5531 f(50, d + 1, d); // undefined behavior
5534 10 EXAMPLE 3 The function parameter declarations
5535 void h(int n, int * restrict p, int * restrict q, int * restrict r)
5537 int i;
5538 for (i = 0; i &lt; n; i++)
5539 p[i] = q[i] + r[i];
5541 illustrate how an unmodified object can be aliased through two restricted pointers. In particular, if a and b
5542 are disjoint arrays, a call of the form h(100, a, b, b) has defined behavior, because array b is not
5543 modified within function h.
5545 [<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
5547 11 EXAMPLE 4 The rule limiting assignments between restricted pointers does not distinguish between a
5548 function call and an equivalent nested block. With one exception, only ''outer-to-inner'' assignments
5549 between restricted pointers declared in nested blocks have defined behavior.
5551 int * restrict p1;
5552 int * restrict q1;
5553 p1 = q1; // undefined behavior
5555 int * restrict p2 = p1; // valid
5556 int * restrict q2 = q1; // valid
5557 p1 = q2; // undefined behavior
5558 p2 = q2; // undefined behavior
5561 12 The one exception allows the value of a restricted pointer to be carried out of the block in which it (or, more
5562 precisely, the ordinary identifier used to designate it) is declared when that block finishes execution. For
5563 example, this permits new_vector to return a vector.
5564 typedef struct { int n; float * restrict v; } vector;
5565 vector new_vector(int n)
5567 vector t;
5568 t.n = n;
5569 t.v = malloc(n * sizeof (float));
5570 return t;
5573 <a name="6.7.4" href="#6.7.4"><b> 6.7.4 Function specifiers</b></a>
5574 <b> Syntax</b>
5575 1 function-specifier:
5576 inline
5577 _Noreturn
5578 <b> Constraints</b>
5579 2 Function specifiers shall be used only in the declaration of an identifier for a function.
5580 3 An inline definition of a function with external linkage shall not contain a definition of a
5581 modifiable object with static or thread storage duration, and shall not contain a reference
5582 to an identifier with internal linkage.
5583 4 In a hosted environment, no function specifier(s) shall appear in a declaration of main.
5584 <b> Semantics</b>
5585 5 A function specifier may appear more than once; the behavior is the same as if it
5586 appeared only once.
5587 6 A function declared with an inline function specifier is an inline function. Making a
5588 function an inline function suggests that calls to the function be as fast as possible.<sup><a href="#note138"><b>138)</b></a></sup>
5590 [<a name="p125" href="#p125">page 125</a>] (<a href="#Contents">Contents</a>)
5592 The extent to which such suggestions are effective is implementation-defined.<sup><a href="#note139"><b>139)</b></a></sup>
5593 7 Any function with internal linkage can be an inline function. For a function with external
5594 linkage, the following restrictions apply: If a function is declared with an inline
5595 function specifier, then it shall also be defined in the same translation unit. If all of the
5596 file scope declarations for a function in a translation unit include the inline function
5597 specifier without extern, then the definition in that translation unit is an inline
5598 definition. An inline definition does not provide an external definition for the function,
5599 and does not forbid an external definition in another translation unit. An inline definition
5600 provides an alternative to an external definition, which a translator may use to implement
5601 any call to the function in the same translation unit. It is unspecified whether a call to the
5602 function uses the inline definition or the external definition.<sup><a href="#note140"><b>140)</b></a></sup>
5603 8 A function declared with a _Noreturn function specifier shall not return to its caller.
5604 Recommended practice
5605 9 The implementation should produce a diagnostic message for a function declared with a
5606 _Noreturn function specifier that appears to be capable of returning to its caller.
5607 10 EXAMPLE 1 The declaration of an inline function with external linkage can result in either an external
5608 definition, or a definition available for use only within the translation unit. A file scope declaration with
5609 extern creates an external definition. The following example shows an entire translation unit.
5610 inline double fahr(double t)
5612 return (9.0 * t) / 5.0 + 32.0;
5614 inline double cels(double t)
5616 return (5.0 * (t - 32.0)) / 9.0;
5618 extern double fahr(double); // creates an external definition
5623 <sup><a name="note138" href="#note138"><b>138)</b></a></sup> By using, for example, an alternative to the usual function call mechanism, such as ''inline
5624 substitution''. Inline substitution is not textual substitution, nor does it create a new function.
5625 Therefore, for example, the expansion of a macro used within the body of the function uses the
5626 definition it had at the point the function body appears, and not where the function is called; and
5627 identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
5628 single address, regardless of the number of inline definitions that occur in addition to the external
5629 definition.
5630 <sup><a name="note139" href="#note139"><b>139)</b></a></sup> For example, an implementation might never perform inline substitution, or might only perform inline
5631 substitutions to calls in the scope of an inline declaration.
5632 <sup><a name="note140" href="#note140"><b>140)</b></a></sup> Since an inline definition is distinct from the corresponding external definition and from any other
5633 corresponding inline definitions in other translation units, all corresponding objects with static storage
5634 duration are also distinct in each of the definitions.
5636 [<a name="p126" href="#p126">page 126</a>] (<a href="#Contents">Contents</a>)
5638 double convert(int is_fahr, double temp)
5640 /* A translator may perform inline substitutions */
5641 return is_fahr ? cels(temp) : fahr(temp);
5643 11 Note that the definition of fahr is an external definition because fahr is also declared with extern, but
5644 the definition of cels is an inline definition. Because cels has external linkage and is referenced, an
5645 external definition has to appear in another translation unit (see <a href="#6.9">6.9</a>); the inline definition and the external
5646 definition are distinct and either may be used for the call.
5648 12 EXAMPLE 2
5649 _Noreturn void f () {
5650 abort(); // ok
5652 _Noreturn void g (int i) { // causes undefined behavior if i &lt;= 0
5653 if (i &gt; 0) abort();
5656 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>).
5657 <a name="6.7.5" href="#6.7.5"><b> 6.7.5 Alignment specifier</b></a>
5658 <b> Syntax</b>
5659 1 alignment-specifier:
5660 _Alignas ( type-name )
5661 _Alignas ( constant-expression )
5662 <b> Constraints</b>
5663 2 An alignment attribute shall not be specified in a declaration of a typedef, or a bit-field, or
5664 a function, or a parameter, or an object declared with the register storage-class
5665 specifier.
5666 3 The constant expression shall be an integer constant expression. It shall evaluate to a
5667 valid fundamental alignment, or to a valid extended alignment supported by the
5668 implementation in the context in which it appears, or to zero.
5669 4 The combined effect of all alignment attributes in a declaration shall not specify an
5670 alignment that is less strict than the alignment that would otherwise be required for the
5671 type of the object or member being declared.
5672 <b> Semantics</b>
5673 5 The first form is equivalent to _Alignas (_Alignof (type-name)).
5674 6 The alignment requirement of the declared object or member is taken to be the specified
5675 alignment. An alignment specification of zero has no effect.<sup><a href="#note141"><b>141)</b></a></sup> When multiple
5676 alignment specifiers occur in a declaration, the effective alignment requirement is the
5677 strictest specified alignment.
5679 [<a name="p127" href="#p127">page 127</a>] (<a href="#Contents">Contents</a>)
5681 7 If the definition of an object has an alignment specifier, any other declaration of that
5682 object shall either specify equivalent alignment or have no alignment specifier. If the
5683 definition of an object does not have an alignment specifier, any other declaration of that
5684 object shall also have no alignment specifier. If declarations of an object in different
5685 translation units have different alignment specifiers, the behavior is undefined.
5686 <a name="6.7.6" href="#6.7.6"><b> 6.7.6 Declarators</b></a>
5687 <b> Syntax</b>
5688 1 declarator:
5689 pointeropt direct-declarator
5690 direct-declarator:
5691 identifier
5692 ( declarator )
5693 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
5694 direct-declarator [ static type-qualifier-listopt assignment-expression ]
5695 direct-declarator [ type-qualifier-list static assignment-expression ]
5696 direct-declarator [ type-qualifier-listopt * ]
5697 direct-declarator ( parameter-type-list )
5698 direct-declarator ( identifier-listopt )
5699 pointer:
5700 * type-qualifier-listopt
5701 * type-qualifier-listopt pointer
5702 type-qualifier-list:
5703 type-qualifier
5704 type-qualifier-list type-qualifier
5705 parameter-type-list:
5706 parameter-list
5707 parameter-list , ...
5708 parameter-list:
5709 parameter-declaration
5710 parameter-list , parameter-declaration
5711 parameter-declaration:
5712 declaration-specifiers declarator
5713 declaration-specifiers abstract-declaratoropt
5717 <sup><a name="note141" href="#note141"><b>141)</b></a></sup> An alignment specification of zero also does not affect other alignment specifications in the same
5718 declaration.
5720 [<a name="p128" href="#p128">page 128</a>] (<a href="#Contents">Contents</a>)
5722 identifier-list:
5723 identifier
5724 identifier-list , identifier
5725 <b> Semantics</b>
5726 2 Each declarator declares one identifier, and asserts that when an operand of the same
5727 form as the declarator appears in an expression, it designates a function or object with the
5728 scope, storage duration, and type indicated by the declaration specifiers.
5729 3 A full declarator is a declarator that is not part of another declarator. The end of a full
5730 declarator is a sequence point. If, in the nested sequence of declarators in a full
5731 declarator, there is a declarator specifying a variable length array type, the type specified
5732 by the full declarator is said to be variably modified. Furthermore, any type derived by
5733 declarator type derivation from a variably modified type is itself variably modified.
5734 4 In the following subclauses, consider a declaration
5735 T D1
5736 where T contains the declaration specifiers that specify a type T (such as int) and D1 is
5737 a declarator that contains an identifier ident. The type specified for the identifier ident in
5738 the various forms of declarator is described inductively using this notation.
5739 5 If, in the declaration ''T D1'', D1 has the form
5740 identifier
5741 then the type specified for ident is T .
5742 6 If, in the declaration ''T D1'', D1 has the form
5743 ( D )
5744 then ident has the type specified by the declaration ''T D''. Thus, a declarator in
5745 parentheses is identical to the unparenthesized declarator, but the binding of complicated
5746 declarators may be altered by parentheses.
5747 Implementation limits
5748 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
5749 function declarators that modify an arithmetic, structure, union, or void type, either
5750 directly or via one or more typedefs.
5751 Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>), type definitions (<a href="#6.7.8">6.7.8</a>).
5753 [<a name="p129" href="#p129">page 129</a>] (<a href="#Contents">Contents</a>)
5755 <a name="6.7.6.1" href="#6.7.6.1"><b> 6.7.6.1 Pointer declarators</b></a>
5756 <b> Semantics</b>
5757 1 If, in the declaration ''T D1'', D1 has the form
5758 * type-qualifier-listopt D
5759 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5760 T '', then the type specified for ident is ''derived-declarator-type-list type-qualifier-list
5761 pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
5762 2 For two pointer types to be compatible, both shall be identically qualified and both shall
5763 be pointers to compatible types.
5764 3 EXAMPLE The following pair of declarations demonstrates the difference between a ''variable pointer
5765 to a constant value'' and a ''constant pointer to a variable value''.
5766 const int *ptr_to_constant;
5767 int *const constant_ptr;
5768 The contents of any object pointed to by ptr_to_constant shall not be modified through that pointer,
5769 but ptr_to_constant itself may be changed to point to another object. Similarly, the contents of the
5770 int pointed to by constant_ptr may be modified, but constant_ptr itself shall always point to the
5771 same location.
5772 4 The declaration of the constant pointer constant_ptr may be clarified by including a definition for the
5773 type ''pointer to int''.
5774 typedef int *int_ptr;
5775 const int_ptr constant_ptr;
5776 declares constant_ptr as an object that has type ''const-qualified pointer to int''.
5778 <a name="6.7.6.2" href="#6.7.6.2"><b> 6.7.6.2 Array declarators</b></a>
5779 <b> Constraints</b>
5780 1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
5781 an expression or *. If they delimit an expression (which specifies the size of an array), the
5782 expression shall have an integer type. If the expression is a constant expression, it shall
5783 have a value greater than zero. The element type shall not be an incomplete or function
5784 type. The optional type qualifiers and the keyword static shall appear only in a
5785 declaration of a function parameter with an array type, and then only in the outermost
5786 array type derivation.
5787 2 If an identifier is declared as having a variably modified type, it shall be an ordinary
5788 identifier (as defined in <a href="#6.2.3">6.2.3</a>), have no linkage, and have either block scope or function
5789 prototype scope. If an identifier is declared to be an object with static or thread storage
5790 duration, it shall not have a variable length array type.
5792 [<a name="p130" href="#p130">page 130</a>] (<a href="#Contents">Contents</a>)
5794 <b> Semantics</b>
5795 3 If, in the declaration ''T D1'', D1 has one of the forms:
5796 D[ type-qualifier-listopt assignment-expressionopt ]
5797 D[ static type-qualifier-listopt assignment-expression ]
5798 D[ type-qualifier-list static assignment-expression ]
5799 D[ type-qualifier-listopt * ]
5800 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5801 T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.<sup><a href="#note142"><b>142)</b></a></sup>
5802 (See <a href="#6.7.6.3">6.7.6.3</a> for the meaning of the optional type qualifiers and the keyword static.)
5803 4 If the size is not present, the array type is an incomplete type. If the size is * instead of
5804 being an expression, the array type is a variable length array type of unspecified size,
5805 which can only be used in declarations or type names with function prototype scope;<sup><a href="#note143"><b>143)</b></a></sup>
5806 such arrays are nonetheless complete types. If the size is an integer constant expression
5807 and the element type has a known constant size, the array type is not a variable length
5808 array type; otherwise, the array type is a variable length array type. (Variable length
5809 arrays are a conditional feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.)
5810 5 If the size is an expression that is not an integer constant expression: if it occurs in a
5811 declaration at function prototype scope, it is treated as if it were replaced by *; otherwise,
5812 each time it is evaluated it shall have a value greater than zero. The size of each instance
5813 of a variable length array type does not change during its lifetime. Where a size
5814 expression is part of the operand of a sizeof operator and changing the value of the
5815 size expression would not affect the result of the operator, it is unspecified whether or not
5816 the size expression is evaluated.
5817 6 For two array types to be compatible, both shall have compatible element types, and if
5818 both size specifiers are present, and are integer constant expressions, then both size
5819 specifiers shall have the same constant value. If the two array types are used in a context
5820 which requires them to be compatible, it is undefined behavior if the two size specifiers
5821 evaluate to unequal values.
5822 7 EXAMPLE 1
5823 float fa[11], *afp[17];
5824 declares an array of float numbers and an array of pointers to float numbers.
5826 8 EXAMPLE 2 Note the distinction between the declarations
5831 <sup><a name="note142" href="#note142"><b>142)</b></a></sup> When several ''array of'' specifications are adjacent, a multidimensional array is declared.
5832 <sup><a name="note143" href="#note143"><b>143)</b></a></sup> Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.6.3">6.7.6.3</a>).
5834 [<a name="p131" href="#p131">page 131</a>] (<a href="#Contents">Contents</a>)
5836 extern int *x;
5837 extern int y[];
5838 The first declares x to be a pointer to int; the second declares y to be an array of int of unspecified size
5839 (an incomplete type), the storage for which is defined elsewhere.
5841 9 EXAMPLE 3 The following declarations demonstrate the compatibility rules for variably modified types.
5842 extern int n;
5843 extern int m;
5844 void fcompat(void)
5846 int a[n][6][m];
5847 int (*p)[4][n+1];
5848 int c[n][n][6][m];
5849 int (*r)[n][n][n+1];
5850 p = a; // invalid: not compatible because 4 != 6
5851 r = c; // compatible, but defined behavior only if
5852 // n == 6 and m == n+1
5855 10 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
5856 function prototype scope. Array objects declared with the _Thread_local, static, or extern
5857 storage-class specifier cannot have a variable length array (VLA) type. However, an object declared with
5858 the static storage-class specifier can have a VM type (that is, a pointer to a VLA type). Finally, all
5859 identifiers declared with a VM type have to be ordinary identifiers and cannot, therefore, be members of
5860 structures or unions.
5861 extern int n;
5862 int A[n]; // invalid: file scope VLA
5863 extern int (*p2)[n]; // invalid: file scope VM
5864 int B[100]; // valid: file scope but not VM
5865 void fvla(int m, int C[m][m]); // valid: VLA with prototype scope
5866 void fvla(int m, int C[m][m]) // valid: adjusted to auto pointer to VLA
5868 typedef int VLA[m][m]; // valid: block scope typedef VLA
5869 struct tag {
5870 int (*y)[n]; // invalid: y not ordinary identifier
5871 int z[n]; // invalid: z not ordinary identifier
5873 int D[m]; // valid: auto VLA
5874 static int E[m]; // invalid: static block scope VLA
5875 extern int F[m]; // invalid: F has linkage and is VLA
5876 int (*s)[m]; // valid: auto pointer to VLA
5877 extern int (*r)[m]; // invalid: r has linkage and points to VLA
5878 static int (*q)[m] = &amp;B; // valid: q is a static block pointer to VLA
5881 Forward references: function declarators (<a href="#6.7.6.3">6.7.6.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
5882 initialization (<a href="#6.7.9">6.7.9</a>).
5884 [<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
5886 <a name="6.7.6.3" href="#6.7.6.3"><b> 6.7.6.3 Function declarators (including prototypes)</b></a>
5887 <b> Constraints</b>
5888 1 A function declarator shall not specify a return type that is a function type or an array
5889 type.
5890 2 The only storage-class specifier that shall occur in a parameter declaration is register.
5891 3 An identifier list in a function declarator that is not part of a definition of that function
5892 shall be empty.
5893 4 After adjustment, the parameters in a parameter type list in a function declarator that is
5894 part of a definition of that function shall not have incomplete type.
5895 <b> Semantics</b>
5896 5 If, in the declaration ''T D1'', D1 has the form
5897 D( parameter-type-list )
5899 D( identifier-listopt )
5900 and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
5901 T '', then the type specified for ident is ''derived-declarator-type-list function returning
5902 T ''.
5903 6 A parameter type list specifies the types of, and may declare identifiers for, the
5904 parameters of the function.
5905 7 A declaration of a parameter as ''array of type'' shall be adjusted to ''qualified pointer to
5906 type'', where the type qualifiers (if any) are those specified within the [ and ] of the
5907 array type derivation. If the keyword static also appears within the [ and ] of the
5908 array type derivation, then for each call to the function, the value of the corresponding
5909 actual argument shall provide access to the first element of an array with at least as many
5910 elements as specified by the size expression.
5911 8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
5912 function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
5913 9 If the list terminates with an ellipsis (, ...), no information about the number or types
5914 of the parameters after the comma is supplied.<sup><a href="#note144"><b>144)</b></a></sup>
5915 10 The special case of an unnamed parameter of type void as the only item in the list
5916 specifies that the function has no parameters.
5920 <sup><a name="note144" href="#note144"><b>144)</b></a></sup> The macros defined in the <a href="#7.16">&lt;stdarg.h&gt;</a> header (<a href="#7.16">7.16</a>) may be used to access arguments that
5921 correspond to the ellipsis.
5923 [<a name="p133" href="#p133">page 133</a>] (<a href="#Contents">Contents</a>)
5925 11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
5926 parameter name, it shall be taken as a typedef name.
5927 12 If the function declarator is not part of a definition of that function, parameters may have
5928 incomplete type and may use the [*] notation in their sequences of declarator specifiers
5929 to specify variable length array types.
5930 13 The storage-class specifier in the declaration specifiers for a parameter declaration, if
5931 present, is ignored unless the declared parameter is one of the members of the parameter
5932 type list for a function definition.
5933 14 An identifier list declares only the identifiers of the parameters of the function. An empty
5934 list in a function declarator that is part of a definition of that function specifies that the
5935 function has no parameters. The empty list in a function declarator that is not part of a
5936 definition of that function specifies that no information about the number or types of the
5937 parameters is supplied.<sup><a href="#note145"><b>145)</b></a></sup>
5938 15 For two function types to be compatible, both shall specify compatible return types.<sup><a href="#note146"><b>146)</b></a></sup>
5939 Moreover, the parameter type lists, if both are present, shall agree in the number of
5940 parameters and in use of the ellipsis terminator; corresponding parameters shall have
5941 compatible types. If one type has a parameter type list and the other type is specified by a
5942 function declarator that is not part of a function definition and that contains an empty
5943 identifier list, the parameter list shall not have an ellipsis terminator and the type of each
5944 parameter shall be compatible with the type that results from the application of the
5945 default argument promotions. If one type has a parameter type list and the other type is
5946 specified by a function definition that contains a (possibly empty) identifier list, both shall
5947 agree in the number of parameters, and the type of each prototype parameter shall be
5948 compatible with the type that results from the application of the default argument
5949 promotions to the type of the corresponding identifier. (In the determination of type
5950 compatibility and of a composite type, each parameter declared with function or array
5951 type is taken as having the adjusted type and each parameter declared with qualified type
5952 is taken as having the unqualified version of its declared type.)
5953 16 EXAMPLE 1 The declaration
5954 int f(void), *fip(), (*pfi)();
5955 declares a function f with no parameters returning an int, a function fip with no parameter specification
5956 returning a pointer to an int, and a pointer pfi to a function with no parameter specification returning an
5957 int. It is especially useful to compare the last two. The binding of *fip() is *(fip()), so that the
5958 declaration suggests, and the same construction in an expression requires, the calling of a function fip,
5959 and then using indirection through the pointer result to yield an int. In the declarator (*pfi)(), the
5960 extra parentheses are necessary to indicate that indirection through a pointer to a function yields a function
5963 <sup><a name="note145" href="#note145"><b>145)</b></a></sup> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
5964 <sup><a name="note146" href="#note146"><b>146)</b></a></sup> If both function types are ''old style'', parameter types are not compared.
5966 [<a name="p134" href="#p134">page 134</a>] (<a href="#Contents">Contents</a>)
5968 designator, which is then used to call the function; it returns an int.
5969 17 If the declaration occurs outside of any function, the identifiers have file scope and external linkage. If the
5970 declaration occurs inside a function, the identifiers of the functions f and fip have block scope and either
5971 internal or external linkage (depending on what file scope declarations for these identifiers are visible), and
5972 the identifier of the pointer pfi has block scope and no linkage.
5974 18 EXAMPLE 2 The declaration
5975 int (*apfi[3])(int *x, int *y);
5976 declares an array apfi of three pointers to functions returning int. Each of these functions has two
5977 parameters that are pointers to int. The identifiers x and y are declared for descriptive purposes only and
5978 go out of scope at the end of the declaration of apfi.
5980 19 EXAMPLE 3 The declaration
5981 int (*fpfi(int (*)(long), int))(int, ...);
5982 declares a function fpfi that returns a pointer to a function returning an int. The function fpfi has two
5983 parameters: a pointer to a function returning an int (with one parameter of type long int), and an int.
5984 The pointer returned by fpfi points to a function that has one int parameter and accepts zero or more
5985 additional arguments of any type.
5987 20 EXAMPLE 4 The following prototype has a variably modified parameter.
5988 void addscalar(int n, int m,
5989 double a[n][n*m+300], double x);
5990 int main()
5992 double b[4][308];
5993 addscalar(4, 2, b, <a href="#2.17">2.17</a>);
5994 return 0;
5996 void addscalar(int n, int m,
5997 double a[n][n*m+300], double x)
5999 for (int i = 0; i &lt; n; i++)
6000 for (int j = 0, k = n*m+300; j &lt; k; j++)
6001 // a is a pointer to a VLA with n*m+300 elements
6002 a[i][j] += x;
6005 21 EXAMPLE 5 The following are all compatible function prototype declarators.
6006 double maximum(int n, int m, double a[n][m]);
6007 double maximum(int n, int m, double a[*][*]);
6008 double maximum(int n, int m, double a[ ][*]);
6009 double maximum(int n, int m, double a[ ][m]);
6010 as are:
6011 void f(double (* restrict a)[5]);
6012 void f(double a[restrict][5]);
6013 void f(double a[restrict 3][5]);
6014 void f(double a[restrict static 3][5]);
6016 [<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
6018 (Note that the last declaration also specifies that the argument corresponding to a in any call to f must be a
6019 non-null pointer to the first of at least three arrays of 5 doubles, which the others do not.)
6021 Forward references: function definitions (<a href="#6.9.1">6.9.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
6022 <a name="6.7.7" href="#6.7.7"><b> 6.7.7 Type names</b></a>
6023 <b> Syntax</b>
6024 1 type-name:
6025 specifier-qualifier-list abstract-declaratoropt
6026 abstract-declarator:
6027 pointer
6028 pointeropt direct-abstract-declarator
6029 direct-abstract-declarator:
6030 ( abstract-declarator )
6031 direct-abstract-declaratoropt [ type-qualifier-listopt
6032 assignment-expressionopt ]
6033 direct-abstract-declaratoropt [ static type-qualifier-listopt
6034 assignment-expression ]
6035 direct-abstract-declaratoropt [ type-qualifier-list static
6036 assignment-expression ]
6037 direct-abstract-declaratoropt [ * ]
6038 direct-abstract-declaratoropt ( parameter-type-listopt )
6039 <b> Semantics</b>
6040 2 In several contexts, it is necessary to specify a type. This is accomplished using a type
6041 name, which is syntactically a declaration for a function or an object of that type that
6042 omits the identifier.<sup><a href="#note147"><b>147)</b></a></sup>
6043 3 EXAMPLE The constructions
6044 (a) int
6045 (b) int *
6046 (c) int *[3]
6047 (d) int (*)[3]
6048 (e) int (*)[*]
6049 (f) int *()
6050 (g) int (*)(void)
6051 (h) int (*const [])(unsigned int, ...)
6052 name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an
6053 array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function
6054 with no parameter specification returning a pointer to int, (g) pointer to function with no parameters
6057 <sup><a name="note147" href="#note147"><b>147)</b></a></sup> As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
6058 parameter specification'', rather than redundant parentheses around the omitted identifier.
6060 [<a name="p136" href="#p136">page 136</a>] (<a href="#Contents">Contents</a>)
6062 returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one
6063 parameter that has type unsigned int and an unspecified number of other parameters, returning an
6064 int.
6066 <a name="6.7.8" href="#6.7.8"><b> 6.7.8 Type definitions</b></a>
6067 <b> Syntax</b>
6068 1 typedef-name:
6069 identifier
6070 <b> Constraints</b>
6071 2 If a typedef name specifies a variably modified type then it shall have block scope.
6072 <b> Semantics</b>
6073 3 In a declaration whose storage-class specifier is typedef, each declarator defines an
6074 identifier to be a typedef name that denotes the type specified for the identifier in the way
6075 described in <a href="#6.7.6">6.7.6</a>. Any array size expressions associated with variable length array
6076 declarators are evaluated each time the declaration of the typedef name is reached in the
6077 order of execution. A typedef declaration does not introduce a new type, only a
6078 synonym for the type so specified. That is, in the following declarations:
6079 typedef T type_ident;
6080 type_ident D;
6081 type_ident is defined as a typedef name with the type specified by the declaration
6082 specifiers in T (known as T ), and the identifier in D has the type ''derived-declarator-
6083 type-list T '' where the derived-declarator-type-list is specified by the declarators of D. A
6084 typedef name shares the same name space as other identifiers declared in ordinary
6085 declarators.
6086 4 EXAMPLE 1 After
6087 typedef int MILES, KLICKSP();
6088 typedef struct { double hi, lo; } range;
6089 the constructions
6090 MILES distance;
6091 extern KLICKSP *metricp;
6092 range x;
6093 range z, *zp;
6094 are all valid declarations. The type of distance is int, that of metricp is ''pointer to function with no
6095 parameter specification returning int'', and that of x and z is the specified structure; zp is a pointer to
6096 such a structure. The object distance has a type compatible with any other int object.
6098 5 EXAMPLE 2 After the declarations
6099 typedef struct s1 { int x; } t1, *tp1;
6100 typedef struct s2 { int x; } t2, *tp2;
6101 type t1 and the type pointed to by tp1 are compatible. Type t1 is also compatible with type struct
6103 [<a name="p137" href="#p137">page 137</a>] (<a href="#Contents">Contents</a>)
6105 s1, but not compatible with the types struct s2, t2, the type pointed to by tp2, or int.
6107 6 EXAMPLE 3 The following obscure constructions
6108 typedef signed int t;
6109 typedef int plain;
6110 struct tag {
6111 unsigned t:4;
6112 const t:5;
6113 plain r:5;
6115 declare a typedef name t with type signed int, a typedef name plain with type int, and a structure
6116 with three bit-field members, one named t that contains values in the range [0, 15], an unnamed const-
6117 qualified bit-field which (if it could be accessed) would contain values in either the range [-15, +15] or
6118 [-16, +15], and one named r that contains values in one of the ranges [0, 31], [-15, +15], or [-16, +15].
6119 (The choice of range is implementation-defined.) The first two bit-field declarations differ in that
6120 unsigned is a type specifier (which forces t to be the name of a structure member), while const is a
6121 type qualifier (which modifies t which is still visible as a typedef name). If these declarations are followed
6122 in an inner scope by
6123 t f(t (t));
6124 long t;
6125 then a function f is declared with type ''function returning signed int with one unnamed parameter
6126 with type pointer to function returning signed int with one unnamed parameter with type signed
6127 int'', and an identifier t with type long int.
6129 7 EXAMPLE 4 On the other hand, typedef names can be used to improve code readability. All three of the
6130 following declarations of the signal function specify exactly the same type, the first without making use
6131 of any typedef names.
6132 typedef void fv(int), (*pfv)(int);
6133 void (*signal(int, void (*)(int)))(int);
6134 fv *signal(int, fv *);
6135 pfv signal(int, pfv);
6137 8 EXAMPLE 5 If a typedef name denotes a variable length array type, the length of the array is fixed at the
6138 time the typedef name is defined, not each time it is used:
6139 void copyt(int n)
6141 typedef int B[n]; // B is n ints, n evaluated now
6142 n += 1;
6143 B a; // a is n ints, n without += 1
6144 int b[n]; // a and b are different sizes
6145 for (int i = 1; i &lt; n; i++)
6146 a[i-1] = b[i];
6149 [<a name="p138" href="#p138">page 138</a>] (<a href="#Contents">Contents</a>)
6151 <a name="6.7.9" href="#6.7.9"><b> 6.7.9 Initialization</b></a>
6152 <b> Syntax</b>
6153 1 initializer:
6154 assignment-expression
6155 { initializer-list }
6156 { initializer-list , }
6157 initializer-list:
6158 designationopt initializer
6159 initializer-list , designationopt initializer
6160 designation:
6161 designator-list =
6162 designator-list:
6163 designator
6164 designator-list designator
6165 designator:
6166 [ constant-expression ]
6167 . identifier
6168 <b> Constraints</b>
6169 2 No initializer shall attempt to provide a value for an object not contained within the entity
6170 being initialized.
6171 3 The type of the entity to be initialized shall be an array of unknown size or a complete
6172 object type that is not a variable length array type.
6173 4 All the expressions in an initializer for an object that has static or thread storage duration
6174 shall be constant expressions or string literals.
6175 5 If the declaration of an identifier has block scope, and the identifier has external or
6176 internal linkage, the declaration shall have no initializer for the identifier.
6177 6 If a designator has the form
6178 [ constant-expression ]
6179 then the current object (defined below) shall have array type and the expression shall be
6180 an integer constant expression. If the array is of unknown size, any nonnegative value is
6181 valid.
6182 7 If a designator has the form
6183 . identifier
6184 then the current object (defined below) shall have structure or union type and the
6185 identifier shall be the name of a member of that type.
6187 [<a name="p139" href="#p139">page 139</a>] (<a href="#Contents">Contents</a>)
6189 <b> Semantics</b>
6190 8 An initializer specifies the initial value stored in an object.
6191 9 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
6192 members of objects of structure and union type do not participate in initialization.
6193 Unnamed members of structure objects have indeterminate value even after initialization.
6194 10 If an object that has automatic storage duration is not initialized explicitly, its value is
6195 indeterminate. If an object that has static or thread storage duration is not initialized
6196 explicitly, then:
6197 -- if it has pointer type, it is initialized to a null pointer;
6198 -- if it has arithmetic type, it is initialized to (positive or unsigned) zero;
6199 -- if it is an aggregate, every member is initialized (recursively) according to these rules,
6200 and any padding is initialized to zero bits;
6201 -- if it is a union, the first named member is initialized (recursively) according to these
6202 rules, and any padding is initialized to zero bits;
6203 11 The initializer for a scalar shall be a single expression, optionally enclosed in braces. The
6204 initial value of the object is that of the expression (after conversion); the same type
6205 constraints and conversions as for simple assignment apply, taking the type of the scalar
6206 to be the unqualified version of its declared type.
6207 12 The rest of this subclause deals with initializers for objects that have aggregate or union
6208 type.
6209 13 The initializer for a structure or union object that has automatic storage duration shall be
6210 either an initializer list as described below, or a single expression that has compatible
6211 structure or union type. In the latter case, the initial value of the object, including
6212 unnamed members, is that of the expression.
6213 14 An array of character type may be initialized by a character string literal or UTF-8 string
6214 literal, optionally enclosed in braces. Successive bytes of the string literal (including the
6215 terminating null character if there is room or if the array is of unknown size) initialize the
6216 elements of the array.
6217 15 An array with element type compatible with a qualified or unqualified version of
6218 wchar_t, char16_t, or char32_t may be initialized by a wide string literal with
6219 the corresponding encoding prefix (L, u, or U, respectively), optionally enclosed in
6220 braces. Successive wide characters of the wide string literal (including the terminating
6221 null wide character if there is room or if the array is of unknown size) initialize the
6222 elements of the array.
6223 16 Otherwise, the initializer for an object that has aggregate or union type shall be a brace-
6224 enclosed list of initializers for the elements or named members.
6226 [<a name="p140" href="#p140">page 140</a>] (<a href="#Contents">Contents</a>)
6228 17 Each brace-enclosed initializer list has an associated current object. When no
6229 designations are present, subobjects of the current object are initialized in order according
6230 to the type of the current object: array elements in increasing subscript order, structure
6231 members in declaration order, and the first named member of a union.<sup><a href="#note148"><b>148)</b></a></sup> In contrast, a
6232 designation causes the following initializer to begin initialization of the subobject
6233 described by the designator. Initialization then continues forward in order, beginning
6234 with the next subobject after that described by the designator.<sup><a href="#note149"><b>149)</b></a></sup>
6235 18 Each designator list begins its description with the current object associated with the
6236 closest surrounding brace pair. Each item in the designator list (in order) specifies a
6237 particular member of its current object and changes the current object for the next
6238 designator (if any) to be that member.<sup><a href="#note150"><b>150)</b></a></sup> The current object that results at the end of the
6239 designator list is the subobject to be initialized by the following initializer.
6240 19 The initialization shall occur in initializer list order, each initializer provided for a
6241 particular subobject overriding any previously listed initializer for the same subobject;<sup><a href="#note151"><b>151)</b></a></sup>
6242 all subobjects that are not initialized explicitly shall be initialized implicitly the same as
6243 objects that have static storage duration.
6244 20 If the aggregate or union contains elements or members that are aggregates or unions,
6245 these rules apply recursively to the subaggregates or contained unions. If the initializer of
6246 a subaggregate or contained union begins with a left brace, the initializers enclosed by
6247 that brace and its matching right brace initialize the elements or members of the
6248 subaggregate or the contained union. Otherwise, only enough initializers from the list are
6249 taken to account for the elements or members of the subaggregate or the first member of
6250 the contained union; any remaining initializers are left to initialize the next element or
6251 member of the aggregate of which the current subaggregate or contained union is a part.
6252 21 If there are fewer initializers in a brace-enclosed list than there are elements or members
6253 of an aggregate, or fewer characters in a string literal used to initialize an array of known
6254 size than there are elements in the array, the remainder of the aggregate shall be
6255 initialized implicitly the same as objects that have static storage duration.
6259 <sup><a name="note148" href="#note148"><b>148)</b></a></sup> If the initializer list for a subaggregate or contained union does not begin with a left brace, its
6260 subobjects are initialized as usual, but the subaggregate or contained union does not become the
6261 current object: current objects are associated only with brace-enclosed initializer lists.
6262 <sup><a name="note149" href="#note149"><b>149)</b></a></sup> After a union member is initialized, the next object is not the next member of the union; instead, it is
6263 the next subobject of an object containing the union.
6264 <sup><a name="note150" href="#note150"><b>150)</b></a></sup> Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with
6265 the surrounding brace pair. Note, too, that each separate designator list is independent.
6266 <sup><a name="note151" href="#note151"><b>151)</b></a></sup> Any initializer for the subobject which is overridden and so not used to initialize that subobject might
6267 not be evaluated at all.
6269 [<a name="p141" href="#p141">page 141</a>] (<a href="#Contents">Contents</a>)
6271 22 If an array of unknown size is initialized, its size is determined by the largest indexed
6272 element with an explicit initializer. The array type is completed at the end of its
6273 initializer list.
6274 23 The evaluations of the initialization list expressions are indeterminately sequenced with
6275 respect to one another and thus the order in which any side effects occur is
6276 unspecified.<sup><a href="#note152"><b>152)</b></a></sup>
6277 24 EXAMPLE 1 Provided that <a href="#7.3">&lt;complex.h&gt;</a> has been #included, the declarations
6278 int i = <a href="#3.5">3.5</a>;
6279 double complex c = 5 + 3 * I;
6280 define and initialize i with the value 3 and c with the value 5.0 + i3.0.
6282 25 EXAMPLE 2 The declaration
6283 int x[] = { 1, 3, 5 };
6284 defines and initializes x as a one-dimensional array object that has three elements, as no size was specified
6285 and there are three initializers.
6287 26 EXAMPLE 3 The declaration
6288 int y[4][3] = {
6289 { 1, 3, 5 },
6290 { 2, 4, 6 },
6291 { 3, 5, 7 },
6293 is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
6294 y[0]), namely y[0][0], y[0][1], and y[0][2]. Likewise the next two lines initialize y[1] and
6295 y[2]. The initializer ends early, so y[3] is initialized with zeros. Precisely the same effect could have
6296 been achieved by
6297 int y[4][3] = {
6298 1, 3, 5, 2, 4, 6, 3, 5, 7
6300 The initializer for y[0] does not begin with a left brace, so three items from the list are used. Likewise the
6301 next three are taken successively for y[1] and y[2].
6303 27 EXAMPLE 4 The declaration
6304 int z[4][3] = {
6305 { 1 }, { 2 }, { 3 }, { 4 }
6307 initializes the first column of z as specified and initializes the rest with zeros.
6309 28 EXAMPLE 5 The declaration
6310 struct { int a[3], b; } w[] = { { 1 }, 2 };
6311 is a definition with an inconsistently bracketed initialization. It defines an array with two element
6315 <sup><a name="note152" href="#note152"><b>152)</b></a></sup> In particular, the evaluation order need not be the same as the order of subobject initialization.
6317 [<a name="p142" href="#p142">page 142</a>] (<a href="#Contents">Contents</a>)
6319 structures: w[0].a[0] is 1 and w[1].a[0] is 2; all the other elements are zero.
6321 29 EXAMPLE 6 The declaration
6322 short q[4][3][2] = {
6323 { 1 },
6324 { 2, 3 },
6325 { 4, 5, 6 }
6327 contains an incompletely but consistently bracketed initialization. It defines a three-dimensional array
6328 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
6329 q[2][0][0], q[2][0][1], and q[2][1][0], respectively; all the rest are zero. The initializer for
6330 q[0][0] does not begin with a left brace, so up to six items from the current list may be used. There is
6331 only one, so the values for the remaining five elements are initialized with zero. Likewise, the initializers
6332 for q[1][0] and q[2][0] do not begin with a left brace, so each uses up to six items, initializing their
6333 respective two-dimensional subaggregates. If there had been more than six items in any of the lists, a
6334 diagnostic message would have been issued. The same initialization result could have been achieved by:
6335 short q[4][3][2] = {
6336 1, 0, 0, 0, 0, 0,
6337 2, 3, 0, 0, 0, 0,
6338 4, 5, 6
6340 or by:
6341 short q[4][3][2] = {
6343 { 1 },
6346 { 2, 3 },
6349 { 4, 5 },
6350 { 6 },
6353 in a fully bracketed form.
6354 30 Note that the fully bracketed and minimally bracketed forms of initialization are, in general, less likely to
6355 cause confusion.
6357 31 EXAMPLE 7 One form of initialization that completes array types involves typedef names. Given the
6358 declaration
6359 typedef int A[]; // OK - declared with block scope
6360 the declaration
6361 A a = { 1, 2 }, b = { 3, 4, 5 };
6362 is identical to
6363 int a[] = { 1, 2 }, b[] = { 3, 4, 5 };
6364 due to the rules for incomplete types.
6366 [<a name="p143" href="#p143">page 143</a>] (<a href="#Contents">Contents</a>)
6368 32 EXAMPLE 8 The declaration
6369 char s[] = "abc", t[3] = "abc";
6370 defines ''plain'' char array objects s and t whose elements are initialized with character string literals.
6371 This declaration is identical to
6372 char s[] = { 'a', 'b', 'c', '\0' },
6373 t[] = { 'a', 'b', 'c' };
6374 The contents of the arrays are modifiable. On the other hand, the declaration
6375 char *p = "abc";
6376 defines p with type ''pointer to char'' and initializes it to point to an object with type ''array of char''
6377 with length 4 whose elements are initialized with a character string literal. If an attempt is made to use p to
6378 modify the contents of the array, the behavior is undefined.
6380 33 EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
6381 designators:
6382 enum { member_one, member_two };
6383 const char *nm[] = {
6384 [member_two] = "member two",
6385 [member_one] = "member one",
6388 34 EXAMPLE 10 Structure members can be initialized to nonzero values without depending on their order:
6389 div_t answer = { .quot = 2, .rem = -1 };
6391 35 EXAMPLE 11 Designators can be used to provide explicit initialization when unadorned initializer lists
6392 might be misunderstood:
6393 struct { int a[3], b; } w[] =
6394 { [0].a = {1}, [1].a[0] = 2 };
6396 36 EXAMPLE 12 Space can be ''allocated'' from both ends of an array by using a single designator:
6397 int a[MAX] = {
6398 1, 3, 5, 7, 9, [MAX-5] = 8, 6, 4, 2, 0
6400 37 In the above, if MAX is greater than ten, there will be some zero-valued elements in the middle; if it is less
6401 than ten, some of the values provided by the first five initializers will be overridden by the second five.
6403 38 EXAMPLE 13 Any member of a union can be initialized:
6404 union { /* ... */ } u = { .any_member = 42 };
6406 Forward references: common definitions <a href="#7.19">&lt;stddef.h&gt;</a> (<a href="#7.19">7.19</a>).
6408 [<a name="p144" href="#p144">page 144</a>] (<a href="#Contents">Contents</a>)
6410 <a name="6.7.10" href="#6.7.10"><b> 6.7.10 Static assertions</b></a>
6411 <b> Syntax</b>
6412 1 static_assert-declaration:
6413 _Static_assert ( constant-expression , string-literal ) ;
6414 <b> Constraints</b>
6415 2 The constant expression shall compare unequal to 0.
6416 <b> Semantics</b>
6417 3 The constant expression shall be an integer constant expression. If the value of the
6418 constant expression compares unequal to 0, the declaration has no effect. Otherwise, the
6419 constraint is violated and the implementation shall produce a diagnostic message that
6420 includes the text of the string literal, except that characters not in the basic source
6421 character set are not required to appear in the message.
6422 Forward references: diagnostics (<a href="#7.2">7.2</a>).
6424 [<a name="p145" href="#p145">page 145</a>] (<a href="#Contents">Contents</a>)
6426 <a name="6.8" href="#6.8"><b> 6.8 Statements and blocks</b></a>
6427 <b> Syntax</b>
6428 1 statement:
6429 labeled-statement
6430 compound-statement
6431 expression-statement
6432 selection-statement
6433 iteration-statement
6434 jump-statement
6435 <b> Semantics</b>
6436 2 A statement specifies an action to be performed. Except as indicated, statements are
6437 executed in sequence.
6438 3 A block allows a set of declarations and statements to be grouped into one syntactic unit.
6439 The initializers of objects that have automatic storage duration, and the variable length
6440 array declarators of ordinary identifiers with block scope, are evaluated and the values are
6441 stored in the objects (including storing an indeterminate value in objects without an
6442 initializer) each time the declaration is reached in the order of execution, as if it were a
6443 statement, and within each declaration in the order that declarators appear.
6444 4 A full expression is an expression that is not part of another expression or of a declarator.
6445 Each of the following is a full expression: an initializer that is not part of a compound
6446 literal; the expression in an expression statement; the controlling expression of a selection
6447 statement (if or switch); the controlling expression of a while or do statement; each
6448 of the (optional) expressions of a for statement; the (optional) expression in a return
6449 statement. There is a sequence point between the evaluation of a full expression and the
6450 evaluation of the next full expression to be evaluated.
6451 Forward references: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
6452 (<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>).
6453 <a name="6.8.1" href="#6.8.1"><b> 6.8.1 Labeled statements</b></a>
6454 <b> Syntax</b>
6455 1 labeled-statement:
6456 identifier : statement
6457 case constant-expression : statement
6458 default : statement
6459 <b> Constraints</b>
6460 2 A case or default label shall appear only in a switch statement. Further
6461 constraints on such labels are discussed under the switch statement.
6463 [<a name="p146" href="#p146">page 146</a>] (<a href="#Contents">Contents</a>)
6465 3 Label names shall be unique within a function.
6466 <b> Semantics</b>
6467 4 Any statement may be preceded by a prefix that declares an identifier as a label name.
6468 Labels in themselves do not alter the flow of control, which continues unimpeded across
6469 them.
6470 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>).
6471 <a name="6.8.2" href="#6.8.2"><b> 6.8.2 Compound statement</b></a>
6472 <b> Syntax</b>
6473 1 compound-statement:
6474 { block-item-listopt }
6475 block-item-list:
6476 block-item
6477 block-item-list block-item
6478 block-item:
6479 declaration
6480 statement
6481 <b> Semantics</b>
6482 2 A compound statement is a block.
6483 <a name="6.8.3" href="#6.8.3"><b> 6.8.3 Expression and null statements</b></a>
6484 <b> Syntax</b>
6485 1 expression-statement:
6486 expressionopt ;
6487 <b> Semantics</b>
6488 2 The expression in an expression statement is evaluated as a void expression for its side
6489 effects.<sup><a href="#note153"><b>153)</b></a></sup>
6490 3 A null statement (consisting of just a semicolon) performs no operations.
6491 4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
6492 discarding of its value may be made explicit by converting the expression to a void expression by means of
6493 a cast:
6494 int p(int);
6495 /* ... */
6496 (void)p(0);
6500 <sup><a name="note153" href="#note153"><b>153)</b></a></sup> Such as assignments, and function calls which have side effects.
6502 [<a name="p147" href="#p147">page 147</a>] (<a href="#Contents">Contents</a>)
6504 5 EXAMPLE 2 In the program fragment
6505 char *s;
6506 /* ... */
6507 while (*s++ != '\0')
6509 a null statement is used to supply an empty loop body to the iteration statement.
6511 6 EXAMPLE 3 A null statement may also be used to carry a label just before the closing } of a compound
6512 statement.
6513 while (loop1) {
6514 /* ... */
6515 while (loop2) {
6516 /* ... */
6517 if (want_out)
6518 goto end_loop1;
6519 /* ... */
6521 /* ... */
6522 end_loop1: ;
6525 Forward references: iteration statements (<a href="#6.8.5">6.8.5</a>).
6526 <a name="6.8.4" href="#6.8.4"><b> 6.8.4 Selection statements</b></a>
6527 <b> Syntax</b>
6528 1 selection-statement:
6529 if ( expression ) statement
6530 if ( expression ) statement else statement
6531 switch ( expression ) statement
6532 <b> Semantics</b>
6533 2 A selection statement selects among a set of statements depending on the value of a
6534 controlling expression.
6535 3 A selection statement is a block whose scope is a strict subset of the scope of its
6536 enclosing block. Each associated substatement is also a block whose scope is a strict
6537 subset of the scope of the selection statement.
6538 <a name="6.8.4.1" href="#6.8.4.1"><b> 6.8.4.1 The if statement</b></a>
6539 <b> Constraints</b>
6540 1 The controlling expression of an if statement shall have scalar type.
6541 <b> Semantics</b>
6542 2 In both forms, the first substatement is executed if the expression compares unequal to 0.
6543 In the else form, the second substatement is executed if the expression compares equal
6545 [<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
6547 to 0. If the first substatement is reached via a label, the second substatement is not
6548 executed.
6549 3 An else is associated with the lexically nearest preceding if that is allowed by the
6550 syntax.
6551 <a name="6.8.4.2" href="#6.8.4.2"><b> 6.8.4.2 The switch statement</b></a>
6552 <b> Constraints</b>
6553 1 The controlling expression of a switch statement shall have integer type.
6554 2 If a switch statement has an associated case or default label within the scope of an
6555 identifier with a variably modified type, the entire switch statement shall be within the
6556 scope of that identifier.<sup><a href="#note154"><b>154)</b></a></sup>
6557 3 The expression of each case label shall be an integer constant expression and no two of
6558 the case constant expressions in the same switch statement shall have the same value
6559 after conversion. There may be at most one default label in a switch statement.
6560 (Any enclosed switch statement may have a default label or case constant
6561 expressions with values that duplicate case constant expressions in the enclosing
6562 switch statement.)
6563 <b> Semantics</b>
6564 4 A switch statement causes control to jump to, into, or past the statement that is the
6565 switch body, depending on the value of a controlling expression, and on the presence of a
6566 default label and the values of any case labels on or in the switch body. A case or
6567 default label is accessible only within the closest enclosing switch statement.
6568 5 The integer promotions are performed on the controlling expression. The constant
6569 expression in each case label is converted to the promoted type of the controlling
6570 expression. If a converted value matches that of the promoted controlling expression,
6571 control jumps to the statement following the matched case label. Otherwise, if there is
6572 a default label, control jumps to the labeled statement. If no converted case constant
6573 expression matches and there is no default label, no part of the switch body is
6574 executed.
6575 Implementation limits
6576 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
6577 switch statement.
6582 <sup><a name="note154" href="#note154"><b>154)</b></a></sup> That is, the declaration either precedes the switch statement, or it follows the last case or
6583 default label associated with the switch that is in the block containing the declaration.
6585 [<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
6587 7 EXAMPLE In the artificial program fragment
6588 switch (expr)
6590 int i = 4;
6591 f(i);
6592 case 0:
6593 i = 17;
6594 /* falls through into default code */
6595 default:
6596 printf("%d\n", i);
6598 the object whose identifier is i exists with automatic storage duration (within the block) but is never
6599 initialized, and thus if the controlling expression has a nonzero value, the call to the printf function will
6600 access an indeterminate value. Similarly, the call to the function f cannot be reached.
6602 <a name="6.8.5" href="#6.8.5"><b> 6.8.5 Iteration statements</b></a>
6603 <b> Syntax</b>
6604 1 iteration-statement:
6605 while ( expression ) statement
6606 do statement while ( expression ) ;
6607 for ( expressionopt ; expressionopt ; expressionopt ) statement
6608 for ( declaration expressionopt ; expressionopt ) statement
6609 <b> Constraints</b>
6610 2 The controlling expression of an iteration statement shall have scalar type.
6611 3 The declaration part of a for statement shall only declare identifiers for objects having
6612 storage class auto or register.
6613 <b> Semantics</b>
6614 4 An iteration statement causes a statement called the loop body to be executed repeatedly
6615 until the controlling expression compares equal to 0. The repetition occurs regardless of
6616 whether the loop body is entered from the iteration statement or by a jump.<sup><a href="#note155"><b>155)</b></a></sup>
6617 5 An iteration statement is a block whose scope is a strict subset of the scope of its
6618 enclosing block. The loop body is also a block whose scope is a strict subset of the scope
6619 of the iteration statement.
6620 6 An iteration statement whose controlling expression is not a constant expression,<sup><a href="#note156"><b>156)</b></a></sup> that
6621 performs no input/output operations, does not access volatile objects, and performs no
6622 synchronization or atomic operations in its body, controlling expression, or (in the case of
6624 <sup><a name="note155" href="#note155"><b>155)</b></a></sup> Code jumped over is not executed. In particular, the controlling expression of a for or while
6625 statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
6626 <sup><a name="note156" href="#note156"><b>156)</b></a></sup> An omitted controlling expression is replaced by a nonzero constant, which is a constant expression.
6628 [<a name="p150" href="#p150">page 150</a>] (<a href="#Contents">Contents</a>)
6630 a for statement) its expression-3, may be assumed by the implementation to
6631 terminate.<sup><a href="#note157"><b>157)</b></a></sup>
6632 <a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
6633 1 The evaluation of the controlling expression takes place before each execution of the loop
6634 body.
6635 <a name="6.8.5.2" href="#6.8.5.2"><b> 6.8.5.2 The do statement</b></a>
6636 1 The evaluation of the controlling expression takes place after each execution of the loop
6637 body.
6638 <a name="6.8.5.3" href="#6.8.5.3"><b> 6.8.5.3 The for statement</b></a>
6639 1 The statement
6640 for ( clause-1 ; expression-2 ; expression-3 ) statement
6641 behaves as follows: The expression expression-2 is the controlling expression that is
6642 evaluated before each execution of the loop body. The expression expression-3 is
6643 evaluated as a void expression after each execution of the loop body. If clause-1 is a
6644 declaration, the scope of any identifiers it declares is the remainder of the declaration and
6645 the entire loop, including the other two expressions; it is reached in the order of execution
6646 before the first evaluation of the controlling expression. If clause-1 is an expression, it is
6647 evaluated as a void expression before the first evaluation of the controlling expression.<sup><a href="#note158"><b>158)</b></a></sup>
6648 2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
6649 nonzero constant.
6650 <a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
6651 <b> Syntax</b>
6652 1 jump-statement:
6653 goto identifier ;
6654 continue ;
6655 break ;
6656 return expressionopt ;
6661 <sup><a name="note157" href="#note157"><b>157)</b></a></sup> This is intended to allow compiler transformations such as removal of empty loops even when
6662 termination cannot be proven.
6663 <sup><a name="note158" href="#note158"><b>158)</b></a></sup> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
6664 the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
6665 such that execution of the loop continues until the expression compares equal to 0; and expression-3
6666 specifies an operation (such as incrementing) that is performed after each iteration.
6668 [<a name="p151" href="#p151">page 151</a>] (<a href="#Contents">Contents</a>)
6670 <b> Semantics</b>
6671 2 A jump statement causes an unconditional jump to another place.
6672 <a name="6.8.6.1" href="#6.8.6.1"><b> 6.8.6.1 The goto statement</b></a>
6673 <b> Constraints</b>
6674 1 The identifier in a goto statement shall name a label located somewhere in the enclosing
6675 function. A goto statement shall not jump from outside the scope of an identifier having
6676 a variably modified type to inside the scope of that identifier.
6677 <b> Semantics</b>
6678 2 A goto statement causes an unconditional jump to the statement prefixed by the named
6679 label in the enclosing function.
6680 3 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
6681 following outline presents one possible approach to a problem based on these three assumptions:
6682 1. The general initialization code accesses objects only visible to the current function.
6683 2. The general initialization code is too large to warrant duplication.
6684 3. The code to determine the next operation is at the head of the loop. (To allow it to be reached by
6685 continue statements, for example.)
6686 /* ... */
6687 goto first_time;
6688 for (;;) {
6689 // determine next operation
6690 /* ... */
6691 if (need to reinitialize) {
6692 // reinitialize-only code
6693 /* ... */
6694 first_time:
6695 // general initialization code
6696 /* ... */
6697 continue;
6699 // handle other operations
6700 /* ... */
6703 [<a name="p152" href="#p152">page 152</a>] (<a href="#Contents">Contents</a>)
6705 4 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
6706 modified types. A jump within the scope, however, is permitted.
6707 goto lab3; // invalid: going INTO scope of VLA.
6709 double a[n];
6710 a[j] = <a href="#4.4">4.4</a>;
6711 lab3:
6712 a[j] = <a href="#3.3">3.3</a>;
6713 goto lab4; // valid: going WITHIN scope of VLA.
6714 a[j] = <a href="#5.5">5.5</a>;
6715 lab4:
6716 a[j] = <a href="#6.6">6.6</a>;
6718 goto lab4; // invalid: going INTO scope of VLA.
6720 <a name="6.8.6.2" href="#6.8.6.2"><b> 6.8.6.2 The continue statement</b></a>
6721 <b> Constraints</b>
6722 1 A continue statement shall appear only in or as a loop body.
6723 <b> Semantics</b>
6724 2 A continue statement causes a jump to the loop-continuation portion of the smallest
6725 enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
6726 of the statements
6727 while (/* ... */) { do { for (/* ... */) {
6728 /* ... */ /* ... */ /* ... */
6729 continue; continue; continue;
6730 /* ... */ /* ... */ /* ... */
6731 contin: ; contin: ; contin: ;
6732 } } while (/* ... */); }
6733 unless the continue statement shown is in an enclosed iteration statement (in which
6734 case it is interpreted within that statement), it is equivalent to goto contin;.<sup><a href="#note159"><b>159)</b></a></sup>
6735 <a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
6736 <b> Constraints</b>
6737 1 A break statement shall appear only in or as a switch body or loop body.
6738 <b> Semantics</b>
6739 2 A break statement terminates execution of the smallest enclosing switch or iteration
6740 statement.
6744 <sup><a name="note159" href="#note159"><b>159)</b></a></sup> Following the contin: label is a null statement.
6746 [<a name="p153" href="#p153">page 153</a>] (<a href="#Contents">Contents</a>)
6748 <a name="6.8.6.4" href="#6.8.6.4"><b> 6.8.6.4 The return statement</b></a>
6749 <b> Constraints</b>
6750 1 A return statement with an expression shall not appear in a function whose return type
6751 is void. A return statement without an expression shall only appear in a function
6752 whose return type is void.
6753 <b> Semantics</b>
6754 2 A return statement terminates execution of the current function and returns control to
6755 its caller. A function may have any number of return statements.
6756 3 If a return statement with an expression is executed, the value of the expression is
6757 returned to the caller as the value of the function call expression. If the expression has a
6758 type different from the return type of the function in which it appears, the value is
6759 converted as if by assignment to an object having the return type of the function.<sup><a href="#note160"><b>160)</b></a></sup>
6760 4 EXAMPLE In:
6761 struct s { double i; } f(void);
6762 union {
6763 struct {
6764 int f1;
6765 struct s f2;
6766 } u1;
6767 struct {
6768 struct s f3;
6769 int f4;
6770 } u2;
6771 } g;
6772 struct s f(void)
6774 return g.u1.f2;
6776 /* ... */
6777 g.u2.f3 = f();
6778 there is no undefined behavior, although there would be if the assignment were done directly (without using
6779 a function call to fetch the value).
6784 <sup><a name="note160" href="#note160"><b>160)</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
6785 apply to the case of function return. The representation of floating-point values may have wider range
6786 or precision than implied by the type; a cast may be used to remove this extra range and precision.
6788 [<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
6790 <a name="6.9" href="#6.9"><b> 6.9 External definitions</b></a>
6791 <b> Syntax</b>
6792 1 translation-unit:
6793 external-declaration
6794 translation-unit external-declaration
6795 external-declaration:
6796 function-definition
6797 declaration
6798 <b> Constraints</b>
6799 2 The storage-class specifiers auto and register shall not appear in the declaration
6800 specifiers in an external declaration.
6801 3 There shall be no more than one external definition for each identifier declared with
6802 internal linkage in a translation unit. Moreover, if an identifier declared with internal
6803 linkage is used in an expression (other than as a part of the operand of a sizeof or
6804 _Alignof operator whose result is an integer constant), there shall be exactly one
6805 external definition for the identifier in the translation unit.
6806 <b> Semantics</b>
6807 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,
6808 which consists of a sequence of external declarations. These are described as ''external''
6809 because they appear outside any function (and hence have file scope). As discussed in
6810 <a href="#6.7">6.7</a>, a declaration that also causes storage to be reserved for an object or a function named
6811 by the identifier is a definition.
6812 5 An external definition is an external declaration that is also a definition of a function
6813 (other than an inline definition) or an object. If an identifier declared with external
6814 linkage is used in an expression (other than as part of the operand of a sizeof or
6815 _Alignof operator whose result is an integer constant), somewhere in the entire
6816 program there shall be exactly one external definition for the identifier; otherwise, there
6817 shall be no more than one.<sup><a href="#note161"><b>161)</b></a></sup>
6822 <sup><a name="note161" href="#note161"><b>161)</b></a></sup> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
6823 external definition for it.
6825 [<a name="p155" href="#p155">page 155</a>] (<a href="#Contents">Contents</a>)
6827 <a name="6.9.1" href="#6.9.1"><b> 6.9.1 Function definitions</b></a>
6828 <b> Syntax</b>
6829 1 function-definition:
6830 declaration-specifiers declarator declaration-listopt compound-statement
6831 declaration-list:
6832 declaration
6833 declaration-list declaration
6834 <b> Constraints</b>
6835 2 The identifier declared in a function definition (which is the name of the function) shall
6836 have a function type, as specified by the declarator portion of the function definition.<sup><a href="#note162"><b>162)</b></a></sup>
6837 3 The return type of a function shall be void or a complete object type other than array
6838 type.
6839 4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
6840 static.
6841 5 If the declarator includes a parameter type list, the declaration of each parameter shall
6842 include an identifier, except for the special case of a parameter list consisting of a single
6843 parameter of type void, in which case there shall not be an identifier. No declaration list
6844 shall follow.
6845 6 If the declarator includes an identifier list, each declaration in the declaration list shall
6846 have at least one declarator, those declarators shall declare only identifiers from the
6847 identifier list, and every identifier in the identifier list shall be declared. An identifier
6848 declared as a typedef name shall not be redeclared as a parameter. The declarations in the
6849 declaration list shall contain no storage-class specifier other than register and no
6850 initializations.
6854 <sup><a name="note162" href="#note162"><b>162)</b></a></sup> The intent is that the type category in a function definition cannot be inherited from a typedef:
6855 typedef int F(void); // type F is ''function with no parameters
6856 // returning int''
6857 F f, g; // f and g both have type compatible with F
6858 F f { /* ... */ } // WRONG: syntax/constraint error
6859 F g() { /* ... */ } // WRONG: declares that g returns a function
6860 int f(void) { /* ... */ } // RIGHT: f has type compatible with F
6861 int g() { /* ... */ } // RIGHT: g has type compatible with F
6862 F *e(void) { /* ... */ } // e returns a pointer to a function
6863 F *((e))(void) { /* ... */ } // same: parentheses irrelevant
6864 int (*fp)(void); // fp points to a function that has type F
6865 F *Fp; // Fp points to a function that has type F
6867 [<a name="p156" href="#p156">page 156</a>] (<a href="#Contents">Contents</a>)
6869 <b> Semantics</b>
6870 7 The declarator in a function definition specifies the name of the function being defined
6871 and the identifiers of its parameters. If the declarator includes a parameter type list, the
6872 list also specifies the types of all the parameters; such a declarator also serves as a
6873 function prototype for later calls to the same function in the same translation unit. If the
6874 declarator includes an identifier list,<sup><a href="#note163"><b>163)</b></a></sup> the types of the parameters shall be declared in a
6875 following declaration list. In either case, the type of each parameter is adjusted as
6876 described in <a href="#6.7.6.3">6.7.6.3</a> for a parameter type list; the resulting type shall be a complete object
6877 type.
6878 8 If a function that accepts a variable number of arguments is defined without a parameter
6879 type list that ends with the ellipsis notation, the behavior is undefined.
6880 9 Each parameter has automatic storage duration; its identifier is an lvalue.<sup><a href="#note164"><b>164)</b></a></sup> The layout
6881 of the storage for parameters is unspecified.
6882 10 On entry to the function, the size expressions of each variably modified parameter are
6883 evaluated and the value of each argument expression is converted to the type of the
6884 corresponding parameter as if by assignment. (Array expressions and function
6885 designators as arguments were converted to pointers before the call.)
6886 11 After all parameters have been assigned, the compound statement that constitutes the
6887 body of the function definition is executed.
6888 12 If the } that terminates a function is reached, and the value of the function call is used by
6889 the caller, the behavior is undefined.
6890 13 EXAMPLE 1 In the following:
6891 extern int max(int a, int b)
6893 return a &gt; b ? a : b;
6895 extern is the storage-class specifier and int is the type specifier; max(int a, int b) is the
6896 function declarator; and
6897 { return a &gt; b ? a : b; }
6898 is the function body. The following similar definition uses the identifier-list form for the parameter
6899 declarations:
6904 <sup><a name="note163" href="#note163"><b>163)</b></a></sup> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
6905 <sup><a name="note164" href="#note164"><b>164)</b></a></sup> A parameter identifier cannot be redeclared in the function body except in an enclosed block.
6907 [<a name="p157" href="#p157">page 157</a>] (<a href="#Contents">Contents</a>)
6909 extern int max(a, b)
6910 int a, b;
6912 return a &gt; b ? a : b;
6914 Here int a, b; is the declaration list for the parameters. The difference between these two definitions is
6915 that the first form acts as a prototype declaration that forces conversion of the arguments of subsequent calls
6916 to the function, whereas the second form does not.
6918 14 EXAMPLE 2 To pass one function to another, one might say
6919 int f(void);
6920 /* ... */
6921 g(f);
6922 Then the definition of g might read
6923 void g(int (*funcp)(void))
6925 /* ... */
6926 (*funcp)(); /* or funcp(); ... */
6928 or, equivalently,
6929 void g(int func(void))
6931 /* ... */
6932 func(); /* or (*func)(); ... */
6935 <a name="6.9.2" href="#6.9.2"><b> 6.9.2 External object definitions</b></a>
6936 <b> Semantics</b>
6937 1 If the declaration of an identifier for an object has file scope and an initializer, the
6938 declaration is an external definition for the identifier.
6939 2 A declaration of an identifier for an object that has file scope without an initializer, and
6940 without a storage-class specifier or with the storage-class specifier static, constitutes a
6941 tentative definition. If a translation unit contains one or more tentative definitions for an
6942 identifier, and the translation unit contains no external definition for that identifier, then
6943 the behavior is exactly as if the translation unit contains a file scope declaration of that
6944 identifier, with the composite type as of the end of the translation unit, with an initializer
6945 equal to 0.
6946 3 If the declaration of an identifier for an object is a tentative definition and has internal
6947 linkage, the declared type shall not be an incomplete type.
6949 [<a name="p158" href="#p158">page 158</a>] (<a href="#Contents">Contents</a>)
6951 4 EXAMPLE 1
6952 int i1 = 1; // definition, external linkage
6953 static int i2 = 2; // definition, internal linkage
6954 extern int i3 = 3; // definition, external linkage
6955 int i4; // tentative definition, external linkage
6956 static int i5; // tentative definition, internal linkage
6957 int i1; // valid tentative definition, refers to previous
6958 int i2; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6959 int i3; // valid tentative definition, refers to previous
6960 int i4; // valid tentative definition, refers to previous
6961 int i5; // <a href="#6.2.2">6.2.2</a> renders undefined, linkage disagreement
6962 extern int i1; // refers to previous, whose linkage is external
6963 extern int i2; // refers to previous, whose linkage is internal
6964 extern int i3; // refers to previous, whose linkage is external
6965 extern int i4; // refers to previous, whose linkage is external
6966 extern int i5; // refers to previous, whose linkage is internal
6968 5 EXAMPLE 2 If at the end of the translation unit containing
6969 int i[];
6970 the array i still has incomplete type, the implicit initializer causes it to have one element, which is set to
6971 zero on program startup.
6973 [<a name="p159" href="#p159">page 159</a>] (<a href="#Contents">Contents</a>)
6975 <a name="6.10" href="#6.10"><b> 6.10 Preprocessing directives</b></a>
6976 <b> Syntax</b>
6977 1 preprocessing-file:
6978 groupopt
6979 group:
6980 group-part
6981 group group-part
6982 group-part:
6983 if-section
6984 control-line
6985 text-line
6986 # non-directive
6987 if-section:
6988 if-group elif-groupsopt else-groupopt endif-line
6989 if-group:
6990 # if constant-expression new-line groupopt
6991 # ifdef identifier new-line groupopt
6992 # ifndef identifier new-line groupopt
6993 elif-groups:
6994 elif-group
6995 elif-groups elif-group
6996 elif-group:
6997 # elif constant-expression new-line groupopt
6998 else-group:
6999 # else new-line groupopt
7000 endif-line:
7001 # endif new-line
7003 [<a name="p160" href="#p160">page 160</a>] (<a href="#Contents">Contents</a>)
7005 control-line:
7006 # include pp-tokens new-line
7007 # define identifier replacement-list new-line
7008 # define identifier lparen identifier-listopt )
7009 replacement-list new-line
7010 # define identifier lparen ... ) replacement-list new-line
7011 # define identifier lparen identifier-list , ... )
7012 replacement-list new-line
7013 # undef identifier new-line
7014 # line pp-tokens new-line
7015 # error pp-tokensopt new-line
7016 # pragma pp-tokensopt new-line
7017 # new-line
7018 text-line:
7019 pp-tokensopt new-line
7020 non-directive:
7021 pp-tokens new-line
7022 lparen:
7023 a ( character not immediately preceded by white-space
7024 replacement-list:
7025 pp-tokensopt
7026 pp-tokens:
7027 preprocessing-token
7028 pp-tokens preprocessing-token
7029 new-line:
7030 the new-line character
7031 <b> Description</b>
7032 2 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
7033 following constraints: The first token in the sequence is a # preprocessing token that (at
7034 the start of translation phase 4) is either the first character in the source file (optionally
7035 after white space containing no new-line characters) or that follows white space
7036 containing at least one new-line character. The last token in the sequence is the first new-
7037 line character that follows the first token in the sequence.<sup><a href="#note165"><b>165)</b></a></sup> A new-line character ends
7038 the preprocessing directive even if it occurs within what would otherwise be an
7040 <sup><a name="note165" href="#note165"><b>165)</b></a></sup> Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
7041 significance, as all white space is equivalent except in certain situations during preprocessing (see the
7042 # character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
7044 [<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
7046 invocation of a function-like macro.
7047 3 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
7048 with any of the directive names appearing in the syntax.
7049 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
7050 sequence of preprocessing tokens to occur between the directive name and the following
7051 new-line character.
7052 <b> Constraints</b>
7053 5 The only white-space characters that shall appear between preprocessing tokens within a
7054 preprocessing directive (from just after the introducing # preprocessing token through
7055 just before the terminating new-line character) are space and horizontal-tab (including
7056 spaces that have replaced comments or possibly other white-space characters in
7057 translation phase 3).
7058 <b> Semantics</b>
7059 6 The implementation can process and skip sections of source files conditionally, include
7060 other source files, and replace macros. These capabilities are called preprocessing,
7061 because conceptually they occur before translation of the resulting translation unit.
7062 7 The preprocessing tokens within a preprocessing directive are not subject to macro
7063 expansion unless otherwise stated.
7064 8 EXAMPLE In:
7065 #define EMPTY
7066 EMPTY # include &lt;file.h&gt;
7067 the sequence of preprocessing tokens on the second line is not a preprocessing directive, because it does not
7068 begin with a # at the start of translation phase 4, even though it will do so after the macro EMPTY has been
7069 replaced.
7071 <a name="6.10.1" href="#6.10.1"><b> 6.10.1 Conditional inclusion</b></a>
7072 <b> Constraints</b>
7073 1 The expression that controls conditional inclusion shall be an integer constant expression
7074 except that: identifiers (including those lexically identical to keywords) are interpreted as
7075 described below;<sup><a href="#note166"><b>166)</b></a></sup> and it may contain unary operator expressions of the form
7076 defined identifier
7078 defined ( identifier )
7079 which evaluate to 1 if the identifier is currently defined as a macro name (that is, if it is
7082 <sup><a name="note166" href="#note166"><b>166)</b></a></sup> Because the controlling constant expression is evaluated during translation phase 4, all identifiers
7083 either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
7085 [<a name="p162" href="#p162">page 162</a>] (<a href="#Contents">Contents</a>)
7087 predefined or if it has been the subject of a #define preprocessing directive without an
7088 intervening #undef directive with the same subject identifier), 0 if it is not.
7089 2 Each preprocessing token that remains (in the list of preprocessing tokens that will
7090 become the controlling expression) after all macro replacements have occurred shall be in
7091 the lexical form of a token (<a href="#6.4">6.4</a>).
7092 <b> Semantics</b>
7093 3 Preprocessing directives of the forms
7094 # if constant-expression new-line groupopt
7095 # elif constant-expression new-line groupopt
7096 check whether the controlling constant expression evaluates to nonzero.
7097 4 Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
7098 the controlling constant expression are replaced (except for those macro names modified
7099 by the defined unary operator), just as in normal text. If the token defined is
7100 generated as a result of this replacement process or use of the defined unary operator
7101 does not match one of the two specified forms prior to macro replacement, the behavior is
7102 undefined. After all replacements due to macro expansion and the defined unary
7103 operator have been performed, all remaining identifiers (including those lexically
7104 identical to keywords) are replaced with the pp-number 0, and then each preprocessing
7105 token is converted into a token. The resulting tokens compose the controlling constant
7106 expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
7107 token conversion and evaluation, all signed integer types and all unsigned integer types
7108 act as if they have the same representation as, respectively, the types intmax_t and
7109 uintmax_t defined in the header <a href="#7.20">&lt;stdint.h&gt;</a>.<sup><a href="#note167"><b>167)</b></a></sup> This includes interpreting
7110 character constants, which may involve converting escape sequences into execution
7111 character set members. Whether the numeric value for these character constants matches
7112 the value obtained when an identical character constant occurs in an expression (other
7113 than within a #if or #elif directive) is implementation-defined.<sup><a href="#note168"><b>168)</b></a></sup> Also, whether a
7114 single-character character constant may have a negative value is implementation-defined.
7119 <sup><a name="note167" href="#note167"><b>167)</b></a></sup> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
7120 0x8000 is signed and positive within a #if expression even though it would be unsigned in
7121 translation phase 7.
7122 <sup><a name="note168" href="#note168"><b>168)</b></a></sup> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
7123 evaluate to the same value in these two contexts.
7124 #if 'z' - 'a' == 25
7125 if ('z' - 'a' == 25)
7127 [<a name="p163" href="#p163">page 163</a>] (<a href="#Contents">Contents</a>)
7129 5 Preprocessing directives of the forms
7130 # ifdef identifier new-line groupopt
7131 # ifndef identifier new-line groupopt
7132 check whether the identifier is or is not currently defined as a macro name. Their
7133 conditions are equivalent to #if defined identifier and #if !defined identifier
7134 respectively.
7135 6 Each directive's condition is checked in order. If it evaluates to false (zero), the group
7136 that it controls is skipped: directives are processed only through the name that determines
7137 the directive in order to keep track of the level of nested conditionals; the rest of the
7138 directives' preprocessing tokens are ignored, as are the other preprocessing tokens in the
7139 group. Only the first group whose control condition evaluates to true (nonzero) is
7140 processed. If none of the conditions evaluates to true, and there is a #else directive, the
7141 group controlled by the #else is processed; lacking a #else directive, all the groups
7142 until the #endif are skipped.<sup><a href="#note169"><b>169)</b></a></sup>
7143 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
7144 integer types (<a href="#7.20.1.5">7.20.1.5</a>).
7145 <a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
7146 <b> Constraints</b>
7147 1 A #include directive shall identify a header or source file that can be processed by the
7148 implementation.
7149 <b> Semantics</b>
7150 2 A preprocessing directive of the form
7151 # include &lt;h-char-sequence&gt; new-line
7152 searches a sequence of implementation-defined places for a header identified uniquely by
7153 the specified sequence between the &lt; and &gt; delimiters, and causes the replacement of that
7154 directive by the entire contents of the header. How the places are specified or the header
7155 identified is implementation-defined.
7156 3 A preprocessing directive of the form
7157 # include "q-char-sequence" new-line
7158 causes the replacement of that directive by the entire contents of the source file identified
7159 by the specified sequence between the " delimiters. The named source file is searched
7162 <sup><a name="note169" href="#note169"><b>169)</b></a></sup> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
7163 before the terminating new-line character. However, comments may appear anywhere in a source file,
7164 including within a preprocessing directive.
7166 [<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
7168 for in an implementation-defined manner. If this search is not supported, or if the search
7169 fails, the directive is reprocessed as if it read
7170 # include &lt;h-char-sequence&gt; new-line
7171 with the identical contained sequence (including &gt; characters, if any) from the original
7172 directive.
7173 4 A preprocessing directive of the form
7174 # include pp-tokens new-line
7175 (that does not match one of the two previous forms) is permitted. The preprocessing
7176 tokens after include in the directive are processed just as in normal text. (Each
7177 identifier currently defined as a macro name is replaced by its replacement list of
7178 preprocessing tokens.) The directive resulting after all replacements shall match one of
7179 the two previous forms.<sup><a href="#note170"><b>170)</b></a></sup> The method by which a sequence of preprocessing tokens
7180 between a &lt; and a &gt; preprocessing token pair or a pair of " characters is combined into a
7181 single header name preprocessing token is implementation-defined.
7182 5 The implementation shall provide unique mappings for sequences consisting of one or
7183 more nondigits or digits (<a href="#6.4.2.1">6.4.2.1</a>) followed by a period (.) and a single nondigit. The
7184 first character shall not be a digit. The implementation may ignore distinctions of
7185 alphabetical case and restrict the mapping to eight significant characters before the
7186 period.
7187 6 A #include preprocessing directive may appear in a source file that has been read
7188 because of a #include directive in another file, up to an implementation-defined
7189 nesting limit (see <a href="#5.2.4.1">5.2.4.1</a>).
7190 7 EXAMPLE 1 The most common uses of #include preprocessing directives are as in the following:
7191 #include <a href="#7.21">&lt;stdio.h&gt;</a>
7192 #include "myprog.h"
7197 <sup><a name="note170" href="#note170"><b>170)</b></a></sup> Note that adjacent string literals are not concatenated into a single string literal (see the translation
7198 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.
7200 [<a name="p165" href="#p165">page 165</a>] (<a href="#Contents">Contents</a>)
7202 8 EXAMPLE 2 This illustrates macro-replaced #include directives:
7203 #if VERSION == 1
7204 #define INCFILE "vers1.h"
7205 #elif VERSION == 2
7206 #define INCFILE "vers2.h" // and so on
7207 #else
7208 #define INCFILE "versN.h"
7209 #endif
7210 #include INCFILE
7212 Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>).
7213 <a name="6.10.3" href="#6.10.3"><b> 6.10.3 Macro replacement</b></a>
7214 <b> Constraints</b>
7215 1 Two replacement lists are identical if and only if the preprocessing tokens in both have
7216 the same number, ordering, spelling, and white-space separation, where all white-space
7217 separations are considered identical.
7218 2 An identifier currently defined as an object-like macro shall not be redefined by another
7219 #define preprocessing directive unless the second definition is an object-like macro
7220 definition and the two replacement lists are identical. Likewise, an identifier currently
7221 defined as a function-like macro shall not be redefined by another #define
7222 preprocessing directive unless the second definition is a function-like macro definition
7223 that has the same number and spelling of parameters, and the two replacement lists are
7224 identical.
7225 3 There shall be white-space between the identifier and the replacement list in the definition
7226 of an object-like macro.
7227 4 If the identifier-list in the macro definition does not end with an ellipsis, the number of
7228 arguments (including those arguments consisting of no preprocessing tokens) in an
7229 invocation of a function-like macro shall equal the number of parameters in the macro
7230 definition. Otherwise, there shall be more arguments in the invocation than there are
7231 parameters in the macro definition (excluding the ...). There shall exist a )
7232 preprocessing token that terminates the invocation.
7233 5 The identifier __VA_ARGS__ shall occur only in the replacement-list of a function-like
7234 macro that uses the ellipsis notation in the parameters.
7235 6 A parameter identifier in a function-like macro shall be uniquely declared within its
7236 scope.
7237 <b> Semantics</b>
7238 7 The identifier immediately following the define is called the macro name. There is one
7239 name space for macro names. Any white-space characters preceding or following the
7240 replacement list of preprocessing tokens are not considered part of the replacement list
7242 [<a name="p166" href="#p166">page 166</a>] (<a href="#Contents">Contents</a>)
7244 for either form of macro.
7245 8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
7246 a preprocessing directive could begin, the identifier is not subject to macro replacement.
7247 9 A preprocessing directive of the form
7248 # define identifier replacement-list new-line
7249 defines an object-like macro that causes each subsequent instance of the macro name<sup><a href="#note171"><b>171)</b></a></sup>
7250 to be replaced by the replacement list of preprocessing tokens that constitute the
7251 remainder of the directive. The replacement list is then rescanned for more macro names
7252 as specified below.
7253 10 A preprocessing directive of the form
7254 # define identifier lparen identifier-listopt ) replacement-list new-line
7255 # define identifier lparen ... ) replacement-list new-line
7256 # define identifier lparen identifier-list , ... ) replacement-list new-line
7257 defines a function-like macro with parameters, whose use is similar syntactically to a
7258 function call. The parameters are specified by the optional list of identifiers, whose scope
7259 extends from their declaration in the identifier list until the new-line character that
7260 terminates the #define preprocessing directive. Each subsequent instance of the
7261 function-like macro name followed by a ( as the next preprocessing token introduces the
7262 sequence of preprocessing tokens that is replaced by the replacement list in the definition
7263 (an invocation of the macro). The replaced sequence of preprocessing tokens is
7264 terminated by the matching ) preprocessing token, skipping intervening matched pairs of
7265 left and right parenthesis preprocessing tokens. Within the sequence of preprocessing
7266 tokens making up an invocation of a function-like macro, new-line is considered a normal
7267 white-space character.
7268 11 The sequence of preprocessing tokens bounded by the outside-most matching parentheses
7269 forms the list of arguments for the function-like macro. The individual arguments within
7270 the list are separated by comma preprocessing tokens, but comma preprocessing tokens
7271 between matching inner parentheses do not separate arguments. If there are sequences of
7272 preprocessing tokens within the list of arguments that would otherwise act as
7273 preprocessing directives,<sup><a href="#note172"><b>172)</b></a></sup> the behavior is undefined.
7274 12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
7275 including any separating comma preprocessing tokens, are merged to form a single item:
7278 <sup><a name="note171" href="#note171"><b>171)</b></a></sup> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
7279 not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
7280 are never scanned for macro names or parameters.
7281 <sup><a name="note172" href="#note172"><b>172)</b></a></sup> Despite the name, a non-directive is a preprocessing directive.
7283 [<a name="p167" href="#p167">page 167</a>] (<a href="#Contents">Contents</a>)
7285 the variable arguments. The number of arguments so combined is such that, following
7286 merger, the number of arguments is one more than the number of parameters in the macro
7287 definition (excluding the ...).
7288 <a name="6.10.3.1" href="#6.10.3.1"><b> 6.10.3.1 Argument substitution</b></a>
7289 1 After the arguments for the invocation of a function-like macro have been identified,
7290 argument substitution takes place. A parameter in the replacement list, unless preceded
7291 by a # or ## preprocessing token or followed by a ## preprocessing token (see below), is
7292 replaced by the corresponding argument after all macros contained therein have been
7293 expanded. Before being substituted, each argument's preprocessing tokens are
7294 completely macro replaced as if they formed the rest of the preprocessing file; no other
7295 preprocessing tokens are available.
7296 2 An identifier __VA_ARGS__ that occurs in the replacement list shall be treated as if it
7297 were a parameter, and the variable arguments shall form the preprocessing tokens used to
7298 replace it.
7299 <a name="6.10.3.2" href="#6.10.3.2"><b> 6.10.3.2 The # operator</b></a>
7300 <b> Constraints</b>
7301 1 Each # preprocessing token in the replacement list for a function-like macro shall be
7302 followed by a parameter as the next preprocessing token in the replacement list.
7303 <b> Semantics</b>
7304 2 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
7305 token, both are replaced by a single character string literal preprocessing token that
7306 contains the spelling of the preprocessing token sequence for the corresponding
7307 argument. Each occurrence of white space between the argument's preprocessing tokens
7308 becomes a single space character in the character string literal. White space before the
7309 first preprocessing token and after the last preprocessing token composing the argument
7310 is deleted. Otherwise, the original spelling of each preprocessing token in the argument
7311 is retained in the character string literal, except for special handling for producing the
7312 spelling of string literals and character constants: a \ character is inserted before each "
7313 and \ character of a character constant or string literal (including the delimiting "
7314 characters), except that it is implementation-defined whether a \ character is inserted
7315 before the \ character beginning a universal character name. If the replacement that
7316 results is not a valid character string literal, the behavior is undefined. The character
7317 string literal corresponding to an empty argument is "". The order of evaluation of # and
7318 ## operators is unspecified.
7320 [<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
7322 <a name="6.10.3.3" href="#6.10.3.3"><b> 6.10.3.3 The ## operator</b></a>
7323 <b> Constraints</b>
7324 1 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
7325 list for either form of macro definition.
7326 <b> Semantics</b>
7327 2 If, in the replacement list of a function-like macro, a parameter is immediately preceded
7328 or followed by a ## preprocessing token, the parameter is replaced by the corresponding
7329 argument's preprocessing token sequence; however, if an argument consists of no
7330 preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
7331 instead.<sup><a href="#note173"><b>173)</b></a></sup>
7332 3 For both object-like and function-like macro invocations, before the replacement list is
7333 reexamined for more macro names to replace, each instance of a ## preprocessing token
7334 in the replacement list (not from an argument) is deleted and the preceding preprocessing
7335 token is concatenated with the following preprocessing token. Placemarker
7336 preprocessing tokens are handled specially: concatenation of two placemarkers results in
7337 a single placemarker preprocessing token, and concatenation of a placemarker with a
7338 non-placemarker preprocessing token results in the non-placemarker preprocessing token.
7339 If the result is not a valid preprocessing token, the behavior is undefined. The resulting
7340 token is available for further macro replacement. The order of evaluation of ## operators
7341 is unspecified.
7342 4 EXAMPLE In the following fragment:
7343 #define hash_hash # ## #
7344 #define mkstr(a) # a
7345 #define in_between(a) mkstr(a)
7346 #define join(c, d) in_between(c hash_hash d)
7347 char p[] = join(x, y); // equivalent to
7348 // char p[] = "x ## y";
7349 The expansion produces, at various stages:
7350 join(x, y)
7351 in_between(x hash_hash y)
7352 in_between(x ## y)
7353 mkstr(x ## y)
7354 "x ## y"
7355 In other words, expanding hash_hash produces a new token, consisting of two adjacent sharp signs, but
7356 this new token is not the ## operator.
7359 <sup><a name="note173" href="#note173"><b>173)</b></a></sup> Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
7360 exist only within translation phase 4.
7362 [<a name="p169" href="#p169">page 169</a>] (<a href="#Contents">Contents</a>)
7364 <a name="6.10.3.4" href="#6.10.3.4"><b> 6.10.3.4 Rescanning and further replacement</b></a>
7365 1 After all parameters in the replacement list have been substituted and # and ##
7366 processing has taken place, all placemarker preprocessing tokens are removed. The
7367 resulting preprocessing token sequence is then rescanned, along with all subsequent
7368 preprocessing tokens of the source file, for more macro names to replace.
7369 2 If the name of the macro being replaced is found during this scan of the replacement list
7370 (not including the rest of the source file's preprocessing tokens), it is not replaced.
7371 Furthermore, if any nested replacements encounter the name of the macro being replaced,
7372 it is not replaced. These nonreplaced macro name preprocessing tokens are no longer
7373 available for further replacement even if they are later (re)examined in contexts in which
7374 that macro name preprocessing token would otherwise have been replaced.
7375 3 The resulting completely macro-replaced preprocessing token sequence is not processed
7376 as a preprocessing directive even if it resembles one, but all pragma unary operator
7377 expressions within it are then processed as specified in <a href="#6.10.9">6.10.9</a> below.
7378 4 EXAMPLE There are cases where it is not clear whether a replacement is nested or not. For example,
7379 given the following macro definitions:
7380 #define f(a) a*g
7381 #define g(a) f(a)
7382 the invocation
7383 f(2)(9)
7384 may expand to either
7385 2*f(9)
7387 2*9*g
7388 Strictly conforming programs are not permitted to depend on such unspecified behavior.
7390 <a name="6.10.3.5" href="#6.10.3.5"><b> 6.10.3.5 Scope of macro definitions</b></a>
7391 1 A macro definition lasts (independent of block structure) until a corresponding #undef
7392 directive is encountered or (if none is encountered) until the end of the preprocessing
7393 translation unit. Macro definitions have no significance after translation phase 4.
7394 2 A preprocessing directive of the form
7395 # undef identifier new-line
7396 causes the specified identifier no longer to be defined as a macro name. It is ignored if
7397 the specified identifier is not currently defined as a macro name.
7398 3 EXAMPLE 1 The simplest use of this facility is to define a ''manifest constant'', as in
7399 #define TABSIZE 100
7401 [<a name="p170" href="#p170">page 170</a>] (<a href="#Contents">Contents</a>)
7403 int table[TABSIZE];
7405 4 EXAMPLE 2 The following defines a function-like macro whose value is the maximum of its arguments.
7406 It has the advantages of working for any compatible types of the arguments and of generating in-line code
7407 without the overhead of function calling. It has the disadvantages of evaluating one or the other of its
7408 arguments a second time (including side effects) and generating more code than a function if invoked
7409 several times. It also cannot have its address taken, as it has none.
7410 #define max(a, b) ((a) &gt; (b) ? (a) : (b))
7411 The parentheses ensure that the arguments and the resulting expression are bound properly.
7413 5 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
7414 #define x 3
7415 #define f(a) f(x * (a))
7416 #undef x
7417 #define x 2
7418 #define g f
7419 #define z z[0]
7420 #define h g(~
7421 #define m(a) a(w)
7422 #define w 0,1
7423 #define t(a) a
7424 #define p() int
7425 #define q(x) x
7426 #define r(x,y) x ## y
7427 #define str(x) # x
7428 f(y+1) + f(f(z)) % t(t(g)(0) + t)(1);
7429 g(x+(3,4)-w) | h 5) &amp; m
7430 (f)^m(m);
7431 p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };
7432 char c[2][6] = { str(hello), str() };
7433 results in
7434 f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);
7435 f(2 * (2+(3,4)-0,1)) | f(2 * (~ 5)) &amp; f(2 * (0,1))^m(0,1);
7436 int i[] = { 1, 23, 4, 5, };
7437 char c[2][6] = { "hello", "" };
7439 6 EXAMPLE 4 To illustrate the rules for creating character string literals and concatenating tokens, the
7440 sequence
7441 #define str(s) # s
7442 #define xstr(s) str(s)
7443 #define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \
7444 x ## s, x ## t)
7445 #define INCFILE(n) vers ## n
7446 #define glue(a, b) a ## b
7447 #define xglue(a, b) glue(a, b)
7448 #define HIGHLOW "hello"
7449 #define LOW LOW ", world"
7451 [<a name="p171" href="#p171">page 171</a>] (<a href="#Contents">Contents</a>)
7453 debug(1, 2);
7454 fputs(str(strncmp("abc\0d", "abc", '\4') // this goes away
7455 == 0) str(: @\n), s);
7456 #include xstr(INCFILE(2).h)
7457 glue(HIGH, LOW);
7458 xglue(HIGH, LOW)
7459 results in
7460 printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
7461 fputs(
7462 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0" ": @\n",
7464 #include "vers2.h" (after macro replacement, before file access)
7465 "hello";
7466 "hello" ", world"
7467 or, after concatenation of the character string literals,
7468 printf("x1= %d, x2= %s", x1, x2);
7469 fputs(
7470 "strncmp(\"abc\\0d\", \"abc\", '\\4') == 0: @\n",
7472 #include "vers2.h" (after macro replacement, before file access)
7473 "hello";
7474 "hello, world"
7475 Space around the # and ## tokens in the macro definition is optional.
7477 7 EXAMPLE 5 To illustrate the rules for placemarker preprocessing tokens, the sequence
7478 #define t(x,y,z) x ## y ## z
7479 int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),
7480 t(10,,), t(,11,), t(,,12), t(,,) };
7481 results in
7482 int j[] = { 123, 45, 67, 89,
7483 10, 11, 12, };
7485 8 EXAMPLE 6 To demonstrate the redefinition rules, the following sequence is valid.
7486 #define OBJ_LIKE (1-1)
7487 #define OBJ_LIKE /* white space */ (1-1) /* other */
7488 #define FUNC_LIKE(a) ( a )
7489 #define FUNC_LIKE( a )( /* note the white space */ \
7490 a /* other stuff on this line
7491 */ )
7492 But the following redefinitions are invalid:
7493 #define OBJ_LIKE (0) // different token sequence
7494 #define OBJ_LIKE (1 - 1) // different white space
7495 #define FUNC_LIKE(b) ( a ) // different parameter usage
7496 #define FUNC_LIKE(b) ( b ) // different parameter spelling
7498 9 EXAMPLE 7 Finally, to show the variable argument list macro facilities:
7500 [<a name="p172" href="#p172">page 172</a>] (<a href="#Contents">Contents</a>)
7502 #define debug(...) fprintf(stderr, __VA_ARGS__)
7503 #define showlist(...) puts(#__VA_ARGS__)
7504 #define report(test, ...) ((test)?puts(#test):\
7505 printf(__VA_ARGS__))
7506 debug("Flag");
7507 debug("X = %d\n", x);
7508 showlist(The first, second, and third items.);
7509 report(x&gt;y, "x is %d but y is %d", x, y);
7510 results in
7511 fprintf(stderr, "Flag" );
7512 fprintf(stderr, "X = %d\n", x );
7513 puts( "The first, second, and third items." );
7514 ((x&gt;y)?puts("x&gt;y"):
7515 printf("x is %d but y is %d", x, y));
7517 <a name="6.10.4" href="#6.10.4"><b> 6.10.4 Line control</b></a>
7518 <b> Constraints</b>
7519 1 The string literal of a #line directive, if present, shall be a character string literal.
7520 <b> Semantics</b>
7521 2 The line number of the current source line is one greater than the number of new-line
7522 characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
7523 file to the current token.
7524 3 A preprocessing directive of the form
7525 # line digit-sequence new-line
7526 causes the implementation to behave as if the following sequence of source lines begins
7527 with a source line that has a line number as specified by the digit sequence (interpreted as
7528 a decimal integer). The digit sequence shall not specify zero, nor a number greater than
7529 2147483647.
7530 4 A preprocessing directive of the form
7531 # line digit-sequence "s-char-sequenceopt" new-line
7532 sets the presumed line number similarly and changes the presumed name of the source
7533 file to be the contents of the character string literal.
7534 5 A preprocessing directive of the form
7535 # line pp-tokens new-line
7536 (that does not match one of the two previous forms) is permitted. The preprocessing
7537 tokens after line on the directive are processed just as in normal text (each identifier
7538 currently defined as a macro name is replaced by its replacement list of preprocessing
7539 tokens). The directive resulting after all replacements shall match one of the two
7540 previous forms and is then processed as appropriate.
7542 [<a name="p173" href="#p173">page 173</a>] (<a href="#Contents">Contents</a>)
7544 <a name="6.10.5" href="#6.10.5"><b> 6.10.5 Error directive</b></a>
7545 <b> Semantics</b>
7546 1 A preprocessing directive of the form
7547 # error pp-tokensopt new-line
7548 causes the implementation to produce a diagnostic message that includes the specified
7549 sequence of preprocessing tokens.
7550 <a name="6.10.6" href="#6.10.6"><b> 6.10.6 Pragma directive</b></a>
7551 <b> Semantics</b>
7552 1 A preprocessing directive of the form
7553 # pragma pp-tokensopt new-line
7554 where the preprocessing token STDC does not immediately follow pragma in the
7555 directive (prior to any macro replacement)<sup><a href="#note174"><b>174)</b></a></sup> causes the implementation to behave in an
7556 implementation-defined manner. The behavior might cause translation to fail or cause the
7557 translator or the resulting program to behave in a non-conforming manner. Any such
7558 pragma that is not recognized by the implementation is ignored.
7559 2 If the preprocessing token STDC does immediately follow pragma in the directive (prior
7560 to any macro replacement), then no macro replacement is performed on the directive, and
7561 the directive shall have one of the following forms<sup><a href="#note175"><b>175)</b></a></sup> whose meanings are described
7562 elsewhere:
7563 #pragma STDC FP_CONTRACT on-off-switch
7564 #pragma STDC FENV_ACCESS on-off-switch
7565 #pragma STDC CX_LIMITED_RANGE on-off-switch
7566 on-off-switch: one of
7567 ON OFF DEFAULT
7568 Forward references: the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>), the FENV_ACCESS pragma
7569 (<a href="#7.6.1">7.6.1</a>), the CX_LIMITED_RANGE pragma (<a href="#7.3.4">7.3.4</a>).
7574 <sup><a name="note174" href="#note174"><b>174)</b></a></sup> An implementation is not required to perform macro replacement in pragmas, but it is permitted
7575 except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
7576 replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
7577 implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
7578 but is not required to.
7579 <sup><a name="note175" href="#note175"><b>175)</b></a></sup> See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
7581 [<a name="p174" href="#p174">page 174</a>] (<a href="#Contents">Contents</a>)
7583 <a name="6.10.7" href="#6.10.7"><b> 6.10.7 Null directive</b></a>
7584 <b> Semantics</b>
7585 1 A preprocessing directive of the form
7586 # new-line
7587 has no effect.
7588 <a name="6.10.8" href="#6.10.8"><b> 6.10.8 Predefined macro names</b></a>
7589 1 The values of the predefined macros listed in the following subclauses<sup><a href="#note176"><b>176)</b></a></sup> (except for
7590 __FILE__ and __LINE__) remain constant throughout the translation unit.
7591 2 None of these macro names, nor the identifier defined, shall be the subject of a
7592 #define or a #undef preprocessing directive. Any other predefined macro names
7593 shall begin with a leading underscore followed by an uppercase letter or a second
7594 underscore.
7595 3 The implementation shall not predefine the macro __cplusplus, nor shall it define it
7596 in any standard header.
7597 Forward references: standard headers (<a href="#7.1.2">7.1.2</a>).
7598 <a name="6.10.8.1" href="#6.10.8.1"><b> 6.10.8.1 Mandatory macros</b></a>
7599 1 The following macro names shall be defined by the implementation:
7600 __DATE__ The date of translation of the preprocessing translation unit: a character
7601 string literal of the form "Mmm dd yyyy", where the names of the
7602 months are the same as those generated by the asctime function, and the
7603 first character of dd is a space character if the value is less than 10. If the
7604 date of translation is not available, an implementation-defined valid date
7605 shall be supplied.
7606 __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note177"><b>177)</b></a></sup>
7607 __LINE__ The presumed line number (within the current source file) of the current
7608 source line (an integer constant).177)
7609 __STDC__ The integer constant 1, intended to indicate a conforming implementation.
7610 __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
7611 implementation or the integer constant 0 if it is not.
7616 <sup><a name="note176" href="#note176"><b>176)</b></a></sup> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
7617 <sup><a name="note177" href="#note177"><b>177)</b></a></sup> The presumed source file name and line number can be changed by the #line directive.
7619 [<a name="p175" href="#p175">page 175</a>] (<a href="#Contents">Contents</a>)
7621 __STDC_VERSION__ The integer constant 201ymmL.<sup><a href="#note178"><b>178)</b></a></sup>
7622 __TIME__ The time of translation of the preprocessing translation unit: a character
7623 string literal of the form "hh:mm:ss" as in the time generated by the
7624 asctime function. If the time of translation is not available, an
7625 implementation-defined valid time shall be supplied.
7626 Forward references: the asctime function (<a href="#7.27.3.1">7.27.3.1</a>).
7627 <a name="6.10.8.2" href="#6.10.8.2"><b> 6.10.8.2 Environment macros</b></a>
7628 1 The following macro names are conditionally defined by the implementation:
7629 __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
7630 199712L). If this symbol is defined, then every character in the Unicode
7631 required set, when stored in an object of type wchar_t, has the same
7632 value as the short identifier of that character. The Unicode required set
7633 consists of all the characters that are defined by ISO/IEC 10646, along with
7634 all amendments and technical corrigenda, as of the specified year and
7635 month. If some other encoding is used, the macro shall not be defined and
7636 the actual encoding used is implementation-defined.
7637 __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
7638 the encoding for wchar_t, a member of the basic character set need not
7639 have a code value equal to its value when used as the lone character in an
7640 integer character constant.
7641 __STDC_UTF_16__ The integer constant 1, intended to indicate that values of type
7642 char16_t are UTF-16 encoded. If some other encoding is used, the
7643 macro shall not be defined and the actual encoding used is implementation-
7644 defined.
7645 __STDC_UTF_32__ The integer constant 1, intended to indicate that values of type
7646 char32_t are UTF-32 encoded. If some other encoding is used, the
7647 macro shall not be defined and the actual encoding used is implementation-
7648 defined.
7649 Forward references: common definitions (<a href="#7.19">7.19</a>), unicode utilities (<a href="#7.28">7.28</a>).
7654 <sup><a name="note178" href="#note178"><b>178)</b></a></sup> This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
7655 ISO/IEC 9899/AMD1:1995 and as 199901L in ISO/IEC 9899:1999. The intention is that this will
7656 remain an integer constant of type long int that is increased with each revision of this International
7657 Standard.
7659 [<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
7661 <a name="6.10.8.3" href="#6.10.8.3"><b> 6.10.8.3 Conditional feature macros</b></a>
7662 1 The following macro names are conditionally defined by the implementation:
7663 __STDC_ANALYZABLE__ The integer constant 1, intended to indicate conformance to
7664 the specifications in <a href="#L">annex L</a> (Analyzability).
7665 __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
7666 specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
7667 __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
7668 adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
7669 arithmetic).
7670 __STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
7671 for the extensions defined in <a href="#K">annex K</a> (Bounds-checking interfaces).<sup><a href="#note179"><b>179)</b></a></sup>
7672 __STDC_NO_ATOMICS__ The integer constant 1, intended to indicate that the
7673 implementation does not support atomic types (including the _Atomic
7674 type qualifier) and the <a href="#7.17">&lt;stdatomic.h&gt;</a> header.
7675 __STDC_NO_COMPLEX__ The integer constant 1, intended to indicate that the
7676 implementation does not support complex types or the <a href="#7.3">&lt;complex.h&gt;</a>
7677 header.
7678 __STDC_NO_THREADS__ The integer constant 1, intended to indicate that the
7679 implementation does not support the <a href="#7.26">&lt;threads.h&gt;</a> header.
7680 __STDC_NO_VLA__ The integer constant 1, intended to indicate that the
7681 implementation does not support variable length arrays or variably
7682 modified types.
7683 2 An implementation that defines __STDC_NO_COMPLEX__ shall not define
7684 __STDC_IEC_559_COMPLEX__.
7689 <sup><a name="note179" href="#note179"><b>179)</b></a></sup> The intention is that this will remain an integer constant of type long int that is increased with
7690 each revision of this International Standard.
7692 [<a name="p177" href="#p177">page 177</a>] (<a href="#Contents">Contents</a>)
7694 <a name="6.10.9" href="#6.10.9"><b> 6.10.9 Pragma operator</b></a>
7695 <b> Semantics</b>
7696 1 A unary operator expression of the form:
7697 _Pragma ( string-literal )
7698 is processed as follows: The string literal is destringized by deleting any encoding prefix,
7699 deleting the leading and trailing double-quotes, replacing each escape sequence \" by a
7700 double-quote, and replacing each escape sequence \\ by a single backslash. The
7701 resulting sequence of characters is processed through translation phase 3 to produce
7702 preprocessing tokens that are executed as if they were the pp-tokens in a pragma
7703 directive. The original four preprocessing tokens in the unary operator expression are
7704 removed.
7705 2 EXAMPLE A directive of the form:
7706 #pragma listing on "..\listing.dir"
7707 can also be expressed as:
7708 _Pragma ( "listing on \"..\\listing.dir\"" )
7709 The latter form is processed in the same way whether it appears literally as shown, or results from macro
7710 replacement, as in:
7711 #define LISTING(x) PRAGMA(listing on #x)
7712 #define PRAGMA(x) _Pragma(#x)
7713 LISTING ( ..\listing.dir )
7715 [<a name="p178" href="#p178">page 178</a>] (<a href="#Contents">Contents</a>)
7717 <a name="6.11" href="#6.11"><b> 6.11 Future language directions</b></a>
7718 <a name="6.11.1" href="#6.11.1"><b> 6.11.1 Floating types</b></a>
7719 1 Future standardization may include additional floating-point types, including those with
7720 greater range, precision, or both than long double.
7721 <a name="6.11.2" href="#6.11.2"><b> 6.11.2 Linkages of identifiers</b></a>
7722 1 Declaring an identifier with internal linkage at file scope without the static storage-
7723 class specifier is an obsolescent feature.
7724 <a name="6.11.3" href="#6.11.3"><b> 6.11.3 External names</b></a>
7725 1 Restriction of the significance of an external name to fewer than 255 characters
7726 (considering each universal character name or extended source character as a single
7727 character) is an obsolescent feature that is a concession to existing implementations.
7728 <a name="6.11.4" href="#6.11.4"><b> 6.11.4 Character escape sequences</b></a>
7729 1 Lowercase letters as escape sequences are reserved for future standardization. Other
7730 characters may be used in extensions.
7731 <a name="6.11.5" href="#6.11.5"><b> 6.11.5 Storage-class specifiers</b></a>
7732 1 The placement of a storage-class specifier other than at the beginning of the declaration
7733 specifiers in a declaration is an obsolescent feature.
7734 <a name="6.11.6" href="#6.11.6"><b> 6.11.6 Function declarators</b></a>
7735 1 The use of function declarators with empty parentheses (not prototype-format parameter
7736 type declarators) is an obsolescent feature.
7737 <a name="6.11.7" href="#6.11.7"><b> 6.11.7 Function definitions</b></a>
7738 1 The use of function definitions with separate parameter identifier and declaration lists
7739 (not prototype-format parameter type and identifier declarators) is an obsolescent feature.
7740 <a name="6.11.8" href="#6.11.8"><b> 6.11.8 Pragma directives</b></a>
7741 1 Pragmas whose first preprocessing token is STDC are reserved for future standardization.
7742 <a name="6.11.9" href="#6.11.9"><b> 6.11.9 Predefined macro names</b></a>
7743 1 Macro names beginning with __STDC_ are reserved for future standardization.
7745 [<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
7748 <a name="7" href="#7"><b> 7. Library</b></a>
7749 <a name="7.1" href="#7.1"><b> 7.1 Introduction</b></a>
7750 <a name="7.1.1" href="#7.1.1"><b> 7.1.1 Definitions of terms</b></a>
7751 1 A string is a contiguous sequence of characters terminated by and including the first null
7752 character. The term multibyte string is sometimes used instead to emphasize special
7753 processing given to multibyte characters contained in the string or to avoid confusion
7754 with a wide string. A pointer to a string is a pointer to its initial (lowest addressed)
7755 character. The length of a string is the number of bytes preceding the null character and
7756 the value of a string is the sequence of the values of the contained characters, in order.
7757 2 The decimal-point character is the character used by functions that convert floating-point
7758 numbers to or from character sequences to denote the beginning of the fractional part of
7759 such character sequences.<sup><a href="#note180"><b>180)</b></a></sup> It is represented in the text and examples by a period, but
7760 may be changed by the setlocale function.
7761 3 A null wide character is a wide character with code value zero.
7762 4 A wide string is a contiguous sequence of wide characters terminated by and including
7763 the first null wide character. A pointer to a wide string is a pointer to its initial (lowest
7764 addressed) wide character. The length of a wide string is the number of wide characters
7765 preceding the null wide character and the value of a wide string is the sequence of code
7766 values of the contained wide characters, in order.
7767 5 A shift sequence is a contiguous sequence of bytes within a multibyte string that
7768 (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
7769 corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
7770 character.<sup><a href="#note181"><b>181)</b></a></sup>
7771 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>).
7776 <sup><a name="note180" href="#note180"><b>180)</b></a></sup> The functions that make use of the decimal-point character are the numeric conversion functions
7777 (<a href="#7.22.1">7.22.1</a>, <a href="#7.29.4.1">7.29.4.1</a>) and the formatted input/output functions (<a href="#7.21.6">7.21.6</a>, <a href="#7.29.2">7.29.2</a>).
7778 <sup><a name="note181" href="#note181"><b>181)</b></a></sup> For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
7779 enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
7780 sequence of maximum length. Whether these counts provide for more than one shift sequence is the
7781 implementation's choice.
7783 [<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
7785 <a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
7786 1 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note182"><b>182)</b></a></sup>
7787 whose contents are made available by the #include preprocessing directive. The
7788 header declares a set of related functions, plus any necessary types and additional macros
7789 needed to facilitate their use. Declarations of types described in this clause shall not
7790 include type qualifiers, unless explicitly stated otherwise.
7791 2 The standard headers are<sup><a href="#note183"><b>183)</b></a></sup>
7792 <a href="#7.2">&lt;assert.h&gt;</a> <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.22">&lt;stdlib.h&gt;</a>
7793 <a href="#7.3">&lt;complex.h&gt;</a> <a href="#7.13">&lt;setjmp.h&gt;</a> <a href="#7.23">&lt;stdnoreturn.h&gt;</a>
7794 <a href="#7.4">&lt;ctype.h&gt;</a> <a href="#7.14">&lt;signal.h&gt;</a> <a href="#7.24">&lt;string.h&gt;</a>
7795 <a href="#7.5">&lt;errno.h&gt;</a> <a href="#7.15">&lt;stdalign.h&gt;</a> <a href="#7.25">&lt;tgmath.h&gt;</a>
7796 <a href="#7.6">&lt;fenv.h&gt;</a> <a href="#7.16">&lt;stdarg.h&gt;</a> <a href="#7.26">&lt;threads.h&gt;</a>
7797 <a href="#7.7">&lt;float.h&gt;</a> <a href="#7.17">&lt;stdatomic.h&gt;</a> <a href="#7.27">&lt;time.h&gt;</a>
7798 <a href="#7.8">&lt;inttypes.h&gt;</a> <a href="#7.18">&lt;stdbool.h&gt;</a> <a href="#7.28">&lt;uchar.h&gt;</a>
7799 <a href="#7.9">&lt;iso646.h&gt;</a> <a href="#7.19">&lt;stddef.h&gt;</a> <a href="#7.29">&lt;wchar.h&gt;</a>
7800 <a href="#7.10">&lt;limits.h&gt;</a> <a href="#7.20">&lt;stdint.h&gt;</a> <a href="#7.30">&lt;wctype.h&gt;</a>
7801 <a href="#7.11">&lt;locale.h&gt;</a> <a href="#7.21">&lt;stdio.h&gt;</a>
7802 3 If a file with the same name as one of the above &lt; and &gt; delimited sequences, not
7803 provided as part of the implementation, is placed in any of the standard places that are
7804 searched for included source files, the behavior is undefined.
7805 4 Standard headers may be included in any order; each may be included more than once in
7806 a given scope, with no effect different from being included only once, except that the
7807 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
7808 used, a header shall be included outside of any external declaration or definition, and it
7809 shall first be included before the first reference to any of the functions or objects it
7810 declares, or to any of the types or macros it defines. However, if an identifier is declared
7811 or defined in more than one header, the second and subsequent associated headers may be
7812 included after the initial reference to the identifier. The program shall not have any
7813 macros with names lexically identical to keywords currently defined prior to the inclusion
7814 of the header or when any macro defined in the header is expanded.
7815 5 Any definition of an object-like macro described in this clause shall expand to code that is
7816 fully protected by parentheses where necessary, so that it groups in an arbitrary
7817 expression as if it were a single identifier.
7820 <sup><a name="note182" href="#note182"><b>182)</b></a></sup> A header is not necessarily a source file, nor are the &lt; and &gt; delimited sequences in header names
7821 necessarily valid source file names.
7822 <sup><a name="note183" href="#note183"><b>183)</b></a></sup> The headers <a href="#7.3">&lt;complex.h&gt;</a>, <a href="#7.17">&lt;stdatomic.h&gt;</a>, and <a href="#7.26">&lt;threads.h&gt;</a> are conditional features that
7823 implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.
7825 [<a name="p181" href="#p181">page 181</a>] (<a href="#Contents">Contents</a>)
7827 6 Any declaration of a library function shall have external linkage.
7828 7 A summary of the contents of the standard headers is given in <a href="#B">annex B</a>.
7829 Forward references: diagnostics (<a href="#7.2">7.2</a>).
7830 <a name="7.1.3" href="#7.1.3"><b> 7.1.3 Reserved identifiers</b></a>
7831 1 Each header declares or defines all identifiers listed in its associated subclause, and
7832 optionally declares or defines identifiers listed in its associated future library directions
7833 subclause and identifiers which are always reserved either for any use or for use as file
7834 scope identifiers.
7835 -- All identifiers that begin with an underscore and either an uppercase letter or another
7836 underscore are always reserved for any use.
7837 -- All identifiers that begin with an underscore are always reserved for use as identifiers
7838 with file scope in both the ordinary and tag name spaces.
7839 -- Each macro name in any of the following subclauses (including the future library
7840 directions) is reserved for use as specified if any of its associated headers is included;
7841 unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
7842 -- All identifiers with external linkage in any of the following subclauses (including the
7843 future library directions) and errno are always reserved for use as identifiers with
7844 external linkage.<sup><a href="#note184"><b>184)</b></a></sup>
7845 -- Each identifier with file scope listed in any of the following subclauses (including the
7846 future library directions) is reserved for use as a macro name and as an identifier with
7847 file scope in the same name space if any of its associated headers is included.
7848 2 No other identifiers are reserved. If the program declares or defines an identifier in a
7849 context in which it is reserved (other than as allowed by <a href="#7.1.4">7.1.4</a>), or defines a reserved
7850 identifier as a macro name, the behavior is undefined.
7851 3 If the program removes (with #undef) any macro definition of an identifier in the first
7852 group listed above, the behavior is undefined.
7857 <sup><a name="note184" href="#note184"><b>184)</b></a></sup> The list of reserved identifiers with external linkage includes math_errhandling, setjmp,
7858 va_copy, and va_end.
7860 [<a name="p182" href="#p182">page 182</a>] (<a href="#Contents">Contents</a>)
7862 <a name="7.1.4" href="#7.1.4"><b> 7.1.4 Use of library functions</b></a>
7863 1 Each of the following statements applies unless explicitly stated otherwise in the detailed
7864 descriptions that follow: If an argument to a function has an invalid value (such as a value
7865 outside the domain of the function, or a pointer outside the address space of the program,
7866 or a null pointer, or a pointer to non-modifiable storage when the corresponding
7867 parameter is not const-qualified) or a type (after promotion) not expected by a function
7868 with variable number of arguments, the behavior is undefined. If a function argument is
7869 described as being an array, the pointer actually passed to the function shall have a value
7870 such that all address computations and accesses to objects (that would be valid if the
7871 pointer did point to the first element of such an array) are in fact valid. Any function
7872 declared in a header may be additionally implemented as a function-like macro defined in
7873 the header, so if a library function is declared explicitly when its header is included, one
7874 of the techniques shown below can be used to ensure the declaration is not affected by
7875 such a macro. Any macro definition of a function can be suppressed locally by enclosing
7876 the name of the function in parentheses, because the name is then not followed by the left
7877 parenthesis that indicates expansion of a macro function name. For the same syntactic
7878 reason, it is permitted to take the address of a library function even if it is also defined as
7879 a macro.<sup><a href="#note185"><b>185)</b></a></sup> The use of #undef to remove any macro definition will also ensure that an
7880 actual function is referred to. Any invocation of a library function that is implemented as
7881 a macro shall expand to code that evaluates each of its arguments exactly once, fully
7882 protected by parentheses where necessary, so it is generally safe to use arbitrary
7883 expressions as arguments.<sup><a href="#note186"><b>186)</b></a></sup> Likewise, those function-like macros described in the
7884 following subclauses may be invoked in an expression anywhere a function with a
7885 compatible return type could be called.<sup><a href="#note187"><b>187)</b></a></sup> All object-like macros listed as expanding to
7888 <sup><a name="note185" href="#note185"><b>185)</b></a></sup> This means that an implementation shall provide an actual function for each library function, even if it
7889 also provides a macro for that function.
7890 <sup><a name="note186" href="#note186"><b>186)</b></a></sup> Such macros might not contain the sequence points that the corresponding function calls do.
7891 <sup><a name="note187" href="#note187"><b>187)</b></a></sup> Because external identifiers and some macro names beginning with an underscore are reserved,
7892 implementations may provide special semantics for such names. For example, the identifier
7893 _BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
7894 appropriate header could specify
7895 #define abs(x) _BUILTIN_abs(x)
7896 for a compiler whose code generator will accept it.
7897 In this manner, a user desiring to guarantee that a given library function such as abs will be a genuine
7898 function may write
7899 #undef abs
7900 whether the implementation's header provides a macro implementation of abs or a built-in
7901 implementation. The prototype for the function, which precedes and is hidden by any macro
7902 definition, is thereby revealed also.
7904 [<a name="p183" href="#p183">page 183</a>] (<a href="#Contents">Contents</a>)
7906 integer constant expressions shall additionally be suitable for use in #if preprocessing
7907 directives.
7908 2 Provided that a library function can be declared without reference to any type defined in a
7909 header, it is also permissible to declare the function and use it without including its
7910 associated header.
7911 3 There is a sequence point immediately before a library function returns.
7912 4 The functions in the standard library are not guaranteed to be reentrant and may modify
7913 objects with static or thread storage duration.<sup><a href="#note188"><b>188)</b></a></sup>
7914 5 Unless explicitly stated otherwise in the detailed descriptions that follow, library
7915 functions shall prevent data races as follows: A library function shall not directly or
7916 indirectly access objects accessible by threads other than the current thread unless the
7917 objects are accessed directly or indirectly via the function's arguments. A library
7918 function shall not directly or indirectly modify objects accessible by threads other than
7919 the current thread unless the objects are accessed directly or indirectly via the function's
7920 non-const arguments.<sup><a href="#note189"><b>189)</b></a></sup> Implementations may share their own internal objects between
7921 threads if the objects are not visible to users and are protected against data races.
7922 6 Unless otherwise specified, library functions shall perform all operations solely within the
7923 current thread if those operations have effects that are visible to users.<sup><a href="#note190"><b>190)</b></a></sup>
7924 7 EXAMPLE The function atoi may be used in any of several ways:
7925 -- by use of its associated header (possibly generating a macro expansion)
7926 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
7927 const char *str;
7928 /* ... */
7929 i = atoi(str);
7930 -- by use of its associated header (assuredly generating a true function reference)
7935 <sup><a name="note188" href="#note188"><b>188)</b></a></sup> Thus, a signal handler cannot, in general, call standard library functions.
7936 <sup><a name="note189" href="#note189"><b>189)</b></a></sup> This means, for example, that an implementation is not permitted to use a static object for internal
7937 purposes without synchronization because it could cause a data race even in programs that do not
7938 explicitly share objects between threads. Similarly, an implementation of memcpy is not permitted to
7939 copy bytes beyond the specified length of the destination object and then restore the original values
7940 because it could cause a data race if the program shared those bytes between threads.
7941 <sup><a name="note190" href="#note190"><b>190)</b></a></sup> This allows implementations to parallelize operations if there are no visible side effects.
7943 [<a name="p184" href="#p184">page 184</a>] (<a href="#Contents">Contents</a>)
7945 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
7946 #undef atoi
7947 const char *str;
7948 /* ... */
7949 i = atoi(str);
7951 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
7952 const char *str;
7953 /* ... */
7954 i = (atoi)(str);
7955 -- by explicit declaration
7956 extern int atoi(const char *);
7957 const char *str;
7958 /* ... */
7959 i = atoi(str);
7961 [<a name="p185" href="#p185">page 185</a>] (<a href="#Contents">Contents</a>)
7963 <a name="7.2" href="#7.2"><b> 7.2 Diagnostics &lt;assert.h&gt;</b></a>
7964 1 The header <a href="#7.2">&lt;assert.h&gt;</a> defines the assert and static_assert macros and
7965 refers to another macro,
7966 NDEBUG
7967 which is not defined by <a href="#7.2">&lt;assert.h&gt;</a>. If NDEBUG is defined as a macro name at the
7968 point in the source file where <a href="#7.2">&lt;assert.h&gt;</a> is included, the assert macro is defined
7969 simply as
7970 #define assert(ignore) ((void)0)
7971 The assert macro is redefined according to the current state of NDEBUG each time that
7972 <a href="#7.2">&lt;assert.h&gt;</a> is included.
7973 2 The assert macro shall be implemented as a macro, not as an actual function. If the
7974 macro definition is suppressed in order to access an actual function, the behavior is
7975 undefined.
7976 3 The macro
7977 static_assert
7978 expands to _Static_assert.
7979 <a name="7.2.1" href="#7.2.1"><b> 7.2.1 Program diagnostics</b></a>
7980 <a name="7.2.1.1" href="#7.2.1.1"><b> 7.2.1.1 The assert macro</b></a>
7981 <b> Synopsis</b>
7982 1 #include <a href="#7.2">&lt;assert.h&gt;</a>
7983 void assert(scalar expression);
7984 <b> Description</b>
7985 2 The assert macro puts diagnostic tests into programs; it expands to a void expression.
7986 When it is executed, if expression (which shall have a scalar type) is false (that is,
7987 compares equal to 0), the assert macro writes information about the particular call that
7988 failed (including the text of the argument, the name of the source file, the source line
7989 number, and the name of the enclosing function -- the latter are respectively the values of
7990 the preprocessing macros __FILE__ and __LINE__ and of the identifier
7991 __func__) on the standard error stream in an implementation-defined format.<sup><a href="#note191"><b>191)</b></a></sup> It
7992 then calls the abort function.
7996 <sup><a name="note191" href="#note191"><b>191)</b></a></sup> The message written might be of the form:
7997 Assertion failed: expression, function abc, file xyz, line nnn.
7999 [<a name="p186" href="#p186">page 186</a>] (<a href="#Contents">Contents</a>)
8001 <b> Returns</b>
8002 3 The assert macro returns no value.
8003 Forward references: the abort function (<a href="#7.22.4.1">7.22.4.1</a>).
8005 [<a name="p187" href="#p187">page 187</a>] (<a href="#Contents">Contents</a>)
8007 <a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic &lt;complex.h&gt;</b></a>
8008 <a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
8009 1 The header <a href="#7.3">&lt;complex.h&gt;</a> defines macros and declares functions that support complex
8010 arithmetic.<sup><a href="#note192"><b>192)</b></a></sup>
8011 2 Implementations that define the macro __STDC_NO_COMPLEX__ need not provide
8012 this header nor support any of its facilities.
8013 3 Each synopsis specifies a family of functions consisting of a principal function with one
8014 or more double complex parameters and a double complex or double return
8015 value; and other functions with the same name but with f and l suffixes which are
8016 corresponding functions with float and long double parameters and return values.
8017 4 The macro
8018 complex
8019 expands to _Complex; the macro
8020 _Complex_I
8021 expands to a constant expression of type const float _Complex, with the value of
8022 the imaginary unit.<sup><a href="#note193"><b>193)</b></a></sup>
8023 5 The macros
8024 imaginary
8026 _Imaginary_I
8027 are defined if and only if the implementation supports imaginary types;<sup><a href="#note194"><b>194)</b></a></sup> if defined,
8028 they expand to _Imaginary and a constant expression of type const float
8029 _Imaginary with the value of the imaginary unit.
8030 6 The macro
8032 expands to either _Imaginary_I or _Complex_I. If _Imaginary_I is not
8033 defined, I shall expand to _Complex_I.
8034 7 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
8035 redefine the macros complex, imaginary, and I.
8037 <sup><a name="note192" href="#note192"><b>192)</b></a></sup> See ''future library directions'' (<a href="#7.31.1">7.31.1</a>).
8038 <sup><a name="note193" href="#note193"><b>193)</b></a></sup> The imaginary unit is a number i such that i 2 = -1.
8039 <sup><a name="note194" href="#note194"><b>194)</b></a></sup> A specification for imaginary types is in informative <a href="#G">annex G</a>.
8041 [<a name="p188" href="#p188">page 188</a>] (<a href="#Contents">Contents</a>)
8043 Forward references: IEC 60559-compatible complex arithmetic (<a href="#G">annex G</a>).
8044 <a name="7.3.2" href="#7.3.2"><b> 7.3.2 Conventions</b></a>
8045 1 Values are interpreted as radians, not degrees. An implementation may set errno but is
8046 not required to.
8047 <a name="7.3.3" href="#7.3.3"><b> 7.3.3 Branch cuts</b></a>
8048 1 Some of the functions below have branch cuts, across which the function is
8049 discontinuous. For implementations with a signed zero (including all IEC 60559
8050 implementations) that follow the specifications of <a href="#G">annex G</a>, the sign of zero distinguishes
8051 one side of a cut from another so the function is continuous (except for format
8052 limitations) as the cut is approached from either side. For example, for the square root
8053 function, which has a branch cut along the negative real axis, the top of the cut, with
8054 imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with
8055 imaginary part -0, maps to the negative imaginary axis.
8056 2 Implementations that do not support a signed zero (see <a href="#F">annex F</a>) cannot distinguish the
8057 sides of branch cuts. These implementations shall map a cut so the function is continuous
8058 as the cut is approached coming around the finite endpoint of the cut in a counter
8059 clockwise direction. (Branch cuts for the functions specified here have just one finite
8060 endpoint.) For example, for the square root function, coming counter clockwise around
8061 the finite endpoint of the cut along the negative real axis approaches the cut from above,
8062 so the cut maps to the positive imaginary axis.
8063 <a name="7.3.4" href="#7.3.4"><b> 7.3.4 The CX_LIMITED_RANGE pragma</b></a>
8064 <b> Synopsis</b>
8065 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8066 #pragma STDC CX_LIMITED_RANGE on-off-switch
8067 <b> Description</b>
8068 2 The usual mathematical formulas for complex multiply, divide, and absolute value are
8069 problematic because of their treatment of infinities and because of undue overflow and
8070 underflow. The CX_LIMITED_RANGE pragma can be used to inform the
8071 implementation that (where the state is ''on'') the usual mathematical formulas are
8072 acceptable.<sup><a href="#note195"><b>195)</b></a></sup> The pragma can occur either outside external declarations or preceding all
8073 explicit declarations and statements inside a compound statement. When outside external
8074 declarations, the pragma takes effect from its occurrence until another
8075 CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
8076 When inside a compound statement, the pragma takes effect from its occurrence until
8077 another CX_LIMITED_RANGE pragma is encountered (including within a nested
8078 compound statement), or until the end of the compound statement; at the end of a
8079 compound statement the state for the pragma is restored to its condition just before the
8081 [<a name="p189" href="#p189">page 189</a>] (<a href="#Contents">Contents</a>)
8083 compound statement. If this pragma is used in any other context, the behavior is
8084 undefined. The default state for the pragma is ''off''.
8085 <a name="7.3.5" href="#7.3.5"><b> 7.3.5 Trigonometric functions</b></a>
8086 <a name="7.3.5.1" href="#7.3.5.1"><b> 7.3.5.1 The cacos functions</b></a>
8087 <b> Synopsis</b>
8088 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8089 double complex cacos(double complex z);
8090 float complex cacosf(float complex z);
8091 long double complex cacosl(long double complex z);
8092 <b> Description</b>
8093 2 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
8094 interval [-1, +1] along the real axis.
8095 <b> Returns</b>
8096 3 The cacos functions return the complex arc cosine value, in the range of a strip
8097 mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
8098 real axis.
8099 <a name="7.3.5.2" href="#7.3.5.2"><b> 7.3.5.2 The casin functions</b></a>
8100 <b> Synopsis</b>
8101 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8102 double complex casin(double complex z);
8103 float complex casinf(float complex z);
8104 long double complex casinl(long double complex z);
8105 <b> Description</b>
8106 2 The casin functions compute the complex arc sine of z, with branch cuts outside the
8107 interval [-1, +1] along the real axis.
8108 <b> Returns</b>
8109 3 The casin functions return the complex arc sine value, in the range of a strip
8110 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
8112 <sup><a name="note195" href="#note195"><b>195)</b></a></sup> The purpose of the pragma is to allow the implementation to use the formulas:
8113 (x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
8114 (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
8115 | x + iy | = (sqrt) x 2 + y 2
8116 -----
8117 where the programmer can determine they are safe.
8119 [<a name="p190" href="#p190">page 190</a>] (<a href="#Contents">Contents</a>)
8121 along the real axis.
8122 <a name="7.3.5.3" href="#7.3.5.3"><b> 7.3.5.3 The catan functions</b></a>
8123 <b> Synopsis</b>
8124 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8125 double complex catan(double complex z);
8126 float complex catanf(float complex z);
8127 long double complex catanl(long double complex z);
8128 <b> Description</b>
8129 2 The catan functions compute the complex arc tangent of z, with branch cuts outside the
8130 interval [-i, +i] along the imaginary axis.
8131 <b> Returns</b>
8132 3 The catan functions return the complex arc tangent value, in the range of a strip
8133 mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
8134 along the real axis.
8135 <a name="7.3.5.4" href="#7.3.5.4"><b> 7.3.5.4 The ccos functions</b></a>
8136 <b> Synopsis</b>
8137 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8138 double complex ccos(double complex z);
8139 float complex ccosf(float complex z);
8140 long double complex ccosl(long double complex z);
8141 <b> Description</b>
8142 2 The ccos functions compute the complex cosine of z.
8143 <b> Returns</b>
8144 3 The ccos functions return the complex cosine value.
8145 <a name="7.3.5.5" href="#7.3.5.5"><b> 7.3.5.5 The csin functions</b></a>
8146 <b> Synopsis</b>
8147 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8148 double complex csin(double complex z);
8149 float complex csinf(float complex z);
8150 long double complex csinl(long double complex z);
8151 <b> Description</b>
8152 2 The csin functions compute the complex sine of z.
8154 [<a name="p191" href="#p191">page 191</a>] (<a href="#Contents">Contents</a>)
8156 <b> Returns</b>
8157 3 The csin functions return the complex sine value.
8158 <a name="7.3.5.6" href="#7.3.5.6"><b> 7.3.5.6 The ctan functions</b></a>
8159 <b> Synopsis</b>
8160 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8161 double complex ctan(double complex z);
8162 float complex ctanf(float complex z);
8163 long double complex ctanl(long double complex z);
8164 <b> Description</b>
8165 2 The ctan functions compute the complex tangent of z.
8166 <b> Returns</b>
8167 3 The ctan functions return the complex tangent value.
8168 <a name="7.3.6" href="#7.3.6"><b> 7.3.6 Hyperbolic functions</b></a>
8169 <a name="7.3.6.1" href="#7.3.6.1"><b> 7.3.6.1 The cacosh functions</b></a>
8170 <b> Synopsis</b>
8171 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8172 double complex cacosh(double complex z);
8173 float complex cacoshf(float complex z);
8174 long double complex cacoshl(long double complex z);
8175 <b> Description</b>
8176 2 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
8177 cut at values less than 1 along the real axis.
8178 <b> Returns</b>
8179 3 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
8180 half-strip of nonnegative values along the real axis and in the interval [-ipi , +ipi ] along the
8181 imaginary axis.
8182 <a name="7.3.6.2" href="#7.3.6.2"><b> 7.3.6.2 The casinh functions</b></a>
8183 <b> Synopsis</b>
8184 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8185 double complex casinh(double complex z);
8186 float complex casinhf(float complex z);
8187 long double complex casinhl(long double complex z);
8189 [<a name="p192" href="#p192">page 192</a>] (<a href="#Contents">Contents</a>)
8191 <b> Description</b>
8192 2 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
8193 outside the interval [-i, +i] along the imaginary axis.
8194 <b> Returns</b>
8195 3 The casinh functions return the complex arc hyperbolic sine value, in the range of a
8196 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
8197 along the imaginary axis.
8198 <a name="7.3.6.3" href="#7.3.6.3"><b> 7.3.6.3 The catanh functions</b></a>
8199 <b> Synopsis</b>
8200 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8201 double complex catanh(double complex z);
8202 float complex catanhf(float complex z);
8203 long double complex catanhl(long double complex z);
8204 <b> Description</b>
8205 2 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
8206 cuts outside the interval [-1, +1] along the real axis.
8207 <b> Returns</b>
8208 3 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
8209 strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
8210 along the imaginary axis.
8211 <a name="7.3.6.4" href="#7.3.6.4"><b> 7.3.6.4 The ccosh functions</b></a>
8212 <b> Synopsis</b>
8213 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8214 double complex ccosh(double complex z);
8215 float complex ccoshf(float complex z);
8216 long double complex ccoshl(long double complex z);
8217 <b> Description</b>
8218 2 The ccosh functions compute the complex hyperbolic cosine of z.
8219 <b> Returns</b>
8220 3 The ccosh functions return the complex hyperbolic cosine value.
8222 [<a name="p193" href="#p193">page 193</a>] (<a href="#Contents">Contents</a>)
8224 <a name="7.3.6.5" href="#7.3.6.5"><b> 7.3.6.5 The csinh functions</b></a>
8225 <b> Synopsis</b>
8226 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8227 double complex csinh(double complex z);
8228 float complex csinhf(float complex z);
8229 long double complex csinhl(long double complex z);
8230 <b> Description</b>
8231 2 The csinh functions compute the complex hyperbolic sine of z.
8232 <b> Returns</b>
8233 3 The csinh functions return the complex hyperbolic sine value.
8234 <a name="7.3.6.6" href="#7.3.6.6"><b> 7.3.6.6 The ctanh functions</b></a>
8235 <b> Synopsis</b>
8236 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8237 double complex ctanh(double complex z);
8238 float complex ctanhf(float complex z);
8239 long double complex ctanhl(long double complex z);
8240 <b> Description</b>
8241 2 The ctanh functions compute the complex hyperbolic tangent of z.
8242 <b> Returns</b>
8243 3 The ctanh functions return the complex hyperbolic tangent value.
8244 <a name="7.3.7" href="#7.3.7"><b> 7.3.7 Exponential and logarithmic functions</b></a>
8245 <a name="7.3.7.1" href="#7.3.7.1"><b> 7.3.7.1 The cexp functions</b></a>
8246 <b> Synopsis</b>
8247 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8248 double complex cexp(double complex z);
8249 float complex cexpf(float complex z);
8250 long double complex cexpl(long double complex z);
8251 <b> Description</b>
8252 2 The cexp functions compute the complex base-e exponential of z.
8253 <b> Returns</b>
8254 3 The cexp functions return the complex base-e exponential value.
8256 [<a name="p194" href="#p194">page 194</a>] (<a href="#Contents">Contents</a>)
8258 <a name="7.3.7.2" href="#7.3.7.2"><b> 7.3.7.2 The clog functions</b></a>
8259 <b> Synopsis</b>
8260 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8261 double complex clog(double complex z);
8262 float complex clogf(float complex z);
8263 long double complex clogl(long double complex z);
8264 <b> Description</b>
8265 2 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
8266 cut along the negative real axis.
8267 <b> Returns</b>
8268 3 The clog functions return the complex natural logarithm value, in the range of a strip
8269 mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
8270 imaginary axis.
8271 <a name="7.3.8" href="#7.3.8"><b> 7.3.8 Power and absolute-value functions</b></a>
8272 <a name="7.3.8.1" href="#7.3.8.1"><b> 7.3.8.1 The cabs functions</b></a>
8273 <b> Synopsis</b>
8274 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8275 double cabs(double complex z);
8276 float cabsf(float complex z);
8277 long double cabsl(long double complex z);
8278 <b> Description</b>
8279 2 The cabs functions compute the complex absolute value (also called norm, modulus, or
8280 magnitude) of z.
8281 <b> Returns</b>
8282 3 The cabs functions return the complex absolute value.
8283 <a name="7.3.8.2" href="#7.3.8.2"><b> 7.3.8.2 The cpow functions</b></a>
8284 <b> Synopsis</b>
8285 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8286 double complex cpow(double complex x, double complex y);
8287 float complex cpowf(float complex x, float complex y);
8288 long double complex cpowl(long double complex x,
8289 long double complex y);
8291 [<a name="p195" href="#p195">page 195</a>] (<a href="#Contents">Contents</a>)
8293 <b> Description</b>
8294 2 The cpow functions compute the complex power function xy , with a branch cut for the
8295 first parameter along the negative real axis.
8296 <b> Returns</b>
8297 3 The cpow functions return the complex power function value.
8298 <a name="7.3.8.3" href="#7.3.8.3"><b> 7.3.8.3 The csqrt functions</b></a>
8299 <b> Synopsis</b>
8300 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8301 double complex csqrt(double complex z);
8302 float complex csqrtf(float complex z);
8303 long double complex csqrtl(long double complex z);
8304 <b> Description</b>
8305 2 The csqrt functions compute the complex square root of z, with a branch cut along the
8306 negative real axis.
8307 <b> Returns</b>
8308 3 The csqrt functions return the complex square root value, in the range of the right half-
8309 plane (including the imaginary axis).
8310 <a name="7.3.9" href="#7.3.9"><b> 7.3.9 Manipulation functions</b></a>
8311 <a name="7.3.9.1" href="#7.3.9.1"><b> 7.3.9.1 The carg functions</b></a>
8312 <b> Synopsis</b>
8313 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8314 double carg(double complex z);
8315 float cargf(float complex z);
8316 long double cargl(long double complex z);
8317 <b> Description</b>
8318 2 The carg functions compute the argument (also called phase angle) of z, with a branch
8319 cut along the negative real axis.
8320 <b> Returns</b>
8321 3 The carg functions return the value of the argument in the interval [-pi , +pi ].
8323 [<a name="p196" href="#p196">page 196</a>] (<a href="#Contents">Contents</a>)
8325 <a name="7.3.9.2" href="#7.3.9.2"><b> 7.3.9.2 The cimag functions</b></a>
8326 <b> Synopsis</b>
8327 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8328 double cimag(double complex z);
8329 float cimagf(float complex z);
8330 long double cimagl(long double complex z);
8331 <b> Description</b>
8332 2 The cimag functions compute the imaginary part of z.<sup><a href="#note196"><b>196)</b></a></sup>
8333 <b> Returns</b>
8334 3 The cimag functions return the imaginary part value (as a real).
8335 <a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The CMPLX macros</b></a>
8336 <b> Synopsis</b>
8337 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8338 double complex CMPLX(double x, double y);
8339 float complex CMPLXF(float x, float y);
8340 long double complex CMPLXL(long double x, long double y);
8341 <b> Description</b>
8342 2 The CMPLX macros expand to an expression of the specified complex type, with the real
8343 part having the (converted) value of x and the imaginary part having the (converted)
8344 value of y. The resulting expression shall be suitable for use as an initializer for an object
8345 with static or thread storage duration, provided both arguments are likewise suitable.
8346 <b> Returns</b>
8347 3 The CMPLX macros return the complex value x + i y.
8348 4 NOTE These macros act as if the implementation supported imaginary types and the definitions were:
8349 #define CMPLX(x, y) ((double complex)((double)(x) + \
8350 _Imaginary_I * (double)(y)))
8351 #define CMPLXF(x, y) ((float complex)((float)(x) + \
8352 _Imaginary_I * (float)(y)))
8353 #define CMPLXL(x, y) ((long double complex)((long double)(x) + \
8354 _Imaginary_I * (long double)(y)))
8359 <sup><a name="note196" href="#note196"><b>196)</b></a></sup> For a variable z of complex type, z == creal(z) + cimag(z)*I.
8361 [<a name="p197" href="#p197">page 197</a>] (<a href="#Contents">Contents</a>)
8363 <a name="7.3.9.4" href="#7.3.9.4"><b> 7.3.9.4 The conj functions</b></a>
8364 <b> Synopsis</b>
8365 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8366 double complex conj(double complex z);
8367 float complex conjf(float complex z);
8368 long double complex conjl(long double complex z);
8369 <b> Description</b>
8370 2 The conj functions compute the complex conjugate of z, by reversing the sign of its
8371 imaginary part.
8372 <b> Returns</b>
8373 3 The conj functions return the complex conjugate value.
8374 <a name="7.3.9.5" href="#7.3.9.5"><b> 7.3.9.5 The cproj functions</b></a>
8375 <b> Synopsis</b>
8376 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8377 double complex cproj(double complex z);
8378 float complex cprojf(float complex z);
8379 long double complex cprojl(long double complex z);
8380 <b> Description</b>
8381 2 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
8382 z except that all complex infinities (even those with one infinite part and one NaN part)
8383 project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
8384 equivalent to
8385 INFINITY + I * copysign(0.0, cimag(z))
8386 <b> Returns</b>
8387 3 The cproj functions return the value of the projection onto the Riemann sphere.
8388 <a name="7.3.9.6" href="#7.3.9.6"><b> 7.3.9.6 The creal functions</b></a>
8389 <b> Synopsis</b>
8390 1 #include <a href="#7.3">&lt;complex.h&gt;</a>
8391 double creal(double complex z);
8392 float crealf(float complex z);
8393 long double creall(long double complex z);
8394 <b> Description</b>
8395 2 The creal functions compute the real part of z.<sup><a href="#note197"><b>197)</b></a></sup>
8397 [<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
8399 <b> Returns</b>
8400 3 The creal functions return the real part value.
8405 <sup><a name="note197" href="#note197"><b>197)</b></a></sup> For a variable z of complex type, z == creal(z) + cimag(z)*I.
8407 [<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
8409 <a name="7.4" href="#7.4"><b> 7.4 Character handling &lt;ctype.h&gt;</b></a>
8410 1 The header <a href="#7.4">&lt;ctype.h&gt;</a> declares several functions useful for classifying and mapping
8411 characters.<sup><a href="#note198"><b>198)</b></a></sup> In all cases the argument is an int, the value of which shall be
8412 representable as an unsigned char or shall equal the value of the macro EOF. If the
8413 argument has any other value, the behavior is undefined.
8414 2 The behavior of these functions is affected by the current locale. Those functions that
8415 have locale-specific aspects only when not in the "C" locale are noted below.
8416 3 The term printing character refers to a member of a locale-specific set of characters, each
8417 of which occupies one printing position on a display device; the term control character
8418 refers to a member of a locale-specific set of characters that are not printing
8419 characters.<sup><a href="#note199"><b>199)</b></a></sup> All letters and digits are printing characters.
8420 Forward references: EOF (<a href="#7.21.1">7.21.1</a>), localization (<a href="#7.11">7.11</a>).
8421 <a name="7.4.1" href="#7.4.1"><b> 7.4.1 Character classification functions</b></a>
8422 1 The functions in this subclause return nonzero (true) if and only if the value of the
8423 argument c conforms to that in the description of the function.
8424 <a name="7.4.1.1" href="#7.4.1.1"><b> 7.4.1.1 The isalnum function</b></a>
8425 <b> Synopsis</b>
8426 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8427 int isalnum(int c);
8428 <b> Description</b>
8429 2 The isalnum function tests for any character for which isalpha or isdigit is true.
8430 <a name="7.4.1.2" href="#7.4.1.2"><b> 7.4.1.2 The isalpha function</b></a>
8431 <b> Synopsis</b>
8432 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8433 int isalpha(int c);
8434 <b> Description</b>
8435 2 The isalpha function tests for any character for which isupper or islower is true,
8436 or any character that is one of a locale-specific set of alphabetic characters for which
8440 <sup><a name="note198" href="#note198"><b>198)</b></a></sup> See ''future library directions'' (<a href="#7.31.2">7.31.2</a>).
8441 <sup><a name="note199" href="#note199"><b>199)</b></a></sup> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
8442 whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
8443 values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
8445 [<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
8447 none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note200"><b>200)</b></a></sup> In the "C" locale,
8448 isalpha returns true only for the characters for which isupper or islower is true.
8449 <a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
8450 <b> Synopsis</b>
8451 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8452 int isblank(int c);
8453 <b> Description</b>
8454 2 The isblank function tests for any character that is a standard blank character or is one
8455 of a locale-specific set of characters for which isspace is true and that is used to
8456 separate words within a line of text. The standard blank characters are the following:
8457 space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
8458 for the standard blank characters.
8459 <a name="7.4.1.4" href="#7.4.1.4"><b> 7.4.1.4 The iscntrl function</b></a>
8460 <b> Synopsis</b>
8461 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8462 int iscntrl(int c);
8463 <b> Description</b>
8464 2 The iscntrl function tests for any control character.
8465 <a name="7.4.1.5" href="#7.4.1.5"><b> 7.4.1.5 The isdigit function</b></a>
8466 <b> Synopsis</b>
8467 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8468 int isdigit(int c);
8469 <b> Description</b>
8470 2 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
8471 <a name="7.4.1.6" href="#7.4.1.6"><b> 7.4.1.6 The isgraph function</b></a>
8472 <b> Synopsis</b>
8473 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8474 int isgraph(int c);
8479 <sup><a name="note200" href="#note200"><b>200)</b></a></sup> The functions islower and isupper test true or false separately for each of these additional
8480 characters; all four combinations are possible.
8482 [<a name="p201" href="#p201">page 201</a>] (<a href="#Contents">Contents</a>)
8484 <b> Description</b>
8485 2 The isgraph function tests for any printing character except space (' ').
8486 <a name="7.4.1.7" href="#7.4.1.7"><b> 7.4.1.7 The islower function</b></a>
8487 <b> Synopsis</b>
8488 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8489 int islower(int c);
8490 <b> Description</b>
8491 2 The islower function tests for any character that is a lowercase letter or is one of a
8492 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
8493 isspace is true. In the "C" locale, islower returns true only for the lowercase
8494 letters (as defined in <a href="#5.2.1">5.2.1</a>).
8495 <a name="7.4.1.8" href="#7.4.1.8"><b> 7.4.1.8 The isprint function</b></a>
8496 <b> Synopsis</b>
8497 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8498 int isprint(int c);
8499 <b> Description</b>
8500 2 The isprint function tests for any printing character including space (' ').
8501 <a name="7.4.1.9" href="#7.4.1.9"><b> 7.4.1.9 The ispunct function</b></a>
8502 <b> Synopsis</b>
8503 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8504 int ispunct(int c);
8505 <b> Description</b>
8506 2 The ispunct function tests for any printing character that is one of a locale-specific set
8507 of punctuation characters for which neither isspace nor isalnum is true. In the "C"
8508 locale, ispunct returns true for every printing character for which neither isspace
8509 nor isalnum is true.
8510 <a name="7.4.1.10" href="#7.4.1.10"><b> 7.4.1.10 The isspace function</b></a>
8511 <b> Synopsis</b>
8512 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8513 int isspace(int c);
8514 <b> Description</b>
8515 2 The isspace function tests for any character that is a standard white-space character or
8516 is one of a locale-specific set of characters for which isalnum is false. The standard
8518 [<a name="p202" href="#p202">page 202</a>] (<a href="#Contents">Contents</a>)
8520 white-space characters are the following: space (' '), form feed ('\f'), new-line
8521 ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
8522 "C" locale, isspace returns true only for the standard white-space characters.
8523 <a name="7.4.1.11" href="#7.4.1.11"><b> 7.4.1.11 The isupper function</b></a>
8524 <b> Synopsis</b>
8525 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8526 int isupper(int c);
8527 <b> Description</b>
8528 2 The isupper function tests for any character that is an uppercase letter or is one of a
8529 locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
8530 isspace is true. In the "C" locale, isupper returns true only for the uppercase
8531 letters (as defined in <a href="#5.2.1">5.2.1</a>).
8532 <a name="7.4.1.12" href="#7.4.1.12"><b> 7.4.1.12 The isxdigit function</b></a>
8533 <b> Synopsis</b>
8534 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8535 int isxdigit(int c);
8536 <b> Description</b>
8537 2 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
8538 <a name="7.4.2" href="#7.4.2"><b> 7.4.2 Character case mapping functions</b></a>
8539 <a name="7.4.2.1" href="#7.4.2.1"><b> 7.4.2.1 The tolower function</b></a>
8540 <b> Synopsis</b>
8541 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8542 int tolower(int c);
8543 <b> Description</b>
8544 2 The tolower function converts an uppercase letter to a corresponding lowercase letter.
8545 <b> Returns</b>
8546 3 If the argument is a character for which isupper is true and there are one or more
8547 corresponding characters, as specified by the current locale, for which islower is true,
8548 the tolower function returns one of the corresponding characters (always the same one
8549 for any given locale); otherwise, the argument is returned unchanged.
8551 [<a name="p203" href="#p203">page 203</a>] (<a href="#Contents">Contents</a>)
8553 <a name="7.4.2.2" href="#7.4.2.2"><b> 7.4.2.2 The toupper function</b></a>
8554 <b> Synopsis</b>
8555 1 #include <a href="#7.4">&lt;ctype.h&gt;</a>
8556 int toupper(int c);
8557 <b> Description</b>
8558 2 The toupper function converts a lowercase letter to a corresponding uppercase letter.
8559 <b> Returns</b>
8560 3 If the argument is a character for which islower is true and there are one or more
8561 corresponding characters, as specified by the current locale, for which isupper is true,
8562 the toupper function returns one of the corresponding characters (always the same one
8563 for any given locale); otherwise, the argument is returned unchanged.
8565 [<a name="p204" href="#p204">page 204</a>] (<a href="#Contents">Contents</a>)
8567 <a name="7.5" href="#7.5"><b> 7.5 Errors &lt;errno.h&gt;</b></a>
8568 1 The header <a href="#7.5">&lt;errno.h&gt;</a> defines several macros, all relating to the reporting of error
8569 conditions.
8570 2 The macros are
8571 EDOM
8572 EILSEQ
8573 ERANGE
8574 which expand to integer constant expressions with type int, distinct positive values, and
8575 which are suitable for use in #if preprocessing directives; and
8576 errno
8577 which expands to a modifiable lvalue<sup><a href="#note201"><b>201)</b></a></sup> that has type int and thread local storage
8578 duration, the value of which is set to a positive error number by several library functions.
8579 If a macro definition is suppressed in order to access an actual object, or a program
8580 defines an identifier with the name errno, the behavior is undefined.
8581 3 The value of errno in the initial thread is zero at program startup (the initial value of
8582 errno in other threads is an indeterminate value), but is never set to zero by any library
8583 function.<sup><a href="#note202"><b>202)</b></a></sup> The value of errno may be set to nonzero by a library function call
8584 whether or not there is an error, provided the use of errno is not documented in the
8585 description of the function in this International Standard.
8586 4 Additional macro definitions, beginning with E and a digit or E and an uppercase
8587 letter,<sup><a href="#note203"><b>203)</b></a></sup> may also be specified by the implementation.
8592 <sup><a name="note201" href="#note201"><b>201)</b></a></sup> The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue
8593 resulting from a function call (for example, *errno()).
8594 <sup><a name="note202" href="#note202"><b>202)</b></a></sup> Thus, a program that uses errno for error checking should set it to zero before a library function call,
8595 then inspect it before a subsequent library function call. Of course, a library function can save the
8596 value of errno on entry and then set it to zero, as long as the original value is restored if errno's
8597 value is still zero just before the return.
8598 <sup><a name="note203" href="#note203"><b>203)</b></a></sup> See ''future library directions'' (<a href="#7.31.3">7.31.3</a>).
8600 [<a name="p205" href="#p205">page 205</a>] (<a href="#Contents">Contents</a>)
8602 <a name="7.6" href="#7.6"><b> 7.6 Floating-point environment &lt;fenv.h&gt;</b></a>
8603 1 The header <a href="#7.6">&lt;fenv.h&gt;</a> defines several macros, and declares types and functions that
8604 provide access to the floating-point environment. The floating-point environment refers
8605 collectively to any floating-point status flags and control modes supported by the
8606 implementation.<sup><a href="#note204"><b>204)</b></a></sup> A floating-point status flag is a system variable whose value is set
8607 (but never cleared) when a floating-point exception is raised, which occurs as a side effect
8608 of exceptional floating-point arithmetic to provide auxiliary information.<sup><a href="#note205"><b>205)</b></a></sup> A floating-
8609 point control mode is a system variable whose value may be set by the user to affect the
8610 subsequent behavior of floating-point arithmetic.
8611 2 The floating-point environment has thread storage duration. The initial state for a
8612 thread's floating-point environment is the current state of the floating-point environment
8613 of the thread that creates it at the time of creation.
8614 3 Certain programming conventions support the intended model of use for the floating-
8615 point environment:<sup><a href="#note206"><b>206)</b></a></sup>
8616 -- a function call does not alter its caller's floating-point control modes, clear its caller's
8617 floating-point status flags, nor depend on the state of its caller's floating-point status
8618 flags unless the function is so documented;
8619 -- a function call is assumed to require default floating-point control modes, unless its
8620 documentation promises otherwise;
8621 -- a function call is assumed to have the potential for raising floating-point exceptions,
8622 unless its documentation promises otherwise.
8623 4 The type
8624 fenv_t
8625 represents the entire floating-point environment.
8626 5 The type
8627 fexcept_t
8628 represents the floating-point status flags collectively, including any status the
8629 implementation associates with the flags.
8632 <sup><a name="note204" href="#note204"><b>204)</b></a></sup> This header is designed to support the floating-point exception status flags and directed-rounding
8633 control modes required by IEC 60559, and other similar floating-point state information. It is also
8634 designed to facilitate code portability among all systems.
8635 <sup><a name="note205" href="#note205"><b>205)</b></a></sup> A floating-point status flag is not an object and can be set more than once within an expression.
8636 <sup><a name="note206" href="#note206"><b>206)</b></a></sup> With these conventions, a programmer can safely assume default floating-point control modes (or be
8637 unaware of them). The responsibilities associated with accessing the floating-point environment fall
8638 on the programmer or program that does so explicitly.
8640 [<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
8642 6 Each of the macros
8643 FE_DIVBYZERO
8644 FE_INEXACT
8645 FE_INVALID
8646 FE_OVERFLOW
8647 FE_UNDERFLOW
8648 is defined if and only if the implementation supports the floating-point exception by
8649 means of the functions in 7.6.2.<sup><a href="#note207"><b>207)</b></a></sup> Additional implementation-defined floating-point
8650 exceptions, with macro definitions beginning with FE_ and an uppercase letter,<sup><a href="#note208"><b>208)</b></a></sup> may
8651 also be specified by the implementation. The defined macros expand to integer constant
8652 expressions with values such that bitwise ORs of all combinations of the macros result in
8653 distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
8654 zero.<sup><a href="#note209"><b>209)</b></a></sup>
8655 7 The macro
8656 FE_ALL_EXCEPT
8657 is simply the bitwise OR of all floating-point exception macros defined by the
8658 implementation. If no such macros are defined, FE_ALL_EXCEPT shall be defined as 0.
8659 8 Each of the macros
8660 FE_DOWNWARD
8661 FE_TONEAREST
8662 FE_TOWARDZERO
8663 FE_UPWARD
8664 is defined if and only if the implementation supports getting and setting the represented
8665 rounding direction by means of the fegetround and fesetround functions.
8666 Additional implementation-defined rounding directions, with macro definitions beginning
8667 with FE_ and an uppercase letter,<sup><a href="#note210"><b>210)</b></a></sup> may also be specified by the implementation. The
8668 defined macros expand to integer constant expressions whose values are distinct
8669 nonnegative values.<sup><a href="#note211"><b>211)</b></a></sup>
8672 <sup><a name="note207" href="#note207"><b>207)</b></a></sup> The implementation supports a floating-point exception if there are circumstances where a call to at
8673 least one of the functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not
8674 necessary for all the functions to succeed all the time.
8675 <sup><a name="note208" href="#note208"><b>208)</b></a></sup> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
8676 <sup><a name="note209" href="#note209"><b>209)</b></a></sup> The macros should be distinct powers of two.
8677 <sup><a name="note210" href="#note210"><b>210)</b></a></sup> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
8678 <sup><a name="note211" href="#note211"><b>211)</b></a></sup> Even though the rounding direction macros may expand to constants corresponding to the values of
8679 FLT_ROUNDS, they are not required to do so.
8681 [<a name="p207" href="#p207">page 207</a>] (<a href="#Contents">Contents</a>)
8683 9 The macro
8684 FE_DFL_ENV
8685 represents the default floating-point environment -- the one installed at program startup
8686 -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
8687 <a href="#7.6">&lt;fenv.h&gt;</a> functions that manage the floating-point environment.
8688 10 Additional implementation-defined environments, with macro definitions beginning with
8689 FE_ and an uppercase letter,<sup><a href="#note212"><b>212)</b></a></sup> and having type ''pointer to const-qualified fenv_t'',
8690 may also be specified by the implementation.
8691 <a name="7.6.1" href="#7.6.1"><b> 7.6.1 The FENV_ACCESS pragma</b></a>
8692 <b> Synopsis</b>
8693 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8694 #pragma STDC FENV_ACCESS on-off-switch
8695 <b> Description</b>
8696 2 The FENV_ACCESS pragma provides a means to inform the implementation when a
8697 program might access the floating-point environment to test floating-point status flags or
8698 run under non-default floating-point control modes.<sup><a href="#note213"><b>213)</b></a></sup> The pragma shall occur either
8699 outside external declarations or preceding all explicit declarations and statements inside a
8700 compound statement. When outside external declarations, the pragma takes effect from
8701 its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
8702 the translation unit. When inside a compound statement, the pragma takes effect from its
8703 occurrence until another FENV_ACCESS pragma is encountered (including within a
8704 nested compound statement), or until the end of the compound statement; at the end of a
8705 compound statement the state for the pragma is restored to its condition just before the
8706 compound statement. If this pragma is used in any other context, the behavior is
8707 undefined. If part of a program tests floating-point status flags, sets floating-point control
8708 modes, or runs under non-default mode settings, but was translated with the state for the
8709 FENV_ACCESS pragma ''off'', the behavior is undefined. The default state (''on'' or
8710 ''off'') for the pragma is implementation-defined. (When execution passes from a part of
8711 the program translated with FENV_ACCESS ''off'' to a part translated with
8712 FENV_ACCESS ''on'', the state of the floating-point status flags is unspecified and the
8713 floating-point control modes have their default settings.)
8717 <sup><a name="note212" href="#note212"><b>212)</b></a></sup> See ''future library directions'' (<a href="#7.31.4">7.31.4</a>).
8718 <sup><a name="note213" href="#note213"><b>213)</b></a></sup> The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag
8719 tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
8720 folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
8721 modes are in effect and the flags are not tested.
8723 [<a name="p208" href="#p208">page 208</a>] (<a href="#Contents">Contents</a>)
8725 3 EXAMPLE
8726 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8727 void f(double x)
8729 #pragma STDC FENV_ACCESS ON
8730 void g(double);
8731 void h(double);
8732 /* ... */
8733 g(x + 1);
8734 h(x + 1);
8735 /* ... */
8737 4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
8738 x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
8739 contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.<sup><a href="#note214"><b>214)</b></a></sup>
8741 <a name="7.6.2" href="#7.6.2"><b> 7.6.2 Floating-point exceptions</b></a>
8742 1 The following functions provide access to the floating-point status flags.<sup><a href="#note215"><b>215)</b></a></sup> The int
8743 input argument for the functions represents a subset of floating-point exceptions, and can
8744 be zero or the bitwise OR of one or more floating-point exception macros, for example
8745 FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
8746 functions is undefined.
8747 <a name="7.6.2.1" href="#7.6.2.1"><b> 7.6.2.1 The feclearexcept function</b></a>
8748 <b> Synopsis</b>
8749 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8750 int feclearexcept(int excepts);
8751 <b> Description</b>
8752 2 The feclearexcept function attempts to clear the supported floating-point exceptions
8753 represented by its argument.
8754 <b> Returns</b>
8755 3 The feclearexcept function returns zero if the excepts argument is zero or if all
8756 the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
8759 <sup><a name="note214" href="#note214"><b>214)</b></a></sup> The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
8760 hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
8761 ''off'', just one evaluation of x + 1 would suffice.
8762 <sup><a name="note215" href="#note215"><b>215)</b></a></sup> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
8763 abstraction of flags that are either set or clear. An implementation may endow floating-point status
8764 flags with more information -- for example, the address of the code which first raised the floating-
8765 point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
8766 content of flags.
8768 [<a name="p209" href="#p209">page 209</a>] (<a href="#Contents">Contents</a>)
8770 <a name="7.6.2.2" href="#7.6.2.2"><b> 7.6.2.2 The fegetexceptflag function</b></a>
8771 <b> Synopsis</b>
8772 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8773 int fegetexceptflag(fexcept_t *flagp,
8774 int excepts);
8775 <b> Description</b>
8776 2 The fegetexceptflag function attempts to store an implementation-defined
8777 representation of the states of the floating-point status flags indicated by the argument
8778 excepts in the object pointed to by the argument flagp.
8779 <b> Returns</b>
8780 3 The fegetexceptflag function returns zero if the representation was successfully
8781 stored. Otherwise, it returns a nonzero value.
8782 <a name="7.6.2.3" href="#7.6.2.3"><b> 7.6.2.3 The feraiseexcept function</b></a>
8783 <b> Synopsis</b>
8784 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8785 int feraiseexcept(int excepts);
8786 <b> Description</b>
8787 2 The feraiseexcept function attempts to raise the supported floating-point exceptions
8788 represented by its argument.<sup><a href="#note216"><b>216)</b></a></sup> The order in which these floating-point exceptions are
8789 raised is unspecified, except as stated in <a href="#F.8.6">F.8.6</a>. Whether the feraiseexcept function
8790 additionally raises the ''inexact'' floating-point exception whenever it raises the
8791 ''overflow'' or ''underflow'' floating-point exception is implementation-defined.
8792 <b> Returns</b>
8793 3 The feraiseexcept function returns zero if the excepts argument is zero or if all
8794 the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
8799 <sup><a name="note216" href="#note216"><b>216)</b></a></sup> The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
8800 Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
8801 in <a href="#F.8.6">F.8.6</a> is in the same spirit.
8803 [<a name="p210" href="#p210">page 210</a>] (<a href="#Contents">Contents</a>)
8805 <a name="7.6.2.4" href="#7.6.2.4"><b> 7.6.2.4 The fesetexceptflag function</b></a>
8806 <b> Synopsis</b>
8807 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8808 int fesetexceptflag(const fexcept_t *flagp,
8809 int excepts);
8810 <b> Description</b>
8811 2 The fesetexceptflag function attempts to set the floating-point status flags
8812 indicated by the argument excepts to the states stored in the object pointed to by
8813 flagp. The value of *flagp shall have been set by a previous call to
8814 fegetexceptflag whose second argument represented at least those floating-point
8815 exceptions represented by the argument excepts. This function does not raise floating-
8816 point exceptions, but only sets the state of the flags.
8817 <b> Returns</b>
8818 3 The fesetexceptflag function returns zero if the excepts argument is zero or if
8819 all the specified flags were successfully set to the appropriate state. Otherwise, it returns
8820 a nonzero value.
8821 <a name="7.6.2.5" href="#7.6.2.5"><b> 7.6.2.5 The fetestexcept function</b></a>
8822 <b> Synopsis</b>
8823 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8824 int fetestexcept(int excepts);
8825 <b> Description</b>
8826 2 The fetestexcept function determines which of a specified subset of the floating-
8827 point exception flags are currently set. The excepts argument specifies the floating-
8828 point status flags to be queried.<sup><a href="#note217"><b>217)</b></a></sup>
8829 <b> Returns</b>
8830 3 The fetestexcept function returns the value of the bitwise OR of the floating-point
8831 exception macros corresponding to the currently set floating-point exceptions included in
8832 excepts.
8833 4 EXAMPLE Call f if ''invalid'' is set, then g if ''overflow'' is set:
8838 <sup><a name="note217" href="#note217"><b>217)</b></a></sup> This mechanism allows testing several floating-point exceptions with just one function call.
8840 [<a name="p211" href="#p211">page 211</a>] (<a href="#Contents">Contents</a>)
8842 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8843 /* ... */
8845 #pragma STDC FENV_ACCESS ON
8846 int set_excepts;
8847 feclearexcept(FE_INVALID | FE_OVERFLOW);
8848 // maybe raise exceptions
8849 set_excepts = fetestexcept(FE_INVALID | FE_OVERFLOW);
8850 if (set_excepts &amp; FE_INVALID) f();
8851 if (set_excepts &amp; FE_OVERFLOW) g();
8852 /* ... */
8855 <a name="7.6.3" href="#7.6.3"><b> 7.6.3 Rounding</b></a>
8856 1 The fegetround and fesetround functions provide control of rounding direction
8857 modes.
8858 <a name="7.6.3.1" href="#7.6.3.1"><b> 7.6.3.1 The fegetround function</b></a>
8859 <b> Synopsis</b>
8860 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8861 int fegetround(void);
8862 <b> Description</b>
8863 2 The fegetround function gets the current rounding direction.
8864 <b> Returns</b>
8865 3 The fegetround function returns the value of the rounding direction macro
8866 representing the current rounding direction or a negative value if there is no such
8867 rounding direction macro or the current rounding direction is not determinable.
8868 <a name="7.6.3.2" href="#7.6.3.2"><b> 7.6.3.2 The fesetround function</b></a>
8869 <b> Synopsis</b>
8870 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8871 int fesetround(int round);
8872 <b> Description</b>
8873 2 The fesetround function establishes the rounding direction represented by its
8874 argument round. If the argument is not equal to the value of a rounding direction macro,
8875 the rounding direction is not changed.
8876 <b> Returns</b>
8877 3 The fesetround function returns zero if and only if the requested rounding direction
8878 was established.
8880 [<a name="p212" href="#p212">page 212</a>] (<a href="#Contents">Contents</a>)
8882 4 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
8883 rounding direction fails.
8884 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8885 #include <a href="#7.2">&lt;assert.h&gt;</a>
8886 void f(int round_dir)
8888 #pragma STDC FENV_ACCESS ON
8889 int save_round;
8890 int setround_ok;
8891 save_round = fegetround();
8892 setround_ok = fesetround(round_dir);
8893 assert(setround_ok == 0);
8894 /* ... */
8895 fesetround(save_round);
8896 /* ... */
8899 <a name="7.6.4" href="#7.6.4"><b> 7.6.4 Environment</b></a>
8900 1 The functions in this section manage the floating-point environment -- status flags and
8901 control modes -- as one entity.
8902 <a name="7.6.4.1" href="#7.6.4.1"><b> 7.6.4.1 The fegetenv function</b></a>
8903 <b> Synopsis</b>
8904 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8905 int fegetenv(fenv_t *envp);
8906 <b> Description</b>
8907 2 The fegetenv function attempts to store the current floating-point environment in the
8908 object pointed to by envp.
8909 <b> Returns</b>
8910 3 The fegetenv function returns zero if the environment was successfully stored.
8911 Otherwise, it returns a nonzero value.
8912 <a name="7.6.4.2" href="#7.6.4.2"><b> 7.6.4.2 The feholdexcept function</b></a>
8913 <b> Synopsis</b>
8914 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8915 int feholdexcept(fenv_t *envp);
8916 <b> Description</b>
8917 2 The feholdexcept function saves the current floating-point environment in the object
8918 pointed to by envp, clears the floating-point status flags, and then installs a non-stop
8919 (continue on floating-point exceptions) mode, if available, for all floating-point
8920 exceptions.<sup><a href="#note218"><b>218)</b></a></sup>
8922 [<a name="p213" href="#p213">page 213</a>] (<a href="#Contents">Contents</a>)
8924 <b> Returns</b>
8925 3 The feholdexcept function returns zero if and only if non-stop floating-point
8926 exception handling was successfully installed.
8927 <a name="7.6.4.3" href="#7.6.4.3"><b> 7.6.4.3 The fesetenv function</b></a>
8928 <b> Synopsis</b>
8929 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8930 int fesetenv(const fenv_t *envp);
8931 <b> Description</b>
8932 2 The fesetenv function attempts to establish the floating-point environment represented
8933 by the object pointed to by envp. The argument envp shall point to an object set by a
8934 call to fegetenv or feholdexcept, or equal a floating-point environment macro.
8935 Note that fesetenv merely installs the state of the floating-point status flags
8936 represented through its argument, and does not raise these floating-point exceptions.
8937 <b> Returns</b>
8938 3 The fesetenv function returns zero if the environment was successfully established.
8939 Otherwise, it returns a nonzero value.
8940 <a name="7.6.4.4" href="#7.6.4.4"><b> 7.6.4.4 The feupdateenv function</b></a>
8941 <b> Synopsis</b>
8942 1 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8943 int feupdateenv(const fenv_t *envp);
8944 <b> Description</b>
8945 2 The feupdateenv function attempts to save the currently raised floating-point
8946 exceptions in its automatic storage, install the floating-point environment represented by
8947 the object pointed to by envp, and then raise the saved floating-point exceptions. The
8948 argument envp shall point to an object set by a call to feholdexcept or fegetenv,
8949 or equal a floating-point environment macro.
8950 <b> Returns</b>
8951 3 The feupdateenv function returns zero if all the actions were successfully carried out.
8952 Otherwise, it returns a nonzero value.
8957 <sup><a name="note218" href="#note218"><b>218)</b></a></sup> IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
8958 handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
8959 such systems, the feholdexcept function can be used in conjunction with the feupdateenv
8960 function to write routines that hide spurious floating-point exceptions from their callers.
8962 [<a name="p214" href="#p214">page 214</a>] (<a href="#Contents">Contents</a>)
8964 4 EXAMPLE Hide spurious underflow floating-point exceptions:
8965 #include <a href="#7.6">&lt;fenv.h&gt;</a>
8966 double f(double x)
8968 #pragma STDC FENV_ACCESS ON
8969 double result;
8970 fenv_t save_env;
8971 if (feholdexcept(&amp;save_env))
8972 return /* indication of an environmental problem */;
8973 // compute result
8974 if (/* test spurious underflow */)
8975 if (feclearexcept(FE_UNDERFLOW))
8976 return /* indication of an environmental problem */;
8977 if (feupdateenv(&amp;save_env))
8978 return /* indication of an environmental problem */;
8979 return result;
8982 [<a name="p215" href="#p215">page 215</a>] (<a href="#Contents">Contents</a>)
8984 <a name="7.7" href="#7.7"><b> 7.7 Characteristics of floating types &lt;float.h&gt;</b></a>
8985 1 The header <a href="#7.7">&lt;float.h&gt;</a> defines several macros that expand to various limits and
8986 parameters of the standard floating-point types.
8987 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
8988 in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
8990 [<a name="p216" href="#p216">page 216</a>] (<a href="#Contents">Contents</a>)
8992 <a name="7.8" href="#7.8"><b> 7.8 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
8993 1 The header <a href="#7.8">&lt;inttypes.h&gt;</a> includes the header <a href="#7.20">&lt;stdint.h&gt;</a> and extends it with
8994 additional facilities provided by hosted implementations.
8995 2 It declares functions for manipulating greatest-width integers and converting numeric
8996 character strings to greatest-width integers, and it declares the type
8997 imaxdiv_t
8998 which is a structure type that is the type of the value returned by the imaxdiv function.
8999 For each type declared in <a href="#7.20">&lt;stdint.h&gt;</a>, it defines corresponding macros for conversion
9000 specifiers for use with the formatted input/output functions.<sup><a href="#note219"><b>219)</b></a></sup>
9001 Forward references: integer types <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#7.20">7.20</a>), formatted input/output
9002 functions (<a href="#7.21.6">7.21.6</a>), formatted wide character input/output functions (<a href="#7.29.2">7.29.2</a>).
9003 <a name="7.8.1" href="#7.8.1"><b> 7.8.1 Macros for format specifiers</b></a>
9004 1 Each of the following object-like macros expands to a character string literal containing a
9005 conversion specifier, possibly modified by a length modifier, suitable for use within the
9006 format argument of a formatted input/output function when converting the corresponding
9007 integer type. These macro names have the general form of PRI (character string literals
9008 for the fprintf and fwprintf family) or SCN (character string literals for the
9009 fscanf and fwscanf family),<sup><a href="#note220"><b>220)</b></a></sup> followed by the conversion specifier, followed by a
9010 name corresponding to a similar type name in <a href="#7.20.1">7.20.1</a>. In these names, N represents the
9011 width of the type as described in <a href="#7.20.1">7.20.1</a>. For example, PRIdFAST32 can be used in a
9012 format string to print the value of an integer of type int_fast32_t.
9013 2 The fprintf macros for signed integers are:
9014 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
9015 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
9016 3 The fprintf macros for unsigned integers are:
9017 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
9018 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
9019 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
9020 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
9021 4 The fscanf macros for signed integers are:
9025 <sup><a name="note219" href="#note219"><b>219)</b></a></sup> See ''future library directions'' (<a href="#7.31.5">7.31.5</a>).
9026 <sup><a name="note220" href="#note220"><b>220)</b></a></sup> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
9027 different format specifiers may be required for fprintf and fscanf, even when the type is the
9028 same.
9030 [<a name="p217" href="#p217">page 217</a>] (<a href="#Contents">Contents</a>)
9032 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
9033 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
9034 5 The fscanf macros for unsigned integers are:
9035 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
9036 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
9037 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
9038 6 For each type that the implementation provides in <a href="#7.20">&lt;stdint.h&gt;</a>, the corresponding
9039 fprintf macros shall be defined and the corresponding fscanf macros shall be
9040 defined unless the implementation does not have a suitable fscanf length modifier for
9041 the type.
9042 7 EXAMPLE
9043 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
9044 #include <a href="#7.29">&lt;wchar.h&gt;</a>
9045 int main(void)
9047 uintmax_t i = UINTMAX_MAX; // this type always exists
9048 wprintf(L"The largest integer value is %020"
9049 PRIxMAX "\n", i);
9050 return 0;
9053 <a name="7.8.2" href="#7.8.2"><b> 7.8.2 Functions for greatest-width integer types</b></a>
9054 <a name="7.8.2.1" href="#7.8.2.1"><b> 7.8.2.1 The imaxabs function</b></a>
9055 <b> Synopsis</b>
9056 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
9057 intmax_t imaxabs(intmax_t j);
9058 <b> Description</b>
9059 2 The imaxabs function computes the absolute value of an integer j. If the result cannot
9060 be represented, the behavior is undefined.<sup><a href="#note221"><b>221)</b></a></sup>
9061 <b> Returns</b>
9062 3 The imaxabs function returns the absolute value.
9067 <sup><a name="note221" href="#note221"><b>221)</b></a></sup> The absolute value of the most negative number cannot be represented in two's complement.
9069 [<a name="p218" href="#p218">page 218</a>] (<a href="#Contents">Contents</a>)
9071 <a name="7.8.2.2" href="#7.8.2.2"><b> 7.8.2.2 The imaxdiv function</b></a>
9072 <b> Synopsis</b>
9073 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
9074 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
9075 <b> Description</b>
9076 2 The imaxdiv function computes numer / denom and numer % denom in a single
9077 operation.
9078 <b> Returns</b>
9079 3 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
9080 quotient and the remainder. The structure shall contain (in either order) the members
9081 quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
9082 either part of the result cannot be represented, the behavior is undefined.
9083 <a name="7.8.2.3" href="#7.8.2.3"><b> 7.8.2.3 The strtoimax and strtoumax functions</b></a>
9084 <b> Synopsis</b>
9085 1 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
9086 intmax_t strtoimax(const char * restrict nptr,
9087 char ** restrict endptr, int base);
9088 uintmax_t strtoumax(const char * restrict nptr,
9089 char ** restrict endptr, int base);
9090 <b> Description</b>
9091 2 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
9092 strtoul, and strtoull functions, except that the initial portion of the string is
9093 converted to intmax_t and uintmax_t representation, respectively.
9094 <b> Returns</b>
9095 3 The strtoimax and strtoumax functions return the converted value, if any. If no
9096 conversion could be performed, zero is returned. If the correct value is outside the range
9097 of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
9098 (according to the return type and sign of the value, if any), and the value of the macro
9099 ERANGE is stored in errno.
9100 Forward references: the strtol, strtoll, strtoul, and strtoull functions
9101 (<a href="#7.22.1.4">7.22.1.4</a>).
9103 [<a name="p219" href="#p219">page 219</a>] (<a href="#Contents">Contents</a>)
9105 <a name="7.8.2.4" href="#7.8.2.4"><b> 7.8.2.4 The wcstoimax and wcstoumax functions</b></a>
9106 <b> Synopsis</b>
9107 1 #include <a href="#7.19">&lt;stddef.h&gt;</a> // for wchar_t
9108 #include <a href="#7.8">&lt;inttypes.h&gt;</a>
9109 intmax_t wcstoimax(const wchar_t * restrict nptr,
9110 wchar_t ** restrict endptr, int base);
9111 uintmax_t wcstoumax(const wchar_t * restrict nptr,
9112 wchar_t ** restrict endptr, int base);
9113 <b> Description</b>
9114 2 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
9115 wcstoul, and wcstoull functions except that the initial portion of the wide string is
9116 converted to intmax_t and uintmax_t representation, respectively.
9117 <b> Returns</b>
9118 3 The wcstoimax function returns the converted value, if any. If no conversion could be
9119 performed, zero is returned. If the correct value is outside the range of representable
9120 values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
9121 return type and sign of the value, if any), and the value of the macro ERANGE is stored in
9122 errno.
9123 Forward references: the wcstol, wcstoll, wcstoul, and wcstoull functions
9124 (<a href="#7.29.4.1.2">7.29.4.1.2</a>).
9126 [<a name="p220" href="#p220">page 220</a>] (<a href="#Contents">Contents</a>)
9128 <a name="7.9" href="#7.9"><b> 7.9 Alternative spellings &lt;iso646.h&gt;</b></a>
9129 1 The header <a href="#7.9">&lt;iso646.h&gt;</a> defines the following eleven macros (on the left) that expand
9130 to the corresponding tokens (on the right):
9131 and &amp;&amp;
9132 and_eq &amp;=
9133 bitand &amp;
9134 bitor |
9135 compl ~
9136 not !
9137 not_eq !=
9138 or ||
9139 or_eq |=
9140 xor ^
9141 xor_eq ^=
9143 [<a name="p221" href="#p221">page 221</a>] (<a href="#Contents">Contents</a>)
9145 <a name="7.10" href="#7.10"><b> 7.10 Sizes of integer types &lt;limits.h&gt;</b></a>
9146 1 The header <a href="#7.10">&lt;limits.h&gt;</a> defines several macros that expand to various limits and
9147 parameters of the standard integer types.
9148 2 The macros, their meanings, and the constraints (or restrictions) on their values are listed
9149 in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
9151 [<a name="p222" href="#p222">page 222</a>] (<a href="#Contents">Contents</a>)
9153 <a name="7.11" href="#7.11"><b> 7.11 Localization &lt;locale.h&gt;</b></a>
9154 1 The header <a href="#7.11">&lt;locale.h&gt;</a> declares two functions, one type, and defines several macros.
9155 2 The type is
9156 struct lconv
9157 which contains members related to the formatting of numeric values. The structure shall
9158 contain at least the following members, in any order. The semantics of the members and
9159 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
9160 the values specified in the comments.
9161 char *decimal_point; // "."
9162 char *thousands_sep; // ""
9163 char *grouping; // ""
9164 char *mon_decimal_point; // ""
9165 char *mon_thousands_sep; // ""
9166 char *mon_grouping; // ""
9167 char *positive_sign; // ""
9168 char *negative_sign; // ""
9169 char *currency_symbol; // ""
9170 char frac_digits; // CHAR_MAX
9171 char p_cs_precedes; // CHAR_MAX
9172 char n_cs_precedes; // CHAR_MAX
9173 char p_sep_by_space; // CHAR_MAX
9174 char n_sep_by_space; // CHAR_MAX
9175 char p_sign_posn; // CHAR_MAX
9176 char n_sign_posn; // CHAR_MAX
9177 char *int_curr_symbol; // ""
9178 char int_frac_digits; // CHAR_MAX
9179 char int_p_cs_precedes; // CHAR_MAX
9180 char int_n_cs_precedes; // CHAR_MAX
9181 char int_p_sep_by_space; // CHAR_MAX
9182 char int_n_sep_by_space; // CHAR_MAX
9183 char int_p_sign_posn; // CHAR_MAX
9184 char int_n_sign_posn; // CHAR_MAX
9186 [<a name="p223" href="#p223">page 223</a>] (<a href="#Contents">Contents</a>)
9188 3 The macros defined are NULL (described in <a href="#7.19">7.19</a>); and
9189 LC_ALL
9190 LC_COLLATE
9191 LC_CTYPE
9192 LC_MONETARY
9193 LC_NUMERIC
9194 LC_TIME
9195 which expand to integer constant expressions with distinct values, suitable for use as the
9196 first argument to the setlocale function.<sup><a href="#note222"><b>222)</b></a></sup> Additional macro definitions, beginning
9197 with the characters LC_ and an uppercase letter,<sup><a href="#note223"><b>223)</b></a></sup> may also be specified by the
9198 implementation.
9199 <a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
9200 <a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
9201 <b> Synopsis</b>
9202 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
9203 char *setlocale(int category, const char *locale);
9204 <b> Description</b>
9205 2 The setlocale function selects the appropriate portion of the program's locale as
9206 specified by the category and locale arguments. The setlocale function may be
9207 used to change or query the program's entire current locale or portions thereof. The value
9208 LC_ALL for category names the program's entire locale; the other values for
9209 category name only a portion of the program's locale. LC_COLLATE affects the
9210 behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
9211 the character handling functions<sup><a href="#note224"><b>224)</b></a></sup> and the multibyte and wide character functions.
9212 LC_MONETARY affects the monetary formatting information returned by the
9213 localeconv function. LC_NUMERIC affects the decimal-point character for the
9214 formatted input/output functions and the string conversion functions, as well as the
9215 nonmonetary formatting information returned by the localeconv function. LC_TIME
9216 affects the behavior of the strftime and wcsftime functions.
9217 3 A value of "C" for locale specifies the minimal environment for C translation; a value
9218 of "" for locale specifies the locale-specific native environment. Other
9219 implementation-defined strings may be passed as the second argument to setlocale.
9221 <sup><a name="note222" href="#note222"><b>222)</b></a></sup> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
9222 <sup><a name="note223" href="#note223"><b>223)</b></a></sup> See ''future library directions'' (<a href="#7.31.6">7.31.6</a>).
9223 <sup><a name="note224" href="#note224"><b>224)</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
9224 isxdigit.
9226 [<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
9228 4 At program startup, the equivalent of
9229 setlocale(LC_ALL, "C");
9230 is executed.
9231 5 A call to the setlocale function may introduce a data race with other calls to the
9232 setlocale function or with calls to functions that are affected by the current locale.
9233 The implementation shall behave as if no library function calls the setlocale function.
9234 <b> Returns</b>
9235 6 If a pointer to a string is given for locale and the selection can be honored, the
9236 setlocale function returns a pointer to the string associated with the specified
9237 category for the new locale. If the selection cannot be honored, the setlocale
9238 function returns a null pointer and the program's locale is not changed.
9239 7 A null pointer for locale causes the setlocale function to return a pointer to the
9240 string associated with the category for the program's current locale; the program's
9241 locale is not changed.<sup><a href="#note225"><b>225)</b></a></sup>
9242 8 The pointer to string returned by the setlocale function is such that a subsequent call
9243 with that string value and its associated category will restore that part of the program's
9244 locale. The string pointed to shall not be modified by the program, but may be
9245 overwritten by a subsequent call to the setlocale function.
9246 Forward references: formatted input/output functions (<a href="#7.21.6">7.21.6</a>), multibyte/wide
9247 character conversion functions (<a href="#7.22.7">7.22.7</a>), multibyte/wide string conversion functions
9248 (<a href="#7.22.8">7.22.8</a>), numeric conversion functions (<a href="#7.22.1">7.22.1</a>), the strcoll function (<a href="#7.24.4.3">7.24.4.3</a>), the
9249 strftime function (<a href="#7.27.3.5">7.27.3.5</a>), the strxfrm function (<a href="#7.24.4.5">7.24.4.5</a>).
9250 <a name="7.11.2" href="#7.11.2"><b> 7.11.2 Numeric formatting convention inquiry</b></a>
9251 <a name="7.11.2.1" href="#7.11.2.1"><b> 7.11.2.1 The localeconv function</b></a>
9252 <b> Synopsis</b>
9253 1 #include <a href="#7.11">&lt;locale.h&gt;</a>
9254 struct lconv *localeconv(void);
9255 <b> Description</b>
9256 2 The localeconv function sets the components of an object with type struct lconv
9257 with values appropriate for the formatting of numeric quantities (monetary and otherwise)
9258 according to the rules of the current locale.
9262 <sup><a name="note225" href="#note225"><b>225)</b></a></sup> The implementation shall arrange to encode in a string the various categories due to a heterogeneous
9263 locale when category has the value LC_ALL.
9265 [<a name="p225" href="#p225">page 225</a>] (<a href="#Contents">Contents</a>)
9267 3 The members of the structure with type char * are pointers to strings, any of which
9268 (except decimal_point) can point to "", to indicate that the value is not available in
9269 the current locale or is of zero length. Apart from grouping and mon_grouping, the
9270 strings shall start and end in the initial shift state. The members with type char are
9271 nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
9272 available in the current locale. The members include the following:
9273 char *decimal_point
9274 The decimal-point character used to format nonmonetary quantities.
9275 char *thousands_sep
9276 The character used to separate groups of digits before the decimal-point
9277 character in formatted nonmonetary quantities.
9278 char *grouping
9279 A string whose elements indicate the size of each group of digits in
9280 formatted nonmonetary quantities.
9281 char *mon_decimal_point
9282 The decimal-point used to format monetary quantities.
9283 char *mon_thousands_sep
9284 The separator for groups of digits before the decimal-point in formatted
9285 monetary quantities.
9286 char *mon_grouping
9287 A string whose elements indicate the size of each group of digits in
9288 formatted monetary quantities.
9289 char *positive_sign
9290 The string used to indicate a nonnegative-valued formatted monetary
9291 quantity.
9292 char *negative_sign
9293 The string used to indicate a negative-valued formatted monetary quantity.
9294 char *currency_symbol
9295 The local currency symbol applicable to the current locale.
9296 char frac_digits
9297 The number of fractional digits (those after the decimal-point) to be
9298 displayed in a locally formatted monetary quantity.
9299 char p_cs_precedes
9300 Set to 1 or 0 if the currency_symbol respectively precedes or
9301 succeeds the value for a nonnegative locally formatted monetary quantity.
9303 [<a name="p226" href="#p226">page 226</a>] (<a href="#Contents">Contents</a>)
9305 char n_cs_precedes
9306 Set to 1 or 0 if the currency_symbol respectively precedes or
9307 succeeds the value for a negative locally formatted monetary quantity.
9308 char p_sep_by_space
9309 Set to a value indicating the separation of the currency_symbol, the
9310 sign string, and the value for a nonnegative locally formatted monetary
9311 quantity.
9312 char n_sep_by_space
9313 Set to a value indicating the separation of the currency_symbol, the
9314 sign string, and the value for a negative locally formatted monetary
9315 quantity.
9316 char p_sign_posn
9317 Set to a value indicating the positioning of the positive_sign for a
9318 nonnegative locally formatted monetary quantity.
9319 char n_sign_posn
9320 Set to a value indicating the positioning of the negative_sign for a
9321 negative locally formatted monetary quantity.
9322 char *int_curr_symbol
9323 The international currency symbol applicable to the current locale. The
9324 first three characters contain the alphabetic international currency symbol
9325 in accordance with those specified in ISO 4217. The fourth character
9326 (immediately preceding the null character) is the character used to separate
9327 the international currency symbol from the monetary quantity.
9328 char int_frac_digits
9329 The number of fractional digits (those after the decimal-point) to be
9330 displayed in an internationally formatted monetary quantity.
9331 char int_p_cs_precedes
9332 Set to 1 or 0 if the int_curr_symbol respectively precedes or
9333 succeeds the value for a nonnegative internationally formatted monetary
9334 quantity.
9335 char int_n_cs_precedes
9336 Set to 1 or 0 if the int_curr_symbol respectively precedes or
9337 succeeds the value for a negative internationally formatted monetary
9338 quantity.
9339 char int_p_sep_by_space
9340 Set to a value indicating the separation of the int_curr_symbol, the
9341 sign string, and the value for a nonnegative internationally formatted
9342 monetary quantity.
9344 [<a name="p227" href="#p227">page 227</a>] (<a href="#Contents">Contents</a>)
9346 char int_n_sep_by_space
9347 Set to a value indicating the separation of the int_curr_symbol, the
9348 sign string, and the value for a negative internationally formatted monetary
9349 quantity.
9350 char int_p_sign_posn
9351 Set to a value indicating the positioning of the positive_sign for a
9352 nonnegative internationally formatted monetary quantity.
9353 char int_n_sign_posn
9354 Set to a value indicating the positioning of the negative_sign for a
9355 negative internationally formatted monetary quantity.
9356 4 The elements of grouping and mon_grouping are interpreted according to the
9357 following:
9358 CHAR_MAX No further grouping is to be performed.
9359 0 The previous element is to be repeatedly used for the remainder of the
9360 digits.
9361 other The integer value is the number of digits that compose the current group.
9362 The next element is examined to determine the size of the next group of
9363 digits before the current group.
9364 5 The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
9365 and int_n_sep_by_space are interpreted according to the following:
9366 0 No space separates the currency symbol and value.
9367 1 If the currency symbol and sign string are adjacent, a space separates them from the
9368 value; otherwise, a space separates the currency symbol from the value.
9369 2 If the currency symbol and sign string are adjacent, a space separates them;
9370 otherwise, a space separates the sign string from the value.
9371 For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
9372 int_curr_symbol is used instead of a space.
9373 6 The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
9374 int_n_sign_posn are interpreted according to the following:
9375 0 Parentheses surround the quantity and currency symbol.
9376 1 The sign string precedes the quantity and currency symbol.
9377 2 The sign string succeeds the quantity and currency symbol.
9378 3 The sign string immediately precedes the currency symbol.
9379 4 The sign string immediately succeeds the currency symbol.
9381 [<a name="p228" href="#p228">page 228</a>] (<a href="#Contents">Contents</a>)
9383 7 The implementation shall behave as if no library function calls the localeconv
9384 function.
9385 <b> Returns</b>
9386 8 The localeconv function returns a pointer to the filled-in object. The structure
9387 pointed to by the return value shall not be modified by the program, but may be
9388 overwritten by a subsequent call to the localeconv function. In addition, calls to the
9389 setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may
9390 overwrite the contents of the structure.
9391 9 EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
9392 monetary quantities.
9393 Local format International format
9395 Country Positive Negative Positive Negative
9397 Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
9398 Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
9399 Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
9400 Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
9401 10 For these four countries, the respective values for the monetary members of the structure returned by
9402 localeconv could be:
9403 Country1 Country2 Country3 Country4
9405 mon_decimal_point "," "" "," "."
9406 mon_thousands_sep "." "." "." ","
9407 mon_grouping "\3" "\3" "\3" "\3"
9408 positive_sign "" "" "" ""
9409 negative_sign "-" "-" "-" "C"
9410 currency_symbol "mk" "L." "\u0192" "SFrs."
9411 frac_digits 2 0 2 2
9412 p_cs_precedes 0 1 1 1
9413 n_cs_precedes 0 1 1 1
9414 p_sep_by_space 1 0 1 0
9415 n_sep_by_space 1 0 2 0
9416 p_sign_posn 1 1 1 1
9417 n_sign_posn 1 1 4 2
9418 int_curr_symbol "FIM " "ITL " "NLG " "CHF "
9419 int_frac_digits 2 0 2 2
9420 int_p_cs_precedes 1 1 1 1
9421 int_n_cs_precedes 1 1 1 1
9422 int_p_sep_by_space 1 1 1 1
9423 int_n_sep_by_space 2 1 2 1
9424 int_p_sign_posn 1 1 1 1
9425 int_n_sign_posn 4 1 4 2
9427 [<a name="p229" href="#p229">page 229</a>] (<a href="#Contents">Contents</a>)
9429 11 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
9430 affect the formatted value.
9431 p_sep_by_space
9433 p_cs_precedes p_sign_posn 0 1 2
9435 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
9436 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
9437 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
9438 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
9439 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
9441 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
9442 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
9443 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
9444 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
9445 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25
9447 [<a name="p230" href="#p230">page 230</a>] (<a href="#Contents">Contents</a>)
9449 <a name="7.12" href="#7.12"><b> 7.12 Mathematics &lt;math.h&gt;</b></a>
9450 1 The header <a href="#7.12">&lt;math.h&gt;</a> declares two types and many mathematical functions and defines
9451 several macros. Most synopses specify a family of functions consisting of a principal
9452 function with one or more double parameters, a double return value, or both; and
9453 other functions with the same name but with f and l suffixes, which are corresponding
9454 functions with float and long double parameters, return values, or both.<sup><a href="#note226"><b>226)</b></a></sup>
9455 Integer arithmetic functions and conversion functions are discussed later.
9456 2 The types
9457 float_t
9458 double_t
9459 are floating types at least as wide as float and double, respectively, and such that
9460 double_t is at least as wide as float_t. If FLT_EVAL_METHOD equals 0,
9461 float_t and double_t are float and double, respectively; if
9462 FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
9463 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
9464 otherwise implementation-defined.<sup><a href="#note227"><b>227)</b></a></sup>
9465 3 The macro
9466 HUGE_VAL
9467 expands to a positive double constant expression, not necessarily representable as a
9468 float. The macros
9469 HUGE_VALF
9470 HUGE_VALL
9471 are respectively float and long double analogs of HUGE_VAL.<sup><a href="#note228"><b>228)</b></a></sup>
9472 4 The macro
9473 INFINITY
9474 expands to a constant expression of type float representing positive or unsigned
9475 infinity, if available; else to a positive constant of type float that overflows at
9479 <sup><a name="note226" href="#note226"><b>226)</b></a></sup> Particularly on systems with wide expression evaluation, a <a href="#7.12">&lt;math.h&gt;</a> function might pass arguments
9480 and return values in wider format than the synopsis prototype indicates.
9481 <sup><a name="note227" href="#note227"><b>227)</b></a></sup> The types float_t and double_t are intended to be the implementation's most efficient types at
9482 least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
9483 type float_t is the narrowest type used by the implementation to evaluate floating expressions.
9484 <sup><a name="note228" href="#note228"><b>228)</b></a></sup> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
9485 supports infinities.
9487 [<a name="p231" href="#p231">page 231</a>] (<a href="#Contents">Contents</a>)
9489 translation time.<sup><a href="#note229"><b>229)</b></a></sup>
9490 5 The macro
9492 is defined if and only if the implementation supports quiet NaNs for the float type. It
9493 expands to a constant expression of type float representing a quiet NaN.
9494 6 The number classification macros
9495 FP_INFINITE
9496 FP_NAN
9497 FP_NORMAL
9498 FP_SUBNORMAL
9499 FP_ZERO
9500 represent the mutually exclusive kinds of floating-point values. They expand to integer
9501 constant expressions with distinct values. Additional implementation-defined floating-
9502 point classifications, with macro definitions beginning with FP_ and an uppercase letter,
9503 may also be specified by the implementation.
9504 7 The macro
9505 FP_FAST_FMA
9506 is optionally defined. If defined, it indicates that the fma function generally executes
9507 about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note230"><b>230)</b></a></sup> The
9508 macros
9509 FP_FAST_FMAF
9510 FP_FAST_FMAL
9511 are, respectively, float and long double analogs of FP_FAST_FMA. If defined,
9512 these macros expand to the integer constant 1.
9513 8 The macros
9514 FP_ILOGB0
9515 FP_ILOGBNAN
9516 expand to integer constant expressions whose values are returned by ilogb(x) if x is
9517 zero or NaN, respectively. The value of FP_ILOGB0 shall be either INT_MIN or
9518 -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN.
9521 <sup><a name="note229" href="#note229"><b>229)</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.
9522 <sup><a name="note230" href="#note230"><b>230)</b></a></sup> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
9523 directly with a hardware multiply-add instruction. Software implementations are expected to be
9524 substantially slower.
9526 [<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
9528 9 The macros
9529 MATH_ERRNO
9530 MATH_ERREXCEPT
9531 expand to the integer constants 1 and 2, respectively; the macro
9532 math_errhandling
9533 expands to an expression that has type int and the value MATH_ERRNO,
9534 MATH_ERREXCEPT, or the bitwise OR of both. The value of math_errhandling is
9535 constant for the duration of the program. It is unspecified whether
9536 math_errhandling is a macro or an identifier with external linkage. If a macro
9537 definition is suppressed or a program defines an identifier with the name
9538 math_errhandling, the behavior is undefined. If the expression
9539 math_errhandling &amp; MATH_ERREXCEPT can be nonzero, the implementation
9540 shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in
9541 <a href="#7.6">&lt;fenv.h&gt;</a>.
9542 <a name="7.12.1" href="#7.12.1"><b> 7.12.1 Treatment of error conditions</b></a>
9543 1 The behavior of each of the functions in <a href="#7.12">&lt;math.h&gt;</a> is specified for all representable
9544 values of its input arguments, except where stated otherwise. Each function shall execute
9545 as if it were a single operation without raising SIGFPE and without generating any of the
9546 floating-point exceptions ''invalid'', ''divide-by-zero'', or ''overflow'' except to reflect
9547 the result of the function.
9548 2 For all functions, a domain error occurs if an input argument is outside the domain over
9549 which the mathematical function is defined. The description of each function lists any
9550 required domain errors; an implementation may define additional domain errors, provided
9551 that such errors are consistent with the mathematical definition of the function.<sup><a href="#note231"><b>231)</b></a></sup> On a
9552 domain error, the function returns an implementation-defined value; if the integer
9553 expression math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression
9554 errno acquires the value EDOM; if the integer expression math_errhandling &amp;
9555 MATH_ERREXCEPT is nonzero, the ''invalid'' floating-point exception is raised.
9556 3 Similarly, a pole error (also known as a singularity or infinitary) occurs if the
9557 mathematical function has an exact infinite result as the finite input argument(s) are
9558 approached in the limit (for example, log(0.0)). The description of each function lists
9559 any required pole errors; an implementation may define additional pole errors, provided
9560 that such errors are consistent with the mathematical definition of the function. On a pole
9561 error, the function returns an implementation-defined value; if the integer expression
9564 <sup><a name="note231" href="#note231"><b>231)</b></a></sup> In an implementation that supports infinities, this allows an infinity as an argument to be a domain
9565 error if the mathematical domain of the function does not include the infinity.
9567 [<a name="p233" href="#p233">page 233</a>] (<a href="#Contents">Contents</a>)
9569 math_errhandling &amp; MATH_ERRNO is nonzero, the integer expression errno
9570 acquires the value ERANGE; if the integer expression math_errhandling &amp;
9571 MATH_ERREXCEPT is nonzero, the ''divide-by-zero'' floating-point exception is raised.
9572 4 Likewise, a range error occurs if the mathematical result of the function cannot be
9573 represented in an object of the specified type, due to extreme magnitude.
9574 5 A floating result overflows if the magnitude of the mathematical result is finite but so
9575 large that the mathematical result cannot be represented without extraordinary roundoff
9576 error in an object of the specified type. If a floating result overflows and default rounding
9577 is in effect, then the function returns the value of the macro HUGE_VAL, HUGE_VALF, or
9578 HUGE_VALL according to the return type, with the same sign as the correct value of the
9579 function; if the integer expression math_errhandling &amp; MATH_ERRNO is nonzero,
9580 the integer expression errno acquires the value ERANGE; if the integer expression
9581 math_errhandling &amp; MATH_ERREXCEPT is nonzero, the ''overflow'' floating-
9582 point exception is raised.
9583 6 The result underflows if the magnitude of the mathematical result is so small that the
9584 mathematical result cannot be represented, without extraordinary roundoff error, in an
9585 object of the specified type.<sup><a href="#note232"><b>232)</b></a></sup> If the result underflows, the function returns an
9586 implementation-defined value whose magnitude is no greater than the smallest
9587 normalized positive number in the specified type; if the integer expression
9588 math_errhandling &amp; MATH_ERRNO is nonzero, whether errno acquires the
9589 value ERANGE is implementation-defined; if the integer expression
9590 math_errhandling &amp; MATH_ERREXCEPT is nonzero, whether the ''underflow''
9591 floating-point exception is raised is implementation-defined.
9592 7 If a domain, pole, or range error occurs and the integer expression
9593 math_errhandling &amp; MATH_ERRNO is zero,<sup><a href="#note233"><b>233)</b></a></sup> then errno shall either be set to
9594 the value corresponding to the error or left unmodified. If no such error occurs, errno
9595 shall be left unmodified regardless of the setting of math_errhandling.
9600 <sup><a name="note232" href="#note232"><b>232)</b></a></sup> The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
9601 also ''flush-to-zero'' underflow.
9602 <sup><a name="note233" href="#note233"><b>233)</b></a></sup> Math errors are being indicated by the floating-point exception flags rather than by errno.
9604 [<a name="p234" href="#p234">page 234</a>] (<a href="#Contents">Contents</a>)
9606 <a name="7.12.2" href="#7.12.2"><b> 7.12.2 The FP_CONTRACT pragma</b></a>
9607 <b> Synopsis</b>
9608 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9609 #pragma STDC FP_CONTRACT on-off-switch
9610 <b> Description</b>
9611 2 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
9612 state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
9613 either outside external declarations or preceding all explicit declarations and statements
9614 inside a compound statement. When outside external declarations, the pragma takes
9615 effect from its occurrence until another FP_CONTRACT pragma is encountered, or until
9616 the end of the translation unit. When inside a compound statement, the pragma takes
9617 effect from its occurrence until another FP_CONTRACT pragma is encountered
9618 (including within a nested compound statement), or until the end of the compound
9619 statement; at the end of a compound statement the state for the pragma is restored to its
9620 condition just before the compound statement. If this pragma is used in any other
9621 context, the behavior is undefined. The default state (''on'' or ''off'') for the pragma is
9622 implementation-defined.
9623 <a name="7.12.3" href="#7.12.3"><b> 7.12.3 Classification macros</b></a>
9624 1 In the synopses in this subclause, real-floating indicates that the argument shall be an
9625 expression of real floating type.
9626 <a name="7.12.3.1" href="#7.12.3.1"><b> 7.12.3.1 The fpclassify macro</b></a>
9627 <b> Synopsis</b>
9628 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9629 int fpclassify(real-floating x);
9630 <b> Description</b>
9631 2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
9632 subnormal, zero, or into another implementation-defined category. First, an argument
9633 represented in a format wider than its semantic type is converted to its semantic type.
9634 Then classification is based on the type of the argument.<sup><a href="#note234"><b>234)</b></a></sup>
9635 <b> Returns</b>
9636 3 The fpclassify macro returns the value of the number classification macro
9637 appropriate to the value of its argument.
9640 <sup><a name="note234" href="#note234"><b>234)</b></a></sup> Since an expression can be evaluated with more range and precision than its type has, it is important to
9641 know the type that classification is based on. For example, a normal long double value might
9642 become subnormal when converted to double, and zero when converted to float.
9644 [<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
9646 <a name="7.12.3.2" href="#7.12.3.2"><b> 7.12.3.2 The isfinite macro</b></a>
9647 <b> Synopsis</b>
9648 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9649 int isfinite(real-floating x);
9650 <b> Description</b>
9651 2 The isfinite macro determines whether its argument has a finite value (zero,
9652 subnormal, or normal, and not infinite or NaN). First, an argument represented in a
9653 format wider than its semantic type is converted to its semantic type. Then determination
9654 is based on the type of the argument.
9655 <b> Returns</b>
9656 3 The isfinite macro returns a nonzero value if and only if its argument has a finite
9657 value.
9658 <a name="7.12.3.3" href="#7.12.3.3"><b> 7.12.3.3 The isinf macro</b></a>
9659 <b> Synopsis</b>
9660 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9661 int isinf(real-floating x);
9662 <b> Description</b>
9663 2 The isinf macro determines whether its argument value is an infinity (positive or
9664 negative). First, an argument represented in a format wider than its semantic type is
9665 converted to its semantic type. Then determination is based on the type of the argument.
9666 <b> Returns</b>
9667 3 The isinf macro returns a nonzero value if and only if its argument has an infinite
9668 value.
9669 <a name="7.12.3.4" href="#7.12.3.4"><b> 7.12.3.4 The isnan macro</b></a>
9670 <b> Synopsis</b>
9671 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9672 int isnan(real-floating x);
9673 <b> Description</b>
9674 2 The isnan macro determines whether its argument value is a NaN. First, an argument
9675 represented in a format wider than its semantic type is converted to its semantic type.
9676 Then determination is based on the type of the argument.<sup><a href="#note235"><b>235)</b></a></sup>
9679 <sup><a name="note235" href="#note235"><b>235)</b></a></sup> For the isnan macro, the type for determination does not matter unless the implementation supports
9680 NaNs in the evaluation type but not in the semantic type.
9682 [<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
9684 <b> Returns</b>
9685 3 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
9686 <a name="7.12.3.5" href="#7.12.3.5"><b> 7.12.3.5 The isnormal macro</b></a>
9687 <b> Synopsis</b>
9688 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9689 int isnormal(real-floating x);
9690 <b> Description</b>
9691 2 The isnormal macro determines whether its argument value is normal (neither zero,
9692 subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
9693 semantic type is converted to its semantic type. Then determination is based on the type
9694 of the argument.
9695 <b> Returns</b>
9696 3 The isnormal macro returns a nonzero value if and only if its argument has a normal
9697 value.
9698 <a name="7.12.3.6" href="#7.12.3.6"><b> 7.12.3.6 The signbit macro</b></a>
9699 <b> Synopsis</b>
9700 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9701 int signbit(real-floating x);
9702 <b> Description</b>
9703 2 The signbit macro determines whether the sign of its argument value is negative.<sup><a href="#note236"><b>236)</b></a></sup>
9704 <b> Returns</b>
9705 3 The signbit macro returns a nonzero value if and only if the sign of its argument value
9706 is negative.
9711 <sup><a name="note236" href="#note236"><b>236)</b></a></sup> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
9712 unsigned, it is treated as positive.
9714 [<a name="p237" href="#p237">page 237</a>] (<a href="#Contents">Contents</a>)
9716 <a name="7.12.4" href="#7.12.4"><b> 7.12.4 Trigonometric functions</b></a>
9717 <a name="7.12.4.1" href="#7.12.4.1"><b> 7.12.4.1 The acos functions</b></a>
9718 <b> Synopsis</b>
9719 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9720 double acos(double x);
9721 float acosf(float x);
9722 long double acosl(long double x);
9723 <b> Description</b>
9724 2 The acos functions compute the principal value of the arc cosine of x. A domain error
9725 occurs for arguments not in the interval [-1, +1].
9726 <b> Returns</b>
9727 3 The acos functions return arccos x in the interval [0, pi ] radians.
9728 <a name="7.12.4.2" href="#7.12.4.2"><b> 7.12.4.2 The asin functions</b></a>
9729 <b> Synopsis</b>
9730 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9731 double asin(double x);
9732 float asinf(float x);
9733 long double asinl(long double x);
9734 <b> Description</b>
9735 2 The asin functions compute the principal value of the arc sine of x. A domain error
9736 occurs for arguments not in the interval [-1, +1].
9737 <b> Returns</b>
9738 3 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
9739 <a name="7.12.4.3" href="#7.12.4.3"><b> 7.12.4.3 The atan functions</b></a>
9740 <b> Synopsis</b>
9741 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9742 double atan(double x);
9743 float atanf(float x);
9744 long double atanl(long double x);
9745 <b> Description</b>
9746 2 The atan functions compute the principal value of the arc tangent of x.
9748 [<a name="p238" href="#p238">page 238</a>] (<a href="#Contents">Contents</a>)
9750 <b> Returns</b>
9751 3 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
9752 <a name="7.12.4.4" href="#7.12.4.4"><b> 7.12.4.4 The atan2 functions</b></a>
9753 <b> Synopsis</b>
9754 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9755 double atan2(double y, double x);
9756 float atan2f(float y, float x);
9757 long double atan2l(long double y, long double x);
9758 <b> Description</b>
9759 2 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
9760 arguments to determine the quadrant of the return value. A domain error may occur if
9761 both arguments are zero.
9762 <b> Returns</b>
9763 3 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
9764 <a name="7.12.4.5" href="#7.12.4.5"><b> 7.12.4.5 The cos functions</b></a>
9765 <b> Synopsis</b>
9766 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9767 double cos(double x);
9768 float cosf(float x);
9769 long double cosl(long double x);
9770 <b> Description</b>
9771 2 The cos functions compute the cosine of x (measured in radians).
9772 <b> Returns</b>
9773 3 The cos functions return cos x.
9774 <a name="7.12.4.6" href="#7.12.4.6"><b> 7.12.4.6 The sin functions</b></a>
9775 <b> Synopsis</b>
9776 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9777 double sin(double x);
9778 float sinf(float x);
9779 long double sinl(long double x);
9780 <b> Description</b>
9781 2 The sin functions compute the sine of x (measured in radians).
9783 [<a name="p239" href="#p239">page 239</a>] (<a href="#Contents">Contents</a>)
9785 <b> Returns</b>
9786 3 The sin functions return sin x.
9787 <a name="7.12.4.7" href="#7.12.4.7"><b> 7.12.4.7 The tan functions</b></a>
9788 <b> Synopsis</b>
9789 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9790 double tan(double x);
9791 float tanf(float x);
9792 long double tanl(long double x);
9793 <b> Description</b>
9794 2 The tan functions return the tangent of x (measured in radians).
9795 <b> Returns</b>
9796 3 The tan functions return tan x.
9797 <a name="7.12.5" href="#7.12.5"><b> 7.12.5 Hyperbolic functions</b></a>
9798 <a name="7.12.5.1" href="#7.12.5.1"><b> 7.12.5.1 The acosh functions</b></a>
9799 <b> Synopsis</b>
9800 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9801 double acosh(double x);
9802 float acoshf(float x);
9803 long double acoshl(long double x);
9804 <b> Description</b>
9805 2 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
9806 error occurs for arguments less than 1.
9807 <b> Returns</b>
9808 3 The acosh functions return arcosh x in the interval [0, +(inf)].
9809 <a name="7.12.5.2" href="#7.12.5.2"><b> 7.12.5.2 The asinh functions</b></a>
9810 <b> Synopsis</b>
9811 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9812 double asinh(double x);
9813 float asinhf(float x);
9814 long double asinhl(long double x);
9815 <b> Description</b>
9816 2 The asinh functions compute the arc hyperbolic sine of x.
9818 [<a name="p240" href="#p240">page 240</a>] (<a href="#Contents">Contents</a>)
9820 <b> Returns</b>
9821 3 The asinh functions return arsinh x.
9822 <a name="7.12.5.3" href="#7.12.5.3"><b> 7.12.5.3 The atanh functions</b></a>
9823 <b> Synopsis</b>
9824 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9825 double atanh(double x);
9826 float atanhf(float x);
9827 long double atanhl(long double x);
9828 <b> Description</b>
9829 2 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
9830 for arguments not in the interval [-1, +1]. A pole error may occur if the argument equals
9831 -1 or +1.
9832 <b> Returns</b>
9833 3 The atanh functions return artanh x.
9834 <a name="7.12.5.4" href="#7.12.5.4"><b> 7.12.5.4 The cosh functions</b></a>
9835 <b> Synopsis</b>
9836 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9837 double cosh(double x);
9838 float coshf(float x);
9839 long double coshl(long double x);
9840 <b> Description</b>
9841 2 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
9842 magnitude of x is too large.
9843 <b> Returns</b>
9844 3 The cosh functions return cosh x.
9845 <a name="7.12.5.5" href="#7.12.5.5"><b> 7.12.5.5 The sinh functions</b></a>
9846 <b> Synopsis</b>
9847 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9848 double sinh(double x);
9849 float sinhf(float x);
9850 long double sinhl(long double x);
9851 <b> Description</b>
9852 2 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
9853 magnitude of x is too large.
9855 [<a name="p241" href="#p241">page 241</a>] (<a href="#Contents">Contents</a>)
9857 <b> Returns</b>
9858 3 The sinh functions return sinh x.
9859 <a name="7.12.5.6" href="#7.12.5.6"><b> 7.12.5.6 The tanh functions</b></a>
9860 <b> Synopsis</b>
9861 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9862 double tanh(double x);
9863 float tanhf(float x);
9864 long double tanhl(long double x);
9865 <b> Description</b>
9866 2 The tanh functions compute the hyperbolic tangent of x.
9867 <b> Returns</b>
9868 3 The tanh functions return tanh x.
9869 <a name="7.12.6" href="#7.12.6"><b> 7.12.6 Exponential and logarithmic functions</b></a>
9870 <a name="7.12.6.1" href="#7.12.6.1"><b> 7.12.6.1 The exp functions</b></a>
9871 <b> Synopsis</b>
9872 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9873 double exp(double x);
9874 float expf(float x);
9875 long double expl(long double x);
9876 <b> Description</b>
9877 2 The exp functions compute the base-e exponential of x. A range error occurs if the
9878 magnitude of x is too large.
9879 <b> Returns</b>
9880 3 The exp functions return ex .
9881 <a name="7.12.6.2" href="#7.12.6.2"><b> 7.12.6.2 The exp2 functions</b></a>
9882 <b> Synopsis</b>
9883 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9884 double exp2(double x);
9885 float exp2f(float x);
9886 long double exp2l(long double x);
9887 <b> Description</b>
9888 2 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
9889 magnitude of x is too large.
9891 [<a name="p242" href="#p242">page 242</a>] (<a href="#Contents">Contents</a>)
9893 <b> Returns</b>
9894 3 The exp2 functions return 2x .
9895 <a name="7.12.6.3" href="#7.12.6.3"><b> 7.12.6.3 The expm1 functions</b></a>
9896 <b> Synopsis</b>
9897 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9898 double expm1(double x);
9899 float expm1f(float x);
9900 long double expm1l(long double x);
9901 <b> Description</b>
9902 2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
9903 error occurs if x is too large.<sup><a href="#note237"><b>237)</b></a></sup>
9904 <b> Returns</b>
9905 3 The expm1 functions return ex - 1.
9906 <a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
9907 <b> Synopsis</b>
9908 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9909 double frexp(double value, int *exp);
9910 float frexpf(float value, int *exp);
9911 long double frexpl(long double value, int *exp);
9912 <b> Description</b>
9913 2 The frexp functions break a floating-point number into a normalized fraction and an
9914 integral power of 2. They store the integer in the int object pointed to by exp.
9915 <b> Returns</b>
9916 3 If value is not a floating-point number or if the integral power of 2 is outside the range
9917 of int, the results are unspecified. Otherwise, the frexp functions return the value x,
9918 such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x x 2*exp .
9919 If value is zero, both parts of the result are zero.
9924 <sup><a name="note237" href="#note237"><b>237)</b></a></sup> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
9926 [<a name="p243" href="#p243">page 243</a>] (<a href="#Contents">Contents</a>)
9928 <a name="7.12.6.5" href="#7.12.6.5"><b> 7.12.6.5 The ilogb functions</b></a>
9929 <b> Synopsis</b>
9930 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9931 int ilogb(double x);
9932 int ilogbf(float x);
9933 int ilogbl(long double x);
9934 <b> Description</b>
9935 2 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
9936 compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
9937 a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
9938 the corresponding logb function and casting the returned value to type int. A domain
9939 error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside
9940 the range of the return type, the numeric result is unspecified.
9941 <b> Returns</b>
9942 3 The ilogb functions return the exponent of x as a signed int value.
9943 Forward references: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
9944 <a name="7.12.6.6" href="#7.12.6.6"><b> 7.12.6.6 The ldexp functions</b></a>
9945 <b> Synopsis</b>
9946 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9947 double ldexp(double x, int exp);
9948 float ldexpf(float x, int exp);
9949 long double ldexpl(long double x, int exp);
9950 <b> Description</b>
9951 2 The ldexp functions multiply a floating-point number by an integral power of 2. A
9952 range error may occur.
9953 <b> Returns</b>
9954 3 The ldexp functions return x x 2exp .
9955 <a name="7.12.6.7" href="#7.12.6.7"><b> 7.12.6.7 The log functions</b></a>
9956 <b> Synopsis</b>
9957 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9958 double log(double x);
9959 float logf(float x);
9960 long double logl(long double x);
9962 [<a name="p244" href="#p244">page 244</a>] (<a href="#Contents">Contents</a>)
9964 <b> Description</b>
9965 2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
9966 the argument is negative. A pole error may occur if the argument is zero.
9967 <b> Returns</b>
9968 3 The log functions return loge x.
9969 <a name="7.12.6.8" href="#7.12.6.8"><b> 7.12.6.8 The log10 functions</b></a>
9970 <b> Synopsis</b>
9971 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9972 double log10(double x);
9973 float log10f(float x);
9974 long double log10l(long double x);
9975 <b> Description</b>
9976 2 The log10 functions compute the base-10 (common) logarithm of x. A domain error
9977 occurs if the argument is negative. A pole error may occur if the argument is zero.
9978 <b> Returns</b>
9979 3 The log10 functions return log10 x.
9980 <a name="7.12.6.9" href="#7.12.6.9"><b> 7.12.6.9 The log1p functions</b></a>
9981 <b> Synopsis</b>
9982 1 #include <a href="#7.12">&lt;math.h&gt;</a>
9983 double log1p(double x);
9984 float log1pf(float x);
9985 long double log1pl(long double x);
9986 <b> Description</b>
9987 2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.<sup><a href="#note238"><b>238)</b></a></sup>
9988 A domain error occurs if the argument is less than -1. A pole error may occur if the
9989 argument equals -1.
9990 <b> Returns</b>
9991 3 The log1p functions return loge (1 + x).
9996 <sup><a name="note238" href="#note238"><b>238)</b></a></sup> For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
9998 [<a name="p245" href="#p245">page 245</a>] (<a href="#Contents">Contents</a>)
10000 <a name="7.12.6.10" href="#7.12.6.10"><b> 7.12.6.10 The log2 functions</b></a>
10001 <b> Synopsis</b>
10002 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10003 double log2(double x);
10004 float log2f(float x);
10005 long double log2l(long double x);
10006 <b> Description</b>
10007 2 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
10008 argument is less than zero. A pole error may occur if the argument is zero.
10009 <b> Returns</b>
10010 3 The log2 functions return log2 x.
10011 <a name="7.12.6.11" href="#7.12.6.11"><b> 7.12.6.11 The logb functions</b></a>
10012 <b> Synopsis</b>
10013 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10014 double logb(double x);
10015 float logbf(float x);
10016 long double logbl(long double x);
10017 <b> Description</b>
10018 2 The logb functions extract the exponent of x, as a signed integer value in floating-point
10019 format. If x is subnormal it is treated as though it were normalized; thus, for positive
10020 finite x,
10021 1 &lt;= x x FLT_RADIX-logb(x) &lt; FLT_RADIX
10022 A domain error or pole error may occur if the argument is zero.
10023 <b> Returns</b>
10024 3 The logb functions return the signed exponent of x.
10025 <a name="7.12.6.12" href="#7.12.6.12"><b> 7.12.6.12 The modf functions</b></a>
10026 <b> Synopsis</b>
10027 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10028 double modf(double value, double *iptr);
10029 float modff(float value, float *iptr);
10030 long double modfl(long double value, long double *iptr);
10031 <b> Description</b>
10032 2 The modf functions break the argument value into integral and fractional parts, each of
10033 which has the same type and sign as the argument. They store the integral part (in
10035 [<a name="p246" href="#p246">page 246</a>] (<a href="#Contents">Contents</a>)
10037 floating-point format) in the object pointed to by iptr.
10038 <b> Returns</b>
10039 3 The modf functions return the signed fractional part of value.
10040 <a name="7.12.6.13" href="#7.12.6.13"><b> 7.12.6.13 The scalbn and scalbln functions</b></a>
10041 <b> Synopsis</b>
10042 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10043 double scalbn(double x, int n);
10044 float scalbnf(float x, int n);
10045 long double scalbnl(long double x, int n);
10046 double scalbln(double x, long int n);
10047 float scalblnf(float x, long int n);
10048 long double scalblnl(long double x, long int n);
10049 <b> Description</b>
10050 2 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
10051 normally by computing FLT_RADIXn explicitly. A range error may occur.
10052 <b> Returns</b>
10053 3 The scalbn and scalbln functions return x x FLT_RADIXn .
10054 <a name="7.12.7" href="#7.12.7"><b> 7.12.7 Power and absolute-value functions</b></a>
10055 <a name="7.12.7.1" href="#7.12.7.1"><b> 7.12.7.1 The cbrt functions</b></a>
10056 <b> Synopsis</b>
10057 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10058 double cbrt(double x);
10059 float cbrtf(float x);
10060 long double cbrtl(long double x);
10061 <b> Description</b>
10062 2 The cbrt functions compute the real cube root of x.
10063 <b> Returns</b>
10064 3 The cbrt functions return x1/3 .
10066 [<a name="p247" href="#p247">page 247</a>] (<a href="#Contents">Contents</a>)
10068 <a name="7.12.7.2" href="#7.12.7.2"><b> 7.12.7.2 The fabs functions</b></a>
10069 <b> Synopsis</b>
10070 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10071 double fabs(double x);
10072 float fabsf(float x);
10073 long double fabsl(long double x);
10074 <b> Description</b>
10075 2 The fabs functions compute the absolute value of a floating-point number x.
10076 <b> Returns</b>
10077 3 The fabs functions return | x |.
10078 <a name="7.12.7.3" href="#7.12.7.3"><b> 7.12.7.3 The hypot functions</b></a>
10079 <b> Synopsis</b>
10080 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10081 double hypot(double x, double y);
10082 float hypotf(float x, float y);
10083 long double hypotl(long double x, long double y);
10084 <b> Description</b>
10085 2 The hypot functions compute the square root of the sum of the squares of x and y,
10086 without undue overflow or underflow. A range error may occur.
10087 3 Returns
10088 4 The hypot functions return (sqrt)x2 + y2 .
10090 -----
10091 <a name="7.12.7.4" href="#7.12.7.4"><b> 7.12.7.4 The pow functions</b></a>
10092 <b> Synopsis</b>
10093 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10094 double pow(double x, double y);
10095 float powf(float x, float y);
10096 long double powl(long double x, long double y);
10097 <b> Description</b>
10098 2 The pow functions compute x raised to the power y. A domain error occurs if x is finite
10099 and negative and y is finite and not an integer value. A range error may occur. A domain
10100 error may occur if x is zero and y is zero. A domain error or pole error may occur if x is
10101 zero and y is less than zero.
10103 [<a name="p248" href="#p248">page 248</a>] (<a href="#Contents">Contents</a>)
10105 <b> Returns</b>
10106 3 The pow functions return xy .
10107 <a name="7.12.7.5" href="#7.12.7.5"><b> 7.12.7.5 The sqrt functions</b></a>
10108 <b> Synopsis</b>
10109 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10110 double sqrt(double x);
10111 float sqrtf(float x);
10112 long double sqrtl(long double x);
10113 <b> Description</b>
10114 2 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
10115 the argument is less than zero.
10116 <b> Returns</b>
10117 3 The sqrt functions return (sqrt)x.
10120 <a name="7.12.8" href="#7.12.8"><b> 7.12.8 Error and gamma functions</b></a>
10121 <a name="7.12.8.1" href="#7.12.8.1"><b> 7.12.8.1 The erf functions</b></a>
10122 <b> Synopsis</b>
10123 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10124 double erf(double x);
10125 float erff(float x);
10126 long double erfl(long double x);
10127 <b> Description</b>
10128 2 The erf functions compute the error function of x.
10129 <b> Returns</b>
10130 3 2 x
10131 (integral) e-t dt.
10133 The erf functions return erf x =
10134 (sqrt)pi
10138 <a name="7.12.8.2" href="#7.12.8.2"><b> 7.12.8.2 The erfc functions</b></a>
10139 <b> Synopsis</b>
10140 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10141 double erfc(double x);
10142 float erfcf(float x);
10143 long double erfcl(long double x);
10144 <b> Description</b>
10145 2 The erfc functions compute the complementary error function of x. A range error
10146 occurs if x is too large.
10148 [<a name="p249" href="#p249">page 249</a>] (<a href="#Contents">Contents</a>)
10150 <b> Returns</b>
10151 3 2 (inf)
10152 (integral) e-t dt.
10154 The erfc functions return erfc x = 1 - erf x =
10155 (sqrt)pi
10159 <a name="7.12.8.3" href="#7.12.8.3"><b> 7.12.8.3 The lgamma functions</b></a>
10160 <b> Synopsis</b>
10161 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10162 double lgamma(double x);
10163 float lgammaf(float x);
10164 long double lgammal(long double x);
10165 <b> Description</b>
10166 2 The lgamma functions compute the natural logarithm of the absolute value of gamma of
10167 x. A range error occurs if x is too large. A pole error may occur if x is a negative integer
10168 or zero.
10169 <b> Returns</b>
10170 3 The lgamma functions return loge | (Gamma)(x) |.
10171 <a name="7.12.8.4" href="#7.12.8.4"><b> 7.12.8.4 The tgamma functions</b></a>
10172 <b> Synopsis</b>
10173 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10174 double tgamma(double x);
10175 float tgammaf(float x);
10176 long double tgammal(long double x);
10177 <b> Description</b>
10178 2 The tgamma functions compute the gamma function of x. A domain error or pole error
10179 may occur if x is a negative integer or zero. A range error occurs if the magnitude of x is
10180 too large and may occur if the magnitude of x is too small.
10181 <b> Returns</b>
10182 3 The tgamma functions return (Gamma)(x).
10184 [<a name="p250" href="#p250">page 250</a>] (<a href="#Contents">Contents</a>)
10186 <a name="7.12.9" href="#7.12.9"><b> 7.12.9 Nearest integer functions</b></a>
10187 <a name="7.12.9.1" href="#7.12.9.1"><b> 7.12.9.1 The ceil functions</b></a>
10188 <b> Synopsis</b>
10189 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10190 double ceil(double x);
10191 float ceilf(float x);
10192 long double ceill(long double x);
10193 <b> Description</b>
10194 2 The ceil functions compute the smallest integer value not less than x.
10195 <b> Returns</b>
10196 3 The ceil functions return [^x^], expressed as a floating-point number.
10197 <a name="7.12.9.2" href="#7.12.9.2"><b> 7.12.9.2 The floor functions</b></a>
10198 <b> Synopsis</b>
10199 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10200 double floor(double x);
10201 float floorf(float x);
10202 long double floorl(long double x);
10203 <b> Description</b>
10204 2 The floor functions compute the largest integer value not greater than x.
10205 <b> Returns</b>
10206 3 The floor functions return [_x_], expressed as a floating-point number.
10207 <a name="7.12.9.3" href="#7.12.9.3"><b> 7.12.9.3 The nearbyint functions</b></a>
10208 <b> Synopsis</b>
10209 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10210 double nearbyint(double x);
10211 float nearbyintf(float x);
10212 long double nearbyintl(long double x);
10213 <b> Description</b>
10214 2 The nearbyint functions round their argument to an integer value in floating-point
10215 format, using the current rounding direction and without raising the ''inexact'' floating-
10216 point exception.
10218 [<a name="p251" href="#p251">page 251</a>] (<a href="#Contents">Contents</a>)
10220 <b> Returns</b>
10221 3 The nearbyint functions return the rounded integer value.
10222 <a name="7.12.9.4" href="#7.12.9.4"><b> 7.12.9.4 The rint functions</b></a>
10223 <b> Synopsis</b>
10224 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10225 double rint(double x);
10226 float rintf(float x);
10227 long double rintl(long double x);
10228 <b> Description</b>
10229 2 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
10230 rint functions may raise the ''inexact'' floating-point exception if the result differs in
10231 value from the argument.
10232 <b> Returns</b>
10233 3 The rint functions return the rounded integer value.
10234 <a name="7.12.9.5" href="#7.12.9.5"><b> 7.12.9.5 The lrint and llrint functions</b></a>
10235 <b> Synopsis</b>
10236 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10237 long int lrint(double x);
10238 long int lrintf(float x);
10239 long int lrintl(long double x);
10240 long long int llrint(double x);
10241 long long int llrintf(float x);
10242 long long int llrintl(long double x);
10243 <b> Description</b>
10244 2 The lrint and llrint functions round their argument to the nearest integer value,
10245 rounding according to the current rounding direction. If the rounded value is outside the
10246 range of the return type, the numeric result is unspecified and a domain error or range
10247 error may occur.
10248 <b> Returns</b>
10249 3 The lrint and llrint functions return the rounded integer value.
10251 [<a name="p252" href="#p252">page 252</a>] (<a href="#Contents">Contents</a>)
10253 <a name="7.12.9.6" href="#7.12.9.6"><b> 7.12.9.6 The round functions</b></a>
10254 <b> Synopsis</b>
10255 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10256 double round(double x);
10257 float roundf(float x);
10258 long double roundl(long double x);
10259 <b> Description</b>
10260 2 The round functions round their argument to the nearest integer value in floating-point
10261 format, rounding halfway cases away from zero, regardless of the current rounding
10262 direction.
10263 <b> Returns</b>
10264 3 The round functions return the rounded integer value.
10265 <a name="7.12.9.7" href="#7.12.9.7"><b> 7.12.9.7 The lround and llround functions</b></a>
10266 <b> Synopsis</b>
10267 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10268 long int lround(double x);
10269 long int lroundf(float x);
10270 long int lroundl(long double x);
10271 long long int llround(double x);
10272 long long int llroundf(float x);
10273 long long int llroundl(long double x);
10274 <b> Description</b>
10275 2 The lround and llround functions round their argument to the nearest integer value,
10276 rounding halfway cases away from zero, regardless of the current rounding direction. If
10277 the rounded value is outside the range of the return type, the numeric result is unspecified
10278 and a domain error or range error may occur.
10279 <b> Returns</b>
10280 3 The lround and llround functions return the rounded integer value.
10281 <a name="7.12.9.8" href="#7.12.9.8"><b> 7.12.9.8 The trunc functions</b></a>
10282 <b> Synopsis</b>
10283 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10284 double trunc(double x);
10285 float truncf(float x);
10286 long double truncl(long double x);
10288 [<a name="p253" href="#p253">page 253</a>] (<a href="#Contents">Contents</a>)
10290 <b> Description</b>
10291 2 The trunc functions round their argument to the integer value, in floating format,
10292 nearest to but no larger in magnitude than the argument.
10293 <b> Returns</b>
10294 3 The trunc functions return the truncated integer value.
10295 <a name="7.12.10" href="#7.12.10"><b> 7.12.10 Remainder functions</b></a>
10296 <a name="7.12.10.1" href="#7.12.10.1"><b> 7.12.10.1 The fmod functions</b></a>
10297 <b> Synopsis</b>
10298 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10299 double fmod(double x, double y);
10300 float fmodf(float x, float y);
10301 long double fmodl(long double x, long double y);
10302 <b> Description</b>
10303 2 The fmod functions compute the floating-point remainder of x/y.
10304 <b> Returns</b>
10305 3 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
10306 the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
10307 whether a domain error occurs or the fmod functions return zero is implementation-
10308 defined.
10309 <a name="7.12.10.2" href="#7.12.10.2"><b> 7.12.10.2 The remainder functions</b></a>
10310 <b> Synopsis</b>
10311 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10312 double remainder(double x, double y);
10313 float remainderf(float x, float y);
10314 long double remainderl(long double x, long double y);
10315 <b> Description</b>
10316 2 The remainder functions compute the remainder x REM y required by IEC 60559.<sup><a href="#note239"><b>239)</b></a></sup>
10321 <sup><a name="note239" href="#note239"><b>239)</b></a></sup> ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
10322 mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
10323 | n - x/y | = 1/2, then n is even. If r = 0, its sign shall be that of x.'' This definition is applicable for
10324 all implementations.
10326 [<a name="p254" href="#p254">page 254</a>] (<a href="#Contents">Contents</a>)
10328 <b> Returns</b>
10329 3 The remainder functions return x REM y. If y is zero, whether a domain error occurs
10330 or the functions return zero is implementation defined.
10331 <a name="7.12.10.3" href="#7.12.10.3"><b> 7.12.10.3 The remquo functions</b></a>
10332 <b> Synopsis</b>
10333 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10334 double remquo(double x, double y, int *quo);
10335 float remquof(float x, float y, int *quo);
10336 long double remquol(long double x, long double y,
10337 int *quo);
10338 <b> Description</b>
10339 2 The remquo functions compute the same remainder as the remainder functions. In
10340 the object pointed to by quo they store a value whose sign is the sign of x/y and whose
10341 magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
10342 n is an implementation-defined integer greater than or equal to 3.
10343 <b> Returns</b>
10344 3 The remquo functions return x REM y. If y is zero, the value stored in the object
10345 pointed to by quo is unspecified and whether a domain error occurs or the functions
10346 return zero is implementation defined.
10347 <a name="7.12.11" href="#7.12.11"><b> 7.12.11 Manipulation functions</b></a>
10348 <a name="7.12.11.1" href="#7.12.11.1"><b> 7.12.11.1 The copysign functions</b></a>
10349 <b> Synopsis</b>
10350 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10351 double copysign(double x, double y);
10352 float copysignf(float x, float y);
10353 long double copysignl(long double x, long double y);
10354 <b> Description</b>
10355 2 The copysign functions produce a value with the magnitude of x and the sign of y.
10356 They produce a NaN (with the sign of y) if x is a NaN. On implementations that
10357 represent a signed zero but do not treat negative zero consistently in arithmetic
10358 operations, the copysign functions regard the sign of zero as positive.
10359 <b> Returns</b>
10360 3 The copysign functions return a value with the magnitude of x and the sign of y.
10362 [<a name="p255" href="#p255">page 255</a>] (<a href="#Contents">Contents</a>)
10364 <a name="7.12.11.2" href="#7.12.11.2"><b> 7.12.11.2 The nan functions</b></a>
10365 <b> Synopsis</b>
10366 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10367 double nan(const char *tagp);
10368 float nanf(const char *tagp);
10369 long double nanl(const char *tagp);
10370 <b> Description</b>
10371 2 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
10372 sequence)", (char**) NULL); the call nan("") is equivalent to
10373 strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
10374 sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
10375 NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
10376 and strtold.
10377 <b> Returns</b>
10378 3 The nan functions return a quiet NaN, if available, with content indicated through tagp.
10379 If the implementation does not support quiet NaNs, the functions return zero.
10380 Forward references: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
10381 <a name="7.12.11.3" href="#7.12.11.3"><b> 7.12.11.3 The nextafter functions</b></a>
10382 <b> Synopsis</b>
10383 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10384 double nextafter(double x, double y);
10385 float nextafterf(float x, float y);
10386 long double nextafterl(long double x, long double y);
10387 <b> Description</b>
10388 2 The nextafter functions determine the next representable value, in the type of the
10389 function, after x in the direction of y, where x and y are first converted to the type of the
10390 function.<sup><a href="#note240"><b>240)</b></a></sup> The nextafter functions return y if x equals y. A range error may occur
10391 if the magnitude of x is the largest finite value representable in the type and the result is
10392 infinite or not representable in the type.
10393 <b> Returns</b>
10394 3 The nextafter functions return the next representable value in the specified format
10395 after x in the direction of y.
10398 <sup><a name="note240" href="#note240"><b>240)</b></a></sup> The argument values are converted to the type of the function, even by a macro implementation of the
10399 function.
10401 [<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
10403 <a name="7.12.11.4" href="#7.12.11.4"><b> 7.12.11.4 The nexttoward functions</b></a>
10404 <b> Synopsis</b>
10405 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10406 double nexttoward(double x, long double y);
10407 float nexttowardf(float x, long double y);
10408 long double nexttowardl(long double x, long double y);
10409 <b> Description</b>
10410 2 The nexttoward functions are equivalent to the nextafter functions except that the
10411 second parameter has type long double and the functions return y converted to the
10412 type of the function if x equals y.<sup><a href="#note241"><b>241)</b></a></sup>
10413 <a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
10414 <a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
10415 <b> Synopsis</b>
10416 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10417 double fdim(double x, double y);
10418 float fdimf(float x, float y);
10419 long double fdiml(long double x, long double y);
10420 <b> Description</b>
10421 2 The fdim functions determine the positive difference between their arguments:
10422 {x - y if x &gt; y
10424 {+0 if x &lt;= y
10425 A range error may occur.
10426 <b> Returns</b>
10427 3 The fdim functions return the positive difference value.
10428 <a name="7.12.12.2" href="#7.12.12.2"><b> 7.12.12.2 The fmax functions</b></a>
10429 <b> Synopsis</b>
10430 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10431 double fmax(double x, double y);
10432 float fmaxf(float x, float y);
10433 long double fmaxl(long double x, long double y);
10437 <sup><a name="note241" href="#note241"><b>241)</b></a></sup> The result of the nexttoward functions is determined in the type of the function, without loss of
10438 range or precision in a floating second argument.
10440 [<a name="p257" href="#p257">page 257</a>] (<a href="#Contents">Contents</a>)
10442 <b> Description</b>
10443 2 The fmax functions determine the maximum numeric value of their arguments.<sup><a href="#note242"><b>242)</b></a></sup>
10444 <b> Returns</b>
10445 3 The fmax functions return the maximum numeric value of their arguments.
10446 <a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
10447 <b> Synopsis</b>
10448 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10449 double fmin(double x, double y);
10450 float fminf(float x, float y);
10451 long double fminl(long double x, long double y);
10452 <b> Description</b>
10453 2 The fmin functions determine the minimum numeric value of their arguments.<sup><a href="#note243"><b>243)</b></a></sup>
10454 <b> Returns</b>
10455 3 The fmin functions return the minimum numeric value of their arguments.
10456 <a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
10457 <a name="7.12.13.1" href="#7.12.13.1"><b> 7.12.13.1 The fma functions</b></a>
10458 <b> Synopsis</b>
10459 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10460 double fma(double x, double y, double z);
10461 float fmaf(float x, float y, float z);
10462 long double fmal(long double x, long double y,
10463 long double z);
10464 <b> Description</b>
10465 2 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
10466 the value (as if) to infinite precision and round once to the result format, according to the
10467 current rounding mode. A range error may occur.
10468 <b> Returns</b>
10469 3 The fma functions return (x x y) + z, rounded as one ternary operation.
10474 <sup><a name="note242" href="#note242"><b>242)</b></a></sup> NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
10475 fmax functions choose the numeric value. See <a href="#F.10.9.2">F.10.9.2</a>.
10476 <sup><a name="note243" href="#note243"><b>243)</b></a></sup> The fmin functions are analogous to the fmax functions in their treatment of NaNs.
10478 [<a name="p258" href="#p258">page 258</a>] (<a href="#Contents">Contents</a>)
10480 <a name="7.12.14" href="#7.12.14"><b> 7.12.14 Comparison macros</b></a>
10481 1 The relational and equality operators support the usual mathematical relationships
10482 between numeric values. For any ordered pair of numeric values exactly one of the
10483 relationships -- less, greater, and equal -- is true. Relational operators may raise the
10484 ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
10485 numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note244"><b>244)</b></a></sup> The following
10486 subclauses provide macros that are quiet (non floating-point exception raising) versions
10487 of the relational operators, and other comparison macros that facilitate writing efficient
10488 code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
10489 the synopses in this subclause, real-floating indicates that the argument shall be an
10490 expression of real floating type<sup><a href="#note245"><b>245)</b></a></sup> (both arguments need not have the same type).<sup><a href="#note246"><b>246)</b></a></sup>
10491 <a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
10492 <b> Synopsis</b>
10493 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10494 int isgreater(real-floating x, real-floating y);
10495 <b> Description</b>
10496 2 The isgreater macro determines whether its first argument is greater than its second
10497 argument. The value of isgreater(x, y) is always equal to (x) &gt; (y); however,
10498 unlike (x) &gt; (y), isgreater(x, y) does not raise the ''invalid'' floating-point
10499 exception when x and y are unordered.
10500 <b> Returns</b>
10501 3 The isgreater macro returns the value of (x) &gt; (y).
10502 <a name="7.12.14.2" href="#7.12.14.2"><b> 7.12.14.2 The isgreaterequal macro</b></a>
10503 <b> Synopsis</b>
10504 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10505 int isgreaterequal(real-floating x, real-floating y);
10510 <sup><a name="note244" href="#note244"><b>244)</b></a></sup> IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
10511 the operands compare unordered, as an error indicator for programs written without consideration of
10512 NaNs; the result in these cases is false.
10513 <sup><a name="note245" href="#note245"><b>245)</b></a></sup> If any argument is of integer type, or any other type that is not a real floating type, the behavior is
10514 undefined.
10515 <sup><a name="note246" href="#note246"><b>246)</b></a></sup> Whether an argument represented in a format wider than its semantic type is converted to the semantic
10516 type is unspecified.
10518 [<a name="p259" href="#p259">page 259</a>] (<a href="#Contents">Contents</a>)
10520 <b> Description</b>
10521 2 The isgreaterequal macro determines whether its first argument is greater than or
10522 equal to its second argument. The value of isgreaterequal(x, y) is always equal
10523 to (x) &gt;= (y); however, unlike (x) &gt;= (y), isgreaterequal(x, y) does
10524 not raise the ''invalid'' floating-point exception when x and y are unordered.
10525 <b> Returns</b>
10526 3 The isgreaterequal macro returns the value of (x) &gt;= (y).
10527 <a name="7.12.14.3" href="#7.12.14.3"><b> 7.12.14.3 The isless macro</b></a>
10528 <b> Synopsis</b>
10529 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10530 int isless(real-floating x, real-floating y);
10531 <b> Description</b>
10532 2 The isless macro determines whether its first argument is less than its second
10533 argument. The value of isless(x, y) is always equal to (x) &lt; (y); however,
10534 unlike (x) &lt; (y), isless(x, y) does not raise the ''invalid'' floating-point
10535 exception when x and y are unordered.
10536 <b> Returns</b>
10537 3 The isless macro returns the value of (x) &lt; (y).
10538 <a name="7.12.14.4" href="#7.12.14.4"><b> 7.12.14.4 The islessequal macro</b></a>
10539 <b> Synopsis</b>
10540 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10541 int islessequal(real-floating x, real-floating y);
10542 <b> Description</b>
10543 2 The islessequal macro determines whether its first argument is less than or equal to
10544 its second argument. The value of islessequal(x, y) is always equal to
10545 (x) &lt;= (y); however, unlike (x) &lt;= (y), islessequal(x, y) does not raise
10546 the ''invalid'' floating-point exception when x and y are unordered.
10547 <b> Returns</b>
10548 3 The islessequal macro returns the value of (x) &lt;= (y).
10550 [<a name="p260" href="#p260">page 260</a>] (<a href="#Contents">Contents</a>)
10552 <a name="7.12.14.5" href="#7.12.14.5"><b> 7.12.14.5 The islessgreater macro</b></a>
10553 <b> Synopsis</b>
10554 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10555 int islessgreater(real-floating x, real-floating y);
10556 <b> Description</b>
10557 2 The islessgreater macro determines whether its first argument is less than or
10558 greater than its second argument. The islessgreater(x, y) macro is similar to
10559 (x) &lt; (y) || (x) &gt; (y); however, islessgreater(x, y) does not raise
10560 the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
10561 and y twice).
10562 <b> Returns</b>
10563 3 The islessgreater macro returns the value of (x) &lt; (y) || (x) &gt; (y).
10564 <a name="7.12.14.6" href="#7.12.14.6"><b> 7.12.14.6 The isunordered macro</b></a>
10565 <b> Synopsis</b>
10566 1 #include <a href="#7.12">&lt;math.h&gt;</a>
10567 int isunordered(real-floating x, real-floating y);
10568 <b> Description</b>
10569 2 The isunordered macro determines whether its arguments are unordered.
10570 <b> Returns</b>
10571 3 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
10573 [<a name="p261" href="#p261">page 261</a>] (<a href="#Contents">Contents</a>)
10575 <a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
10576 1 The header <a href="#7.13">&lt;setjmp.h&gt;</a> defines the macro setjmp, and declares one function and
10577 one type, for bypassing the normal function call and return discipline.<sup><a href="#note247"><b>247)</b></a></sup>
10578 2 The type declared is
10579 jmp_buf
10580 which is an array type suitable for holding the information needed to restore a calling
10581 environment. The environment of a call to the setjmp macro consists of information
10582 sufficient for a call to the longjmp function to return execution to the correct block and
10583 invocation of that block, were it called recursively. It does not include the state of the
10584 floating-point status flags, of open files, or of any other component of the abstract
10585 machine.
10586 3 It is unspecified whether setjmp is a macro or an identifier declared with external
10587 linkage. If a macro definition is suppressed in order to access an actual function, or a
10588 program defines an external identifier with the name setjmp, the behavior is undefined.
10589 <a name="7.13.1" href="#7.13.1"><b> 7.13.1 Save calling environment</b></a>
10590 <a name="7.13.1.1" href="#7.13.1.1"><b> 7.13.1.1 The setjmp macro</b></a>
10591 <b> Synopsis</b>
10592 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
10593 int setjmp(jmp_buf env);
10594 <b> Description</b>
10595 2 The setjmp macro saves its calling environment in its jmp_buf argument for later use
10596 by the longjmp function.
10597 <b> Returns</b>
10598 3 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
10599 return is from a call to the longjmp function, the setjmp macro returns a nonzero
10600 value.
10601 Environmental limits
10602 4 An invocation of the setjmp macro shall appear only in one of the following contexts:
10603 -- the entire controlling expression of a selection or iteration statement;
10604 -- one operand of a relational or equality operator with the other operand an integer
10605 constant expression, with the resulting expression being the entire controlling
10608 <sup><a name="note247" href="#note247"><b>247)</b></a></sup> These functions are useful for dealing with unusual conditions encountered in a low-level function of
10609 a program.
10611 [<a name="p262" href="#p262">page 262</a>] (<a href="#Contents">Contents</a>)
10613 expression of a selection or iteration statement;
10614 -- the operand of a unary ! operator with the resulting expression being the entire
10615 controlling expression of a selection or iteration statement; or
10616 -- the entire expression of an expression statement (possibly cast to void).
10617 5 If the invocation appears in any other context, the behavior is undefined.
10618 <a name="7.13.2" href="#7.13.2"><b> 7.13.2 Restore calling environment</b></a>
10619 <a name="7.13.2.1" href="#7.13.2.1"><b> 7.13.2.1 The longjmp function</b></a>
10620 <b> Synopsis</b>
10621 1 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
10622 _Noreturn void longjmp(jmp_buf env, int val);
10623 <b> Description</b>
10624 2 The longjmp function restores the environment saved by the most recent invocation of
10625 the setjmp macro in the same invocation of the program with the corresponding
10626 jmp_buf argument. If there has been no such invocation, or if the invocation was from
10627 another thread of execution, or if the function containing the invocation of the setjmp
10628 macro has terminated execution<sup><a href="#note248"><b>248)</b></a></sup> in the interim, or if the invocation of the setjmp
10629 macro was within the scope of an identifier with variably modified type and execution has
10630 left that scope in the interim, the behavior is undefined.
10631 3 All accessible objects have values, and all other components of the abstract machine<sup><a href="#note249"><b>249)</b></a></sup>
10632 have state, as of the time the longjmp function was called, except that the values of
10633 objects of automatic storage duration that are local to the function containing the
10634 invocation of the corresponding setjmp macro that do not have volatile-qualified type
10635 and have been changed between the setjmp invocation and longjmp call are
10636 indeterminate.
10637 <b> Returns</b>
10638 4 After longjmp is completed, thread execution continues as if the corresponding
10639 invocation of the setjmp macro had just returned the value specified by val. The
10640 longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
10641 the setjmp macro returns the value 1.
10642 5 EXAMPLE The longjmp function that returns control back to the point of the setjmp invocation
10643 might cause memory associated with a variable length array object to be squandered.
10647 <sup><a name="note248" href="#note248"><b>248)</b></a></sup> For example, by executing a return statement or because another longjmp call has caused a
10648 transfer to a setjmp invocation in a function earlier in the set of nested calls.
10649 <sup><a name="note249" href="#note249"><b>249)</b></a></sup> This includes, but is not limited to, the floating-point status flags and the state of open files.
10651 [<a name="p263" href="#p263">page 263</a>] (<a href="#Contents">Contents</a>)
10653 #include <a href="#7.13">&lt;setjmp.h&gt;</a>
10654 jmp_buf buf;
10655 void g(int n);
10656 void h(int n);
10657 int n = 6;
10658 void f(void)
10660 int x[n]; // valid: f is not terminated
10661 setjmp(buf);
10662 g(n);
10664 void g(int n)
10666 int a[n]; // a may remain allocated
10667 h(n);
10669 void h(int n)
10671 int b[n]; // b may remain allocated
10672 longjmp(buf, 2); // might cause memory loss
10675 [<a name="p264" href="#p264">page 264</a>] (<a href="#Contents">Contents</a>)
10677 <a name="7.14" href="#7.14"><b> 7.14 Signal handling &lt;signal.h&gt;</b></a>
10678 1 The header <a href="#7.14">&lt;signal.h&gt;</a> declares a type and two functions and defines several macros,
10679 for handling various signals (conditions that may be reported during program execution).
10680 2 The type defined is
10681 sig_atomic_t
10682 which is the (possibly volatile-qualified) integer type of an object that can be accessed as
10683 an atomic entity, even in the presence of asynchronous interrupts.
10684 3 The macros defined are
10685 SIG_DFL
10686 SIG_ERR
10687 SIG_IGN
10688 which expand to constant expressions with distinct values that have type compatible with
10689 the second argument to, and the return value of, the signal function, and whose values
10690 compare unequal to the address of any declarable function; and the following, which
10691 expand to positive integer constant expressions with type int and distinct values that are
10692 the signal numbers, each corresponding to the specified condition:
10693 SIGABRT abnormal termination, such as is initiated by the abort function
10694 SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
10695 resulting in overflow
10696 SIGILL detection of an invalid function image, such as an invalid instruction
10697 SIGINT receipt of an interactive attention signal
10698 SIGSEGV an invalid access to storage
10699 SIGTERM a termination request sent to the program
10700 4 An implementation need not generate any of these signals, except as a result of explicit
10701 calls to the raise function. Additional signals and pointers to undeclarable functions,
10702 with macro definitions beginning, respectively, with the letters SIG and an uppercase
10703 letter or with SIG_ and an uppercase letter,<sup><a href="#note250"><b>250)</b></a></sup> may also be specified by the
10704 implementation. The complete set of signals, their semantics, and their default handling
10705 is implementation-defined; all signal numbers shall be positive.
10710 <sup><a name="note250" href="#note250"><b>250)</b></a></sup> See ''future library directions'' (<a href="#7.31.7">7.31.7</a>). The names of the signal numbers reflect the following terms
10711 (respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
10712 and termination.
10714 [<a name="p265" href="#p265">page 265</a>] (<a href="#Contents">Contents</a>)
10716 <a name="7.14.1" href="#7.14.1"><b> 7.14.1 Specify signal handling</b></a>
10717 <a name="7.14.1.1" href="#7.14.1.1"><b> 7.14.1.1 The signal function</b></a>
10718 <b> Synopsis</b>
10719 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
10720 void (*signal(int sig, void (*func)(int)))(int);
10721 <b> Description</b>
10722 2 The signal function chooses one of three ways in which receipt of the signal number
10723 sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
10724 for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
10725 Otherwise, func shall point to a function to be called when that signal occurs. An
10726 invocation of such a function because of a signal, or (recursively) of any further functions
10727 called by that invocation (other than functions in the standard library),<sup><a href="#note251"><b>251)</b></a></sup> is called a
10728 signal handler.
10729 3 When a signal occurs and func points to a function, it is implementation-defined
10730 whether the equivalent of signal(sig, SIG_DFL); is executed or the
10731 implementation prevents some implementation-defined set of signals (at least including
10732 sig) from occurring until the current signal handling has completed; in the case of
10733 SIGILL, the implementation may alternatively define that no action is taken. Then the
10734 equivalent of (*func)(sig); is executed. If and when the function returns, if the
10735 value of sig is SIGFPE, SIGILL, SIGSEGV, or any other implementation-defined
10736 value corresponding to a computational exception, the behavior is undefined; otherwise
10737 the program will resume execution at the point it was interrupted.
10738 4 If the signal occurs as the result of calling the abort or raise function, the signal
10739 handler shall not call the raise function.
10740 5 If the signal occurs other than as the result of calling the abort or raise function, the
10741 behavior is undefined if the signal handler refers to any object with static or thread
10742 storage duration that is not a lock-free atomic object other than by assigning a value to an
10743 object declared as volatile sig_atomic_t, or the signal handler calls any function
10744 in the standard library other than the abort function, the _Exit function, the
10745 quick_exit function, or the signal function with the first argument equal to the
10746 signal number corresponding to the signal that caused the invocation of the handler.
10747 Furthermore, if such a call to the signal function results in a SIG_ERR return, the
10748 value of errno is indeterminate.<sup><a href="#note252"><b>252)</b></a></sup>
10751 <sup><a name="note251" href="#note251"><b>251)</b></a></sup> This includes functions called indirectly via standard library functions (e.g., a SIGABRT handler
10752 called via the abort function).
10753 <sup><a name="note252" href="#note252"><b>252)</b></a></sup> If any signal is generated by an asynchronous signal handler, the behavior is undefined.
10755 [<a name="p266" href="#p266">page 266</a>] (<a href="#Contents">Contents</a>)
10757 6 At program startup, the equivalent of
10758 signal(sig, SIG_IGN);
10759 may be executed for some signals selected in an implementation-defined manner; the
10760 equivalent of
10761 signal(sig, SIG_DFL);
10762 is executed for all other signals defined by the implementation.
10763 7 Use of this function in a multi-threaded program results in undefined behavior. The
10764 implementation shall behave as if no library function calls the signal function.
10765 <b> Returns</b>
10766 8 If the request can be honored, the signal function returns the value of func for the
10767 most recent successful call to signal for the specified signal sig. Otherwise, a value of
10768 SIG_ERR is returned and a positive value is stored in errno.
10769 Forward references: the abort function (<a href="#7.22.4.1">7.22.4.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>), the
10770 _Exit function (<a href="#7.22.4.5">7.22.4.5</a>), the quick_exit function (<a href="#7.22.4.7">7.22.4.7</a>).
10771 <a name="7.14.2" href="#7.14.2"><b> 7.14.2 Send signal</b></a>
10772 <a name="7.14.2.1" href="#7.14.2.1"><b> 7.14.2.1 The raise function</b></a>
10773 <b> Synopsis</b>
10774 1 #include <a href="#7.14">&lt;signal.h&gt;</a>
10775 int raise(int sig);
10776 <b> Description</b>
10777 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
10778 signal handler is called, the raise function shall not return until after the signal handler
10779 does.
10780 <b> Returns</b>
10781 3 The raise function returns zero if successful, nonzero if unsuccessful.
10783 [<a name="p267" href="#p267">page 267</a>] (<a href="#Contents">Contents</a>)
10785 <a name="7.15" href="#7.15"><b> 7.15 Alignment &lt;stdalign.h&gt;</b></a>
10786 1 The header <a href="#7.15">&lt;stdalign.h&gt;</a> defines four macros.
10787 2 The macro
10788 alignas
10789 expands to _Alignas; the macro
10790 alignof
10791 expands to _Alignof.
10792 3 The remaining macros are suitable for use in #if preprocessing directives. They are
10793 __alignas_is_defined
10795 __alignof_is_defined
10796 which both expand to the integer constant 1.
10798 [<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
10800 <a name="7.16" href="#7.16"><b> 7.16 Variable arguments &lt;stdarg.h&gt;</b></a>
10801 1 The header <a href="#7.16">&lt;stdarg.h&gt;</a> declares a type and defines four macros, for advancing
10802 through a list of arguments whose number and types are not known to the called function
10803 when it is translated.
10804 2 A function may be called with a variable number of arguments of varying types. As
10805 described in <a href="#6.9.1">6.9.1</a>, its parameter list contains one or more parameters. The rightmost
10806 parameter plays a special role in the access mechanism, and will be designated parmN in
10807 this description.
10808 3 The type declared is
10809 va_list
10810 which is a complete object type suitable for holding information needed by the macros
10811 va_start, va_arg, va_end, and va_copy. If access to the varying arguments is
10812 desired, the called function shall declare an object (generally referred to as ap in this
10813 subclause) having type va_list. The object ap may be passed as an argument to
10814 another function; if that function invokes the va_arg macro with parameter ap, the
10815 value of ap in the calling function is indeterminate and shall be passed to the va_end
10816 macro prior to any further reference to ap.<sup><a href="#note253"><b>253)</b></a></sup>
10817 <a name="7.16.1" href="#7.16.1"><b> 7.16.1 Variable argument list access macros</b></a>
10818 1 The va_start and va_arg macros described in this subclause shall be implemented
10819 as macros, not functions. It is unspecified whether va_copy and va_end are macros or
10820 identifiers declared with external linkage. If a macro definition is suppressed in order to
10821 access an actual function, or a program defines an external identifier with the same name,
10822 the behavior is undefined. Each invocation of the va_start and va_copy macros
10823 shall be matched by a corresponding invocation of the va_end macro in the same
10824 function.
10825 <a name="7.16.1.1" href="#7.16.1.1"><b> 7.16.1.1 The va_arg macro</b></a>
10826 <b> Synopsis</b>
10827 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10828 type va_arg(va_list ap, type);
10829 <b> Description</b>
10830 2 The va_arg macro expands to an expression that has the specified type and the value of
10831 the next argument in the call. The parameter ap shall have been initialized by the
10832 va_start or va_copy macro (without an intervening invocation of the va_end
10834 <sup><a name="note253" href="#note253"><b>253)</b></a></sup> It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
10835 case the original function may make further use of the original list after the other function returns.
10837 [<a name="p269" href="#p269">page 269</a>] (<a href="#Contents">Contents</a>)
10839 macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
10840 values of successive arguments are returned in turn. The parameter type shall be a type
10841 name specified such that the type of a pointer to an object that has the specified type can
10842 be obtained simply by postfixing a * to type. If there is no actual next argument, or if
10843 type is not compatible with the type of the actual next argument (as promoted according
10844 to the default argument promotions), the behavior is undefined, except for the following
10845 cases:
10846 -- one type is a signed integer type, the other type is the corresponding unsigned integer
10847 type, and the value is representable in both types;
10848 -- one type is pointer to void and the other is a pointer to a character type.
10849 <b> Returns</b>
10850 3 The first invocation of the va_arg macro after that of the va_start macro returns the
10851 value of the argument after that specified by parmN . Successive invocations return the
10852 values of the remaining arguments in succession.
10853 <a name="7.16.1.2" href="#7.16.1.2"><b> 7.16.1.2 The va_copy macro</b></a>
10854 <b> Synopsis</b>
10855 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10856 void va_copy(va_list dest, va_list src);
10857 <b> Description</b>
10858 2 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
10859 been applied to dest followed by the same sequence of uses of the va_arg macro as
10860 had previously been used to reach the present state of src. Neither the va_copy nor
10861 va_start macro shall be invoked to reinitialize dest without an intervening
10862 invocation of the va_end macro for the same dest.
10863 <b> Returns</b>
10864 3 The va_copy macro returns no value.
10865 <a name="7.16.1.3" href="#7.16.1.3"><b> 7.16.1.3 The va_end macro</b></a>
10866 <b> Synopsis</b>
10867 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10868 void va_end(va_list ap);
10869 <b> Description</b>
10870 2 The va_end macro facilitates a normal return from the function whose variable
10871 argument list was referred to by the expansion of the va_start macro, or the function
10872 containing the expansion of the va_copy macro, that initialized the va_list ap. The
10873 va_end macro may modify ap so that it is no longer usable (without being reinitialized
10875 [<a name="p270" href="#p270">page 270</a>] (<a href="#Contents">Contents</a>)
10877 by the va_start or va_copy macro). If there is no corresponding invocation of the
10878 va_start or va_copy macro, or if the va_end macro is not invoked before the
10879 return, the behavior is undefined.
10880 <b> Returns</b>
10881 3 The va_end macro returns no value.
10882 <a name="7.16.1.4" href="#7.16.1.4"><b> 7.16.1.4 The va_start macro</b></a>
10883 <b> Synopsis</b>
10884 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10885 void va_start(va_list ap, parmN);
10886 <b> Description</b>
10887 2 The va_start macro shall be invoked before any access to the unnamed arguments.
10888 3 The va_start macro initializes ap for subsequent use by the va_arg and va_end
10889 macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
10890 without an intervening invocation of the va_end macro for the same ap.
10891 4 The parameter parmN is the identifier of the rightmost parameter in the variable
10892 parameter list in the function definition (the one just before the , ...). If the parameter
10893 parmN is declared with the register storage class, with a function or array type, or
10894 with a type that is not compatible with the type that results after application of the default
10895 argument promotions, the behavior is undefined.
10896 <b> Returns</b>
10897 5 The va_start macro returns no value.
10898 6 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
10899 more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
10900 pointers is specified by the first argument to f1.
10901 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10902 #define MAXARGS 31
10903 void f1(int n_ptrs, ...)
10905 va_list ap;
10906 char *array[MAXARGS];
10907 int ptr_no = 0;
10909 [<a name="p271" href="#p271">page 271</a>] (<a href="#Contents">Contents</a>)
10911 if (n_ptrs &gt; MAXARGS)
10912 n_ptrs = MAXARGS;
10913 va_start(ap, n_ptrs);
10914 while (ptr_no &lt; n_ptrs)
10915 array[ptr_no++] = va_arg(ap, char *);
10916 va_end(ap);
10917 f2(n_ptrs, array);
10919 Each call to f1 is required to have visible the definition of the function or a declaration such as
10920 void f1(int, ...);
10922 7 EXAMPLE 2 The function f3 is similar, but saves the status of the variable argument list after the
10923 indicated number of arguments; after f2 has been called once with the whole list, the trailing part of the list
10924 is gathered again and passed to function f4.
10925 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
10926 #define MAXARGS 31
10927 void f3(int n_ptrs, int f4_after, ...)
10929 va_list ap, ap_save;
10930 char *array[MAXARGS];
10931 int ptr_no = 0;
10932 if (n_ptrs &gt; MAXARGS)
10933 n_ptrs = MAXARGS;
10934 va_start(ap, f4_after);
10935 while (ptr_no &lt; n_ptrs) {
10936 array[ptr_no++] = va_arg(ap, char *);
10937 if (ptr_no == f4_after)
10938 va_copy(ap_save, ap);
10940 va_end(ap);
10941 f2(n_ptrs, array);
10942 // Now process the saved copy.
10943 n_ptrs -= f4_after;
10944 ptr_no = 0;
10945 while (ptr_no &lt; n_ptrs)
10946 array[ptr_no++] = va_arg(ap_save, char *);
10947 va_end(ap_save);
10948 f4(n_ptrs, array);
10951 [<a name="p272" href="#p272">page 272</a>] (<a href="#Contents">Contents</a>)
10953 <a name="7.17" href="#7.17"><b> 7.17 Atomics &lt;stdatomic.h&gt;</b></a>
10954 <a name="7.17.1" href="#7.17.1"><b> 7.17.1 Introduction</b></a>
10955 1 The header <a href="#7.17">&lt;stdatomic.h&gt;</a> defines several macros and declares several types and
10956 functions for performing atomic operations on data shared between threads.<sup><a href="#note254"><b>254)</b></a></sup>
10957 2 Implementations that define the macro __STDC_NO_ATOMICS__ need not provide
10958 this header nor support any of its facilities.
10959 3 The macros defined are the atomic lock-free macros
10960 ATOMIC_BOOL_LOCK_FREE
10961 ATOMIC_CHAR_LOCK_FREE
10962 ATOMIC_CHAR16_T_LOCK_FREE
10963 ATOMIC_CHAR32_T_LOCK_FREE
10964 ATOMIC_WCHAR_T_LOCK_FREE
10965 ATOMIC_SHORT_LOCK_FREE
10966 ATOMIC_INT_LOCK_FREE
10967 ATOMIC_LONG_LOCK_FREE
10968 ATOMIC_LLONG_LOCK_FREE
10969 ATOMIC_POINTER_LOCK_FREE
10970 which indicate the lock-free property of the corresponding atomic types (both signed and
10971 unsigned); and
10972 ATOMIC_FLAG_INIT
10973 which expands to an initializer for an object of type atomic_flag.
10974 4 The types include
10975 memory_order
10976 which is an enumerated type whose enumerators identify memory ordering constraints;
10977 atomic_flag
10978 which is a structure type representing a lock-free, primitive atomic flag; and several *
10979 atomic analogs of integer types.
10980 5 In the following synopses:
10981 -- An A refers to one of the atomic types.
10982 -- A C refers to its corresponding non-atomic type. *
10983 -- An M refers to the type of the other argument for arithmetic operations. For atomic
10984 integer types, M is C. For atomic pointer types, M is ptrdiff_t.
10986 <sup><a name="note254" href="#note254"><b>254)</b></a></sup> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
10988 [<a name="p273" href="#p273">page 273</a>] (<a href="#Contents">Contents</a>)
10990 -- The functions not ending in _explicit have the same semantics as the
10991 corresponding _explicit function with memory_order_seq_cst for the
10992 memory_order argument.
10993 6 NOTE Many operations are volatile-qualified. The ''volatile as device register'' semantics have not
10994 changed in the standard. This qualification means that volatility is preserved when applying these
10995 operations to volatile objects.
10997 <a name="7.17.2" href="#7.17.2"><b> 7.17.2 Initialization</b></a>
10998 <a name="7.17.2.1" href="#7.17.2.1"><b> 7.17.2.1 The ATOMIC_VAR_INIT macro</b></a>
10999 <b> Synopsis</b>
11000 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11001 #define ATOMIC_VAR_INIT(C value)
11002 <b> Description</b>
11003 2 The ATOMIC_VAR_INIT macro expands to a token sequence suitable for initializing an
11004 atomic object of a type that is initialization-compatible with value. An atomic object
11005 with automatic storage duration that is not explicitly initialized using
11006 ATOMIC_VAR_INIT is initially in an indeterminate state; however, the default (zero)
11007 initialization for objects with static or thread-local storage duration is guaranteed to
11008 produce a valid state.
11009 3 Concurrent access to the variable being initialized, even via an atomic operation,
11010 constitutes a data race.
11011 4 EXAMPLE
11012 atomic_int guide = ATOMIC_VAR_INIT(42);
11014 <a name="7.17.2.2" href="#7.17.2.2"><b> 7.17.2.2 The atomic_init generic function</b></a>
11015 <b> Synopsis</b>
11016 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11017 void atomic_init(volatile A *obj, C value);
11018 <b> Description</b>
11019 2 The atomic_init generic function initializes the atomic object pointed to by obj to
11020 the value value, while also initializing any additional state that the implementation
11021 might need to carry for the atomic object.
11022 3 Although this function initializes an atomic object, it does not avoid data races;
11023 concurrent access to the variable being initialized, even via an atomic operation,
11024 constitutes a data race.
11026 [<a name="p274" href="#p274">page 274</a>] (<a href="#Contents">Contents</a>)
11028 <b> Returns</b>
11029 4 The atomic_init generic function returns no value.
11030 5 EXAMPLE
11031 atomic_int guide;
11032 atomic_init(&amp;guide, 42);
11034 <a name="7.17.3" href="#7.17.3"><b> 7.17.3 Order and consistency</b></a>
11035 1 The enumerated type memory_order specifies the detailed regular (non-atomic)
11036 memory synchronization operations as defined in <a href="#5.1.2.4">5.1.2.4</a> and may provide for operation
11037 ordering. Its enumeration constants are as follows:<sup><a href="#note255"><b>255)</b></a></sup>
11038 memory_order_relaxed
11039 memory_order_consume
11040 memory_order_acquire
11041 memory_order_release
11042 memory_order_acq_rel
11043 memory_order_seq_cst
11044 2 For memory_order_relaxed, no operation orders memory.
11045 3 For memory_order_release, memory_order_acq_rel, and
11046 memory_order_seq_cst, a store operation performs a release operation on the
11047 affected memory location.
11048 4 For memory_order_acquire, memory_order_acq_rel, and
11049 memory_order_seq_cst, a load operation performs an acquire operation on the
11050 affected memory location.
11051 5 For memory_order_consume, a load operation performs a consume operation on the
11052 affected memory location.
11053 6 There shall be a single total order S on all memory_order_seq_cst operations,
11054 consistent with the ''happens before'' order and modification orders for all affected
11055 locations, such that each memory_order_seq_cst operation B that loads a value
11056 from an atomic object M observes one of the following values:
11057 -- the result of the last modification A of M that precedes B in S, if it exists, or
11058 -- if A exists, the result of some modification of M in the visible sequence of side
11059 effects with respect to B that is not memory_order_seq_cst and that does not
11060 happen before A, or
11065 <sup><a name="note255" href="#note255"><b>255)</b></a></sup> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
11067 [<a name="p275" href="#p275">page 275</a>] (<a href="#Contents">Contents</a>)
11069 -- if A does not exist, the result of some modification of M in the visible sequence of
11070 side effects with respect to B that is not memory_order_seq_cst.
11071 7 NOTE 1 Although it is not explicitly required that S include lock operations, it can always be extended to
11072 an order that does include lock and unlock operations, since the ordering between those is already included
11073 in the ''happens before'' ordering.
11075 8 NOTE 2 Atomic operations specifying memory_order_relaxed are relaxed only with respect to
11076 memory ordering. Implementations must still guarantee that any given atomic access to a particular atomic
11077 object be indivisible with respect to all other atomic accesses to that object.
11079 9 For an atomic operation B that reads the value of an atomic object M, if there is a
11080 memory_order_seq_cst fence X sequenced before B, then B observes either the
11081 last memory_order_seq_cst modification of M preceding X in the total order S or
11082 a later modification of M in its modification order.
11083 10 For atomic operations A and B on an atomic object M, where A modifies M and B takes
11084 its value, if there is a memory_order_seq_cst fence X such that A is sequenced
11085 before X and B follows X in S, then B observes either the effects of A or a later
11086 modification of M in its modification order.
11087 11 For atomic operations A and B on an atomic object M, where A modifies M and B takes
11088 its value, if there are memory_order_seq_cst fences X and Y such that A is
11089 sequenced before X, Y is sequenced before B, and X precedes Y in S, then B observes
11090 either the effects of A or a later modification of M in its modification order.
11091 12 Atomic read-modify-write operations shall always read the last value (in the modification
11092 order) stored before the write associated with the read-modify-write operation.
11093 13 An atomic store shall only store a value that has been computed from constants and
11094 program input values by a finite sequence of program evaluations, such that each
11095 evaluation observes the values of variables as computed by the last prior assignment in
11096 the sequence.<sup><a href="#note256"><b>256)</b></a></sup> The ordering of evaluations in this sequence shall be such that
11097 -- If an evaluation B observes a value computed by A in a different thread, then B does
11098 not happen before A.
11099 -- If an evaluation A is included in the sequence, then all evaluations that assign to the
11100 same variable and happen before A are also included.
11101 14 NOTE 3 The second requirement disallows ''out-of-thin-air'', or ''speculative'' stores of atomics when
11102 relaxed atomics are used. Since unordered operations are involved, evaluations may appear in this
11103 sequence out of thread order. For example, with x and y initially zero,
11108 <sup><a name="note256" href="#note256"><b>256)</b></a></sup> Among other implications, atomic variables shall not decay.
11110 [<a name="p276" href="#p276">page 276</a>] (<a href="#Contents">Contents</a>)
11112 // Thread 1:
11113 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
11114 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
11116 // Thread 2:
11117 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
11118 atomic_store_explicit(&amp;y, 42, memory_order_relaxed);
11119 is allowed to produce r1 == 42 &amp;&amp; r2 == 42. The sequence of evaluations justifying this consists of:
11120 atomic_store_explicit(&amp;y, 42, memory_order_relaxed);
11121 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
11122 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
11123 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
11124 On the other hand,
11125 // Thread 1:
11126 r1 = atomic_load_explicit(&amp;y, memory_order_relaxed);
11127 atomic_store_explicit(&amp;x, r1, memory_order_relaxed);
11129 // Thread 2:
11130 r2 = atomic_load_explicit(&amp;x, memory_order_relaxed);
11131 atomic_store_explicit(&amp;y, r2, memory_order_relaxed);
11132 is not allowed to produce r1 == 42 &amp;&amp; r2 = 42, since there is no sequence of evaluations that results
11133 in the computation of 42. In the absence of ''relaxed'' operations and read-modify-write operations with
11134 weaker than memory_order_acq_rel ordering, the second requirement has no impact.
11136 Recommended practice
11137 15 The requirements do not forbid r1 == 42 &amp;&amp; r2 == 42 in the following example,
11138 with x and y initially zero:
11139 // Thread 1:
11140 r1 = atomic_load_explicit(&amp;x, memory_order_relaxed);
11141 if (r1 == 42)
11142 atomic_store_explicit(&amp;y, r1, memory_order_relaxed);
11144 // Thread 2:
11145 r2 = atomic_load_explicit(&amp;y, memory_order_relaxed);
11146 if (r2 == 42)
11147 atomic_store_explicit(&amp;x, 42, memory_order_relaxed);
11148 However, this is not useful behavior, and implementations should not allow it.
11149 16 Implementations should make atomic stores visible to atomic loads within a reasonable
11150 amount of time.
11152 [<a name="p277" href="#p277">page 277</a>] (<a href="#Contents">Contents</a>)
11154 <a name="7.17.3.1" href="#7.17.3.1"><b> 7.17.3.1 The kill_dependency macro</b></a>
11155 <b> Synopsis</b>
11156 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11157 type kill_dependency(type y);
11158 <b> Description</b>
11159 2 The kill_dependency macro terminates a dependency chain; the argument does not
11160 carry a dependency to the return value.
11161 <b> Returns</b>
11162 3 The kill_dependency macro returns the value of y.
11163 <a name="7.17.4" href="#7.17.4"><b> 7.17.4 Fences</b></a>
11164 1 This subclause introduces synchronization primitives called fences. Fences can have
11165 acquire semantics, release semantics, or both. A fence with acquire semantics is called
11166 an acquire fence; a fence with release semantics is called a release fence.
11167 2 A release fence A synchronizes with an acquire fence B if there exist atomic operations
11168 X and Y , both operating on some atomic object M, such that A is sequenced before X, X
11169 modifies M, Y is sequenced before B, and Y reads the value written by X or a value
11170 written by any side effect in the hypothetical release sequence X would head if it were a
11171 release operation.
11172 3 A release fence A synchronizes with an atomic operation B that performs an acquire
11173 operation on an atomic object M if there exists an atomic operation X such that A is
11174 sequenced before X, X modifies M, and B reads the value written by X or a value written
11175 by any side effect in the hypothetical release sequence X would head if it were a release
11176 operation.
11177 4 An atomic operation A that is a release operation on an atomic object M synchronizes
11178 with an acquire fence B if there exists some atomic operation X on M such that X is
11179 sequenced before B and reads the value written by A or a value written by any side effect
11180 in the release sequence headed by A.
11181 <a name="7.17.4.1" href="#7.17.4.1"><b> 7.17.4.1 The atomic_thread_fence function</b></a>
11182 <b> Synopsis</b>
11183 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11184 void atomic_thread_fence(memory_order order);
11185 <b> Description</b>
11186 2 Depending on the value of order, this operation:
11187 -- has no effects, if order == memory_order_relaxed;
11189 [<a name="p278" href="#p278">page 278</a>] (<a href="#Contents">Contents</a>)
11191 -- is an acquire fence, if order == memory_order_acquire or order ==
11192 memory_order_consume;
11193 -- is a release fence, if order == memory_order_release;
11194 -- is both an acquire fence and a release fence, if order ==
11195 memory_order_acq_rel;
11196 -- is a sequentially consistent acquire and release fence, if order ==
11197 memory_order_seq_cst.
11198 <b> Returns</b>
11199 3 The atomic_thread_fence function returns no value.
11200 <a name="7.17.4.2" href="#7.17.4.2"><b> 7.17.4.2 The atomic_signal_fence function</b></a>
11201 <b> Synopsis</b>
11202 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11203 void atomic_signal_fence(memory_order order);
11204 <b> Description</b>
11205 2 Equivalent to atomic_thread_fence(order), except that the resulting ordering
11206 constraints are established only between a thread and a signal handler executed in the
11207 same thread.
11208 3 NOTE 1 The atomic_signal_fence function can be used to specify the order in which actions
11209 performed by the thread become visible to the signal handler.
11211 4 NOTE 2 Compiler optimizations and reorderings of loads and stores are inhibited in the same way as with
11212 atomic_thread_fence, but the hardware fence instructions that atomic_thread_fence would
11213 have inserted are not emitted.
11215 <b> Returns</b>
11216 5 The atomic_signal_fence function returns no value.
11217 <a name="7.17.5" href="#7.17.5"><b> 7.17.5 Lock-free property</b></a>
11218 1 The atomic lock-free macros indicate the lock-free property of integer and address atomic
11219 types. A value of 0 indicates that the type is never lock-free; a value of 1 indicates that
11220 the type is sometimes lock-free; a value of 2 indicates that the type is always lock-free.
11221 2 NOTE Operations that are lock-free should also be address-free. That is, atomic operations on the same
11222 memory location via two different addresses will communicate atomically. The implementation should not
11223 depend on any per-process state. This restriction enables communication via memory mapped into a
11224 process more than once and memory shared between two processes.
11226 [<a name="p279" href="#p279">page 279</a>] (<a href="#Contents">Contents</a>)
11228 <a name="7.17.5.1" href="#7.17.5.1"><b> 7.17.5.1 The atomic_is_lock_free generic function</b></a>
11229 <b> Synopsis</b>
11230 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11231 _Bool atomic_is_lock_free(const volatile A *obj);
11232 <b> Description</b>
11233 2 The atomic_is_lock_free generic function indicates whether or not the object
11234 pointed to by obj is lock-free. *
11235 <b> Returns</b>
11236 3 The atomic_is_lock_free generic function returns nonzero (true) if and only if the
11237 object's operations are lock-free. The result of a lock-free query on one object cannot be
11238 inferred from the result of a lock-free query on another object.
11239 <a name="7.17.6" href="#7.17.6"><b> 7.17.6 Atomic integer types</b></a>
11240 1 For each line in the following table,<sup><a href="#note257"><b>257)</b></a></sup> the atomic type name is declared as a type that
11241 has the same representation and alignment requirements as the corresponding direct
11242 type.<sup><a href="#note258"><b>258)</b></a></sup>
11247 <sup><a name="note257" href="#note257"><b>257)</b></a></sup> See ''future library directions'' (<a href="#7.31.8">7.31.8</a>).
11248 <sup><a name="note258" href="#note258"><b>258)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
11249 arguments to functions, return values from functions, and members of unions.
11251 [<a name="p280" href="#p280">page 280</a>] (<a href="#Contents">Contents</a>)
11253 Atomic type name Direct type
11254 atomic_bool _Atomic _Bool
11255 atomic_char _Atomic char
11256 atomic_schar _Atomic signed char
11257 atomic_uchar _Atomic unsigned char
11258 atomic_short _Atomic short
11259 atomic_ushort _Atomic unsigned short
11260 atomic_int _Atomic int
11261 atomic_uint _Atomic unsigned int
11262 atomic_long _Atomic long
11263 atomic_ulong _Atomic unsigned long
11264 atomic_llong _Atomic long long
11265 atomic_ullong _Atomic unsigned long long
11266 atomic_char16_t _Atomic char16_t
11267 atomic_char32_t _Atomic char32_t
11268 atomic_wchar_t _Atomic wchar_t
11269 atomic_int_least8_t _Atomic int_least8_t
11270 atomic_uint_least8_t _Atomic uint_least8_t
11271 atomic_int_least16_t _Atomic int_least16_t
11272 atomic_uint_least16_t _Atomic uint_least16_t
11273 atomic_int_least32_t _Atomic int_least32_t
11274 atomic_uint_least32_t _Atomic uint_least32_t
11275 atomic_int_least64_t _Atomic int_least64_t
11276 atomic_uint_least64_t _Atomic uint_least64_t
11277 atomic_int_fast8_t _Atomic int_fast8_t
11278 atomic_uint_fast8_t _Atomic uint_fast8_t
11279 atomic_int_fast16_t _Atomic int_fast16_t
11280 atomic_uint_fast16_t _Atomic uint_fast16_t
11281 atomic_int_fast32_t _Atomic int_fast32_t
11282 atomic_uint_fast32_t _Atomic uint_fast32_t
11283 atomic_int_fast64_t _Atomic int_fast64_t
11284 atomic_uint_fast64_t _Atomic uint_fast64_t
11285 atomic_intptr_t _Atomic intptr_t
11286 atomic_uintptr_t _Atomic uintptr_t
11287 atomic_size_t _Atomic size_t
11288 atomic_ptrdiff_t _Atomic ptrdiff_t
11289 atomic_intmax_t _Atomic intmax_t
11290 atomic_uintmax_t _Atomic uintmax_t
11291 2 The semantics of the operations on these types are defined in <a href="#7.17.7">7.17.7</a>. *
11293 [<a name="p281" href="#p281">page 281</a>] (<a href="#Contents">Contents</a>)
11295 3 NOTE The representation of atomic integer types need not have the same size as their corresponding
11296 regular types. They should have the same size whenever possible, as it eases effort required to port existing
11297 code.
11299 <a name="7.17.7" href="#7.17.7"><b> 7.17.7 Operations on atomic types</b></a>
11300 1 There are only a few kinds of operations on atomic types, though there are many
11301 instances of those kinds. This subclause specifies each general kind.
11302 <a name="7.17.7.1" href="#7.17.7.1"><b> 7.17.7.1 The atomic_store generic functions</b></a>
11303 <b> Synopsis</b>
11304 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11305 void atomic_store(volatile A *object, C desired);
11306 void atomic_store_explicit(volatile A *object,
11307 C desired, memory_order order);
11308 <b> Description</b>
11309 2 The order argument shall not be memory_order_acquire,
11310 memory_order_consume, nor memory_order_acq_rel. Atomically replace the
11311 value pointed to by object with the value of desired. Memory is affected according
11312 to the value of order.
11313 <b> Returns</b>
11314 3 The atomic_store generic functions return no value.
11315 <a name="7.17.7.2" href="#7.17.7.2"><b> 7.17.7.2 The atomic_load generic functions</b></a>
11316 <b> Synopsis</b>
11317 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11318 C atomic_load(volatile A *object);
11319 C atomic_load_explicit(volatile A *object,
11320 memory_order order);
11321 <b> Description</b>
11322 2 The order argument shall not be memory_order_release nor
11323 memory_order_acq_rel. Memory is affected according to the value of order.
11324 <b> Returns</b>
11325 Atomically returns the value pointed to by object.
11327 [<a name="p282" href="#p282">page 282</a>] (<a href="#Contents">Contents</a>)
11329 <a name="7.17.7.3" href="#7.17.7.3"><b> 7.17.7.3 The atomic_exchange generic functions</b></a>
11330 <b> Synopsis</b>
11331 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11332 C atomic_exchange(volatile A *object, C desired);
11333 C atomic_exchange_explicit(volatile A *object,
11334 C desired, memory_order order);
11335 <b> Description</b>
11336 2 Atomically replace the value pointed to by object with desired. Memory is affected
11337 according to the value of order. These operations are read-modify-write operations
11338 (<a href="#5.1.2.4">5.1.2.4</a>).
11339 <b> Returns</b>
11340 3 Atomically returns the value pointed to by object immediately before the effects.
11341 <a name="7.17.7.4" href="#7.17.7.4"><b> 7.17.7.4 The atomic_compare_exchange generic functions</b></a>
11342 <b> Synopsis</b>
11343 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11344 _Bool atomic_compare_exchange_strong(volatile A *object,
11345 C *expected, C desired);
11346 _Bool atomic_compare_exchange_strong_explicit(
11347 volatile A *object, C *expected, C desired,
11348 memory_order success, memory_order failure);
11349 _Bool atomic_compare_exchange_weak(volatile A *object,
11350 C *expected, C desired);
11351 _Bool atomic_compare_exchange_weak_explicit(
11352 volatile A *object, C *expected, C desired,
11353 memory_order success, memory_order failure);
11354 <b> Description</b>
11355 2 The failure argument shall not be memory_order_release nor
11356 memory_order_acq_rel. The failure argument shall be no stronger than the
11357 success argument. Atomically, compares the value pointed to by object for equality
11358 with that in expected, and if true, replaces the value pointed to by object with
11359 desired, and if false, updates the value in expected with the value pointed to by
11360 object. Further, if the comparison is true, memory is affected according to the value of
11361 success, and if the comparison is false, memory is affected according to the value of
11362 failure. These operations are atomic read-modify-write operations (<a href="#5.1.2.4">5.1.2.4</a>).
11363 3 NOTE 1 For example, the effect of atomic_compare_exchange_strong is
11365 [<a name="p283" href="#p283">page 283</a>] (<a href="#Contents">Contents</a>)
11367 if (memcmp(object, expected, sizeof (*object)) == 0)
11368 memcpy(object, &amp;desired, sizeof (*object));
11369 else
11370 memcpy(expected, object, sizeof (*object));
11372 4 A weak compare-and-exchange operation may fail spuriously. That is, even when the
11373 contents of memory referred to by expected and object are equal, it may return zero
11374 and store back to expected the same memory contents that were originally there.
11375 5 NOTE 2 This spurious failure enables implementation of compare-and-exchange on a broader class of
11376 machines, e.g. load-locked store-conditional machines.
11378 6 EXAMPLE A consequence of spurious failure is that nearly all uses of weak compare-and-exchange will
11379 be in a loop.
11380 exp = atomic_load(&amp;cur);
11381 do {
11382 des = function(exp);
11383 } while (!atomic_compare_exchange_weak(&amp;cur, &amp;exp, des));
11384 When a compare-and-exchange is in a loop, the weak version will yield better performance on some
11385 platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the
11386 strong one is preferable.
11388 <b> Returns</b>
11389 7 The result of the comparison.
11390 <a name="7.17.7.5" href="#7.17.7.5"><b> 7.17.7.5 The atomic_fetch and modify generic functions</b></a>
11391 1 The following operations perform arithmetic and bitwise computations. All of these
11392 operations are applicable to an object of any atomic integer type. None of these *
11393 operations is applicable to atomic_bool. The key, operator, and computation
11394 correspondence is:
11395 key op computation
11396 add + addition
11397 sub - subtraction
11398 or | bitwise inclusive or
11399 xor ^ bitwise exclusive or
11400 and &amp; bitwise and
11401 <b> Synopsis</b>
11402 2 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11403 C atomic_fetch_key(volatile A *object, M operand);
11404 C atomic_fetch_key_explicit(volatile A *object,
11405 M operand, memory_order order);
11406 <b> Description</b>
11407 3 Atomically replaces the value pointed to by object with the result of the computation
11408 applied to the value pointed to by object and the given operand. Memory is affected
11410 [<a name="p284" href="#p284">page 284</a>] (<a href="#Contents">Contents</a>)
11412 according to the value of order. These operations are atomic read-modify-write
11413 operations (<a href="#5.1.2.4">5.1.2.4</a>). For signed integer types, arithmetic is defined to use two's
11414 complement representation with silent wrap-around on overflow; there are no undefined
11415 results. For address types, the result may be an undefined address, but the operations
11416 otherwise have no undefined behavior.
11417 <b> Returns</b>
11418 4 Atomically, the value pointed to by object immediately before the effects.
11419 5 NOTE The operation of the atomic_fetch and modify generic functions are nearly equivalent to the
11420 operation of the corresponding op= compound assignment operators. The only differences are that the
11421 compound assignment operators are not guaranteed to operate atomically, and the value yielded by a
11422 compound assignment operator is the updated value of the object, whereas the value returned by the
11423 atomic_fetch and modify generic functions is the previous value of the atomic object.
11425 <a name="7.17.8" href="#7.17.8"><b> 7.17.8 Atomic flag type and operations</b></a>
11426 1 The atomic_flag type provides the classic test-and-set functionality. It has two
11427 states, set and clear.
11428 2 Operations on an object of type atomic_flag shall be lock free.
11429 3 NOTE Hence the operations should also be address-free. No other type requires lock-free operations, so
11430 the atomic_flag type is the minimum hardware-implemented type needed to conform to this
11431 International standard. The remaining types can be emulated with atomic_flag, though with less than
11432 ideal properties.
11434 4 The macro ATOMIC_FLAG_INIT may be used to initialize an atomic_flag to the
11435 clear state. An atomic_flag that is not explicitly initialized with
11436 ATOMIC_FLAG_INIT is initially in an indeterminate state.
11437 5 EXAMPLE
11438 atomic_flag guard = ATOMIC_FLAG_INIT;
11440 <a name="7.17.8.1" href="#7.17.8.1"><b> 7.17.8.1 The atomic_flag_test_and_set functions</b></a>
11441 <b> Synopsis</b>
11442 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11443 _Bool atomic_flag_test_and_set(
11444 volatile atomic_flag *object);
11445 _Bool atomic_flag_test_and_set_explicit(
11446 volatile atomic_flag *object, memory_order order);
11447 <b> Description</b>
11448 2 Atomically sets the value pointed to by object to true. Memory is affected according
11449 to the value of order. These operations are atomic read-modify-write operations
11450 (<a href="#5.1.2.4">5.1.2.4</a>).
11452 [<a name="p285" href="#p285">page 285</a>] (<a href="#Contents">Contents</a>)
11454 <b> Returns</b>
11455 3 Atomically, the value of the object immediately before the effects.
11456 <a name="7.17.8.2" href="#7.17.8.2"><b> 7.17.8.2 The atomic_flag_clear functions</b></a>
11457 <b> Synopsis</b>
11458 1 #include <a href="#7.17">&lt;stdatomic.h&gt;</a>
11459 void atomic_flag_clear(volatile atomic_flag *object);
11460 void atomic_flag_clear_explicit(
11461 volatile atomic_flag *object, memory_order order);
11462 <b> Description</b>
11463 2 The order argument shall not be memory_order_acquire nor
11464 memory_order_acq_rel. Atomically sets the value pointed to by object to false.
11465 Memory is affected according to the value of order.
11466 <b> Returns</b>
11467 3 The atomic_flag_clear functions return no value.
11469 [<a name="p286" href="#p286">page 286</a>] (<a href="#Contents">Contents</a>)
11471 <a name="7.18" href="#7.18"><b> 7.18 Boolean type and values &lt;stdbool.h&gt;</b></a>
11472 1 The header <a href="#7.18">&lt;stdbool.h&gt;</a> defines four macros.
11473 2 The macro
11474 bool
11475 expands to _Bool.
11476 3 The remaining three macros are suitable for use in #if preprocessing directives. They
11478 true
11479 which expands to the integer constant 1,
11480 false
11481 which expands to the integer constant 0, and
11482 __bool_true_false_are_defined
11483 which expands to the integer constant 1.
11484 4 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
11485 redefine the macros bool, true, and false.<sup><a href="#note259"><b>259)</b></a></sup>
11490 <sup><a name="note259" href="#note259"><b>259)</b></a></sup> See ''future library directions'' (<a href="#7.31.9">7.31.9</a>).
11492 [<a name="p287" href="#p287">page 287</a>] (<a href="#Contents">Contents</a>)
11494 <a name="7.19" href="#7.19"><b> 7.19 Common definitions &lt;stddef.h&gt;</b></a>
11495 1 The header <a href="#7.19">&lt;stddef.h&gt;</a> defines the following macros and declares the following types.
11496 Some are also defined in other headers, as noted in their respective subclauses.
11497 2 The types are
11498 ptrdiff_t
11499 which is the signed integer type of the result of subtracting two pointers;
11500 size_t
11501 which is the unsigned integer type of the result of the sizeof operator;
11502 max_align_t
11503 which is an object type whose alignment is as great as is supported by the implementation
11504 in all contexts; and
11505 wchar_t
11506 which is an integer type whose range of values can represent distinct codes for all
11507 members of the largest extended character set specified among the supported locales; the
11508 null character shall have the code value zero. Each member of the basic character set
11509 shall have a code value equal to its value when used as the lone character in an integer
11510 character constant if an implementation does not define
11511 __STDC_MB_MIGHT_NEQ_WC__.
11512 3 The macros are
11513 NULL
11514 which expands to an implementation-defined null pointer constant; and
11515 offsetof(type, member-designator)
11516 which expands to an integer constant expression that has type size_t, the value of
11517 which is the offset in bytes, to the structure member (designated by member-designator),
11518 from the beginning of its structure (designated by type). The type and member designator
11519 shall be such that given
11520 static type t;
11521 then the expression &amp;(t.member-designator) evaluates to an address constant. (If the
11522 specified member is a bit-field, the behavior is undefined.)
11523 Recommended practice
11524 4 The types used for size_t and ptrdiff_t should not have an integer conversion rank
11525 greater than that of signed long int unless the implementation supports objects
11526 large enough to make this necessary. *
11528 [<a name="p288" href="#p288">page 288</a>] (<a href="#Contents">Contents</a>)
11530 <a name="7.20" href="#7.20"><b> 7.20 Integer types &lt;stdint.h&gt;</b></a>
11531 1 The header <a href="#7.20">&lt;stdint.h&gt;</a> declares sets of integer types having specified widths, and
11532 defines corresponding sets of macros.<sup><a href="#note260"><b>260)</b></a></sup> It also defines macros that specify limits of
11533 integer types corresponding to types defined in other standard headers.
11534 2 Types are defined in the following categories:
11535 -- integer types having certain exact widths;
11536 -- integer types having at least certain specified widths;
11537 -- fastest integer types having at least certain specified widths;
11538 -- integer types wide enough to hold pointers to objects;
11539 -- integer types having greatest width.
11540 (Some of these types may denote the same type.)
11541 3 Corresponding macros specify limits of the declared types and construct suitable
11542 constants.
11543 4 For each type described herein that the implementation provides,<sup><a href="#note261"><b>261)</b></a></sup> <a href="#7.20">&lt;stdint.h&gt;</a> shall
11544 declare that typedef name and define the associated macros. Conversely, for each type
11545 described herein that the implementation does not provide, <a href="#7.20">&lt;stdint.h&gt;</a> shall not
11546 declare that typedef name nor shall it define the associated macros. An implementation
11547 shall provide those types described as ''required'', but need not provide any of the others
11548 (described as ''optional'').
11549 <a name="7.20.1" href="#7.20.1"><b> 7.20.1 Integer types</b></a>
11550 1 When typedef names differing only in the absence or presence of the initial u are defined,
11551 they shall denote corresponding signed and unsigned types as described in <a href="#6.2.5">6.2.5</a>; an
11552 implementation providing one of these corresponding types shall also provide the other.
11553 2 In the following descriptions, the symbol N represents an unsigned decimal integer with
11554 no leading zeros (e.g., 8 or 24, but not 04 or 048).
11559 <sup><a name="note260" href="#note260"><b>260)</b></a></sup> See ''future library directions'' (<a href="#7.31.10">7.31.10</a>).
11560 <sup><a name="note261" href="#note261"><b>261)</b></a></sup> Some of these types may denote implementation-defined extended integer types.
11562 [<a name="p289" href="#p289">page 289</a>] (<a href="#Contents">Contents</a>)
11564 <a name="7.20.1.1" href="#7.20.1.1"><b> 7.20.1.1 Exact-width integer types</b></a>
11565 1 The typedef name intN_t designates a signed integer type with width N , no padding
11566 bits, and a two's complement representation. Thus, int8_t denotes such a signed
11567 integer type with a width of exactly 8 bits.
11568 2 The typedef name uintN_t designates an unsigned integer type with width N and no
11569 padding bits. Thus, uint24_t denotes such an unsigned integer type with a width of
11570 exactly 24 bits.
11571 3 These types are optional. However, if an implementation provides integer types with
11572 widths of 8, 16, 32, or 64 bits, no padding bits, and (for the signed types) that have a
11573 two's complement representation, it shall define the corresponding typedef names.
11574 <a name="7.20.1.2" href="#7.20.1.2"><b> 7.20.1.2 Minimum-width integer types</b></a>
11575 1 The typedef name int_leastN_t designates a signed integer type with a width of at
11576 least N , such that no signed integer type with lesser size has at least the specified width.
11577 Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
11578 2 The typedef name uint_leastN_t designates an unsigned integer type with a width
11579 of at least N , such that no unsigned integer type with lesser size has at least the specified
11580 width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
11581 least 16 bits.
11582 3 The following types are required:
11583 int_least8_t uint_least8_t
11584 int_least16_t uint_least16_t
11585 int_least32_t uint_least32_t
11586 int_least64_t uint_least64_t
11587 All other types of this form are optional.
11588 <a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 Fastest minimum-width integer types</b></a>
11589 1 Each of the following types designates an integer type that is usually fastest<sup><a href="#note262"><b>262)</b></a></sup> to operate
11590 with among all integer types that have at least the specified width.
11591 2 The typedef name int_fastN_t designates the fastest signed integer type with a width
11592 of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
11593 type with a width of at least N .
11598 <sup><a name="note262" href="#note262"><b>262)</b></a></sup> The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
11599 grounds for choosing one type over another, it will simply pick some integer type satisfying the
11600 signedness and width requirements.
11602 [<a name="p290" href="#p290">page 290</a>] (<a href="#Contents">Contents</a>)
11604 3 The following types are required:
11605 int_fast8_t uint_fast8_t
11606 int_fast16_t uint_fast16_t
11607 int_fast32_t uint_fast32_t
11608 int_fast64_t uint_fast64_t
11609 All other types of this form are optional.
11610 <a name="7.20.1.4" href="#7.20.1.4"><b> 7.20.1.4 Integer types capable of holding object pointers</b></a>
11611 1 The following type designates a signed integer type with the property that any valid
11612 pointer to void can be converted to this type, then converted back to pointer to void,
11613 and the result will compare equal to the original pointer:
11614 intptr_t
11615 The following type designates an unsigned integer type with the property that any valid
11616 pointer to void can be converted to this type, then converted back to pointer to void,
11617 and the result will compare equal to the original pointer:
11618 uintptr_t
11619 These types are optional.
11620 <a name="7.20.1.5" href="#7.20.1.5"><b> 7.20.1.5 Greatest-width integer types</b></a>
11621 1 The following type designates a signed integer type capable of representing any value of
11622 any signed integer type:
11623 intmax_t
11624 The following type designates an unsigned integer type capable of representing any value
11625 of any unsigned integer type:
11626 uintmax_t
11627 These types are required.
11628 <a name="7.20.2" href="#7.20.2"><b> 7.20.2 Limits of specified-width integer types</b></a>
11629 1 The following object-like macros specify the minimum and maximum limits of the types
11630 declared in <a href="#7.20">&lt;stdint.h&gt;</a>. Each macro name corresponds to a similar type name in
11631 <a href="#7.20.1">7.20.1</a>.
11632 2 Each instance of any defined macro shall be replaced by a constant expression suitable
11633 for use in #if preprocessing directives, and this expression shall have the same type as
11634 would an expression that is an object of the corresponding type converted according to
11635 the integer promotions. Its implementation-defined value shall be equal to or greater in
11636 magnitude (absolute value) than the corresponding value given below, with the same sign,
11637 except where stated to be exactly the given value.
11639 [<a name="p291" href="#p291">page 291</a>] (<a href="#Contents">Contents</a>)
11641 <a name="7.20.2.1" href="#7.20.2.1"><b> 7.20.2.1 Limits of exact-width integer types</b></a>
11642 1 -- minimum values of exact-width signed integer types
11643 INTN_MIN exactly -(2 N -1 )
11644 -- maximum values of exact-width signed integer types
11645 INTN_MAX exactly 2 N -1 - 1
11646 -- maximum values of exact-width unsigned integer types
11647 UINTN_MAX exactly 2 N - 1
11648 <a name="7.20.2.2" href="#7.20.2.2"><b> 7.20.2.2 Limits of minimum-width integer types</b></a>
11649 1 -- minimum values of minimum-width signed integer types
11650 INT_LEASTN_MIN -(2 N -1 - 1)
11651 -- maximum values of minimum-width signed integer types
11652 INT_LEASTN_MAX 2 N -1 - 1
11653 -- maximum values of minimum-width unsigned integer types
11654 UINT_LEASTN_MAX 2N - 1
11655 <a name="7.20.2.3" href="#7.20.2.3"><b> 7.20.2.3 Limits of fastest minimum-width integer types</b></a>
11656 1 -- minimum values of fastest minimum-width signed integer types
11657 INT_FASTN_MIN -(2 N -1 - 1)
11658 -- maximum values of fastest minimum-width signed integer types
11659 INT_FASTN_MAX 2 N -1 - 1
11660 -- maximum values of fastest minimum-width unsigned integer types
11661 UINT_FASTN_MAX 2N - 1
11662 <a name="7.20.2.4" href="#7.20.2.4"><b> 7.20.2.4 Limits of integer types capable of holding object pointers</b></a>
11663 1 -- minimum value of pointer-holding signed integer type
11664 INTPTR_MIN -(215 - 1)
11665 -- maximum value of pointer-holding signed integer type
11666 INTPTR_MAX 215 - 1
11667 -- maximum value of pointer-holding unsigned integer type
11668 UINTPTR_MAX 216 - 1
11670 [<a name="p292" href="#p292">page 292</a>] (<a href="#Contents">Contents</a>)
11672 <a name="7.20.2.5" href="#7.20.2.5"><b> 7.20.2.5 Limits of greatest-width integer types</b></a>
11673 1 -- minimum value of greatest-width signed integer type
11674 INTMAX_MIN -(263 - 1)
11675 -- maximum value of greatest-width signed integer type
11676 INTMAX_MAX 263 - 1
11677 -- maximum value of greatest-width unsigned integer type
11678 UINTMAX_MAX 264 - 1
11679 <a name="7.20.3" href="#7.20.3"><b> 7.20.3 Limits of other integer types</b></a>
11680 1 The following object-like macros specify the minimum and maximum limits of integer
11681 types corresponding to types defined in other standard headers.
11682 2 Each instance of these macros shall be replaced by a constant expression suitable for use
11683 in #if preprocessing directives, and this expression shall have the same type as would an
11684 expression that is an object of the corresponding type converted according to the integer
11685 promotions. Its implementation-defined value shall be equal to or greater in magnitude
11686 (absolute value) than the corresponding value given below, with the same sign. An
11687 implementation shall define only the macros corresponding to those typedef names it
11688 actually provides.<sup><a href="#note263"><b>263)</b></a></sup>
11689 -- limits of ptrdiff_t
11690 PTRDIFF_MIN -65535
11691 PTRDIFF_MAX +65535
11692 -- limits of sig_atomic_t
11693 SIG_ATOMIC_MIN see below
11694 SIG_ATOMIC_MAX see below
11695 -- limit of size_t
11696 SIZE_MAX 65535
11697 -- limits of wchar_t
11698 WCHAR_MIN see below
11699 WCHAR_MAX see below
11700 -- limits of wint_t
11705 <sup><a name="note263" href="#note263"><b>263)</b></a></sup> A freestanding implementation need not provide all of these types.
11707 [<a name="p293" href="#p293">page 293</a>] (<a href="#Contents">Contents</a>)
11709 WINT_MIN see below
11710 WINT_MAX see below
11711 3 If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
11712 SIG_ATOMIC_MIN shall be no greater than -127 and the value of SIG_ATOMIC_MAX
11713 shall be no less than 127; otherwise, sig_atomic_t is defined as an unsigned integer
11714 type, and the value of SIG_ATOMIC_MIN shall be 0 and the value of
11715 SIG_ATOMIC_MAX shall be no less than 255.
11716 4 If wchar_t (see <a href="#7.19">7.19</a>) is defined as a signed integer type, the value of WCHAR_MIN
11717 shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
11718 otherwise, wchar_t is defined as an unsigned integer type, and the value of
11719 WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.<sup><a href="#note264"><b>264)</b></a></sup>
11720 5 If wint_t (see <a href="#7.29">7.29</a>) is defined as a signed integer type, the value of WINT_MIN shall
11721 be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
11722 otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
11723 shall be 0 and the value of WINT_MAX shall be no less than 65535.
11724 <a name="7.20.4" href="#7.20.4"><b> 7.20.4 Macros for integer constants</b></a>
11725 1 The following function-like macros expand to integer constants suitable for initializing
11726 objects that have integer types corresponding to types defined in <a href="#7.20">&lt;stdint.h&gt;</a>. Each
11727 macro name corresponds to a similar type name in <a href="#7.20.1.2">7.20.1.2</a> or <a href="#7.20.1.5">7.20.1.5</a>.
11728 2 The argument in any instance of these macros shall be an unsuffixed integer constant (as
11729 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.
11730 3 Each invocation of one of these macros shall expand to an integer constant expression
11731 suitable for use in #if preprocessing directives. The type of the expression shall have
11732 the same type as would an expression of the corresponding type converted according to
11733 the integer promotions. The value of the expression shall be that of the argument.
11734 <a name="7.20.4.1" href="#7.20.4.1"><b> 7.20.4.1 Macros for minimum-width integer constants</b></a>
11735 1 The macro INTN_C(value) shall expand to an integer constant expression
11736 corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
11737 to an integer constant expression corresponding to the type uint_leastN_t. For
11738 example, if uint_least64_t is a name for the type unsigned long long int,
11739 then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
11744 <sup><a name="note264" href="#note264"><b>264)</b></a></sup> The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
11745 character set.
11747 [<a name="p294" href="#p294">page 294</a>] (<a href="#Contents">Contents</a>)
11749 <a name="7.20.4.2" href="#7.20.4.2"><b> 7.20.4.2 Macros for greatest-width integer constants</b></a>
11750 1 The following macro expands to an integer constant expression having the value specified
11751 by its argument and the type intmax_t:
11752 INTMAX_C(value)
11753 The following macro expands to an integer constant expression having the value specified
11754 by its argument and the type uintmax_t:
11755 UINTMAX_C(value)
11757 [<a name="p295" href="#p295">page 295</a>] (<a href="#Contents">Contents</a>)
11759 <a name="7.21" href="#7.21"><b> 7.21 Input/output &lt;stdio.h&gt;</b></a>
11760 <a name="7.21.1" href="#7.21.1"><b> 7.21.1 Introduction</b></a>
11761 1 The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros, and declares three types and many
11762 functions for performing input and output.
11763 2 The types declared are size_t (described in <a href="#7.19">7.19</a>);
11764 FILE
11765 which is an object type capable of recording all the information needed to control a
11766 stream, including its file position indicator, a pointer to its associated buffer (if any), an
11767 error indicator that records whether a read/write error has occurred, and an end-of-file
11768 indicator that records whether the end of the file has been reached; and
11769 fpos_t
11770 which is a complete object type other than an array type capable of recording all the
11771 information needed to specify uniquely every position within a file.
11772 3 The macros are NULL (described in <a href="#7.19">7.19</a>);
11773 _IOFBF
11774 _IOLBF
11775 _IONBF
11776 which expand to integer constant expressions with distinct values, suitable for use as the
11777 third argument to the setvbuf function;
11778 BUFSIZ
11779 which expands to an integer constant expression that is the size of the buffer used by the
11780 setbuf function;
11782 which expands to an integer constant expression, with type int and a negative value, that
11783 is returned by several functions to indicate end-of-file, that is, no more input from a
11784 stream;
11785 FOPEN_MAX
11786 which expands to an integer constant expression that is the minimum number of files that
11787 the implementation guarantees can be open simultaneously;
11788 FILENAME_MAX
11789 which expands to an integer constant expression that is the size needed for an array of
11790 char large enough to hold the longest file name string that the implementation
11792 [<a name="p296" href="#p296">page 296</a>] (<a href="#Contents">Contents</a>)
11794 guarantees can be opened;<sup><a href="#note265"><b>265)</b></a></sup>
11795 L_tmpnam
11796 which expands to an integer constant expression that is the size needed for an array of
11797 char large enough to hold a temporary file name string generated by the tmpnam
11798 function;
11799 SEEK_CUR
11800 SEEK_END
11801 SEEK_SET
11802 which expand to integer constant expressions with distinct values, suitable for use as the
11803 third argument to the fseek function;
11804 TMP_MAX
11805 which expands to an integer constant expression that is the minimum number of unique
11806 file names that can be generated by the tmpnam function;
11807 stderr
11808 stdin
11809 stdout
11810 which are expressions of type ''pointer to FILE'' that point to the FILE objects
11811 associated, respectively, with the standard error, input, and output streams.
11812 4 The header <a href="#7.29">&lt;wchar.h&gt;</a> declares a number of functions useful for wide character input
11813 and output. The wide character input/output functions described in that subclause
11814 provide operations analogous to most of those described here, except that the
11815 fundamental units internal to the program are wide characters. The external
11816 representation (in the file) is a sequence of ''generalized'' multibyte characters, as
11817 described further in <a href="#7.21.3">7.21.3</a>.
11818 5 The input/output functions are given the following collective terms:
11819 -- The wide character input functions -- those functions described in <a href="#7.29">7.29</a> that perform
11820 input into wide characters and wide strings: fgetwc, fgetws, getwc, getwchar,
11821 fwscanf, wscanf, vfwscanf, and vwscanf.
11822 -- The wide character output functions -- those functions described in <a href="#7.29">7.29</a> that perform
11823 output from wide characters and wide strings: fputwc, fputws, putwc,
11824 putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
11827 <sup><a name="note265" href="#note265"><b>265)</b></a></sup> If the implementation imposes no practical limit on the length of file name strings, the value of
11828 FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
11829 string. Of course, file name string contents are subject to other system-specific constraints; therefore
11830 all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
11832 [<a name="p297" href="#p297">page 297</a>] (<a href="#Contents">Contents</a>)
11834 -- The wide character input/output functions -- the union of the ungetwc function, the
11835 wide character input functions, and the wide character output functions.
11836 -- The byte input/output functions -- those functions described in this subclause that
11837 perform input/output: fgetc, fgets, fprintf, fputc, fputs, fread,
11838 fscanf, fwrite, getc, getchar, printf, putc, putchar, puts, scanf,
11839 ungetc, vfprintf, vfscanf, vprintf, and vscanf.
11840 Forward references: files (<a href="#7.21.3">7.21.3</a>), the fseek function (<a href="#7.21.9.2">7.21.9.2</a>), streams (<a href="#7.21.2">7.21.2</a>), the
11841 tmpnam function (<a href="#7.21.4.4">7.21.4.4</a>), <a href="#7.29">&lt;wchar.h&gt;</a> (<a href="#7.29">7.29</a>).
11842 <a name="7.21.2" href="#7.21.2"><b> 7.21.2 Streams</b></a>
11843 1 Input and output, whether to or from physical devices such as terminals and tape drives,
11844 or whether to or from files supported on structured storage devices, are mapped into
11845 logical data streams, whose properties are more uniform than their various inputs and
11846 outputs. Two forms of mapping are supported, for text streams and for binary
11847 streams.<sup><a href="#note266"><b>266)</b></a></sup>
11848 2 A text stream is an ordered sequence of characters composed into lines, each line
11849 consisting of zero or more characters plus a terminating new-line character. Whether the
11850 last line requires a terminating new-line character is implementation-defined. Characters
11851 may have to be added, altered, or deleted on input and output to conform to differing
11852 conventions for representing text in the host environment. Thus, there need not be a one-
11853 to-one correspondence between the characters in a stream and those in the external
11854 representation. Data read in from a text stream will necessarily compare equal to the data
11855 that were earlier written out to that stream only if: the data consist only of printing
11856 characters and the control characters horizontal tab and new-line; no new-line character is
11857 immediately preceded by space characters; and the last character is a new-line character.
11858 Whether space characters that are written out immediately before a new-line character
11859 appear when read in is implementation-defined.
11860 3 A binary stream is an ordered sequence of characters that can transparently record
11861 internal data. Data read in from a binary stream shall compare equal to the data that were
11862 earlier written out to that stream, under the same implementation. Such a stream may,
11863 however, have an implementation-defined number of null characters appended to the end
11864 of the stream.
11865 4 Each stream has an orientation. After a stream is associated with an external file, but
11866 before any operations are performed on it, the stream is without orientation. Once a wide
11867 character input/output function has been applied to a stream without orientation, the
11870 <sup><a name="note266" href="#note266"><b>266)</b></a></sup> An implementation need not distinguish between text streams and binary streams. In such an
11871 implementation, there need be no new-line characters in a text stream nor any limit to the length of a
11872 line.
11874 [<a name="p298" href="#p298">page 298</a>] (<a href="#Contents">Contents</a>)
11876 stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
11877 been applied to a stream without orientation, the stream becomes a byte-oriented stream.
11878 Only a call to the freopen function or the fwide function can otherwise alter the
11879 orientation of a stream. (A successful call to freopen removes any orientation.)<sup><a href="#note267"><b>267)</b></a></sup>
11880 5 Byte input/output functions shall not be applied to a wide-oriented stream and wide
11881 character input/output functions shall not be applied to a byte-oriented stream. The
11882 remaining stream operations do not affect, and are not affected by, a stream's orientation,
11883 except for the following additional restrictions:
11884 -- Binary wide-oriented streams have the file-positioning restrictions ascribed to both
11885 text and binary streams.
11886 -- For wide-oriented streams, after a successful call to a file-positioning function that
11887 leaves the file position indicator prior to the end-of-file, a wide character output
11888 function can overwrite a partial multibyte character; any file contents beyond the
11889 byte(s) written are henceforth indeterminate.
11890 6 Each wide-oriented stream has an associated mbstate_t object that stores the current
11891 parse state of the stream. A successful call to fgetpos stores a representation of the
11892 value of this mbstate_t object as part of the value of the fpos_t object. A later
11893 successful call to fsetpos using the same stored fpos_t value restores the value of
11894 the associated mbstate_t object as well as the position within the controlled stream.
11895 7 Each stream has an associated lock that is used to prevent data races when multiple
11896 threads of execution access a stream, and to restrict the interleaving of stream operations
11897 performed by multiple threads. Only one thread may hold this lock at a time. The lock is
11898 reentrant: a single thread may hold the lock multiple times at a given time.
11899 8 All functions that read, write, position, or query the position of a stream lock the stream
11900 before accessing it. They release the lock associated with the stream when the access is
11901 complete.
11902 Environmental limits
11903 9 An implementation shall support text files with lines containing at least 254 characters,
11904 including the terminating new-line character. The value of the macro BUFSIZ shall be at
11905 least 256.
11906 Forward references: the freopen function (<a href="#7.21.5.4">7.21.5.4</a>), the fwide function (<a href="#7.29.3.5">7.29.3.5</a>),
11907 mbstate_t (<a href="#7.30.1">7.30.1</a>), the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>), the fsetpos function
11908 (<a href="#7.21.9.3">7.21.9.3</a>).
11913 <sup><a name="note267" href="#note267"><b>267)</b></a></sup> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
11915 [<a name="p299" href="#p299">page 299</a>] (<a href="#Contents">Contents</a>)
11917 <a name="7.21.3" href="#7.21.3"><b> 7.21.3 Files</b></a>
11918 1 A stream is associated with an external file (which may be a physical device) by opening
11919 a file, which may involve creating a new file. Creating an existing file causes its former
11920 contents to be discarded, if necessary. If a file can support positioning requests (such as a
11921 disk file, as opposed to a terminal), then a file position indicator associated with the
11922 stream is positioned at the start (character number zero) of the file, unless the file is
11923 opened with append mode in which case it is implementation-defined whether the file
11924 position indicator is initially positioned at the beginning or the end of the file. The file
11925 position indicator is maintained by subsequent reads, writes, and positioning requests, to
11926 facilitate an orderly progression through the file.
11927 2 Binary files are not truncated, except as defined in <a href="#7.21.5.3">7.21.5.3</a>. Whether a write on a text
11928 stream causes the associated file to be truncated beyond that point is implementation-
11929 defined.
11930 3 When a stream is unbuffered, characters are intended to appear from the source or at the
11931 destination as soon as possible. Otherwise characters may be accumulated and
11932 transmitted to or from the host environment as a block. When a stream is fully buffered,
11933 characters are intended to be transmitted to or from the host environment as a block when
11934 a buffer is filled. When a stream is line buffered, characters are intended to be
11935 transmitted to or from the host environment as a block when a new-line character is
11936 encountered. Furthermore, characters are intended to be transmitted as a block to the host
11937 environment when a buffer is filled, when input is requested on an unbuffered stream, or
11938 when input is requested on a line buffered stream that requires the transmission of
11939 characters from the host environment. Support for these characteristics is
11940 implementation-defined, and may be affected via the setbuf and setvbuf functions.
11941 4 A file may be disassociated from a controlling stream by closing the file. Output streams
11942 are flushed (any unwritten buffer contents are transmitted to the host environment) before
11943 the stream is disassociated from the file. The value of a pointer to a FILE object is
11944 indeterminate after the associated file is closed (including the standard text streams).
11945 Whether a file of zero length (on which no characters have been written by an output
11946 stream) actually exists is implementation-defined.
11947 5 The file may be subsequently reopened, by the same or another program execution, and
11948 its contents reclaimed or modified (if it can be repositioned at its start). If the main
11949 function returns to its original caller, or if the exit function is called, all open files are
11950 closed (hence all output streams are flushed) before program termination. Other paths to
11951 program termination, such as calling the abort function, need not close all files
11952 properly.
11953 6 The address of the FILE object used to control a stream may be significant; a copy of a
11954 FILE object need not serve in place of the original.
11956 [<a name="p300" href="#p300">page 300</a>] (<a href="#Contents">Contents</a>)
11958 7 At program startup, three text streams are predefined and need not be opened explicitly
11959 -- standard input (for reading conventional input), standard output (for writing
11960 conventional output), and standard error (for writing diagnostic output). As initially
11961 opened, the standard error stream is not fully buffered; the standard input and standard
11962 output streams are fully buffered if and only if the stream can be determined not to refer
11963 to an interactive device.
11964 8 Functions that open additional (nontemporary) files require a file name, which is a string.
11965 The rules for composing valid file names are implementation-defined. Whether the same
11966 file can be simultaneously open multiple times is also implementation-defined.
11967 9 Although both text and binary wide-oriented streams are conceptually sequences of wide
11968 characters, the external file associated with a wide-oriented stream is a sequence of
11969 multibyte characters, generalized as follows:
11970 -- Multibyte encodings within files may contain embedded null bytes (unlike multibyte
11971 encodings valid for use internal to the program).
11972 -- A file need not begin nor end in the initial shift state.<sup><a href="#note268"><b>268)</b></a></sup>
11973 10 Moreover, the encodings used for multibyte characters may differ among files. Both the
11974 nature and choice of such encodings are implementation-defined.
11975 11 The wide character input functions read multibyte characters from the stream and convert
11976 them to wide characters as if they were read by successive calls to the fgetwc function.
11977 Each conversion occurs as if by a call to the mbrtowc function, with the conversion state
11978 described by the stream's own mbstate_t object. The byte input functions read
11979 characters from the stream as if by successive calls to the fgetc function.
11980 12 The wide character output functions convert wide characters to multibyte characters and
11981 write them to the stream as if they were written by successive calls to the fputwc
11982 function. Each conversion occurs as if by a call to the wcrtomb function, with the
11983 conversion state described by the stream's own mbstate_t object. The byte output
11984 functions write characters to the stream as if by successive calls to the fputc function.
11985 13 In some cases, some of the byte input/output functions also perform conversions between
11986 multibyte characters and wide characters. These conversions also occur as if by calls to
11987 the mbrtowc and wcrtomb functions.
11988 14 An encoding error occurs if the character sequence presented to the underlying
11989 mbrtowc function does not form a valid (generalized) multibyte character, or if the code
11990 value passed to the underlying wcrtomb does not correspond to a valid (generalized)
11993 <sup><a name="note268" href="#note268"><b>268)</b></a></sup> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
11994 undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
11995 with state-dependent encoding that does not assuredly end in the initial shift state.
11997 [<a name="p301" href="#p301">page 301</a>] (<a href="#Contents">Contents</a>)
11999 multibyte character. The wide character input/output functions and the byte input/output
12000 functions store the value of the macro EILSEQ in errno if and only if an encoding error
12001 occurs.
12002 Environmental limits
12003 15 The value of FOPEN_MAX shall be at least eight, including the three standard text
12004 streams.
12005 Forward references: the exit function (<a href="#7.22.4.4">7.22.4.4</a>), the fgetc function (<a href="#7.21.7.1">7.21.7.1</a>), the
12006 fopen function (<a href="#7.21.5.3">7.21.5.3</a>), the fputc function (<a href="#7.21.7.3">7.21.7.3</a>), the setbuf function
12007 (<a href="#7.21.5.5">7.21.5.5</a>), the setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>), the fgetwc function (<a href="#7.29.3.1">7.29.3.1</a>), the
12008 fputwc function (<a href="#7.29.3.3">7.29.3.3</a>), conversion state (<a href="#7.29.6">7.29.6</a>), the mbrtowc function
12009 (<a href="#7.29.6.3.2">7.29.6.3.2</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
12010 <a name="7.21.4" href="#7.21.4"><b> 7.21.4 Operations on files</b></a>
12011 <a name="7.21.4.1" href="#7.21.4.1"><b> 7.21.4.1 The remove function</b></a>
12012 <b> Synopsis</b>
12013 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12014 int remove(const char *filename);
12015 <b> Description</b>
12016 2 The remove function causes the file whose name is the string pointed to by filename
12017 to be no longer accessible by that name. A subsequent attempt to open that file using that
12018 name will fail, unless it is created anew. If the file is open, the behavior of the remove
12019 function is implementation-defined.
12020 <b> Returns</b>
12021 3 The remove function returns zero if the operation succeeds, nonzero if it fails.
12022 <a name="7.21.4.2" href="#7.21.4.2"><b> 7.21.4.2 The rename function</b></a>
12023 <b> Synopsis</b>
12024 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12025 int rename(const char *old, const char *new);
12026 <b> Description</b>
12027 2 The rename function causes the file whose name is the string pointed to by old to be
12028 henceforth known by the name given by the string pointed to by new. The file named
12029 old is no longer accessible by that name. If a file named by the string pointed to by new
12030 exists prior to the call to the rename function, the behavior is implementation-defined.
12032 [<a name="p302" href="#p302">page 302</a>] (<a href="#Contents">Contents</a>)
12034 <b> Returns</b>
12035 3 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note269"><b>269)</b></a></sup> in
12036 which case if the file existed previously it is still known by its original name.
12037 <a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The tmpfile function</b></a>
12038 <b> Synopsis</b>
12039 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12040 FILE *tmpfile(void);
12041 <b> Description</b>
12042 2 The tmpfile function creates a temporary binary file that is different from any other
12043 existing file and that will automatically be removed when it is closed or at program
12044 termination. If the program terminates abnormally, whether an open temporary file is
12045 removed is implementation-defined. The file is opened for update with "wb+" mode.
12046 Recommended practice
12047 3 It should be possible to open at least TMP_MAX temporary files during the lifetime of the
12048 program (this limit may be shared with tmpnam) and there should be no limit on the
12049 number simultaneously open other than this limit and any limit on the number of open
12050 files (FOPEN_MAX).
12051 <b> Returns</b>
12052 4 The tmpfile function returns a pointer to the stream of the file that it created. If the file
12053 cannot be created, the tmpfile function returns a null pointer.
12054 Forward references: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
12055 <a name="7.21.4.4" href="#7.21.4.4"><b> 7.21.4.4 The tmpnam function</b></a>
12056 <b> Synopsis</b>
12057 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12058 char *tmpnam(char *s);
12059 <b> Description</b>
12060 2 The tmpnam function generates a string that is a valid file name and that is not the same
12061 as the name of an existing file.<sup><a href="#note270"><b>270)</b></a></sup> The function is potentially capable of generating at
12064 <sup><a name="note269" href="#note269"><b>269)</b></a></sup> Among the reasons the implementation may cause the rename function to fail are that the file is open
12065 or that it is necessary to copy its contents to effectuate its renaming.
12066 <sup><a name="note270" href="#note270"><b>270)</b></a></sup> Files created using strings generated by the tmpnam function are temporary only in the sense that
12067 their names should not collide with those generated by conventional naming rules for the
12068 implementation. It is still necessary to use the remove function to remove such files when their use
12069 is ended, and before program termination.
12071 [<a name="p303" href="#p303">page 303</a>] (<a href="#Contents">Contents</a>)
12073 least TMP_MAX different strings, but any or all of them may already be in use by existing
12074 files and thus not be suitable return values.
12075 3 The tmpnam function generates a different string each time it is called.
12076 4 Calls to the tmpnam function with a null pointer argument may introduce data races with
12077 each other. The implementation shall behave as if no library function calls the tmpnam
12078 function.
12079 <b> Returns</b>
12080 5 If no suitable string can be generated, the tmpnam function returns a null pointer.
12081 Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
12082 internal static object and returns a pointer to that object (subsequent calls to the tmpnam
12083 function may modify the same object). If the argument is not a null pointer, it is assumed
12084 to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
12085 in that array and returns the argument as its value.
12086 Environmental limits
12087 6 The value of the macro TMP_MAX shall be at least 25.
12088 <a name="7.21.5" href="#7.21.5"><b> 7.21.5 File access functions</b></a>
12089 <a name="7.21.5.1" href="#7.21.5.1"><b> 7.21.5.1 The fclose function</b></a>
12090 <b> Synopsis</b>
12091 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12092 int fclose(FILE *stream);
12093 <b> Description</b>
12094 2 A successful call to the fclose function causes the stream pointed to by stream to be
12095 flushed and the associated file to be closed. Any unwritten buffered data for the stream
12096 are delivered to the host environment to be written to the file; any unread buffered data
12097 are discarded. Whether or not the call succeeds, the stream is disassociated from the file
12098 and any buffer set by the setbuf or setvbuf function is disassociated from the stream
12099 (and deallocated if it was automatically allocated).
12100 <b> Returns</b>
12101 3 The fclose function returns zero if the stream was successfully closed, or EOF if any
12102 errors were detected.
12104 [<a name="p304" href="#p304">page 304</a>] (<a href="#Contents">Contents</a>)
12106 <a name="7.21.5.2" href="#7.21.5.2"><b> 7.21.5.2 The fflush function</b></a>
12107 <b> Synopsis</b>
12108 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12109 int fflush(FILE *stream);
12110 <b> Description</b>
12111 2 If stream points to an output stream or an update stream in which the most recent
12112 operation was not input, the fflush function causes any unwritten data for that stream
12113 to be delivered to the host environment to be written to the file; otherwise, the behavior is
12114 undefined.
12115 3 If stream is a null pointer, the fflush function performs this flushing action on all
12116 streams for which the behavior is defined above.
12117 <b> Returns</b>
12118 4 The fflush function sets the error indicator for the stream and returns EOF if a write
12119 error occurs, otherwise it returns zero.
12120 Forward references: the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
12121 <a name="7.21.5.3" href="#7.21.5.3"><b> 7.21.5.3 The fopen function</b></a>
12122 <b> Synopsis</b>
12123 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12124 FILE *fopen(const char * restrict filename,
12125 const char * restrict mode);
12126 <b> Description</b>
12127 2 The fopen function opens the file whose name is the string pointed to by filename,
12128 and associates a stream with it.
12129 3 The argument mode points to a string. If the string is one of the following, the file is
12130 open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note271"><b>271)</b></a></sup>
12131 r open text file for reading
12132 w truncate to zero length or create text file for writing
12133 wx create text file for writing
12134 a append; open or create text file for writing at end-of-file
12135 rb open binary file for reading
12136 wb truncate to zero length or create binary file for writing
12139 <sup><a name="note271" href="#note271"><b>271)</b></a></sup> If the string begins with one of the above sequences, the implementation might choose to ignore the
12140 remaining characters, or it might use them to select different kinds of a file (some of which might not
12141 conform to the properties in <a href="#7.21.2">7.21.2</a>).
12143 [<a name="p305" href="#p305">page 305</a>] (<a href="#Contents">Contents</a>)
12145 wbx create binary file for writing
12146 ab append; open or create binary file for writing at end-of-file
12147 r+ open text file for update (reading and writing)
12148 w+ truncate to zero length or create text file for update
12149 w+x create text file for update
12150 a+ append; open or create text file for update, writing at end-of-file
12151 r+b or rb+ open binary file for update (reading and writing)
12152 w+b or wb+ truncate to zero length or create binary file for update
12153 w+bx or wb+x create binary file for update
12154 a+b or ab+ append; open or create binary file for update, writing at end-of-file
12155 4 Opening a file with read mode ('r' as the first character in the mode argument) fails if
12156 the file does not exist or cannot be read.
12157 5 Opening a file with exclusive mode ('x' as the last character in the mode argument)
12158 fails if the file already exists or cannot be created. Otherwise, the file is created with
12159 exclusive (also known as non-shared) access to the extent that the underlying system
12160 supports exclusive access.
12161 6 Opening a file with append mode ('a' as the first character in the mode argument)
12162 causes all subsequent writes to the file to be forced to the then current end-of-file,
12163 regardless of intervening calls to the fseek function. In some implementations, opening
12164 a binary file with append mode ('b' as the second or third character in the above list of
12165 mode argument values) may initially position the file position indicator for the stream
12166 beyond the last data written, because of null character padding.
12167 7 When a file is opened with update mode ('+' as the second or third character in the
12168 above list of mode argument values), both input and output may be performed on the
12169 associated stream. However, output shall not be directly followed by input without an
12170 intervening call to the fflush function or to a file positioning function (fseek,
12171 fsetpos, or rewind), and input shall not be directly followed by output without an
12172 intervening call to a file positioning function, unless the input operation encounters end-
12173 of-file. Opening (or creating) a text file with update mode may instead open (or create) a
12174 binary stream in some implementations.
12175 8 When opened, a stream is fully buffered if and only if it can be determined not to refer to
12176 an interactive device. The error and end-of-file indicators for the stream are cleared.
12177 <b> Returns</b>
12178 9 The fopen function returns a pointer to the object controlling the stream. If the open
12179 operation fails, fopen returns a null pointer.
12180 Forward references: file positioning functions (<a href="#7.21.9">7.21.9</a>).
12182 [<a name="p306" href="#p306">page 306</a>] (<a href="#Contents">Contents</a>)
12184 <a name="7.21.5.4" href="#7.21.5.4"><b> 7.21.5.4 The freopen function</b></a>
12185 <b> Synopsis</b>
12186 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12187 FILE *freopen(const char * restrict filename,
12188 const char * restrict mode,
12189 FILE * restrict stream);
12190 <b> Description</b>
12191 2 The freopen function opens the file whose name is the string pointed to by filename
12192 and associates the stream pointed to by stream with it. The mode argument is used just
12193 as in the fopen function.<sup><a href="#note272"><b>272)</b></a></sup>
12194 3 If filename is a null pointer, the freopen function attempts to change the mode of
12195 the stream to that specified by mode, as if the name of the file currently associated with
12196 the stream had been used. It is implementation-defined which changes of mode are
12197 permitted (if any), and under what circumstances.
12198 4 The freopen function first attempts to close any file that is associated with the specified
12199 stream. Failure to close the file is ignored. The error and end-of-file indicators for the
12200 stream are cleared.
12201 <b> Returns</b>
12202 5 The freopen function returns a null pointer if the open operation fails. Otherwise,
12203 freopen returns the value of stream.
12204 <a name="7.21.5.5" href="#7.21.5.5"><b> 7.21.5.5 The setbuf function</b></a>
12205 <b> Synopsis</b>
12206 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12207 void setbuf(FILE * restrict stream,
12208 char * restrict buf);
12209 <b> Description</b>
12210 2 Except that it returns no value, the setbuf function is equivalent to the setvbuf
12211 function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
12212 is a null pointer), with the value _IONBF for mode.
12217 <sup><a name="note272" href="#note272"><b>272)</b></a></sup> The primary use of the freopen function is to change the file associated with a standard text stream
12218 (stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
12219 returned by the fopen function may be assigned.
12221 [<a name="p307" href="#p307">page 307</a>] (<a href="#Contents">Contents</a>)
12223 <b> Returns</b>
12224 3 The setbuf function returns no value.
12225 Forward references: the setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
12226 <a name="7.21.5.6" href="#7.21.5.6"><b> 7.21.5.6 The setvbuf function</b></a>
12227 <b> Synopsis</b>
12228 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12229 int setvbuf(FILE * restrict stream,
12230 char * restrict buf,
12231 int mode, size_t size);
12232 <b> Description</b>
12233 2 The setvbuf function may be used only after the stream pointed to by stream has
12234 been associated with an open file and before any other operation (other than an
12235 unsuccessful call to setvbuf) is performed on the stream. The argument mode
12236 determines how stream will be buffered, as follows: _IOFBF causes input/output to be
12237 fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
12238 input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
12239 used instead of a buffer allocated by the setvbuf function<sup><a href="#note273"><b>273)</b></a></sup> and the argument size
12240 specifies the size of the array; otherwise, size may determine the size of a buffer
12241 allocated by the setvbuf function. The contents of the array at any time are
12242 indeterminate.
12243 <b> Returns</b>
12244 3 The setvbuf function returns zero on success, or nonzero if an invalid value is given
12245 for mode or if the request cannot be honored.
12250 <sup><a name="note273" href="#note273"><b>273)</b></a></sup> The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
12251 before a buffer that has automatic storage duration is deallocated upon block exit.
12253 [<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
12255 <a name="7.21.6" href="#7.21.6"><b> 7.21.6 Formatted input/output functions</b></a>
12256 1 The formatted input/output functions shall behave as if there is a sequence point after the
12257 actions associated with each specifier.<sup><a href="#note274"><b>274)</b></a></sup>
12258 <a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The fprintf function</b></a>
12259 <b> Synopsis</b>
12260 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12261 int fprintf(FILE * restrict stream,
12262 const char * restrict format, ...);
12263 <b> Description</b>
12264 2 The fprintf function writes output to the stream pointed to by stream, under control
12265 of the string pointed to by format that specifies how subsequent arguments are
12266 converted for output. If there are insufficient arguments for the format, the behavior is
12267 undefined. If the format is exhausted while arguments remain, the excess arguments are
12268 evaluated (as always) but are otherwise ignored. The fprintf function returns when
12269 the end of the format string is encountered.
12270 3 The format shall be a multibyte character sequence, beginning and ending in its initial
12271 shift state. The format is composed of zero or more directives: ordinary multibyte
12272 characters (not %), which are copied unchanged to the output stream; and conversion
12273 specifications, each of which results in fetching zero or more subsequent arguments,
12274 converting them, if applicable, according to the corresponding conversion specifier, and
12275 then writing the result to the output stream.
12276 4 Each conversion specification is introduced by the character %. After the %, the following
12277 appear in sequence:
12278 -- Zero or more flags (in any order) that modify the meaning of the conversion
12279 specification.
12280 -- An optional minimum field width. If the converted value has fewer characters than the
12281 field width, it is padded with spaces (by default) on the left (or right, if the left
12282 adjustment flag, described later, has been given) to the field width. The field width
12283 takes the form of an asterisk * (described later) or a nonnegative decimal integer.<sup><a href="#note275"><b>275)</b></a></sup>
12284 -- An optional precision that gives the minimum number of digits to appear for the d, i,
12285 o, u, x, and X conversions, the number of digits to appear after the decimal-point
12286 character for a, A, e, E, f, and F conversions, the maximum number of significant
12287 digits for the g and G conversions, or the maximum number of bytes to be written for
12290 <sup><a name="note274" href="#note274"><b>274)</b></a></sup> The fprintf functions perform writes to memory for the %n specifier.
12291 <sup><a name="note275" href="#note275"><b>275)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
12293 [<a name="p309" href="#p309">page 309</a>] (<a href="#Contents">Contents</a>)
12295 s conversions. The precision takes the form of a period (.) followed either by an
12296 asterisk * (described later) or by an optional decimal integer; if only the period is
12297 specified, the precision is taken as zero. If a precision appears with any other
12298 conversion specifier, the behavior is undefined.
12299 -- An optional length modifier that specifies the size of the argument.
12300 -- A conversion specifier character that specifies the type of conversion to be applied.
12301 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
12302 this case, an int argument supplies the field width or precision. The arguments
12303 specifying field width, or precision, or both, shall appear (in that order) before the
12304 argument (if any) to be converted. A negative field width argument is taken as a - flag
12305 followed by a positive field width. A negative precision argument is taken as if the
12306 precision were omitted.
12307 6 The flag characters and their meanings are:
12308 - The result of the conversion is left-justified within the field. (It is right-justified if
12309 this flag is not specified.)
12310 + The result of a signed conversion always begins with a plus or minus sign. (It
12311 begins with a sign only when a negative value is converted if this flag is not
12312 specified.)<sup><a href="#note276"><b>276)</b></a></sup>
12313 space If the first character of a signed conversion is not a sign, or if a signed conversion
12314 results in no characters, a space is prefixed to the result. If the space and + flags
12315 both appear, the space flag is ignored.
12316 # The result is converted to an ''alternative form''. For o conversion, it increases
12317 the precision, if and only if necessary, to force the first digit of the result to be a
12318 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
12319 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
12320 and G conversions, the result of converting a floating-point number always
12321 contains a decimal-point character, even if no digits follow it. (Normally, a
12322 decimal-point character appears in the result of these conversions only if a digit
12323 follows it.) For g and G conversions, trailing zeros are not removed from the
12324 result. For other conversions, the behavior is undefined.
12325 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
12326 (following any indication of sign or base) are used to pad to the field width rather
12327 than performing space padding, except when converting an infinity or NaN. If the
12328 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
12331 <sup><a name="note276" href="#note276"><b>276)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
12332 include a minus sign.
12334 [<a name="p310" href="#p310">page 310</a>] (<a href="#Contents">Contents</a>)
12336 conversions, if a precision is specified, the 0 flag is ignored. For other
12337 conversions, the behavior is undefined.
12338 7 The length modifiers and their meanings are:
12339 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12340 signed char or unsigned char argument (the argument will have
12341 been promoted according to the integer promotions, but its value shall be
12342 converted to signed char or unsigned char before printing); or that
12343 a following n conversion specifier applies to a pointer to a signed char
12344 argument.
12345 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12346 short int or unsigned short int argument (the argument will
12347 have been promoted according to the integer promotions, but its value shall
12348 be converted to short int or unsigned short int before printing);
12349 or that a following n conversion specifier applies to a pointer to a short
12350 int argument.
12351 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12352 long int or unsigned long int argument; that a following n
12353 conversion specifier applies to a pointer to a long int argument; that a
12354 following c conversion specifier applies to a wint_t argument; that a
12355 following s conversion specifier applies to a pointer to a wchar_t
12356 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
12357 specifier.
12358 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12359 long long int or unsigned long long int argument; or that a
12360 following n conversion specifier applies to a pointer to a long long int
12361 argument.
12362 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
12363 an intmax_t or uintmax_t argument; or that a following n conversion
12364 specifier applies to a pointer to an intmax_t argument.
12365 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12366 size_t or the corresponding signed integer type argument; or that a
12367 following n conversion specifier applies to a pointer to a signed integer type
12368 corresponding to size_t argument.
12369 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
12370 ptrdiff_t or the corresponding unsigned integer type argument; or that a
12371 following n conversion specifier applies to a pointer to a ptrdiff_t
12372 argument.
12374 [<a name="p311" href="#p311">page 311</a>] (<a href="#Contents">Contents</a>)
12376 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
12377 applies to a long double argument.
12378 If a length modifier appears with any conversion specifier other than as specified above,
12379 the behavior is undefined.
12380 8 The conversion specifiers and their meanings are:
12381 d,i The int argument is converted to signed decimal in the style [-]dddd. The
12382 precision specifies the minimum number of digits to appear; if the value
12383 being converted can be represented in fewer digits, it is expanded with
12384 leading zeros. The default precision is 1. The result of converting a zero
12385 value with a precision of zero is no characters.
12386 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
12387 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
12388 letters abcdef are used for x conversion and the letters ABCDEF for X
12389 conversion. The precision specifies the minimum number of digits to appear;
12390 if the value being converted can be represented in fewer digits, it is expanded
12391 with leading zeros. The default precision is 1. The result of converting a
12392 zero value with a precision of zero is no characters.
12393 f,F A double argument representing a floating-point number is converted to
12394 decimal notation in the style [-]ddd.ddd, where the number of digits after
12395 the decimal-point character is equal to the precision specification. If the
12396 precision is missing, it is taken as 6; if the precision is zero and the # flag is
12397 not specified, no decimal-point character appears. If a decimal-point
12398 character appears, at least one digit appears before it. The value is rounded to
12399 the appropriate number of digits.
12400 A double argument representing an infinity is converted in one of the styles
12401 [-]inf or [-]infinity -- which style is implementation-defined. A
12402 double argument representing a NaN is converted in one of the styles
12403 [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
12404 any n-char-sequence, is implementation-defined. The F conversion specifier
12405 produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
12406 respectively.<sup><a href="#note277"><b>277)</b></a></sup>
12407 e,E A double argument representing a floating-point number is converted in the
12408 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
12409 argument is nonzero) before the decimal-point character and the number of
12410 digits after it is equal to the precision; if the precision is missing, it is taken as
12413 <sup><a name="note277" href="#note277"><b>277)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
12414 the # and 0 flag characters have no effect.
12416 [<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
12418 6; if the precision is zero and the # flag is not specified, no decimal-point
12419 character appears. The value is rounded to the appropriate number of digits.
12420 The E conversion specifier produces a number with E instead of e
12421 introducing the exponent. The exponent always contains at least two digits,
12422 and only as many more digits as necessary to represent the exponent. If the
12423 value is zero, the exponent is zero.
12424 A double argument representing an infinity or NaN is converted in the style
12425 of an f or F conversion specifier.
12426 g,G A double argument representing a floating-point number is converted in
12427 style f or e (or in style F or E in the case of a G conversion specifier),
12428 depending on the value converted and the precision. Let P equal the
12429 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
12430 Then, if a conversion with style E would have an exponent of X:
12431 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
12432 P - (X + 1).
12433 -- otherwise, the conversion is with style e (or E) and precision P - 1.
12434 Finally, unless the # flag is used, any trailing zeros are removed from the
12435 fractional portion of the result and the decimal-point character is removed if
12436 there is no fractional portion remaining.
12437 A double argument representing an infinity or NaN is converted in the style
12438 of an f or F conversion specifier.
12439 a,A A double argument representing a floating-point number is converted in the
12440 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
12441 nonzero if the argument is a normalized floating-point number and is
12442 otherwise unspecified) before the decimal-point character<sup><a href="#note278"><b>278)</b></a></sup> and the number
12443 of hexadecimal digits after it is equal to the precision; if the precision is
12444 missing and FLT_RADIX is a power of 2, then the precision is sufficient for
12445 an exact representation of the value; if the precision is missing and
12446 FLT_RADIX is not a power of 2, then the precision is sufficient to
12451 <sup><a name="note278" href="#note278"><b>278)</b></a></sup> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
12452 that subsequent digits align to nibble (4-bit) boundaries.
12454 [<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
12456 distinguish<sup><a href="#note279"><b>279)</b></a></sup> values of type double, except that trailing zeros may be
12457 omitted; if the precision is zero and the # flag is not specified, no decimal-
12458 point character appears. The letters abcdef are used for a conversion and
12459 the letters ABCDEF for A conversion. The A conversion specifier produces a
12460 number with X and P instead of x and p. The exponent always contains at
12461 least one digit, and only as many more digits as necessary to represent the
12462 decimal exponent of 2. If the value is zero, the exponent is zero.
12463 A double argument representing an infinity or NaN is converted in the style
12464 of an f or F conversion specifier.
12465 c If no l length modifier is present, the int argument is converted to an
12466 unsigned char, and the resulting character is written.
12467 If an l length modifier is present, the wint_t argument is converted as if by
12468 an ls conversion specification with no precision and an argument that points
12469 to the initial element of a two-element array of wchar_t, the first element
12470 containing the wint_t argument to the lc conversion specification and the
12471 second a null wide character.
12472 s If no l length modifier is present, the argument shall be a pointer to the initial
12473 element of an array of character type.<sup><a href="#note280"><b>280)</b></a></sup> Characters from the array are
12474 written up to (but not including) the terminating null character. If the
12475 precision is specified, no more than that many bytes are written. If the
12476 precision is not specified or is greater than the size of the array, the array shall
12477 contain a null character.
12478 If an l length modifier is present, the argument shall be a pointer to the initial
12479 element of an array of wchar_t type. Wide characters from the array are
12480 converted to multibyte characters (each as if by a call to the wcrtomb
12481 function, with the conversion state described by an mbstate_t object
12482 initialized to zero before the first wide character is converted) up to and
12483 including a terminating null wide character. The resulting multibyte
12484 characters are written up to (but not including) the terminating null character
12485 (byte). If no precision is specified, the array shall contain a null wide
12486 character. If a precision is specified, no more than that many bytes are
12487 written (including shift sequences, if any), and the array shall contain a null
12488 wide character if, to equal the multibyte character sequence length given by
12490 <sup><a name="note279" href="#note279"><b>279)</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
12491 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
12492 might suffice depending on the implementation's scheme for determining the digit to the left of the
12493 decimal-point character.
12494 <sup><a name="note280" href="#note280"><b>280)</b></a></sup> No special provisions are made for multibyte characters.
12496 [<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
12498 the precision, the function would need to access a wide character one past the
12499 end of the array. In no case is a partial multibyte character written.<sup><a href="#note281"><b>281)</b></a></sup>
12500 p The argument shall be a pointer to void. The value of the pointer is
12501 converted to a sequence of printing characters, in an implementation-defined
12502 manner.
12503 n The argument shall be a pointer to signed integer into which is written the
12504 number of characters written to the output stream so far by this call to
12505 fprintf. No argument is converted, but one is consumed. If the conversion
12506 specification includes any flags, a field width, or a precision, the behavior is
12507 undefined.
12508 % A % character is written. No argument is converted. The complete
12509 conversion specification shall be %%.
12510 9 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note282"><b>282)</b></a></sup> If any argument is
12511 not the correct type for the corresponding conversion specification, the behavior is
12512 undefined.
12513 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
12514 of a conversion is wider than the field width, the field is expanded to contain the
12515 conversion result.
12516 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
12517 to a hexadecimal floating number with the given precision.
12518 Recommended practice
12519 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
12520 representable in the given precision, the result should be one of the two adjacent numbers
12521 in hexadecimal floating style with the given precision, with the extra stipulation that the
12522 error should have a correct sign for the current rounding direction.
12523 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
12524 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note283"><b>283)</b></a></sup> If the number of
12525 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
12526 representable with DECIMAL_DIG digits, then the result should be an exact
12527 representation with trailing zeros. Otherwise, the source value is bounded by two
12528 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
12531 <sup><a name="note281" href="#note281"><b>281)</b></a></sup> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
12532 <sup><a name="note282" href="#note282"><b>282)</b></a></sup> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
12533 <sup><a name="note283" href="#note283"><b>283)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
12534 given format specifier. The number of significant digits is determined by the format specifier, and in
12535 the case of fixed-point conversion by the source value as well.
12537 [<a name="p315" href="#p315">page 315</a>] (<a href="#Contents">Contents</a>)
12539 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
12540 the error should have a correct sign for the current rounding direction.
12541 <b> Returns</b>
12542 14 The fprintf function returns the number of characters transmitted, or a negative value
12543 if an output or encoding error occurred.
12544 Environmental limits
12545 15 The number of characters that can be produced by any single conversion shall be at least
12546 4095.
12547 16 EXAMPLE 1 To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
12548 places:
12549 #include <a href="#7.12">&lt;math.h&gt;</a>
12550 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12551 /* ... */
12552 char *weekday, *month; // pointers to strings
12553 int day, hour, min;
12554 fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
12555 weekday, month, day, hour, min);
12556 fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
12558 17 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
12559 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
12560 the first of which is denoted here by a and the second by an uppercase letter.
12561 18 Given the following wide string with length seven,
12562 static wchar_t wstr[] = L" X Yabc Z W";
12563 the seven calls
12564 fprintf(stdout, "|1234567890123|\n");
12565 fprintf(stdout, "|%13ls|\n", wstr);
12566 fprintf(stdout, "|%-13.9ls|\n", wstr);
12567 fprintf(stdout, "|%13.10ls|\n", wstr);
12568 fprintf(stdout, "|%13.11ls|\n", wstr);
12569 fprintf(stdout, "|%13.15ls|\n", &amp;wstr[2]);
12570 fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
12571 will print the following seven lines:
12572 |1234567890123|
12573 | X Yabc Z W|
12574 | X Yabc Z |
12575 | X Yabc Z|
12576 | X Yabc Z W|
12577 | abc Z W|
12578 | Z|
12580 Forward references: conversion state (<a href="#7.29.6">7.29.6</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
12582 [<a name="p316" href="#p316">page 316</a>] (<a href="#Contents">Contents</a>)
12584 <a name="7.21.6.2" href="#7.21.6.2"><b> 7.21.6.2 The fscanf function</b></a>
12585 <b> Synopsis</b>
12586 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12587 int fscanf(FILE * restrict stream,
12588 const char * restrict format, ...);
12589 <b> Description</b>
12590 2 The fscanf function reads input from the stream pointed to by stream, under control
12591 of the string pointed to by format that specifies the admissible input sequences and how
12592 they are to be converted for assignment, using subsequent arguments as pointers to the
12593 objects to receive the converted input. If there are insufficient arguments for the format,
12594 the behavior is undefined. If the format is exhausted while arguments remain, the excess
12595 arguments are evaluated (as always) but are otherwise ignored.
12596 3 The format shall be a multibyte character sequence, beginning and ending in its initial
12597 shift state. The format is composed of zero or more directives: one or more white-space
12598 characters, an ordinary multibyte character (neither % nor a white-space character), or a
12599 conversion specification. Each conversion specification is introduced by the character %.
12600 After the %, the following appear in sequence:
12601 -- An optional assignment-suppressing character *.
12602 -- An optional decimal integer greater than zero that specifies the maximum field width
12603 (in characters).
12604 -- An optional length modifier that specifies the size of the receiving object.
12605 -- A conversion specifier character that specifies the type of conversion to be applied.
12606 4 The fscanf function executes each directive of the format in turn. When all directives
12607 have been executed, or if a directive fails (as detailed below), the function returns.
12608 Failures are described as input failures (due to the occurrence of an encoding error or the
12609 unavailability of input characters), or matching failures (due to inappropriate input).
12610 5 A directive composed of white-space character(s) is executed by reading input up to the
12611 first non-white-space character (which remains unread), or until no more characters can
12612 be read. The directive never fails.
12613 6 A directive that is an ordinary multibyte character is executed by reading the next
12614 characters of the stream. If any of those characters differ from the ones composing the
12615 directive, the directive fails and the differing and subsequent characters remain unread.
12616 Similarly, if end-of-file, an encoding error, or a read error prevents a character from being
12617 read, the directive fails.
12618 7 A directive that is a conversion specification defines a set of matching input sequences, as
12619 described below for each specifier. A conversion specification is executed in the
12621 [<a name="p317" href="#p317">page 317</a>] (<a href="#Contents">Contents</a>)
12623 following steps:
12624 8 Input white-space characters (as specified by the isspace function) are skipped, unless
12625 the specification includes a [, c, or n specifier.<sup><a href="#note284"><b>284)</b></a></sup>
12626 9 An input item is read from the stream, unless the specification includes an n specifier. An
12627 input item is defined as the longest sequence of input characters which does not exceed
12628 any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note285"><b>285)</b></a></sup>
12629 The first character, if any, after the input item remains unread. If the length of the input
12630 item is zero, the execution of the directive fails; this condition is a matching failure unless
12631 end-of-file, an encoding error, or a read error prevented input from the stream, in which
12632 case it is an input failure.
12633 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
12634 count of input characters) is converted to a type appropriate to the conversion specifier. If
12635 the input item is not a matching sequence, the execution of the directive fails: this
12636 condition is a matching failure. Unless assignment suppression was indicated by a *, the
12637 result of the conversion is placed in the object pointed to by the first argument following
12638 the format argument that has not already received a conversion result. If this object
12639 does not have an appropriate type, or if the result of the conversion cannot be represented
12640 in the object, the behavior is undefined.
12641 11 The length modifiers and their meanings are:
12642 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12643 to an argument with type pointer to signed char or unsigned char.
12644 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12645 to an argument with type pointer to short int or unsigned short
12646 int.
12647 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12648 to an argument with type pointer to long int or unsigned long
12649 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
12650 an argument with type pointer to double; or that a following c, s, or [
12651 conversion specifier applies to an argument with type pointer to wchar_t.
12652 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12653 to an argument with type pointer to long long int or unsigned
12654 long long int.
12658 <sup><a name="note284" href="#note284"><b>284)</b></a></sup> These white-space characters are not counted against a specified field width.
12659 <sup><a name="note285" href="#note285"><b>285)</b></a></sup> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
12660 that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
12662 [<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
12664 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12665 to an argument with type pointer to intmax_t or uintmax_t.
12666 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12667 to an argument with type pointer to size_t or the corresponding signed
12668 integer type.
12669 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
12670 to an argument with type pointer to ptrdiff_t or the corresponding
12671 unsigned integer type.
12672 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
12673 applies to an argument with type pointer to long double.
12674 If a length modifier appears with any conversion specifier other than as specified above,
12675 the behavior is undefined.
12676 12 The conversion specifiers and their meanings are:
12677 d Matches an optionally signed decimal integer, whose format is the same as
12678 expected for the subject sequence of the strtol function with the value 10
12679 for the base argument. The corresponding argument shall be a pointer to
12680 signed integer.
12681 i Matches an optionally signed integer, whose format is the same as expected
12682 for the subject sequence of the strtol function with the value 0 for the
12683 base argument. The corresponding argument shall be a pointer to signed
12684 integer.
12685 o Matches an optionally signed octal integer, whose format is the same as
12686 expected for the subject sequence of the strtoul function with the value 8
12687 for the base argument. The corresponding argument shall be a pointer to
12688 unsigned integer.
12689 u Matches an optionally signed decimal integer, whose format is the same as
12690 expected for the subject sequence of the strtoul function with the value 10
12691 for the base argument. The corresponding argument shall be a pointer to
12692 unsigned integer.
12693 x Matches an optionally signed hexadecimal integer, whose format is the same
12694 as expected for the subject sequence of the strtoul function with the value
12695 16 for the base argument. The corresponding argument shall be a pointer to
12696 unsigned integer.
12697 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
12698 format is the same as expected for the subject sequence of the strtod
12699 function. The corresponding argument shall be a pointer to floating.
12701 [<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
12703 c Matches a sequence of characters of exactly the number specified by the field
12704 width (1 if no field width is present in the directive).<sup><a href="#note286"><b>286)</b></a></sup>
12705 If no l length modifier is present, the corresponding argument shall be a
12706 pointer to the initial element of a character array large enough to accept the
12707 sequence. No null character is added.
12708 If an l length modifier is present, the input shall be a sequence of multibyte
12709 characters that begins in the initial shift state. Each multibyte character in the
12710 sequence is converted to a wide character as if by a call to the mbrtowc
12711 function, with the conversion state described by an mbstate_t object
12712 initialized to zero before the first multibyte character is converted. The
12713 corresponding argument shall be a pointer to the initial element of an array of
12714 wchar_t large enough to accept the resulting sequence of wide characters.
12715 No null wide character is added.
12716 s Matches a sequence of non-white-space characters.286)
12717 If no l length modifier is present, the corresponding argument shall be a
12718 pointer to the initial element of a character array large enough to accept the
12719 sequence and a terminating null character, which will be added automatically.
12720 If an l length modifier is present, the input shall be a sequence of multibyte
12721 characters that begins in the initial shift state. Each multibyte character is
12722 converted to a wide character as if by a call to the mbrtowc function, with
12723 the conversion state described by an mbstate_t object initialized to zero
12724 before the first multibyte character is converted. The corresponding argument
12725 shall be a pointer to the initial element of an array of wchar_t large enough
12726 to accept the sequence and the terminating null wide character, which will be
12727 added automatically.
12728 [ Matches a nonempty sequence of characters from a set of expected characters
12729 (the scanset).286)
12730 If no l length modifier is present, the corresponding argument shall be a
12731 pointer to the initial element of a character array large enough to accept the
12732 sequence and a terminating null character, which will be added automatically.
12733 If an l length modifier is present, the input shall be a sequence of multibyte
12734 characters that begins in the initial shift state. Each multibyte character is
12735 converted to a wide character as if by a call to the mbrtowc function, with
12736 the conversion state described by an mbstate_t object initialized to zero
12738 <sup><a name="note286" href="#note286"><b>286)</b></a></sup> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
12739 conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
12740 resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
12742 [<a name="p320" href="#p320">page 320</a>] (<a href="#Contents">Contents</a>)
12744 before the first multibyte character is converted. The corresponding argument
12745 shall be a pointer to the initial element of an array of wchar_t large enough
12746 to accept the sequence and the terminating null wide character, which will be
12747 added automatically.
12748 The conversion specifier includes all subsequent characters in the format
12749 string, up to and including the matching right bracket (]). The characters
12750 between the brackets (the scanlist) compose the scanset, unless the character
12751 after the left bracket is a circumflex (^), in which case the scanset contains all
12752 characters that do not appear in the scanlist between the circumflex and the
12753 right bracket. If the conversion specifier begins with [] or [^], the right
12754 bracket character is in the scanlist and the next following right bracket
12755 character is the matching right bracket that ends the specification; otherwise
12756 the first following right bracket character is the one that ends the
12757 specification. If a - character is in the scanlist and is not the first, nor the
12758 second where the first character is a ^, nor the last character, the behavior is
12759 implementation-defined.
12760 p Matches an implementation-defined set of sequences, which should be the
12761 same as the set of sequences that may be produced by the %p conversion of
12762 the fprintf function. The corresponding argument shall be a pointer to a
12763 pointer to void. The input item is converted to a pointer value in an
12764 implementation-defined manner. If the input item is a value converted earlier
12765 during the same program execution, the pointer that results shall compare
12766 equal to that value; otherwise the behavior of the %p conversion is undefined.
12767 n No input is consumed. The corresponding argument shall be a pointer to
12768 signed integer into which is to be written the number of characters read from
12769 the input stream so far by this call to the fscanf function. Execution of a
12770 %n directive does not increment the assignment count returned at the
12771 completion of execution of the fscanf function. No argument is converted,
12772 but one is consumed. If the conversion specification includes an assignment-
12773 suppressing character or a field width, the behavior is undefined.
12774 % Matches a single % character; no conversion or assignment occurs. The
12775 complete conversion specification shall be %%.
12776 13 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note287"><b>287)</b></a></sup>
12777 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
12778 respectively, a, e, f, g, and x.
12782 <sup><a name="note287" href="#note287"><b>287)</b></a></sup> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
12784 [<a name="p321" href="#p321">page 321</a>] (<a href="#Contents">Contents</a>)
12786 15 Trailing white space (including new-line characters) is left unread unless matched by a
12787 directive. The success of literal matches and suppressed assignments is not directly
12788 determinable other than via the %n directive.
12789 <b> Returns</b>
12790 16 The fscanf function returns the value of the macro EOF if an input failure occurs
12791 before the first conversion (if any) has completed. Otherwise, the function returns the
12792 number of input items assigned, which can be fewer than provided for, or even zero, in
12793 the event of an early matching failure.
12794 17 EXAMPLE 1 The call:
12795 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12796 /* ... */
12797 int n, i; float x; char name[50];
12798 n = fscanf(stdin, "%d%f%s", &amp;i, &amp;x, name);
12799 with the input line:
12800 25 54.32E-1 thompson
12801 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
12802 thompson\0.
12804 18 EXAMPLE 2 The call:
12805 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12806 /* ... */
12807 int i; float x; char name[50];
12808 fscanf(stdin, "%2d%f%*d %[0123456789]", &amp;i, &amp;x, name);
12809 with input:
12810 56789 0123 56a72
12811 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
12812 sequence 56\0. The next character read from the input stream will be a.
12814 19 EXAMPLE 3 To accept repeatedly from stdin a quantity, a unit of measure, and an item name:
12815 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12816 /* ... */
12817 int count; float quant; char units[21], item[21];
12818 do {
12819 count = fscanf(stdin, "%f%20s of %20s", &amp;quant, units, item);
12820 fscanf(stdin,"%*[^\n]");
12821 } while (!feof(stdin) &amp;&amp; !ferror(stdin));
12822 20 If the stdin stream contains the following lines:
12823 2 quarts of oil
12824 -12.8degrees Celsius
12825 lots of luck
12826 10.0LBS of
12827 dirt
12828 100ergs of energy
12830 [<a name="p322" href="#p322">page 322</a>] (<a href="#Contents">Contents</a>)
12832 the execution of the above example will be analogous to the following assignments:
12833 quant = 2; strcpy(units, "quarts"); strcpy(item, "oil");
12834 count = 3;
12835 quant = -12.8; strcpy(units, "degrees");
12836 count = 2; // "C" fails to match "o"
12837 count = 0; // "l" fails to match "%f"
12838 quant = 10.0; strcpy(units, "LBS"); strcpy(item, "dirt");
12839 count = 3;
12840 count = 0; // "100e" fails to match "%f"
12841 count = EOF;
12843 21 EXAMPLE 4 In:
12844 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12845 /* ... */
12846 int d1, d2, n1, n2, i;
12847 i = sscanf("123", "%d%n%n%d", &amp;d1, &amp;n1, &amp;n2, &amp;d2);
12848 the value 123 is assigned to d1 and the value 3 to n1. Because %n can never get an input failure, the value
12849 of 3 is also assigned to n2. The value of d2 is not affected. The value 1 is assigned to i.
12851 22 EXAMPLE 5 The call:
12852 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12853 /* ... */
12854 int n, i;
12855 n = sscanf("foo % bar 42", "foo%%bar%d", &amp;i);
12856 will assign to n the value 1 and to i the value 42 because input white-space characters are skipped for both
12857 the % and d conversion specifiers.
12859 23 EXAMPLE 6 In these examples, multibyte characters do have a state-dependent encoding, and the
12860 members of the extended character set that consist of more than one byte each consist of exactly two bytes,
12861 the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
12862 such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
12863 entry into the alternate shift state.
12864 24 After the call:
12865 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12866 /* ... */
12867 char str[50];
12868 fscanf(stdin, "a%s", str);
12869 with the input line:
12870 a(uparrow) X Y(downarrow) bc
12871 str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
12872 characters, in the more general case) appears to be a single-byte white-space character.
12873 25 In contrast, after the call:
12875 [<a name="p323" href="#p323">page 323</a>] (<a href="#Contents">Contents</a>)
12877 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12878 #include <a href="#7.19">&lt;stddef.h&gt;</a>
12879 /* ... */
12880 wchar_t wstr[50];
12881 fscanf(stdin, "a%ls", wstr);
12882 with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
12883 terminating null wide character.
12884 26 However, the call:
12885 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12886 #include <a href="#7.19">&lt;stddef.h&gt;</a>
12887 /* ... */
12888 wchar_t wstr[50];
12889 fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
12890 with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
12891 string.
12892 27 Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
12893 character Y, after the call:
12894 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12895 #include <a href="#7.19">&lt;stddef.h&gt;</a>
12896 /* ... */
12897 wchar_t wstr[50];
12898 fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
12899 with the same input line, zero will again be returned, but stdin will be left with a partially consumed
12900 multibyte character.
12902 Forward references: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>), the
12903 strtol, strtoll, strtoul, and strtoull functions (<a href="#7.22.1.4">7.22.1.4</a>), conversion state
12904 (<a href="#7.29.6">7.29.6</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
12905 <a name="7.21.6.3" href="#7.21.6.3"><b> 7.21.6.3 The printf function</b></a>
12906 <b> Synopsis</b>
12907 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12908 int printf(const char * restrict format, ...);
12909 <b> Description</b>
12910 2 The printf function is equivalent to fprintf with the argument stdout interposed
12911 before the arguments to printf.
12912 <b> Returns</b>
12913 3 The printf function returns the number of characters transmitted, or a negative value if
12914 an output or encoding error occurred.
12916 [<a name="p324" href="#p324">page 324</a>] (<a href="#Contents">Contents</a>)
12918 <a name="7.21.6.4" href="#7.21.6.4"><b> 7.21.6.4 The scanf function</b></a>
12919 <b> Synopsis</b>
12920 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12921 int scanf(const char * restrict format, ...);
12922 <b> Description</b>
12923 2 The scanf function is equivalent to fscanf with the argument stdin interposed
12924 before the arguments to scanf.
12925 <b> Returns</b>
12926 3 The scanf function returns the value of the macro EOF if an input failure occurs before
12927 the first conversion (if any) has completed. Otherwise, the scanf function returns the
12928 number of input items assigned, which can be fewer than provided for, or even zero, in
12929 the event of an early matching failure.
12930 <a name="7.21.6.5" href="#7.21.6.5"><b> 7.21.6.5 The snprintf function</b></a>
12931 <b> Synopsis</b>
12932 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12933 int snprintf(char * restrict s, size_t n,
12934 const char * restrict format, ...);
12935 <b> Description</b>
12936 2 The snprintf function is equivalent to fprintf, except that the output is written into
12937 an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
12938 and s may be a null pointer. Otherwise, output characters beyond the n-1st are
12939 discarded rather than being written to the array, and a null character is written at the end
12940 of the characters actually written into the array. If copying takes place between objects
12941 that overlap, the behavior is undefined.
12942 <b> Returns</b>
12943 3 The snprintf function returns the number of characters that would have been written
12944 had n been sufficiently large, not counting the terminating null character, or a negative
12945 value if an encoding error occurred. Thus, the null-terminated output has been
12946 completely written if and only if the returned value is nonnegative and less than n.
12947 <a name="7.21.6.6" href="#7.21.6.6"><b> 7.21.6.6 The sprintf function</b></a>
12948 <b> Synopsis</b>
12949 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12950 int sprintf(char * restrict s,
12951 const char * restrict format, ...);
12953 [<a name="p325" href="#p325">page 325</a>] (<a href="#Contents">Contents</a>)
12955 <b> Description</b>
12956 2 The sprintf function is equivalent to fprintf, except that the output is written into
12957 an array (specified by the argument s) rather than to a stream. A null character is written
12958 at the end of the characters written; it is not counted as part of the returned value. If
12959 copying takes place between objects that overlap, the behavior is undefined.
12960 <b> Returns</b>
12961 3 The sprintf function returns the number of characters written in the array, not
12962 counting the terminating null character, or a negative value if an encoding error occurred.
12963 <a name="7.21.6.7" href="#7.21.6.7"><b> 7.21.6.7 The sscanf function</b></a>
12964 <b> Synopsis</b>
12965 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12966 int sscanf(const char * restrict s,
12967 const char * restrict format, ...);
12968 <b> Description</b>
12969 2 The sscanf function is equivalent to fscanf, except that input is obtained from a
12970 string (specified by the argument s) rather than from a stream. Reaching the end of the
12971 string is equivalent to encountering end-of-file for the fscanf function. If copying
12972 takes place between objects that overlap, the behavior is undefined.
12973 <b> Returns</b>
12974 3 The sscanf function returns the value of the macro EOF if an input failure occurs
12975 before the first conversion (if any) has completed. Otherwise, the sscanf function
12976 returns the number of input items assigned, which can be fewer than provided for, or even
12977 zero, in the event of an early matching failure.
12978 <a name="7.21.6.8" href="#7.21.6.8"><b> 7.21.6.8 The vfprintf function</b></a>
12979 <b> Synopsis</b>
12980 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
12981 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12982 int vfprintf(FILE * restrict stream,
12983 const char * restrict format,
12984 va_list arg);
12985 <b> Description</b>
12986 2 The vfprintf function is equivalent to fprintf, with the variable argument list
12987 replaced by arg, which shall have been initialized by the va_start macro (and
12988 possibly subsequent va_arg calls). The vfprintf function does not invoke the
12990 [<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
12992 va_end macro.<sup><a href="#note288"><b>288)</b></a></sup>
12993 <b> Returns</b>
12994 3 The vfprintf function returns the number of characters transmitted, or a negative
12995 value if an output or encoding error occurred.
12996 4 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
12997 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
12998 #include <a href="#7.21">&lt;stdio.h&gt;</a>
12999 void error(char *function_name, char *format, ...)
13001 va_list args;
13002 va_start(args, format);
13003 // print out name of function causing error
13004 fprintf(stderr, "ERROR in %s: ", function_name);
13005 // print out remainder of message
13006 vfprintf(stderr, format, args);
13007 va_end(args);
13010 <a name="7.21.6.9" href="#7.21.6.9"><b> 7.21.6.9 The vfscanf function</b></a>
13011 <b> Synopsis</b>
13012 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13013 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13014 int vfscanf(FILE * restrict stream,
13015 const char * restrict format,
13016 va_list arg);
13017 <b> Description</b>
13018 2 The vfscanf function is equivalent to fscanf, with the variable argument list
13019 replaced by arg, which shall have been initialized by the va_start macro (and
13020 possibly subsequent va_arg calls). The vfscanf function does not invoke the
13021 va_end macro.288)
13022 <b> Returns</b>
13023 3 The vfscanf function returns the value of the macro EOF if an input failure occurs
13024 before the first conversion (if any) has completed. Otherwise, the vfscanf function
13025 returns the number of input items assigned, which can be fewer than provided for, or even
13026 zero, in the event of an early matching failure.
13030 <sup><a name="note288" href="#note288"><b>288)</b></a></sup> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
13031 vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
13033 [<a name="p327" href="#p327">page 327</a>] (<a href="#Contents">Contents</a>)
13035 <a name="7.21.6.10" href="#7.21.6.10"><b> 7.21.6.10 The vprintf function</b></a>
13036 <b> Synopsis</b>
13037 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13038 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13039 int vprintf(const char * restrict format,
13040 va_list arg);
13041 <b> Description</b>
13042 2 The vprintf function is equivalent to printf, with the variable argument list
13043 replaced by arg, which shall have been initialized by the va_start macro (and
13044 possibly subsequent va_arg calls). The vprintf function does not invoke the
13045 va_end macro.288)
13046 <b> Returns</b>
13047 3 The vprintf function returns the number of characters transmitted, or a negative value
13048 if an output or encoding error occurred.
13049 <a name="7.21.6.11" href="#7.21.6.11"><b> 7.21.6.11 The vscanf function</b></a>
13050 <b> Synopsis</b>
13051 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13052 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13053 int vscanf(const char * restrict format,
13054 va_list arg);
13055 <b> Description</b>
13056 2 The vscanf function is equivalent to scanf, with the variable argument list replaced
13057 by arg, which shall have been initialized by the va_start macro (and possibly
13058 subsequent va_arg calls). The vscanf function does not invoke the va_end
13059 macro.288)
13060 <b> Returns</b>
13061 3 The vscanf function returns the value of the macro EOF if an input failure occurs
13062 before the first conversion (if any) has completed. Otherwise, the vscanf function
13063 returns the number of input items assigned, which can be fewer than provided for, or even
13064 zero, in the event of an early matching failure.
13066 [<a name="p328" href="#p328">page 328</a>] (<a href="#Contents">Contents</a>)
13068 <a name="7.21.6.12" href="#7.21.6.12"><b> 7.21.6.12 The vsnprintf function</b></a>
13069 <b> Synopsis</b>
13070 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13071 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13072 int vsnprintf(char * restrict s, size_t n,
13073 const char * restrict format,
13074 va_list arg);
13075 <b> Description</b>
13076 2 The vsnprintf function is equivalent to snprintf, with the variable argument list
13077 replaced by arg, which shall have been initialized by the va_start macro (and
13078 possibly subsequent va_arg calls). The vsnprintf function does not invoke the
13079 va_end macro.288) If copying takes place between objects that overlap, the behavior is
13080 undefined.
13081 <b> Returns</b>
13082 3 The vsnprintf function returns the number of characters that would have been written
13083 had n been sufficiently large, not counting the terminating null character, or a negative
13084 value if an encoding error occurred. Thus, the null-terminated output has been
13085 completely written if and only if the returned value is nonnegative and less than n.
13086 <a name="7.21.6.13" href="#7.21.6.13"><b> 7.21.6.13 The vsprintf function</b></a>
13087 <b> Synopsis</b>
13088 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13089 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13090 int vsprintf(char * restrict s,
13091 const char * restrict format,
13092 va_list arg);
13093 <b> Description</b>
13094 2 The vsprintf function is equivalent to sprintf, with the variable argument list
13095 replaced by arg, which shall have been initialized by the va_start macro (and
13096 possibly subsequent va_arg calls). The vsprintf function does not invoke the
13097 va_end macro.288) If copying takes place between objects that overlap, the behavior is
13098 undefined.
13099 <b> Returns</b>
13100 3 The vsprintf function returns the number of characters written in the array, not
13101 counting the terminating null character, or a negative value if an encoding error occurred.
13103 [<a name="p329" href="#p329">page 329</a>] (<a href="#Contents">Contents</a>)
13105 <a name="7.21.6.14" href="#7.21.6.14"><b> 7.21.6.14 The vsscanf function</b></a>
13106 <b> Synopsis</b>
13107 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
13108 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13109 int vsscanf(const char * restrict s,
13110 const char * restrict format,
13111 va_list arg);
13112 <b> Description</b>
13113 2 The vsscanf function is equivalent to sscanf, with the variable argument list
13114 replaced by arg, which shall have been initialized by the va_start macro (and
13115 possibly subsequent va_arg calls). The vsscanf function does not invoke the
13116 va_end macro.288)
13117 <b> Returns</b>
13118 3 The vsscanf function returns the value of the macro EOF if an input failure occurs
13119 before the first conversion (if any) has completed. Otherwise, the vsscanf function
13120 returns the number of input items assigned, which can be fewer than provided for, or even
13121 zero, in the event of an early matching failure.
13122 <a name="7.21.7" href="#7.21.7"><b> 7.21.7 Character input/output functions</b></a>
13123 <a name="7.21.7.1" href="#7.21.7.1"><b> 7.21.7.1 The fgetc function</b></a>
13124 <b> Synopsis</b>
13125 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13126 int fgetc(FILE *stream);
13127 <b> Description</b>
13128 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
13129 next character is present, the fgetc function obtains that character as an unsigned
13130 char converted to an int and advances the associated file position indicator for the
13131 stream (if defined).
13132 <b> Returns</b>
13133 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
13134 of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
13135 fgetc function returns the next character from the input stream pointed to by stream.
13136 If a read error occurs, the error indicator for the stream is set and the fgetc function
13137 returns EOF.<sup><a href="#note289"><b>289)</b></a></sup>
13140 <sup><a name="note289" href="#note289"><b>289)</b></a></sup> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
13142 [<a name="p330" href="#p330">page 330</a>] (<a href="#Contents">Contents</a>)
13144 <a name="7.21.7.2" href="#7.21.7.2"><b> 7.21.7.2 The fgets function</b></a>
13145 <b> Synopsis</b>
13146 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13147 char *fgets(char * restrict s, int n,
13148 FILE * restrict stream);
13149 <b> Description</b>
13150 2 The fgets function reads at most one less than the number of characters specified by n
13151 from the stream pointed to by stream into the array pointed to by s. No additional
13152 characters are read after a new-line character (which is retained) or after end-of-file. A
13153 null character is written immediately after the last character read into the array.
13154 <b> Returns</b>
13155 3 The fgets function returns s if successful. If end-of-file is encountered and no
13156 characters have been read into the array, the contents of the array remain unchanged and a
13157 null pointer is returned. If a read error occurs during the operation, the array contents are
13158 indeterminate and a null pointer is returned.
13159 <a name="7.21.7.3" href="#7.21.7.3"><b> 7.21.7.3 The fputc function</b></a>
13160 <b> Synopsis</b>
13161 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13162 int fputc(int c, FILE *stream);
13163 <b> Description</b>
13164 2 The fputc function writes the character specified by c (converted to an unsigned
13165 char) to the output stream pointed to by stream, at the position indicated by the
13166 associated file position indicator for the stream (if defined), and advances the indicator
13167 appropriately. If the file cannot support positioning requests, or if the stream was opened
13168 with append mode, the character is appended to the output stream.
13169 <b> Returns</b>
13170 3 The fputc function returns the character written. If a write error occurs, the error
13171 indicator for the stream is set and fputc returns EOF.
13172 <a name="7.21.7.4" href="#7.21.7.4"><b> 7.21.7.4 The fputs function</b></a>
13173 <b> Synopsis</b>
13174 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13175 int fputs(const char * restrict s,
13176 FILE * restrict stream);
13178 [<a name="p331" href="#p331">page 331</a>] (<a href="#Contents">Contents</a>)
13180 <b> Description</b>
13181 2 The fputs function writes the string pointed to by s to the stream pointed to by
13182 stream. The terminating null character is not written.
13183 <b> Returns</b>
13184 3 The fputs function returns EOF if a write error occurs; otherwise it returns a
13185 nonnegative value.
13186 <a name="7.21.7.5" href="#7.21.7.5"><b> 7.21.7.5 The getc function</b></a>
13187 <b> Synopsis</b>
13188 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13189 int getc(FILE *stream);
13190 <b> Description</b>
13191 2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
13192 may evaluate stream more than once, so the argument should never be an expression
13193 with side effects.
13194 <b> Returns</b>
13195 3 The getc function returns the next character from the input stream pointed to by
13196 stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
13197 getc returns EOF. If a read error occurs, the error indicator for the stream is set and
13198 getc returns EOF.
13199 <a name="7.21.7.6" href="#7.21.7.6"><b> 7.21.7.6 The getchar function</b></a>
13200 <b> Synopsis</b>
13201 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13202 int getchar(void);
13203 <b> Description</b>
13204 2 The getchar function is equivalent to getc with the argument stdin.
13205 <b> Returns</b>
13206 3 The getchar function returns the next character from the input stream pointed to by
13207 stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
13208 getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
13209 getchar returns EOF.
13211 [<a name="p332" href="#p332">page 332</a>] (<a href="#Contents">Contents</a>)
13213 <a name="7.21.7.7" href="#7.21.7.7"><b> 7.21.7.7 The putc function</b></a>
13214 <b> Synopsis</b>
13215 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13216 int putc(int c, FILE *stream);
13217 <b> Description</b>
13218 2 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
13219 may evaluate stream more than once, so that argument should never be an expression
13220 with side effects.
13221 <b> Returns</b>
13222 3 The putc function returns the character written. If a write error occurs, the error
13223 indicator for the stream is set and putc returns EOF.
13224 <a name="7.21.7.8" href="#7.21.7.8"><b> 7.21.7.8 The putchar function</b></a>
13225 <b> Synopsis</b>
13226 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13227 int putchar(int c);
13228 <b> Description</b>
13229 2 The putchar function is equivalent to putc with the second argument stdout.
13230 <b> Returns</b>
13231 3 The putchar function returns the character written. If a write error occurs, the error
13232 indicator for the stream is set and putchar returns EOF.
13233 <a name="7.21.7.9" href="#7.21.7.9"><b> 7.21.7.9 The puts function</b></a>
13234 <b> Synopsis</b>
13235 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13236 int puts(const char *s);
13237 <b> Description</b>
13238 2 The puts function writes the string pointed to by s to the stream pointed to by stdout,
13239 and appends a new-line character to the output. The terminating null character is not
13240 written.
13241 <b> Returns</b>
13242 3 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
13243 value.
13245 [<a name="p333" href="#p333">page 333</a>] (<a href="#Contents">Contents</a>)
13247 <a name="7.21.7.10" href="#7.21.7.10"><b> 7.21.7.10 The ungetc function</b></a>
13248 <b> Synopsis</b>
13249 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13250 int ungetc(int c, FILE *stream);
13251 <b> Description</b>
13252 2 The ungetc function pushes the character specified by c (converted to an unsigned
13253 char) back onto the input stream pointed to by stream. Pushed-back characters will be
13254 returned by subsequent reads on that stream in the reverse order of their pushing. A
13255 successful intervening call (with the stream pointed to by stream) to a file positioning
13256 function (fseek, fsetpos, or rewind) discards any pushed-back characters for the
13257 stream. The external storage corresponding to the stream is unchanged.
13258 3 One character of pushback is guaranteed. If the ungetc function is called too many
13259 times on the same stream without an intervening read or file positioning operation on that
13260 stream, the operation may fail.
13261 4 If the value of c equals that of the macro EOF, the operation fails and the input stream is
13262 unchanged.
13263 5 A successful call to the ungetc function clears the end-of-file indicator for the stream.
13264 The value of the file position indicator for the stream after reading or discarding all
13265 pushed-back characters shall be the same as it was before the characters were pushed
13266 back. For a text stream, the value of its file position indicator after a successful call to the
13267 ungetc function is unspecified until all pushed-back characters are read or discarded.
13268 For a binary stream, its file position indicator is decremented by each successful call to
13269 the ungetc function; if its value was zero before a call, it is indeterminate after the
13270 call.<sup><a href="#note290"><b>290)</b></a></sup>
13271 <b> Returns</b>
13272 6 The ungetc function returns the character pushed back after conversion, or EOF if the
13273 operation fails.
13274 Forward references: file positioning functions (<a href="#7.21.9">7.21.9</a>).
13279 <sup><a name="note290" href="#note290"><b>290)</b></a></sup> See ''future library directions'' (<a href="#7.31.11">7.31.11</a>).
13281 [<a name="p334" href="#p334">page 334</a>] (<a href="#Contents">Contents</a>)
13283 <a name="7.21.8" href="#7.21.8"><b> 7.21.8 Direct input/output functions</b></a>
13284 <a name="7.21.8.1" href="#7.21.8.1"><b> 7.21.8.1 The fread function</b></a>
13285 <b> Synopsis</b>
13286 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13287 size_t fread(void * restrict ptr,
13288 size_t size, size_t nmemb,
13289 FILE * restrict stream);
13290 <b> Description</b>
13291 2 The fread function reads, into the array pointed to by ptr, up to nmemb elements
13292 whose size is specified by size, from the stream pointed to by stream. For each
13293 object, size calls are made to the fgetc function and the results stored, in the order
13294 read, in an array of unsigned char exactly overlaying the object. The file position
13295 indicator for the stream (if defined) is advanced by the number of characters successfully
13296 read. If an error occurs, the resulting value of the file position indicator for the stream is
13297 indeterminate. If a partial element is read, its value is indeterminate.
13298 <b> Returns</b>
13299 3 The fread function returns the number of elements successfully read, which may be
13300 less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
13301 fread returns zero and the contents of the array and the state of the stream remain
13302 unchanged.
13303 <a name="7.21.8.2" href="#7.21.8.2"><b> 7.21.8.2 The fwrite function</b></a>
13304 <b> Synopsis</b>
13305 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13306 size_t fwrite(const void * restrict ptr,
13307 size_t size, size_t nmemb,
13308 FILE * restrict stream);
13309 <b> Description</b>
13310 2 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
13311 whose size is specified by size, to the stream pointed to by stream. For each object,
13312 size calls are made to the fputc function, taking the values (in order) from an array of
13313 unsigned char exactly overlaying the object. The file position indicator for the
13314 stream (if defined) is advanced by the number of characters successfully written. If an
13315 error occurs, the resulting value of the file position indicator for the stream is
13316 indeterminate.
13318 [<a name="p335" href="#p335">page 335</a>] (<a href="#Contents">Contents</a>)
13320 <b> Returns</b>
13321 3 The fwrite function returns the number of elements successfully written, which will be
13322 less than nmemb only if a write error is encountered. If size or nmemb is zero,
13323 fwrite returns zero and the state of the stream remains unchanged.
13324 <a name="7.21.9" href="#7.21.9"><b> 7.21.9 File positioning functions</b></a>
13325 <a name="7.21.9.1" href="#7.21.9.1"><b> 7.21.9.1 The fgetpos function</b></a>
13326 <b> Synopsis</b>
13327 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13328 int fgetpos(FILE * restrict stream,
13329 fpos_t * restrict pos);
13330 <b> Description</b>
13331 2 The fgetpos function stores the current values of the parse state (if any) and file
13332 position indicator for the stream pointed to by stream in the object pointed to by pos.
13333 The values stored contain unspecified information usable by the fsetpos function for
13334 repositioning the stream to its position at the time of the call to the fgetpos function.
13335 <b> Returns</b>
13336 3 If successful, the fgetpos function returns zero; on failure, the fgetpos function
13337 returns nonzero and stores an implementation-defined positive value in errno.
13338 Forward references: the fsetpos function (<a href="#7.21.9.3">7.21.9.3</a>).
13339 <a name="7.21.9.2" href="#7.21.9.2"><b> 7.21.9.2 The fseek function</b></a>
13340 <b> Synopsis</b>
13341 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13342 int fseek(FILE *stream, long int offset, int whence);
13343 <b> Description</b>
13344 2 The fseek function sets the file position indicator for the stream pointed to by stream.
13345 If a read or write error occurs, the error indicator for the stream is set and fseek fails.
13346 3 For a binary stream, the new position, measured in characters from the beginning of the
13347 file, is obtained by adding offset to the position specified by whence. The specified
13348 position is the beginning of the file if whence is SEEK_SET, the current value of the file
13349 position indicator if SEEK_CUR, or end-of-file if SEEK_END. A binary stream need not
13350 meaningfully support fseek calls with a whence value of SEEK_END.
13351 4 For a text stream, either offset shall be zero, or offset shall be a value returned by
13352 an earlier successful call to the ftell function on a stream associated with the same file
13353 and whence shall be SEEK_SET.
13355 [<a name="p336" href="#p336">page 336</a>] (<a href="#Contents">Contents</a>)
13357 5 After determining the new position, a successful call to the fseek function undoes any
13358 effects of the ungetc function on the stream, clears the end-of-file indicator for the
13359 stream, and then establishes the new position. After a successful fseek call, the next
13360 operation on an update stream may be either input or output.
13361 <b> Returns</b>
13362 6 The fseek function returns nonzero only for a request that cannot be satisfied.
13363 Forward references: the ftell function (<a href="#7.21.9.4">7.21.9.4</a>).
13364 <a name="7.21.9.3" href="#7.21.9.3"><b> 7.21.9.3 The fsetpos function</b></a>
13365 <b> Synopsis</b>
13366 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13367 int fsetpos(FILE *stream, const fpos_t *pos);
13368 <b> Description</b>
13369 2 The fsetpos function sets the mbstate_t object (if any) and file position indicator
13370 for the stream pointed to by stream according to the value of the object pointed to by
13371 pos, which shall be a value obtained from an earlier successful call to the fgetpos
13372 function on a stream associated with the same file. If a read or write error occurs, the
13373 error indicator for the stream is set and fsetpos fails.
13374 3 A successful call to the fsetpos function undoes any effects of the ungetc function
13375 on the stream, clears the end-of-file indicator for the stream, and then establishes the new
13376 parse state and position. After a successful fsetpos call, the next operation on an
13377 update stream may be either input or output.
13378 <b> Returns</b>
13379 4 If successful, the fsetpos function returns zero; on failure, the fsetpos function
13380 returns nonzero and stores an implementation-defined positive value in errno.
13381 <a name="7.21.9.4" href="#7.21.9.4"><b> 7.21.9.4 The ftell function</b></a>
13382 <b> Synopsis</b>
13383 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13384 long int ftell(FILE *stream);
13385 <b> Description</b>
13386 2 The ftell function obtains the current value of the file position indicator for the stream
13387 pointed to by stream. For a binary stream, the value is the number of characters from
13388 the beginning of the file. For a text stream, its file position indicator contains unspecified
13389 information, usable by the fseek function for returning the file position indicator for the
13390 stream to its position at the time of the ftell call; the difference between two such
13391 return values is not necessarily a meaningful measure of the number of characters written
13393 [<a name="p337" href="#p337">page 337</a>] (<a href="#Contents">Contents</a>)
13395 or read.
13396 <b> Returns</b>
13397 3 If successful, the ftell function returns the current value of the file position indicator
13398 for the stream. On failure, the ftell function returns -1L and stores an
13399 implementation-defined positive value in errno.
13400 <a name="7.21.9.5" href="#7.21.9.5"><b> 7.21.9.5 The rewind function</b></a>
13401 <b> Synopsis</b>
13402 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13403 void rewind(FILE *stream);
13404 <b> Description</b>
13405 2 The rewind function sets the file position indicator for the stream pointed to by
13406 stream to the beginning of the file. It is equivalent to
13407 (void)fseek(stream, 0L, SEEK_SET)
13408 except that the error indicator for the stream is also cleared.
13409 <b> Returns</b>
13410 3 The rewind function returns no value.
13411 <a name="7.21.10" href="#7.21.10"><b> 7.21.10 Error-handling functions</b></a>
13412 <a name="7.21.10.1" href="#7.21.10.1"><b> 7.21.10.1 The clearerr function</b></a>
13413 <b> Synopsis</b>
13414 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13415 void clearerr(FILE *stream);
13416 <b> Description</b>
13417 2 The clearerr function clears the end-of-file and error indicators for the stream pointed
13418 to by stream.
13419 <b> Returns</b>
13420 3 The clearerr function returns no value.
13422 [<a name="p338" href="#p338">page 338</a>] (<a href="#Contents">Contents</a>)
13424 <a name="7.21.10.2" href="#7.21.10.2"><b> 7.21.10.2 The feof function</b></a>
13425 <b> Synopsis</b>
13426 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13427 int feof(FILE *stream);
13428 <b> Description</b>
13429 2 The feof function tests the end-of-file indicator for the stream pointed to by stream.
13430 <b> Returns</b>
13431 3 The feof function returns nonzero if and only if the end-of-file indicator is set for
13432 stream.
13433 <a name="7.21.10.3" href="#7.21.10.3"><b> 7.21.10.3 The ferror function</b></a>
13434 <b> Synopsis</b>
13435 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13436 int ferror(FILE *stream);
13437 <b> Description</b>
13438 2 The ferror function tests the error indicator for the stream pointed to by stream.
13439 <b> Returns</b>
13440 3 The ferror function returns nonzero if and only if the error indicator is set for
13441 stream.
13442 <a name="7.21.10.4" href="#7.21.10.4"><b> 7.21.10.4 The perror function</b></a>
13443 <b> Synopsis</b>
13444 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
13445 void perror(const char *s);
13446 <b> Description</b>
13447 2 The perror function maps the error number in the integer expression errno to an
13448 error message. It writes a sequence of characters to the standard error stream thus: first
13449 (if s is not a null pointer and the character pointed to by s is not the null character), the
13450 string pointed to by s followed by a colon (:) and a space; then an appropriate error
13451 message string followed by a new-line character. The contents of the error message
13452 strings are the same as those returned by the strerror function with argument errno.
13453 <b> Returns</b>
13454 3 The perror function returns no value.
13455 Forward references: the strerror function (<a href="#7.24.6.2">7.24.6.2</a>).
13457 [<a name="p339" href="#p339">page 339</a>] (<a href="#Contents">Contents</a>)
13459 <a name="7.22" href="#7.22"><b> 7.22 General utilities &lt;stdlib.h&gt;</b></a>
13460 1 The header <a href="#7.22">&lt;stdlib.h&gt;</a> declares five types and several functions of general utility, and
13461 defines several macros.<sup><a href="#note291"><b>291)</b></a></sup>
13462 2 The types declared are size_t and wchar_t (both described in <a href="#7.19">7.19</a>),
13463 div_t
13464 which is a structure type that is the type of the value returned by the div function,
13465 ldiv_t
13466 which is a structure type that is the type of the value returned by the ldiv function, and
13467 lldiv_t
13468 which is a structure type that is the type of the value returned by the lldiv function.
13469 3 The macros defined are NULL (described in <a href="#7.19">7.19</a>);
13470 EXIT_FAILURE
13472 EXIT_SUCCESS
13473 which expand to integer constant expressions that can be used as the argument to the
13474 exit function to return unsuccessful or successful termination status, respectively, to the
13475 host environment;
13476 RAND_MAX
13477 which expands to an integer constant expression that is the maximum value returned by
13478 the rand function; and
13479 MB_CUR_MAX
13480 which expands to a positive integer expression with type size_t that is the maximum
13481 number of bytes in a multibyte character for the extended character set specified by the
13482 current locale (category LC_CTYPE), which is never greater than MB_LEN_MAX.
13487 <sup><a name="note291" href="#note291"><b>291)</b></a></sup> See ''future library directions'' (<a href="#7.31.12">7.31.12</a>).
13489 [<a name="p340" href="#p340">page 340</a>] (<a href="#Contents">Contents</a>)
13491 <a name="7.22.1" href="#7.22.1"><b> 7.22.1 Numeric conversion functions</b></a>
13492 1 The functions atof, atoi, atol, and atoll need not affect the value of the integer
13493 expression errno on an error. If the value of the result cannot be represented, the
13494 behavior is undefined.
13495 <a name="7.22.1.1" href="#7.22.1.1"><b> 7.22.1.1 The atof function</b></a>
13496 <b> Synopsis</b>
13497 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13498 double atof(const char *nptr);
13499 <b> Description</b>
13500 2 The atof function converts the initial portion of the string pointed to by nptr to
13501 double representation. Except for the behavior on error, it is equivalent to
13502 strtod(nptr, (char **)NULL)
13503 <b> Returns</b>
13504 3 The atof function returns the converted value.
13505 Forward references: the strtod, strtof, and strtold functions (<a href="#7.22.1.3">7.22.1.3</a>).
13506 <a name="7.22.1.2" href="#7.22.1.2"><b> 7.22.1.2 The atoi, atol, and atoll functions</b></a>
13507 <b> Synopsis</b>
13508 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13509 int atoi(const char *nptr);
13510 long int atol(const char *nptr);
13511 long long int atoll(const char *nptr);
13512 <b> Description</b>
13513 2 The atoi, atol, and atoll functions convert the initial portion of the string pointed
13514 to by nptr to int, long int, and long long int representation, respectively.
13515 Except for the behavior on error, they are equivalent to
13516 atoi: (int)strtol(nptr, (char **)NULL, 10)
13517 atol: strtol(nptr, (char **)NULL, 10)
13518 atoll: strtoll(nptr, (char **)NULL, 10)
13519 <b> Returns</b>
13520 3 The atoi, atol, and atoll functions return the converted value.
13521 Forward references: the strtol, strtoll, strtoul, and strtoull functions
13522 (<a href="#7.22.1.4">7.22.1.4</a>).
13524 [<a name="p341" href="#p341">page 341</a>] (<a href="#Contents">Contents</a>)
13526 <a name="7.22.1.3" href="#7.22.1.3"><b> 7.22.1.3 The strtod, strtof, and strtold functions</b></a>
13527 <b> Synopsis</b>
13528 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13529 double strtod(const char * restrict nptr,
13530 char ** restrict endptr);
13531 float strtof(const char * restrict nptr,
13532 char ** restrict endptr);
13533 long double strtold(const char * restrict nptr,
13534 char ** restrict endptr);
13535 <b> Description</b>
13536 2 The strtod, strtof, and strtold functions convert the initial portion of the string
13537 pointed to by nptr to double, float, and long double representation,
13538 respectively. First, they decompose the input string into three parts: an initial, possibly
13539 empty, sequence of white-space characters (as specified by the isspace function), a
13540 subject sequence resembling a floating-point constant or representing an infinity or NaN;
13541 and a final string of one or more unrecognized characters, including the terminating null
13542 character of the input string. Then, they attempt to convert the subject sequence to a
13543 floating-point number, and return the result.
13544 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
13545 the following:
13546 -- a nonempty sequence of decimal digits optionally containing a decimal-point
13547 character, then an optional exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
13548 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
13549 decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
13550 -- INF or INFINITY, ignoring case
13551 -- NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
13552 n-char-sequence:
13553 digit
13554 nondigit
13555 n-char-sequence digit
13556 n-char-sequence nondigit
13557 The subject sequence is defined as the longest initial subsequence of the input string,
13558 starting with the first non-white-space character, that is of the expected form. The subject
13559 sequence contains no characters if the input string is not of the expected form.
13560 4 If the subject sequence has the expected form for a floating-point number, the sequence of
13561 characters starting with the first digit or the decimal-point character (whichever occurs
13562 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
13564 [<a name="p342" href="#p342">page 342</a>] (<a href="#Contents">Contents</a>)
13566 decimal-point character is used in place of a period, and that if neither an exponent part
13567 nor a decimal-point character appears in a decimal floating point number, or if a binary
13568 exponent part does not appear in a hexadecimal floating point number, an exponent part
13569 of the appropriate type with value zero is assumed to follow the last digit in the string. If
13570 the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note292"><b>292)</b></a></sup>
13571 A character sequence INF or INFINITY is interpreted as an infinity, if representable in
13572 the return type, else like a floating constant that is too large for the range of the return
13573 type. A character sequence NAN or NAN(n-char-sequenceopt) is interpreted as a quiet
13574 NaN, if supported in the return type, else like a subject sequence part that does not have
13575 the expected form; the meaning of the n-char sequence is implementation-defined.<sup><a href="#note293"><b>293)</b></a></sup> A
13576 pointer to the final string is stored in the object pointed to by endptr, provided that
13577 endptr is not a null pointer.
13578 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
13579 value resulting from the conversion is correctly rounded.
13580 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
13581 accepted.
13582 7 If the subject sequence is empty or does not have the expected form, no conversion is
13583 performed; the value of nptr is stored in the object pointed to by endptr, provided
13584 that endptr is not a null pointer.
13585 Recommended practice
13586 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
13587 the result is not exactly representable, the result should be one of the two numbers in the
13588 appropriate internal format that are adjacent to the hexadecimal floating source value,
13589 with the extra stipulation that the error should have a correct sign for the current rounding
13590 direction.
13591 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
13592 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
13593 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
13594 consider the two bounding, adjacent decimal strings L and U, both having
13595 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
13596 The result should be one of the (equal or adjacent) values that would be obtained by
13597 correctly rounding L and U according to the current rounding direction, with the extra
13599 <sup><a name="note292" href="#note292"><b>292)</b></a></sup> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
13600 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
13601 methods may yield different results if rounding is toward positive or negative infinity. In either case,
13602 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
13603 <sup><a name="note293" href="#note293"><b>293)</b></a></sup> An implementation may use the n-char sequence to determine extra information to be represented in
13604 the NaN's significand.
13606 [<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
13608 stipulation that the error with respect to D should have a correct sign for the current
13609 rounding direction.<sup><a href="#note294"><b>294)</b></a></sup>
13610 <b> Returns</b>
13611 10 The functions return the converted value, if any. If no conversion could be performed,
13612 zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
13613 plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
13614 return type and sign of the value), and the value of the macro ERANGE is stored in
13615 errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
13616 no greater than the smallest normalized positive number in the return type; whether
13617 errno acquires the value ERANGE is implementation-defined.
13618 <a name="7.22.1.4" href="#7.22.1.4"><b> 7.22.1.4 The strtol, strtoll, strtoul, and strtoull functions</b></a>
13619 <b> Synopsis</b>
13620 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13621 long int strtol(
13622 const char * restrict nptr,
13623 char ** restrict endptr,
13624 int base);
13625 long long int strtoll(
13626 const char * restrict nptr,
13627 char ** restrict endptr,
13628 int base);
13629 unsigned long int strtoul(
13630 const char * restrict nptr,
13631 char ** restrict endptr,
13632 int base);
13633 unsigned long long int strtoull(
13634 const char * restrict nptr,
13635 char ** restrict endptr,
13636 int base);
13637 <b> Description</b>
13638 2 The strtol, strtoll, strtoul, and strtoull functions convert the initial
13639 portion of the string pointed to by nptr to long int, long long int, unsigned
13640 long int, and unsigned long long int representation, respectively. First,
13641 they decompose the input string into three parts: an initial, possibly empty, sequence of
13642 white-space characters (as specified by the isspace function), a subject sequence
13645 <sup><a name="note294" href="#note294"><b>294)</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
13646 to the same internal floating value, but if not will round to adjacent values.
13648 [<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
13650 resembling an integer represented in some radix determined by the value of base, and a
13651 final string of one or more unrecognized characters, including the terminating null
13652 character of the input string. Then, they attempt to convert the subject sequence to an
13653 integer, and return the result.
13654 3 If the value of base is zero, the expected form of the subject sequence is that of an
13655 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
13656 not including an integer suffix. If the value of base is between 2 and 36 (inclusive), the
13657 expected form of the subject sequence is a sequence of letters and digits representing an
13658 integer with the radix specified by base, optionally preceded by a plus or minus sign,
13659 but not including an integer suffix. The letters from a (or A) through z (or Z) are
13660 ascribed the values 10 through 35; only letters and digits whose ascribed values are less
13661 than that of base are permitted. If the value of base is 16, the characters 0x or 0X may
13662 optionally precede the sequence of letters and digits, following the sign if present.
13663 4 The subject sequence is defined as the longest initial subsequence of the input string,
13664 starting with the first non-white-space character, that is of the expected form. The subject
13665 sequence contains no characters if the input string is empty or consists entirely of white
13666 space, or if the first non-white-space character is other than a sign or a permissible letter
13667 or digit.
13668 5 If the subject sequence has the expected form and the value of base is zero, the sequence
13669 of characters starting with the first digit is interpreted as an integer constant according to
13670 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
13671 is between 2 and 36, it is used as the base for conversion, ascribing to each letter its value
13672 as given above. If the subject sequence begins with a minus sign, the value resulting from
13673 the conversion is negated (in the return type). A pointer to the final string is stored in the
13674 object pointed to by endptr, provided that endptr is not a null pointer.
13675 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
13676 accepted.
13677 7 If the subject sequence is empty or does not have the expected form, no conversion is
13678 performed; the value of nptr is stored in the object pointed to by endptr, provided
13679 that endptr is not a null pointer.
13680 <b> Returns</b>
13681 8 The strtol, strtoll, strtoul, and strtoull functions return the converted
13682 value, if any. If no conversion could be performed, zero is returned. If the correct value
13683 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
13684 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
13685 and sign of the value, if any), and the value of the macro ERANGE is stored in errno.
13687 [<a name="p345" href="#p345">page 345</a>] (<a href="#Contents">Contents</a>)
13689 <a name="7.22.2" href="#7.22.2"><b> 7.22.2 Pseudo-random sequence generation functions</b></a>
13690 <a name="7.22.2.1" href="#7.22.2.1"><b> 7.22.2.1 The rand function</b></a>
13691 <b> Synopsis</b>
13692 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13693 int rand(void);
13694 <b> Description</b>
13695 2 The rand function computes a sequence of pseudo-random integers in the range 0 to
13696 RAND_MAX.<sup><a href="#note295"><b>295)</b></a></sup>
13697 3 The rand function is not required to avoid data races with other calls to pseudo-random
13698 sequence generation functions. The implementation shall behave as if no library function
13699 calls the rand function.
13700 <b> Returns</b>
13701 4 The rand function returns a pseudo-random integer.
13702 Environmental limits
13703 5 The value of the RAND_MAX macro shall be at least 32767.
13704 <a name="7.22.2.2" href="#7.22.2.2"><b> 7.22.2.2 The srand function</b></a>
13705 <b> Synopsis</b>
13706 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13707 void srand(unsigned int seed);
13708 <b> Description</b>
13709 2 The srand function uses the argument as a seed for a new sequence of pseudo-random
13710 numbers to be returned by subsequent calls to rand. If srand is then called with the
13711 same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
13712 called before any calls to srand have been made, the same sequence shall be generated
13713 as when srand is first called with a seed value of 1.
13714 3 The srand function is not required to avoid data races with other calls to pseudo-
13715 random sequence generation functions. The implementation shall behave as if no library
13716 function calls the srand function.
13721 <sup><a name="note295" href="#note295"><b>295)</b></a></sup> There are no guarantees as to the quality of the random sequence produced and some implementations
13722 are known to produce sequences with distressingly non-random low-order bits. Applications with
13723 particular requirements should use a generator that is known to be sufficient for their needs.
13725 [<a name="p346" href="#p346">page 346</a>] (<a href="#Contents">Contents</a>)
13727 <b> Returns</b>
13728 4 The srand function returns no value.
13729 5 EXAMPLE The following functions define a portable implementation of rand and srand.
13730 static unsigned long int next = 1;
13731 int rand(void) // RAND_MAX assumed to be 32767
13733 next = next * 1103515245 + 12345;
13734 return (unsigned int)(next/65536) % 32768;
13736 void srand(unsigned int seed)
13738 next = seed;
13741 <a name="7.22.3" href="#7.22.3"><b> 7.22.3 Memory management functions</b></a>
13742 1 The order and contiguity of storage allocated by successive calls to the
13743 aligned_alloc, calloc, malloc, and realloc functions is unspecified. The
13744 pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to
13745 a pointer to any type of object with a fundamental alignment requirement and then used
13746 to access such an object or an array of such objects in the space allocated (until the space
13747 is explicitly deallocated). The lifetime of an allocated object extends from the allocation
13748 until the deallocation. Each such allocation shall yield a pointer to an object disjoint from
13749 any other object. The pointer returned points to the start (lowest byte address) of the
13750 allocated space. If the space cannot be allocated, a null pointer is returned. If the size of
13751 the space requested is zero, the behavior is implementation-defined: either a null pointer
13752 is returned, or the behavior is as if the size were some nonzero value, except that the
13753 returned pointer shall not be used to access an object.
13754 2 For purposes of determining the existence of a data race, memory allocation functions
13755 behave as though they accessed only memory locations accessible through their
13756 arguments and not other static duration storage. These functions may, however, visibly
13757 modify the storage that they allocate or deallocate. A call to free or realloc that
13758 deallocates a region p of memory synchronizes with any allocation call that allocates all
13759 or part of the region p. This synchronization occurs after any access of p by the
13760 deallocating function, and before any such access by the allocating function.
13761 <a name="7.22.3.1" href="#7.22.3.1"><b> 7.22.3.1 The aligned_alloc function</b></a>
13762 <b> Synopsis</b>
13763 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13764 void *aligned_alloc(size_t alignment, size_t size);
13766 [<a name="p347" href="#p347">page 347</a>] (<a href="#Contents">Contents</a>)
13768 <b> Description</b>
13769 2 The aligned_alloc function allocates space for an object whose alignment is
13770 specified by alignment, whose size is specified by size, and whose value is
13771 indeterminate. The value of alignment shall be a valid alignment supported by the
13772 implementation and the value of size shall be an integral multiple of alignment.
13773 <b> Returns</b>
13774 3 The aligned_alloc function returns either a null pointer or a pointer to the allocated
13775 space.
13776 <a name="7.22.3.2" href="#7.22.3.2"><b> 7.22.3.2 The calloc function</b></a>
13777 <b> Synopsis</b>
13778 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13779 void *calloc(size_t nmemb, size_t size);
13780 <b> Description</b>
13781 2 The calloc function allocates space for an array of nmemb objects, each of whose size
13782 is size. The space is initialized to all bits zero.<sup><a href="#note296"><b>296)</b></a></sup>
13783 <b> Returns</b>
13784 3 The calloc function returns either a null pointer or a pointer to the allocated space.
13785 <a name="7.22.3.3" href="#7.22.3.3"><b> 7.22.3.3 The free function</b></a>
13786 <b> Synopsis</b>
13787 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13788 void free(void *ptr);
13789 <b> Description</b>
13790 2 The free function causes the space pointed to by ptr to be deallocated, that is, made
13791 available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
13792 the argument does not match a pointer earlier returned by a memory management
13793 function, or if the space has been deallocated by a call to free or realloc, the
13794 behavior is undefined.
13795 <b> Returns</b>
13796 3 The free function returns no value.
13801 <sup><a name="note296" href="#note296"><b>296)</b></a></sup> Note that this need not be the same as the representation of floating-point zero or a null pointer
13802 constant.
13804 [<a name="p348" href="#p348">page 348</a>] (<a href="#Contents">Contents</a>)
13806 <a name="7.22.3.4" href="#7.22.3.4"><b> 7.22.3.4 The malloc function</b></a>
13807 <b> Synopsis</b>
13808 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13809 void *malloc(size_t size);
13810 <b> Description</b>
13811 2 The malloc function allocates space for an object whose size is specified by size and
13812 whose value is indeterminate.
13813 <b> Returns</b>
13814 3 The malloc function returns either a null pointer or a pointer to the allocated space.
13815 <a name="7.22.3.5" href="#7.22.3.5"><b> 7.22.3.5 The realloc function</b></a>
13816 <b> Synopsis</b>
13817 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13818 void *realloc(void *ptr, size_t size);
13819 <b> Description</b>
13820 2 The realloc function deallocates the old object pointed to by ptr and returns a
13821 pointer to a new object that has the size specified by size. The contents of the new
13822 object shall be the same as that of the old object prior to deallocation, up to the lesser of
13823 the new and old sizes. Any bytes in the new object beyond the size of the old object have
13824 indeterminate values.
13825 3 If ptr is a null pointer, the realloc function behaves like the malloc function for the
13826 specified size. Otherwise, if ptr does not match a pointer earlier returned by a memory
13827 management function, or if the space has been deallocated by a call to the free or
13828 realloc function, the behavior is undefined. If memory for the new object cannot be
13829 allocated, the old object is not deallocated and its value is unchanged.
13830 <b> Returns</b>
13831 4 The realloc function returns a pointer to the new object (which may have the same
13832 value as a pointer to the old object), or a null pointer if the new object could not be
13833 allocated.
13835 [<a name="p349" href="#p349">page 349</a>] (<a href="#Contents">Contents</a>)
13837 <a name="7.22.4" href="#7.22.4"><b> 7.22.4 Communication with the environment</b></a>
13838 <a name="7.22.4.1" href="#7.22.4.1"><b> 7.22.4.1 The abort function</b></a>
13839 <b> Synopsis</b>
13840 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13841 _Noreturn void abort(void);
13842 <b> Description</b>
13843 2 The abort function causes abnormal program termination to occur, unless the signal
13844 SIGABRT is being caught and the signal handler does not return. Whether open streams
13845 with unwritten buffered data are flushed, open streams are closed, or temporary files are
13846 removed is implementation-defined. An implementation-defined form of the status
13847 unsuccessful termination is returned to the host environment by means of the function
13848 call raise(SIGABRT).
13849 <b> Returns</b>
13850 3 The abort function does not return to its caller.
13851 <a name="7.22.4.2" href="#7.22.4.2"><b> 7.22.4.2 The atexit function</b></a>
13852 <b> Synopsis</b>
13853 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13854 int atexit(void (*func)(void));
13855 <b> Description</b>
13856 2 The atexit function registers the function pointed to by func, to be called without
13857 arguments at normal program termination.<sup><a href="#note297"><b>297)</b></a></sup> It is unspecified whether a call to the
13858 atexit function that does not happen before the exit function is called will succeed.
13859 Environmental limits
13860 3 The implementation shall support the registration of at least 32 functions.
13861 <b> Returns</b>
13862 4 The atexit function returns zero if the registration succeeds, nonzero if it fails.
13863 Forward references: the at_quick_exit function (<a href="#7.22.4.3">7.22.4.3</a>), the exit function
13864 (<a href="#7.22.4.4">7.22.4.4</a>).
13869 <sup><a name="note297" href="#note297"><b>297)</b></a></sup> The atexit function registrations are distinct from the at_quick_exit registrations, so
13870 applications may need to call both registration functions with the same argument.
13872 [<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
13874 <a name="7.22.4.3" href="#7.22.4.3"><b> 7.22.4.3 The at_quick_exit function</b></a>
13875 <b> Synopsis</b>
13876 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13877 int at_quick_exit(void (*func)(void));
13878 <b> Description</b>
13879 2 The at_quick_exit function registers the function pointed to by func, to be called
13880 without arguments should quick_exit be called.<sup><a href="#note298"><b>298)</b></a></sup> It is unspecified whether a call to
13881 the at_quick_exit function that does not happen before the quick_exit function
13882 is called will succeed.
13883 Environmental limits
13884 3 The implementation shall support the registration of at least 32 functions.
13885 <b> Returns</b>
13886 4 The at_quick_exit function returns zero if the registration succeeds, nonzero if it
13887 fails.
13888 Forward references: the quick_exit function (<a href="#7.22.4.7">7.22.4.7</a>).
13889 <a name="7.22.4.4" href="#7.22.4.4"><b> 7.22.4.4 The exit function</b></a>
13890 <b> Synopsis</b>
13891 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13892 _Noreturn void exit(int status);
13893 <b> Description</b>
13894 2 The exit function causes normal program termination to occur. No functions registered
13895 by the at_quick_exit function are called. If a program calls the exit function
13896 more than once, or calls the quick_exit function in addition to the exit function, the
13897 behavior is undefined.
13898 3 First, all functions registered by the atexit function are called, in the reverse order of
13899 their registration,<sup><a href="#note299"><b>299)</b></a></sup> except that a function is called after any previously registered
13900 functions that had already been called at the time it was registered. If, during the call to
13901 any such function, a call to the longjmp function is made that would terminate the call
13902 to the registered function, the behavior is undefined.
13906 <sup><a name="note298" href="#note298"><b>298)</b></a></sup> The at_quick_exit function registrations are distinct from the atexit registrations, so
13907 applications may need to call both registration functions with the same argument.
13908 <sup><a name="note299" href="#note299"><b>299)</b></a></sup> Each function is called as many times as it was registered, and in the correct order with respect to
13909 other registered functions.
13911 [<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
13913 4 Next, all open streams with unwritten buffered data are flushed, all open streams are
13914 closed, and all files created by the tmpfile function are removed.
13915 5 Finally, control is returned to the host environment. If the value of status is zero or
13916 EXIT_SUCCESS, an implementation-defined form of the status successful termination is
13917 returned. If the value of status is EXIT_FAILURE, an implementation-defined form
13918 of the status unsuccessful termination is returned. Otherwise the status returned is
13919 implementation-defined.
13920 <b> Returns</b>
13921 6 The exit function cannot return to its caller.
13922 <a name="7.22.4.5" href="#7.22.4.5"><b> 7.22.4.5 The _Exit function</b></a>
13923 <b> Synopsis</b>
13924 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13925 _Noreturn void _Exit(int status);
13926 <b> Description</b>
13927 2 The _Exit function causes normal program termination to occur and control to be
13928 returned to the host environment. No functions registered by the atexit function, the
13929 at_quick_exit function, or signal handlers registered by the signal function are
13930 called. The status returned to the host environment is determined in the same way as for
13931 the exit function (<a href="#7.22.4.4">7.22.4.4</a>). Whether open streams with unwritten buffered data are
13932 flushed, open streams are closed, or temporary files are removed is implementation-
13933 defined.
13934 <b> Returns</b>
13935 3 The _Exit function cannot return to its caller.
13936 <a name="7.22.4.6" href="#7.22.4.6"><b> 7.22.4.6 The getenv function</b></a>
13937 <b> Synopsis</b>
13938 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13939 char *getenv(const char *name);
13940 <b> Description</b>
13941 2 The getenv function searches an environment list, provided by the host environment,
13942 for a string that matches the string pointed to by name. The set of environment names
13943 and the method for altering the environment list are implementation-defined. The
13944 getenv function need not avoid data races with other threads of execution that modify
13945 the environment list.<sup><a href="#note300"><b>300)</b></a></sup>
13947 <sup><a name="note300" href="#note300"><b>300)</b></a></sup> Many implementations provide non-standard functions that modify the environment list.
13949 [<a name="p352" href="#p352">page 352</a>] (<a href="#Contents">Contents</a>)
13951 3 The implementation shall behave as if no library function calls the getenv function.
13952 <b> Returns</b>
13953 4 The getenv function returns a pointer to a string associated with the matched list
13954 member. The string pointed to shall not be modified by the program, but may be
13955 overwritten by a subsequent call to the getenv function. If the specified name cannot
13956 be found, a null pointer is returned.
13957 <a name="7.22.4.7" href="#7.22.4.7"><b> 7.22.4.7 The quick_exit function</b></a>
13958 <b> Synopsis</b>
13959 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13960 _Noreturn void quick_exit(int status);
13961 <b> Description</b>
13962 2 The quick_exit function causes normal program termination to occur. No functions
13963 registered by the atexit function or signal handlers registered by the signal function
13964 are called. If a program calls the quick_exit function more than once, or calls the
13965 exit function in addition to the quick_exit function, the behavior is undefined. If a
13966 signal is raised while the quick_exit function is executing, the behavior is undefined.
13967 3 The quick_exit function first calls all functions registered by the at_quick_exit
13968 function, in the reverse order of their registration,<sup><a href="#note301"><b>301)</b></a></sup> except that a function is called after
13969 any previously registered functions that had already been called at the time it was
13970 registered. If, during the call to any such function, a call to the longjmp function is
13971 made that would terminate the call to the registered function, the behavior is undefined.
13972 4 Then control is returned to the host environment by means of the function call
13973 _Exit(status).
13974 <b> Returns</b>
13975 5 The quick_exit function cannot return to its caller.
13976 <a name="7.22.4.8" href="#7.22.4.8"><b> 7.22.4.8 The system function</b></a>
13977 <b> Synopsis</b>
13978 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
13979 int system(const char *string);
13980 <b> Description</b>
13981 2 If string is a null pointer, the system function determines whether the host
13982 environment has a command processor. If string is not a null pointer, the system
13984 <sup><a name="note301" href="#note301"><b>301)</b></a></sup> Each function is called as many times as it was registered, and in the correct order with respect to
13985 other registered functions.
13987 [<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
13989 function passes the string pointed to by string to that command processor to be
13990 executed in a manner which the implementation shall document; this might then cause the
13991 program calling system to behave in a non-conforming manner or to terminate.
13992 <b> Returns</b>
13993 3 If the argument is a null pointer, the system function returns nonzero only if a
13994 command processor is available. If the argument is not a null pointer, and the system
13995 function does return, it returns an implementation-defined value.
13996 <a name="7.22.5" href="#7.22.5"><b> 7.22.5 Searching and sorting utilities</b></a>
13997 1 These utilities make use of a comparison function to search or sort arrays of unspecified
13998 type. Where an argument declared as size_t nmemb specifies the length of the array
13999 for a function, nmemb can have the value zero on a call to that function; the comparison
14000 function is not called, a search finds no matching element, and sorting performs no
14001 rearrangement. Pointer arguments on such a call shall still have valid values, as described
14002 in <a href="#7.1.4">7.1.4</a>.
14003 2 The implementation shall ensure that the second argument of the comparison function
14004 (when called from bsearch), or both arguments (when called from qsort), are
14005 pointers to elements of the array.<sup><a href="#note302"><b>302)</b></a></sup> The first argument when called from bsearch
14006 shall equal key.
14007 3 The comparison function shall not alter the contents of the array. The implementation
14008 may reorder elements of the array between calls to the comparison function, but shall not
14009 alter the contents of any individual element.
14010 4 When the same objects (consisting of size bytes, irrespective of their current positions
14011 in the array) are passed more than once to the comparison function, the results shall be
14012 consistent with one another. That is, for qsort they shall define a total ordering on the
14013 array, and for bsearch the same object shall always compare the same way with the
14014 key.
14015 5 A sequence point occurs immediately before and immediately after each call to the
14016 comparison function, and also between any call to the comparison function and any
14017 movement of the objects passed as arguments to that call.
14022 <sup><a name="note302" href="#note302"><b>302)</b></a></sup> That is, if the value passed is p, then the following expressions are always nonzero:
14023 ((char *)p - (char *)base) % size == 0
14024 (char *)p &gt;= (char *)base
14025 (char *)p &lt; (char *)base + nmemb * size
14027 [<a name="p354" href="#p354">page 354</a>] (<a href="#Contents">Contents</a>)
14029 <a name="7.22.5.1" href="#7.22.5.1"><b> 7.22.5.1 The bsearch function</b></a>
14030 <b> Synopsis</b>
14031 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14032 void *bsearch(const void *key, const void *base,
14033 size_t nmemb, size_t size,
14034 int (*compar)(const void *, const void *));
14035 <b> Description</b>
14036 2 The bsearch function searches an array of nmemb objects, the initial element of which
14037 is pointed to by base, for an element that matches the object pointed to by key. The
14038 size of each element of the array is specified by size.
14039 3 The comparison function pointed to by compar is called with two arguments that point
14040 to the key object and to an array element, in that order. The function shall return an
14041 integer less than, equal to, or greater than zero if the key object is considered,
14042 respectively, to be less than, to match, or to be greater than the array element. The array
14043 shall consist of: all the elements that compare less than, all the elements that compare
14044 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note303"><b>303)</b></a></sup>
14045 <b> Returns</b>
14046 4 The bsearch function returns a pointer to a matching element of the array, or a null
14047 pointer if no match is found. If two elements compare as equal, which element is
14048 matched is unspecified.
14049 <a name="7.22.5.2" href="#7.22.5.2"><b> 7.22.5.2 The qsort function</b></a>
14050 <b> Synopsis</b>
14051 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14052 void qsort(void *base, size_t nmemb, size_t size,
14053 int (*compar)(const void *, const void *));
14054 <b> Description</b>
14055 2 The qsort function sorts an array of nmemb objects, the initial element of which is
14056 pointed to by base. The size of each object is specified by size.
14057 3 The contents of the array are sorted into ascending order according to a comparison
14058 function pointed to by compar, which is called with two arguments that point to the
14059 objects being compared. The function shall return an integer less than, equal to, or
14060 greater than zero if the first argument is considered to be respectively less than, equal to,
14061 or greater than the second.
14064 <sup><a name="note303" href="#note303"><b>303)</b></a></sup> In practice, the entire array is sorted according to the comparison function.
14066 [<a name="p355" href="#p355">page 355</a>] (<a href="#Contents">Contents</a>)
14068 4 If two elements compare as equal, their order in the resulting sorted array is unspecified.
14069 <b> Returns</b>
14070 5 The qsort function returns no value.
14071 <a name="7.22.6" href="#7.22.6"><b> 7.22.6 Integer arithmetic functions</b></a>
14072 <a name="7.22.6.1" href="#7.22.6.1"><b> 7.22.6.1 The abs, labs and llabs functions</b></a>
14073 <b> Synopsis</b>
14074 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14075 int abs(int j);
14076 long int labs(long int j);
14077 long long int llabs(long long int j);
14078 <b> Description</b>
14079 2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
14080 result cannot be represented, the behavior is undefined.<sup><a href="#note304"><b>304)</b></a></sup>
14081 <b> Returns</b>
14082 3 The abs, labs, and llabs, functions return the absolute value.
14083 <a name="7.22.6.2" href="#7.22.6.2"><b> 7.22.6.2 The div, ldiv, and lldiv functions</b></a>
14084 <b> Synopsis</b>
14085 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14086 div_t div(int numer, int denom);
14087 ldiv_t ldiv(long int numer, long int denom);
14088 lldiv_t lldiv(long long int numer, long long int denom);
14089 <b> Description</b>
14090 2 The div, ldiv, and lldiv, functions compute numer / denom and numer %
14091 denom in a single operation.
14092 <b> Returns</b>
14093 3 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
14094 lldiv_t, respectively, comprising both the quotient and the remainder. The structures
14095 shall contain (in either order) the members quot (the quotient) and rem (the remainder),
14096 each of which has the same type as the arguments numer and denom. If either part of
14097 the result cannot be represented, the behavior is undefined.
14102 <sup><a name="note304" href="#note304"><b>304)</b></a></sup> The absolute value of the most negative number cannot be represented in two's complement.
14104 [<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
14106 <a name="7.22.7" href="#7.22.7"><b> 7.22.7 Multibyte/wide character conversion functions</b></a>
14107 1 The behavior of the multibyte character functions is affected by the LC_CTYPE category
14108 of the current locale. For a state-dependent encoding, each function is placed into its
14109 initial conversion state at program startup and can be returned to that state by a call for
14110 which its character pointer argument, s, is a null pointer. Subsequent calls with s as
14111 other than a null pointer cause the internal conversion state of the function to be altered as
14112 necessary. A call with s as a null pointer causes these functions to return a nonzero value
14113 if encodings have state dependency, and zero otherwise.<sup><a href="#note305"><b>305)</b></a></sup> Changing the LC_CTYPE
14114 category causes the conversion state of these functions to be indeterminate.
14115 <a name="7.22.7.1" href="#7.22.7.1"><b> 7.22.7.1 The mblen function</b></a>
14116 <b> Synopsis</b>
14117 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14118 int mblen(const char *s, size_t n);
14119 <b> Description</b>
14120 2 If s is not a null pointer, the mblen function determines the number of bytes contained
14121 in the multibyte character pointed to by s. Except that the conversion state of the
14122 mbtowc function is not affected, it is equivalent to
14123 mbtowc((wchar_t *)0, (const char *)0, 0);
14124 mbtowc((wchar_t *)0, s, n);
14125 3 The implementation shall behave as if no library function calls the mblen function.
14126 <b> Returns</b>
14127 4 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
14128 character encodings, respectively, do or do not have state-dependent encodings. If s is
14129 not a null pointer, the mblen function either returns 0 (if s points to the null character),
14130 or returns the number of bytes that are contained in the multibyte character (if the next n
14131 or fewer bytes form a valid multibyte character), or returns -1 (if they do not form a valid
14132 multibyte character).
14133 Forward references: the mbtowc function (<a href="#7.22.7.2">7.22.7.2</a>).
14138 <sup><a name="note305" href="#note305"><b>305)</b></a></sup> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
14139 character codes, but are grouped with an adjacent multibyte character.
14141 [<a name="p357" href="#p357">page 357</a>] (<a href="#Contents">Contents</a>)
14143 <a name="7.22.7.2" href="#7.22.7.2"><b> 7.22.7.2 The mbtowc function</b></a>
14144 <b> Synopsis</b>
14145 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14146 int mbtowc(wchar_t * restrict pwc,
14147 const char * restrict s,
14148 size_t n);
14149 <b> Description</b>
14150 2 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
14151 the byte pointed to by s to determine the number of bytes needed to complete the next
14152 multibyte character (including any shift sequences). If the function determines that the
14153 next multibyte character is complete and valid, it determines the value of the
14154 corresponding wide character and then, if pwc is not a null pointer, stores that value in
14155 the object pointed to by pwc. If the corresponding wide character is the null wide
14156 character, the function is left in the initial conversion state.
14157 3 The implementation shall behave as if no library function calls the mbtowc function.
14158 <b> Returns</b>
14159 4 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
14160 character encodings, respectively, do or do not have state-dependent encodings. If s is
14161 not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
14162 or returns the number of bytes that are contained in the converted multibyte character (if
14163 the next n or fewer bytes form a valid multibyte character), or returns -1 (if they do not
14164 form a valid multibyte character).
14165 5 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
14166 macro.
14167 <a name="7.22.7.3" href="#7.22.7.3"><b> 7.22.7.3 The wctomb function</b></a>
14168 <b> Synopsis</b>
14169 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14170 int wctomb(char *s, wchar_t wc);
14171 <b> Description</b>
14172 2 The wctomb function determines the number of bytes needed to represent the multibyte
14173 character corresponding to the wide character given by wc (including any shift
14174 sequences), and stores the multibyte character representation in the array whose first
14175 element is pointed to by s (if s is not a null pointer). At most MB_CUR_MAX characters
14176 are stored. If wc is a null wide character, a null byte is stored, preceded by any shift
14177 sequence needed to restore the initial shift state, and the function is left in the initial
14178 conversion state.
14180 [<a name="p358" href="#p358">page 358</a>] (<a href="#Contents">Contents</a>)
14182 3 The implementation shall behave as if no library function calls the wctomb function.
14183 <b> Returns</b>
14184 4 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
14185 character encodings, respectively, do or do not have state-dependent encodings. If s is
14186 not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
14187 to a valid multibyte character, or returns the number of bytes that are contained in the
14188 multibyte character corresponding to the value of wc.
14189 5 In no case will the value returned be greater than the value of the MB_CUR_MAX macro.
14190 <a name="7.22.8" href="#7.22.8"><b> 7.22.8 Multibyte/wide string conversion functions</b></a>
14191 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
14192 the current locale.
14193 <a name="7.22.8.1" href="#7.22.8.1"><b> 7.22.8.1 The mbstowcs function</b></a>
14194 <b> Synopsis</b>
14195 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14196 size_t mbstowcs(wchar_t * restrict pwcs,
14197 const char * restrict s,
14198 size_t n);
14199 <b> Description</b>
14200 2 The mbstowcs function converts a sequence of multibyte characters that begins in the
14201 initial shift state from the array pointed to by s into a sequence of corresponding wide
14202 characters and stores not more than n wide characters into the array pointed to by pwcs.
14203 No multibyte characters that follow a null character (which is converted into a null wide
14204 character) will be examined or converted. Each multibyte character is converted as if by
14205 a call to the mbtowc function, except that the conversion state of the mbtowc function is
14206 not affected.
14207 3 No more than n elements will be modified in the array pointed to by pwcs. If copying
14208 takes place between objects that overlap, the behavior is undefined.
14209 <b> Returns</b>
14210 4 If an invalid multibyte character is encountered, the mbstowcs function returns
14211 (size_t)(-1). Otherwise, the mbstowcs function returns the number of array
14212 elements modified, not including a terminating null wide character, if any.<sup><a href="#note306"><b>306)</b></a></sup>
14217 <sup><a name="note306" href="#note306"><b>306)</b></a></sup> The array will not be null-terminated if the value returned is n.
14219 [<a name="p359" href="#p359">page 359</a>] (<a href="#Contents">Contents</a>)
14221 <a name="7.22.8.2" href="#7.22.8.2"><b> 7.22.8.2 The wcstombs function</b></a>
14222 <b> Synopsis</b>
14223 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
14224 size_t wcstombs(char * restrict s,
14225 const wchar_t * restrict pwcs,
14226 size_t n);
14227 <b> Description</b>
14228 2 The wcstombs function converts a sequence of wide characters from the array pointed
14229 to by pwcs into a sequence of corresponding multibyte characters that begins in the
14230 initial shift state, and stores these multibyte characters into the array pointed to by s,
14231 stopping if a multibyte character would exceed the limit of n total bytes or if a null
14232 character is stored. Each wide character is converted as if by a call to the wctomb
14233 function, except that the conversion state of the wctomb function is not affected.
14234 3 No more than n bytes will be modified in the array pointed to by s. If copying takes place
14235 between objects that overlap, the behavior is undefined.
14236 <b> Returns</b>
14237 4 If a wide character is encountered that does not correspond to a valid multibyte character,
14238 the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
14239 returns the number of bytes modified, not including a terminating null character, if
14240 any.306)
14242 [<a name="p360" href="#p360">page 360</a>] (<a href="#Contents">Contents</a>)
14244 <a href="#7.23">7.23</a> _Noreturn <a href="#7.23">&lt;stdnoreturn.h&gt;</a>
14245 1 The header <a href="#7.23">&lt;stdnoreturn.h&gt;</a> defines the macro
14246 noreturn
14247 which expands to _Noreturn.
14249 [<a name="p361" href="#p361">page 361</a>] (<a href="#Contents">Contents</a>)
14251 <a name="7.24" href="#7.24"><b> 7.24 String handling &lt;string.h&gt;</b></a>
14252 <a name="7.24.1" href="#7.24.1"><b> 7.24.1 String function conventions</b></a>
14253 1 The header <a href="#7.24">&lt;string.h&gt;</a> declares one type and several functions, and defines one
14254 macro useful for manipulating arrays of character type and other objects treated as arrays
14255 of character type.<sup><a href="#note307"><b>307)</b></a></sup> The type is size_t and the macro is NULL (both described in
14256 <a name="7.19)" href="#7.19)"><b> 7.19). Various methods are used for determining the lengths of the arrays, but in all cases</b></a>
14257 a char * or void * argument points to the initial (lowest addressed) character of the
14258 array. If an array is accessed beyond the end of an object, the behavior is undefined.
14259 2 Where an argument declared as size_t n specifies the length of the array for a
14260 function, n can have the value zero on a call to that function. Unless explicitly stated
14261 otherwise in the description of a particular function in this subclause, pointer arguments
14262 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
14263 function that locates a character finds no occurrence, a function that compares two
14264 character sequences returns zero, and a function that copies characters copies zero
14265 characters.
14266 3 For all functions in this subclause, each character shall be interpreted as if it had the type
14267 unsigned char (and therefore every possible object representation is valid and has a
14268 different value).
14269 <a name="7.24.2" href="#7.24.2"><b> 7.24.2 Copying functions</b></a>
14270 <a name="7.24.2.1" href="#7.24.2.1"><b> 7.24.2.1 The memcpy function</b></a>
14271 <b> Synopsis</b>
14272 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14273 void *memcpy(void * restrict s1,
14274 const void * restrict s2,
14275 size_t n);
14276 <b> Description</b>
14277 2 The memcpy function copies n characters from the object pointed to by s2 into the
14278 object pointed to by s1. If copying takes place between objects that overlap, the behavior
14279 is undefined.
14280 <b> Returns</b>
14281 3 The memcpy function returns the value of s1.
14286 <sup><a name="note307" href="#note307"><b>307)</b></a></sup> See ''future library directions'' (<a href="#7.31.13">7.31.13</a>).
14288 [<a name="p362" href="#p362">page 362</a>] (<a href="#Contents">Contents</a>)
14290 <a name="7.24.2.2" href="#7.24.2.2"><b> 7.24.2.2 The memmove function</b></a>
14291 <b> Synopsis</b>
14292 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14293 void *memmove(void *s1, const void *s2, size_t n);
14294 <b> Description</b>
14295 2 The memmove function copies n characters from the object pointed to by s2 into the
14296 object pointed to by s1. Copying takes place as if the n characters from the object
14297 pointed to by s2 are first copied into a temporary array of n characters that does not
14298 overlap the objects pointed to by s1 and s2, and then the n characters from the
14299 temporary array are copied into the object pointed to by s1.
14300 <b> Returns</b>
14301 3 The memmove function returns the value of s1.
14302 <a name="7.24.2.3" href="#7.24.2.3"><b> 7.24.2.3 The strcpy function</b></a>
14303 <b> Synopsis</b>
14304 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14305 char *strcpy(char * restrict s1,
14306 const char * restrict s2);
14307 <b> Description</b>
14308 2 The strcpy function copies the string pointed to by s2 (including the terminating null
14309 character) into the array pointed to by s1. If copying takes place between objects that
14310 overlap, the behavior is undefined.
14311 <b> Returns</b>
14312 3 The strcpy function returns the value of s1.
14313 <a name="7.24.2.4" href="#7.24.2.4"><b> 7.24.2.4 The strncpy function</b></a>
14314 <b> Synopsis</b>
14315 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14316 char *strncpy(char * restrict s1,
14317 const char * restrict s2,
14318 size_t n);
14319 <b> Description</b>
14320 2 The strncpy function copies not more than n characters (characters that follow a null
14321 character are not copied) from the array pointed to by s2 to the array pointed to by
14323 [<a name="p363" href="#p363">page 363</a>] (<a href="#Contents">Contents</a>)
14325 s1.<sup><a href="#note308"><b>308)</b></a></sup> If copying takes place between objects that overlap, the behavior is undefined.
14326 3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
14327 are appended to the copy in the array pointed to by s1, until n characters in all have been
14328 written.
14329 <b> Returns</b>
14330 4 The strncpy function returns the value of s1.
14331 <a name="7.24.3" href="#7.24.3"><b> 7.24.3 Concatenation functions</b></a>
14332 <a name="7.24.3.1" href="#7.24.3.1"><b> 7.24.3.1 The strcat function</b></a>
14333 <b> Synopsis</b>
14334 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14335 char *strcat(char * restrict s1,
14336 const char * restrict s2);
14337 <b> Description</b>
14338 2 The strcat function appends a copy of the string pointed to by s2 (including the
14339 terminating null character) to the end of the string pointed to by s1. The initial character
14340 of s2 overwrites the null character at the end of s1. If copying takes place between
14341 objects that overlap, the behavior is undefined.
14342 <b> Returns</b>
14343 3 The strcat function returns the value of s1.
14344 <a name="7.24.3.2" href="#7.24.3.2"><b> 7.24.3.2 The strncat function</b></a>
14345 <b> Synopsis</b>
14346 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14347 char *strncat(char * restrict s1,
14348 const char * restrict s2,
14349 size_t n);
14350 <b> Description</b>
14351 2 The strncat function appends not more than n characters (a null character and
14352 characters that follow it are not appended) from the array pointed to by s2 to the end of
14353 the string pointed to by s1. The initial character of s2 overwrites the null character at the
14354 end of s1. A terminating null character is always appended to the result.<sup><a href="#note309"><b>309)</b></a></sup> If copying
14356 <sup><a name="note308" href="#note308"><b>308)</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
14357 not be null-terminated.
14358 <sup><a name="note309" href="#note309"><b>309)</b></a></sup> Thus, the maximum number of characters that can end up in the array pointed to by s1 is
14359 strlen(s1)+n+1.
14361 [<a name="p364" href="#p364">page 364</a>] (<a href="#Contents">Contents</a>)
14363 takes place between objects that overlap, the behavior is undefined.
14364 <b> Returns</b>
14365 3 The strncat function returns the value of s1.
14366 Forward references: the strlen function (<a href="#7.24.6.3">7.24.6.3</a>).
14367 <a name="7.24.4" href="#7.24.4"><b> 7.24.4 Comparison functions</b></a>
14368 1 The sign of a nonzero value returned by the comparison functions memcmp, strcmp,
14369 and strncmp is determined by the sign of the difference between the values of the first
14370 pair of characters (both interpreted as unsigned char) that differ in the objects being
14371 compared.
14372 <a name="7.24.4.1" href="#7.24.4.1"><b> 7.24.4.1 The memcmp function</b></a>
14373 <b> Synopsis</b>
14374 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14375 int memcmp(const void *s1, const void *s2, size_t n);
14376 <b> Description</b>
14377 2 The memcmp function compares the first n characters of the object pointed to by s1 to
14378 the first n characters of the object pointed to by s2.<sup><a href="#note310"><b>310)</b></a></sup>
14379 <b> Returns</b>
14380 3 The memcmp function returns an integer greater than, equal to, or less than zero,
14381 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
14382 pointed to by s2.
14383 <a name="7.24.4.2" href="#7.24.4.2"><b> 7.24.4.2 The strcmp function</b></a>
14384 <b> Synopsis</b>
14385 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14386 int strcmp(const char *s1, const char *s2);
14387 <b> Description</b>
14388 2 The strcmp function compares the string pointed to by s1 to the string pointed to by
14390 <b> Returns</b>
14391 3 The strcmp function returns an integer greater than, equal to, or less than zero,
14392 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
14394 <sup><a name="note310" href="#note310"><b>310)</b></a></sup> The contents of ''holes'' used as padding for purposes of alignment within structure objects are
14395 indeterminate. Strings shorter than their allocated space and unions may also cause problems in
14396 comparison.
14398 [<a name="p365" href="#p365">page 365</a>] (<a href="#Contents">Contents</a>)
14400 pointed to by s2.
14401 <a name="7.24.4.3" href="#7.24.4.3"><b> 7.24.4.3 The strcoll function</b></a>
14402 <b> Synopsis</b>
14403 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14404 int strcoll(const char *s1, const char *s2);
14405 <b> Description</b>
14406 2 The strcoll function compares the string pointed to by s1 to the string pointed to by
14407 s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
14408 <b> Returns</b>
14409 3 The strcoll function returns an integer greater than, equal to, or less than zero,
14410 accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
14411 pointed to by s2 when both are interpreted as appropriate to the current locale.
14412 <a name="7.24.4.4" href="#7.24.4.4"><b> 7.24.4.4 The strncmp function</b></a>
14413 <b> Synopsis</b>
14414 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14415 int strncmp(const char *s1, const char *s2, size_t n);
14416 <b> Description</b>
14417 2 The strncmp function compares not more than n characters (characters that follow a
14418 null character are not compared) from the array pointed to by s1 to the array pointed to
14419 by s2.
14420 <b> Returns</b>
14421 3 The strncmp function returns an integer greater than, equal to, or less than zero,
14422 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
14423 to, or less than the possibly null-terminated array pointed to by s2.
14424 <a name="7.24.4.5" href="#7.24.4.5"><b> 7.24.4.5 The strxfrm function</b></a>
14425 <b> Synopsis</b>
14426 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14427 size_t strxfrm(char * restrict s1,
14428 const char * restrict s2,
14429 size_t n);
14430 <b> Description</b>
14431 2 The strxfrm function transforms the string pointed to by s2 and places the resulting
14432 string into the array pointed to by s1. The transformation is such that if the strcmp
14433 function is applied to two transformed strings, it returns a value greater than, equal to, or
14435 [<a name="p366" href="#p366">page 366</a>] (<a href="#Contents">Contents</a>)
14437 less than zero, corresponding to the result of the strcoll function applied to the same
14438 two original strings. No more than n characters are placed into the resulting array
14439 pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
14440 be a null pointer. If copying takes place between objects that overlap, the behavior is
14441 undefined.
14442 <b> Returns</b>
14443 3 The strxfrm function returns the length of the transformed string (not including the
14444 terminating null character). If the value returned is n or more, the contents of the array
14445 pointed to by s1 are indeterminate.
14446 4 EXAMPLE The value of the following expression is the size of the array needed to hold the
14447 transformation of the string pointed to by s.
14448 1 + strxfrm(NULL, s, 0)
14450 <a name="7.24.5" href="#7.24.5"><b> 7.24.5 Search functions</b></a>
14451 <a name="7.24.5.1" href="#7.24.5.1"><b> 7.24.5.1 The memchr function</b></a>
14452 <b> Synopsis</b>
14453 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14454 void *memchr(const void *s, int c, size_t n);
14455 <b> Description</b>
14456 2 The memchr function locates the first occurrence of c (converted to an unsigned
14457 char) in the initial n characters (each interpreted as unsigned char) of the object
14458 pointed to by s. The implementation shall behave as if it reads the characters sequentially
14459 and stops as soon as a matching character is found.
14460 <b> Returns</b>
14461 3 The memchr function returns a pointer to the located character, or a null pointer if the
14462 character does not occur in the object.
14463 <a name="7.24.5.2" href="#7.24.5.2"><b> 7.24.5.2 The strchr function</b></a>
14464 <b> Synopsis</b>
14465 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14466 char *strchr(const char *s, int c);
14467 <b> Description</b>
14468 2 The strchr function locates the first occurrence of c (converted to a char) in the
14469 string pointed to by s. The terminating null character is considered to be part of the
14470 string.
14472 [<a name="p367" href="#p367">page 367</a>] (<a href="#Contents">Contents</a>)
14474 <b> Returns</b>
14475 3 The strchr function returns a pointer to the located character, or a null pointer if the
14476 character does not occur in the string.
14477 <a name="7.24.5.3" href="#7.24.5.3"><b> 7.24.5.3 The strcspn function</b></a>
14478 <b> Synopsis</b>
14479 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14480 size_t strcspn(const char *s1, const char *s2);
14481 <b> Description</b>
14482 2 The strcspn function computes the length of the maximum initial segment of the string
14483 pointed to by s1 which consists entirely of characters not from the string pointed to by
14485 <b> Returns</b>
14486 3 The strcspn function returns the length of the segment.
14487 <a name="7.24.5.4" href="#7.24.5.4"><b> 7.24.5.4 The strpbrk function</b></a>
14488 <b> Synopsis</b>
14489 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14490 char *strpbrk(const char *s1, const char *s2);
14491 <b> Description</b>
14492 2 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
14493 character from the string pointed to by s2.
14494 <b> Returns</b>
14495 3 The strpbrk function returns a pointer to the character, or a null pointer if no character
14496 from s2 occurs in s1.
14497 <a name="7.24.5.5" href="#7.24.5.5"><b> 7.24.5.5 The strrchr function</b></a>
14498 <b> Synopsis</b>
14499 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14500 char *strrchr(const char *s, int c);
14501 <b> Description</b>
14502 2 The strrchr function locates the last occurrence of c (converted to a char) in the
14503 string pointed to by s. The terminating null character is considered to be part of the
14504 string.
14506 [<a name="p368" href="#p368">page 368</a>] (<a href="#Contents">Contents</a>)
14508 <b> Returns</b>
14509 3 The strrchr function returns a pointer to the character, or a null pointer if c does not
14510 occur in the string.
14511 <a name="7.24.5.6" href="#7.24.5.6"><b> 7.24.5.6 The strspn function</b></a>
14512 <b> Synopsis</b>
14513 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14514 size_t strspn(const char *s1, const char *s2);
14515 <b> Description</b>
14516 2 The strspn function computes the length of the maximum initial segment of the string
14517 pointed to by s1 which consists entirely of characters from the string pointed to by s2.
14518 <b> Returns</b>
14519 3 The strspn function returns the length of the segment.
14520 <a name="7.24.5.7" href="#7.24.5.7"><b> 7.24.5.7 The strstr function</b></a>
14521 <b> Synopsis</b>
14522 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14523 char *strstr(const char *s1, const char *s2);
14524 <b> Description</b>
14525 2 The strstr function locates the first occurrence in the string pointed to by s1 of the
14526 sequence of characters (excluding the terminating null character) in the string pointed to
14527 by s2.
14528 <b> Returns</b>
14529 3 The strstr function returns a pointer to the located string, or a null pointer if the string
14530 is not found. If s2 points to a string with zero length, the function returns s1.
14531 <a name="7.24.5.8" href="#7.24.5.8"><b> 7.24.5.8 The strtok function</b></a>
14532 <b> Synopsis</b>
14533 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14534 char *strtok(char * restrict s1,
14535 const char * restrict s2);
14536 <b> Description</b>
14537 2 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
14538 sequence of tokens, each of which is delimited by a character from the string pointed to
14539 by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
14540 sequence have a null first argument. The separator string pointed to by s2 may be
14541 different from call to call.
14543 [<a name="p369" href="#p369">page 369</a>] (<a href="#Contents">Contents</a>)
14545 3 The first call in the sequence searches the string pointed to by s1 for the first character
14546 that is not contained in the current separator string pointed to by s2. If no such character
14547 is found, then there are no tokens in the string pointed to by s1 and the strtok function
14548 returns a null pointer. If such a character is found, it is the start of the first token.
14549 4 The strtok function then searches from there for a character that is contained in the
14550 current separator string. If no such character is found, the current token extends to the
14551 end of the string pointed to by s1, and subsequent searches for a token will return a null
14552 pointer. If such a character is found, it is overwritten by a null character, which
14553 terminates the current token. The strtok function saves a pointer to the following
14554 character, from which the next search for a token will start.
14555 5 Each subsequent call, with a null pointer as the value of the first argument, starts
14556 searching from the saved pointer and behaves as described above.
14557 6 The strtok function is not required to avoid data races with other calls to the strtok
14558 function.<sup><a href="#note311"><b>311)</b></a></sup> The implementation shall behave as if no library function calls the strtok
14559 function.
14560 <b> Returns</b>
14561 7 The strtok function returns a pointer to the first character of a token, or a null pointer
14562 if there is no token.
14563 8 EXAMPLE
14564 #include <a href="#7.24">&lt;string.h&gt;</a>
14565 static char str[] = "?a???b,,,#c";
14566 char *t;
14567 t = strtok(str, "?"); // t points to the token "a"
14568 t = strtok(NULL, ","); // t points to the token "??b"
14569 t = strtok(NULL, "#,"); // t points to the token "c"
14570 t = strtok(NULL, "?"); // t is a null pointer
14572 Forward references: The strtok_s function (<a href="#K.3.7.3.1">K.3.7.3.1</a>).
14577 <sup><a name="note311" href="#note311"><b>311)</b></a></sup> The strtok_s function can be used instead to avoid data races.
14579 [<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
14581 <a name="7.24.6" href="#7.24.6"><b> 7.24.6 Miscellaneous functions</b></a>
14582 <a name="7.24.6.1" href="#7.24.6.1"><b> 7.24.6.1 The memset function</b></a>
14583 <b> Synopsis</b>
14584 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14585 void *memset(void *s, int c, size_t n);
14586 <b> Description</b>
14587 2 The memset function copies the value of c (converted to an unsigned char) into
14588 each of the first n characters of the object pointed to by s.
14589 <b> Returns</b>
14590 3 The memset function returns the value of s.
14591 <a name="7.24.6.2" href="#7.24.6.2"><b> 7.24.6.2 The strerror function</b></a>
14592 <b> Synopsis</b>
14593 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14594 char *strerror(int errnum);
14595 <b> Description</b>
14596 2 The strerror function maps the number in errnum to a message string. Typically,
14597 the values for errnum come from errno, but strerror shall map any value of type
14598 int to a message.
14599 3 The strerror function is not required to avoid data races with other calls to the
14600 strerror function.<sup><a href="#note312"><b>312)</b></a></sup> The implementation shall behave as if no library function calls
14601 the strerror function.
14602 <b> Returns</b>
14603 4 The strerror function returns a pointer to the string, the contents of which are locale-
14604 specific. The array pointed to shall not be modified by the program, but may be
14605 overwritten by a subsequent call to the strerror function.
14606 Forward references: The strerror_s function (<a href="#K.3.7.4.2">K.3.7.4.2</a>).
14611 <sup><a name="note312" href="#note312"><b>312)</b></a></sup> The strerror_s function can be used instead to avoid data races.
14613 [<a name="p371" href="#p371">page 371</a>] (<a href="#Contents">Contents</a>)
14615 <a name="7.24.6.3" href="#7.24.6.3"><b> 7.24.6.3 The strlen function</b></a>
14616 <b> Synopsis</b>
14617 1 #include <a href="#7.24">&lt;string.h&gt;</a>
14618 size_t strlen(const char *s);
14619 <b> Description</b>
14620 2 The strlen function computes the length of the string pointed to by s.
14621 <b> Returns</b>
14622 3 The strlen function returns the number of characters that precede the terminating null
14623 character.
14625 [<a name="p372" href="#p372">page 372</a>] (<a href="#Contents">Contents</a>)
14627 <a name="7.25" href="#7.25"><b> 7.25 Type-generic math &lt;tgmath.h&gt;</b></a>
14628 1 The header <a href="#7.25">&lt;tgmath.h&gt;</a> includes the headers <a href="#7.12">&lt;math.h&gt;</a> and <a href="#7.3">&lt;complex.h&gt;</a> and
14629 defines several type-generic macros.
14630 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
14631 double) suffix, several have one or more parameters whose corresponding real type is
14632 double. For each such function, except modf, there is a corresponding type-generic
14633 macro.<sup><a href="#note313"><b>313)</b></a></sup> The parameters whose corresponding real type is double in the function
14634 synopsis are generic parameters. Use of the macro invokes a function whose
14635 corresponding real type and type domain are determined by the arguments for the generic
14636 parameters.<sup><a href="#note314"><b>314)</b></a></sup>
14637 3 Use of the macro invokes a function whose generic parameters have the corresponding
14638 real type determined as follows:
14639 -- First, if any argument for generic parameters has type long double, the type
14640 determined is long double.
14641 -- Otherwise, if any argument for generic parameters has type double or is of integer
14642 type, the type determined is double.
14643 -- Otherwise, the type determined is float.
14644 4 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> for which there is a function in
14645 <a href="#7.3">&lt;complex.h&gt;</a> with the same name except for a c prefix, the corresponding type-
14646 generic macro (for both functions) has the same name as the function in <a href="#7.12">&lt;math.h&gt;</a>. The
14647 corresponding type-generic macro for fabs and cabs is fabs.
14652 <sup><a name="note313" href="#note313"><b>313)</b></a></sup> Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to
14653 make available the corresponding ordinary function.
14654 <sup><a name="note314" href="#note314"><b>314)</b></a></sup> If the type of the argument is not compatible with the type of the parameter for the selected function,
14655 the behavior is undefined.
14657 [<a name="p373" href="#p373">page 373</a>] (<a href="#Contents">Contents</a>)
14659 <a href="#7.12">&lt;math.h&gt;</a> <a href="#7.3">&lt;complex.h&gt;</a> type-generic
14660 function function macro
14661 acos cacos acos
14662 asin casin asin
14663 atan catan atan
14664 acosh cacosh acosh
14665 asinh casinh asinh
14666 atanh catanh atanh
14667 cos ccos cos
14668 sin csin sin
14669 tan ctan tan
14670 cosh ccosh cosh
14671 sinh csinh sinh
14672 tanh ctanh tanh
14673 exp cexp exp
14674 log clog log
14675 pow cpow pow
14676 sqrt csqrt sqrt
14677 fabs cabs fabs
14678 If at least one argument for a generic parameter is complex, then use of the macro invokes
14679 a complex function; otherwise, use of the macro invokes a real function.
14680 5 For each unsuffixed function in <a href="#7.12">&lt;math.h&gt;</a> without a c-prefixed counterpart in
14681 <a href="#7.3">&lt;complex.h&gt;</a> (except modf), the corresponding type-generic macro has the same
14682 name as the function. These type-generic macros are:
14683 atan2 fma llround remainder
14684 cbrt fmax log10 remquo
14685 ceil fmin log1p rint
14686 copysign fmod log2 round
14687 erf frexp logb scalbn
14688 erfc hypot lrint scalbln
14689 exp2 ilogb lround tgamma
14690 expm1 ldexp nearbyint trunc
14691 fdim lgamma nextafter
14692 floor llrint nexttoward
14693 If all arguments for generic parameters are real, then use of the macro invokes a real
14694 function; otherwise, use of the macro results in undefined behavior.
14696 [<a name="p374" href="#p374">page 374</a>] (<a href="#Contents">Contents</a>)
14698 6 For each unsuffixed function in <a href="#7.3">&lt;complex.h&gt;</a> that is not a c-prefixed counterpart to a
14699 function in <a href="#7.12">&lt;math.h&gt;</a>, the corresponding type-generic macro has the same name as the
14700 function. These type-generic macros are:
14701 carg conj creal
14702 cimag cproj
14703 Use of the macro with any real or complex argument invokes a complex function.
14704 7 EXAMPLE With the declarations
14705 #include <a href="#7.25">&lt;tgmath.h&gt;</a>
14706 int n;
14707 float f;
14708 double d;
14709 long double ld;
14710 float complex fc;
14711 double complex dc;
14712 long double complex ldc;
14713 functions invoked by use of type-generic macros are shown in the following table:
14714 macro use invokes
14715 exp(n) exp(n), the function
14716 acosh(f) acoshf(f)
14717 sin(d) sin(d), the function
14718 atan(ld) atanl(ld)
14719 log(fc) clogf(fc)
14720 sqrt(dc) csqrt(dc)
14721 pow(ldc, f) cpowl(ldc, f)
14722 remainder(n, n) remainder(n, n), the function
14723 nextafter(d, f) nextafter(d, f), the function
14724 nexttoward(f, ld) nexttowardf(f, ld)
14725 copysign(n, ld) copysignl(n, ld)
14726 ceil(fc) undefined behavior
14727 rint(dc) undefined behavior
14728 fmax(ldc, ld) undefined behavior
14729 carg(n) carg(n), the function
14730 cproj(f) cprojf(f)
14731 creal(d) creal(d), the function
14732 cimag(ld) cimagl(ld)
14733 fabs(fc) cabsf(fc)
14734 carg(dc) carg(dc), the function
14735 cproj(ldc) cprojl(ldc)
14737 [<a name="p375" href="#p375">page 375</a>] (<a href="#Contents">Contents</a>)
14739 <a name="7.26" href="#7.26"><b> 7.26 Threads &lt;threads.h&gt;</b></a>
14740 <a name="7.26.1" href="#7.26.1"><b> 7.26.1 Introduction</b></a>
14741 1 The header <a href="#7.26">&lt;threads.h&gt;</a> includes the header <a href="#7.27">&lt;time.h&gt;</a>, defines macros, and
14742 declares types, enumeration constants, and functions that support multiple threads of
14743 execution.<sup><a href="#note315"><b>315)</b></a></sup>
14744 2 Implementations that define the macro __STDC_NO_THREADS__ need not provide
14745 this header nor support any of its facilities.
14746 3 The macros are
14747 thread_local
14748 which expands to _Thread_local;
14749 ONCE_FLAG_INIT
14750 which expands to a value that can be used to initialize an object of type once_flag;
14752 TSS_DTOR_ITERATIONS
14753 which expands to an integer constant expression representing the maximum number of
14754 times that destructors will be called when a thread terminates.
14755 4 The types are
14756 cnd_t
14757 which is a complete object type that holds an identifier for a condition variable;
14758 thrd_t
14759 which is a complete object type that holds an identifier for a thread;
14760 tss_t
14761 which is a complete object type that holds an identifier for a thread-specific storage
14762 pointer;
14763 mtx_t
14764 which is a complete object type that holds an identifier for a mutex;
14765 tss_dtor_t
14766 which is the function pointer type void (*)(void*), used for a destructor for a
14767 thread-specific storage pointer;
14771 <sup><a name="note315" href="#note315"><b>315)</b></a></sup> See ''future library directions'' (<a href="#7.31.15">7.31.15</a>).
14773 [<a name="p376" href="#p376">page 376</a>] (<a href="#Contents">Contents</a>)
14775 thrd_start_t
14776 which is the function pointer type int (*)(void*) that is passed to thrd_create
14777 to create a new thread; and
14778 once_flag
14779 which is a complete object type that holds a flag for use by call_once.
14780 5 The enumeration constants are
14781 mtx_plain
14782 which is passed to mtx_init to create a mutex object that supports neither timeout nor
14783 test and return;
14784 mtx_recursive
14785 which is passed to mtx_init to create a mutex object that supports recursive locking;
14786 mtx_timed
14787 which is passed to mtx_init to create a mutex object that supports timeout;
14788 thrd_timedout
14789 which is returned by a timed wait function to indicate that the time specified in the call
14790 was reached without acquiring the requested resource;
14791 thrd_success
14792 which is returned by a function to indicate that the requested operation succeeded;
14793 thrd_busy
14794 which is returned by a function to indicate that the requested operation failed because a
14795 resource requested by a test and return function is already in use;
14796 thrd_error
14797 which is returned by a function to indicate that the requested operation failed; and
14798 thrd_nomem
14799 which is returned by a function to indicate that the requested operation failed because it
14800 was unable to allocate memory.
14801 Forward references: date and time (<a href="#7.27">7.27</a>).
14803 [<a name="p377" href="#p377">page 377</a>] (<a href="#Contents">Contents</a>)
14805 <a name="7.26.2" href="#7.26.2"><b> 7.26.2 Initialization functions</b></a>
14806 <a name="7.26.2.1" href="#7.26.2.1"><b> 7.26.2.1 The call_once function</b></a>
14807 <b> Synopsis</b>
14808 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14809 void call_once(once_flag *flag, void (*func)(void));
14810 <b> Description</b>
14811 2 The call_once function uses the once_flag pointed to by flag to ensure that
14812 func is called exactly once, the first time the call_once function is called with that
14813 value of flag. Completion of an effective call to the call_once function synchronizes
14814 with all subsequent calls to the call_once function with the same value of flag.
14815 <b> Returns</b>
14816 3 The call_once function returns no value.
14817 <a name="7.26.3" href="#7.26.3"><b> 7.26.3 Condition variable functions</b></a>
14818 <a name="7.26.3.1" href="#7.26.3.1"><b> 7.26.3.1 The cnd_broadcast function</b></a>
14819 <b> Synopsis</b>
14820 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14821 int cnd_broadcast(cnd_t *cond);
14822 <b> Description</b>
14823 2 The cnd_broadcast function unblocks all of the threads that are blocked on the
14824 condition variable pointed to by cond at the time of the call. If no threads are blocked
14825 on the condition variable pointed to by cond at the time of the call, the function does
14826 nothing.
14827 <b> Returns</b>
14828 3 The cnd_broadcast function returns thrd_success on success, or thrd_error
14829 if the request could not be honored.
14830 <a name="7.26.3.2" href="#7.26.3.2"><b> 7.26.3.2 The cnd_destroy function</b></a>
14831 <b> Synopsis</b>
14832 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14833 void cnd_destroy(cnd_t *cond);
14834 <b> Description</b>
14835 2 The cnd_destroy function releases all resources used by the condition variable
14836 pointed to by cond. The cnd_destroy function requires that no threads be blocked
14837 waiting for the condition variable pointed to by cond.
14839 [<a name="p378" href="#p378">page 378</a>] (<a href="#Contents">Contents</a>)
14841 <b> Returns</b>
14842 3 The cnd_destroy function returns no value.
14843 <a name="7.26.3.3" href="#7.26.3.3"><b> 7.26.3.3 The cnd_init function</b></a>
14844 <b> Synopsis</b>
14845 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14846 int cnd_init(cnd_t *cond);
14847 <b> Description</b>
14848 2 The cnd_init function creates a condition variable. If it succeeds it sets the variable
14849 pointed to by cond to a value that uniquely identifies the newly created condition
14850 variable. A thread that calls cnd_wait on a newly created condition variable will
14851 block.
14852 <b> Returns</b>
14853 3 The cnd_init function returns thrd_success on success, or thrd_nomem if no
14854 memory could be allocated for the newly created condition, or thrd_error if the
14855 request could not be honored.
14856 <a name="7.26.3.4" href="#7.26.3.4"><b> 7.26.3.4 The cnd_signal function</b></a>
14857 <b> Synopsis</b>
14858 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14859 int cnd_signal(cnd_t *cond);
14860 <b> Description</b>
14861 2 The cnd_signal function unblocks one of the threads that are blocked on the
14862 condition variable pointed to by cond at the time of the call. If no threads are blocked
14863 on the condition variable at the time of the call, the function does nothing and return
14864 success.
14865 <b> Returns</b>
14866 3 The cnd_signal function returns thrd_success on success or thrd_error if
14867 the request could not be honored.
14868 <a name="7.26.3.5" href="#7.26.3.5"><b> 7.26.3.5 The cnd_timedwait function</b></a>
14869 <b> Synopsis</b>
14870 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14871 int cnd_timedwait(cnd_t *restrict cond,
14872 mtx_t *restrict mtx,
14873 const struct timespec *restrict ts);
14875 [<a name="p379" href="#p379">page 379</a>] (<a href="#Contents">Contents</a>)
14877 <b> Description</b>
14878 2 The cnd_timedwait function atomically unlocks the mutex pointed to by mtx and
14879 endeavors to block until the condition variable pointed to by cond is signaled by a call to
14880 cnd_signal or to cnd_broadcast, or until after the TIME_UTC-based calendar
14881 time pointed to by ts. When the calling thread becomes unblocked it locks the variable
14882 pointed to by mtx before it returns. The cnd_timedwait function requires that the
14883 mutex pointed to by mtx be locked by the calling thread.
14884 <b> Returns</b>
14885 3 The cnd_timedwait function returns thrd_success upon success, or
14886 thrd_timedout if the time specified in the call was reached without acquiring the
14887 requested resource, or thrd_error if the request could not be honored.
14888 <a name="7.26.3.6" href="#7.26.3.6"><b> 7.26.3.6 The cnd_wait function</b></a>
14889 <b> Synopsis</b>
14890 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14891 int cnd_wait(cnd_t *cond, mtx_t *mtx);
14892 <b> Description</b>
14893 2 The cnd_wait function atomically unlocks the mutex pointed to by mtx and endeavors
14894 to block until the condition variable pointed to by cond is signaled by a call to
14895 cnd_signal or to cnd_broadcast. When the calling thread becomes unblocked it
14896 locks the mutex pointed to by mtx before it returns. The cnd_wait function requires
14897 that the mutex pointed to by mtx be locked by the calling thread.
14898 <b> Returns</b>
14899 3 The cnd_wait function returns thrd_success on success or thrd_error if the
14900 request could not be honored.
14901 <a name="7.26.4" href="#7.26.4"><b> 7.26.4 Mutex functions</b></a>
14902 <a name="7.26.4.1" href="#7.26.4.1"><b> 7.26.4.1 The mtx_destroy function</b></a>
14903 <b> Synopsis</b>
14904 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14905 void mtx_destroy(mtx_t *mtx);
14906 <b> Description</b>
14907 2 The mtx_destroy function releases any resources used by the mutex pointed to by
14908 mtx. No threads can be blocked waiting for the mutex pointed to by mtx.
14909 <b> Returns</b>
14910 3 The mtx_destroy function returns no value.
14912 [<a name="p380" href="#p380">page 380</a>] (<a href="#Contents">Contents</a>)
14914 <a name="7.26.4.2" href="#7.26.4.2"><b> 7.26.4.2 The mtx_init function</b></a>
14915 <b> Synopsis</b>
14916 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14917 int mtx_init(mtx_t *mtx, int type);
14918 <b> Description</b>
14919 2 The mtx_init function creates a mutex object with properties indicated by type,
14920 which must have one of the six values:
14921 mtx_plain for a simple non-recursive mutex,
14922 mtx_timed for a non-recursive mutex that supports timeout, *
14923 mtx_plain | mtx_recursive for a simple recursive mutex, or
14924 mtx_timed | mtx_recursive for a recursive mutex that supports timeout.
14925 3 If the mtx_init function succeeds, it sets the mutex pointed to by mtx to a value that
14926 uniquely identifies the newly created mutex.
14927 <b> Returns</b>
14928 4 The mtx_init function returns thrd_success on success, or thrd_error if the
14929 request could not be honored.
14930 <a name="7.26.4.3" href="#7.26.4.3"><b> 7.26.4.3 The mtx_lock function</b></a>
14931 <b> Synopsis</b>
14932 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14933 int mtx_lock(mtx_t *mtx);
14934 <b> Description</b>
14935 2 The mtx_lock function blocks until it locks the mutex pointed to by mtx. If the mutex
14936 is non-recursive, it shall not be locked by the calling thread. Prior calls to mtx_unlock
14937 on the same mutex shall synchronize with this operation.
14938 <b> Returns</b>
14939 3 The mtx_lock function returns thrd_success on success, or thrd_error if the *
14940 request could not be honored.
14941 <a name="7.26.4.4" href="#7.26.4.4"><b> 7.26.4.4 The mtx_timedlock function</b></a>
14942 <b> Synopsis</b>
14943 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14944 int mtx_timedlock(mtx_t *restrict mtx,
14945 const struct timespec *restrict ts);
14947 [<a name="p381" href="#p381">page 381</a>] (<a href="#Contents">Contents</a>)
14949 <b> Description</b>
14950 2 The mtx_timedlock function endeavors to block until it locks the mutex pointed to by
14951 mtx or until after the TIME_UTC-based calendar time pointed to by ts. The specified
14952 mutex shall support timeout. If the operation succeeds, prior calls to mtx_unlock on
14953 the same mutex shall synchronize with this operation.
14954 <b> Returns</b>
14955 3 The mtx_timedlock function returns thrd_success on success, or
14956 thrd_timedout if the time specified was reached without acquiring the requested
14957 resource, or thrd_error if the request could not be honored.
14958 <a name="7.26.4.5" href="#7.26.4.5"><b> 7.26.4.5 The mtx_trylock function</b></a>
14959 <b> Synopsis</b>
14960 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14961 int mtx_trylock(mtx_t *mtx);
14962 <b> Description</b>
14963 2 The mtx_trylock function endeavors to lock the mutex pointed to by mtx. If the *
14964 mutex is already locked, the function returns without blocking. If the operation succeeds,
14965 prior calls to mtx_unlock on the same mutex shall synchronize with this operation.
14966 <b> Returns</b>
14967 3 The mtx_trylock function returns thrd_success on success, or thrd_busy if
14968 the resource requested is already in use, or thrd_error if the request could not be
14969 honored.
14970 <a name="7.26.4.6" href="#7.26.4.6"><b> 7.26.4.6 The mtx_unlock function</b></a>
14971 <b> Synopsis</b>
14972 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14973 int mtx_unlock(mtx_t *mtx);
14974 <b> Description</b>
14975 2 The mtx_unlock function unlocks the mutex pointed to by mtx. The mutex pointed to
14976 by mtx shall be locked by the calling thread.
14977 <b> Returns</b>
14978 3 The mtx_unlock function returns thrd_success on success or thrd_error if
14979 the request could not be honored.
14981 [<a name="p382" href="#p382">page 382</a>] (<a href="#Contents">Contents</a>)
14983 <a name="7.26.5" href="#7.26.5"><b> 7.26.5 Thread functions</b></a>
14984 <a name="7.26.5.1" href="#7.26.5.1"><b> 7.26.5.1 The thrd_create function</b></a>
14985 <b> Synopsis</b>
14986 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
14987 int thrd_create(thrd_t *thr, thrd_start_t func,
14988 void *arg);
14989 <b> Description</b>
14990 2 The thrd_create function creates a new thread executing func(arg). If the
14991 thrd_create function succeeds, it sets the object pointed to by thr to the identifier of
14992 the newly created thread. (A thread's identifier may be reused for a different thread once
14993 the original thread has exited and either been detached or joined to another thread.) The
14994 completion of the thrd_create function synchronizes with the beginning of the
14995 execution of the new thread.
14996 <b> Returns</b>
14997 3 The thrd_create function returns thrd_success on success, or thrd_nomem if
14998 no memory could be allocated for the thread requested, or thrd_error if the request
14999 could not be honored.
15000 <a name="7.26.5.2" href="#7.26.5.2"><b> 7.26.5.2 The thrd_current function</b></a>
15001 <b> Synopsis</b>
15002 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15003 thrd_t thrd_current(void);
15004 <b> Description</b>
15005 2 The thrd_current function identifies the thread that called it.
15006 <b> Returns</b>
15007 3 The thrd_current function returns the identifier of the thread that called it.
15008 <a name="7.26.5.3" href="#7.26.5.3"><b> 7.26.5.3 The thrd_detach function</b></a>
15009 <b> Synopsis</b>
15010 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15011 int thrd_detach(thrd_t thr);
15012 <b> Description</b>
15013 2 The thrd_detach function tells the operating system to dispose of any resources
15014 allocated to the thread identified by thr when that thread terminates. The thread
15015 identified by thr shall not have been previously detached or joined with another thread.
15017 [<a name="p383" href="#p383">page 383</a>] (<a href="#Contents">Contents</a>)
15019 <b> Returns</b>
15020 3 The thrd_detach function returns thrd_success on success or thrd_error if
15021 the request could not be honored.
15022 <a name="7.26.5.4" href="#7.26.5.4"><b> 7.26.5.4 The thrd_equal function</b></a>
15023 <b> Synopsis</b>
15024 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15025 int thrd_equal(thrd_t thr0, thrd_t thr1);
15026 <b> Description</b>
15027 2 The thrd_equal function will determine whether the thread identified by thr0 refers
15028 to the thread identified by thr1.
15029 <b> Returns</b>
15030 3 The thrd_equal function returns zero if the thread thr0 and the thread thr1 refer to
15031 different threads. Otherwise the thrd_equal function returns a nonzero value.
15032 <a name="7.26.5.5" href="#7.26.5.5"><b> 7.26.5.5 The thrd_exit function</b></a>
15033 <b> Synopsis</b>
15034 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15035 _Noreturn void thrd_exit(int res);
15036 <b> Description</b>
15037 2 The thrd_exit function terminates execution of the calling thread and sets its result
15038 code to res.
15039 3 The program shall terminate normally after the last thread has been terminated. The
15040 behavior shall be as if the program called the exit function with the status
15041 EXIT_SUCCESS at thread termination time.
15042 <b> Returns</b>
15043 4 The thrd_exit function returns no value.
15044 <a name="7.26.5.6" href="#7.26.5.6"><b> 7.26.5.6 The thrd_join function</b></a>
15045 <b> Synopsis</b>
15046 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15047 int thrd_join(thrd_t thr, int *res);
15048 <b> Description</b>
15049 2 The thrd_join function joins the thread identified by thr with the current thread by
15050 blocking until the other thread has terminated. If the parameter res is not a null pointer,
15051 it stores the thread's result code in the integer pointed to by res. The termination of the
15053 [<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
15055 other thread synchronizes with the completion of the thrd_join function. The thread
15056 identified by thr shall not have been previously detached or joined with another thread.
15057 <b> Returns</b>
15058 3 The thrd_join function returns thrd_success on success or thrd_error if the
15059 request could not be honored.
15060 <a name="7.26.5.7" href="#7.26.5.7"><b> 7.26.5.7 The thrd_sleep function</b></a>
15061 <b> Synopsis</b>
15062 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15063 int thrd_sleep(const struct timespec *duration,
15064 struct timespec *remaining);
15065 <b> Description</b>
15066 2 The thrd_sleep function suspends execution of the calling thread until either the
15067 interval specified by duration has elapsed or a signal which is not being ignored is
15068 received. If interrupted by a signal and the remaining argument is not null, the
15069 amount of time remaining (the requested interval minus the time actually slept) is stored
15070 in the interval it points to. The duration and remaining arguments may point to the
15071 same object.
15072 3 The suspension time may be longer than requested because the interval is rounded up to
15073 an integer multiple of the sleep resolution or because of the scheduling of other activity
15074 by the system. But, except for the case of being interrupted by a signal, the suspension
15075 time shall not be less than that specified, as measured by the system clock TIME_UTC.
15076 <b> Returns</b>
15077 4 The thrd_sleep function returns zero if the requested time has elapsed, -1 if it has
15078 been interrupted by a signal, or a negative value if it fails.
15079 <a name="7.26.5.8" href="#7.26.5.8"><b> 7.26.5.8 The thrd_yield function</b></a>
15080 <b> Synopsis</b>
15081 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15082 void thrd_yield(void);
15083 <b> Description</b>
15084 2 The thrd_yield function endeavors to permit other threads to run, even if the current
15085 thread would ordinarily continue to run.
15086 <b> Returns</b>
15087 3 The thrd_yield function returns no value.
15089 [<a name="p385" href="#p385">page 385</a>] (<a href="#Contents">Contents</a>)
15091 <a name="7.26.6" href="#7.26.6"><b> 7.26.6 Thread-specific storage functions</b></a>
15092 <a name="7.26.6.1" href="#7.26.6.1"><b> 7.26.6.1 The tss_create function</b></a>
15093 <b> Synopsis</b>
15094 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15095 int tss_create(tss_t *key, tss_dtor_t dtor);
15096 <b> Description</b>
15097 2 The tss_create function creates a thread-specific storage pointer with destructor
15098 dtor, which may be null.
15099 <b> Returns</b>
15100 3 If the tss_create function is successful, it sets the thread-specific storage pointed to
15101 by key to a value that uniquely identifies the newly created pointer and returns
15102 thrd_success; otherwise, thrd_error is returned and the thread-specific storage
15103 pointed to by key is set to an undefined value.
15104 <a name="7.26.6.2" href="#7.26.6.2"><b> 7.26.6.2 The tss_delete function</b></a>
15105 <b> Synopsis</b>
15106 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15107 void tss_delete(tss_t key);
15108 <b> Description</b>
15109 2 The tss_delete function releases any resources used by the thread-specific storage
15110 identified by key.
15111 <b> Returns</b>
15112 3 The tss_delete function returns no value.
15113 <a name="7.26.6.3" href="#7.26.6.3"><b> 7.26.6.3 The tss_get function</b></a>
15114 <b> Synopsis</b>
15115 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15116 void *tss_get(tss_t key);
15117 <b> Description</b>
15118 2 The tss_get function returns the value for the current thread held in the thread-specific
15119 storage identified by key.
15120 <b> Returns</b>
15121 3 The tss_get function returns the value for the current thread if successful, or zero if
15122 unsuccessful.
15124 [<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
15126 <a name="7.26.6.4" href="#7.26.6.4"><b> 7.26.6.4 The tss_set function</b></a>
15127 <b> Synopsis</b>
15128 1 #include <a href="#7.26">&lt;threads.h&gt;</a>
15129 int tss_set(tss_t key, void *val);
15130 <b> Description</b>
15131 2 The tss_set function sets the value for the current thread held in the thread-specific
15132 storage identified by key to val.
15133 <b> Returns</b>
15134 3 The tss_set function returns thrd_success on success or thrd_error if the
15135 request could not be honored. *
15137 [<a name="p387" href="#p387">page 387</a>] (<a href="#Contents">Contents</a>)
15139 <a name="7.27" href="#7.27"><b> 7.27 Date and time &lt;time.h&gt;</b></a>
15140 <a name="7.27.1" href="#7.27.1"><b> 7.27.1 Components of time</b></a>
15141 1 The header <a href="#7.27">&lt;time.h&gt;</a> defines two macros, and declares several types and functions for
15142 manipulating time. Many functions deal with a calendar time that represents the current
15143 date (according to the Gregorian calendar) and time. Some functions deal with local
15144 time, which is the calendar time expressed for some specific time zone, and with Daylight
15145 Saving Time, which is a temporary change in the algorithm for determining local time.
15146 The local time zone and Daylight Saving Time are implementation-defined.
15147 2 The macros defined are NULL (described in <a href="#7.19">7.19</a>); *
15148 CLOCKS_PER_SEC
15149 which expands to an expression with type clock_t (described below) that is the
15150 number per second of the value returned by the clock function; and
15151 TIME_UTC
15152 which expands to an integer constant greater than 0 that designates the UTC time
15153 base.<sup><a href="#note316"><b>316)</b></a></sup>
15154 3 The types declared are size_t (described in <a href="#7.19">7.19</a>);
15155 clock_t
15157 time_t
15158 which are real types capable of representing times;
15159 struct timespec
15160 which holds an interval specified in seconds and nanoseconds (which may represent a
15161 calendar time based on a particular epoch); and
15162 struct tm
15163 which holds the components of a calendar time, called the broken-down time.
15164 4 The range and precision of times representable in clock_t and time_t are
15165 implementation-defined. The timespec structure shall contain at least the following
15166 members, in any order.<sup><a href="#note317"><b>317)</b></a></sup>
15170 <sup><a name="note316" href="#note316"><b>316)</b></a></sup> Implementations may define additional time bases, but are only required to support a real time clock
15171 based on UTC.
15172 <sup><a name="note317" href="#note317"><b>317)</b></a></sup> The tv_sec member is a linear count of seconds and may not have the normal semantics of a
15173 time_t. The semantics of the members and their normal ranges are expressed in the comments.
15175 [<a name="p388" href="#p388">page 388</a>] (<a href="#Contents">Contents</a>)
15177 time_t tv_sec; // whole seconds -- &gt;= 0
15178 long tv_nsec; // nanoseconds -- [0, 999999999]
15179 The tm structure shall contain at least the following members, in any order. The
15180 semantics of the members and their normal ranges are expressed in the comments.<sup><a href="#note318"><b>318)</b></a></sup>
15181 int tm_sec; // seconds after the minute -- [0, 60]
15182 int tm_min; // minutes after the hour -- [0, 59]
15183 int tm_hour; // hours since midnight -- [0, 23]
15184 int tm_mday; // day of the month -- [1, 31]
15185 int tm_mon; // months since January -- [0, 11]
15186 int tm_year; // years since 1900
15187 int tm_wday; // days since Sunday -- [0, 6]
15188 int tm_yday; // days since January 1 -- [0, 365]
15189 int tm_isdst; // Daylight Saving Time flag
15190 The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
15191 Saving Time is not in effect, and negative if the information is not available.
15192 <a name="7.27.2" href="#7.27.2"><b> 7.27.2 Time manipulation functions</b></a>
15193 <a name="7.27.2.1" href="#7.27.2.1"><b> 7.27.2.1 The clock function</b></a>
15194 <b> Synopsis</b>
15195 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15196 clock_t clock(void);
15197 <b> Description</b>
15198 2 The clock function determines the processor time used.
15199 <b> Returns</b>
15200 3 The clock function returns the implementation's best approximation to the processor
15201 time used by the program since the beginning of an implementation-defined era related
15202 only to the program invocation. To determine the time in seconds, the value returned by
15203 the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
15204 the processor time used is not available or its value cannot be represented, the function
15205 returns the value (clock_t)(-1).<sup><a href="#note319"><b>319)</b></a></sup>
15210 <sup><a name="note318" href="#note318"><b>318)</b></a></sup> The range [0, 60] for tm_sec allows for a positive leap second.
15211 <sup><a name="note319" href="#note319"><b>319)</b></a></sup> In order to measure the time spent in a program, the clock function should be called at the start of
15212 the program and its return value subtracted from the value returned by subsequent calls.
15214 [<a name="p389" href="#p389">page 389</a>] (<a href="#Contents">Contents</a>)
15216 <a name="7.27.2.2" href="#7.27.2.2"><b> 7.27.2.2 The difftime function</b></a>
15217 <b> Synopsis</b>
15218 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15219 double difftime(time_t time1, time_t time0);
15220 <b> Description</b>
15221 2 The difftime function computes the difference between two calendar times: time1 -
15222 time0.
15223 <b> Returns</b>
15224 3 The difftime function returns the difference expressed in seconds as a double.
15225 <a name="7.27.2.3" href="#7.27.2.3"><b> 7.27.2.3 The mktime function</b></a>
15226 <b> Synopsis</b>
15227 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15228 time_t mktime(struct tm *timeptr);
15229 <b> Description</b>
15230 2 The mktime function converts the broken-down time, expressed as local time, in the
15231 structure pointed to by timeptr into a calendar time value with the same encoding as
15232 that of the values returned by the time function. The original values of the tm_wday
15233 and tm_yday components of the structure are ignored, and the original values of the
15234 other components are not restricted to the ranges indicated above.<sup><a href="#note320"><b>320)</b></a></sup> On successful
15235 completion, the values of the tm_wday and tm_yday components of the structure are
15236 set appropriately, and the other components are set to represent the specified calendar
15237 time, but with their values forced to the ranges indicated above; the final value of
15238 tm_mday is not set until tm_mon and tm_year are determined.
15239 <b> Returns</b>
15240 3 The mktime function returns the specified calendar time encoded as a value of type
15241 time_t. If the calendar time cannot be represented, the function returns the value
15242 (time_t)(-1).
15243 4 EXAMPLE What day of the week is July 4, 2001?
15248 <sup><a name="note320" href="#note320"><b>320)</b></a></sup> Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
15249 Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
15250 causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
15252 [<a name="p390" href="#p390">page 390</a>] (<a href="#Contents">Contents</a>)
15254 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15255 #include <a href="#7.27">&lt;time.h&gt;</a>
15256 static const char *const wday[] = {
15257 "Sunday", "Monday", "Tuesday", "Wednesday",
15258 "Thursday", "Friday", "Saturday", "-unknown-"
15260 struct tm time_str;
15261 /* ... */
15262 time_str.tm_year = 2001 - 1900;
15263 time_str.tm_mon = 7 - 1;
15264 time_str.tm_mday = 4;
15265 time_str.tm_hour = 0;
15266 time_str.tm_min = 0;
15267 time_str.tm_sec = 1;
15268 time_str.tm_isdst = -1;
15269 if (mktime(&amp;time_str) == (time_t)(-1))
15270 time_str.tm_wday = 7;
15271 printf("%s\n", wday[time_str.tm_wday]);
15273 <a name="7.27.2.4" href="#7.27.2.4"><b> 7.27.2.4 The time function</b></a>
15274 <b> Synopsis</b>
15275 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15276 time_t time(time_t *timer);
15277 <b> Description</b>
15278 2 The time function determines the current calendar time. The encoding of the value is
15279 unspecified.
15280 <b> Returns</b>
15281 3 The time function returns the implementation's best approximation to the current
15282 calendar time. The value (time_t)(-1) is returned if the calendar time is not
15283 available. If timer is not a null pointer, the return value is also assigned to the object it
15284 points to.
15285 <a name="7.27.2.5" href="#7.27.2.5"><b> 7.27.2.5 The timespec_get function</b></a>
15286 <b> Synopsis</b>
15287 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15288 int timespec_get(struct timespec *ts, int base);
15289 <b> Description</b>
15290 2 The timespec_get function sets the interval pointed to by ts to hold the current
15291 calendar time based on the specified time base.
15292 3 If base is TIME_UTC, the tv_sec member is set to the number of seconds since an
15293 implementation defined epoch, truncated to a whole value and the tv_nsec member is
15294 set to the integral number of nanoseconds, rounded to the resolution of the system
15296 [<a name="p391" href="#p391">page 391</a>] (<a href="#Contents">Contents</a>)
15298 clock.<sup><a href="#note321"><b>321)</b></a></sup>
15299 <b> Returns</b>
15300 4 If the timespec_get function is successful it returns the nonzero value base;
15301 otherwise, it returns zero.
15302 <a name="7.27.3" href="#7.27.3"><b> 7.27.3 Time conversion functions</b></a>
15303 1 Except for the strftime function, these functions each return a pointer to one of two
15304 types of static objects: a broken-down time structure or an array of char. Execution of
15305 any of the functions that return a pointer to one of these object types may overwrite the
15306 information in any object of the same type pointed to by the value returned from any
15307 previous call to any of them and the functions are not required to avoid data races with
15308 each other.<sup><a href="#note322"><b>322)</b></a></sup> The implementation shall behave as if no other library functions call these
15309 functions.
15310 <a name="7.27.3.1" href="#7.27.3.1"><b> 7.27.3.1 The asctime function</b></a>
15311 <b> Synopsis</b>
15312 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15313 char *asctime(const struct tm *timeptr);
15314 <b> Description</b>
15315 2 The asctime function converts the broken-down time in the structure pointed to by
15316 timeptr into a string in the form
15317 Sun Sep 16 01:03:52 1973\n\0
15318 using the equivalent of the following algorithm.
15319 char *asctime(const struct tm *timeptr)
15321 static const char wday_name[7][3] = {
15322 "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
15324 static const char mon_name[12][3] = {
15325 "Jan", "Feb", "Mar", "Apr", "May", "Jun",
15326 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
15328 static char result[26];
15332 <sup><a name="note321" href="#note321"><b>321)</b></a></sup> Although a struct timespec object describes times with nanosecond resolution, the available
15333 resolution is system dependent and may even be greater than 1 second.
15334 <sup><a name="note322" href="#note322"><b>322)</b></a></sup> Alternative time conversion functions that do avoid data races are specified in <a href="#K.3.8.2">K.3.8.2</a>.
15336 [<a name="p392" href="#p392">page 392</a>] (<a href="#Contents">Contents</a>)
15338 sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
15339 wday_name[timeptr-&gt;tm_wday],
15340 mon_name[timeptr-&gt;tm_mon],
15341 timeptr-&gt;tm_mday, timeptr-&gt;tm_hour,
15342 timeptr-&gt;tm_min, timeptr-&gt;tm_sec,
15343 1900 + timeptr-&gt;tm_year);
15344 return result;
15346 3 If any of the members of the broken-down time contain values that are outside their
15347 normal ranges,<sup><a href="#note323"><b>323)</b></a></sup> the behavior of the asctime function is undefined. Likewise, if the
15348 calculated year exceeds four digits or is less than the year 1000, the behavior is
15349 undefined.
15350 <b> Returns</b>
15351 4 The asctime function returns a pointer to the string.
15352 <a name="7.27.3.2" href="#7.27.3.2"><b> 7.27.3.2 The ctime function</b></a>
15353 <b> Synopsis</b>
15354 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15355 char *ctime(const time_t *timer);
15356 <b> Description</b>
15357 2 The ctime function converts the calendar time pointed to by timer to local time in the
15358 form of a string. It is equivalent to
15359 asctime(localtime(timer))
15360 <b> Returns</b>
15361 3 The ctime function returns the pointer returned by the asctime function with that
15362 broken-down time as argument.
15363 Forward references: the localtime function (<a href="#7.27.3.4">7.27.3.4</a>).
15364 <a name="7.27.3.3" href="#7.27.3.3"><b> 7.27.3.3 The gmtime function</b></a>
15365 <b> Synopsis</b>
15366 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15367 struct tm *gmtime(const time_t *timer);
15372 <sup><a name="note323" href="#note323"><b>323)</b></a></sup> See <a href="#7.27.1">7.27.1</a>.
15374 [<a name="p393" href="#p393">page 393</a>] (<a href="#Contents">Contents</a>)
15376 <b> Description</b>
15377 2 The gmtime function converts the calendar time pointed to by timer into a broken-
15378 down time, expressed as UTC.
15379 <b> Returns</b>
15380 3 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
15381 specified time cannot be converted to UTC.
15382 <a name="7.27.3.4" href="#7.27.3.4"><b> 7.27.3.4 The localtime function</b></a>
15383 <b> Synopsis</b>
15384 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15385 struct tm *localtime(const time_t *timer);
15386 <b> Description</b>
15387 2 The localtime function converts the calendar time pointed to by timer into a
15388 broken-down time, expressed as local time.
15389 <b> Returns</b>
15390 3 The localtime function returns a pointer to the broken-down time, or a null pointer if
15391 the specified time cannot be converted to local time.
15392 <a name="7.27.3.5" href="#7.27.3.5"><b> 7.27.3.5 The strftime function</b></a>
15393 <b> Synopsis</b>
15394 1 #include <a href="#7.27">&lt;time.h&gt;</a>
15395 size_t strftime(char * restrict s,
15396 size_t maxsize,
15397 const char * restrict format,
15398 const struct tm * restrict timeptr);
15399 <b> Description</b>
15400 2 The strftime function places characters into the array pointed to by s as controlled by
15401 the string pointed to by format. The format shall be a multibyte character sequence,
15402 beginning and ending in its initial shift state. The format string consists of zero or
15403 more conversion specifiers and ordinary multibyte characters. A conversion specifier
15404 consists of a % character, possibly followed by an E or O modifier character (described
15405 below), followed by a character that determines the behavior of the conversion specifier.
15406 All ordinary multibyte characters (including the terminating null character) are copied
15407 unchanged into the array. If copying takes place between objects that overlap, the
15408 behavior is undefined. No more than maxsize characters are placed into the array.
15409 3 Each conversion specifier is replaced by appropriate characters as described in the
15410 following list. The appropriate characters are determined using the LC_TIME category
15412 [<a name="p394" href="#p394">page 394</a>] (<a href="#Contents">Contents</a>)
15414 of the current locale and by the values of zero or more members of the broken-down time
15415 structure pointed to by timeptr, as specified in brackets in the description. If any of
15416 the specified values is outside the normal range, the characters stored are unspecified.
15417 %a is replaced by the locale's abbreviated weekday name. [tm_wday]
15418 %A is replaced by the locale's full weekday name. [tm_wday]
15419 %b is replaced by the locale's abbreviated month name. [tm_mon]
15420 %B is replaced by the locale's full month name. [tm_mon]
15421 %c is replaced by the locale's appropriate date and time representation. [all specified
15422 in <a href="#7.27.1">7.27.1</a>]
15423 %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
15424 number (00-99). [tm_year]
15425 %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
15426 %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
15427 %e is replaced by the day of the month as a decimal number (1-31); a single digit is
15428 preceded by a space. [tm_mday]
15429 %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
15430 tm_mday]
15431 %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
15432 number (00-99). [tm_year, tm_wday, tm_yday]
15433 %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
15434 [tm_year, tm_wday, tm_yday]
15435 %h is equivalent to ''%b''. [tm_mon]
15436 %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
15437 %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
15438 %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
15439 %m is replaced by the month as a decimal number (01-12). [tm_mon]
15440 %M is replaced by the minute as a decimal number (00-59). [tm_min]
15441 %n is replaced by a new-line character.
15442 %p is replaced by the locale's equivalent of the AM/PM designations associated with a
15443 12-hour clock. [tm_hour]
15444 %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
15445 %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
15446 %S is replaced by the second as a decimal number (00-60). [tm_sec]
15447 %t is replaced by a horizontal-tab character.
15448 %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
15449 tm_sec]
15450 %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
15451 is 1. [tm_wday]
15452 %U is replaced by the week number of the year (the first Sunday as the first day of week
15453 <sup><a name="note1" href="#note1"><b>1)</b></a></sup> as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
15454 %V is replaced by the ISO 8601 week number (see below) as a decimal number
15456 [<a name="p395" href="#p395">page 395</a>] (<a href="#Contents">Contents</a>)
15458 (01-53). [tm_year, tm_wday, tm_yday]
15459 %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
15460 [tm_wday]
15461 %W is replaced by the week number of the year (the first Monday as the first day of
15462 week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
15463 %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.27.1">7.27.1</a>]
15464 %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.27.1">7.27.1</a>]
15465 %y is replaced by the last 2 digits of the year as a decimal number (00-99).
15466 [tm_year]
15467 %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
15468 %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
15469 hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
15470 zone is determinable. [tm_isdst]
15471 %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
15472 time zone is determinable. [tm_isdst]
15473 %% is replaced by %.
15474 4 Some conversion specifiers can be modified by the inclusion of an E or O modifier
15475 character to indicate an alternative format or specification. If the alternative format or
15476 specification does not exist for the current locale, the modifier is ignored.
15477 %Ec is replaced by the locale's alternative date and time representation.
15478 %EC is replaced by the name of the base year (period) in the locale's alternative
15479 representation.
15480 %Ex is replaced by the locale's alternative date representation.
15481 %EX is replaced by the locale's alternative time representation.
15482 %Ey is replaced by the offset from %EC (year only) in the locale's alternative
15483 representation.
15484 %EY is replaced by the locale's full alternative year representation.
15485 %Od is replaced by the day of the month, using the locale's alternative numeric symbols
15486 (filled as needed with leading zeros, or with leading spaces if there is no alternative
15487 symbol for zero).
15488 %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
15489 (filled as needed with leading spaces).
15490 %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
15491 symbols.
15492 %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
15493 symbols.
15494 %Om is replaced by the month, using the locale's alternative numeric symbols.
15495 %OM is replaced by the minutes, using the locale's alternative numeric symbols.
15496 %OS is replaced by the seconds, using the locale's alternative numeric symbols.
15497 %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
15499 [<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
15501 representation, where Monday is 1.
15502 %OU is replaced by the week number, using the locale's alternative numeric symbols.
15503 %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
15504 symbols.
15505 %Ow is replaced by the weekday as a number, using the locale's alternative numeric
15506 symbols.
15507 %OW is replaced by the week number of the year, using the locale's alternative numeric
15508 symbols.
15509 %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
15510 symbols.
15511 5 %g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
15512 weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
15513 which is also the week that includes the first Thursday of the year, and is also the first
15514 week that contains at least four days in the year. If the first Monday of January is the
15515 2nd, 3rd, or 4th, the preceding days are part of the last week of the preceding year; thus,
15516 for Saturday 2nd January 1999, %G is replaced by 1998 and %V is replaced by 53. If
15517 December 29th, 30th, or 31st is a Monday, it and any following days are part of week 1 of
15518 the following year. Thus, for Tuesday 30th December 1997, %G is replaced by 1998 and
15519 %V is replaced by 01.
15520 6 If a conversion specifier is not one of the above, the behavior is undefined.
15521 7 In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
15522 following specifiers are:
15523 %a the first three characters of %A.
15524 %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
15525 %b the first three characters of %B.
15526 %B one of ''January'', ''February'', ... , ''December''.
15527 %c equivalent to ''%a %b %e %T %Y''.
15528 %p one of ''AM'' or ''PM''.
15529 %r equivalent to ''%I:%M:%S %p''.
15530 %x equivalent to ''%m/%d/%y''.
15531 %X equivalent to %T.
15532 %Z implementation-defined.
15533 <b> Returns</b>
15534 8 If the total number of resulting characters including the terminating null character is not
15535 more than maxsize, the strftime function returns the number of characters placed
15536 into the array pointed to by s not including the terminating null character. Otherwise,
15537 zero is returned and the contents of the array are indeterminate.
15539 [<a name="p397" href="#p397">page 397</a>] (<a href="#Contents">Contents</a>)
15541 <a name="7.28" href="#7.28"><b> 7.28 Unicode utilities &lt;uchar.h&gt;</b></a>
15542 1 The header <a href="#7.28">&lt;uchar.h&gt;</a> declares types and functions for manipulating Unicode
15543 characters.
15544 2 The types declared are mbstate_t (described in <a href="#7.30.1">7.30.1</a>) and size_t (described in
15545 <a name="7.19);" href="#7.19);"><b> 7.19);</b></a>
15546 char16_t
15547 which is an unsigned integer type used for 16-bit characters and is the same type as
15548 uint_least16_t (described in <a href="#7.20.1.2">7.20.1.2</a>); and
15549 char32_t
15550 which is an unsigned integer type used for 32-bit characters and is the same type as
15551 uint_least32_t (also described in <a href="#7.20.1.2">7.20.1.2</a>).
15552 <a name="7.28.1" href="#7.28.1"><b> 7.28.1 Restartable multibyte/wide character conversion functions</b></a>
15553 1 These functions have a parameter, ps, of type pointer to mbstate_t that points to an
15554 object that can completely describe the current conversion state of the associated
15555 multibyte character sequence, which the functions alter as necessary. If ps is a null
15556 pointer, each function uses its own internal mbstate_t object instead, which is
15557 initialized at program startup to the initial conversion state; the functions are not required
15558 to avoid data races with other calls to the same function in this case. The implementation
15559 behaves as if no library function calls these functions with a null pointer for ps.
15560 <a name="7.28.1.1" href="#7.28.1.1"><b> 7.28.1.1 The mbrtoc16 function</b></a>
15561 <b> Synopsis</b>
15562 1 #include <a href="#7.28">&lt;uchar.h&gt;</a>
15563 size_t mbrtoc16(char16_t * restrict pc16,
15564 const char * restrict s, size_t n,
15565 mbstate_t * restrict ps);
15566 <b> Description</b>
15567 2 If s is a null pointer, the mbrtoc16 function is equivalent to the call:
15568 mbrtoc16(NULL, "", 1, ps)
15569 In this case, the values of the parameters pc16 and n are ignored.
15570 3 If s is not a null pointer, the mbrtoc16 function inspects at most n bytes beginning with
15571 the byte pointed to by s to determine the number of bytes needed to complete the next
15572 multibyte character (including any shift sequences). If the function determines that the
15573 next multibyte character is complete and valid, it determines the values of the
15574 corresponding wide characters and then, if pc16 is not a null pointer, stores the value of
15575 the first (or only) such character in the object pointed to by pc16. Subsequent calls will
15577 [<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
15579 store successive wide characters without consuming any additional input until all the
15580 characters have been stored. If the corresponding wide character is the null wide
15581 character, the resulting state described is the initial conversion state.
15582 <b> Returns</b>
15583 4 The mbrtoc16 function returns the first of the following that applies (given the current
15584 conversion state):
15585 0 if the next n or fewer bytes complete the multibyte character that
15586 corresponds to the null wide character (which is the value stored).
15587 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
15588 character (which is the value stored); the value returned is the number
15589 of bytes that complete the multibyte character.
15590 (size_t)(-3) if the next character resulting from a previous call has been stored (no
15591 bytes from the input have been consumed by this call).
15592 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
15593 multibyte character, and all n bytes have been processed (no value is
15594 stored).<sup><a href="#note324"><b>324)</b></a></sup>
15595 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
15596 do not contribute to a complete and valid multibyte character (no
15597 value is stored); the value of the macro EILSEQ is stored in errno,
15598 and the conversion state is unspecified.
15599 <a name="7.28.1.2" href="#7.28.1.2"><b> 7.28.1.2 The c16rtomb function</b></a>
15600 <b> Synopsis</b>
15601 1 #include <a href="#7.28">&lt;uchar.h&gt;</a>
15602 size_t c16rtomb(char * restrict s, char16_t c16,
15603 mbstate_t * restrict ps);
15604 <b> Description</b>
15605 2 If s is a null pointer, the c16rtomb function is equivalent to the call
15606 c16rtomb(buf, L'\0', ps)
15607 where buf is an internal buffer.
15608 3 If s is not a null pointer, the c16rtomb function determines the number of bytes needed
15609 to represent the multibyte character that corresponds to the wide character given by c16
15610 (including any shift sequences), and stores the multibyte character representation in the
15612 <sup><a name="note324" href="#note324"><b>324)</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
15613 sequence of redundant shift sequences (for implementations with state-dependent encodings).
15615 [<a name="p399" href="#p399">page 399</a>] (<a href="#Contents">Contents</a>)
15617 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
15618 c16 is a null wide character, a null byte is stored, preceded by any shift sequence needed
15619 to restore the initial shift state; the resulting state described is the initial conversion state.
15620 <b> Returns</b>
15621 4 The c16rtomb function returns the number of bytes stored in the array object (including
15622 any shift sequences). When c16 is not a valid wide character, an encoding error occurs:
15623 the function stores the value of the macro EILSEQ in errno and returns
15624 (size_t)(-1); the conversion state is unspecified.
15625 <a name="7.28.1.3" href="#7.28.1.3"><b> 7.28.1.3 The mbrtoc32 function</b></a>
15626 <b> Synopsis</b>
15627 1 #include <a href="#7.28">&lt;uchar.h&gt;</a>
15628 size_t mbrtoc32(char32_t * restrict pc32,
15629 const char * restrict s, size_t n,
15630 mbstate_t * restrict ps);
15631 <b> Description</b>
15632 2 If s is a null pointer, the mbrtoc32 function is equivalent to the call:
15633 mbrtoc32(NULL, "", 1, ps)
15634 In this case, the values of the parameters pc32 and n are ignored.
15635 3 If s is not a null pointer, the mbrtoc32 function inspects at most n bytes beginning with
15636 the byte pointed to by s to determine the number of bytes needed to complete the next
15637 multibyte character (including any shift sequences). If the function determines that the
15638 next multibyte character is complete and valid, it determines the values of the
15639 corresponding wide characters and then, if pc32 is not a null pointer, stores the value of
15640 the first (or only) such character in the object pointed to by pc32. Subsequent calls will
15641 store successive wide characters without consuming any additional input until all the
15642 characters have been stored. If the corresponding wide character is the null wide
15643 character, the resulting state described is the initial conversion state.
15644 <b> Returns</b>
15645 4 The mbrtoc32 function returns the first of the following that applies (given the current
15646 conversion state):
15647 0 if the next n or fewer bytes complete the multibyte character that
15648 corresponds to the null wide character (which is the value stored).
15649 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
15650 character (which is the value stored); the value returned is the number
15651 of bytes that complete the multibyte character.
15653 [<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
15655 (size_t)(-3) if the next character resulting from a previous call has been stored (no
15656 bytes from the input have been consumed by this call).
15657 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
15658 multibyte character, and all n bytes have been processed (no value is
15659 stored).<sup><a href="#note325"><b>325)</b></a></sup>
15660 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
15661 do not contribute to a complete and valid multibyte character (no
15662 value is stored); the value of the macro EILSEQ is stored in errno,
15663 and the conversion state is unspecified.
15664 <a name="7.28.1.4" href="#7.28.1.4"><b> 7.28.1.4 The c32rtomb function</b></a>
15665 <b> Synopsis</b>
15666 1 #include <a href="#7.28">&lt;uchar.h&gt;</a>
15667 size_t c32rtomb(char * restrict s, char32_t c32,
15668 mbstate_t * restrict ps);
15669 <b> Description</b>
15670 2 If s is a null pointer, the c32rtomb function is equivalent to the call
15671 c32rtomb(buf, L'\0', ps)
15672 where buf is an internal buffer.
15673 3 If s is not a null pointer, the c32rtomb function determines the number of bytes needed
15674 to represent the multibyte character that corresponds to the wide character given by c32
15675 (including any shift sequences), and stores the multibyte character representation in the
15676 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
15677 c32 is a null wide character, a null byte is stored, preceded by any shift sequence needed
15678 to restore the initial shift state; the resulting state described is the initial conversion state.
15679 <b> Returns</b>
15680 4 The c32rtomb function returns the number of bytes stored in the array object (including
15681 any shift sequences). When c32 is not a valid wide character, an encoding error occurs:
15682 the function stores the value of the macro EILSEQ in errno and returns
15683 (size_t)(-1); the conversion state is unspecified.
15688 <sup><a name="note325" href="#note325"><b>325)</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
15689 sequence of redundant shift sequences (for implementations with state-dependent encodings).
15691 [<a name="p401" href="#p401">page 401</a>] (<a href="#Contents">Contents</a>)
15693 <a name="7.29" href="#7.29"><b> 7.29 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
15694 <a name="7.29.1" href="#7.29.1"><b> 7.29.1 Introduction</b></a>
15695 1 The header <a href="#7.29">&lt;wchar.h&gt;</a> defines four macros, and declares four data types, one tag, and
15696 many functions.<sup><a href="#note326"><b>326)</b></a></sup>
15697 2 The types declared are wchar_t and size_t (both described in <a href="#7.19">7.19</a>);
15698 mbstate_t
15699 which is a complete object type other than an array type that can hold the conversion state
15700 information necessary to convert between sequences of multibyte characters and wide
15701 characters;
15702 wint_t
15703 which is an integer type unchanged by default argument promotions that can hold any
15704 value corresponding to members of the extended character set, as well as at least one
15705 value that does not correspond to any member of the extended character set (see WEOF
15706 below);<sup><a href="#note327"><b>327)</b></a></sup> and
15707 struct tm
15708 which is declared as an incomplete structure type (the contents are described in <a href="#7.27.1">7.27.1</a>).
15709 3 The macros defined are NULL (described in <a href="#7.19">7.19</a>); WCHAR_MIN and WCHAR_MAX
15710 (described in <a href="#7.20.3">7.20.3</a>); and
15711 WEOF
15712 which expands to a constant expression of type wint_t whose value does not
15713 correspond to any member of the extended character set.<sup><a href="#note328"><b>328)</b></a></sup> It is accepted (and returned)
15714 by several functions in this subclause to indicate end-of-file, that is, no more input from a
15715 stream. It is also used as a wide character value that does not correspond to any member
15716 of the extended character set.
15717 4 The functions declared are grouped as follows:
15718 -- Functions that perform input and output of wide characters, or multibyte characters,
15719 or both;
15720 -- Functions that provide wide string numeric conversion;
15721 -- Functions that perform general wide string manipulation;
15724 <sup><a name="note326" href="#note326"><b>326)</b></a></sup> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
15725 <sup><a name="note327" href="#note327"><b>327)</b></a></sup> wchar_t and wint_t can be the same integer type.
15726 <sup><a name="note328" href="#note328"><b>328)</b></a></sup> The value of the macro WEOF may differ from that of EOF and need not be negative.
15728 [<a name="p402" href="#p402">page 402</a>] (<a href="#Contents">Contents</a>)
15730 -- Functions for wide string date and time conversion; and
15731 -- Functions that provide extended capabilities for conversion between multibyte and
15732 wide character sequences.
15733 5 Arguments to the functions in this subclause may point to arrays containing wchar_t
15734 values that do not correspond to members of the extended character set. Such values
15735 shall be processed according to the specified semantics, except that it is unspecified
15736 whether an encoding error occurs if such a value appears in the format string for a
15737 function in <a href="#7.29.2">7.29.2</a> or <a href="#7.29.5">7.29.5</a> and the specified semantics do not require that value to be
15738 processed by wcrtomb.
15739 6 Unless explicitly stated otherwise, if the execution of a function described in this
15740 subclause causes copying to take place between objects that overlap, the behavior is
15741 undefined.
15742 <a name="7.29.2" href="#7.29.2"><b> 7.29.2 Formatted wide character input/output functions</b></a>
15743 1 The formatted wide character input/output functions shall behave as if there is a sequence
15744 point after the actions associated with each specifier.<sup><a href="#note329"><b>329)</b></a></sup>
15745 <a name="7.29.2.1" href="#7.29.2.1"><b> 7.29.2.1 The fwprintf function</b></a>
15746 <b> Synopsis</b>
15747 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
15748 #include <a href="#7.29">&lt;wchar.h&gt;</a>
15749 int fwprintf(FILE * restrict stream,
15750 const wchar_t * restrict format, ...);
15751 <b> Description</b>
15752 2 The fwprintf function writes output to the stream pointed to by stream, under
15753 control of the wide string pointed to by format that specifies how subsequent arguments
15754 are converted for output. If there are insufficient arguments for the format, the behavior
15755 is undefined. If the format is exhausted while arguments remain, the excess arguments
15756 are evaluated (as always) but are otherwise ignored. The fwprintf function returns
15757 when the end of the format string is encountered.
15758 3 The format is composed of zero or more directives: ordinary wide characters (not %),
15759 which are copied unchanged to the output stream; and conversion specifications, each of
15760 which results in fetching zero or more subsequent arguments, converting them, if
15761 applicable, according to the corresponding conversion specifier, and then writing the
15762 result to the output stream.
15766 <sup><a name="note329" href="#note329"><b>329)</b></a></sup> The fwprintf functions perform writes to memory for the %n specifier.
15768 [<a name="p403" href="#p403">page 403</a>] (<a href="#Contents">Contents</a>)
15770 4 Each conversion specification is introduced by the wide character %. After the %, the
15771 following appear in sequence:
15772 -- Zero or more flags (in any order) that modify the meaning of the conversion
15773 specification.
15774 -- An optional minimum field width. If the converted value has fewer wide characters
15775 than the field width, it is padded with spaces (by default) on the left (or right, if the
15776 left adjustment flag, described later, has been given) to the field width. The field
15777 width takes the form of an asterisk * (described later) or a nonnegative decimal
15778 integer.<sup><a href="#note330"><b>330)</b></a></sup>
15779 -- An optional precision that gives the minimum number of digits to appear for the d, i,
15780 o, u, x, and X conversions, the number of digits to appear after the decimal-point
15781 wide character for a, A, e, E, f, and F conversions, the maximum number of
15782 significant digits for the g and G conversions, or the maximum number of wide
15783 characters to be written for s conversions. The precision takes the form of a period
15784 (.) followed either by an asterisk * (described later) or by an optional decimal
15785 integer; if only the period is specified, the precision is taken as zero. If a precision
15786 appears with any other conversion specifier, the behavior is undefined.
15787 -- An optional length modifier that specifies the size of the argument.
15788 -- A conversion specifier wide character that specifies the type of conversion to be
15789 applied.
15790 5 As noted above, a field width, or precision, or both, may be indicated by an asterisk. In
15791 this case, an int argument supplies the field width or precision. The arguments
15792 specifying field width, or precision, or both, shall appear (in that order) before the
15793 argument (if any) to be converted. A negative field width argument is taken as a - flag
15794 followed by a positive field width. A negative precision argument is taken as if the
15795 precision were omitted.
15796 6 The flag wide characters and their meanings are:
15797 - The result of the conversion is left-justified within the field. (It is right-justified if
15798 this flag is not specified.)
15799 + The result of a signed conversion always begins with a plus or minus sign. (It
15800 begins with a sign only when a negative value is converted if this flag is not
15805 <sup><a name="note330" href="#note330"><b>330)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
15807 [<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
15809 specified.)<sup><a href="#note331"><b>331)</b></a></sup>
15810 space If the first wide character of a signed conversion is not a sign, or if a signed
15811 conversion results in no wide characters, a space is prefixed to the result. If the
15812 space and + flags both appear, the space flag is ignored.
15813 # The result is converted to an ''alternative form''. For o conversion, it increases
15814 the precision, if and only if necessary, to force the first digit of the result to be a
15815 zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
15816 conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
15817 and G conversions, the result of converting a floating-point number always
15818 contains a decimal-point wide character, even if no digits follow it. (Normally, a
15819 decimal-point wide character appears in the result of these conversions only if a
15820 digit follows it.) For g and G conversions, trailing zeros are not removed from the
15821 result. For other conversions, the behavior is undefined.
15822 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
15823 (following any indication of sign or base) are used to pad to the field width rather
15824 than performing space padding, except when converting an infinity or NaN. If the
15825 0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
15826 conversions, if a precision is specified, the 0 flag is ignored. For other
15827 conversions, the behavior is undefined.
15828 7 The length modifiers and their meanings are:
15829 hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15830 signed char or unsigned char argument (the argument will have
15831 been promoted according to the integer promotions, but its value shall be
15832 converted to signed char or unsigned char before printing); or that
15833 a following n conversion specifier applies to a pointer to a signed char
15834 argument.
15835 h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15836 short int or unsigned short int argument (the argument will
15837 have been promoted according to the integer promotions, but its value shall
15838 be converted to short int or unsigned short int before printing);
15839 or that a following n conversion specifier applies to a pointer to a short
15840 int argument.
15841 l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15842 long int or unsigned long int argument; that a following n
15843 conversion specifier applies to a pointer to a long int argument; that a
15846 <sup><a name="note331" href="#note331"><b>331)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
15847 include a minus sign.
15849 [<a name="p405" href="#p405">page 405</a>] (<a href="#Contents">Contents</a>)
15851 following c conversion specifier applies to a wint_t argument; that a
15852 following s conversion specifier applies to a pointer to a wchar_t
15853 argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
15854 specifier.
15855 ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15856 long long int or unsigned long long int argument; or that a
15857 following n conversion specifier applies to a pointer to a long long int
15858 argument.
15859 j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
15860 an intmax_t or uintmax_t argument; or that a following n conversion
15861 specifier applies to a pointer to an intmax_t argument.
15862 z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15863 size_t or the corresponding signed integer type argument; or that a
15864 following n conversion specifier applies to a pointer to a signed integer type
15865 corresponding to size_t argument.
15866 t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
15867 ptrdiff_t or the corresponding unsigned integer type argument; or that a
15868 following n conversion specifier applies to a pointer to a ptrdiff_t
15869 argument.
15870 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
15871 applies to a long double argument.
15872 If a length modifier appears with any conversion specifier other than as specified above,
15873 the behavior is undefined.
15874 8 The conversion specifiers and their meanings are:
15875 d,i The int argument is converted to signed decimal in the style [-]dddd. The
15876 precision specifies the minimum number of digits to appear; if the value
15877 being converted can be represented in fewer digits, it is expanded with
15878 leading zeros. The default precision is 1. The result of converting a zero
15879 value with a precision of zero is no wide characters.
15880 o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
15881 decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
15882 letters abcdef are used for x conversion and the letters ABCDEF for X
15883 conversion. The precision specifies the minimum number of digits to appear;
15884 if the value being converted can be represented in fewer digits, it is expanded
15885 with leading zeros. The default precision is 1. The result of converting a
15886 zero value with a precision of zero is no wide characters.
15888 [<a name="p406" href="#p406">page 406</a>] (<a href="#Contents">Contents</a>)
15890 f,F A double argument representing a floating-point number is converted to
15891 decimal notation in the style [-]ddd.ddd, where the number of digits after
15892 the decimal-point wide character is equal to the precision specification. If the
15893 precision is missing, it is taken as 6; if the precision is zero and the # flag is
15894 not specified, no decimal-point wide character appears. If a decimal-point
15895 wide character appears, at least one digit appears before it. The value is
15896 rounded to the appropriate number of digits.
15897 A double argument representing an infinity is converted in one of the styles
15898 [-]inf or [-]infinity -- which style is implementation-defined. A
15899 double argument representing a NaN is converted in one of the styles
15900 [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
15901 any n-wchar-sequence, is implementation-defined. The F conversion
15902 specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
15903 nan, respectively.<sup><a href="#note332"><b>332)</b></a></sup>
15904 e,E A double argument representing a floating-point number is converted in the
15905 style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
15906 argument is nonzero) before the decimal-point wide character and the number
15907 of digits after it is equal to the precision; if the precision is missing, it is taken
15908 as 6; if the precision is zero and the # flag is not specified, no decimal-point
15909 wide character appears. The value is rounded to the appropriate number of
15910 digits. The E conversion specifier produces a number with E instead of e
15911 introducing the exponent. The exponent always contains at least two digits,
15912 and only as many more digits as necessary to represent the exponent. If the
15913 value is zero, the exponent is zero.
15914 A double argument representing an infinity or NaN is converted in the style
15915 of an f or F conversion specifier.
15916 g,G A double argument representing a floating-point number is converted in
15917 style f or e (or in style F or E in the case of a G conversion specifier),
15918 depending on the value converted and the precision. Let P equal the
15919 precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
15920 Then, if a conversion with style E would have an exponent of X:
15921 -- if P &gt; X &gt;= -4, the conversion is with style f (or F) and precision
15922 P - (X + 1).
15923 -- otherwise, the conversion is with style e (or E) and precision P - 1.
15924 Finally, unless the # flag is used, any trailing zeros are removed from the
15927 <sup><a name="note332" href="#note332"><b>332)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
15928 meaning; the # and 0 flag wide characters have no effect.
15930 [<a name="p407" href="#p407">page 407</a>] (<a href="#Contents">Contents</a>)
15932 fractional portion of the result and the decimal-point wide character is
15933 removed if there is no fractional portion remaining.
15934 A double argument representing an infinity or NaN is converted in the style
15935 of an f or F conversion specifier.
15936 a,A A double argument representing a floating-point number is converted in the
15937 style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
15938 nonzero if the argument is a normalized floating-point number and is
15939 otherwise unspecified) before the decimal-point wide character<sup><a href="#note333"><b>333)</b></a></sup> and the
15940 number of hexadecimal digits after it is equal to the precision; if the precision
15941 is missing and FLT_RADIX is a power of 2, then the precision is sufficient
15942 for an exact representation of the value; if the precision is missing and
15943 FLT_RADIX is not a power of 2, then the precision is sufficient to
15944 distinguish<sup><a href="#note334"><b>334)</b></a></sup> values of type double, except that trailing zeros may be
15945 omitted; if the precision is zero and the # flag is not specified, no decimal-
15946 point wide character appears. The letters abcdef are used for a conversion
15947 and the letters ABCDEF for A conversion. The A conversion specifier
15948 produces a number with X and P instead of x and p. The exponent always
15949 contains at least one digit, and only as many more digits as necessary to
15950 represent the decimal exponent of 2. If the value is zero, the exponent is
15951 zero.
15952 A double argument representing an infinity or NaN is converted in the style
15953 of an f or F conversion specifier.
15954 c If no l length modifier is present, the int argument is converted to a wide
15955 character as if by calling btowc and the resulting wide character is written.
15956 If an l length modifier is present, the wint_t argument is converted to
15957 wchar_t and written.
15958 s If no l length modifier is present, the argument shall be a pointer to the initial
15959 element of a character array containing a multibyte character sequence
15960 beginning in the initial shift state. Characters from the array are converted as
15961 if by repeated calls to the mbrtowc function, with the conversion state
15962 described by an mbstate_t object initialized to zero before the first
15963 multibyte character is converted, and written up to (but not including) the
15965 <sup><a name="note333" href="#note333"><b>333)</b></a></sup> Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
15966 character so that subsequent digits align to nibble (4-bit) boundaries.
15967 <sup><a name="note334" href="#note334"><b>334)</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
15968 FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
15969 might suffice depending on the implementation's scheme for determining the digit to the left of the
15970 decimal-point wide character.
15972 [<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
15974 terminating null wide character. If the precision is specified, no more than
15975 that many wide characters are written. If the precision is not specified or is
15976 greater than the size of the converted array, the converted array shall contain a
15977 null wide character.
15978 If an l length modifier is present, the argument shall be a pointer to the initial
15979 element of an array of wchar_t type. Wide characters from the array are
15980 written up to (but not including) a terminating null wide character. If the
15981 precision is specified, no more than that many wide characters are written. If
15982 the precision is not specified or is greater than the size of the array, the array
15983 shall contain a null wide character.
15984 p The argument shall be a pointer to void. The value of the pointer is
15985 converted to a sequence of printing wide characters, in an implementation-
15986 defined manner.
15987 n The argument shall be a pointer to signed integer into which is written the
15988 number of wide characters written to the output stream so far by this call to
15989 fwprintf. No argument is converted, but one is consumed. If the
15990 conversion specification includes any flags, a field width, or a precision, the
15991 behavior is undefined.
15992 % A % wide character is written. No argument is converted. The complete
15993 conversion specification shall be %%.
15994 9 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note335"><b>335)</b></a></sup> If any argument is
15995 not the correct type for the corresponding conversion specification, the behavior is
15996 undefined.
15997 10 In no case does a nonexistent or small field width cause truncation of a field; if the result
15998 of a conversion is wider than the field width, the field is expanded to contain the
15999 conversion result.
16000 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
16001 to a hexadecimal floating number with the given precision.
16002 Recommended practice
16003 12 For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
16004 representable in the given precision, the result should be one of the two adjacent numbers
16005 in hexadecimal floating style with the given precision, with the extra stipulation that the
16006 error should have a correct sign for the current rounding direction.
16007 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
16008 DECIMAL_DIG, then the result should be correctly rounded.<sup><a href="#note336"><b>336)</b></a></sup> If the number of
16010 <sup><a name="note335" href="#note335"><b>335)</b></a></sup> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
16012 [<a name="p409" href="#p409">page 409</a>] (<a href="#Contents">Contents</a>)
16014 significant decimal digits is more than DECIMAL_DIG but the source value is exactly
16015 representable with DECIMAL_DIG digits, then the result should be an exact
16016 representation with trailing zeros. Otherwise, the source value is bounded by two
16017 adjacent decimal strings L &lt; U, both having DECIMAL_DIG significant digits; the value
16018 of the resultant decimal string D should satisfy L &lt;= D &lt;= U, with the extra stipulation that
16019 the error should have a correct sign for the current rounding direction.
16020 <b> Returns</b>
16021 14 The fwprintf function returns the number of wide characters transmitted, or a negative
16022 value if an output or encoding error occurred.
16023 Environmental limits
16024 15 The number of wide characters that can be produced by any single conversion shall be at
16025 least 4095.
16026 16 EXAMPLE To print a date and time in the form ''Sunday, July 3, 10:02'' followed by pi to five decimal
16027 places:
16028 #include <a href="#7.12">&lt;math.h&gt;</a>
16029 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16030 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16031 /* ... */
16032 wchar_t *weekday, *month; // pointers to wide strings
16033 int day, hour, min;
16034 fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
16035 weekday, month, day, hour, min);
16036 fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
16038 Forward references: the btowc function (<a href="#7.29.6.1.1">7.29.6.1.1</a>), the mbrtowc function
16039 (<a href="#7.29.6.3.2">7.29.6.3.2</a>).
16040 <a name="7.29.2.2" href="#7.29.2.2"><b> 7.29.2.2 The fwscanf function</b></a>
16041 <b> Synopsis</b>
16042 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16043 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16044 int fwscanf(FILE * restrict stream,
16045 const wchar_t * restrict format, ...);
16046 <b> Description</b>
16047 2 The fwscanf function reads input from the stream pointed to by stream, under
16048 control of the wide string pointed to by format that specifies the admissible input
16049 sequences and how they are to be converted for assignment, using subsequent arguments
16051 <sup><a name="note336" href="#note336"><b>336)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
16052 given format specifier. The number of significant digits is determined by the format specifier, and in
16053 the case of fixed-point conversion by the source value as well.
16055 [<a name="p410" href="#p410">page 410</a>] (<a href="#Contents">Contents</a>)
16057 as pointers to the objects to receive the converted input. If there are insufficient
16058 arguments for the format, the behavior is undefined. If the format is exhausted while
16059 arguments remain, the excess arguments are evaluated (as always) but are otherwise
16060 ignored.
16061 3 The format is composed of zero or more directives: one or more white-space wide
16062 characters, an ordinary wide character (neither % nor a white-space wide character), or a
16063 conversion specification. Each conversion specification is introduced by the wide
16064 character %. After the %, the following appear in sequence:
16065 -- An optional assignment-suppressing wide character *.
16066 -- An optional decimal integer greater than zero that specifies the maximum field width
16067 (in wide characters).
16068 -- An optional length modifier that specifies the size of the receiving object.
16069 -- A conversion specifier wide character that specifies the type of conversion to be
16070 applied.
16071 4 The fwscanf function executes each directive of the format in turn. When all directives
16072 have been executed, or if a directive fails (as detailed below), the function returns.
16073 Failures are described as input failures (due to the occurrence of an encoding error or the
16074 unavailability of input characters), or matching failures (due to inappropriate input).
16075 5 A directive composed of white-space wide character(s) is executed by reading input up to
16076 the first non-white-space wide character (which remains unread), or until no more wide
16077 characters can be read. The directive never fails.
16078 6 A directive that is an ordinary wide character is executed by reading the next wide
16079 character of the stream. If that wide character differs from the directive, the directive
16080 fails and the differing and subsequent wide characters remain unread. Similarly, if end-
16081 of-file, an encoding error, or a read error prevents a wide character from being read, the
16082 directive fails.
16083 7 A directive that is a conversion specification defines a set of matching input sequences, as
16084 described below for each specifier. A conversion specification is executed in the
16085 following steps:
16086 8 Input white-space wide characters (as specified by the iswspace function) are skipped,
16087 unless the specification includes a [, c, or n specifier.<sup><a href="#note337"><b>337)</b></a></sup>
16088 9 An input item is read from the stream, unless the specification includes an n specifier. An
16089 input item is defined as the longest sequence of input wide characters which does not
16090 exceed any specified field width and which is, or is a prefix of, a matching input
16093 <sup><a name="note337" href="#note337"><b>337)</b></a></sup> These white-space wide characters are not counted against a specified field width.
16095 [<a name="p411" href="#p411">page 411</a>] (<a href="#Contents">Contents</a>)
16097 sequence.<sup><a href="#note338"><b>338)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
16098 length of the input item is zero, the execution of the directive fails; this condition is a
16099 matching failure unless end-of-file, an encoding error, or a read error prevented input
16100 from the stream, in which case it is an input failure.
16101 10 Except in the case of a % specifier, the input item (or, in the case of a %n directive, the
16102 count of input wide characters) is converted to a type appropriate to the conversion
16103 specifier. If the input item is not a matching sequence, the execution of the directive fails:
16104 this condition is a matching failure. Unless assignment suppression was indicated by a *,
16105 the result of the conversion is placed in the object pointed to by the first argument
16106 following the format argument that has not already received a conversion result. If this
16107 object does not have an appropriate type, or if the result of the conversion cannot be
16108 represented in the object, the behavior is undefined.
16109 11 The length modifiers and their meanings are:
16110 hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16111 to an argument with type pointer to signed char or unsigned char.
16112 h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16113 to an argument with type pointer to short int or unsigned short
16114 int.
16115 l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16116 to an argument with type pointer to long int or unsigned long
16117 int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
16118 an argument with type pointer to double; or that a following c, s, or [
16119 conversion specifier applies to an argument with type pointer to wchar_t.
16120 ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16121 to an argument with type pointer to long long int or unsigned
16122 long long int.
16123 j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16124 to an argument with type pointer to intmax_t or uintmax_t.
16125 z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16126 to an argument with type pointer to size_t or the corresponding signed
16127 integer type.
16128 t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
16129 to an argument with type pointer to ptrdiff_t or the corresponding
16130 unsigned integer type.
16133 <sup><a name="note338" href="#note338"><b>338)</b></a></sup> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
16134 sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
16136 [<a name="p412" href="#p412">page 412</a>] (<a href="#Contents">Contents</a>)
16138 L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
16139 applies to an argument with type pointer to long double.
16140 If a length modifier appears with any conversion specifier other than as specified above,
16141 the behavior is undefined.
16142 12 The conversion specifiers and their meanings are:
16143 d Matches an optionally signed decimal integer, whose format is the same as
16144 expected for the subject sequence of the wcstol function with the value 10
16145 for the base argument. The corresponding argument shall be a pointer to
16146 signed integer.
16147 i Matches an optionally signed integer, whose format is the same as expected
16148 for the subject sequence of the wcstol function with the value 0 for the
16149 base argument. The corresponding argument shall be a pointer to signed
16150 integer.
16151 o Matches an optionally signed octal integer, whose format is the same as
16152 expected for the subject sequence of the wcstoul function with the value 8
16153 for the base argument. The corresponding argument shall be a pointer to
16154 unsigned integer.
16155 u Matches an optionally signed decimal integer, whose format is the same as
16156 expected for the subject sequence of the wcstoul function with the value 10
16157 for the base argument. The corresponding argument shall be a pointer to
16158 unsigned integer.
16159 x Matches an optionally signed hexadecimal integer, whose format is the same
16160 as expected for the subject sequence of the wcstoul function with the value
16161 16 for the base argument. The corresponding argument shall be a pointer to
16162 unsigned integer.
16163 a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
16164 format is the same as expected for the subject sequence of the wcstod
16165 function. The corresponding argument shall be a pointer to floating.
16166 c Matches a sequence of wide characters of exactly the number specified by the
16167 field width (1 if no field width is present in the directive).
16168 If no l length modifier is present, characters from the input field are
16169 converted as if by repeated calls to the wcrtomb function, with the
16170 conversion state described by an mbstate_t object initialized to zero
16171 before the first wide character is converted. The corresponding argument
16172 shall be a pointer to the initial element of a character array large enough to
16173 accept the sequence. No null character is added.
16174 If an l length modifier is present, the corresponding argument shall be a
16176 [<a name="p413" href="#p413">page 413</a>] (<a href="#Contents">Contents</a>)
16178 pointer to the initial element of an array of wchar_t large enough to accept
16179 the sequence. No null wide character is added.
16180 s Matches a sequence of non-white-space wide characters.
16181 If no l length modifier is present, characters from the input field are
16182 converted as if by repeated calls to the wcrtomb function, with the
16183 conversion state described by an mbstate_t object initialized to zero
16184 before the first wide character is converted. The corresponding argument
16185 shall be a pointer to the initial element of a character array large enough to
16186 accept the sequence and a terminating null character, which will be added
16187 automatically.
16188 If an l length modifier is present, the corresponding argument shall be a
16189 pointer to the initial element of an array of wchar_t large enough to accept
16190 the sequence and the terminating null wide character, which will be added
16191 automatically.
16192 [ Matches a nonempty sequence of wide characters from a set of expected
16193 characters (the scanset).
16194 If no l length modifier is present, characters from the input field are
16195 converted as if by repeated calls to the wcrtomb function, with the
16196 conversion state described by an mbstate_t object initialized to zero
16197 before the first wide character is converted. The corresponding argument
16198 shall be a pointer to the initial element of a character array large enough to
16199 accept the sequence and a terminating null character, which will be added
16200 automatically.
16201 If an l length modifier is present, the corresponding argument shall be a
16202 pointer to the initial element of an array of wchar_t large enough to accept
16203 the sequence and the terminating null wide character, which will be added
16204 automatically.
16205 The conversion specifier includes all subsequent wide characters in the
16206 format string, up to and including the matching right bracket (]). The wide
16207 characters between the brackets (the scanlist) compose the scanset, unless the
16208 wide character after the left bracket is a circumflex (^), in which case the
16209 scanset contains all wide characters that do not appear in the scanlist between
16210 the circumflex and the right bracket. If the conversion specifier begins with
16211 [] or [^], the right bracket wide character is in the scanlist and the next
16212 following right bracket wide character is the matching right bracket that ends
16213 the specification; otherwise the first following right bracket wide character is
16214 the one that ends the specification. If a - wide character is in the scanlist and
16215 is not the first, nor the second where the first wide character is a ^, nor the
16217 [<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
16219 last character, the behavior is implementation-defined.
16220 p Matches an implementation-defined set of sequences, which should be the
16221 same as the set of sequences that may be produced by the %p conversion of
16222 the fwprintf function. The corresponding argument shall be a pointer to a
16223 pointer to void. The input item is converted to a pointer value in an
16224 implementation-defined manner. If the input item is a value converted earlier
16225 during the same program execution, the pointer that results shall compare
16226 equal to that value; otherwise the behavior of the %p conversion is undefined.
16227 n No input is consumed. The corresponding argument shall be a pointer to
16228 signed integer into which is to be written the number of wide characters read
16229 from the input stream so far by this call to the fwscanf function. Execution
16230 of a %n directive does not increment the assignment count returned at the
16231 completion of execution of the fwscanf function. No argument is
16232 converted, but one is consumed. If the conversion specification includes an
16233 assignment-suppressing wide character or a field width, the behavior is
16234 undefined.
16235 % Matches a single % wide character; no conversion or assignment occurs. The
16236 complete conversion specification shall be %%.
16237 13 If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note339"><b>339)</b></a></sup>
16238 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
16239 respectively, a, e, f, g, and x.
16240 15 Trailing white space (including new-line wide characters) is left unread unless matched
16241 by a directive. The success of literal matches and suppressed assignments is not directly
16242 determinable other than via the %n directive.
16243 <b> Returns</b>
16244 16 The fwscanf function returns the value of the macro EOF if an input failure occurs
16245 before the first conversion (if any) has completed. Otherwise, the function returns the
16246 number of input items assigned, which can be fewer than provided for, or even zero, in
16247 the event of an early matching failure.
16248 17 EXAMPLE 1 The call:
16249 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16250 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16251 /* ... */
16252 int n, i; float x; wchar_t name[50];
16253 n = fwscanf(stdin, L"%d%f%ls", &amp;i, &amp;x, name);
16257 <sup><a name="note339" href="#note339"><b>339)</b></a></sup> See ''future library directions'' (<a href="#7.31.16">7.31.16</a>).
16259 [<a name="p415" href="#p415">page 415</a>] (<a href="#Contents">Contents</a>)
16261 with the input line:
16262 25 54.32E-1 thompson
16263 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
16264 thompson\0.
16266 18 EXAMPLE 2 The call:
16267 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16268 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16269 /* ... */
16270 int i; float x; double y;
16271 fwscanf(stdin, L"%2d%f%*d %lf", &amp;i, &amp;x, &amp;y);
16272 with input:
16273 56789 0123 56a72
16274 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
16275 56.0. The next wide character read from the input stream will be a.
16277 Forward references: the wcstod, wcstof, and wcstold functions (<a href="#7.29.4.1.1">7.29.4.1.1</a>), the
16278 wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.29.4.1.2">7.29.4.1.2</a>), the wcrtomb
16279 function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
16280 <a name="7.29.2.3" href="#7.29.2.3"><b> 7.29.2.3 The swprintf function</b></a>
16281 <b> Synopsis</b>
16282 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16283 int swprintf(wchar_t * restrict s,
16284 size_t n,
16285 const wchar_t * restrict format, ...);
16286 <b> Description</b>
16287 2 The swprintf function is equivalent to fwprintf, except that the argument s
16288 specifies an array of wide characters into which the generated output is to be written,
16289 rather than written to a stream. No more than n wide characters are written, including a
16290 terminating null wide character, which is always added (unless n is zero).
16291 <b> Returns</b>
16292 3 The swprintf function returns the number of wide characters written in the array, not
16293 counting the terminating null wide character, or a negative value if an encoding error
16294 occurred or if n or more wide characters were requested to be written.
16296 [<a name="p416" href="#p416">page 416</a>] (<a href="#Contents">Contents</a>)
16298 <a name="7.29.2.4" href="#7.29.2.4"><b> 7.29.2.4 The swscanf function</b></a>
16299 <b> Synopsis</b>
16300 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16301 int swscanf(const wchar_t * restrict s,
16302 const wchar_t * restrict format, ...);
16303 <b> Description</b>
16304 2 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
16305 wide string from which the input is to be obtained, rather than from a stream. Reaching
16306 the end of the wide string is equivalent to encountering end-of-file for the fwscanf
16307 function.
16308 <b> Returns</b>
16309 3 The swscanf function returns the value of the macro EOF if an input failure occurs
16310 before the first conversion (if any) has completed. Otherwise, the swscanf function
16311 returns the number of input items assigned, which can be fewer than provided for, or even
16312 zero, in the event of an early matching failure.
16313 <a name="7.29.2.5" href="#7.29.2.5"><b> 7.29.2.5 The vfwprintf function</b></a>
16314 <b> Synopsis</b>
16315 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16316 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16317 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16318 int vfwprintf(FILE * restrict stream,
16319 const wchar_t * restrict format,
16320 va_list arg);
16321 <b> Description</b>
16322 2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
16323 replaced by arg, which shall have been initialized by the va_start macro (and
16324 possibly subsequent va_arg calls). The vfwprintf function does not invoke the
16325 va_end macro.<sup><a href="#note340"><b>340)</b></a></sup>
16326 <b> Returns</b>
16327 3 The vfwprintf function returns the number of wide characters transmitted, or a
16328 negative value if an output or encoding error occurred.
16333 <sup><a name="note340" href="#note340"><b>340)</b></a></sup> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
16334 invoke the va_arg macro, the value of arg after the return is indeterminate.
16336 [<a name="p417" href="#p417">page 417</a>] (<a href="#Contents">Contents</a>)
16338 4 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
16339 routine.
16340 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16341 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16342 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16343 void error(char *function_name, wchar_t *format, ...)
16345 va_list args;
16346 va_start(args, format);
16347 // print out name of function causing error
16348 fwprintf(stderr, L"ERROR in %s: ", function_name);
16349 // print out remainder of message
16350 vfwprintf(stderr, format, args);
16351 va_end(args);
16354 <a name="7.29.2.6" href="#7.29.2.6"><b> 7.29.2.6 The vfwscanf function</b></a>
16355 <b> Synopsis</b>
16356 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16357 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16358 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16359 int vfwscanf(FILE * restrict stream,
16360 const wchar_t * restrict format,
16361 va_list arg);
16362 <b> Description</b>
16363 2 The vfwscanf function is equivalent to fwscanf, with the variable argument list
16364 replaced by arg, which shall have been initialized by the va_start macro (and
16365 possibly subsequent va_arg calls). The vfwscanf function does not invoke the
16366 va_end macro.340)
16367 <b> Returns</b>
16368 3 The vfwscanf function returns the value of the macro EOF if an input failure occurs
16369 before the first conversion (if any) has completed. Otherwise, the vfwscanf function
16370 returns the number of input items assigned, which can be fewer than provided for, or even
16371 zero, in the event of an early matching failure.
16373 [<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
16375 <a name="7.29.2.7" href="#7.29.2.7"><b> 7.29.2.7 The vswprintf function</b></a>
16376 <b> Synopsis</b>
16377 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16378 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16379 int vswprintf(wchar_t * restrict s,
16380 size_t n,
16381 const wchar_t * restrict format,
16382 va_list arg);
16383 <b> Description</b>
16384 2 The vswprintf function is equivalent to swprintf, with the variable argument list
16385 replaced by arg, which shall have been initialized by the va_start macro (and
16386 possibly subsequent va_arg calls). The vswprintf function does not invoke the
16387 va_end macro.340)
16388 <b> Returns</b>
16389 3 The vswprintf function returns the number of wide characters written in the array, not
16390 counting the terminating null wide character, or a negative value if an encoding error
16391 occurred or if n or more wide characters were requested to be generated.
16392 <a name="7.29.2.8" href="#7.29.2.8"><b> 7.29.2.8 The vswscanf function</b></a>
16393 <b> Synopsis</b>
16394 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16395 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16396 int vswscanf(const wchar_t * restrict s,
16397 const wchar_t * restrict format,
16398 va_list arg);
16399 <b> Description</b>
16400 2 The vswscanf function is equivalent to swscanf, with the variable argument list
16401 replaced by arg, which shall have been initialized by the va_start macro (and
16402 possibly subsequent va_arg calls). The vswscanf function does not invoke the
16403 va_end macro.340)
16404 <b> Returns</b>
16405 3 The vswscanf function returns the value of the macro EOF if an input failure occurs
16406 before the first conversion (if any) has completed. Otherwise, the vswscanf function
16407 returns the number of input items assigned, which can be fewer than provided for, or even
16408 zero, in the event of an early matching failure.
16410 [<a name="p419" href="#p419">page 419</a>] (<a href="#Contents">Contents</a>)
16412 <a name="7.29.2.9" href="#7.29.2.9"><b> 7.29.2.9 The vwprintf function</b></a>
16413 <b> Synopsis</b>
16414 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16415 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16416 int vwprintf(const wchar_t * restrict format,
16417 va_list arg);
16418 <b> Description</b>
16419 2 The vwprintf function is equivalent to wprintf, with the variable argument list
16420 replaced by arg, which shall have been initialized by the va_start macro (and
16421 possibly subsequent va_arg calls). The vwprintf function does not invoke the
16422 va_end macro.340)
16423 <b> Returns</b>
16424 3 The vwprintf function returns the number of wide characters transmitted, or a negative
16425 value if an output or encoding error occurred.
16426 <a name="7.29.2.10" href="#7.29.2.10"><b> 7.29.2.10 The vwscanf function</b></a>
16427 <b> Synopsis</b>
16428 1 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
16429 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16430 int vwscanf(const wchar_t * restrict format,
16431 va_list arg);
16432 <b> Description</b>
16433 2 The vwscanf function is equivalent to wscanf, with the variable argument list
16434 replaced by arg, which shall have been initialized by the va_start macro (and
16435 possibly subsequent va_arg calls). The vwscanf function does not invoke the
16436 va_end macro.340)
16437 <b> Returns</b>
16438 3 The vwscanf function returns the value of the macro EOF if an input failure occurs
16439 before the first conversion (if any) has completed. Otherwise, the vwscanf function
16440 returns the number of input items assigned, which can be fewer than provided for, or even
16441 zero, in the event of an early matching failure.
16443 [<a name="p420" href="#p420">page 420</a>] (<a href="#Contents">Contents</a>)
16445 <a name="7.29.2.11" href="#7.29.2.11"><b> 7.29.2.11 The wprintf function</b></a>
16446 <b> Synopsis</b>
16447 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16448 int wprintf(const wchar_t * restrict format, ...);
16449 <b> Description</b>
16450 2 The wprintf function is equivalent to fwprintf with the argument stdout
16451 interposed before the arguments to wprintf.
16452 <b> Returns</b>
16453 3 The wprintf function returns the number of wide characters transmitted, or a negative
16454 value if an output or encoding error occurred.
16455 <a name="7.29.2.12" href="#7.29.2.12"><b> 7.29.2.12 The wscanf function</b></a>
16456 <b> Synopsis</b>
16457 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16458 int wscanf(const wchar_t * restrict format, ...);
16459 <b> Description</b>
16460 2 The wscanf function is equivalent to fwscanf with the argument stdin interposed
16461 before the arguments to wscanf.
16462 <b> Returns</b>
16463 3 The wscanf function returns the value of the macro EOF if an input failure occurs
16464 before the first conversion (if any) has completed. Otherwise, the wscanf function
16465 returns the number of input items assigned, which can be fewer than provided for, or even
16466 zero, in the event of an early matching failure.
16467 <a name="7.29.3" href="#7.29.3"><b> 7.29.3 Wide character input/output functions</b></a>
16468 <a name="7.29.3.1" href="#7.29.3.1"><b> 7.29.3.1 The fgetwc function</b></a>
16469 <b> Synopsis</b>
16470 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16471 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16472 wint_t fgetwc(FILE *stream);
16473 <b> Description</b>
16474 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
16475 next wide character is present, the fgetwc function obtains that wide character as a
16476 wchar_t converted to a wint_t and advances the associated file position indicator for
16477 the stream (if defined).
16479 [<a name="p421" href="#p421">page 421</a>] (<a href="#Contents">Contents</a>)
16481 <b> Returns</b>
16482 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
16483 of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
16484 the fgetwc function returns the next wide character from the input stream pointed to by
16485 stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
16486 function returns WEOF. If an encoding error occurs (including too few bytes), the value of
16487 the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.<sup><a href="#note341"><b>341)</b></a></sup>
16488 <a name="7.29.3.2" href="#7.29.3.2"><b> 7.29.3.2 The fgetws function</b></a>
16489 <b> Synopsis</b>
16490 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16491 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16492 wchar_t *fgetws(wchar_t * restrict s,
16493 int n, FILE * restrict stream);
16494 <b> Description</b>
16495 2 The fgetws function reads at most one less than the number of wide characters
16496 specified by n from the stream pointed to by stream into the array pointed to by s. No
16497 additional wide characters are read after a new-line wide character (which is retained) or
16498 after end-of-file. A null wide character is written immediately after the last wide
16499 character read into the array.
16500 <b> Returns</b>
16501 3 The fgetws function returns s if successful. If end-of-file is encountered and no
16502 characters have been read into the array, the contents of the array remain unchanged and a
16503 null pointer is returned. If a read or encoding error occurs during the operation, the array
16504 contents are indeterminate and a null pointer is returned.
16505 <a name="7.29.3.3" href="#7.29.3.3"><b> 7.29.3.3 The fputwc function</b></a>
16506 <b> Synopsis</b>
16507 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16508 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16509 wint_t fputwc(wchar_t c, FILE *stream);
16510 <b> Description</b>
16511 2 The fputwc function writes the wide character specified by c to the output stream
16512 pointed to by stream, at the position indicated by the associated file position indicator
16513 for the stream (if defined), and advances the indicator appropriately. If the file cannot
16515 <sup><a name="note341" href="#note341"><b>341)</b></a></sup> An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
16516 Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
16518 [<a name="p422" href="#p422">page 422</a>] (<a href="#Contents">Contents</a>)
16520 support positioning requests, or if the stream was opened with append mode, the
16521 character is appended to the output stream.
16522 <b> Returns</b>
16523 3 The fputwc function returns the wide character written. If a write error occurs, the
16524 error indicator for the stream is set and fputwc returns WEOF. If an encoding error
16525 occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
16526 <a name="7.29.3.4" href="#7.29.3.4"><b> 7.29.3.4 The fputws function</b></a>
16527 <b> Synopsis</b>
16528 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16529 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16530 int fputws(const wchar_t * restrict s,
16531 FILE * restrict stream);
16532 <b> Description</b>
16533 2 The fputws function writes the wide string pointed to by s to the stream pointed to by
16534 stream. The terminating null wide character is not written.
16535 <b> Returns</b>
16536 3 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
16537 returns a nonnegative value.
16538 <a name="7.29.3.5" href="#7.29.3.5"><b> 7.29.3.5 The fwide function</b></a>
16539 <b> Synopsis</b>
16540 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16541 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16542 int fwide(FILE *stream, int mode);
16543 <b> Description</b>
16544 2 The fwide function determines the orientation of the stream pointed to by stream. If
16545 mode is greater than zero, the function first attempts to make the stream wide oriented. If
16546 mode is less than zero, the function first attempts to make the stream byte oriented.<sup><a href="#note342"><b>342)</b></a></sup>
16547 Otherwise, mode is zero and the function does not alter the orientation of the stream.
16548 <b> Returns</b>
16549 3 The fwide function returns a value greater than zero if, after the call, the stream has
16550 wide orientation, a value less than zero if the stream has byte orientation, or zero if the
16551 stream has no orientation.
16554 <sup><a name="note342" href="#note342"><b>342)</b></a></sup> If the orientation of the stream has already been determined, fwide does not change it.
16556 [<a name="p423" href="#p423">page 423</a>] (<a href="#Contents">Contents</a>)
16558 <a name="7.29.3.6" href="#7.29.3.6"><b> 7.29.3.6 The getwc function</b></a>
16559 <b> Synopsis</b>
16560 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16561 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16562 wint_t getwc(FILE *stream);
16563 <b> Description</b>
16564 2 The getwc function is equivalent to fgetwc, except that if it is implemented as a
16565 macro, it may evaluate stream more than once, so the argument should never be an
16566 expression with side effects.
16567 <b> Returns</b>
16568 3 The getwc function returns the next wide character from the input stream pointed to by
16569 stream, or WEOF.
16570 <a name="7.29.3.7" href="#7.29.3.7"><b> 7.29.3.7 The getwchar function</b></a>
16571 <b> Synopsis</b>
16572 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16573 wint_t getwchar(void);
16574 <b> Description</b>
16575 2 The getwchar function is equivalent to getwc with the argument stdin.
16576 <b> Returns</b>
16577 3 The getwchar function returns the next wide character from the input stream pointed to
16578 by stdin, or WEOF.
16579 <a name="7.29.3.8" href="#7.29.3.8"><b> 7.29.3.8 The putwc function</b></a>
16580 <b> Synopsis</b>
16581 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16582 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16583 wint_t putwc(wchar_t c, FILE *stream);
16584 <b> Description</b>
16585 2 The putwc function is equivalent to fputwc, except that if it is implemented as a
16586 macro, it may evaluate stream more than once, so that argument should never be an
16587 expression with side effects.
16588 <b> Returns</b>
16589 3 The putwc function returns the wide character written, or WEOF.
16591 [<a name="p424" href="#p424">page 424</a>] (<a href="#Contents">Contents</a>)
16593 <a name="7.29.3.9" href="#7.29.3.9"><b> 7.29.3.9 The putwchar function</b></a>
16594 <b> Synopsis</b>
16595 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16596 wint_t putwchar(wchar_t c);
16597 <b> Description</b>
16598 2 The putwchar function is equivalent to putwc with the second argument stdout.
16599 <b> Returns</b>
16600 3 The putwchar function returns the character written, or WEOF.
16601 <a name="7.29.3.10" href="#7.29.3.10"><b> 7.29.3.10 The ungetwc function</b></a>
16602 <b> Synopsis</b>
16603 1 #include <a href="#7.21">&lt;stdio.h&gt;</a>
16604 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16605 wint_t ungetwc(wint_t c, FILE *stream);
16606 <b> Description</b>
16607 2 The ungetwc function pushes the wide character specified by c back onto the input
16608 stream pointed to by stream. Pushed-back wide characters will be returned by
16609 subsequent reads on that stream in the reverse order of their pushing. A successful
16610 intervening call (with the stream pointed to by stream) to a file positioning function
16611 (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
16612 stream. The external storage corresponding to the stream is unchanged.
16613 3 One wide character of pushback is guaranteed, even if the call to the ungetwc function
16614 follows just after a call to a formatted wide character input function fwscanf,
16615 vfwscanf, vwscanf, or wscanf. If the ungetwc function is called too many times
16616 on the same stream without an intervening read or file positioning operation on that
16617 stream, the operation may fail.
16618 4 If the value of c equals that of the macro WEOF, the operation fails and the input stream is
16619 unchanged.
16620 5 A successful call to the ungetwc function clears the end-of-file indicator for the stream.
16621 The value of the file position indicator for the stream after reading or discarding all
16622 pushed-back wide characters is the same as it was before the wide characters were pushed
16623 back. For a text or binary stream, the value of its file position indicator after a successful
16624 call to the ungetwc function is unspecified until all pushed-back wide characters are
16625 read or discarded.
16627 [<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
16629 <b> Returns</b>
16630 6 The ungetwc function returns the wide character pushed back, or WEOF if the operation
16631 fails.
16632 <a name="7.29.4" href="#7.29.4"><b> 7.29.4 General wide string utilities</b></a>
16633 1 The header <a href="#7.29">&lt;wchar.h&gt;</a> declares a number of functions useful for wide string
16634 manipulation. Various methods are used for determining the lengths of the arrays, but in
16635 all cases a wchar_t * argument points to the initial (lowest addressed) element of the
16636 array. If an array is accessed beyond the end of an object, the behavior is undefined.
16637 2 Where an argument declared as size_t n determines the length of the array for a
16638 function, n can have the value zero on a call to that function. Unless explicitly stated
16639 otherwise in the description of a particular function in this subclause, pointer arguments
16640 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
16641 function that locates a wide character finds no occurrence, a function that compares two
16642 wide character sequences returns zero, and a function that copies wide characters copies
16643 zero wide characters.
16644 <a name="7.29.4.1" href="#7.29.4.1"><b> 7.29.4.1 Wide string numeric conversion functions</b></a>
16645 <a name="7.29.4.1.1" href="#7.29.4.1.1"><b> 7.29.4.1.1 The wcstod, wcstof, and wcstold functions</b></a>
16646 <b> Synopsis</b>
16647 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16648 double wcstod(const wchar_t * restrict nptr,
16649 wchar_t ** restrict endptr);
16650 float wcstof(const wchar_t * restrict nptr,
16651 wchar_t ** restrict endptr);
16652 long double wcstold(const wchar_t * restrict nptr,
16653 wchar_t ** restrict endptr);
16654 <b> Description</b>
16655 2 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
16656 string pointed to by nptr to double, float, and long double representation,
16657 respectively. First, they decompose the input string into three parts: an initial, possibly
16658 empty, sequence of white-space wide characters (as specified by the iswspace
16659 function), a subject sequence resembling a floating-point constant or representing an
16660 infinity or NaN; and a final wide string of one or more unrecognized wide characters,
16661 including the terminating null wide character of the input wide string. Then, they attempt
16662 to convert the subject sequence to a floating-point number, and return the result.
16663 3 The expected form of the subject sequence is an optional plus or minus sign, then one of
16664 the following:
16666 [<a name="p426" href="#p426">page 426</a>] (<a href="#Contents">Contents</a>)
16668 -- a nonempty sequence of decimal digits optionally containing a decimal-point wide
16669 character, then an optional exponent part as defined for the corresponding single-byte
16670 characters in <a href="#6.4.4.2">6.4.4.2</a>;
16671 -- a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
16672 decimal-point wide character, then an optional binary exponent part as defined in
16673 <a href="#6.4.4.2">6.4.4.2</a>;
16674 -- INF or INFINITY, or any other wide string equivalent except for case
16675 -- NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
16676 case in the NAN part, where:
16677 n-wchar-sequence:
16678 digit
16679 nondigit
16680 n-wchar-sequence digit
16681 n-wchar-sequence nondigit
16682 The subject sequence is defined as the longest initial subsequence of the input wide
16683 string, starting with the first non-white-space wide character, that is of the expected form.
16684 The subject sequence contains no wide characters if the input wide string is not of the
16685 expected form.
16686 4 If the subject sequence has the expected form for a floating-point number, the sequence of
16687 wide characters starting with the first digit or the decimal-point wide character
16688 (whichever occurs first) is interpreted as a floating constant according to the rules of
16689 <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
16690 if neither an exponent part nor a decimal-point wide character appears in a decimal
16691 floating point number, or if a binary exponent part does not appear in a hexadecimal
16692 floating point number, an exponent part of the appropriate type with value zero is
16693 assumed to follow the last digit in the string. If the subject sequence begins with a minus
16694 sign, the sequence is interpreted as negated.<sup><a href="#note343"><b>343)</b></a></sup> A wide character sequence INF or
16695 INFINITY is interpreted as an infinity, if representable in the return type, else like a
16696 floating constant that is too large for the range of the return type. A wide character
16697 sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
16698 in the return type, else like a subject sequence part that does not have the expected form;
16699 the meaning of the n-wchar sequence is implementation-defined.<sup><a href="#note344"><b>344)</b></a></sup> A pointer to the
16701 <sup><a name="note343" href="#note343"><b>343)</b></a></sup> It is unspecified whether a minus-signed sequence is converted to a negative number directly or by
16702 negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
16703 methods may yield different results if rounding is toward positive or negative infinity. In either case,
16704 the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
16705 <sup><a name="note344" href="#note344"><b>344)</b></a></sup> An implementation may use the n-wchar sequence to determine extra information to be represented in
16706 the NaN's significand.
16708 [<a name="p427" href="#p427">page 427</a>] (<a href="#Contents">Contents</a>)
16710 final wide string is stored in the object pointed to by endptr, provided that endptr is
16711 not a null pointer.
16712 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
16713 value resulting from the conversion is correctly rounded.
16714 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
16715 accepted.
16716 7 If the subject sequence is empty or does not have the expected form, no conversion is
16717 performed; the value of nptr is stored in the object pointed to by endptr, provided
16718 that endptr is not a null pointer.
16719 Recommended practice
16720 8 If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
16721 the result is not exactly representable, the result should be one of the two numbers in the
16722 appropriate internal format that are adjacent to the hexadecimal floating source value,
16723 with the extra stipulation that the error should have a correct sign for the current rounding
16724 direction.
16725 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
16726 <a href="#7.7">&lt;float.h&gt;</a>) significant digits, the result should be correctly rounded. If the subject
16727 sequence D has the decimal form and more than DECIMAL_DIG significant digits,
16728 consider the two bounding, adjacent decimal strings L and U, both having
16729 DECIMAL_DIG significant digits, such that the values of L, D, and U satisfy L &lt;= D &lt;= U.
16730 The result should be one of the (equal or adjacent) values that would be obtained by
16731 correctly rounding L and U according to the current rounding direction, with the extra
16732 stipulation that the error with respect to D should have a correct sign for the current
16733 rounding direction.<sup><a href="#note345"><b>345)</b></a></sup>
16734 <b> Returns</b>
16735 10 The functions return the converted value, if any. If no conversion could be performed,
16736 zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
16737 plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the
16738 return type and sign of the value), and the value of the macro ERANGE is stored in
16739 errno. If the result underflows (<a href="#7.12.1">7.12.1</a>), the functions return a value whose magnitude is
16740 no greater than the smallest normalized positive number in the return type; whether
16741 errno acquires the value ERANGE is implementation-defined.
16746 <sup><a name="note345" href="#note345"><b>345)</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
16747 to the same internal floating value, but if not will round to adjacent values.
16749 [<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
16751 <a name="7.29.4.1.2" href="#7.29.4.1.2"><b> 7.29.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</b></a>
16752 <b> Synopsis</b>
16753 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16754 long int wcstol(
16755 const wchar_t * restrict nptr,
16756 wchar_t ** restrict endptr,
16757 int base);
16758 long long int wcstoll(
16759 const wchar_t * restrict nptr,
16760 wchar_t ** restrict endptr,
16761 int base);
16762 unsigned long int wcstoul(
16763 const wchar_t * restrict nptr,
16764 wchar_t ** restrict endptr,
16765 int base);
16766 unsigned long long int wcstoull(
16767 const wchar_t * restrict nptr,
16768 wchar_t ** restrict endptr,
16769 int base);
16770 <b> Description</b>
16771 2 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
16772 portion of the wide string pointed to by nptr to long int, long long int,
16773 unsigned long int, and unsigned long long int representation,
16774 respectively. First, they decompose the input string into three parts: an initial, possibly
16775 empty, sequence of white-space wide characters (as specified by the iswspace
16776 function), a subject sequence resembling an integer represented in some radix determined
16777 by the value of base, and a final wide string of one or more unrecognized wide
16778 characters, including the terminating null wide character of the input wide string. Then,
16779 they attempt to convert the subject sequence to an integer, and return the result.
16780 3 If the value of base is zero, the expected form of the subject sequence is that of an
16781 integer constant as described for the corresponding single-byte characters in <a href="#6.4.4.1">6.4.4.1</a>,
16782 optionally preceded by a plus or minus sign, but not including an integer suffix. If the
16783 value of base is between 2 and 36 (inclusive), the expected form of the subject sequence
16784 is a sequence of letters and digits representing an integer with the radix specified by
16785 base, optionally preceded by a plus or minus sign, but not including an integer suffix.
16786 The letters from a (or A) through z (or Z) are ascribed the values 10 through 35; only
16787 letters and digits whose ascribed values are less than that of base are permitted. If the
16788 value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
16789 of letters and digits, following the sign if present.
16791 [<a name="p429" href="#p429">page 429</a>] (<a href="#Contents">Contents</a>)
16793 4 The subject sequence is defined as the longest initial subsequence of the input wide
16794 string, starting with the first non-white-space wide character, that is of the expected form.
16795 The subject sequence contains no wide characters if the input wide string is empty or
16796 consists entirely of white space, or if the first non-white-space wide character is other
16797 than a sign or a permissible letter or digit.
16798 5 If the subject sequence has the expected form and the value of base is zero, the sequence
16799 of wide characters starting with the first digit is interpreted as an integer constant
16800 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
16801 value of base is between 2 and 36, it is used as the base for conversion, ascribing to each
16802 letter its value as given above. If the subject sequence begins with a minus sign, the value
16803 resulting from the conversion is negated (in the return type). A pointer to the final wide
16804 string is stored in the object pointed to by endptr, provided that endptr is not a null
16805 pointer.
16806 6 In other than the "C" locale, additional locale-specific subject sequence forms may be
16807 accepted.
16808 7 If the subject sequence is empty or does not have the expected form, no conversion is
16809 performed; the value of nptr is stored in the object pointed to by endptr, provided
16810 that endptr is not a null pointer.
16811 <b> Returns</b>
16812 8 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
16813 value, if any. If no conversion could be performed, zero is returned. If the correct value
16814 is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
16815 LLONG_MAX, ULONG_MAX, or ULLONG_MAX is returned (according to the return type
16816 sign of the value, if any), and the value of the macro ERANGE is stored in errno.
16817 <a name="7.29.4.2" href="#7.29.4.2"><b> 7.29.4.2 Wide string copying functions</b></a>
16818 <a name="7.29.4.2.1" href="#7.29.4.2.1"><b> 7.29.4.2.1 The wcscpy function</b></a>
16819 <b> Synopsis</b>
16820 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16821 wchar_t *wcscpy(wchar_t * restrict s1,
16822 const wchar_t * restrict s2);
16823 <b> Description</b>
16824 2 The wcscpy function copies the wide string pointed to by s2 (including the terminating
16825 null wide character) into the array pointed to by s1.
16826 <b> Returns</b>
16827 3 The wcscpy function returns the value of s1.
16829 [<a name="p430" href="#p430">page 430</a>] (<a href="#Contents">Contents</a>)
16831 <a name="7.29.4.2.2" href="#7.29.4.2.2"><b> 7.29.4.2.2 The wcsncpy function</b></a>
16832 <b> Synopsis</b>
16833 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16834 wchar_t *wcsncpy(wchar_t * restrict s1,
16835 const wchar_t * restrict s2,
16836 size_t n);
16837 <b> Description</b>
16838 2 The wcsncpy function copies not more than n wide characters (those that follow a null
16839 wide character are not copied) from the array pointed to by s2 to the array pointed to by
16840 s1.<sup><a href="#note346"><b>346)</b></a></sup>
16841 3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
16842 wide characters are appended to the copy in the array pointed to by s1, until n wide
16843 characters in all have been written.
16844 <b> Returns</b>
16845 4 The wcsncpy function returns the value of s1.
16846 <a name="7.29.4.2.3" href="#7.29.4.2.3"><b> 7.29.4.2.3 The wmemcpy function</b></a>
16847 <b> Synopsis</b>
16848 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16849 wchar_t *wmemcpy(wchar_t * restrict s1,
16850 const wchar_t * restrict s2,
16851 size_t n);
16852 <b> Description</b>
16853 2 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
16854 object pointed to by s1.
16855 <b> Returns</b>
16856 3 The wmemcpy function returns the value of s1.
16861 <sup><a name="note346" href="#note346"><b>346)</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
16862 result will not be null-terminated.
16864 [<a name="p431" href="#p431">page 431</a>] (<a href="#Contents">Contents</a>)
16866 <a name="7.29.4.2.4" href="#7.29.4.2.4"><b> 7.29.4.2.4 The wmemmove function</b></a>
16867 <b> Synopsis</b>
16868 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16869 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
16870 size_t n);
16871 <b> Description</b>
16872 2 The wmemmove function copies n wide characters from the object pointed to by s2 to
16873 the object pointed to by s1. Copying takes place as if the n wide characters from the
16874 object pointed to by s2 are first copied into a temporary array of n wide characters that
16875 does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
16876 the temporary array are copied into the object pointed to by s1.
16877 <b> Returns</b>
16878 3 The wmemmove function returns the value of s1.
16879 <a name="7.29.4.3" href="#7.29.4.3"><b> 7.29.4.3 Wide string concatenation functions</b></a>
16880 <a name="7.29.4.3.1" href="#7.29.4.3.1"><b> 7.29.4.3.1 The wcscat function</b></a>
16881 <b> Synopsis</b>
16882 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16883 wchar_t *wcscat(wchar_t * restrict s1,
16884 const wchar_t * restrict s2);
16885 <b> Description</b>
16886 2 The wcscat function appends a copy of the wide string pointed to by s2 (including the
16887 terminating null wide character) to the end of the wide string pointed to by s1. The initial
16888 wide character of s2 overwrites the null wide character at the end of s1.
16889 <b> Returns</b>
16890 3 The wcscat function returns the value of s1.
16891 <a name="7.29.4.3.2" href="#7.29.4.3.2"><b> 7.29.4.3.2 The wcsncat function</b></a>
16892 <b> Synopsis</b>
16893 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16894 wchar_t *wcsncat(wchar_t * restrict s1,
16895 const wchar_t * restrict s2,
16896 size_t n);
16897 <b> Description</b>
16898 2 The wcsncat function appends not more than n wide characters (a null wide character
16899 and those that follow it are not appended) from the array pointed to by s2 to the end of
16901 [<a name="p432" href="#p432">page 432</a>] (<a href="#Contents">Contents</a>)
16903 the wide string pointed to by s1. The initial wide character of s2 overwrites the null
16904 wide character at the end of s1. A terminating null wide character is always appended to
16905 the result.<sup><a href="#note347"><b>347)</b></a></sup>
16906 <b> Returns</b>
16907 3 The wcsncat function returns the value of s1.
16908 <a name="7.29.4.4" href="#7.29.4.4"><b> 7.29.4.4 Wide string comparison functions</b></a>
16909 1 Unless explicitly stated otherwise, the functions described in this subclause order two
16910 wide characters the same way as two integers of the underlying integer type designated
16911 by wchar_t.
16912 <a name="7.29.4.4.1" href="#7.29.4.4.1"><b> 7.29.4.4.1 The wcscmp function</b></a>
16913 <b> Synopsis</b>
16914 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16915 int wcscmp(const wchar_t *s1, const wchar_t *s2);
16916 <b> Description</b>
16917 2 The wcscmp function compares the wide string pointed to by s1 to the wide string
16918 pointed to by s2.
16919 <b> Returns</b>
16920 3 The wcscmp function returns an integer greater than, equal to, or less than zero,
16921 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
16922 wide string pointed to by s2.
16923 <a name="7.29.4.4.2" href="#7.29.4.4.2"><b> 7.29.4.4.2 The wcscoll function</b></a>
16924 <b> Synopsis</b>
16925 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16926 int wcscoll(const wchar_t *s1, const wchar_t *s2);
16927 <b> Description</b>
16928 2 The wcscoll function compares the wide string pointed to by s1 to the wide string
16929 pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
16930 current locale.
16931 <b> Returns</b>
16932 3 The wcscoll function returns an integer greater than, equal to, or less than zero,
16933 accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
16936 <sup><a name="note347" href="#note347"><b>347)</b></a></sup> Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
16937 wcslen(s1)+n+1.
16939 [<a name="p433" href="#p433">page 433</a>] (<a href="#Contents">Contents</a>)
16941 wide string pointed to by s2 when both are interpreted as appropriate to the current
16942 locale.
16943 <a name="7.29.4.4.3" href="#7.29.4.4.3"><b> 7.29.4.4.3 The wcsncmp function</b></a>
16944 <b> Synopsis</b>
16945 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16946 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
16947 size_t n);
16948 <b> Description</b>
16949 2 The wcsncmp function compares not more than n wide characters (those that follow a
16950 null wide character are not compared) from the array pointed to by s1 to the array
16951 pointed to by s2.
16952 <b> Returns</b>
16953 3 The wcsncmp function returns an integer greater than, equal to, or less than zero,
16954 accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
16955 to, or less than the possibly null-terminated array pointed to by s2.
16956 <a name="7.29.4.4.4" href="#7.29.4.4.4"><b> 7.29.4.4.4 The wcsxfrm function</b></a>
16957 <b> Synopsis</b>
16958 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16959 size_t wcsxfrm(wchar_t * restrict s1,
16960 const wchar_t * restrict s2,
16961 size_t n);
16962 <b> Description</b>
16963 2 The wcsxfrm function transforms the wide string pointed to by s2 and places the
16964 resulting wide string into the array pointed to by s1. The transformation is such that if
16965 the wcscmp function is applied to two transformed wide strings, it returns a value greater
16966 than, equal to, or less than zero, corresponding to the result of the wcscoll function
16967 applied to the same two original wide strings. No more than n wide characters are placed
16968 into the resulting array pointed to by s1, including the terminating null wide character. If
16969 n is zero, s1 is permitted to be a null pointer.
16970 <b> Returns</b>
16971 3 The wcsxfrm function returns the length of the transformed wide string (not including
16972 the terminating null wide character). If the value returned is n or greater, the contents of
16973 the array pointed to by s1 are indeterminate.
16974 4 EXAMPLE The value of the following expression is the length of the array needed to hold the
16975 transformation of the wide string pointed to by s:
16977 [<a name="p434" href="#p434">page 434</a>] (<a href="#Contents">Contents</a>)
16979 1 + wcsxfrm(NULL, s, 0)
16981 <a name="7.29.4.4.5" href="#7.29.4.4.5"><b> 7.29.4.4.5 The wmemcmp function</b></a>
16982 <b> Synopsis</b>
16983 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16984 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
16985 size_t n);
16986 <b> Description</b>
16987 2 The wmemcmp function compares the first n wide characters of the object pointed to by
16988 s1 to the first n wide characters of the object pointed to by s2.
16989 <b> Returns</b>
16990 3 The wmemcmp function returns an integer greater than, equal to, or less than zero,
16991 accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
16992 pointed to by s2.
16993 <a name="7.29.4.5" href="#7.29.4.5"><b> 7.29.4.5 Wide string search functions</b></a>
16994 <a name="7.29.4.5.1" href="#7.29.4.5.1"><b> 7.29.4.5.1 The wcschr function</b></a>
16995 <b> Synopsis</b>
16996 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
16997 wchar_t *wcschr(const wchar_t *s, wchar_t c);
16998 <b> Description</b>
16999 2 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
17000 The terminating null wide character is considered to be part of the wide string.
17001 <b> Returns</b>
17002 3 The wcschr function returns a pointer to the located wide character, or a null pointer if
17003 the wide character does not occur in the wide string.
17004 <a name="7.29.4.5.2" href="#7.29.4.5.2"><b> 7.29.4.5.2 The wcscspn function</b></a>
17005 <b> Synopsis</b>
17006 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17007 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
17008 <b> Description</b>
17009 2 The wcscspn function computes the length of the maximum initial segment of the wide
17010 string pointed to by s1 which consists entirely of wide characters not from the wide
17011 string pointed to by s2.
17013 [<a name="p435" href="#p435">page 435</a>] (<a href="#Contents">Contents</a>)
17015 <b> Returns</b>
17016 3 The wcscspn function returns the length of the segment.
17017 <a name="7.29.4.5.3" href="#7.29.4.5.3"><b> 7.29.4.5.3 The wcspbrk function</b></a>
17018 <b> Synopsis</b>
17019 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17020 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
17021 <b> Description</b>
17022 2 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
17023 any wide character from the wide string pointed to by s2.
17024 <b> Returns</b>
17025 3 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
17026 no wide character from s2 occurs in s1.
17027 <a name="7.29.4.5.4" href="#7.29.4.5.4"><b> 7.29.4.5.4 The wcsrchr function</b></a>
17028 <b> Synopsis</b>
17029 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17030 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
17031 <b> Description</b>
17032 2 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
17033 s. The terminating null wide character is considered to be part of the wide string.
17034 <b> Returns</b>
17035 3 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
17036 not occur in the wide string.
17037 <a name="7.29.4.5.5" href="#7.29.4.5.5"><b> 7.29.4.5.5 The wcsspn function</b></a>
17038 <b> Synopsis</b>
17039 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17040 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
17041 <b> Description</b>
17042 2 The wcsspn function computes the length of the maximum initial segment of the wide
17043 string pointed to by s1 which consists entirely of wide characters from the wide string
17044 pointed to by s2.
17045 <b> Returns</b>
17046 3 The wcsspn function returns the length of the segment.
17048 [<a name="p436" href="#p436">page 436</a>] (<a href="#Contents">Contents</a>)
17050 <a name="7.29.4.5.6" href="#7.29.4.5.6"><b> 7.29.4.5.6 The wcsstr function</b></a>
17051 <b> Synopsis</b>
17052 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17053 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
17054 <b> Description</b>
17055 2 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
17056 the sequence of wide characters (excluding the terminating null wide character) in the
17057 wide string pointed to by s2.
17058 <b> Returns</b>
17059 3 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
17060 wide string is not found. If s2 points to a wide string with zero length, the function
17061 returns s1.
17062 <a name="7.29.4.5.7" href="#7.29.4.5.7"><b> 7.29.4.5.7 The wcstok function</b></a>
17063 <b> Synopsis</b>
17064 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17065 wchar_t *wcstok(wchar_t * restrict s1,
17066 const wchar_t * restrict s2,
17067 wchar_t ** restrict ptr);
17068 <b> Description</b>
17069 2 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
17070 a sequence of tokens, each of which is delimited by a wide character from the wide string
17071 pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
17072 which the wcstok function stores information necessary for it to continue scanning the
17073 same wide string.
17074 3 The first call in a sequence has a non-null first argument and stores an initial value in the
17075 object pointed to by ptr. Subsequent calls in the sequence have a null first argument and
17076 the object pointed to by ptr is required to have the value stored by the previous call in
17077 the sequence, which is then updated. The separator wide string pointed to by s2 may be
17078 different from call to call.
17079 4 The first call in the sequence searches the wide string pointed to by s1 for the first wide
17080 character that is not contained in the current separator wide string pointed to by s2. If no
17081 such wide character is found, then there are no tokens in the wide string pointed to by s1
17082 and the wcstok function returns a null pointer. If such a wide character is found, it is
17083 the start of the first token.
17084 5 The wcstok function then searches from there for a wide character that is contained in
17085 the current separator wide string. If no such wide character is found, the current token
17087 [<a name="p437" href="#p437">page 437</a>] (<a href="#Contents">Contents</a>)
17089 extends to the end of the wide string pointed to by s1, and subsequent searches in the
17090 same wide string for a token return a null pointer. If such a wide character is found, it is
17091 overwritten by a null wide character, which terminates the current token.
17092 6 In all cases, the wcstok function stores sufficient information in the pointer pointed to
17093 by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
17094 value for ptr, shall start searching just past the element overwritten by a null wide
17095 character (if any).
17096 <b> Returns</b>
17097 7 The wcstok function returns a pointer to the first wide character of a token, or a null
17098 pointer if there is no token.
17099 8 EXAMPLE
17100 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17101 static wchar_t str1[] = L"?a???b,,,#c";
17102 static wchar_t str2[] = L"\t \t";
17103 wchar_t *t, *ptr1, *ptr2;
17104 t = wcstok(str1, L"?", &amp;ptr1); // t points to the token L"a"
17105 t = wcstok(NULL, L",", &amp;ptr1); // t points to the token L"??b"
17106 t = wcstok(str2, L" \t", &amp;ptr2); // t is a null pointer
17107 t = wcstok(NULL, L"#,", &amp;ptr1); // t points to the token L"c"
17108 t = wcstok(NULL, L"?", &amp;ptr1); // t is a null pointer
17110 <a name="7.29.4.5.8" href="#7.29.4.5.8"><b> 7.29.4.5.8 The wmemchr function</b></a>
17111 <b> Synopsis</b>
17112 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17113 wchar_t *wmemchr(const wchar_t *s, wchar_t c,
17114 size_t n);
17115 <b> Description</b>
17116 2 The wmemchr function locates the first occurrence of c in the initial n wide characters of
17117 the object pointed to by s.
17118 <b> Returns</b>
17119 3 The wmemchr function returns a pointer to the located wide character, or a null pointer if
17120 the wide character does not occur in the object.
17122 [<a name="p438" href="#p438">page 438</a>] (<a href="#Contents">Contents</a>)
17124 <a name="7.29.4.6" href="#7.29.4.6"><b> 7.29.4.6 Miscellaneous functions</b></a>
17125 <a name="7.29.4.6.1" href="#7.29.4.6.1"><b> 7.29.4.6.1 The wcslen function</b></a>
17126 <b> Synopsis</b>
17127 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17128 size_t wcslen(const wchar_t *s);
17129 <b> Description</b>
17130 2 The wcslen function computes the length of the wide string pointed to by s.
17131 <b> Returns</b>
17132 3 The wcslen function returns the number of wide characters that precede the terminating
17133 null wide character.
17134 <a name="7.29.4.6.2" href="#7.29.4.6.2"><b> 7.29.4.6.2 The wmemset function</b></a>
17135 <b> Synopsis</b>
17136 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17137 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
17138 <b> Description</b>
17139 2 The wmemset function copies the value of c into each of the first n wide characters of
17140 the object pointed to by s.
17141 <b> Returns</b>
17142 3 The wmemset function returns the value of s.
17143 <a name="7.29.5" href="#7.29.5"><b> 7.29.5 Wide character time conversion functions</b></a>
17144 <a name="7.29.5.1" href="#7.29.5.1"><b> 7.29.5.1 The wcsftime function</b></a>
17145 <b> Synopsis</b>
17146 1 #include <a href="#7.27">&lt;time.h&gt;</a>
17147 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17148 size_t wcsftime(wchar_t * restrict s,
17149 size_t maxsize,
17150 const wchar_t * restrict format,
17151 const struct tm * restrict timeptr);
17152 <b> Description</b>
17153 2 The wcsftime function is equivalent to the strftime function, except that:
17154 -- The argument s points to the initial element of an array of wide characters into which
17155 the generated output is to be placed.
17157 [<a name="p439" href="#p439">page 439</a>] (<a href="#Contents">Contents</a>)
17159 -- The argument maxsize indicates the limiting number of wide characters.
17160 -- The argument format is a wide string and the conversion specifiers are replaced by
17161 corresponding sequences of wide characters.
17162 -- The return value indicates the number of wide characters.
17163 <b> Returns</b>
17164 3 If the total number of resulting wide characters including the terminating null wide
17165 character is not more than maxsize, the wcsftime function returns the number of
17166 wide characters placed into the array pointed to by s not including the terminating null
17167 wide character. Otherwise, zero is returned and the contents of the array are
17168 indeterminate.
17169 <a name="7.29.6" href="#7.29.6"><b> 7.29.6 Extended multibyte/wide character conversion utilities</b></a>
17170 1 The header <a href="#7.29">&lt;wchar.h&gt;</a> declares an extended set of functions useful for conversion
17171 between multibyte characters and wide characters.
17172 2 Most of the following functions -- those that are listed as ''restartable'', <a href="#7.29.6.3">7.29.6.3</a> and
17173 <a href="#7.29.6.4">7.29.6.4</a> -- take as a last argument a pointer to an object of type mbstate_t that is used
17174 to describe the current conversion state from a particular multibyte character sequence to
17175 a wide character sequence (or the reverse) under the rules of a particular setting for the
17176 LC_CTYPE category of the current locale.
17177 3 The initial conversion state corresponds, for a conversion in either direction, to the
17178 beginning of a new multibyte character in the initial shift state. A zero-valued
17179 mbstate_t object is (at least) one way to describe an initial conversion state. A zero-
17180 valued mbstate_t object can be used to initiate conversion involving any multibyte
17181 character sequence, in any LC_CTYPE category setting. If an mbstate_t object has
17182 been altered by any of the functions described in this subclause, and is then used with a
17183 different multibyte character sequence, or in the other conversion direction, or with a
17184 different LC_CTYPE category setting than on earlier function calls, the behavior is
17185 undefined.<sup><a href="#note348"><b>348)</b></a></sup>
17186 4 On entry, each function takes the described conversion state (either internal or pointed to
17187 by an argument) as current. The conversion state described by the referenced object is
17188 altered as needed to track the shift state, and the position within a multibyte character, for
17189 the associated multibyte character sequence.
17194 <sup><a name="note348" href="#note348"><b>348)</b></a></sup> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
17195 mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
17196 character string.
17198 [<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
17200 <a name="7.29.6.1" href="#7.29.6.1"><b> 7.29.6.1 Single-byte/wide character conversion functions</b></a>
17201 <a name="7.29.6.1.1" href="#7.29.6.1.1"><b> 7.29.6.1.1 The btowc function</b></a>
17202 <b> Synopsis</b>
17203 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17204 wint_t btowc(int c);
17205 <b> Description</b>
17206 2 The btowc function determines whether c constitutes a valid single-byte character in the
17207 initial shift state.
17208 <b> Returns</b>
17209 3 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
17210 does not constitute a valid single-byte character in the initial shift state. Otherwise, it
17211 returns the wide character representation of that character.
17212 <a name="7.29.6.1.2" href="#7.29.6.1.2"><b> 7.29.6.1.2 The wctob function</b></a>
17213 <b> Synopsis</b>
17214 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17215 int wctob(wint_t c);
17216 <b> Description</b>
17217 2 The wctob function determines whether c corresponds to a member of the extended
17218 character set whose multibyte character representation is a single byte when in the initial
17219 shift state.
17220 <b> Returns</b>
17221 3 The wctob function returns EOF if c does not correspond to a multibyte character with
17222 length one in the initial shift state. Otherwise, it returns the single-byte representation of
17223 that character as an unsigned char converted to an int.
17224 <a name="7.29.6.2" href="#7.29.6.2"><b> 7.29.6.2 Conversion state functions</b></a>
17225 <a name="7.29.6.2.1" href="#7.29.6.2.1"><b> 7.29.6.2.1 The mbsinit function</b></a>
17226 <b> Synopsis</b>
17227 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17228 int mbsinit(const mbstate_t *ps);
17229 <b> Description</b>
17230 2 If ps is not a null pointer, the mbsinit function determines whether the referenced
17231 mbstate_t object describes an initial conversion state.
17233 [<a name="p441" href="#p441">page 441</a>] (<a href="#Contents">Contents</a>)
17235 <b> Returns</b>
17236 3 The mbsinit function returns nonzero if ps is a null pointer or if the referenced object
17237 describes an initial conversion state; otherwise, it returns zero.
17238 <a name="7.29.6.3" href="#7.29.6.3"><b> 7.29.6.3 Restartable multibyte/wide character conversion functions</b></a>
17239 1 These functions differ from the corresponding multibyte character functions of <a href="#7.22.7">7.22.7</a>
17240 (mblen, mbtowc, and wctomb) in that they have an extra parameter, ps, of type
17241 pointer to mbstate_t that points to an object that can completely describe the current
17242 conversion state of the associated multibyte character sequence. If ps is a null pointer,
17243 each function uses its own internal mbstate_t object instead, which is initialized at
17244 program startup to the initial conversion state; the functions are not required to avoid data
17245 races with other calls to the same function in this case. The implementation behaves as if
17246 no library function calls these functions with a null pointer for ps.
17247 2 Also unlike their corresponding functions, the return value does not represent whether the
17248 encoding is state-dependent.
17249 <a name="7.29.6.3.1" href="#7.29.6.3.1"><b> 7.29.6.3.1 The mbrlen function</b></a>
17250 <b> Synopsis</b>
17251 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17252 size_t mbrlen(const char * restrict s,
17253 size_t n,
17254 mbstate_t * restrict ps);
17255 <b> Description</b>
17256 2 The mbrlen function is equivalent to the call:
17257 mbrtowc(NULL, s, n, ps != NULL ? ps : &amp;internal)
17258 where internal is the mbstate_t object for the mbrlen function, except that the
17259 expression designated by ps is evaluated only once.
17260 <b> Returns</b>
17261 3 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
17262 or (size_t)(-1).
17263 Forward references: the mbrtowc function (<a href="#7.29.6.3.2">7.29.6.3.2</a>).
17265 [<a name="p442" href="#p442">page 442</a>] (<a href="#Contents">Contents</a>)
17267 <a name="7.29.6.3.2" href="#7.29.6.3.2"><b> 7.29.6.3.2 The mbrtowc function</b></a>
17268 <b> Synopsis</b>
17269 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17270 size_t mbrtowc(wchar_t * restrict pwc,
17271 const char * restrict s,
17272 size_t n,
17273 mbstate_t * restrict ps);
17274 <b> Description</b>
17275 2 If s is a null pointer, the mbrtowc function is equivalent to the call:
17276 mbrtowc(NULL, "", 1, ps)
17277 In this case, the values of the parameters pwc and n are ignored.
17278 3 If s is not a null pointer, the mbrtowc function inspects at most n bytes beginning with
17279 the byte pointed to by s to determine the number of bytes needed to complete the next
17280 multibyte character (including any shift sequences). If the function determines that the
17281 next multibyte character is complete and valid, it determines the value of the
17282 corresponding wide character and then, if pwc is not a null pointer, stores that value in
17283 the object pointed to by pwc. If the corresponding wide character is the null wide
17284 character, the resulting state described is the initial conversion state.
17285 <b> Returns</b>
17286 4 The mbrtowc function returns the first of the following that applies (given the current
17287 conversion state):
17288 0 if the next n or fewer bytes complete the multibyte character that
17289 corresponds to the null wide character (which is the value stored).
17290 between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
17291 character (which is the value stored); the value returned is the number
17292 of bytes that complete the multibyte character.
17293 (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
17294 multibyte character, and all n bytes have been processed (no value is
17295 stored).<sup><a href="#note349"><b>349)</b></a></sup>
17296 (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
17297 do not contribute to a complete and valid multibyte character (no
17298 value is stored); the value of the macro EILSEQ is stored in errno,
17299 and the conversion state is unspecified.
17301 <sup><a name="note349" href="#note349"><b>349)</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
17302 sequence of redundant shift sequences (for implementations with state-dependent encodings).
17304 [<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
17306 <a name="7.29.6.3.3" href="#7.29.6.3.3"><b> 7.29.6.3.3 The wcrtomb function</b></a>
17307 <b> Synopsis</b>
17308 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17309 size_t wcrtomb(char * restrict s,
17310 wchar_t wc,
17311 mbstate_t * restrict ps);
17312 <b> Description</b>
17313 2 If s is a null pointer, the wcrtomb function is equivalent to the call
17314 wcrtomb(buf, L'\0', ps)
17315 where buf is an internal buffer.
17316 3 If s is not a null pointer, the wcrtomb function determines the number of bytes needed
17317 to represent the multibyte character that corresponds to the wide character given by wc
17318 (including any shift sequences), and stores the multibyte character representation in the
17319 array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
17320 wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
17321 to restore the initial shift state; the resulting state described is the initial conversion state.
17322 <b> Returns</b>
17323 4 The wcrtomb function returns the number of bytes stored in the array object (including
17324 any shift sequences). When wc is not a valid wide character, an encoding error occurs:
17325 the function stores the value of the macro EILSEQ in errno and returns
17326 (size_t)(-1); the conversion state is unspecified.
17327 <a name="7.29.6.4" href="#7.29.6.4"><b> 7.29.6.4 Restartable multibyte/wide string conversion functions</b></a>
17328 1 These functions differ from the corresponding multibyte string functions of <a href="#7.22.8">7.22.8</a>
17329 (mbstowcs and wcstombs) in that they have an extra parameter, ps, of type pointer to
17330 mbstate_t that points to an object that can completely describe the current conversion
17331 state of the associated multibyte character sequence. If ps is a null pointer, each function
17332 uses its own internal mbstate_t object instead, which is initialized at program startup
17333 to the initial conversion state; the functions are not required to avoid data races with other
17334 calls to the same function in this case. The implementation behaves as if no library
17335 function calls these functions with a null pointer for ps.
17336 2 Also unlike their corresponding functions, the conversion source parameter, src, has a
17337 pointer-to-pointer type. When the function is storing the results of conversions (that is,
17338 when dst is not a null pointer), the pointer object pointed to by this parameter is updated
17339 to reflect the amount of the source processed by that invocation.
17341 [<a name="p444" href="#p444">page 444</a>] (<a href="#Contents">Contents</a>)
17343 <a name="7.29.6.4.1" href="#7.29.6.4.1"><b> 7.29.6.4.1 The mbsrtowcs function</b></a>
17344 <b> Synopsis</b>
17345 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17346 size_t mbsrtowcs(wchar_t * restrict dst,
17347 const char ** restrict src,
17348 size_t len,
17349 mbstate_t * restrict ps);
17350 <b> Description</b>
17351 2 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
17352 conversion state described by the object pointed to by ps, from the array indirectly
17353 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
17354 pointer, the converted characters are stored into the array pointed to by dst. Conversion
17355 continues up to and including a terminating null character, which is also stored.
17356 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
17357 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
17358 characters have been stored into the array pointed to by dst.<sup><a href="#note350"><b>350)</b></a></sup> Each conversion takes
17359 place as if by a call to the mbrtowc function.
17360 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
17361 pointer (if conversion stopped due to reaching a terminating null character) or the address
17362 just past the last multibyte character converted (if any). If conversion stopped due to
17363 reaching a terminating null character and if dst is not a null pointer, the resulting state
17364 described is the initial conversion state.
17365 <b> Returns</b>
17366 4 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
17367 character, an encoding error occurs: the mbsrtowcs function stores the value of the
17368 macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
17369 unspecified. Otherwise, it returns the number of multibyte characters successfully
17370 converted, not including the terminating null character (if any).
17375 <sup><a name="note350" href="#note350"><b>350)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
17377 [<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
17379 <a name="7.29.6.4.2" href="#7.29.6.4.2"><b> 7.29.6.4.2 The wcsrtombs function</b></a>
17380 <b> Synopsis</b>
17381 1 #include <a href="#7.29">&lt;wchar.h&gt;</a>
17382 size_t wcsrtombs(char * restrict dst,
17383 const wchar_t ** restrict src,
17384 size_t len,
17385 mbstate_t * restrict ps);
17386 <b> Description</b>
17387 2 The wcsrtombs function converts a sequence of wide characters from the array
17388 indirectly pointed to by src into a sequence of corresponding multibyte characters that
17389 begins in the conversion state described by the object pointed to by ps. If dst is not a
17390 null pointer, the converted characters are then stored into the array pointed to by dst.
17391 Conversion continues up to and including a terminating null wide character, which is also
17392 stored. Conversion stops earlier in two cases: when a wide character is reached that does
17393 not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
17394 next multibyte character would exceed the limit of len total bytes to be stored into the
17395 array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
17396 function.<sup><a href="#note351"><b>351)</b></a></sup>
17397 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
17398 pointer (if conversion stopped due to reaching a terminating null wide character) or the
17399 address just past the last wide character converted (if any). If conversion stopped due to
17400 reaching a terminating null wide character, the resulting state described is the initial
17401 conversion state.
17402 <b> Returns</b>
17403 4 If conversion stops because a wide character is reached that does not correspond to a
17404 valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
17405 value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
17406 state is unspecified. Otherwise, it returns the number of bytes in the resulting multibyte
17407 character sequence, not including the terminating null character (if any).
17412 <sup><a name="note351" href="#note351"><b>351)</b></a></sup> If conversion stops because a terminating null wide character has been reached, the bytes stored
17413 include those necessary to reach the initial shift state immediately before the null byte.
17415 [<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
17417 <a name="7.30" href="#7.30"><b> 7.30 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
17418 <a name="7.30.1" href="#7.30.1"><b> 7.30.1 Introduction</b></a>
17419 1 The header <a href="#7.30">&lt;wctype.h&gt;</a> defines one macro, and declares three data types and many
17420 functions.<sup><a href="#note352"><b>352)</b></a></sup>
17421 2 The types declared are
17422 wint_t
17423 described in <a href="#7.29.1">7.29.1</a>;
17424 wctrans_t
17425 which is a scalar type that can hold values which represent locale-specific character
17426 mappings; and
17427 wctype_t
17428 which is a scalar type that can hold values which represent locale-specific character
17429 classifications.
17430 3 The macro defined is WEOF (described in <a href="#7.29.1">7.29.1</a>).
17431 4 The functions declared are grouped as follows:
17432 -- Functions that provide wide character classification;
17433 -- Extensible functions that provide wide character classification;
17434 -- Functions that provide wide character case mapping;
17435 -- Extensible functions that provide wide character mapping.
17436 5 For all functions described in this subclause that accept an argument of type wint_t, the
17437 value shall be representable as a wchar_t or shall equal the value of the macro WEOF. If
17438 this argument has any other value, the behavior is undefined.
17439 6 The behavior of these functions is affected by the LC_CTYPE category of the current
17440 locale.
17445 <sup><a name="note352" href="#note352"><b>352)</b></a></sup> See ''future library directions'' (<a href="#7.31.17">7.31.17</a>).
17447 [<a name="p447" href="#p447">page 447</a>] (<a href="#Contents">Contents</a>)
17449 <a name="7.30.2" href="#7.30.2"><b> 7.30.2 Wide character classification utilities</b></a>
17450 1 The header <a href="#7.30">&lt;wctype.h&gt;</a> declares several functions useful for classifying wide
17451 characters.
17452 2 The term printing wide character refers to a member of a locale-specific set of wide
17453 characters, each of which occupies at least one printing position on a display device. The
17454 term control wide character refers to a member of a locale-specific set of wide characters
17455 that are not printing wide characters.
17456 <a name="7.30.2.1" href="#7.30.2.1"><b> 7.30.2.1 Wide character classification functions</b></a>
17457 1 The functions in this subclause return nonzero (true) if and only if the value of the
17458 argument wc conforms to that in the description of the function.
17459 2 Each of the following functions returns true for each wide character that corresponds (as
17460 if by a call to the wctob function) to a single-byte character for which the corresponding
17461 character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
17462 iswpunct functions may differ with respect to wide characters other than L' ' that are
17463 both printing and white-space wide characters.<sup><a href="#note353"><b>353)</b></a></sup>
17464 Forward references: the wctob function (<a href="#7.29.6.1.2">7.29.6.1.2</a>).
17465 <a name="7.30.2.1.1" href="#7.30.2.1.1"><b> 7.30.2.1.1 The iswalnum function</b></a>
17466 <b> Synopsis</b>
17467 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17468 int iswalnum(wint_t wc);
17469 <b> Description</b>
17470 2 The iswalnum function tests for any wide character for which iswalpha or
17471 iswdigit is true.
17472 <a name="7.30.2.1.2" href="#7.30.2.1.2"><b> 7.30.2.1.2 The iswalpha function</b></a>
17473 <b> Synopsis</b>
17474 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17475 int iswalpha(wint_t wc);
17476 <b> Description</b>
17477 2 The iswalpha function tests for any wide character for which iswupper or
17478 iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
17480 <sup><a name="note353" href="#note353"><b>353)</b></a></sup> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
17481 iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
17482 (which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
17483 &amp;&amp; iswspace(wc) is true, but not both.
17485 [<a name="p448" href="#p448">page 448</a>] (<a href="#Contents">Contents</a>)
17487 wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
17488 is true.<sup><a href="#note354"><b>354)</b></a></sup>
17489 <a name="7.30.2.1.3" href="#7.30.2.1.3"><b> 7.30.2.1.3 The iswblank function</b></a>
17490 <b> Synopsis</b>
17491 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17492 int iswblank(wint_t wc);
17493 <b> Description</b>
17494 2 The iswblank function tests for any wide character that is a standard blank wide
17495 character or is one of a locale-specific set of wide characters for which iswspace is true
17496 and that is used to separate words within a line of text. The standard blank wide
17497 characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
17498 locale, iswblank returns true only for the standard blank characters.
17499 <a name="7.30.2.1.4" href="#7.30.2.1.4"><b> 7.30.2.1.4 The iswcntrl function</b></a>
17500 <b> Synopsis</b>
17501 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17502 int iswcntrl(wint_t wc);
17503 <b> Description</b>
17504 2 The iswcntrl function tests for any control wide character.
17505 <a name="7.30.2.1.5" href="#7.30.2.1.5"><b> 7.30.2.1.5 The iswdigit function</b></a>
17506 <b> Synopsis</b>
17507 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17508 int iswdigit(wint_t wc);
17509 <b> Description</b>
17510 2 The iswdigit function tests for any wide character that corresponds to a decimal-digit
17511 character (as defined in <a href="#5.2.1">5.2.1</a>).
17512 <a name="7.30.2.1.6" href="#7.30.2.1.6"><b> 7.30.2.1.6 The iswgraph function</b></a>
17513 <b> Synopsis</b>
17514 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17515 int iswgraph(wint_t wc);
17520 <sup><a name="note354" href="#note354"><b>354)</b></a></sup> The functions iswlower and iswupper test true or false separately for each of these additional
17521 wide characters; all four combinations are possible.
17523 [<a name="p449" href="#p449">page 449</a>] (<a href="#Contents">Contents</a>)
17525 <b> Description</b>
17526 2 The iswgraph function tests for any wide character for which iswprint is true and
17527 iswspace is false.<sup><a href="#note355"><b>355)</b></a></sup>
17528 <a name="7.30.2.1.7" href="#7.30.2.1.7"><b> 7.30.2.1.7 The iswlower function</b></a>
17529 <b> Synopsis</b>
17530 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17531 int iswlower(wint_t wc);
17532 <b> Description</b>
17533 2 The iswlower function tests for any wide character that corresponds to a lowercase
17534 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
17535 iswdigit, iswpunct, or iswspace is true.
17536 <a name="7.30.2.1.8" href="#7.30.2.1.8"><b> 7.30.2.1.8 The iswprint function</b></a>
17537 <b> Synopsis</b>
17538 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17539 int iswprint(wint_t wc);
17540 <b> Description</b>
17541 2 The iswprint function tests for any printing wide character.
17542 <a name="7.30.2.1.9" href="#7.30.2.1.9"><b> 7.30.2.1.9 The iswpunct function</b></a>
17543 <b> Synopsis</b>
17544 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17545 int iswpunct(wint_t wc);
17546 <b> Description</b>
17547 2 The iswpunct function tests for any printing wide character that is one of a locale-
17548 specific set of punctuation wide characters for which neither iswspace nor iswalnum
17549 is true.355)
17550 <a name="7.30.2.1.10" href="#7.30.2.1.10"><b> 7.30.2.1.10 The iswspace function</b></a>
17551 <b> Synopsis</b>
17552 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17553 int iswspace(wint_t wc);
17557 <sup><a name="note355" href="#note355"><b>355)</b></a></sup> Note that the behavior of the iswgraph and iswpunct functions may differ from their
17558 corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
17559 characters other than ' '.
17561 [<a name="p450" href="#p450">page 450</a>] (<a href="#Contents">Contents</a>)
17563 <b> Description</b>
17564 2 The iswspace function tests for any wide character that corresponds to a locale-specific
17565 set of white-space wide characters for which none of iswalnum, iswgraph, or
17566 iswpunct is true.
17567 <a name="7.30.2.1.11" href="#7.30.2.1.11"><b> 7.30.2.1.11 The iswupper function</b></a>
17568 <b> Synopsis</b>
17569 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17570 int iswupper(wint_t wc);
17571 <b> Description</b>
17572 2 The iswupper function tests for any wide character that corresponds to an uppercase
17573 letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
17574 iswdigit, iswpunct, or iswspace is true.
17575 <a name="7.30.2.1.12" href="#7.30.2.1.12"><b> 7.30.2.1.12 The iswxdigit function</b></a>
17576 <b> Synopsis</b>
17577 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17578 int iswxdigit(wint_t wc);
17579 <b> Description</b>
17580 2 The iswxdigit function tests for any wide character that corresponds to a
17581 hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
17582 <a name="7.30.2.2" href="#7.30.2.2"><b> 7.30.2.2 Extensible wide character classification functions</b></a>
17583 1 The functions wctype and iswctype provide extensible wide character classification
17584 as well as testing equivalent to that performed by the functions described in the previous
17585 subclause (<a href="#7.30.2.1">7.30.2.1</a>).
17586 <a name="7.30.2.2.1" href="#7.30.2.2.1"><b> 7.30.2.2.1 The iswctype function</b></a>
17587 <b> Synopsis</b>
17588 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17589 int iswctype(wint_t wc, wctype_t desc);
17590 <b> Description</b>
17591 2 The iswctype function determines whether the wide character wc has the property
17592 described by desc. The current setting of the LC_CTYPE category shall be the same as
17593 during the call to wctype that returned the value desc.
17594 3 Each of the following expressions has a truth-value equivalent to the call to the wide
17595 character classification function (<a href="#7.30.2.1">7.30.2.1</a>) in the comment that follows the expression:
17597 [<a name="p451" href="#p451">page 451</a>] (<a href="#Contents">Contents</a>)
17599 iswctype(wc, wctype("alnum")) // iswalnum(wc)
17600 iswctype(wc, wctype("alpha")) // iswalpha(wc)
17601 iswctype(wc, wctype("blank")) // iswblank(wc)
17602 iswctype(wc, wctype("cntrl")) // iswcntrl(wc)
17603 iswctype(wc, wctype("digit")) // iswdigit(wc)
17604 iswctype(wc, wctype("graph")) // iswgraph(wc)
17605 iswctype(wc, wctype("lower")) // iswlower(wc)
17606 iswctype(wc, wctype("print")) // iswprint(wc)
17607 iswctype(wc, wctype("punct")) // iswpunct(wc)
17608 iswctype(wc, wctype("space")) // iswspace(wc)
17609 iswctype(wc, wctype("upper")) // iswupper(wc)
17610 iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
17611 <b> Returns</b>
17612 4 The iswctype function returns nonzero (true) if and only if the value of the wide
17613 character wc has the property described by desc. If desc is zero, the iswctype
17614 function returns zero (false).
17615 Forward references: the wctype function (<a href="#7.30.2.2.2">7.30.2.2.2</a>).
17616 <a name="7.30.2.2.2" href="#7.30.2.2.2"><b> 7.30.2.2.2 The wctype function</b></a>
17617 <b> Synopsis</b>
17618 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17619 wctype_t wctype(const char *property);
17620 <b> Description</b>
17621 2 The wctype function constructs a value with type wctype_t that describes a class of
17622 wide characters identified by the string argument property.
17623 3 The strings listed in the description of the iswctype function shall be valid in all
17624 locales as property arguments to the wctype function.
17625 <b> Returns</b>
17626 4 If property identifies a valid class of wide characters according to the LC_CTYPE
17627 category of the current locale, the wctype function returns a nonzero value that is valid
17628 as the second argument to the iswctype function; otherwise, it returns zero.
17630 [<a name="p452" href="#p452">page 452</a>] (<a href="#Contents">Contents</a>)
17632 <a name="7.30.3" href="#7.30.3"><b> 7.30.3 Wide character case mapping utilities</b></a>
17633 1 The header <a href="#7.30">&lt;wctype.h&gt;</a> declares several functions useful for mapping wide characters.
17634 <a name="7.30.3.1" href="#7.30.3.1"><b> 7.30.3.1 Wide character case mapping functions</b></a>
17635 <a name="7.30.3.1.1" href="#7.30.3.1.1"><b> 7.30.3.1.1 The towlower function</b></a>
17636 <b> Synopsis</b>
17637 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17638 wint_t towlower(wint_t wc);
17639 <b> Description</b>
17640 2 The towlower function converts an uppercase letter to a corresponding lowercase letter.
17641 <b> Returns</b>
17642 3 If the argument is a wide character for which iswupper is true and there are one or
17643 more corresponding wide characters, as specified by the current locale, for which
17644 iswlower is true, the towlower function returns one of the corresponding wide
17645 characters (always the same one for any given locale); otherwise, the argument is
17646 returned unchanged.
17647 <a name="7.30.3.1.2" href="#7.30.3.1.2"><b> 7.30.3.1.2 The towupper function</b></a>
17648 <b> Synopsis</b>
17649 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17650 wint_t towupper(wint_t wc);
17651 <b> Description</b>
17652 2 The towupper function converts a lowercase letter to a corresponding uppercase letter.
17653 <b> Returns</b>
17654 3 If the argument is a wide character for which iswlower is true and there are one or
17655 more corresponding wide characters, as specified by the current locale, for which
17656 iswupper is true, the towupper function returns one of the corresponding wide
17657 characters (always the same one for any given locale); otherwise, the argument is
17658 returned unchanged.
17659 <a name="7.30.3.2" href="#7.30.3.2"><b> 7.30.3.2 Extensible wide character case mapping functions</b></a>
17660 1 The functions wctrans and towctrans provide extensible wide character mapping as
17661 well as case mapping equivalent to that performed by the functions described in the
17662 previous subclause (<a href="#7.30.3.1">7.30.3.1</a>).
17664 [<a name="p453" href="#p453">page 453</a>] (<a href="#Contents">Contents</a>)
17666 <a name="7.30.3.2.1" href="#7.30.3.2.1"><b> 7.30.3.2.1 The towctrans function</b></a>
17667 <b> Synopsis</b>
17668 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17669 wint_t towctrans(wint_t wc, wctrans_t desc);
17670 <b> Description</b>
17671 2 The towctrans function maps the wide character wc using the mapping described by
17672 desc. The current setting of the LC_CTYPE category shall be the same as during the call
17673 to wctrans that returned the value desc.
17674 3 Each of the following expressions behaves the same as the call to the wide character case
17675 mapping function (<a href="#7.30.3.1">7.30.3.1</a>) in the comment that follows the expression:
17676 towctrans(wc, wctrans("tolower")) // towlower(wc)
17677 towctrans(wc, wctrans("toupper")) // towupper(wc)
17678 <b> Returns</b>
17679 4 The towctrans function returns the mapped value of wc using the mapping described
17680 by desc. If desc is zero, the towctrans function returns the value of wc.
17681 <a name="7.30.3.2.2" href="#7.30.3.2.2"><b> 7.30.3.2.2 The wctrans function</b></a>
17682 <b> Synopsis</b>
17683 1 #include <a href="#7.30">&lt;wctype.h&gt;</a>
17684 wctrans_t wctrans(const char *property);
17685 <b> Description</b>
17686 2 The wctrans function constructs a value with type wctrans_t that describes a
17687 mapping between wide characters identified by the string argument property.
17688 3 The strings listed in the description of the towctrans function shall be valid in all
17689 locales as property arguments to the wctrans function.
17690 <b> Returns</b>
17691 4 If property identifies a valid mapping of wide characters according to the LC_CTYPE
17692 category of the current locale, the wctrans function returns a nonzero value that is valid
17693 as the second argument to the towctrans function; otherwise, it returns zero.
17695 [<a name="p454" href="#p454">page 454</a>] (<a href="#Contents">Contents</a>)
17697 <a name="7.31" href="#7.31"><b> 7.31 Future library directions</b></a>
17698 1 The following names are grouped under individual headers for convenience. All external
17699 names described below are reserved no matter what headers are included by the program.
17700 <a name="7.31.1" href="#7.31.1"><b> 7.31.1 Complex arithmetic &lt;complex.h&gt;</b></a>
17701 1 The function names
17702 cerf cexpm1 clog2
17703 cerfc clog10 clgamma
17704 cexp2 clog1p ctgamma
17705 and the same names suffixed with f or l may be added to the declarations in the
17706 <a href="#7.3">&lt;complex.h&gt;</a> header.
17707 <a name="7.31.2" href="#7.31.2"><b> 7.31.2 Character handling &lt;ctype.h&gt;</b></a>
17708 1 Function names that begin with either is or to, and a lowercase letter may be added to
17709 the declarations in the <a href="#7.4">&lt;ctype.h&gt;</a> header.
17710 <a name="7.31.3" href="#7.31.3"><b> 7.31.3 Errors &lt;errno.h&gt;</b></a>
17711 1 Macros that begin with E and a digit or E and an uppercase letter may be added to the
17712 macros defined in the <a href="#7.5">&lt;errno.h&gt;</a> header.
17713 <a name="7.31.4" href="#7.31.4"><b> 7.31.4 Floating-point environment &lt;fenv.h&gt;</b></a>
17714 1 Macros that begin with FE_ and an uppercase letter may be added to the macros defined
17715 in the <a href="#7.6">&lt;fenv.h&gt;</a> header.
17716 <a name="7.31.5" href="#7.31.5"><b> 7.31.5 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
17717 1 Macros that begin with either PRI or SCN, and either a lowercase letter or X may be
17718 added to the macros defined in the <a href="#7.8">&lt;inttypes.h&gt;</a> header.
17719 <a name="7.31.6" href="#7.31.6"><b> 7.31.6 Localization &lt;locale.h&gt;</b></a>
17720 1 Macros that begin with LC_ and an uppercase letter may be added to the macros defined
17721 in the <a href="#7.11">&lt;locale.h&gt;</a> header.
17722 <a name="7.31.7" href="#7.31.7"><b> 7.31.7 Signal handling &lt;signal.h&gt;</b></a>
17723 1 Macros that begin with either SIG and an uppercase letter or SIG_ and an uppercase
17724 letter may be added to the macros defined in the <a href="#7.14">&lt;signal.h&gt;</a> header.
17725 <a name="7.31.8" href="#7.31.8"><b> 7.31.8 Atomics &lt;stdatomic.h&gt;</b></a>
17726 1 Macros that begin with ATOMIC_ and an uppercase letter may be added to the macros
17727 defined in the <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Typedef names that begin with either
17728 atomic_ or memory_, and a lowercase letter may be added to the declarations in the
17729 <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Enumeration constants that begin with memory_order_
17731 [<a name="p455" href="#p455">page 455</a>] (<a href="#Contents">Contents</a>)
17733 and a lowercase letter may be added to the definition of the memory_order type in the
17734 <a href="#7.17">&lt;stdatomic.h&gt;</a> header. Function names that begin with atomic_ and a lowercase
17735 letter may be added to the declarations in the <a href="#7.17">&lt;stdatomic.h&gt;</a> header.
17736 <a name="7.31.9" href="#7.31.9"><b> 7.31.9 Boolean type and values &lt;stdbool.h&gt;</b></a>
17737 1 The ability to undefine and perhaps then redefine the macros bool, true, and false is
17738 an obsolescent feature.
17739 <a name="7.31.10" href="#7.31.10"><b> 7.31.10 Integer types &lt;stdint.h&gt;</b></a>
17740 1 Typedef names beginning with int or uint and ending with _t may be added to the
17741 types defined in the <a href="#7.20">&lt;stdint.h&gt;</a> header. Macro names beginning with INT or UINT
17742 and ending with _MAX, _MIN, or _C may be added to the macros defined in the
17743 <a href="#7.20">&lt;stdint.h&gt;</a> header.
17744 <a name="7.31.11" href="#7.31.11"><b> 7.31.11 Input/output &lt;stdio.h&gt;</b></a>
17745 1 Lowercase letters may be added to the conversion specifiers and length modifiers in
17746 fprintf and fscanf. Other characters may be used in extensions.
17747 2 The use of ungetc on a binary stream where the file position indicator is zero prior to
17748 the call is an obsolescent feature.
17749 <a name="7.31.12" href="#7.31.12"><b> 7.31.12 General utilities &lt;stdlib.h&gt;</b></a>
17750 1 Function names that begin with str and a lowercase letter may be added to the
17751 declarations in the <a href="#7.22">&lt;stdlib.h&gt;</a> header.
17752 <a name="7.31.13" href="#7.31.13"><b> 7.31.13 String handling &lt;string.h&gt;</b></a>
17753 1 Function names that begin with str, mem, or wcs and a lowercase letter may be added
17754 to the declarations in the <a href="#7.24">&lt;string.h&gt;</a> header.
17755 <a name="7.31.14" href="#7.31.14"><b> 7.31.14 Date and time &lt;time.h&gt;</b></a>
17756 Macros beginning with TIME_ and an uppercase letter may be added to the macros in the
17757 <a href="#7.27">&lt;time.h&gt;</a> header.
17758 <a name="7.31.15" href="#7.31.15"><b> 7.31.15 Threads &lt;threads.h&gt;</b></a>
17759 1 Function names, type names, and enumeration constants that begin with either cnd_,
17760 mtx_, thrd_, or tss_, and a lowercase letter may be added to the declarations in the
17761 <a href="#7.26">&lt;threads.h&gt;</a> header.
17762 <a name="7.31.16" href="#7.31.16"><b> 7.31.16 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
17763 1 Function names that begin with wcs and a lowercase letter may be added to the
17764 declarations in the <a href="#7.29">&lt;wchar.h&gt;</a> header.
17765 2 Lowercase letters may be added to the conversion specifiers and length modifiers in
17766 fwprintf and fwscanf. Other characters may be used in extensions.
17768 [<a name="p456" href="#p456">page 456</a>] (<a href="#Contents">Contents</a>)
17770 <a name="7.31.17" href="#7.31.17"><b> 7.31.17 Wide character classification and mapping utilities</b></a>
17771 <a href="#7.30">&lt;wctype.h&gt;</a>
17772 1 Function names that begin with is or to and a lowercase letter may be added to the
17773 declarations in the <a href="#7.30">&lt;wctype.h&gt;</a> header.
17775 [<a name="p457" href="#p457">page 457</a>] (<a href="#Contents">Contents</a>)
17777 <a name="A" href="#A"><b> Annex A</b></a>
17778 (informative)
17779 Language syntax summary
17780 1 NOTE The notation is described in <a href="#6.1">6.1</a>.
17782 <a name="A.1" href="#A.1"><b> A.1 Lexical grammar</b></a>
17783 <a name="A.1.1" href="#A.1.1"><b> A.1.1 Lexical elements</b></a>
17784 (<a href="#6.4">6.4</a>) token:
17785 keyword
17786 identifier
17787 constant
17788 string-literal
17789 punctuator
17790 (<a href="#6.4">6.4</a>) preprocessing-token:
17791 header-name
17792 identifier
17793 pp-number
17794 character-constant
17795 string-literal
17796 punctuator
17797 each non-white-space character that cannot be one of the above
17799 [<a name="p458" href="#p458">page 458</a>] (<a href="#Contents">Contents</a>)
17801 <a name="A.1.2" href="#A.1.2"><b>A.1.2 Keywords</b></a>
17802 (<a href="#6.4.1">6.4.1</a>) keyword: one of
17803 auto * if unsigned
17804 break inline void
17805 case int volatile
17806 char long while
17807 const register _Alignas
17808 continue restrict _Alignof
17809 default return _Atomic
17810 do short _Bool
17811 double signed _Complex
17812 else sizeof _Generic
17813 enum static _Imaginary
17814 extern struct _Noreturn
17815 float switch _Static_assert
17816 for typedef _Thread_local
17817 goto union
17818 <a name="A.1.3" href="#A.1.3"><b>A.1.3 Identifiers</b></a>
17819 (<a href="#6.4.2.1">6.4.2.1</a>) identifier:
17820 identifier-nondigit
17821 identifier identifier-nondigit
17822 identifier digit
17823 (<a href="#6.4.2.1">6.4.2.1</a>) identifier-nondigit:
17824 nondigit
17825 universal-character-name
17826 other implementation-defined characters
17827 (<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
17828 _ a b c d e f g h i j k l m
17829 n o p q r s t u v w x y z
17830 A B C D E F G H I J K L M
17831 N O P Q R S T U V W X Y Z
17832 (<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
17833 0 1 2 3 4 5 6 7 8 9
17835 [<a name="p459" href="#p459">page 459</a>] (<a href="#Contents">Contents</a>)
17837 <a name="A.1.4" href="#A.1.4"><b>A.1.4 Universal character names</b></a>
17838 (<a href="#6.4.3">6.4.3</a>) universal-character-name:
17839 \u hex-quad
17840 \U hex-quad hex-quad
17841 (<a href="#6.4.3">6.4.3</a>) hex-quad:
17842 hexadecimal-digit hexadecimal-digit
17843 hexadecimal-digit hexadecimal-digit
17844 <a name="A.1.5" href="#A.1.5"><b>A.1.5 Constants</b></a>
17845 (<a href="#6.4.4">6.4.4</a>) constant:
17846 integer-constant
17847 floating-constant
17848 enumeration-constant
17849 character-constant
17850 (<a href="#6.4.4.1">6.4.4.1</a>) integer-constant:
17851 decimal-constant integer-suffixopt
17852 octal-constant integer-suffixopt
17853 hexadecimal-constant integer-suffixopt
17854 (<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
17855 nonzero-digit
17856 decimal-constant digit
17857 (<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
17859 octal-constant octal-digit
17860 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-constant:
17861 hexadecimal-prefix hexadecimal-digit
17862 hexadecimal-constant hexadecimal-digit
17863 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-prefix: one of
17864 0x 0X
17865 (<a href="#6.4.4.1">6.4.4.1</a>) nonzero-digit: one of
17866 1 2 3 4 5 6 7 8 9
17867 (<a href="#6.4.4.1">6.4.4.1</a>) octal-digit: one of
17868 0 1 2 3 4 5 6 7
17870 [<a name="p460" href="#p460">page 460</a>] (<a href="#Contents">Contents</a>)
17872 (<a href="#6.4.4.1">6.4.4.1</a>) hexadecimal-digit: one of
17873 0 1 2 3 4 5 6 7 8 9
17874 a b c d e f
17875 A B C D E F
17876 (<a href="#6.4.4.1">6.4.4.1</a>) integer-suffix:
17877 unsigned-suffix long-suffixopt
17878 unsigned-suffix long-long-suffix
17879 long-suffix unsigned-suffixopt
17880 long-long-suffix unsigned-suffixopt
17881 (<a href="#6.4.4.1">6.4.4.1</a>) unsigned-suffix: one of
17883 (<a href="#6.4.4.1">6.4.4.1</a>) long-suffix: one of
17885 (<a href="#6.4.4.1">6.4.4.1</a>) long-long-suffix: one of
17886 ll LL
17887 (<a href="#6.4.4.2">6.4.4.2</a>) floating-constant:
17888 decimal-floating-constant
17889 hexadecimal-floating-constant
17890 (<a href="#6.4.4.2">6.4.4.2</a>) decimal-floating-constant:
17891 fractional-constant exponent-partopt floating-suffixopt
17892 digit-sequence exponent-part floating-suffixopt
17893 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
17894 hexadecimal-prefix hexadecimal-fractional-constant
17895 binary-exponent-part floating-suffixopt
17896 hexadecimal-prefix hexadecimal-digit-sequence
17897 binary-exponent-part floating-suffixopt
17898 (<a href="#6.4.4.2">6.4.4.2</a>) fractional-constant:
17899 digit-sequenceopt . digit-sequence
17900 digit-sequence .
17901 (<a href="#6.4.4.2">6.4.4.2</a>) exponent-part:
17902 e signopt digit-sequence
17903 E signopt digit-sequence
17904 (<a href="#6.4.4.2">6.4.4.2</a>) sign: one of
17907 [<a name="p461" href="#p461">page 461</a>] (<a href="#Contents">Contents</a>)
17909 (<a href="#6.4.4.2">6.4.4.2</a>) digit-sequence:
17910 digit
17911 digit-sequence digit
17912 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-fractional-constant:
17913 hexadecimal-digit-sequenceopt .
17914 hexadecimal-digit-sequence
17915 hexadecimal-digit-sequence .
17916 (<a href="#6.4.4.2">6.4.4.2</a>) binary-exponent-part:
17917 p signopt digit-sequence
17918 P signopt digit-sequence
17919 (<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-digit-sequence:
17920 hexadecimal-digit
17921 hexadecimal-digit-sequence hexadecimal-digit
17922 (<a href="#6.4.4.2">6.4.4.2</a>) floating-suffix: one of
17923 f l F L
17924 (<a href="#6.4.4.3">6.4.4.3</a>) enumeration-constant:
17925 identifier
17926 (<a href="#6.4.4.4">6.4.4.4</a>) character-constant:
17927 ' c-char-sequence '
17928 L' c-char-sequence '
17929 u' c-char-sequence '
17930 U' c-char-sequence '
17931 (<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
17932 c-char
17933 c-char-sequence c-char
17934 (<a href="#6.4.4.4">6.4.4.4</a>) c-char:
17935 any member of the source character set except
17936 the single-quote ', backslash \, or new-line character
17937 escape-sequence
17938 (<a href="#6.4.4.4">6.4.4.4</a>) escape-sequence:
17939 simple-escape-sequence
17940 octal-escape-sequence
17941 hexadecimal-escape-sequence
17942 universal-character-name
17944 [<a name="p462" href="#p462">page 462</a>] (<a href="#Contents">Contents</a>)
17946 (<a href="#6.4.4.4">6.4.4.4</a>) simple-escape-sequence: one of
17947 \' \" \? \\
17948 \a \b \f \n \r \t \v
17949 (<a href="#6.4.4.4">6.4.4.4</a>) octal-escape-sequence:
17950 \ octal-digit
17951 \ octal-digit octal-digit
17952 \ octal-digit octal-digit octal-digit
17953 (<a href="#6.4.4.4">6.4.4.4</a>) hexadecimal-escape-sequence:
17954 \x hexadecimal-digit
17955 hexadecimal-escape-sequence hexadecimal-digit
17956 <a name="A.1.6" href="#A.1.6"><b>A.1.6 String literals</b></a>
17957 (<a href="#6.4.5">6.4.5</a>) string-literal:
17958 encoding-prefixopt " s-char-sequenceopt "
17959 (<a href="#6.4.5">6.4.5</a>) encoding-prefix:
17964 (<a href="#6.4.5">6.4.5</a>) s-char-sequence:
17965 s-char
17966 s-char-sequence s-char
17967 (<a href="#6.4.5">6.4.5</a>) s-char:
17968 any member of the source character set except
17969 the double-quote ", backslash \, or new-line character
17970 escape-sequence
17971 <a name="A.1.7" href="#A.1.7"><b>A.1.7 Punctuators</b></a>
17972 (<a href="#6.4.6">6.4.6</a>) punctuator: one of
17973 [ ] ( ) { } . -&gt;
17974 ++ -- &amp; * + - ~ !
17975 / % &lt;&lt; &gt;&gt; &lt; &gt; &lt;= &gt;= == != ^ | &amp;&amp; ||
17976 ? : ; ...
17977 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
17978 , # ##
17979 &lt;: :&gt; &lt;% %&gt; %: %:%:
17981 [<a name="p463" href="#p463">page 463</a>] (<a href="#Contents">Contents</a>)
17983 <a name="A.1.8" href="#A.1.8"><b>A.1.8 Header names</b></a>
17984 (<a href="#6.4.7">6.4.7</a>) header-name:
17985 &lt; h-char-sequence &gt;
17986 " q-char-sequence "
17987 (<a href="#6.4.7">6.4.7</a>) h-char-sequence:
17988 h-char
17989 h-char-sequence h-char
17990 (<a href="#6.4.7">6.4.7</a>) h-char:
17991 any member of the source character set except
17992 the new-line character and &gt;
17993 (<a href="#6.4.7">6.4.7</a>) q-char-sequence:
17994 q-char
17995 q-char-sequence q-char
17996 (<a href="#6.4.7">6.4.7</a>) q-char:
17997 any member of the source character set except
17998 the new-line character and "
17999 <a name="A.1.9" href="#A.1.9"><b>A.1.9 Preprocessing numbers</b></a>
18000 (<a href="#6.4.8">6.4.8</a>) pp-number:
18001 digit
18002 . digit
18003 pp-number digit
18004 pp-number identifier-nondigit
18005 pp-number e sign
18006 pp-number E sign
18007 pp-number p sign
18008 pp-number P sign
18009 pp-number .
18011 [<a name="p464" href="#p464">page 464</a>] (<a href="#Contents">Contents</a>)
18013 <a name="A.2" href="#A.2"><b>A.2 Phrase structure grammar</b></a>
18014 <a name="A.2.1" href="#A.2.1"><b>A.2.1 Expressions</b></a>
18015 (<a href="#6.5.1">6.5.1</a>) primary-expression:
18016 identifier
18017 constant
18018 string-literal
18019 ( expression )
18020 generic-selection
18021 (<a href="#6.5.1.1">6.5.1.1</a>) generic-selection:
18022 _Generic ( assignment-expression , generic-assoc-list )
18023 (<a href="#6.5.1.1">6.5.1.1</a>) generic-assoc-list:
18024 generic-association
18025 generic-assoc-list , generic-association
18026 (<a href="#6.5.1.1">6.5.1.1</a>) generic-association:
18027 type-name : assignment-expression
18028 default : assignment-expression
18029 (<a href="#6.5.2">6.5.2</a>) postfix-expression:
18030 primary-expression
18031 postfix-expression [ expression ]
18032 postfix-expression ( argument-expression-listopt )
18033 postfix-expression . identifier
18034 postfix-expression -&gt; identifier
18035 postfix-expression ++
18036 postfix-expression --
18037 ( type-name ) { initializer-list }
18038 ( type-name ) { initializer-list , }
18039 (<a href="#6.5.2">6.5.2</a>) argument-expression-list:
18040 assignment-expression
18041 argument-expression-list , assignment-expression
18042 (<a href="#6.5.3">6.5.3</a>) unary-expression:
18043 postfix-expression
18044 ++ unary-expression
18045 -- unary-expression
18046 unary-operator cast-expression
18047 sizeof unary-expression
18048 sizeof ( type-name )
18049 _Alignof ( type-name )
18051 [<a name="p465" href="#p465">page 465</a>] (<a href="#Contents">Contents</a>)
18053 (<a href="#6.5.3">6.5.3</a>) unary-operator: one of
18054 &amp; * + - ~ !
18055 (<a href="#6.5.4">6.5.4</a>) cast-expression:
18056 unary-expression
18057 ( type-name ) cast-expression
18058 (<a href="#6.5.5">6.5.5</a>) multiplicative-expression:
18059 cast-expression
18060 multiplicative-expression * cast-expression
18061 multiplicative-expression / cast-expression
18062 multiplicative-expression % cast-expression
18063 (<a href="#6.5.6">6.5.6</a>) additive-expression:
18064 multiplicative-expression
18065 additive-expression + multiplicative-expression
18066 additive-expression - multiplicative-expression
18067 (<a href="#6.5.7">6.5.7</a>) shift-expression:
18068 additive-expression
18069 shift-expression &lt;&lt; additive-expression
18070 shift-expression &gt;&gt; additive-expression
18071 (<a href="#6.5.8">6.5.8</a>) relational-expression:
18072 shift-expression
18073 relational-expression &lt; shift-expression
18074 relational-expression &gt; shift-expression
18075 relational-expression &lt;= shift-expression
18076 relational-expression &gt;= shift-expression
18077 (<a href="#6.5.9">6.5.9</a>) equality-expression:
18078 relational-expression
18079 equality-expression == relational-expression
18080 equality-expression != relational-expression
18081 (<a href="#6.5.10">6.5.10</a>) AND-expression:
18082 equality-expression
18083 AND-expression &amp; equality-expression
18084 (<a href="#6.5.11">6.5.11</a>) exclusive-OR-expression:
18085 AND-expression
18086 exclusive-OR-expression ^ AND-expression
18088 [<a name="p466" href="#p466">page 466</a>] (<a href="#Contents">Contents</a>)
18090 (<a href="#6.5.12">6.5.12</a>) inclusive-OR-expression:
18091 exclusive-OR-expression
18092 inclusive-OR-expression | exclusive-OR-expression
18093 (<a href="#6.5.13">6.5.13</a>) logical-AND-expression:
18094 inclusive-OR-expression
18095 logical-AND-expression &amp;&amp; inclusive-OR-expression
18096 (<a href="#6.5.14">6.5.14</a>) logical-OR-expression:
18097 logical-AND-expression
18098 logical-OR-expression || logical-AND-expression
18099 (<a href="#6.5.15">6.5.15</a>) conditional-expression:
18100 logical-OR-expression
18101 logical-OR-expression ? expression : conditional-expression
18102 (<a href="#6.5.16">6.5.16</a>) assignment-expression:
18103 conditional-expression
18104 unary-expression assignment-operator assignment-expression
18105 (<a href="#6.5.16">6.5.16</a>) assignment-operator: one of
18106 = *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=
18107 (<a href="#6.5.17">6.5.17</a>) expression:
18108 assignment-expression
18109 expression , assignment-expression
18110 (<a href="#6.6">6.6</a>) constant-expression:
18111 conditional-expression
18112 <a name="A.2.2" href="#A.2.2"><b>A.2.2 Declarations</b></a>
18113 (<a href="#6.7">6.7</a>) declaration:
18114 declaration-specifiers init-declarator-listopt ;
18115 static_assert-declaration
18116 (<a href="#6.7">6.7</a>) declaration-specifiers:
18117 storage-class-specifier declaration-specifiersopt
18118 type-specifier declaration-specifiersopt
18119 type-qualifier declaration-specifiersopt
18120 function-specifier declaration-specifiersopt
18121 alignment-specifier declaration-specifiersopt
18122 (<a href="#6.7">6.7</a>) init-declarator-list:
18123 init-declarator
18124 init-declarator-list , init-declarator
18126 [<a name="p467" href="#p467">page 467</a>] (<a href="#Contents">Contents</a>)
18128 (<a href="#6.7">6.7</a>) init-declarator:
18129 declarator
18130 declarator = initializer
18131 (<a href="#6.7.1">6.7.1</a>) storage-class-specifier:
18132 typedef
18133 extern
18134 static
18135 _Thread_local
18136 auto
18137 register
18138 (<a href="#6.7.2">6.7.2</a>) type-specifier:
18139 void
18140 char
18141 short
18143 long
18144 float
18145 double
18146 signed
18147 unsigned
18148 _Bool
18149 _Complex
18150 atomic-type-specifier
18151 struct-or-union-specifier
18152 enum-specifier
18153 typedef-name
18154 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union-specifier:
18155 struct-or-union identifieropt { struct-declaration-list }
18156 struct-or-union identifier
18157 (<a href="#6.7.2.1">6.7.2.1</a>) struct-or-union:
18158 struct
18159 union
18160 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration-list:
18161 struct-declaration
18162 struct-declaration-list struct-declaration
18163 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declaration:
18164 specifier-qualifier-list struct-declarator-listopt ;
18165 static_assert-declaration
18167 [<a name="p468" href="#p468">page 468</a>] (<a href="#Contents">Contents</a>)
18169 (<a href="#6.7.2.1">6.7.2.1</a>) specifier-qualifier-list:
18170 type-specifier specifier-qualifier-listopt
18171 type-qualifier specifier-qualifier-listopt
18172 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator-list:
18173 struct-declarator
18174 struct-declarator-list , struct-declarator
18175 (<a href="#6.7.2.1">6.7.2.1</a>) struct-declarator:
18176 declarator
18177 declaratoropt : constant-expression
18178 (<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
18179 enum identifieropt { enumerator-list }
18180 enum identifieropt { enumerator-list , }
18181 enum identifier
18182 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator-list:
18183 enumerator
18184 enumerator-list , enumerator
18185 (<a href="#6.7.2.2">6.7.2.2</a>) enumerator:
18186 enumeration-constant
18187 enumeration-constant = constant-expression
18188 (<a href="#6.7.2.4">6.7.2.4</a>) atomic-type-specifier:
18189 _Atomic ( type-name )
18190 (<a href="#6.7.3">6.7.3</a>) type-qualifier:
18191 const
18192 restrict
18193 volatile
18194 _Atomic
18195 (<a href="#6.7.4">6.7.4</a>) function-specifier:
18196 inline
18197 _Noreturn
18198 (<a href="#6.7.5">6.7.5</a>) alignment-specifier:
18199 _Alignas ( type-name )
18200 _Alignas ( constant-expression )
18201 (<a href="#6.7.6">6.7.6</a>) declarator:
18202 pointeropt direct-declarator
18204 [<a name="p469" href="#p469">page 469</a>] (<a href="#Contents">Contents</a>)
18206 (<a href="#6.7.6">6.7.6</a>) direct-declarator:
18207 identifier
18208 ( declarator )
18209 direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
18210 direct-declarator [ static type-qualifier-listopt assignment-expression ]
18211 direct-declarator [ type-qualifier-list static assignment-expression ]
18212 direct-declarator [ type-qualifier-listopt * ]
18213 direct-declarator ( parameter-type-list )
18214 direct-declarator ( identifier-listopt )
18215 (<a href="#6.7.6">6.7.6</a>) pointer:
18216 * type-qualifier-listopt
18217 * type-qualifier-listopt pointer
18218 (<a href="#6.7.6">6.7.6</a>) type-qualifier-list:
18219 type-qualifier
18220 type-qualifier-list type-qualifier
18221 (<a href="#6.7.6">6.7.6</a>) parameter-type-list:
18222 parameter-list
18223 parameter-list , ...
18224 (<a href="#6.7.6">6.7.6</a>) parameter-list:
18225 parameter-declaration
18226 parameter-list , parameter-declaration
18227 (<a href="#6.7.6">6.7.6</a>) parameter-declaration:
18228 declaration-specifiers declarator
18229 declaration-specifiers abstract-declaratoropt
18230 (<a href="#6.7.6">6.7.6</a>) identifier-list:
18231 identifier
18232 identifier-list , identifier
18233 (<a href="#6.7.7">6.7.7</a>) type-name:
18234 specifier-qualifier-list abstract-declaratoropt
18235 (<a href="#6.7.7">6.7.7</a>) abstract-declarator:
18236 pointer
18237 pointeropt direct-abstract-declarator
18239 [<a name="p470" href="#p470">page 470</a>] (<a href="#Contents">Contents</a>)
18241 (<a href="#6.7.7">6.7.7</a>) direct-abstract-declarator:
18242 ( abstract-declarator )
18243 direct-abstract-declaratoropt [ type-qualifier-listopt
18244 assignment-expressionopt ]
18245 direct-abstract-declaratoropt [ static type-qualifier-listopt
18246 assignment-expression ]
18247 direct-abstract-declaratoropt [ type-qualifier-list static
18248 assignment-expression ]
18249 direct-abstract-declaratoropt [ * ]
18250 direct-abstract-declaratoropt ( parameter-type-listopt )
18251 (<a href="#6.7.8">6.7.8</a>) typedef-name:
18252 identifier
18253 (<a href="#6.7.9">6.7.9</a>) initializer:
18254 assignment-expression
18255 { initializer-list }
18256 { initializer-list , }
18257 (<a href="#6.7.9">6.7.9</a>) initializer-list:
18258 designationopt initializer
18259 initializer-list , designationopt initializer
18260 (<a href="#6.7.9">6.7.9</a>) designation:
18261 designator-list =
18262 (<a href="#6.7.9">6.7.9</a>) designator-list:
18263 designator
18264 designator-list designator
18265 (<a href="#6.7.9">6.7.9</a>) designator:
18266 [ constant-expression ]
18267 . identifier
18268 (<a href="#6.7.10">6.7.10</a>) static_assert-declaration:
18269 _Static_assert ( constant-expression , string-literal ) ;
18271 [<a name="p471" href="#p471">page 471</a>] (<a href="#Contents">Contents</a>)
18273 <a name="A.2.3" href="#A.2.3"><b>A.2.3 Statements</b></a>
18274 (<a href="#6.8">6.8</a>) statement:
18275 labeled-statement
18276 compound-statement
18277 expression-statement
18278 selection-statement
18279 iteration-statement
18280 jump-statement
18281 (<a href="#6.8.1">6.8.1</a>) labeled-statement:
18282 identifier : statement
18283 case constant-expression : statement
18284 default : statement
18285 (<a href="#6.8.2">6.8.2</a>) compound-statement:
18286 { block-item-listopt }
18287 (<a href="#6.8.2">6.8.2</a>) block-item-list:
18288 block-item
18289 block-item-list block-item
18290 (<a href="#6.8.2">6.8.2</a>) block-item:
18291 declaration
18292 statement
18293 (<a href="#6.8.3">6.8.3</a>) expression-statement:
18294 expressionopt ;
18295 (<a href="#6.8.4">6.8.4</a>) selection-statement:
18296 if ( expression ) statement
18297 if ( expression ) statement else statement
18298 switch ( expression ) statement
18299 (<a href="#6.8.5">6.8.5</a>) iteration-statement:
18300 while ( expression ) statement
18301 do statement while ( expression ) ;
18302 for ( expressionopt ; expressionopt ; expressionopt ) statement
18303 for ( declaration expressionopt ; expressionopt ) statement
18304 (<a href="#6.8.6">6.8.6</a>) jump-statement:
18305 goto identifier ;
18306 continue ;
18307 break ;
18308 return expressionopt ;
18310 [<a name="p472" href="#p472">page 472</a>] (<a href="#Contents">Contents</a>)
18312 <a name="A.2.4" href="#A.2.4"><b>A.2.4 External definitions</b></a>
18313 (<a href="#6.9">6.9</a>) translation-unit:
18314 external-declaration
18315 translation-unit external-declaration
18316 (<a href="#6.9">6.9</a>) external-declaration:
18317 function-definition
18318 declaration
18319 (<a href="#6.9.1">6.9.1</a>) function-definition:
18320 declaration-specifiers declarator declaration-listopt compound-statement
18321 (<a href="#6.9.1">6.9.1</a>) declaration-list:
18322 declaration
18323 declaration-list declaration
18324 <a name="A.3" href="#A.3"><b>A.3 Preprocessing directives</b></a>
18325 (<a href="#6.10">6.10</a>) preprocessing-file:
18326 groupopt
18327 (<a href="#6.10">6.10</a>) group:
18328 group-part
18329 group group-part
18330 (<a href="#6.10">6.10</a>) group-part:
18331 if-section
18332 control-line
18333 text-line
18334 # non-directive
18335 (<a href="#6.10">6.10</a>) if-section:
18336 if-group elif-groupsopt else-groupopt endif-line
18337 (<a href="#6.10">6.10</a>) if-group:
18338 # if constant-expression new-line groupopt
18339 # ifdef identifier new-line groupopt
18340 # ifndef identifier new-line groupopt
18341 (<a href="#6.10">6.10</a>) elif-groups:
18342 elif-group
18343 elif-groups elif-group
18344 (<a href="#6.10">6.10</a>) elif-group:
18345 # elif constant-expression new-line groupopt
18347 [<a name="p473" href="#p473">page 473</a>] (<a href="#Contents">Contents</a>)
18349 (<a href="#6.10">6.10</a>) else-group:
18350 # else new-line groupopt
18351 (<a href="#6.10">6.10</a>) endif-line:
18352 # endif new-line
18353 (<a href="#6.10">6.10</a>) control-line:
18354 # include pp-tokens new-line
18355 # define identifier replacement-list new-line
18356 # define identifier lparen identifier-listopt )
18357 replacement-list new-line
18358 # define identifier lparen ... ) replacement-list new-line
18359 # define identifier lparen identifier-list , ... )
18360 replacement-list new-line
18361 # undef identifier new-line
18362 # line pp-tokens new-line
18363 # error pp-tokensopt new-line
18364 # pragma pp-tokensopt new-line
18365 # new-line
18366 (<a href="#6.10">6.10</a>) text-line:
18367 pp-tokensopt new-line
18368 (<a href="#6.10">6.10</a>) non-directive:
18369 pp-tokens new-line
18370 (<a href="#6.10">6.10</a>) lparen:
18371 a ( character not immediately preceded by white-space
18372 (<a href="#6.10">6.10</a>) replacement-list:
18373 pp-tokensopt
18374 (<a href="#6.10">6.10</a>) pp-tokens:
18375 preprocessing-token
18376 pp-tokens preprocessing-token
18377 (<a href="#6.10">6.10</a>) new-line:
18378 the new-line character
18380 [<a name="p474" href="#p474">page 474</a>] (<a href="#Contents">Contents</a>)
18382 <a name="B" href="#B"><b> Annex B</b></a>
18383 (informative)
18384 Library summary
18385 <a name="B.1" href="#B.1"><b>B.1 Diagnostics &lt;assert.h&gt;</b></a>
18386 NDEBUG
18387 static_assert
18388 void assert(scalar expression);
18389 <a name="B.2" href="#B.2"><b>B.2 Complex &lt;complex.h&gt;</b></a>
18390 __STDC_NO_COMPLEX__ imaginary
18391 complex _Imaginary_I
18392 _Complex_I I
18393 #pragma STDC CX_LIMITED_RANGE on-off-switch
18394 double complex cacos(double complex z);
18395 float complex cacosf(float complex z);
18396 long double complex cacosl(long double complex z);
18397 double complex casin(double complex z);
18398 float complex casinf(float complex z);
18399 long double complex casinl(long double complex z);
18400 double complex catan(double complex z);
18401 float complex catanf(float complex z);
18402 long double complex catanl(long double complex z);
18403 double complex ccos(double complex z);
18404 float complex ccosf(float complex z);
18405 long double complex ccosl(long double complex z);
18406 double complex csin(double complex z);
18407 float complex csinf(float complex z);
18408 long double complex csinl(long double complex z);
18409 double complex ctan(double complex z);
18410 float complex ctanf(float complex z);
18411 long double complex ctanl(long double complex z);
18412 double complex cacosh(double complex z);
18413 float complex cacoshf(float complex z);
18414 long double complex cacoshl(long double complex z);
18415 double complex casinh(double complex z);
18416 float complex casinhf(float complex z);
18417 long double complex casinhl(long double complex z);
18419 [<a name="p475" href="#p475">page 475</a>] (<a href="#Contents">Contents</a>)
18421 double complex catanh(double complex z);
18422 float complex catanhf(float complex z);
18423 long double complex catanhl(long double complex z);
18424 double complex ccosh(double complex z);
18425 float complex ccoshf(float complex z);
18426 long double complex ccoshl(long double complex z);
18427 double complex csinh(double complex z);
18428 float complex csinhf(float complex z);
18429 long double complex csinhl(long double complex z);
18430 double complex ctanh(double complex z);
18431 float complex ctanhf(float complex z);
18432 long double complex ctanhl(long double complex z);
18433 double complex cexp(double complex z);
18434 float complex cexpf(float complex z);
18435 long double complex cexpl(long double complex z);
18436 double complex clog(double complex z);
18437 float complex clogf(float complex z);
18438 long double complex clogl(long double complex z);
18439 double cabs(double complex z);
18440 float cabsf(float complex z);
18441 long double cabsl(long double complex z);
18442 double complex cpow(double complex x, double complex y);
18443 float complex cpowf(float complex x, float complex y);
18444 long double complex cpowl(long double complex x,
18445 long double complex y);
18446 double complex csqrt(double complex z);
18447 float complex csqrtf(float complex z);
18448 long double complex csqrtl(long double complex z);
18449 double carg(double complex z);
18450 float cargf(float complex z);
18451 long double cargl(long double complex z);
18452 double cimag(double complex z);
18453 float cimagf(float complex z);
18454 long double cimagl(long double complex z);
18455 double complex CMPLX(double x, double y);
18456 float complex CMPLXF(float x, float y);
18457 long double complex CMPLXL(long double x, long double y);
18458 double complex conj(double complex z);
18459 float complex conjf(float complex z);
18460 long double complex conjl(long double complex z);
18461 double complex cproj(double complex z);
18463 [<a name="p476" href="#p476">page 476</a>] (<a href="#Contents">Contents</a>)
18465 float complex cprojf(float complex z);
18466 long double complex cprojl(long double complex z);
18467 double creal(double complex z);
18468 float crealf(float complex z);
18469 long double creall(long double complex z);
18470 <a name="B.3" href="#B.3"><b>B.3 Character handling &lt;ctype.h&gt;</b></a>
18471 int isalnum(int c);
18472 int isalpha(int c);
18473 int isblank(int c);
18474 int iscntrl(int c);
18475 int isdigit(int c);
18476 int isgraph(int c);
18477 int islower(int c);
18478 int isprint(int c);
18479 int ispunct(int c);
18480 int isspace(int c);
18481 int isupper(int c);
18482 int isxdigit(int c);
18483 int tolower(int c);
18484 int toupper(int c);
18485 <a name="B.4" href="#B.4"><b>B.4 Errors &lt;errno.h&gt;</b></a>
18486 EDOM EILSEQ ERANGE errno
18487 __STDC_WANT_LIB_EXT1__
18488 errno_t
18489 <a name="B.5" href="#B.5"><b>B.5 Floating-point environment &lt;fenv.h&gt;</b></a>
18490 fenv_t FE_OVERFLOW FE_TOWARDZERO
18491 fexcept_t FE_UNDERFLOW FE_UPWARD
18492 FE_DIVBYZERO FE_ALL_EXCEPT FE_DFL_ENV
18493 FE_INEXACT FE_DOWNWARD
18494 FE_INVALID FE_TONEAREST
18495 #pragma STDC FENV_ACCESS on-off-switch
18496 int feclearexcept(int excepts);
18497 int fegetexceptflag(fexcept_t *flagp, int excepts);
18498 int feraiseexcept(int excepts);
18499 int fesetexceptflag(const fexcept_t *flagp,
18500 int excepts);
18501 int fetestexcept(int excepts);
18503 [<a name="p477" href="#p477">page 477</a>] (<a href="#Contents">Contents</a>)
18505 int fegetround(void);
18506 int fesetround(int round);
18507 int fegetenv(fenv_t *envp);
18508 int feholdexcept(fenv_t *envp);
18509 int fesetenv(const fenv_t *envp);
18510 int feupdateenv(const fenv_t *envp);
18511 <a name="B.6" href="#B.6"><b>B.6 Characteristics of floating types &lt;float.h&gt;</b></a>
18512 FLT_ROUNDS DBL_DIG FLT_MAX
18513 FLT_EVAL_METHOD LDBL_DIG DBL_MAX
18514 FLT_HAS_SUBNORM FLT_MIN_EXP LDBL_MAX
18515 DBL_HAS_SUBNORM DBL_MIN_EXP FLT_EPSILON
18516 LDBL_HAS_SUBNORM LDBL_MIN_EXP DBL_EPSILON
18517 FLT_RADIX FLT_MIN_10_EXP LDBL_EPSILON
18518 FLT_MANT_DIG DBL_MIN_10_EXP FLT_MIN
18519 DBL_MANT_DIG LDBL_MIN_10_EXP DBL_MIN
18520 LDBL_MANT_DIG FLT_MAX_EXP LDBL_MIN
18521 FLT_DECIMAL_DIG DBL_MAX_EXP FLT_TRUE_MIN
18522 DBL_DECIMAL_DIG LDBL_MAX_EXP DBL_TRUE_MIN
18523 LDBL_DECIMAL_DIG FLT_MAX_10_EXP LDBL_TRUE_MIN
18524 DECIMAL_DIG DBL_MAX_10_EXP
18525 FLT_DIG LDBL_MAX_10_EXP
18526 <a name="B.7" href="#B.7"><b>B.7 Format conversion of integer types &lt;inttypes.h&gt;</b></a>
18527 imaxdiv_t
18528 PRIdN PRIdLEASTN PRIdFASTN PRIdMAX PRIdPTR
18529 PRIiN PRIiLEASTN PRIiFASTN PRIiMAX PRIiPTR
18530 PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
18531 PRIuN PRIuLEASTN PRIuFASTN PRIuMAX PRIuPTR
18532 PRIxN PRIxLEASTN PRIxFASTN PRIxMAX PRIxPTR
18533 PRIXN PRIXLEASTN PRIXFASTN PRIXMAX PRIXPTR
18534 SCNdN SCNdLEASTN SCNdFASTN SCNdMAX SCNdPTR
18535 SCNiN SCNiLEASTN SCNiFASTN SCNiMAX SCNiPTR
18536 SCNoN SCNoLEASTN SCNoFASTN SCNoMAX SCNoPTR
18537 SCNuN SCNuLEASTN SCNuFASTN SCNuMAX SCNuPTR
18538 SCNxN SCNxLEASTN SCNxFASTN SCNxMAX SCNxPTR
18539 intmax_t imaxabs(intmax_t j);
18540 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
18541 intmax_t strtoimax(const char * restrict nptr,
18542 char ** restrict endptr, int base);
18544 [<a name="p478" href="#p478">page 478</a>] (<a href="#Contents">Contents</a>)
18546 uintmax_t strtoumax(const char * restrict nptr,
18547 char ** restrict endptr, int base);
18548 intmax_t wcstoimax(const wchar_t * restrict nptr,
18549 wchar_t ** restrict endptr, int base);
18550 uintmax_t wcstoumax(const wchar_t * restrict nptr,
18551 wchar_t ** restrict endptr, int base);
18552 <a name="B.8" href="#B.8"><b>B.8 Alternative spellings &lt;iso646.h&gt;</b></a>
18553 and bitor not_eq xor
18554 and_eq compl or xor_eq
18555 bitand not or_eq
18556 <a name="B.9" href="#B.9"><b>B.9 Sizes of integer types &lt;limits.h&gt;</b></a>
18557 CHAR_BIT CHAR_MAX INT_MIN ULONG_MAX
18558 SCHAR_MIN MB_LEN_MAX INT_MAX LLONG_MIN
18559 SCHAR_MAX SHRT_MIN UINT_MAX LLONG_MAX
18560 UCHAR_MAX SHRT_MAX LONG_MIN ULLONG_MAX
18561 CHAR_MIN USHRT_MAX LONG_MAX
18562 <a name="B.10" href="#B.10"><b>B.10 Localization &lt;locale.h&gt;</b></a>
18563 struct lconv LC_ALL LC_CTYPE LC_NUMERIC
18564 NULL LC_COLLATE LC_MONETARY LC_TIME
18565 char *setlocale(int category, const char *locale);
18566 struct lconv *localeconv(void);
18567 <a name="B.11" href="#B.11"><b>B.11 Mathematics &lt;math.h&gt;</b></a>
18568 float_t FP_INFINITE FP_FAST_FMAL
18569 double_t FP_NAN FP_ILOGB0
18570 HUGE_VAL FP_NORMAL FP_ILOGBNAN
18571 HUGE_VALF FP_SUBNORMAL MATH_ERRNO
18572 HUGE_VALL FP_ZERO MATH_ERREXCEPT
18573 INFINITY FP_FAST_FMA math_errhandling
18574 NAN FP_FAST_FMAF
18575 #pragma STDC FP_CONTRACT on-off-switch
18576 int fpclassify(real-floating x);
18577 int isfinite(real-floating x);
18578 int isinf(real-floating x);
18579 int isnan(real-floating x);
18580 int isnormal(real-floating x);
18581 int signbit(real-floating x);
18583 [<a name="p479" href="#p479">page 479</a>] (<a href="#Contents">Contents</a>)
18585 double acos(double x);
18586 float acosf(float x);
18587 long double acosl(long double x);
18588 double asin(double x);
18589 float asinf(float x);
18590 long double asinl(long double x);
18591 double atan(double x);
18592 float atanf(float x);
18593 long double atanl(long double x);
18594 double atan2(double y, double x);
18595 float atan2f(float y, float x);
18596 long double atan2l(long double y, long double x);
18597 double cos(double x);
18598 float cosf(float x);
18599 long double cosl(long double x);
18600 double sin(double x);
18601 float sinf(float x);
18602 long double sinl(long double x);
18603 double tan(double x);
18604 float tanf(float x);
18605 long double tanl(long double x);
18606 double acosh(double x);
18607 float acoshf(float x);
18608 long double acoshl(long double x);
18609 double asinh(double x);
18610 float asinhf(float x);
18611 long double asinhl(long double x);
18612 double atanh(double x);
18613 float atanhf(float x);
18614 long double atanhl(long double x);
18615 double cosh(double x);
18616 float coshf(float x);
18617 long double coshl(long double x);
18618 double sinh(double x);
18619 float sinhf(float x);
18620 long double sinhl(long double x);
18621 double tanh(double x);
18622 float tanhf(float x);
18623 long double tanhl(long double x);
18624 double exp(double x);
18625 float expf(float x);
18627 [<a name="p480" href="#p480">page 480</a>] (<a href="#Contents">Contents</a>)
18629 long double expl(long double x);
18630 double exp2(double x);
18631 float exp2f(float x);
18632 long double exp2l(long double x);
18633 double expm1(double x);
18634 float expm1f(float x);
18635 long double expm1l(long double x);
18636 double frexp(double value, int *exp);
18637 float frexpf(float value, int *exp);
18638 long double frexpl(long double value, int *exp);
18639 int ilogb(double x);
18640 int ilogbf(float x);
18641 int ilogbl(long double x);
18642 double ldexp(double x, int exp);
18643 float ldexpf(float x, int exp);
18644 long double ldexpl(long double x, int exp);
18645 double log(double x);
18646 float logf(float x);
18647 long double logl(long double x);
18648 double log10(double x);
18649 float log10f(float x);
18650 long double log10l(long double x);
18651 double log1p(double x);
18652 float log1pf(float x);
18653 long double log1pl(long double x);
18654 double log2(double x);
18655 float log2f(float x);
18656 long double log2l(long double x);
18657 double logb(double x);
18658 float logbf(float x);
18659 long double logbl(long double x);
18660 double modf(double value, double *iptr);
18661 float modff(float value, float *iptr);
18662 long double modfl(long double value, long double *iptr);
18663 double scalbn(double x, int n);
18664 float scalbnf(float x, int n);
18665 long double scalbnl(long double x, int n);
18666 double scalbln(double x, long int n);
18667 float scalblnf(float x, long int n);
18668 long double scalblnl(long double x, long int n);
18669 double cbrt(double x);
18671 [<a name="p481" href="#p481">page 481</a>] (<a href="#Contents">Contents</a>)
18673 float cbrtf(float x);
18674 long double cbrtl(long double x);
18675 double fabs(double x);
18676 float fabsf(float x);
18677 long double fabsl(long double x);
18678 double hypot(double x, double y);
18679 float hypotf(float x, float y);
18680 long double hypotl(long double x, long double y);
18681 double pow(double x, double y);
18682 float powf(float x, float y);
18683 long double powl(long double x, long double y);
18684 double sqrt(double x);
18685 float sqrtf(float x);
18686 long double sqrtl(long double x);
18687 double erf(double x);
18688 float erff(float x);
18689 long double erfl(long double x);
18690 double erfc(double x);
18691 float erfcf(float x);
18692 long double erfcl(long double x);
18693 double lgamma(double x);
18694 float lgammaf(float x);
18695 long double lgammal(long double x);
18696 double tgamma(double x);
18697 float tgammaf(float x);
18698 long double tgammal(long double x);
18699 double ceil(double x);
18700 float ceilf(float x);
18701 long double ceill(long double x);
18702 double floor(double x);
18703 float floorf(float x);
18704 long double floorl(long double x);
18705 double nearbyint(double x);
18706 float nearbyintf(float x);
18707 long double nearbyintl(long double x);
18708 double rint(double x);
18709 float rintf(float x);
18710 long double rintl(long double x);
18711 long int lrint(double x);
18712 long int lrintf(float x);
18713 long int lrintl(long double x);
18715 [<a name="p482" href="#p482">page 482</a>] (<a href="#Contents">Contents</a>)
18717 long long int llrint(double x);
18718 long long int llrintf(float x);
18719 long long int llrintl(long double x);
18720 double round(double x);
18721 float roundf(float x);
18722 long double roundl(long double x);
18723 long int lround(double x);
18724 long int lroundf(float x);
18725 long int lroundl(long double x);
18726 long long int llround(double x);
18727 long long int llroundf(float x);
18728 long long int llroundl(long double x);
18729 double trunc(double x);
18730 float truncf(float x);
18731 long double truncl(long double x);
18732 double fmod(double x, double y);
18733 float fmodf(float x, float y);
18734 long double fmodl(long double x, long double y);
18735 double remainder(double x, double y);
18736 float remainderf(float x, float y);
18737 long double remainderl(long double x, long double y);
18738 double remquo(double x, double y, int *quo);
18739 float remquof(float x, float y, int *quo);
18740 long double remquol(long double x, long double y,
18741 int *quo);
18742 double copysign(double x, double y);
18743 float copysignf(float x, float y);
18744 long double copysignl(long double x, long double y);
18745 double nan(const char *tagp);
18746 float nanf(const char *tagp);
18747 long double nanl(const char *tagp);
18748 double nextafter(double x, double y);
18749 float nextafterf(float x, float y);
18750 long double nextafterl(long double x, long double y);
18751 double nexttoward(double x, long double y);
18752 float nexttowardf(float x, long double y);
18753 long double nexttowardl(long double x, long double y);
18754 double fdim(double x, double y);
18755 float fdimf(float x, float y);
18756 long double fdiml(long double x, long double y);
18757 double fmax(double x, double y);
18759 [<a name="p483" href="#p483">page 483</a>] (<a href="#Contents">Contents</a>)
18761 float fmaxf(float x, float y);
18762 long double fmaxl(long double x, long double y);
18763 double fmin(double x, double y);
18764 float fminf(float x, float y);
18765 long double fminl(long double x, long double y);
18766 double fma(double x, double y, double z);
18767 float fmaf(float x, float y, float z);
18768 long double fmal(long double x, long double y,
18769 long double z);
18770 int isgreater(real-floating x, real-floating y);
18771 int isgreaterequal(real-floating x, real-floating y);
18772 int isless(real-floating x, real-floating y);
18773 int islessequal(real-floating x, real-floating y);
18774 int islessgreater(real-floating x, real-floating y);
18775 int isunordered(real-floating x, real-floating y);
18776 <a name="B.12" href="#B.12"><b>B.12 Nonlocal jumps &lt;setjmp.h&gt;</b></a>
18777 jmp_buf
18778 int setjmp(jmp_buf env);
18779 _Noreturn void longjmp(jmp_buf env, int val);
18780 <a name="B.13" href="#B.13"><b>B.13 Signal handling &lt;signal.h&gt;</b></a>
18781 sig_atomic_t SIG_IGN SIGILL SIGTERM
18782 SIG_DFL SIGABRT SIGINT
18783 SIG_ERR SIGFPE SIGSEGV
18784 void (*signal(int sig, void (*func)(int)))(int);
18785 int raise(int sig);
18787 [<a name="p484" href="#p484">page 484</a>] (<a href="#Contents">Contents</a>)
18789 <a name="B.14" href="#B.14"><b>B.14 Alignment &lt;stdalign.h&gt;</b></a>
18790 alignas
18791 __alignas_is_defined
18792 <a name="B.15" href="#B.15"><b>B.15 Variable arguments &lt;stdarg.h&gt;</b></a>
18793 va_list
18794 type va_arg(va_list ap, type);
18795 void va_copy(va_list dest, va_list src);
18796 void va_end(va_list ap);
18797 void va_start(va_list ap, parmN);
18798 <a name="B.16" href="#B.16"><b>B.16 Atomics &lt;stdatomic.h&gt;</b></a>
18799 ATOMIC_BOOL_LOCK_FREE atomic_uint
18800 ATOMIC_CHAR_LOCK_FREE atomic_long
18801 ATOMIC_CHAR16_T_LOCK_FREE atomic_ulong
18802 ATOMIC_CHAR32_T_LOCK_FREE atomic_llong
18803 ATOMIC_WCHAR_T_LOCK_FREE atomic_ullong
18804 ATOMIC_SHORT_LOCK_FREE atomic_char16_t
18805 ATOMIC_INT_LOCK_FREE atomic_char32_t
18806 ATOMIC_LONG_LOCK_FREE atomic_wchar_t
18807 ATOMIC_LLONG_LOCK_FREE atomic_int_least8_t
18808 ATOMIC_POINTER_LOCK_FREE atomic_uint_least8_t
18809 ATOMIC_FLAG_INIT atomic_int_least16_t
18810 memory_order atomic_uint_least16_t
18811 atomic_flag atomic_int_least32_t
18812 memory_order_relaxed * atomic_uint_least32_t
18813 memory_order_consume atomic_int_least64_t
18814 memory_order_acquire atomic_uint_least64_t
18815 memory_order_release atomic_int_fast8_t
18816 memory_order_acq_rel atomic_uint_fast8_t
18817 memory_order_seq_cst atomic_int_fast16_t
18818 atomic_bool atomic_uint_fast16_t
18819 atomic_char atomic_int_fast32_t
18820 atomic_schar atomic_uint_fast32_t
18821 atomic_uchar atomic_int_fast64_t
18822 atomic_short atomic_uint_fast64_t
18823 atomic_ushort atomic_intptr_t
18824 atomic_int atomic_uintptr_t
18826 [<a name="p485" href="#p485">page 485</a>] (<a href="#Contents">Contents</a>)
18828 atomic_size_t atomic_intmax_t
18829 atomic_ptrdiff_t atomic_uintmax_t
18830 #define ATOMIC_VAR_INIT(C value)
18831 void atomic_init(volatile A *obj, C value);
18832 type kill_dependency(type y);
18833 void atomic_thread_fence(memory_order order);
18834 void atomic_signal_fence(memory_order order);
18835 _Bool atomic_is_lock_free(const volatile A *obj);
18836 void atomic_store(volatile A *object, C desired);
18837 void atomic_store_explicit(volatile A *object,
18838 C desired, memory_order order);
18839 C atomic_load(volatile A *object);
18840 C atomic_load_explicit(volatile A *object,
18841 memory_order order);
18842 C atomic_exchange(volatile A *object, C desired);
18843 C atomic_exchange_explicit(volatile A *object,
18844 C desired, memory_order order);
18845 _Bool atomic_compare_exchange_strong(volatile A *object,
18846 C *expected, C desired);
18847 _Bool atomic_compare_exchange_strong_explicit(
18848 volatile A *object, C *expected, C desired,
18849 memory_order success, memory_order failure);
18850 _Bool atomic_compare_exchange_weak(volatile A *object,
18851 C *expected, C desired);
18852 _Bool atomic_compare_exchange_weak_explicit(
18853 volatile A *object, C *expected, C desired,
18854 memory_order success, memory_order failure);
18855 C atomic_fetch_key(volatile A *object, M operand);
18856 C atomic_fetch_key_explicit(volatile A *object,
18857 M operand, memory_order order);
18858 _Bool atomic_flag_test_and_set(
18859 volatile atomic_flag *object);
18860 _Bool atomic_flag_test_and_set_explicit(
18861 volatile atomic_flag *object, memory_order order);
18862 void atomic_flag_clear(volatile atomic_flag *object);
18863 void atomic_flag_clear_explicit(
18864 volatile atomic_flag *object, memory_order order);
18866 [<a name="p486" href="#p486">page 486</a>] (<a href="#Contents">Contents</a>)
18868 <a name="B.17" href="#B.17"><b>B.17 Boolean type and values &lt;stdbool.h&gt;</b></a>
18869 bool
18870 true
18871 false
18872 __bool_true_false_are_defined
18873 <a name="B.18" href="#B.18"><b>B.18 Common definitions &lt;stddef.h&gt;</b></a>
18874 ptrdiff_t max_align_t NULL
18875 size_t wchar_t
18876 offsetof(type, member-designator)
18877 __STDC_WANT_LIB_EXT1__
18878 rsize_t
18879 <a name="B.19" href="#B.19"><b>B.19 Integer types &lt;stdint.h&gt;</b></a>
18880 intN_t INT_LEASTN_MIN PTRDIFF_MAX
18881 uintN_t INT_LEASTN_MAX SIG_ATOMIC_MIN
18882 int_leastN_t UINT_LEASTN_MAX SIG_ATOMIC_MAX
18883 uint_leastN_t INT_FASTN_MIN SIZE_MAX
18884 int_fastN_t INT_FASTN_MAX WCHAR_MIN
18885 uint_fastN_t UINT_FASTN_MAX WCHAR_MAX
18886 intptr_t INTPTR_MIN WINT_MIN
18887 uintptr_t INTPTR_MAX WINT_MAX
18888 intmax_t UINTPTR_MAX INTN_C(value)
18889 uintmax_t INTMAX_MIN UINTN_C(value)
18890 INTN_MIN INTMAX_MAX INTMAX_C(value)
18891 INTN_MAX UINTMAX_MAX UINTMAX_C(value)
18892 UINTN_MAX PTRDIFF_MIN
18893 __STDC_WANT_LIB_EXT1__
18894 RSIZE_MAX
18896 [<a name="p487" href="#p487">page 487</a>] (<a href="#Contents">Contents</a>)
18898 <a name="B.20" href="#B.20"><b>B.20 Input/output &lt;stdio.h&gt;</b></a>
18899 size_t _IOLBF FILENAME_MAX TMP_MAX
18900 FILE _IONBF L_tmpnam stderr
18901 fpos_t BUFSIZ SEEK_CUR stdin
18902 NULL EOF SEEK_END stdout
18903 _IOFBF FOPEN_MAX SEEK_SET
18904 int remove(const char *filename);
18905 int rename(const char *old, const char *new);
18906 FILE *tmpfile(void);
18907 char *tmpnam(char *s);
18908 int fclose(FILE *stream);
18909 int fflush(FILE *stream);
18910 FILE *fopen(const char * restrict filename,
18911 const char * restrict mode);
18912 FILE *freopen(const char * restrict filename,
18913 const char * restrict mode,
18914 FILE * restrict stream);
18915 void setbuf(FILE * restrict stream,
18916 char * restrict buf);
18917 int setvbuf(FILE * restrict stream,
18918 char * restrict buf,
18919 int mode, size_t size);
18920 int fprintf(FILE * restrict stream,
18921 const char * restrict format, ...);
18922 int fscanf(FILE * restrict stream,
18923 const char * restrict format, ...);
18924 int printf(const char * restrict format, ...);
18925 int scanf(const char * restrict format, ...);
18926 int snprintf(char * restrict s, size_t n,
18927 const char * restrict format, ...);
18928 int sprintf(char * restrict s,
18929 const char * restrict format, ...);
18930 int sscanf(const char * restrict s,
18931 const char * restrict format, ...);
18932 int vfprintf(FILE * restrict stream,
18933 const char * restrict format, va_list arg);
18934 int vfscanf(FILE * restrict stream,
18935 const char * restrict format, va_list arg);
18936 int vprintf(const char * restrict format, va_list arg);
18937 int vscanf(const char * restrict format, va_list arg);
18939 [<a name="p488" href="#p488">page 488</a>] (<a href="#Contents">Contents</a>)
18941 int vsnprintf(char * restrict s, size_t n,
18942 const char * restrict format, va_list arg);
18943 int vsprintf(char * restrict s,
18944 const char * restrict format, va_list arg);
18945 int vsscanf(const char * restrict s,
18946 const char * restrict format, va_list arg);
18947 int fgetc(FILE *stream);
18948 char *fgets(char * restrict s, int n,
18949 FILE * restrict stream);
18950 int fputc(int c, FILE *stream);
18951 int fputs(const char * restrict s,
18952 FILE * restrict stream);
18953 int getc(FILE *stream);
18954 int getchar(void);
18955 int putc(int c, FILE *stream);
18956 int putchar(int c);
18957 int puts(const char *s);
18958 int ungetc(int c, FILE *stream);
18959 size_t fread(void * restrict ptr,
18960 size_t size, size_t nmemb,
18961 FILE * restrict stream);
18962 size_t fwrite(const void * restrict ptr,
18963 size_t size, size_t nmemb,
18964 FILE * restrict stream);
18965 int fgetpos(FILE * restrict stream,
18966 fpos_t * restrict pos);
18967 int fseek(FILE *stream, long int offset, int whence);
18968 int fsetpos(FILE *stream, const fpos_t *pos);
18969 long int ftell(FILE *stream);
18970 void rewind(FILE *stream);
18971 void clearerr(FILE *stream);
18972 int feof(FILE *stream);
18973 int ferror(FILE *stream);
18974 void perror(const char *s);
18975 __STDC_WANT_LIB_EXT1__
18976 L_tmpnam_s TMP_MAX_S errno_t rsize_t
18977 errno_t tmpfile_s(FILE * restrict * restrict streamptr);
18978 errno_t tmpnam_s(char *s, rsize_t maxsize);
18980 [<a name="p489" href="#p489">page 489</a>] (<a href="#Contents">Contents</a>)
18982 errno_t fopen_s(FILE * restrict * restrict streamptr,
18983 const char * restrict filename,
18984 const char * restrict mode);
18985 errno_t freopen_s(FILE * restrict * restrict newstreamptr,
18986 const char * restrict filename,
18987 const char * restrict mode,
18988 FILE * restrict stream);
18989 int fprintf_s(FILE * restrict stream,
18990 const char * restrict format, ...);
18991 int fscanf_s(FILE * restrict stream,
18992 const char * restrict format, ...);
18993 int printf_s(const char * restrict format, ...);
18994 int scanf_s(const char * restrict format, ...);
18995 int snprintf_s(char * restrict s, rsize_t n,
18996 const char * restrict format, ...);
18997 int sprintf_s(char * restrict s, rsize_t n,
18998 const char * restrict format, ...);
18999 int sscanf_s(const char * restrict s,
19000 const char * restrict format, ...);
19001 int vfprintf_s(FILE * restrict stream,
19002 const char * restrict format,
19003 va_list arg);
19004 int vfscanf_s(FILE * restrict stream,
19005 const char * restrict format,
19006 va_list arg);
19007 int vprintf_s(const char * restrict format,
19008 va_list arg);
19009 int vscanf_s(const char * restrict format,
19010 va_list arg);
19011 int vsnprintf_s(char * restrict s, rsize_t n,
19012 const char * restrict format,
19013 va_list arg);
19014 int vsprintf_s(char * restrict s, rsize_t n,
19015 const char * restrict format,
19016 va_list arg);
19017 int vsscanf_s(const char * restrict s,
19018 const char * restrict format,
19019 va_list arg);
19020 char *gets_s(char *s, rsize_t n);
19022 [<a name="p490" href="#p490">page 490</a>] (<a href="#Contents">Contents</a>)
19024 <a name="B.21" href="#B.21"><b>B.21 General utilities &lt;stdlib.h&gt;</b></a>
19025 size_t ldiv_t EXIT_FAILURE MB_CUR_MAX
19026 wchar_t lldiv_t EXIT_SUCCESS
19027 div_t NULL RAND_MAX
19028 double atof(const char *nptr);
19029 int atoi(const char *nptr);
19030 long int atol(const char *nptr);
19031 long long int atoll(const char *nptr);
19032 double strtod(const char * restrict nptr,
19033 char ** restrict endptr);
19034 float strtof(const char * restrict nptr,
19035 char ** restrict endptr);
19036 long double strtold(const char * restrict nptr,
19037 char ** restrict endptr);
19038 long int strtol(const char * restrict nptr,
19039 char ** restrict endptr, int base);
19040 long long int strtoll(const char * restrict nptr,
19041 char ** restrict endptr, int base);
19042 unsigned long int strtoul(
19043 const char * restrict nptr,
19044 char ** restrict endptr, int base);
19045 unsigned long long int strtoull(
19046 const char * restrict nptr,
19047 char ** restrict endptr, int base);
19048 int rand(void);
19049 void srand(unsigned int seed);
19050 void *aligned_alloc(size_t alignment, size_t size);
19051 void *calloc(size_t nmemb, size_t size);
19052 void free(void *ptr);
19053 void *malloc(size_t size);
19054 void *realloc(void *ptr, size_t size);
19055 _Noreturn void abort(void);
19056 int atexit(void (*func)(void));
19057 int at_quick_exit(void (*func)(void));
19058 _Noreturn void exit(int status);
19059 _Noreturn void _Exit(int status);
19060 char *getenv(const char *name);
19061 _Noreturn void quick_exit(int status);
19062 int system(const char *string);
19064 [<a name="p491" href="#p491">page 491</a>] (<a href="#Contents">Contents</a>)
19066 void *bsearch(const void *key, const void *base,
19067 size_t nmemb, size_t size,
19068 int (*compar)(const void *, const void *));
19069 void qsort(void *base, size_t nmemb, size_t size,
19070 int (*compar)(const void *, const void *));
19071 int abs(int j);
19072 long int labs(long int j);
19073 long long int llabs(long long int j);
19074 div_t div(int numer, int denom);
19075 ldiv_t ldiv(long int numer, long int denom);
19076 lldiv_t lldiv(long long int numer,
19077 long long int denom);
19078 int mblen(const char *s, size_t n);
19079 int mbtowc(wchar_t * restrict pwc,
19080 const char * restrict s, size_t n);
19081 int wctomb(char *s, wchar_t wchar);
19082 size_t mbstowcs(wchar_t * restrict pwcs,
19083 const char * restrict s, size_t n);
19084 size_t wcstombs(char * restrict s,
19085 const wchar_t * restrict pwcs, size_t n);
19086 __STDC_WANT_LIB_EXT1__
19087 errno_t
19088 rsize_t
19089 constraint_handler_t
19090 constraint_handler_t set_constraint_handler_s(
19091 constraint_handler_t handler);
19092 void abort_handler_s(
19093 const char * restrict msg,
19094 void * restrict ptr,
19095 errno_t error);
19096 void ignore_handler_s(
19097 const char * restrict msg,
19098 void * restrict ptr,
19099 errno_t error);
19100 errno_t getenv_s(size_t * restrict len,
19101 char * restrict value, rsize_t maxsize,
19102 const char * restrict name);
19104 [<a name="p492" href="#p492">page 492</a>] (<a href="#Contents">Contents</a>)
19106 void *bsearch_s(const void *key, const void *base,
19107 rsize_t nmemb, rsize_t size,
19108 int (*compar)(const void *k, const void *y,
19109 void *context),
19110 void *context);
19111 errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
19112 int (*compar)(const void *x, const void *y,
19113 void *context),
19114 void *context);
19115 errno_t wctomb_s(int * restrict status,
19116 char * restrict s,
19117 rsize_t smax,
19118 wchar_t wc);
19119 errno_t mbstowcs_s(size_t * restrict retval,
19120 wchar_t * restrict dst, rsize_t dstmax,
19121 const char * restrict src, rsize_t len);
19122 errno_t wcstombs_s(size_t * restrict retval,
19123 char * restrict dst, rsize_t dstmax,
19124 const wchar_t * restrict src, rsize_t len);
19125 B.22 _Noreturn <a href="#7.23">&lt;stdnoreturn.h&gt;</a>
19126 noreturn
19127 <a name="B.23" href="#B.23"><b>B.23 String handling &lt;string.h&gt;</b></a>
19128 size_t
19129 NULL
19130 void *memcpy(void * restrict s1,
19131 const void * restrict s2, size_t n);
19132 void *memmove(void *s1, const void *s2, size_t n);
19133 char *strcpy(char * restrict s1,
19134 const char * restrict s2);
19135 char *strncpy(char * restrict s1,
19136 const char * restrict s2, size_t n);
19137 char *strcat(char * restrict s1,
19138 const char * restrict s2);
19139 char *strncat(char * restrict s1,
19140 const char * restrict s2, size_t n);
19141 int memcmp(const void *s1, const void *s2, size_t n);
19142 int strcmp(const char *s1, const char *s2);
19143 int strcoll(const char *s1, const char *s2);
19144 int strncmp(const char *s1, const char *s2, size_t n);
19146 [<a name="p493" href="#p493">page 493</a>] (<a href="#Contents">Contents</a>)
19148 size_t strxfrm(char * restrict s1,
19149 const char * restrict s2, size_t n);
19150 void *memchr(const void *s, int c, size_t n);
19151 char *strchr(const char *s, int c);
19152 size_t strcspn(const char *s1, const char *s2);
19153 char *strpbrk(const char *s1, const char *s2);
19154 char *strrchr(const char *s, int c);
19155 size_t strspn(const char *s1, const char *s2);
19156 char *strstr(const char *s1, const char *s2);
19157 char *strtok(char * restrict s1,
19158 const char * restrict s2);
19159 void *memset(void *s, int c, size_t n);
19160 char *strerror(int errnum);
19161 size_t strlen(const char *s);
19162 __STDC_WANT_LIB_EXT1__
19163 errno_t
19164 rsize_t
19165 errno_t memcpy_s(void * restrict s1, rsize_t s1max,
19166 const void * restrict s2, rsize_t n);
19167 errno_t memmove_s(void *s1, rsize_t s1max,
19168 const void *s2, rsize_t n);
19169 errno_t strcpy_s(char * restrict s1,
19170 rsize_t s1max,
19171 const char * restrict s2);
19172 errno_t strncpy_s(char * restrict s1,
19173 rsize_t s1max,
19174 const char * restrict s2,
19175 rsize_t n);
19176 errno_t strcat_s(char * restrict s1,
19177 rsize_t s1max,
19178 const char * restrict s2);
19179 errno_t strncat_s(char * restrict s1,
19180 rsize_t s1max,
19181 const char * restrict s2,
19182 rsize_t n);
19183 char *strtok_s(char * restrict s1,
19184 rsize_t * restrict s1max,
19185 const char * restrict s2,
19186 char ** restrict ptr);
19187 errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
19189 [<a name="p494" href="#p494">page 494</a>] (<a href="#Contents">Contents</a>)
19191 errno_t strerror_s(char *s, rsize_t maxsize,
19192 errno_t errnum);
19193 size_t strerrorlen_s(errno_t errnum);
19194 size_t strnlen_s(const char *s, size_t maxsize);
19195 <a name="B.24" href="#B.24"><b>B.24 Type-generic math &lt;tgmath.h&gt;</b></a>
19196 acos sqrt fmod nextafter
19197 asin fabs frexp nexttoward
19198 atan atan2 hypot remainder
19199 acosh cbrt ilogb remquo
19200 asinh ceil ldexp rint
19201 atanh copysign lgamma round
19202 cos erf llrint scalbn
19203 sin erfc llround scalbln
19204 tan exp2 log10 tgamma
19205 cosh expm1 log1p trunc
19206 sinh fdim log2 carg
19207 tanh floor logb cimag
19208 exp fma lrint conj
19209 log fmax lround cproj
19210 pow fmin nearbyint creal
19211 <a name="B.25" href="#B.25"><b>B.25 Threads &lt;threads.h&gt;</b></a>
19212 thread_local once_flag
19213 ONCE_FLAG_INIT mtx_plain *
19214 TSS_DTOR_ITERATIONS mtx_recursive
19215 cnd_t mtx_timed
19216 thrd_t thrd_timedout
19217 tss_t thrd_success
19218 mtx_t thrd_busy
19219 tss_dtor_t thrd_error
19220 thrd_start_t thrd_nomem
19221 void call_once(once_flag *flag, void (*func)(void));
19222 int cnd_broadcast(cnd_t *cond);
19223 void cnd_destroy(cnd_t *cond);
19224 int cnd_init(cnd_t *cond);
19225 int cnd_signal(cnd_t *cond);
19226 int cnd_timedwait(cnd_t *restrict cond,
19227 mtx_t *restrict mtx,
19228 const struct timespec *restrict ts);
19229 int cnd_wait(cnd_t *cond, mtx_t *mtx);
19231 [<a name="p495" href="#p495">page 495</a>] (<a href="#Contents">Contents</a>)
19233 void mtx_destroy(mtx_t *mtx);
19234 int mtx_init(mtx_t *mtx, int type);
19235 int mtx_lock(mtx_t *mtx);
19236 int mtx_timedlock(mtx_t *restrict mtx,
19237 const struct timespec *restrict ts);
19238 int mtx_trylock(mtx_t *mtx);
19239 int mtx_unlock(mtx_t *mtx);
19240 int thrd_create(thrd_t *thr, thrd_start_t func,
19241 void *arg);
19242 thrd_t thrd_current(void);
19243 int thrd_detach(thrd_t thr);
19244 int thrd_equal(thrd_t thr0, thrd_t thr1);
19245 _Noreturn void thrd_exit(int res);
19246 int thrd_join(thrd_t thr, int *res);
19247 int thrd_sleep(const struct timespec *duration,
19248 struct timespec *remaining);
19249 void thrd_yield(void);
19250 int tss_create(tss_t *key, tss_dtor_t dtor);
19251 void tss_delete(tss_t key);
19252 void *tss_get(tss_t key);
19253 int tss_set(tss_t key, void *val);
19254 <a name="B.26" href="#B.26"><b>B.26 Date and time &lt;time.h&gt;</b></a>
19255 NULL size_t struct timespec
19256 CLOCKS_PER_SEC clock_t struct tm
19257 TIME_UTC time_t
19258 clock_t clock(void);
19259 double difftime(time_t time1, time_t time0);
19260 time_t mktime(struct tm *timeptr);
19261 time_t time(time_t *timer);
19262 int timespec_get(timespec *ts, int base);
19263 char *asctime(const struct tm *timeptr);
19264 char *ctime(const time_t *timer);
19265 struct tm *gmtime(const time_t *timer);
19266 struct tm *localtime(const time_t *timer);
19267 size_t strftime(char * restrict s,
19268 size_t maxsize,
19269 const char * restrict format,
19270 const struct tm * restrict timeptr);
19271 __STDC_WANT_LIB_EXT1__
19273 [<a name="p496" href="#p496">page 496</a>] (<a href="#Contents">Contents</a>)
19275 errno_t
19276 rsize_t
19277 errno_t asctime_s(char *s, rsize_t maxsize,
19278 const struct tm *timeptr);
19279 errno_t ctime_s(char *s, rsize_t maxsize,
19280 const time_t *timer);
19281 struct tm *gmtime_s(const time_t * restrict timer,
19282 struct tm * restrict result);
19283 struct tm *localtime_s(const time_t * restrict timer,
19284 struct tm * restrict result);
19285 <a name="B.27" href="#B.27"><b>B.27 Unicode utilities &lt;uchar.h&gt;</b></a>
19286 mbstate_t size_t char16_t char32_t
19287 size_t mbrtoc16(char16_t * restrict pc16,
19288 const char * restrict s, size_t n,
19289 mbstate_t * restrict ps);
19290 size_t c16rtomb(char * restrict s, char16_t c16,
19291 mbstate_t * restrict ps);
19292 size_t mbrtoc32(char32_t * restrict pc32,
19293 const char * restrict s, size_t n,
19294 mbstate_t * restrict ps);
19295 size_t c32rtomb(char * restrict s, char32_t c32,
19296 mbstate_t * restrict ps);
19297 <a name="B.28" href="#B.28"><b>B.28 Extended multibyte/wide character utilities &lt;wchar.h&gt;</b></a>
19298 wchar_t wint_t WCHAR_MAX
19299 size_t struct tm WCHAR_MIN
19300 mbstate_t NULL WEOF
19301 int fwprintf(FILE * restrict stream,
19302 const wchar_t * restrict format, ...);
19303 int fwscanf(FILE * restrict stream,
19304 const wchar_t * restrict format, ...);
19305 int swprintf(wchar_t * restrict s, size_t n,
19306 const wchar_t * restrict format, ...);
19307 int swscanf(const wchar_t * restrict s,
19308 const wchar_t * restrict format, ...);
19309 int vfwprintf(FILE * restrict stream,
19310 const wchar_t * restrict format, va_list arg);
19312 [<a name="p497" href="#p497">page 497</a>] (<a href="#Contents">Contents</a>)
19314 int vfwscanf(FILE * restrict stream,
19315 const wchar_t * restrict format, va_list arg);
19316 int vswprintf(wchar_t * restrict s, size_t n,
19317 const wchar_t * restrict format, va_list arg);
19318 int vswscanf(const wchar_t * restrict s,
19319 const wchar_t * restrict format, va_list arg);
19320 int vwprintf(const wchar_t * restrict format,
19321 va_list arg);
19322 int vwscanf(const wchar_t * restrict format,
19323 va_list arg);
19324 int wprintf(const wchar_t * restrict format, ...);
19325 int wscanf(const wchar_t * restrict format, ...);
19326 wint_t fgetwc(FILE *stream);
19327 wchar_t *fgetws(wchar_t * restrict s, int n,
19328 FILE * restrict stream);
19329 wint_t fputwc(wchar_t c, FILE *stream);
19330 int fputws(const wchar_t * restrict s,
19331 FILE * restrict stream);
19332 int fwide(FILE *stream, int mode);
19333 wint_t getwc(FILE *stream);
19334 wint_t getwchar(void);
19335 wint_t putwc(wchar_t c, FILE *stream);
19336 wint_t putwchar(wchar_t c);
19337 wint_t ungetwc(wint_t c, FILE *stream);
19338 double wcstod(const wchar_t * restrict nptr,
19339 wchar_t ** restrict endptr);
19340 float wcstof(const wchar_t * restrict nptr,
19341 wchar_t ** restrict endptr);
19342 long double wcstold(const wchar_t * restrict nptr,
19343 wchar_t ** restrict endptr);
19344 long int wcstol(const wchar_t * restrict nptr,
19345 wchar_t ** restrict endptr, int base);
19346 long long int wcstoll(const wchar_t * restrict nptr,
19347 wchar_t ** restrict endptr, int base);
19348 unsigned long int wcstoul(const wchar_t * restrict nptr,
19349 wchar_t ** restrict endptr, int base);
19350 unsigned long long int wcstoull(
19351 const wchar_t * restrict nptr,
19352 wchar_t ** restrict endptr, int base);
19354 [<a name="p498" href="#p498">page 498</a>] (<a href="#Contents">Contents</a>)
19356 wchar_t *wcscpy(wchar_t * restrict s1,
19357 const wchar_t * restrict s2);
19358 wchar_t *wcsncpy(wchar_t * restrict s1,
19359 const wchar_t * restrict s2, size_t n);
19360 wchar_t *wmemcpy(wchar_t * restrict s1,
19361 const wchar_t * restrict s2, size_t n);
19362 wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
19363 size_t n);
19364 wchar_t *wcscat(wchar_t * restrict s1,
19365 const wchar_t * restrict s2);
19366 wchar_t *wcsncat(wchar_t * restrict s1,
19367 const wchar_t * restrict s2, size_t n);
19368 int wcscmp(const wchar_t *s1, const wchar_t *s2);
19369 int wcscoll(const wchar_t *s1, const wchar_t *s2);
19370 int wcsncmp(const wchar_t *s1, const wchar_t *s2,
19371 size_t n);
19372 size_t wcsxfrm(wchar_t * restrict s1,
19373 const wchar_t * restrict s2, size_t n);
19374 int wmemcmp(const wchar_t *s1, const wchar_t *s2,
19375 size_t n);
19376 wchar_t *wcschr(const wchar_t *s, wchar_t c);
19377 size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
19378 wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
19379 wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
19380 size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
19381 wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
19382 wchar_t *wcstok(wchar_t * restrict s1,
19383 const wchar_t * restrict s2,
19384 wchar_t ** restrict ptr);
19385 wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
19386 size_t wcslen(const wchar_t *s);
19387 wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
19388 size_t wcsftime(wchar_t * restrict s, size_t maxsize,
19389 const wchar_t * restrict format,
19390 const struct tm * restrict timeptr);
19391 wint_t btowc(int c);
19392 int wctob(wint_t c);
19393 int mbsinit(const mbstate_t *ps);
19394 size_t mbrlen(const char * restrict s, size_t n,
19395 mbstate_t * restrict ps);
19397 [<a name="p499" href="#p499">page 499</a>] (<a href="#Contents">Contents</a>)
19399 size_t mbrtowc(wchar_t * restrict pwc,
19400 const char * restrict s, size_t n,
19401 mbstate_t * restrict ps);
19402 size_t wcrtomb(char * restrict s, wchar_t wc,
19403 mbstate_t * restrict ps);
19404 size_t mbsrtowcs(wchar_t * restrict dst,
19405 const char ** restrict src, size_t len,
19406 mbstate_t * restrict ps);
19407 size_t wcsrtombs(char * restrict dst,
19408 const wchar_t ** restrict src, size_t len,
19409 mbstate_t * restrict ps);
19410 __STDC_WANT_LIB_EXT1__
19411 errno_t
19412 rsize_t
19413 int fwprintf_s(FILE * restrict stream,
19414 const wchar_t * restrict format, ...);
19415 int fwscanf_s(FILE * restrict stream,
19416 const wchar_t * restrict format, ...);
19417 int snwprintf_s(wchar_t * restrict s,
19418 rsize_t n,
19419 const wchar_t * restrict format, ...);
19420 int swprintf_s(wchar_t * restrict s, rsize_t n,
19421 const wchar_t * restrict format, ...);
19422 int swscanf_s(const wchar_t * restrict s,
19423 const wchar_t * restrict format, ...);
19424 int vfwprintf_s(FILE * restrict stream,
19425 const wchar_t * restrict format,
19426 va_list arg);
19427 int vfwscanf_s(FILE * restrict stream,
19428 const wchar_t * restrict format, va_list arg);
19429 int vsnwprintf_s(wchar_t * restrict s,
19430 rsize_t n,
19431 const wchar_t * restrict format,
19432 va_list arg);
19433 int vswprintf_s(wchar_t * restrict s,
19434 rsize_t n,
19435 const wchar_t * restrict format,
19436 va_list arg);
19438 [<a name="p500" href="#p500">page 500</a>] (<a href="#Contents">Contents</a>)
19440 int vswscanf_s(const wchar_t * restrict s,
19441 const wchar_t * restrict format,
19442 va_list arg);
19443 int vwprintf_s(const wchar_t * restrict format,
19444 va_list arg);
19445 int vwscanf_s(const wchar_t * restrict format,
19446 va_list arg);
19447 int wprintf_s(const wchar_t * restrict format, ...);
19448 int wscanf_s(const wchar_t * restrict format, ...);
19449 errno_t wcscpy_s(wchar_t * restrict s1,
19450 rsize_t s1max,
19451 const wchar_t * restrict s2);
19452 errno_t wcsncpy_s(wchar_t * restrict s1,
19453 rsize_t s1max,
19454 const wchar_t * restrict s2,
19455 rsize_t n);
19456 errno_t wmemcpy_s(wchar_t * restrict s1,
19457 rsize_t s1max,
19458 const wchar_t * restrict s2,
19459 rsize_t n);
19460 errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
19461 const wchar_t *s2, rsize_t n);
19462 errno_t wcscat_s(wchar_t * restrict s1,
19463 rsize_t s1max,
19464 const wchar_t * restrict s2);
19465 errno_t wcsncat_s(wchar_t * restrict s1,
19466 rsize_t s1max,
19467 const wchar_t * restrict s2,
19468 rsize_t n);
19469 wchar_t *wcstok_s(wchar_t * restrict s1,
19470 rsize_t * restrict s1max,
19471 const wchar_t * restrict s2,
19472 wchar_t ** restrict ptr);
19473 size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
19474 errno_t wcrtomb_s(size_t * restrict retval,
19475 char * restrict s, rsize_t smax,
19476 wchar_t wc, mbstate_t * restrict ps);
19478 [<a name="p501" href="#p501">page 501</a>] (<a href="#Contents">Contents</a>)
19480 errno_t mbsrtowcs_s(size_t * restrict retval,
19481 wchar_t * restrict dst, rsize_t dstmax,
19482 const char ** restrict src, rsize_t len,
19483 mbstate_t * restrict ps);
19484 errno_t wcsrtombs_s(size_t * restrict retval,
19485 char * restrict dst, rsize_t dstmax,
19486 const wchar_t ** restrict src, rsize_t len,
19487 mbstate_t * restrict ps);
19488 <a name="B.29" href="#B.29"><b>B.29 Wide character classification and mapping utilities &lt;wctype.h&gt;</b></a>
19489 wint_t wctrans_t wctype_t WEOF
19490 int iswalnum(wint_t wc);
19491 int iswalpha(wint_t wc);
19492 int iswblank(wint_t wc);
19493 int iswcntrl(wint_t wc);
19494 int iswdigit(wint_t wc);
19495 int iswgraph(wint_t wc);
19496 int iswlower(wint_t wc);
19497 int iswprint(wint_t wc);
19498 int iswpunct(wint_t wc);
19499 int iswspace(wint_t wc);
19500 int iswupper(wint_t wc);
19501 int iswxdigit(wint_t wc);
19502 int iswctype(wint_t wc, wctype_t desc);
19503 wctype_t wctype(const char *property);
19504 wint_t towlower(wint_t wc);
19505 wint_t towupper(wint_t wc);
19506 wint_t towctrans(wint_t wc, wctrans_t desc);
19507 wctrans_t wctrans(const char *property);
19509 [<a name="p502" href="#p502">page 502</a>] (<a href="#Contents">Contents</a>)
19511 <a name="C" href="#C"><b> Annex C</b></a>
19512 (informative)
19513 Sequence points
19514 1 The following are the sequence points described in <a href="#5.1.2.3">5.1.2.3</a>:
19515 -- Between the evaluations of the function designator and actual arguments in a function
19516 call and the actual call. (<a href="#6.5.2.2">6.5.2.2</a>).
19517 -- Between the evaluations of the first and second operands of the following operators:
19518 logical AND &amp;&amp; (<a href="#6.5.13">6.5.13</a>); logical OR || (<a href="#6.5.14">6.5.14</a>); comma , (<a href="#6.5.17">6.5.17</a>).
19519 -- Between the evaluations of the first operand of the conditional ? : operator and
19520 whichever of the second and third operands is evaluated (<a href="#6.5.15">6.5.15</a>).
19521 -- The end of a full declarator: declarators (<a href="#6.7.6">6.7.6</a>);
19522 -- Between the evaluation of a full expression and the next full expression to be
19523 evaluated. The following are full expressions: an initializer that is not part of a
19524 compound literal (<a href="#6.7.9">6.7.9</a>); the expression in an expression statement (<a href="#6.8.3">6.8.3</a>); the
19525 controlling expression of a selection statement (if or switch) (<a href="#6.8.4">6.8.4</a>); the
19526 controlling expression of a while or do statement (<a href="#6.8.5">6.8.5</a>); each of the (optional)
19527 expressions of a for statement (<a href="#6.8.5.3">6.8.5.3</a>); the (optional) expression in a return
19528 statement (<a href="#6.8.6.4">6.8.6.4</a>).
19529 -- Immediately before a library function returns (<a href="#7.1.4">7.1.4</a>).
19530 -- After the actions associated with each formatted input/output function conversion
19531 specifier (<a href="#7.21.6">7.21.6</a>, <a href="#7.29.2">7.29.2</a>).
19532 -- Immediately before and immediately after each call to a comparison function, and
19533 also between any call to a comparison function and any movement of the objects
19534 passed as arguments to that call (<a href="#7.22.5">7.22.5</a>).
19536 [<a name="p503" href="#p503">page 503</a>] (<a href="#Contents">Contents</a>)
19538 <a name="D" href="#D"><b> Annex D</b></a>
19539 (normative)
19540 Universal character names for identifiers
19541 1 This clause lists the hexadecimal code values that are valid in universal character names
19542 in identifiers.
19543 <a name="D.1" href="#D.1"><b> D.1 Ranges of characters allowed</b></a>
19544 1 00A8, 00AA, 00AD, 00AF, 00B2-00B5, 00B7-00BA, 00BC-00BE, 00C0-00D6,
19545 00D8-00F6, 00F8-00FF
19546 2 0100-167F, 1681-180D, 180F-1FFF
19547 3 200B-200D, 202A-202E, 203F-2040, 2054, 2060-206F
19548 4 2070-218F, 2460-24FF, 2776-2793, 2C00-2DFF, 2E80-2FFF
19549 5 3004-3007, 3021-302F, 3031-303F
19550 6 3040-D7FF
19551 7 F900-FD3D, FD40-FDCF, FDF0-FE44, FE47-FFFD
19552 8 10000-1FFFD, 20000-2FFFD, 30000-3FFFD, 40000-4FFFD, 50000-5FFFD,
19553 60000-6FFFD, 70000-7FFFD, 80000-8FFFD, 90000-9FFFD, A0000-AFFFD,
19554 B0000-BFFFD, C0000-CFFFD, D0000-DFFFD, E0000-EFFFD
19555 <a name="D.2" href="#D.2"><b> D.2 Ranges of characters disallowed initially</b></a>
19556 1 0300-036F, 1DC0-1DFF, 20D0-20FF, FE20-FE2F
19558 [<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
19560 <a name="E" href="#E"><b> Annex E</b></a>
19561 (informative)
19562 Implementation limits
19563 1 The contents of the header <a href="#7.10">&lt;limits.h&gt;</a> are given below, in alphabetical order. The
19564 minimum magnitudes shown shall be replaced by implementation-defined magnitudes
19565 with the same sign. The values shall all be constant expressions suitable for use in #if
19566 preprocessing directives. The components are described further in <a href="#5.2.4.2.1">5.2.4.2.1</a>.
19567 #define CHAR_BIT 8
19568 #define CHAR_MAX UCHAR_MAX or SCHAR_MAX
19569 #define CHAR_MIN 0 or SCHAR_MIN
19570 #define INT_MAX +32767
19571 #define INT_MIN -32767
19572 #define LONG_MAX +2147483647
19573 #define LONG_MIN -2147483647
19574 #define LLONG_MAX +9223372036854775807
19575 #define LLONG_MIN -9223372036854775807
19576 #define MB_LEN_MAX 1
19577 #define SCHAR_MAX +127
19578 #define SCHAR_MIN -127
19579 #define SHRT_MAX +32767
19580 #define SHRT_MIN -32767
19581 #define UCHAR_MAX 255
19582 #define USHRT_MAX 65535
19583 #define UINT_MAX 65535
19584 #define ULONG_MAX 4294967295
19585 #define ULLONG_MAX 18446744073709551615
19586 2 The contents of the header <a href="#7.7">&lt;float.h&gt;</a> are given below. All integer values, except
19587 FLT_ROUNDS, shall be constant expressions suitable for use in #if preprocessing
19588 directives; all floating values shall be constant expressions. The components are
19589 described further in <a href="#5.2.4.2.2">5.2.4.2.2</a>.
19590 3 The values given in the following list shall be replaced by implementation-defined
19591 expressions:
19592 #define FLT_EVAL_METHOD
19593 #define FLT_ROUNDS
19594 4 The values given in the following list shall be replaced by implementation-defined
19595 constant expressions that are greater or equal in magnitude (absolute value) to those
19596 shown, with the same sign:
19598 [<a name="p505" href="#p505">page 505</a>] (<a href="#Contents">Contents</a>)
19600 #define DLB_DECIMAL_DIG 10
19601 #define DBL_DIG 10
19602 #define DBL_MANT_DIG
19603 #define DBL_MAX_10_EXP +37
19604 #define DBL_MAX_EXP
19605 #define DBL_MIN_10_EXP -37
19606 #define DBL_MIN_EXP
19607 #define DECIMAL_DIG 10
19608 #define FLT_DECIMAL_DIG 6
19609 #define FLT_DIG 6
19610 #define FLT_MANT_DIG
19611 #define FLT_MAX_10_EXP +37
19612 #define FLT_MAX_EXP
19613 #define FLT_MIN_10_EXP -37
19614 #define FLT_MIN_EXP
19615 #define FLT_RADIX 2
19616 #define LDLB_DECIMAL_DIG 10
19617 #define LDBL_DIG 10
19618 #define LDBL_MANT_DIG
19619 #define LDBL_MAX_10_EXP +37
19620 #define LDBL_MAX_EXP
19621 #define LDBL_MIN_10_EXP -37
19622 #define LDBL_MIN_EXP
19623 5 The values given in the following list shall be replaced by implementation-defined
19624 constant expressions with values that are greater than or equal to those shown:
19625 #define DBL_MAX 1E+37
19626 #define FLT_MAX 1E+37
19627 #define LDBL_MAX 1E+37
19628 6 The values given in the following list shall be replaced by implementation-defined
19629 constant expressions with (positive) values that are less than or equal to those shown:
19630 #define DBL_EPSILON 1E-9
19631 #define DBL_MIN 1E-37
19632 #define FLT_EPSILON 1E-5
19633 #define FLT_MIN 1E-37
19634 #define LDBL_EPSILON 1E-9
19635 #define LDBL_MIN 1E-37
19637 [<a name="p506" href="#p506">page 506</a>] (<a href="#Contents">Contents</a>)
19639 <a name="F" href="#F"><b> Annex F</b></a>
19640 (normative)
19641 IEC 60559 floating-point arithmetic
19642 <a name="F.1" href="#F.1"><b> F.1 Introduction</b></a>
19643 1 This annex specifies C language support for the IEC 60559 floating-point standard. The
19644 IEC 60559 floating-point standard is specifically Binary floating-point arithmetic for
19645 microprocessor systems, second edition (IEC 60559:1989), previously designated
19646 IEC 559:1989 and as IEEE Standard for Binary Floating-Point Arithmetic
19647 (ANSI/IEEE 754-1985). IEEE Standard for Radix-Independent Floating-Point
19648 Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
19649 dependencies on radix and word length. IEC 60559 generally refers to the floating-point
19650 standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
19651 defines __STDC_IEC_559__ shall conform to the specifications in this annex.<sup><a href="#note356"><b>356)</b></a></sup>
19652 Where a binding between the C language and IEC 60559 is indicated, the
19653 IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since
19654 negative and positive infinity are representable in IEC 60559 formats, all real numbers lie
19655 within the range of representable values.
19656 <a name="F.2" href="#F.2"><b> F.2 Types</b></a>
19657 1 The C floating types match the IEC 60559 formats as follows:
19658 -- The float type matches the IEC 60559 single format.
19659 -- The double type matches the IEC 60559 double format.
19660 -- The long double type matches an IEC 60559 extended format,<sup><a href="#note357"><b>357)</b></a></sup> else a
19661 non-IEC 60559 extended format, else the IEC 60559 double format.
19662 Any non-IEC 60559 extended format used for the long double type shall have more
19663 precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note358"><b>358)</b></a></sup>
19668 <sup><a name="note356" href="#note356"><b>356)</b></a></sup> Implementations that do not define __STDC_IEC_559__ are not required to conform to these
19669 specifications.
19670 <sup><a name="note357" href="#note357"><b>357)</b></a></sup> ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit
19671 and quadruple 128-bit IEC 60559 formats.
19672 <sup><a name="note358" href="#note358"><b>358)</b></a></sup> A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
19673 all double values.
19675 [<a name="p507" href="#p507">page 507</a>] (<a href="#Contents">Contents</a>)
19677 Recommended practice
19678 2 The long double type should match an IEC 60559 extended format.
19679 <a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
19680 1 This specification does not define the behavior of signaling NaNs.<sup><a href="#note359"><b>359)</b></a></sup> It generally uses
19681 the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
19682 functions in <a href="#7.12">&lt;math.h&gt;</a> provide designations for IEC 60559 NaNs and infinities.
19683 <a name="F.3" href="#F.3"><b> F.3 Operators and functions</b></a>
19684 1 C operators and functions provide IEC 60559 required and recommended facilities as
19685 listed below.
19686 -- The +, -, *, and / operators provide the IEC 60559 add, subtract, multiply, and
19687 divide operations.
19688 -- The sqrt functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 square root operation.
19689 -- The remainder functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 remainder
19690 operation. The remquo functions in <a href="#7.12">&lt;math.h&gt;</a> provide the same operation but
19691 with additional information.
19692 -- The rint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559 operation that rounds a
19693 floating-point number to an integer value (in the same precision). The nearbyint
19694 functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nearbyinteger function recommended in the
19695 Appendix to ANSI/IEEE 854.
19696 -- The conversions for floating types provide the IEC 60559 conversions between
19697 floating-point precisions.
19698 -- The conversions from integer to floating types provide the IEC 60559 conversions
19699 from integer to floating point.
19700 -- The conversions from floating to integer types provide IEC 60559-like conversions
19701 but always round toward zero.
19702 -- The lrint and llrint functions in <a href="#7.12">&lt;math.h&gt;</a> provide the IEC 60559
19703 conversions, which honor the directed rounding mode, from floating point to the
19704 long int and long long int integer formats. The lrint and llrint
19705 functions can be used to implement IEC 60559 conversions from floating to other
19706 integer formats.
19707 -- The translation time conversion of floating constants and the strtod, strtof,
19708 strtold, fprintf, fscanf, and related library functions in <a href="#7.22">&lt;stdlib.h&gt;</a>,
19711 <sup><a name="note359" href="#note359"><b>359)</b></a></sup> Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
19712 sufficient for closure of the arithmetic.
19714 [<a name="p508" href="#p508">page 508</a>] (<a href="#Contents">Contents</a>)
19716 <a href="#7.21">&lt;stdio.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a> provide IEC 60559 binary-decimal conversions. The
19717 strtold function in <a href="#7.22">&lt;stdlib.h&gt;</a> provides the conv function recommended in the
19718 Appendix to ANSI/IEEE 854.
19719 -- The relational and equality operators provide IEC 60559 comparisons. IEC 60559
19720 identifies a need for additional comparison predicates to facilitate writing code that
19721 accounts for NaNs. The comparison macros (isgreater, isgreaterequal,
19722 isless, islessequal, islessgreater, and isunordered) in <a href="#7.12">&lt;math.h&gt;</a>
19723 supplement the language operators to address this need. The islessgreater and
19724 isunordered macros provide respectively a quiet version of the &lt;&gt; predicate and
19725 the unordered predicate recommended in the Appendix to IEC 60559.
19726 -- The feclearexcept, feraiseexcept, and fetestexcept functions in
19727 <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to test and alter the IEC 60559 floating-point
19728 exception status flags. The fegetexceptflag and fesetexceptflag
19729 functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility to save and restore all five status flags at
19730 one time. These functions are used in conjunction with the type fexcept_t and the
19731 floating-point exception macros (FE_INEXACT, FE_DIVBYZERO,
19732 FE_UNDERFLOW, FE_OVERFLOW, FE_INVALID) also in <a href="#7.6">&lt;fenv.h&gt;</a>.
19733 -- The fegetround and fesetround functions in <a href="#7.6">&lt;fenv.h&gt;</a> provide the facility
19734 to select among the IEC 60559 directed rounding modes represented by the rounding
19735 direction macros in <a href="#7.6">&lt;fenv.h&gt;</a> (FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
19736 FE_TOWARDZERO) and the values 0, 1, 2, and 3 of FLT_ROUNDS are the
19737 IEC 60559 directed rounding modes.
19738 -- The fegetenv, feholdexcept, fesetenv, and feupdateenv functions in
19739 <a href="#7.6">&lt;fenv.h&gt;</a> provide a facility to manage the floating-point environment, comprising
19740 the IEC 60559 status flags and control modes.
19741 -- The copysign functions in <a href="#7.12">&lt;math.h&gt;</a> provide the copysign function
19742 recommended in the Appendix to IEC 60559.
19743 -- The fabs functions in <a href="#7.12">&lt;math.h&gt;</a> provide the abs function recommended in the
19744 Appendix to IEC 60559.
19745 -- The unary minus (-) operator provides the unary minus (-) operation recommended
19746 in the Appendix to IEC 60559.
19747 -- The scalbn and scalbln functions in <a href="#7.12">&lt;math.h&gt;</a> provide the scalb function
19748 recommended in the Appendix to IEC 60559.
19749 -- The logb functions in <a href="#7.12">&lt;math.h&gt;</a> provide the logb function recommended in the
19750 Appendix to IEC 60559, but following the newer specifications in ANSI/IEEE 854.
19751 -- The nextafter and nexttoward functions in <a href="#7.12">&lt;math.h&gt;</a> provide the nextafter
19752 function recommended in the Appendix to IEC 60559 (but with a minor change to
19754 [<a name="p509" href="#p509">page 509</a>] (<a href="#Contents">Contents</a>)
19756 better handle signed zeros).
19757 -- The isfinite macro in <a href="#7.12">&lt;math.h&gt;</a> provides the finite function recommended in
19758 the Appendix to IEC 60559.
19759 -- The isnan macro in <a href="#7.12">&lt;math.h&gt;</a> provides the isnan function recommended in the
19760 Appendix to IEC 60559.
19761 -- The signbit macro and the fpclassify macro in <a href="#7.12">&lt;math.h&gt;</a>, used in
19762 conjunction with the number classification macros (FP_NAN, FP_INFINITE,
19763 FP_NORMAL, FP_SUBNORMAL, FP_ZERO), provide the facility of the class
19764 function recommended in the Appendix to IEC 60559 (except that the classification
19765 macros defined in <a href="#7.12.3">7.12.3</a> do not distinguish signaling from quiet NaNs).
19766 <a name="F.4" href="#F.4"><b> F.4 Floating to integer conversion</b></a>
19767 1 If the integer type is _Bool, <a href="#6.3.1.2">6.3.1.2</a> applies and no floating-point exceptions are raised
19768 (even for NaN). Otherwise, if the floating value is infinite or NaN or if the integral part
19769 of the floating value exceeds the range of the integer type, then the ''invalid'' floating-
19770 point exception is raised and the resulting value is unspecified. Otherwise, the resulting
19771 value is determined by <a href="#6.3.1.4">6.3.1.4</a>. Conversion of an integral floating value that does not
19772 exceed the range of the integer type raises no floating-point exceptions; whether
19773 conversion of a non-integral floating value raises the ''inexact'' floating-point exception is
19774 unspecified.<sup><a href="#note360"><b>360)</b></a></sup>
19775 <a name="F.5" href="#F.5"><b> F.5 Binary-decimal conversion</b></a>
19776 1 Conversion from the widest supported IEC 60559 format to decimal with
19777 DECIMAL_DIG digits and back is the identity function.<sup><a href="#note361"><b>361)</b></a></sup>
19778 2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
19779 particular, conversion between any supported IEC 60559 format and decimal with
19780 DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
19781 rounding mode), which assures that conversion from the widest supported IEC 60559
19782 format to decimal with DECIMAL_DIG digits and back is the identity function.
19786 <sup><a name="note360" href="#note360"><b>360)</b></a></sup> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
19787 conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
19788 cases where it matters, library functions can be used to effect such conversions with or without raising
19789 the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
19790 <a href="#7.12">&lt;math.h&gt;</a>.
19791 <sup><a name="note361" href="#note361"><b>361)</b></a></sup> If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
19792 DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
19793 IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
19794 DBL_DIG are 18 and 15, respectively, for these formats.)
19796 [<a name="p510" href="#p510">page 510</a>] (<a href="#Contents">Contents</a>)
19798 3 Functions such as strtod that convert character sequences to floating types honor the
19799 rounding direction. Hence, if the rounding direction might be upward or downward, the
19800 implementation cannot convert a minus-signed sequence by negating the converted
19801 unsigned sequence.
19802 <a name="F.6" href="#F.6"><b> F.6 The return statement</b></a>
19803 If the return expression is evaluated in a floating-point format different from the return
19804 type, the expression is converted as if by assignment<sup><a href="#note362"><b>362)</b></a></sup> to the return type of the function
19805 and the resulting value is returned to the caller.
19806 <a name="F.7" href="#F.7"><b> F.7 Contracted expressions</b></a>
19807 1 A contracted expression is correctly rounded (once) and treats infinities, NaNs, signed
19808 zeros, subnormals, and the rounding directions in a manner consistent with the basic
19809 arithmetic operations covered by IEC 60559.
19810 Recommended practice
19811 2 A contracted expression should raise floating-point exceptions in a manner generally
19812 consistent with the basic arithmetic operations.
19813 <a name="F.8" href="#F.8"><b> F.8 Floating-point environment</b></a>
19814 1 The floating-point environment defined in <a href="#7.6">&lt;fenv.h&gt;</a> includes the IEC 60559 floating-
19815 point exception status flags and directed-rounding control modes. It includes also
19816 IEC 60559 dynamic rounding precision and trap enablement modes, if the
19817 implementation supports them.<sup><a href="#note363"><b>363)</b></a></sup>
19818 <a name="F.8.1" href="#F.8.1"><b> F.8.1 Environment management</b></a>
19819 1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
19820 status flags, and that rounding control modes can be set explicitly to affect result values of
19821 floating-point operations. When the state for the FENV_ACCESS pragma (defined in
19822 <a href="#7.6">&lt;fenv.h&gt;</a>) is ''on'', these changes to the floating-point state are treated as side effects
19823 which respect sequence points.<sup><a href="#note364"><b>364)</b></a></sup>
19828 <sup><a name="note362" href="#note362"><b>362)</b></a></sup> Assignment removes any extra range and precision.
19829 <sup><a name="note363" href="#note363"><b>363)</b></a></sup> This specification does not require dynamic rounding precision nor trap enablement modes.
19830 <sup><a name="note364" href="#note364"><b>364)</b></a></sup> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
19831 point control modes will be the default ones and the floating-point status flags will not be tested,
19832 which allows certain optimizations (see <a href="#F.9">F.9</a>).
19834 [<a name="p511" href="#p511">page 511</a>] (<a href="#Contents">Contents</a>)
19836 <a name="F.8.2" href="#F.8.2"><b> F.8.2 Translation</b></a>
19837 1 During translation the IEC 60559 default modes are in effect:
19838 -- The rounding direction mode is rounding to nearest.
19839 -- The rounding precision mode (if supported) is set so that results are not shortened.
19840 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
19841 Recommended practice
19842 2 The implementation should produce a diagnostic message for each translation-time
19843 floating-point exception, other than ''inexact'';<sup><a href="#note365"><b>365)</b></a></sup> the implementation should then
19844 proceed with the translation of the program.
19845 <a name="F.8.3" href="#F.8.3"><b> F.8.3 Execution</b></a>
19846 1 At program startup the floating-point environment is initialized as prescribed by
19847 IEC 60559:
19848 -- All floating-point exception status flags are cleared.
19849 -- The rounding direction mode is rounding to nearest.
19850 -- The dynamic rounding precision mode (if supported) is set so that results are not
19851 shortened.
19852 -- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
19853 <a name="F.8.4" href="#F.8.4"><b> F.8.4 Constant expressions</b></a>
19854 1 An arithmetic constant expression of floating type, other than one in an initializer for an
19855 object that has static or thread storage duration, is evaluated (as if) during execution; thus,
19856 it is affected by any operative floating-point control modes and raises floating-point
19857 exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
19858 is ''on'').<sup><a href="#note366"><b>366)</b></a></sup>
19859 2 EXAMPLE
19863 <sup><a name="note365" href="#note365"><b>365)</b></a></sup> As floating constants are converted to appropriate internal representations at translation time, their
19864 conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
19865 (even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
19866 strtod, provide execution-time conversion of numeric strings.
19867 <sup><a name="note366" href="#note366"><b>366)</b></a></sup> Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
19868 are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
19869 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
19870 efficiency of translation-time evaluation through static initialization, such as
19871 const static double one_third = 1.0/3.0;
19873 [<a name="p512" href="#p512">page 512</a>] (<a href="#Contents">Contents</a>)
19875 #include <a href="#7.6">&lt;fenv.h&gt;</a>
19876 #pragma STDC FENV_ACCESS ON
19877 void f(void)
19879 float w[] = { 0.0/0.0 }; // raises an exception
19880 static float x = 0.0/0.0; // does not raise an exception
19881 float y = 0.0/0.0; // raises an exception
19882 double z = 0.0/0.0; // raises an exception
19883 /* ... */
19885 3 For the static initialization, the division is done at translation time, raising no (execution-time) floating-
19886 point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at
19887 execution time.
19889 <a name="F.8.5" href="#F.8.5"><b> F.8.5 Initialization</b></a>
19890 1 All computation for automatic initialization is done (as if) at execution time; thus, it is
19891 affected by any operative modes and raises floating-point exceptions as required by
19892 IEC 60559 (provided the state for the FENV_ACCESS pragma is ''on''). All computation
19893 for initialization of objects that have static or thread storage duration is done (as if) at
19894 translation time.
19895 2 EXAMPLE
19896 #include <a href="#7.6">&lt;fenv.h&gt;</a>
19897 #pragma STDC FENV_ACCESS ON
19898 void f(void)
19900 float u[] = { 1.1e75 }; // raises exceptions
19901 static float v = 1.1e75; // does not raise exceptions
19902 float w = 1.1e75; // raises exceptions
19903 double x = 1.1e75; // may raise exceptions
19904 float y = 1.1e75f; // may raise exceptions
19905 long double z = 1.1e75; // does not raise exceptions
19906 /* ... */
19908 3 The static initialization of v raises no (execution-time) floating-point exceptions because its computation is
19909 done at translation time. The automatic initialization of u and w require an execution-time conversion to
19910 float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
19911 of x and y entail execution-time conversion; however, in some expression evaluation methods, the
19912 conversions is not to a narrower format, in which case no floating-point exception is raised.<sup><a href="#note367"><b>367)</b></a></sup> The
19913 automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
19914 point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
19918 <sup><a name="note367" href="#note367"><b>367)</b></a></sup> Use of float_t and double_t variables increases the likelihood of translation-time computation.
19919 For example, the automatic initialization
19920 double_t x = 1.1e75;
19921 could be done at translation time, regardless of the expression evaluation method.
19923 [<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
19925 their internal representations occur at translation time in all cases.
19927 <a name="F.8.6" href="#F.8.6"><b> F.8.6 Changing the environment</b></a>
19928 1 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
19929 change floating-point status flags and control modes just as indicated by their
19930 specifications (including conformance to IEC 60559). They do not change flags or modes
19931 (so as to be detectable by the user) in any other cases.
19932 2 If the argument to the feraiseexcept function in <a href="#7.6">&lt;fenv.h&gt;</a> represents IEC 60559
19933 valid coincident floating-point exceptions for atomic operations (namely ''overflow'' and
19934 ''inexact'', or ''underflow'' and ''inexact''), then ''overflow'' or ''underflow'' is raised
19935 before ''inexact''.
19936 <a name="F.9" href="#F.9"><b> F.9 Optimization</b></a>
19937 1 This section identifies code transformations that might subvert IEC 60559-specified
19938 behavior, and others that do not.
19939 <a name="F.9.1" href="#F.9.1"><b> F.9.1 Global transformations</b></a>
19940 1 Floating-point arithmetic operations and external function calls may entail side effects
19941 which optimization shall honor, at least where the state of the FENV_ACCESS pragma is
19942 ''on''. The flags and modes in the floating-point environment may be regarded as global
19943 variables; floating-point operations (+, *, etc.) implicitly read the modes and write the
19944 flags.
19945 2 Concern about side effects may inhibit code motion and removal of seemingly useless
19946 code. For example, in
19947 #include <a href="#7.6">&lt;fenv.h&gt;</a>
19948 #pragma STDC FENV_ACCESS ON
19949 void f(double x)
19951 /* ... */
19952 for (i = 0; i &lt; n; i++) x + 1;
19953 /* ... */
19955 x + 1 might raise floating-point exceptions, so cannot be removed. And since the loop
19956 body might not execute (maybe 0 &gt;= n), x + 1 cannot be moved out of the loop. (Of
19957 course these optimizations are valid if the implementation can rule out the nettlesome
19958 cases.)
19959 3 This specification does not require support for trap handlers that maintain information
19960 about the order or count of floating-point exceptions. Therefore, between function calls,
19961 floating-point exceptions need not be precise: the actual order and number of occurrences
19962 of floating-point exceptions (&gt; 1) may vary from what the source code expresses. Thus,
19964 [<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
19966 the preceding loop could be treated as
19967 if (0 &lt; n) x + 1;
19968 <a name="F.9.2" href="#F.9.2"><b> F.9.2 Expression transformations</b></a>
19969 1 x/2 &lt;-&gt; x x 0.5 Although similar transformations involving inexact constants
19970 generally do not yield numerically equivalent expressions, if the
19971 constants are exact then such transformations can be made on
19972 IEC 60559 machines and others that round perfectly.
19973 1 x x and x/1 -&gt; x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
19974 machines, among others).<sup><a href="#note368"><b>368)</b></a></sup>
19975 x/x -&gt; 1.0 The expressions x/x and 1.0 are not equivalent if x can be zero,
19976 infinite, or NaN.
19977 x - y &lt;-&gt; x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on
19978 IEC 60559 machines, among others).
19979 x - y &lt;-&gt; -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1
19980 is +0 but -(1 - 1) is -0 (in the default rounding direction).<sup><a href="#note369"><b>369)</b></a></sup>
19981 x - x -&gt; 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or
19982 infinite.
19983 0 x x -&gt; 0.0 The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
19984 infinite, or -0.
19985 x+0-&gt; x The expressions x + 0 and x are not equivalent if x is -0, because
19986 (-0) + (+0) yields +0 (in the default rounding direction), not -0.
19987 x-0-&gt; x (+0) - (+0) yields -0 when rounding is downward (toward -(inf)), but
19988 +0 otherwise, and (-0) - (+0) always yields -0; so, if the state of the
19989 FENV_ACCESS pragma is ''off'', promising default rounding, then
19990 the implementation can replace x - 0 by x, even if x might be zero.
19991 -x &lt;-&gt; 0 - x The expressions -x and 0 - x are not equivalent if x is +0, because
19992 -(+0) yields -0, but 0 - (+0) yields +0 (unless rounding is
19993 downward).
19995 <sup><a name="note368" href="#note368"><b>368)</b></a></sup> Strict support for signaling NaNs -- not required by this specification -- would invalidate these and
19996 other transformations that remove arithmetic operators.
19997 <sup><a name="note369" href="#note369"><b>369)</b></a></sup> IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
19998 Examples include:
19999 1/(1/ (+-) (inf)) is (+-) (inf)
20001 conj(csqrt(z)) is csqrt(conj(z)),
20002 for complex z.
20004 [<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
20006 <a name="F.9.3" href="#F.9.3"><b> F.9.3 Relational operators</b></a>
20007 1 x != x -&gt; false The expression x != x is true if x is a NaN.
20008 x = x -&gt; true The expression x = x is false if x is a NaN.
20009 x &lt; y -&gt; isless(x,y) (and similarly for &lt;=, &gt;, &gt;=) Though numerically equal, these
20010 expressions are not equivalent because of side effects when x or y is a
20011 NaN and the state of the FENV_ACCESS pragma is ''on''. This
20012 transformation, which would be desirable if extra code were required
20013 to cause the ''invalid'' floating-point exception for unordered cases,
20014 could be performed provided the state of the FENV_ACCESS pragma
20015 is ''off''.
20016 The sense of relational operators shall be maintained. This includes handling unordered
20017 cases as expressed by the source code.
20018 2 EXAMPLE
20019 // calls g and raises ''invalid'' if a and b are unordered
20020 if (a &lt; b)
20021 f();
20022 else
20023 g();
20024 is not equivalent to
20025 // calls f and raises ''invalid'' if a and b are unordered
20026 if (a &gt;= b)
20027 g();
20028 else
20029 f();
20030 nor to
20031 // calls f without raising ''invalid'' if a and b are unordered
20032 if (isgreaterequal(a,b))
20033 g();
20034 else
20035 f();
20036 nor, unless the state of the FENV_ACCESS pragma is ''off'', to
20037 // calls g without raising ''invalid'' if a and b are unordered
20038 if (isless(a,b))
20039 f();
20040 else
20041 g();
20042 but is equivalent to
20044 [<a name="p516" href="#p516">page 516</a>] (<a href="#Contents">Contents</a>)
20046 if (!(a &lt; b))
20047 g();
20048 else
20049 f();
20051 <a name="F.9.4" href="#F.9.4"><b> F.9.4 Constant arithmetic</b></a>
20052 1 The implementation shall honor floating-point exceptions raised by execution-time
20053 constant arithmetic wherever the state of the FENV_ACCESS pragma is ''on''. (See <a href="#F.8.4">F.8.4</a>
20054 and <a href="#F.8.5">F.8.5</a>.) An operation on constants that raises no floating-point exception can be
20055 folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
20056 further check is required to assure that changing the rounding direction to downward does
20057 not alter the sign of the result,<sup><a href="#note370"><b>370)</b></a></sup> and implementations that support dynamic rounding
20058 precision modes shall assure further that the result of the operation raises no floating-
20059 point exception when converted to the semantic type of the operation.
20060 <a name="F.10" href="#F.10"><b> F.10 Mathematics &lt;math.h&gt;</b></a>
20061 1 This subclause contains specifications of <a href="#7.12">&lt;math.h&gt;</a> facilities that are particularly suited
20062 for IEC 60559 implementations.
20063 2 The Standard C macro HUGE_VAL and its float and long double analogs,
20064 HUGE_VALF and HUGE_VALL, expand to expressions whose values are positive
20065 infinities.
20066 3 Special cases for functions in <a href="#7.12">&lt;math.h&gt;</a> are covered directly or indirectly by
20067 IEC 60559. The functions that IEC 60559 specifies directly are identified in <a href="#F.3">F.3</a>. The
20068 other functions in <a href="#7.12">&lt;math.h&gt;</a> treat infinities, NaNs, signed zeros, subnormals, and
20069 (provided the state of the FENV_ACCESS pragma is ''on'') the floating-point status flags
20070 in a manner consistent with the basic arithmetic operations covered by IEC 60559.
20071 4 The expression math_errhandling &amp; MATH_ERREXCEPT shall evaluate to a
20072 nonzero value.
20073 5 The ''invalid'' and ''divide-by-zero'' floating-point exceptions are raised as specified in
20074 subsequent subclauses of this annex.
20075 6 The ''overflow'' floating-point exception is raised whenever an infinity -- or, because of
20076 rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
20077 whose magnitude is too large.
20078 7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
20079 subnormal or zero) and suffers loss of accuracy.<sup><a href="#note371"><b>371)</b></a></sup>
20082 <sup><a name="note370" href="#note370"><b>370)</b></a></sup> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
20083 <sup><a name="note371" href="#note371"><b>371)</b></a></sup> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
20084 when the floating-point exception is raised.
20086 [<a name="p517" href="#p517">page 517</a>] (<a href="#Contents">Contents</a>)
20088 8 Whether or when library functions raise the ''inexact'' floating-point exception is
20089 unspecified, unless explicitly specified otherwise.
20090 9 Whether or when library functions raise an undeserved ''underflow'' floating-point
20091 exception is unspecified.<sup><a href="#note372"><b>372)</b></a></sup> Otherwise, as implied by <a href="#F.8.6">F.8.6</a>, the <a href="#7.12">&lt;math.h&gt;</a> functions do
20092 not raise spurious floating-point exceptions (detectable by the user), other than the
20093 ''inexact'' floating-point exception.
20094 10 Whether the functions honor the rounding direction mode is implementation-defined,
20095 unless explicitly specified otherwise.
20096 11 Functions with a NaN argument return a NaN result and raise no floating-point exception,
20097 except where stated otherwise.
20098 12 The specifications in the following subclauses append to the definitions in <a href="#7.12">&lt;math.h&gt;</a>.
20099 For families of functions, the specifications apply to all of the functions even though only
20100 the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
20101 occurs in both an argument and the result, the result has the same sign as the argument.
20102 Recommended practice
20103 13 If a function with one or more NaN arguments returns a NaN result, the result should be
20104 the same as one of the NaN arguments (after possible type conversion), except perhaps
20105 for the sign.
20106 <a name="F.10.1" href="#F.10.1"><b> F.10.1 Trigonometric functions</b></a>
20107 <a name="F.10.1.1" href="#F.10.1.1"><b> F.10.1.1 The acos functions</b></a>
20108 1 -- acos(1) returns +0.
20109 -- acos(x) returns a NaN and raises the ''invalid'' floating-point exception for
20110 | x | &gt; 1.
20111 <a name="F.10.1.2" href="#F.10.1.2"><b> F.10.1.2 The asin functions</b></a>
20112 1 -- asin((+-)0) returns (+-)0.
20113 -- asin(x) returns a NaN and raises the ''invalid'' floating-point exception for
20114 | x | &gt; 1.
20119 <sup><a name="note372" href="#note372"><b>372)</b></a></sup> It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
20120 avoiding them would be too costly.
20122 [<a name="p518" href="#p518">page 518</a>] (<a href="#Contents">Contents</a>)
20124 <a name="F.10.1.3" href="#F.10.1.3"><b> F.10.1.3 The atan functions</b></a>
20125 1 -- atan((+-)0) returns (+-)0.
20126 -- atan((+-)(inf)) returns (+-)pi /2.
20127 <a name="F.10.1.4" href="#F.10.1.4"><b> F.10.1.4 The atan2 functions</b></a>
20128 1 -- atan2((+-)0, -0) returns (+-)pi .<sup><a href="#note373"><b>373)</b></a></sup>
20129 -- atan2((+-)0, +0) returns (+-)0.
20130 -- atan2((+-)0, x) returns (+-)pi for x &lt; 0.
20131 -- atan2((+-)0, x) returns (+-)0 for x &gt; 0.
20132 -- atan2(y, (+-)0) returns -pi /2 for y &lt; 0.
20133 -- atan2(y, (+-)0) returns pi /2 for y &gt; 0.
20134 -- atan2((+-)y, -(inf)) returns (+-)pi for finite y &gt; 0.
20135 -- atan2((+-)y, +(inf)) returns (+-)0 for finite y &gt; 0.
20136 -- atan2((+-)(inf), x) returns (+-)pi /2 for finite x.
20137 -- atan2((+-)(inf), -(inf)) returns (+-)3pi /4.
20138 -- atan2((+-)(inf), +(inf)) returns (+-)pi /4.
20139 <a name="F.10.1.5" href="#F.10.1.5"><b> F.10.1.5 The cos functions</b></a>
20140 1 -- cos((+-)0) returns 1.
20141 -- cos((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
20142 <a name="F.10.1.6" href="#F.10.1.6"><b> F.10.1.6 The sin functions</b></a>
20143 1 -- sin((+-)0) returns (+-)0.
20144 -- sin((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
20145 <a name="F.10.1.7" href="#F.10.1.7"><b> F.10.1.7 The tan functions</b></a>
20146 1 -- tan((+-)0) returns (+-)0.
20147 -- tan((+-)(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
20152 <sup><a name="note373" href="#note373"><b>373)</b></a></sup> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
20153 the ''divide-by-zero'' floating-point exception.
20155 [<a name="p519" href="#p519">page 519</a>] (<a href="#Contents">Contents</a>)
20157 <a name="F.10.2" href="#F.10.2"><b> F.10.2 Hyperbolic functions</b></a>
20158 <a name="F.10.2.1" href="#F.10.2.1"><b> F.10.2.1 The acosh functions</b></a>
20159 1 -- acosh(1) returns +0.
20160 -- acosh(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 1.
20161 -- acosh(+(inf)) returns +(inf).
20162 <a name="F.10.2.2" href="#F.10.2.2"><b> F.10.2.2 The asinh functions</b></a>
20163 1 -- asinh((+-)0) returns (+-)0.
20164 -- asinh((+-)(inf)) returns (+-)(inf).
20165 <a name="F.10.2.3" href="#F.10.2.3"><b> F.10.2.3 The atanh functions</b></a>
20166 1 -- atanh((+-)0) returns (+-)0.
20167 -- atanh((+-)1) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
20168 -- atanh(x) returns a NaN and raises the ''invalid'' floating-point exception for
20169 | x | &gt; 1.
20170 <a name="F.10.2.4" href="#F.10.2.4"><b> F.10.2.4 The cosh functions</b></a>
20171 1 -- cosh((+-)0) returns 1.
20172 -- cosh((+-)(inf)) returns +(inf).
20173 <a name="F.10.2.5" href="#F.10.2.5"><b> F.10.2.5 The sinh functions</b></a>
20174 1 -- sinh((+-)0) returns (+-)0.
20175 -- sinh((+-)(inf)) returns (+-)(inf).
20176 <a name="F.10.2.6" href="#F.10.2.6"><b> F.10.2.6 The tanh functions</b></a>
20177 1 -- tanh((+-)0) returns (+-)0.
20178 -- tanh((+-)(inf)) returns (+-)1.
20179 <a name="F.10.3" href="#F.10.3"><b> F.10.3 Exponential and logarithmic functions</b></a>
20180 <a name="F.10.3.1" href="#F.10.3.1"><b> F.10.3.1 The exp functions</b></a>
20181 1 -- exp((+-)0) returns 1.
20182 -- exp(-(inf)) returns +0.
20183 -- exp(+(inf)) returns +(inf).
20185 [<a name="p520" href="#p520">page 520</a>] (<a href="#Contents">Contents</a>)
20187 <a name="F.10.3.2" href="#F.10.3.2"><b> F.10.3.2 The exp2 functions</b></a>
20188 1 -- exp2((+-)0) returns 1.
20189 -- exp2(-(inf)) returns +0.
20190 -- exp2(+(inf)) returns +(inf).
20191 <a name="F.10.3.3" href="#F.10.3.3"><b> F.10.3.3 The expm1 functions</b></a>
20192 1 -- expm1((+-)0) returns (+-)0.
20193 -- expm1(-(inf)) returns -1.
20194 -- expm1(+(inf)) returns +(inf).
20195 <a name="F.10.3.4" href="#F.10.3.4"><b> F.10.3.4 The frexp functions</b></a>
20196 1 -- frexp((+-)0, exp) returns (+-)0, and stores 0 in the object pointed to by exp.
20197 -- frexp((+-)(inf), exp) returns (+-)(inf), and stores an unspecified value in the object
20198 pointed to by exp.
20199 -- frexp(NaN, exp) stores an unspecified value in the object pointed to by exp
20200 (and returns a NaN).
20201 2 frexp raises no floating-point exceptions.
20202 3 When the radix of the argument is a power of 2, the returned value is exact and is
20203 independent of the current rounding direction mode.
20204 4 On a binary system, the body of the frexp function might be
20206 *exp = (value == 0) ? 0 : (int)(1 + logb(value));
20207 return scalbn(value, -(*exp));
20209 <a name="F.10.3.5" href="#F.10.3.5"><b> F.10.3.5 The ilogb functions</b></a>
20210 1 When the correct result is representable in the range of the return type, the returned value
20211 is exact and is independent of the current rounding direction mode.
20212 2 If the correct result is outside the range of the return type, the numeric result is
20213 unspecified and the ''invalid'' floating-point exception is raised.
20214 3 ilogb(x), for x zero, infinite, or NaN, raises the ''invalid'' floating-point exception and
20215 returns the value specified in <a href="#7.12.6.5">7.12.6.5</a>.
20217 [<a name="p521" href="#p521">page 521</a>] (<a href="#Contents">Contents</a>)
20219 <a name="F.10.3.6" href="#F.10.3.6"><b> F.10.3.6 The ldexp functions</b></a>
20220 1 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
20221 <a name="F.10.3.7" href="#F.10.3.7"><b> F.10.3.7 The log functions</b></a>
20222 1 -- log((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
20223 -- log(1) returns +0.
20224 -- log(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
20225 -- log(+(inf)) returns +(inf).
20226 <a name="F.10.3.8" href="#F.10.3.8"><b> F.10.3.8 The log10 functions</b></a>
20227 1 -- log10((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
20228 -- log10(1) returns +0.
20229 -- log10(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
20230 -- log10(+(inf)) returns +(inf).
20231 <a name="F.10.3.9" href="#F.10.3.9"><b> F.10.3.9 The log1p functions</b></a>
20232 1 -- log1p((+-)0) returns (+-)0.
20233 -- log1p(-1) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
20234 -- log1p(x) returns a NaN and raises the ''invalid'' floating-point exception for
20235 x &lt; -1.
20236 -- log1p(+(inf)) returns +(inf).
20237 <a name="F.10.3.10" href="#F.10.3.10"><b> F.10.3.10 The log2 functions</b></a>
20238 1 -- log2((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
20239 -- log2(1) returns +0.
20240 -- log2(x) returns a NaN and raises the ''invalid'' floating-point exception for x &lt; 0.
20241 -- log2(+(inf)) returns +(inf).
20242 <a name="F.10.3.11" href="#F.10.3.11"><b> F.10.3.11 The logb functions</b></a>
20243 1 -- logb((+-)0) returns -(inf) and raises the ''divide-by-zero'' floating-point exception.
20244 -- logb((+-)(inf)) returns +(inf).
20245 2 The returned value is exact and is independent of the current rounding direction mode.
20247 [<a name="p522" href="#p522">page 522</a>] (<a href="#Contents">Contents</a>)
20249 <a name="F.10.3.12" href="#F.10.3.12"><b> F.10.3.12 The modf functions</b></a>
20250 1 -- modf((+-)x, iptr) returns a result with the same sign as x.
20251 -- modf((+-)(inf), iptr) returns (+-)0 and stores (+-)(inf) in the object pointed to by iptr.
20252 -- modf(NaN, iptr) stores a NaN in the object pointed to by iptr (and returns a
20253 NaN).
20254 2 The returned values are exact and are independent of the current rounding direction
20255 mode.
20256 3 modf behaves as though implemented by
20257 #include <a href="#7.12">&lt;math.h&gt;</a>
20258 #include <a href="#7.6">&lt;fenv.h&gt;</a>
20259 #pragma STDC FENV_ACCESS ON
20260 double modf(double value, double *iptr)
20262 int save_round = fegetround();
20263 fesetround(FE_TOWARDZERO);
20264 *iptr = nearbyint(value);
20265 fesetround(save_round);
20266 return copysign(
20267 isinf(value) ? 0.0 :
20268 value - (*iptr), value);
20270 <a name="F.10.3.13" href="#F.10.3.13"><b> F.10.3.13 The scalbn and scalbln functions</b></a>
20271 1 -- scalbn((+-)0, n) returns (+-)0.
20272 -- scalbn(x, 0) returns x.
20273 -- scalbn((+-)(inf), n) returns (+-)(inf).
20274 2 If the calculation does not overflow or underflow, the returned value is exact and
20275 independent of the current rounding direction mode.
20277 [<a name="p523" href="#p523">page 523</a>] (<a href="#Contents">Contents</a>)
20279 <a name="F.10.4" href="#F.10.4"><b> F.10.4 Power and absolute value functions</b></a>
20280 <a name="F.10.4.1" href="#F.10.4.1"><b> F.10.4.1 The cbrt functions</b></a>
20281 1 -- cbrt((+-)0) returns (+-)0.
20282 -- cbrt((+-)(inf)) returns (+-)(inf).
20283 <a name="F.10.4.2" href="#F.10.4.2"><b> F.10.4.2 The fabs functions</b></a>
20284 1 -- fabs((+-)0) returns +0.
20285 -- fabs((+-)(inf)) returns +(inf).
20286 2 The returned value is exact and is independent of the current rounding direction mode.
20287 <a name="F.10.4.3" href="#F.10.4.3"><b> F.10.4.3 The hypot functions</b></a>
20288 1 -- hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
20289 -- hypot(x, (+-)0) is equivalent to fabs(x).
20290 -- hypot((+-)(inf), y) returns +(inf), even if y is a NaN.
20291 <a name="F.10.4.4" href="#F.10.4.4"><b> F.10.4.4 The pow functions</b></a>
20292 1 -- pow((+-)0, y) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception
20293 for y an odd integer &lt; 0.
20294 -- pow((+-)0, y) returns +(inf) and raises the ''divide-by-zero'' floating-point exception
20295 for y &lt; 0, finite, and not an odd integer.
20296 -- pow((+-)0, -(inf)) returns +(inf) and may raise the ''divide-by-zero'' floating-point
20297 exception.
20298 -- pow((+-)0, y) returns (+-)0 for y an odd integer &gt; 0.
20299 -- pow((+-)0, y) returns +0 for y &gt; 0 and not an odd integer.
20300 -- pow(-1, (+-)(inf)) returns 1.
20301 -- pow(+1, y) returns 1 for any y, even a NaN.
20302 -- pow(x, (+-)0) returns 1 for any x, even a NaN.
20303 -- pow(x, y) returns a NaN and raises the ''invalid'' floating-point exception for
20304 finite x &lt; 0 and finite non-integer y.
20305 -- pow(x, -(inf)) returns +(inf) for | x | &lt; 1.
20306 -- pow(x, -(inf)) returns +0 for | x | &gt; 1.
20307 -- pow(x, +(inf)) returns +0 for | x | &lt; 1.
20308 -- pow(x, +(inf)) returns +(inf) for | x | &gt; 1.
20310 [<a name="p524" href="#p524">page 524</a>] (<a href="#Contents">Contents</a>)
20312 -- pow(-(inf), y) returns -0 for y an odd integer &lt; 0.
20313 -- pow(-(inf), y) returns +0 for y &lt; 0 and not an odd integer.
20314 -- pow(-(inf), y) returns -(inf) for y an odd integer &gt; 0.
20315 -- pow(-(inf), y) returns +(inf) for y &gt; 0 and not an odd integer.
20316 -- pow(+(inf), y) returns +0 for y &lt; 0.
20317 -- pow(+(inf), y) returns +(inf) for y &gt; 0.
20318 <a name="F.10.4.5" href="#F.10.4.5"><b> F.10.4.5 The sqrt functions</b></a>
20319 1 sqrt is fully specified as a basic arithmetic operation in IEC 60559. The returned value
20320 is dependent on the current rounding direction mode.
20321 <a name="F.10.5" href="#F.10.5"><b> F.10.5 Error and gamma functions</b></a>
20322 <a name="F.10.5.1" href="#F.10.5.1"><b> F.10.5.1 The erf functions</b></a>
20323 1 -- erf((+-)0) returns (+-)0.
20324 -- erf((+-)(inf)) returns (+-)1.
20325 <a name="F.10.5.2" href="#F.10.5.2"><b> F.10.5.2 The erfc functions</b></a>
20326 1 -- erfc(-(inf)) returns 2.
20327 -- erfc(+(inf)) returns +0.
20328 <a name="F.10.5.3" href="#F.10.5.3"><b> F.10.5.3 The lgamma functions</b></a>
20329 1 -- lgamma(1) returns +0.
20330 -- lgamma(2) returns +0.
20331 -- lgamma(x) returns +(inf) and raises the ''divide-by-zero'' floating-point exception for
20332 x a negative integer or zero.
20333 -- lgamma(-(inf)) returns +(inf).
20334 -- lgamma(+(inf)) returns +(inf).
20335 <a name="F.10.5.4" href="#F.10.5.4"><b> F.10.5.4 The tgamma functions</b></a>
20336 1 -- tgamma((+-)0) returns (+-)(inf) and raises the ''divide-by-zero'' floating-point exception.
20337 -- tgamma(x) returns a NaN and raises the ''invalid'' floating-point exception for x a
20338 negative integer.
20339 -- tgamma(-(inf)) returns a NaN and raises the ''invalid'' floating-point exception.
20340 -- tgamma(+(inf)) returns +(inf).
20342 [<a name="p525" href="#p525">page 525</a>] (<a href="#Contents">Contents</a>)
20344 <a name="F.10.6" href="#F.10.6"><b> F.10.6 Nearest integer functions</b></a>
20345 <a name="F.10.6.1" href="#F.10.6.1"><b> F.10.6.1 The ceil functions</b></a>
20346 1 -- ceil((+-)0) returns (+-)0.
20347 -- ceil((+-)(inf)) returns (+-)(inf).
20348 2 The returned value is independent of the current rounding direction mode.
20349 3 The double version of ceil behaves as though implemented by
20350 #include <a href="#7.12">&lt;math.h&gt;</a>
20351 #include <a href="#7.6">&lt;fenv.h&gt;</a>
20352 #pragma STDC FENV_ACCESS ON
20353 double ceil(double x)
20355 double result;
20356 int save_round = fegetround();
20357 fesetround(FE_UPWARD);
20358 result = rint(x); // or nearbyint instead of rint
20359 fesetround(save_round);
20360 return result;
20362 4 The ceil functions may, but are not required to, raise the ''inexact'' floating-point
20363 exception for finite non-integer arguments, as this implementation does.
20364 <a name="F.10.6.2" href="#F.10.6.2"><b> F.10.6.2 The floor functions</b></a>
20365 1 -- floor((+-)0) returns (+-)0.
20366 -- floor((+-)(inf)) returns (+-)(inf).
20367 2 The returned value and is independent of the current rounding direction mode.
20368 3 See the sample implementation for ceil in <a href="#F.10.6.1">F.10.6.1</a>. The floor functions may, but are
20369 not required to, raise the ''inexact'' floating-point exception for finite non-integer
20370 arguments, as that implementation does.
20371 <a name="F.10.6.3" href="#F.10.6.3"><b> F.10.6.3 The nearbyint functions</b></a>
20372 1 The nearbyint functions use IEC 60559 rounding according to the current rounding
20373 direction. They do not raise the ''inexact'' floating-point exception if the result differs in
20374 value from the argument.
20375 -- nearbyint((+-)0) returns (+-)0 (for all rounding directions).
20376 -- nearbyint((+-)(inf)) returns (+-)(inf) (for all rounding directions).
20378 [<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
20380 <a name="F.10.6.4" href="#F.10.6.4"><b> F.10.6.4 The rint functions</b></a>
20381 1 The rint functions differ from the nearbyint functions only in that they do raise the
20382 ''inexact'' floating-point exception if the result differs in value from the argument.
20383 <a name="F.10.6.5" href="#F.10.6.5"><b> F.10.6.5 The lrint and llrint functions</b></a>
20384 1 The lrint and llrint functions provide floating-to-integer conversion as prescribed
20385 by IEC 60559. They round according to the current rounding direction. If the rounded
20386 value is outside the range of the return type, the numeric result is unspecified and the
20387 ''invalid'' floating-point exception is raised. When they raise no other floating-point
20388 exception and the result differs from the argument, they raise the ''inexact'' floating-point
20389 exception.
20390 <a name="F.10.6.6" href="#F.10.6.6"><b> F.10.6.6 The round functions</b></a>
20391 1 -- round((+-)0) returns (+-)0.
20392 -- round((+-)(inf)) returns (+-)(inf).
20393 2 The returned value is independent of the current rounding direction mode.
20394 3 The double version of round behaves as though implemented by
20395 #include <a href="#7.12">&lt;math.h&gt;</a>
20396 #include <a href="#7.6">&lt;fenv.h&gt;</a>
20397 #pragma STDC FENV_ACCESS ON
20398 double round(double x)
20400 double result;
20401 fenv_t save_env;
20402 feholdexcept(&amp;save_env);
20403 result = rint(x);
20404 if (fetestexcept(FE_INEXACT)) {
20405 fesetround(FE_TOWARDZERO);
20406 result = rint(copysign(0.5 + fabs(x), x));
20408 feupdateenv(&amp;save_env);
20409 return result;
20411 The round functions may, but are not required to, raise the ''inexact'' floating-point
20412 exception for finite non-integer numeric arguments, as this implementation does.
20414 [<a name="p527" href="#p527">page 527</a>] (<a href="#Contents">Contents</a>)
20416 <a name="F.10.6.7" href="#F.10.6.7"><b> F.10.6.7 The lround and llround functions</b></a>
20417 1 The lround and llround functions differ from the lrint and llrint functions
20418 with the default rounding direction just in that the lround and llround functions
20419 round halfway cases away from zero and need not raise the ''inexact'' floating-point
20420 exception for non-integer arguments that round to within the range of the return type.
20421 <a name="F.10.6.8" href="#F.10.6.8"><b> F.10.6.8 The trunc functions</b></a>
20422 1 The trunc functions use IEC 60559 rounding toward zero (regardless of the current
20423 rounding direction). The returned value is exact.
20424 -- trunc((+-)0) returns (+-)0.
20425 -- trunc((+-)(inf)) returns (+-)(inf).
20426 2 The returned value is independent of the current rounding direction mode. The trunc
20427 functions may, but are not required to, raise the ''inexact'' floating-point exception for
20428 finite non-integer arguments.
20429 <a name="F.10.7" href="#F.10.7"><b> F.10.7 Remainder functions</b></a>
20430 <a name="F.10.7.1" href="#F.10.7.1"><b> F.10.7.1 The fmod functions</b></a>
20431 1 -- fmod((+-)0, y) returns (+-)0 for y not zero.
20432 -- fmod(x, y) returns a NaN and raises the ''invalid'' floating-point exception for x
20433 infinite or y zero (and neither is a NaN).
20434 -- fmod(x, (+-)(inf)) returns x for x not infinite.
20435 2 When subnormal results are supported, the returned value is exact and is independent of
20436 the current rounding direction mode.
20437 3 The double version of fmod behaves as though implemented by
20438 #include <a href="#7.12">&lt;math.h&gt;</a>
20439 #include <a href="#7.6">&lt;fenv.h&gt;</a>
20440 #pragma STDC FENV_ACCESS ON
20441 double fmod(double x, double y)
20443 double result;
20444 result = remainder(fabs(x), (y = fabs(y)));
20445 if (signbit(result)) result += y;
20446 return copysign(result, x);
20449 [<a name="p528" href="#p528">page 528</a>] (<a href="#Contents">Contents</a>)
20451 <a name="F.10.7.2" href="#F.10.7.2"><b> F.10.7.2 The remainder functions</b></a>
20452 1 The remainder functions are fully specified as a basic arithmetic operation in
20453 IEC 60559.
20454 2 When subnormal results are supported, the returned value is exact and is independent of
20455 the current rounding direction mode.
20456 <a name="F.10.7.3" href="#F.10.7.3"><b> F.10.7.3 The remquo functions</b></a>
20457 1 The remquo functions follow the specifications for the remainder functions. They
20458 have no further specifications special to IEC 60559 implementations.
20459 2 When subnormal results are supported, the returned value is exact and is independent of
20460 the current rounding direction mode.
20461 <a name="F.10.8" href="#F.10.8"><b> F.10.8 Manipulation functions</b></a>
20462 <a name="F.10.8.1" href="#F.10.8.1"><b> F.10.8.1 The copysign functions</b></a>
20463 1 copysign is specified in the Appendix to IEC 60559.
20464 2 The returned value is exact and is independent of the current rounding direction mode.
20465 <a name="F.10.8.2" href="#F.10.8.2"><b> F.10.8.2 The nan functions</b></a>
20466 1 All IEC 60559 implementations support quiet NaNs, in all floating formats.
20467 2 The returned value is exact and is independent of the current rounding direction mode.
20468 <a name="F.10.8.3" href="#F.10.8.3"><b> F.10.8.3 The nextafter functions</b></a>
20469 1 -- nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
20470 for x finite and the function value infinite.
20471 -- nextafter(x, y) raises the ''underflow'' and ''inexact'' floating-point
20472 exceptions for the function value subnormal or zero and x != y.
20473 2 Even though underflow or overflow can occur, the returned value is independent of the
20474 current rounding direction mode.
20475 <a name="F.10.8.4" href="#F.10.8.4"><b> F.10.8.4 The nexttoward functions</b></a>
20476 1 No additional requirements beyond those on nextafter.
20477 2 Even though underflow or overflow can occur, the returned value is independent of the
20478 current rounding direction mode.
20480 [<a name="p529" href="#p529">page 529</a>] (<a href="#Contents">Contents</a>)
20482 <a name="F.10.9" href="#F.10.9"><b> F.10.9 Maximum, minimum, and positive difference functions</b></a>
20483 <a name="F.10.9.1" href="#F.10.9.1"><b> F.10.9.1 The fdim functions</b></a>
20484 1 No additional requirements.
20485 <a name="F.10.9.2" href="#F.10.9.2"><b> F.10.9.2 The fmax functions</b></a>
20486 1 If just one argument is a NaN, the fmax functions return the other argument (if both
20487 arguments are NaNs, the functions return a NaN).
20488 2 The returned value is exact and is independent of the current rounding direction mode.
20489 3 The body of the fmax function might be<sup><a href="#note374"><b>374)</b></a></sup>
20490 { return (isgreaterequal(x, y) ||
20491 isnan(y)) ? x : y; }
20492 <a name="F.10.9.3" href="#F.10.9.3"><b> F.10.9.3 The fmin functions</b></a>
20493 1 The fmin functions are analogous to the fmax functions (see <a href="#F.10.9.2">F.10.9.2</a>).
20494 2 The returned value is exact and is independent of the current rounding direction mode.
20495 <a name="F.10.10" href="#F.10.10"><b> F.10.10 Floating multiply-add</b></a>
20496 <a name="F.10.10.1" href="#F.10.10.1"><b> F.10.10.1 The fma functions</b></a>
20497 1 -- fma(x, y, z) computes xy + z, correctly rounded once.
20498 -- fma(x, y, z) returns a NaN and optionally raises the ''invalid'' floating-point
20499 exception if one of x and y is infinite, the other is zero, and z is a NaN.
20500 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if
20501 one of x and y is infinite, the other is zero, and z is not a NaN.
20502 -- fma(x, y, z) returns a NaN and raises the ''invalid'' floating-point exception if x
20503 times y is an exact infinity and z is also an infinity but with the opposite sign.
20508 <sup><a name="note374" href="#note374"><b>374)</b></a></sup> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
20509 return +0; however, implementation in software might be impractical.
20511 [<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
20513 <a name="F.10.11" href="#F.10.11"><b> F.10.11 Comparison macros</b></a>
20514 1 Relational operators and their corresponding comparison macros (<a href="#7.12.14">7.12.14</a>) produce
20515 equivalent result values, even if argument values are represented in wider formats. Thus,
20516 comparison macro arguments represented in formats wider than their semantic types are
20517 not converted to the semantic types, unless the wide evaluation method converts operands
20518 of relational operators to their semantic types. The standard wide evaluation methods
20519 characterized by FLT_EVAL_METHOD equal to 1 or 2 (<a href="#5.2.4.2.2">5.2.4.2.2</a>), do not convert
20520 operands of relational operators to their semantic types.
20522 [<a name="p531" href="#p531">page 531</a>] (<a href="#Contents">Contents</a>)
20524 <a name="G" href="#G"><b> Annex G</b></a>
20525 (normative)
20526 IEC 60559-compatible complex arithmetic
20527 <a name="G.1" href="#G.1"><b> G.1 Introduction</b></a>
20528 1 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
20529 IEC 60559 real floating-point arithmetic. An implementation that defines
20530 __STDC_IEC_559_COMPLEX__ shall conform to the specifications in this annex.<sup><a href="#note375"><b>375)</b></a></sup>
20531 <a name="G.2" href="#G.2"><b> G.2 Types</b></a>
20532 1 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
20533 used as a type specifier within declaration specifiers in the same way as _Complex is
20534 (thus, _Imaginary float is a valid type name).
20535 2 There are three imaginary types, designated as float _Imaginary, double
20536 _Imaginary, and long double _Imaginary. The imaginary types (along with
20537 the real floating and complex types) are floating types.
20538 3 For imaginary types, the corresponding real type is given by deleting the keyword
20539 _Imaginary from the type name.
20540 4 Each imaginary type has the same representation and alignment requirements as the
20541 corresponding real type. The value of an object of imaginary type is the value of the real
20542 representation times the imaginary unit.
20543 5 The imaginary type domain comprises the imaginary types.
20544 <a name="G.3" href="#G.3"><b> G.3 Conventions</b></a>
20545 1 A complex or imaginary value with at least one infinite part is regarded as an infinity
20546 (even if its other part is a NaN). A complex or imaginary value is a finite number if each
20547 of its parts is a finite number (neither infinite nor NaN). A complex or imaginary value is
20548 a zero if each of its parts is a zero.
20553 <sup><a name="note375" href="#note375"><b>375)</b></a></sup> Implementations that do not define __STDC_IEC_559_COMPLEX__ are not required to conform
20554 to these specifications.
20556 [<a name="p532" href="#p532">page 532</a>] (<a href="#Contents">Contents</a>)
20558 <a name="G.4" href="#G.4"><b> G.4 Conversions</b></a>
20559 <a name="G.4.1" href="#G.4.1"><b> G.4.1 Imaginary types</b></a>
20560 1 Conversions among imaginary types follow rules analogous to those for real floating
20561 types.
20562 <a name="G.4.2" href="#G.4.2"><b> G.4.2 Real and imaginary</b></a>
20563 1 When a value of imaginary type is converted to a real type other than _Bool,<sup><a href="#note376"><b>376)</b></a></sup> the
20564 result is a positive zero.
20565 2 When a value of real type is converted to an imaginary type, the result is a positive
20566 imaginary zero.
20567 <a name="G.4.3" href="#G.4.3"><b> G.4.3 Imaginary and complex</b></a>
20568 1 When a value of imaginary type is converted to a complex type, the real part of the
20569 complex result value is a positive zero and the imaginary part of the complex result value
20570 is determined by the conversion rules for the corresponding real types.
20571 2 When a value of complex type is converted to an imaginary type, the real part of the
20572 complex value is discarded and the value of the imaginary part is converted according to
20573 the conversion rules for the corresponding real types.
20574 <a name="G.5" href="#G.5"><b> G.5 Binary operators</b></a>
20575 1 The following subclauses supplement <a href="#6.5">6.5</a> in order to specify the type of the result for an
20576 operation with an imaginary operand.
20577 2 For most operand types, the value of the result of a binary operator with an imaginary or
20578 complex operand is completely determined, with reference to real arithmetic, by the usual
20579 mathematical formula. For some operand types, the usual mathematical formula is
20580 problematic because of its treatment of infinities and because of undue overflow or
20581 underflow; in these cases the result satisfies certain properties (specified in <a href="#G.5.1">G.5.1</a>), but is
20582 not completely determined.
20587 <sup><a name="note376" href="#note376"><b>376)</b></a></sup> See <a href="#6.3.1.2">6.3.1.2</a>.
20589 [<a name="p533" href="#p533">page 533</a>] (<a href="#Contents">Contents</a>)
20591 <a name="G.5.1" href="#G.5.1"><b> G.5.1 Multiplicative operators</b></a>
20592 <b> Semantics</b>
20593 1 If one operand has real type and the other operand has imaginary type, then the result has
20594 imaginary type. If both operands have imaginary type, then the result has real type. (If
20595 either operand has complex type, then the result has complex type.)
20596 2 If the operands are not both complex, then the result and floating-point exception
20597 behavior of the * operator is defined by the usual mathematical formula:
20598 * u iv u + iv
20600 x xu i(xv) (xu) + i(xv)
20602 iy i(yu) -yv (-yv) + i(yu)
20604 x + iy (xu) + i(yu) (-yv) + i(xv)
20605 3 If the second operand is not complex, then the result and floating-point exception
20606 behavior of the / operator is defined by the usual mathematical formula:
20607 / u iv
20609 x x/u i(-x/v)
20611 iy i(y/u) y/v
20613 x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
20614 4 The * and / operators satisfy the following infinity properties for all real, imaginary, and
20615 complex operands:<sup><a href="#note377"><b>377)</b></a></sup>
20616 -- if one operand is an infinity and the other operand is a nonzero finite number or an
20617 infinity, then the result of the * operator is an infinity;
20618 -- if the first operand is an infinity and the second operand is a finite number, then the
20619 result of the / operator is an infinity;
20620 -- if the first operand is a finite number and the second operand is an infinity, then the
20621 result of the / operator is a zero;
20626 <sup><a name="note377" href="#note377"><b>377)</b></a></sup> These properties are already implied for those cases covered in the tables, but are required for all cases
20627 (at least where the state for CX_LIMITED_RANGE is ''off'').
20629 [<a name="p534" href="#p534">page 534</a>] (<a href="#Contents">Contents</a>)
20631 -- if the first operand is a nonzero finite number or an infinity and the second operand is
20632 a zero, then the result of the / operator is an infinity.
20633 5 If both operands of the * operator are complex or if the second operand of the / operator
20634 is complex, the operator raises floating-point exceptions if appropriate for the calculation
20635 of the parts of the result, and may raise spurious floating-point exceptions.
20636 6 EXAMPLE 1 Multiplication of double _Complex operands could be implemented as follows. Note
20637 that the imaginary unit I has imaginary type (see <a href="#G.6">G.6</a>).
20638 #include <a href="#7.12">&lt;math.h&gt;</a>
20639 #include <a href="#7.3">&lt;complex.h&gt;</a>
20640 /* Multiply z * w ... */
20641 double complex _Cmultd(double complex z, double complex w)
20643 #pragma STDC FP_CONTRACT OFF
20644 double a, b, c, d, ac, bd, ad, bc, x, y;
20645 a = creal(z); b = cimag(z);
20646 c = creal(w); d = cimag(w);
20647 ac = a * c; bd = b * d;
20648 ad = a * d; bc = b * c;
20649 x = ac - bd; y = ad + bc;
20650 if (isnan(x) &amp;&amp; isnan(y)) {
20651 /* Recover infinities that computed as NaN+iNaN ... */
20652 int recalc = 0;
20653 if (isinf(a) || isinf(b)) { // z is infinite
20654 /* "Box" the infinity and change NaNs in the other factor to 0 */
20655 a = copysign(isinf(a) ? 1.0 : 0.0, a);
20656 b = copysign(isinf(b) ? 1.0 : 0.0, b);
20657 if (isnan(c)) c = copysign(0.0, c);
20658 if (isnan(d)) d = copysign(0.0, d);
20659 recalc = 1;
20661 if (isinf(c) || isinf(d)) { // w is infinite
20662 /* "Box" the infinity and change NaNs in the other factor to 0 */
20663 c = copysign(isinf(c) ? 1.0 : 0.0, c);
20664 d = copysign(isinf(d) ? 1.0 : 0.0, d);
20665 if (isnan(a)) a = copysign(0.0, a);
20666 if (isnan(b)) b = copysign(0.0, b);
20667 recalc = 1;
20669 if (!recalc &amp;&amp; (isinf(ac) || isinf(bd) ||
20670 isinf(ad) || isinf(bc))) {
20671 /* Recover infinities from overflow by changing NaNs to 0 ... */
20672 if (isnan(a)) a = copysign(0.0, a);
20673 if (isnan(b)) b = copysign(0.0, b);
20674 if (isnan(c)) c = copysign(0.0, c);
20675 if (isnan(d)) d = copysign(0.0, d);
20676 recalc = 1;
20678 if (recalc) {
20680 [<a name="p535" href="#p535">page 535</a>] (<a href="#Contents">Contents</a>)
20682 x = INFINITY * ( a * c - b * d );
20683 y = INFINITY * ( a * d + b * c );
20686 return x + I * y;
20688 7 This implementation achieves the required treatment of infinities at the cost of only one isnan test in
20689 ordinary (finite) cases. It is less than ideal in that undue overflow and underflow may occur.
20691 8 EXAMPLE 2 Division of two double _Complex operands could be implemented as follows.
20692 #include <a href="#7.12">&lt;math.h&gt;</a>
20693 #include <a href="#7.3">&lt;complex.h&gt;</a>
20694 /* Divide z / w ... */
20695 double complex _Cdivd(double complex z, double complex w)
20697 #pragma STDC FP_CONTRACT OFF
20698 double a, b, c, d, logbw, denom, x, y;
20699 int ilogbw = 0;
20700 a = creal(z); b = cimag(z);
20701 c = creal(w); d = cimag(w);
20702 logbw = logb(fmax(fabs(c), fabs(d)));
20703 if (isfinite(logbw)) {
20704 ilogbw = (int)logbw;
20705 c = scalbn(c, -ilogbw); d = scalbn(d, -ilogbw);
20707 denom = c * c + d * d;
20708 x = scalbn((a * c + b * d) / denom, -ilogbw);
20709 y = scalbn((b * c - a * d) / denom, -ilogbw);
20710 /* Recover infinities and zeros that computed as NaN+iNaN; */
20711 /* the only cases are nonzero/zero, infinite/finite, and finite/infinite, ... */
20712 if (isnan(x) &amp;&amp; isnan(y)) {
20713 if ((denom == 0.0) &amp;&amp;
20714 (!isnan(a) || !isnan(b))) {
20715 x = copysign(INFINITY, c) * a;
20716 y = copysign(INFINITY, c) * b;
20718 else if ((isinf(a) || isinf(b)) &amp;&amp;
20719 isfinite(c) &amp;&amp; isfinite(d)) {
20720 a = copysign(isinf(a) ? 1.0 : 0.0, a);
20721 b = copysign(isinf(b) ? 1.0 : 0.0, b);
20722 x = INFINITY * ( a * c + b * d );
20723 y = INFINITY * ( b * c - a * d );
20725 else if ((logbw == INFINITY) &amp;&amp;
20726 isfinite(a) &amp;&amp; isfinite(b)) {
20727 c = copysign(isinf(c) ? 1.0 : 0.0, c);
20728 d = copysign(isinf(d) ? 1.0 : 0.0, d);
20729 x = 0.0 * ( a * c + b * d );
20730 y = 0.0 * ( b * c - a * d );
20732 [<a name="p536" href="#p536">page 536</a>] (<a href="#Contents">Contents</a>)
20736 return x + I * y;
20738 9 Scaling the denominator alleviates the main overflow and underflow problem, which is more serious than
20739 for multiplication. In the spirit of the multiplication example above, this code does not defend against
20740 overflow and underflow in the calculation of the numerator. Scaling with the scalbn function, instead of
20741 with division, provides better roundoff characteristics.
20743 <a name="G.5.2" href="#G.5.2"><b> G.5.2 Additive operators</b></a>
20744 <b> Semantics</b>
20745 1 If both operands have imaginary type, then the result has imaginary type. (If one operand
20746 has real type and the other operand has imaginary type, or if either operand has complex
20747 type, then the result has complex type.)
20748 2 In all cases the result and floating-point exception behavior of a + or - operator is defined
20749 by the usual mathematical formula:
20750 + or - u iv u + iv
20752 x x(+-)u x (+-) iv (x (+-) u) (+-) iv
20754 iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
20756 x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
20757 <a name="G.6" href="#G.6"><b> G.6 Complex arithmetic &lt;complex.h&gt;</b></a>
20758 1 The macros
20759 imaginary
20761 _Imaginary_I
20762 are defined, respectively, as _Imaginary and a constant expression of type const
20763 float _Imaginary with the value of the imaginary unit. The macro
20765 is defined to be _Imaginary_I (not _Complex_I as stated in <a href="#7.3">7.3</a>). Notwithstanding
20766 the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and then perhaps redefine the macro
20767 imaginary.
20768 2 This subclause contains specifications for the <a href="#7.3">&lt;complex.h&gt;</a> functions that are
20769 particularly suited to IEC 60559 implementations. For families of functions, the
20770 specifications apply to all of the functions even though only the principal function is
20772 [<a name="p537" href="#p537">page 537</a>] (<a href="#Contents">Contents</a>)
20774 shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
20775 and the result, the result has the same sign as the argument.
20776 3 The functions are continuous onto both sides of their branch cuts, taking into account the
20777 sign of zero. For example, csqrt(-2 (+-) i0) = (+-)i(sqrt)2. -
20778 4 Since complex and imaginary values are composed of real values, each function may be
20779 regarded as computing real values from real values. Except as noted, the functions treat
20780 real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
20781 manner consistent with the specifications for real functions in F.10.<sup><a href="#note378"><b>378)</b></a></sup>
20782 5 The functions cimag, conj, cproj, and creal are fully specified for all
20783 implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
20784 point exceptions.
20785 6 Each of the functions cabs and carg is specified by a formula in terms of a real
20786 function (whose special cases are covered in <a href="#F">annex F</a>):
20787 cabs(x + iy) = hypot(x, y)
20788 carg(x + iy) = atan2(y, x)
20789 7 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by
20790 a formula in terms of other complex functions (whose special cases are specified below):
20791 casin(z) = -i casinh(iz)
20792 catan(z) = -i catanh(iz)
20793 ccos(z) = ccosh(iz)
20794 csin(z) = -i csinh(iz)
20795 ctan(z) = -i ctanh(iz)
20796 8 For the other functions, the following subclauses specify behavior for special cases,
20797 including treatment of the ''invalid'' and ''divide-by-zero'' floating-point exceptions. For
20798 families of functions, the specifications apply to all of the functions even though only the
20799 principal function is shown. For a function f satisfying f (conj(z)) = conj( f (z)), the
20800 specifications for the upper half-plane imply the specifications for the lower half-plane; if
20801 the function f is also either even, f (-z) = f (z), or odd, f (-z) = - f (z), then the
20802 specifications for the first quadrant imply the specifications for the other three quadrants.
20803 9 In the following subclauses, cis(y) is defined as cos(y) + i sin(y).
20808 <sup><a name="note378" href="#note378"><b>378)</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
20809 other part is a NaN.
20811 [<a name="p538" href="#p538">page 538</a>] (<a href="#Contents">Contents</a>)
20813 <a name="G.6.1" href="#G.6.1"><b> G.6.1 Trigonometric functions</b></a>
20814 <a name="G.6.1.1" href="#G.6.1.1"><b> G.6.1.1 The cacos functions</b></a>
20815 1 -- cacos(conj(z)) = conj(cacos(z)).
20816 -- cacos((+-)0 + i0) returns pi /2 - i0.
20817 -- cacos((+-)0 + iNaN) returns pi /2 + iNaN.
20818 -- cacos(x + i (inf)) returns pi /2 - i (inf), for finite x.
20819 -- cacos(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20820 point exception, for nonzero finite x.
20821 -- cacos(-(inf) + iy) returns pi - i (inf), for positive-signed finite y.
20822 -- cacos(+(inf) + iy) returns +0 - i (inf), for positive-signed finite y.
20823 -- cacos(-(inf) + i (inf)) returns 3pi /4 - i (inf).
20824 -- cacos(+(inf) + i (inf)) returns pi /4 - i (inf).
20825 -- cacos((+-)(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
20826 result is unspecified).
20827 -- cacos(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20828 point exception, for finite y.
20829 -- cacos(NaN + i (inf)) returns NaN - i (inf).
20830 -- cacos(NaN + iNaN) returns NaN + iNaN.
20831 <a name="G.6.2" href="#G.6.2"><b> G.6.2 Hyperbolic functions</b></a>
20832 <a name="G.6.2.1" href="#G.6.2.1"><b> G.6.2.1 The cacosh functions</b></a>
20833 1 -- cacosh(conj(z)) = conj(cacosh(z)).
20834 -- cacosh((+-)0 + i0) returns +0 + ipi /2.
20835 -- cacosh(x + i (inf)) returns +(inf) + ipi /2, for finite x.
20836 -- cacosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
20837 floating-point exception, for finite x.
20838 -- cacosh(-(inf) + iy) returns +(inf) + ipi , for positive-signed finite y.
20839 -- cacosh(+(inf) + iy) returns +(inf) + i0, for positive-signed finite y.
20840 -- cacosh(-(inf) + i (inf)) returns +(inf) + i3pi /4.
20841 -- cacosh(+(inf) + i (inf)) returns +(inf) + ipi /4.
20842 -- cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
20844 [<a name="p539" href="#p539">page 539</a>] (<a href="#Contents">Contents</a>)
20846 -- cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
20847 floating-point exception, for finite y.
20848 -- cacosh(NaN + i (inf)) returns +(inf) + iNaN.
20849 -- cacosh(NaN + iNaN) returns NaN + iNaN.
20850 <a name="G.6.2.2" href="#G.6.2.2"><b> G.6.2.2 The casinh functions</b></a>
20851 1 -- casinh(conj(z)) = conj(casinh(z)) and casinh is odd.
20852 -- casinh(+0 + i0) returns 0 + i0.
20853 -- casinh(x + i (inf)) returns +(inf) + ipi /2 for positive-signed finite x.
20854 -- casinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
20855 floating-point exception, for finite x.
20856 -- casinh(+(inf) + iy) returns +(inf) + i0 for positive-signed finite y.
20857 -- casinh(+(inf) + i (inf)) returns +(inf) + ipi /4.
20858 -- casinh(+(inf) + iNaN) returns +(inf) + iNaN.
20859 -- casinh(NaN + i0) returns NaN + i0.
20860 -- casinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
20861 floating-point exception, for finite nonzero y.
20862 -- casinh(NaN + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result
20863 is unspecified).
20864 -- casinh(NaN + iNaN) returns NaN + iNaN.
20865 <a name="G.6.2.3" href="#G.6.2.3"><b> G.6.2.3 The catanh functions</b></a>
20866 1 -- catanh(conj(z)) = conj(catanh(z)) and catanh is odd.
20867 -- catanh(+0 + i0) returns +0 + i0.
20868 -- catanh(+0 + iNaN) returns +0 + iNaN.
20869 -- catanh(+1 + i0) returns +(inf) + i0 and raises the ''divide-by-zero'' floating-point
20870 exception.
20871 -- catanh(x + i (inf)) returns +0 + ipi /2, for finite positive-signed x.
20872 -- catanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid''
20873 floating-point exception, for nonzero finite x.
20874 -- catanh(+(inf) + iy) returns +0 + ipi /2, for finite positive-signed y.
20875 -- catanh(+(inf) + i (inf)) returns +0 + ipi /2.
20876 -- catanh(+(inf) + iNaN) returns +0 + iNaN.
20878 [<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
20880 -- catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
20881 floating-point exception, for finite y.
20882 -- catanh(NaN + i (inf)) returns (+-)0 + ipi /2 (where the sign of the real part of the result is
20883 unspecified).
20884 -- catanh(NaN + iNaN) returns NaN + iNaN.
20885 <a name="G.6.2.4" href="#G.6.2.4"><b> G.6.2.4 The ccosh functions</b></a>
20886 1 -- ccosh(conj(z)) = conj(ccosh(z)) and ccosh is even.
20887 -- ccosh(+0 + i0) returns 1 + i0.
20888 -- ccosh(+0 + i (inf)) returns NaN (+-) i0 (where the sign of the imaginary part of the
20889 result is unspecified) and raises the ''invalid'' floating-point exception.
20890 -- ccosh(+0 + iNaN) returns NaN (+-) i0 (where the sign of the imaginary part of the
20891 result is unspecified).
20892 -- ccosh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
20893 exception, for finite nonzero x.
20894 -- ccosh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20895 point exception, for finite nonzero x.
20896 -- ccosh(+(inf) + i0) returns +(inf) + i0.
20897 -- ccosh(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
20898 -- ccosh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
20899 unspecified) and raises the ''invalid'' floating-point exception.
20900 -- ccosh(+(inf) + iNaN) returns +(inf) + iNaN.
20901 -- ccosh(NaN + i0) returns NaN (+-) i0 (where the sign of the imaginary part of the
20902 result is unspecified).
20903 -- ccosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20904 point exception, for all nonzero numbers y.
20905 -- ccosh(NaN + iNaN) returns NaN + iNaN.
20906 <a name="G.6.2.5" href="#G.6.2.5"><b> G.6.2.5 The csinh functions</b></a>
20907 1 -- csinh(conj(z)) = conj(csinh(z)) and csinh is odd.
20908 -- csinh(+0 + i0) returns +0 + i0.
20909 -- csinh(+0 + i (inf)) returns (+-)0 + iNaN (where the sign of the real part of the result is
20910 unspecified) and raises the ''invalid'' floating-point exception.
20911 -- csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
20912 unspecified).
20914 [<a name="p541" href="#p541">page 541</a>] (<a href="#Contents">Contents</a>)
20916 -- csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
20917 exception, for positive finite x.
20918 -- csinh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20919 point exception, for finite nonzero x.
20920 -- csinh(+(inf) + i0) returns +(inf) + i0.
20921 -- csinh(+(inf) + iy) returns +(inf) cis(y), for positive finite y.
20922 -- csinh(+(inf) + i (inf)) returns (+-)(inf) + iNaN (where the sign of the real part of the result is
20923 unspecified) and raises the ''invalid'' floating-point exception.
20924 -- csinh(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
20925 is unspecified).
20926 -- csinh(NaN + i0) returns NaN + i0.
20927 -- csinh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20928 point exception, for all nonzero numbers y.
20929 -- csinh(NaN + iNaN) returns NaN + iNaN.
20930 <a name="G.6.2.6" href="#G.6.2.6"><b> G.6.2.6 The ctanh functions</b></a>
20931 1 -- ctanh(conj(z)) = conj(ctanh(z))and ctanh is odd.
20932 -- ctanh(+0 + i0) returns +0 + i0.
20933 -- ctanh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
20934 exception, for finite x.
20935 -- ctanh(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20936 point exception, for finite x.
20937 -- ctanh(+(inf) + iy) returns 1 + i0 sin(2y), for positive-signed finite y.
20938 -- ctanh(+(inf) + i (inf)) returns 1 (+-) i0 (where the sign of the imaginary part of the result
20939 is unspecified).
20940 -- ctanh(+(inf) + iNaN) returns 1 (+-) i0 (where the sign of the imaginary part of the
20941 result is unspecified).
20942 -- ctanh(NaN + i0) returns NaN + i0.
20943 -- ctanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20944 point exception, for all nonzero numbers y.
20945 -- ctanh(NaN + iNaN) returns NaN + iNaN.
20947 [<a name="p542" href="#p542">page 542</a>] (<a href="#Contents">Contents</a>)
20949 <a name="G.6.3" href="#G.6.3"><b> G.6.3 Exponential and logarithmic functions</b></a>
20950 <a name="G.6.3.1" href="#G.6.3.1"><b> G.6.3.1 The cexp functions</b></a>
20951 1 -- cexp(conj(z)) = conj(cexp(z)).
20952 -- cexp((+-)0 + i0) returns 1 + i0.
20953 -- cexp(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
20954 exception, for finite x.
20955 -- cexp(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20956 point exception, for finite x.
20957 -- cexp(+(inf) + i0) returns +(inf) + i0.
20958 -- cexp(-(inf) + iy) returns +0 cis(y), for finite y.
20959 -- cexp(+(inf) + iy) returns +(inf) cis(y), for finite nonzero y.
20960 -- cexp(-(inf) + i (inf)) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts of
20961 the result are unspecified).
20962 -- cexp(+(inf) + i (inf)) returns (+-)(inf) + iNaN and raises the ''invalid'' floating-point
20963 exception (where the sign of the real part of the result is unspecified).
20964 -- cexp(-(inf) + iNaN) returns (+-)0 (+-) i0 (where the signs of the real and imaginary parts
20965 of the result are unspecified).
20966 -- cexp(+(inf) + iNaN) returns (+-)(inf) + iNaN (where the sign of the real part of the result
20967 is unspecified).
20968 -- cexp(NaN + i0) returns NaN + i0.
20969 -- cexp(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20970 point exception, for all nonzero numbers y.
20971 -- cexp(NaN + iNaN) returns NaN + iNaN.
20972 <a name="G.6.3.2" href="#G.6.3.2"><b> G.6.3.2 The clog functions</b></a>
20973 1 -- clog(conj(z)) = conj(clog(z)).
20974 -- clog(-0 + i0) returns -(inf) + ipi and raises the ''divide-by-zero'' floating-point
20975 exception.
20976 -- clog(+0 + i0) returns -(inf) + i0 and raises the ''divide-by-zero'' floating-point
20977 exception.
20978 -- clog(x + i (inf)) returns +(inf) + ipi /2, for finite x.
20979 -- clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20980 point exception, for finite x.
20982 [<a name="p543" href="#p543">page 543</a>] (<a href="#Contents">Contents</a>)
20984 -- clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
20985 -- clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
20986 -- clog(-(inf) + i (inf)) returns +(inf) + i3pi /4.
20987 -- clog(+(inf) + i (inf)) returns +(inf) + ipi /4.
20988 -- clog((+-)(inf) + iNaN) returns +(inf) + iNaN.
20989 -- clog(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
20990 point exception, for finite y.
20991 -- clog(NaN + i (inf)) returns +(inf) + iNaN.
20992 -- clog(NaN + iNaN) returns NaN + iNaN.
20993 <a name="G.6.4" href="#G.6.4"><b> G.6.4 Power and absolute-value functions</b></a>
20994 <a name="G.6.4.1" href="#G.6.4.1"><b> G.6.4.1 The cpow functions</b></a>
20995 1 The cpow functions raise floating-point exceptions if appropriate for the calculation of
20996 the parts of the result, and may also raise spurious floating-point exceptions.<sup><a href="#note379"><b>379)</b></a></sup>
20997 <a name="G.6.4.2" href="#G.6.4.2"><b> G.6.4.2 The csqrt functions</b></a>
20998 1 -- csqrt(conj(z)) = conj(csqrt(z)).
20999 -- csqrt((+-)0 + i0) returns +0 + i0.
21000 -- csqrt(x + i (inf)) returns +(inf) + i (inf), for all x (including NaN).
21001 -- csqrt(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
21002 point exception, for finite x.
21003 -- csqrt(-(inf) + iy) returns +0 + i (inf), for finite positive-signed y.
21004 -- csqrt(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
21005 -- csqrt(-(inf) + iNaN) returns NaN (+-) i (inf) (where the sign of the imaginary part of the
21006 result is unspecified).
21007 -- csqrt(+(inf) + iNaN) returns +(inf) + iNaN.
21008 -- csqrt(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-
21009 point exception, for finite y.
21010 -- csqrt(NaN + iNaN) returns NaN + iNaN.
21015 <sup><a name="note379" href="#note379"><b>379)</b></a></sup> This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
21016 implementations that treat special cases more carefully.
21018 [<a name="p544" href="#p544">page 544</a>] (<a href="#Contents">Contents</a>)
21020 <a name="G.7" href="#G.7"><b> G.7 Type-generic math &lt;tgmath.h&gt;</b></a>
21021 1 Type-generic macros that accept complex arguments also accept imaginary arguments. If
21022 an argument is imaginary, the macro expands to an expression whose type is real,
21023 imaginary, or complex, as appropriate for the particular function: if the argument is
21024 imaginary, then the types of cos, cosh, fabs, carg, cimag, and creal are real; the
21025 types of sin, tan, sinh, tanh, asin, atan, asinh, and atanh are imaginary; and
21026 the types of the others are complex.
21027 2 Given an imaginary argument, each of the type-generic macros cos, sin, tan, cosh,
21028 sinh, tanh, asin, atan, asinh, atanh is specified by a formula in terms of real
21029 functions:
21030 cos(iy) = cosh(y)
21031 sin(iy) = i sinh(y)
21032 tan(iy) = i tanh(y)
21033 cosh(iy) = cos(y)
21034 sinh(iy) = i sin(y)
21035 tanh(iy) = i tan(y)
21036 asin(iy) = i asinh(y)
21037 atan(iy) = i atanh(y)
21038 asinh(iy) = i asin(y)
21039 atanh(iy) = i atan(y)
21041 [<a name="p545" href="#p545">page 545</a>] (<a href="#Contents">Contents</a>)
21043 <a name="H" href="#H"><b> Annex H</b></a>
21044 (informative)
21045 Language independent arithmetic
21046 <a name="H.1" href="#H.1"><b> H.1 Introduction</b></a>
21047 1 This annex documents the extent to which the C language supports the ISO/IEC 10967-1
21048 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than
21049 IEC 60559 (<a href="#F">annex F</a>) in that it covers integer and diverse floating-point arithmetics.
21050 <a name="H.2" href="#H.2"><b> H.2 Types</b></a>
21051 1 The relevant C arithmetic types meet the requirements of LIA-1 types if an
21052 implementation adds notification of exceptional arithmetic operations and meets the 1
21053 unit in the last place (ULP) accuracy requirement (LIA-1 subclause <a href="#5.2.8">5.2.8</a>).
21054 <a name="H.2.1" href="#H.2.1"><b> H.2.1 Boolean type</b></a>
21055 1 The LIA-1 data type Boolean is implemented by the C data type bool with values of
21056 true and false, all from <a href="#7.18">&lt;stdbool.h&gt;</a>.
21057 <a name="H.2.2" href="#H.2.2"><b> H.2.2 Integer types</b></a>
21058 1 The signed C integer types int, long int, long long int, and the corresponding
21059 unsigned types are compatible with LIA-1. If an implementation adds support for the
21060 LIA-1 exceptional values ''integer_overflow'' and ''undefined'', then those types are
21061 LIA-1 conformant types. C's unsigned integer types are ''modulo'' in the LIA-1 sense
21062 in that overflows or out-of-bounds results silently wrap. An implementation that defines
21063 signed integer types as also being modulo need not detect integer overflow, in which case,
21064 only integer divide-by-zero need be detected.
21065 2 The parameters for the integer data types can be accessed by the following:
21066 maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
21067 ULLONG_MAX
21068 minint INT_MIN, LONG_MIN, LLONG_MIN
21069 3 The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
21070 is always 0 for the unsigned types, and is not provided for those types.
21072 [<a name="p546" href="#p546">page 546</a>] (<a href="#Contents">Contents</a>)
21074 <a name="H.2.2.1" href="#H.2.2.1"><b> H.2.2.1 Integer operations</b></a>
21075 1 The integer operations on integer types are the following:
21076 addI x + y
21077 subI x - y
21078 mulI x * y
21079 divI, divtI x / y
21080 remI, remtI x % y
21081 negI -x
21082 absI abs(x), labs(x), llabs(x)
21083 eqI x == y
21084 neqI x != y
21085 lssI x &lt; y
21086 leqI x &lt;= y
21087 gtrI x &gt; y
21088 geqI x &gt;= y
21089 where x and y are expressions of the same integer type.
21090 <a name="H.2.3" href="#H.2.3"><b> H.2.3 Floating-point types</b></a>
21091 1 The C floating-point types float, double, and long double are compatible with
21092 LIA-1. If an implementation adds support for the LIA-1 exceptional values
21093 ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant
21094 with LIA-1. An implementation that uses IEC 60559 floating-point formats and
21095 operations (see <a href="#F">annex F</a>) along with IEC 60559 status flags and traps has LIA-1
21096 conformant types.
21097 <a name="H.2.3.1" href="#H.2.3.1"><b> H.2.3.1 Floating-point parameters</b></a>
21098 1 The parameters for a floating point data type can be accessed by the following:
21099 r FLT_RADIX
21100 p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
21101 emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
21102 emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
21103 2 The derived constants for the floating point types are accessed by the following:
21105 [<a name="p547" href="#p547">page 547</a>] (<a href="#Contents">Contents</a>)
21107 fmax FLT_MAX, DBL_MAX, LDBL_MAX
21108 fminN FLT_MIN, DBL_MIN, LDBL_MIN
21109 epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
21110 rnd_style FLT_ROUNDS
21111 <a name="H.2.3.2" href="#H.2.3.2"><b> H.2.3.2 Floating-point operations</b></a>
21112 1 The floating-point operations on floating-point types are the following:
21113 addF x + y
21114 subF x - y
21115 mulF x * y
21116 divF x / y
21117 negF -x
21118 absF fabsf(x), fabs(x), fabsl(x)
21119 exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
21120 scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
21121 scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
21122 intpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
21123 fractpartF modff(x, &amp;y), modf(x, &amp;y), modfl(x, &amp;y)
21124 eqF x == y
21125 neqF x != y
21126 lssF x &lt; y
21127 leqF x &lt;= y
21128 gtrF x &gt; y
21129 geqF x &gt;= y
21130 where x and y are expressions of the same floating point type, n is of type int, and li
21131 is of type long int.
21132 <a name="H.2.3.3" href="#H.2.3.3"><b> H.2.3.3 Rounding styles</b></a>
21133 1 The C Standard requires all floating types to use the same radix and rounding style, so
21134 that only one identifier for each is provided to map to LIA-1.
21135 2 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
21136 truncate FLT_ROUNDS == 0
21138 [<a name="p548" href="#p548">page 548</a>] (<a href="#Contents">Contents</a>)
21140 nearest FLT_ROUNDS == 1
21141 other FLT_ROUNDS != 0 &amp;&amp; FLT_ROUNDS != 1
21142 provided that an implementation extends FLT_ROUNDS to cover the rounding style used
21143 in all relevant LIA-1 operations, not just addition as in C.
21144 <a name="H.2.4" href="#H.2.4"><b> H.2.4 Type conversions</b></a>
21145 1 The LIA-1 type conversions are the following type casts:
21146 cvtI' -&gt; I (int)i, (long int)i, (long long int)i,
21147 (unsigned int)i, (unsigned long int)i,
21148 (unsigned long long int)i
21149 cvtF -&gt; I (int)x, (long int)x, (long long int)x,
21150 (unsigned int)x, (unsigned long int)x,
21151 (unsigned long long int)x
21152 cvtI -&gt; F (float)i, (double)i, (long double)i
21153 cvtF' -&gt; F (float)x, (double)x, (long double)x
21154 2 In the above conversions from floating to integer, the use of (cast)x can be replaced with
21155 (cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
21156 (cast)ceil(x), or (cast)floor(x). In addition, C's floating-point to integer
21157 conversion functions, lrint(), llrint(), lround(), and llround(), can be
21158 used. They all meet LIA-1's requirements on floating to integer rounding for in-range
21159 values. For out-of-range values, the conversions shall silently wrap for the modulo types.
21160 3 The fmod() function is useful for doing silent wrapping to unsigned integer types, e.g.,
21161 fmod( fabs(rint(x)), 65536.0 ) or (0.0 &lt;= (y = fmod( rint(x),
21162 65536.0 )) ? y : 65536.0 + y) will compute an integer value in the range 0.0
21163 to 65535.0 which can then be cast to unsigned short int. But, the
21164 remainder() function is not useful for doing silent wrapping to signed integer types,
21165 e.g., remainder( rint(x), 65536.0 ) will compute an integer value in the
21166 range -32767.0 to +32768.0 which is not, in general, in the range of signed short
21167 int.
21168 4 C's conversions (casts) from floating-point to floating-point can meet LIA-1
21169 requirements if an implementation uses round-to-nearest (IEC 60559 default).
21170 5 C's conversions (casts) from integer to floating-point can meet LIA-1 requirements if an
21171 implementation uses round-to-nearest.
21173 [<a name="p549" href="#p549">page 549</a>] (<a href="#Contents">Contents</a>)
21175 <a name="H.3" href="#H.3"><b> H.3 Notification</b></a>
21176 1 Notification is the process by which a user or program is informed that an exceptional
21177 arithmetic operation has occurred. C's operations are compatible with LIA-1 in that C
21178 allows an implementation to cause a notification to occur when any arithmetic operation
21179 returns an exceptional value as defined in LIA-1 clause 5.
21180 <a name="H.3.1" href="#H.3.1"><b> H.3.1 Notification alternatives</b></a>
21181 1 LIA-1 requires at least the following two alternatives for handling of notifications:
21182 setting indicators or trap-and-terminate. LIA-1 allows a third alternative: trap-and-
21183 resume.
21184 2 An implementation need only support a given notification alternative for the entire
21185 program. An implementation may support the ability to switch between notification
21186 alternatives during execution, but is not required to do so. An implementation can
21187 provide separate selection for each kind of notification, but this is not required.
21188 3 C allows an implementation to provide notification. C's SIGFPE (for traps) and
21189 FE_INVALID, FE_DIVBYZERO, FE_OVERFLOW, FE_UNDERFLOW (for indicators)
21190 can provide LIA-1 notification.
21191 4 C's signal handlers are compatible with LIA-1. Default handling of SIGFPE can
21192 provide trap-and-terminate behavior, except for those LIA-1 operations implemented by
21193 math library function calls. User-provided signal handlers for SIGFPE allow for trap-
21194 and-resume behavior with the same constraint.
21195 <a name="H.3.1.1" href="#H.3.1.1"><b> H.3.1.1 Indicators</b></a>
21196 1 C's <a href="#7.6">&lt;fenv.h&gt;</a> status flags are compatible with the LIA-1 indicators.
21197 2 The following mapping is for floating-point types:
21198 undefined FE_INVALID, FE_DIVBYZERO
21199 floating_overflow FE_OVERFLOW
21200 underflow FE_UNDERFLOW
21201 3 The floating-point indicator interrogation and manipulation operations are:
21202 set_indicators feraiseexcept(i)
21203 clear_indicators feclearexcept(i)
21204 test_indicators fetestexcept(i)
21205 current_indicators fetestexcept(FE_ALL_EXCEPT)
21206 where i is an expression of type int representing a subset of the LIA-1 indicators.
21207 4 C allows an implementation to provide the following LIA-1 required behavior: at
21208 program termination if any indicator is set the implementation shall send an unambiguous
21210 [<a name="p550" href="#p550">page 550</a>] (<a href="#Contents">Contents</a>)
21212 and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
21213 5 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
21214 This documentation makes that distinction because <a href="#7.6">&lt;fenv.h&gt;</a> covers only the floating-
21215 point indicators.
21216 <a name="H.3.1.2" href="#H.3.1.2"><b> H.3.1.2 Traps</b></a>
21217 1 C is compatible with LIA-1's trap requirements for arithmetic operations, but not for
21218 math library functions (which are not permitted to invoke a user's signal handler for
21219 SIGFPE). An implementation can provide an alternative of notification through
21220 termination with a ''hard-to-ignore'' message (see LIA-1 subclause <a href="#6.1.3">6.1.3</a>).
21221 2 LIA-1 does not require that traps be precise.
21222 3 C does require that SIGFPE be the signal corresponding to LIA-1 arithmetic exceptions,
21223 if there is any signal raised for them.
21224 4 C supports signal handlers for SIGFPE and allows trapping of LIA-1 arithmetic
21225 exceptions. When LIA-1 arithmetic exceptions do trap, C's signal-handler mechanism
21226 allows trap-and-terminate (either default implementation behavior or user replacement for
21227 it) or trap-and-resume, at the programmer's option.
21229 [<a name="p551" href="#p551">page 551</a>] (<a href="#Contents">Contents</a>)
21231 <a name="I" href="#I"><b> Annex I</b></a>
21232 (informative)
21233 Common warnings
21234 1 An implementation may generate warnings in many situations, none of which are
21235 specified as part of this International Standard. The following are a few of the more
21236 common situations.
21237 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>).
21238 -- A block with initialization of an object that has automatic storage duration is jumped
21239 into (<a href="#6.2.4">6.2.4</a>).
21240 -- An implicit narrowing conversion is encountered, such as the assignment of a long
21241 int or a double to an int, or a pointer to void to a pointer to any type other than
21242 a character type (<a href="#6.3">6.3</a>).
21243 -- A hexadecimal floating constant cannot be represented exactly in its evaluation format
21244 (<a href="#6.4.4.2">6.4.4.2</a>).
21245 -- An integer character constant includes more than one character or a wide character
21246 constant includes more than one multibyte character (<a href="#6.4.4.4">6.4.4.4</a>).
21247 -- The characters /* are found in a comment (<a href="#6.4.7">6.4.7</a>).
21248 -- An ''unordered'' binary operator (not comma, &amp;&amp;, or ||) contains a side effect to an
21249 lvalue in one operand, and a side effect to, or an access to the value of, the identical
21250 lvalue in the other operand (<a href="#6.5">6.5</a>).
21251 -- A function is called but no prototype has been supplied (<a href="#6.5.2.2">6.5.2.2</a>).
21252 -- The arguments in a function call do not agree in number and type with those of the
21253 parameters in a function definition that is not a prototype (<a href="#6.5.2.2">6.5.2.2</a>).
21254 -- An object is defined but not used (<a href="#6.7">6.7</a>).
21255 -- A value is given to an object of an enumerated type other than by assignment of an
21256 enumeration constant that is a member of that type, or an enumeration object that has
21257 the same type, or the value of a function that returns the same enumerated type
21258 (<a href="#6.7.2.2">6.7.2.2</a>).
21259 -- An aggregate has a partly bracketed initialization (<a href="#6.7.8">6.7.8</a>).
21260 -- A statement cannot be reached (<a href="#6.8">6.8</a>).
21261 -- A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
21262 -- A constant expression is used as the controlling expression of a selection statement
21263 (<a href="#6.8.4">6.8.4</a>).
21265 [<a name="p552" href="#p552">page 552</a>] (<a href="#Contents">Contents</a>)
21267 -- An incorrectly formed preprocessing group is encountered while skipping a
21268 preprocessing group (<a href="#6.10.1">6.10.1</a>).
21269 -- An unrecognized #pragma directive is encountered (<a href="#6.10.6">6.10.6</a>).
21271 [<a name="p553" href="#p553">page 553</a>] (<a href="#Contents">Contents</a>)
21273 <a name="J" href="#J"><b> Annex J</b></a>
21274 (informative)
21275 Portability issues
21276 1 This annex collects some information about portability that appears in this International
21277 Standard.
21278 <a name="J.1" href="#J.1"><b> J.1 Unspecified behavior</b></a>
21279 1 The following are unspecified:
21280 -- The manner and timing of static initialization (<a href="#5.1.2">5.1.2</a>).
21281 -- The termination status returned to the hosted environment if the return type of main
21282 is not compatible with int (<a href="#5.1.2.2.3">5.1.2.2.3</a>).
21283 -- The values of objects that are neither lock-free atomic objects nor of type volatile
21284 sig_atomic_t and the state of the floating-point environment, when the
21285 processing of the abstract machine is interrupted by receipt of a signal (<a href="#5.1.2.3">5.1.2.3</a>).
21286 -- The behavior of the display device if a printing character is written when the active
21287 position is at the final position of a line (<a href="#5.2.2">5.2.2</a>).
21288 -- The behavior of the display device if a backspace character is written when the active
21289 position is at the initial position of a line (<a href="#5.2.2">5.2.2</a>).
21290 -- The behavior of the display device if a horizontal tab character is written when the
21291 active position is at or past the last defined horizontal tabulation position (<a href="#5.2.2">5.2.2</a>).
21292 -- The behavior of the display device if a vertical tab character is written when the active
21293 position is at or past the last defined vertical tabulation position (<a href="#5.2.2">5.2.2</a>).
21294 -- How an extended source character that does not correspond to a universal character
21295 name counts toward the significant initial characters in an external identifier (<a href="#5.2.4.1">5.2.4.1</a>).
21296 -- Many aspects of the representations of types (<a href="#6.2.6">6.2.6</a>).
21297 -- The value of padding bytes when storing values in structures or unions (<a href="#6.2.6.1">6.2.6.1</a>).
21298 -- The values of bytes that correspond to union members other than the one last stored
21299 into (<a href="#6.2.6.1">6.2.6.1</a>).
21300 -- The representation used when storing a value in an object that has more than one
21301 object representation for that value (<a href="#6.2.6.1">6.2.6.1</a>).
21302 -- The values of any padding bits in integer representations (<a href="#6.2.6.2">6.2.6.2</a>).
21303 -- Whether certain operators can generate negative zeros and whether a negative zero
21304 becomes a normal zero when stored in an object (<a href="#6.2.6.2">6.2.6.2</a>).
21306 [<a name="p554" href="#p554">page 554</a>] (<a href="#Contents">Contents</a>)
21308 -- Whether two string literals result in distinct arrays (<a href="#6.4.5">6.4.5</a>).
21309 -- The order in which subexpressions are evaluated and the order in which side effects
21310 take place, except as specified for the function-call (), &amp;&amp;, ||, ? :, and comma
21311 operators (<a href="#6.5">6.5</a>).
21312 -- The order in which the function designator, arguments, and subexpressions within the
21313 arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
21314 -- The order of side effects among compound literal initialization list expressions
21315 (<a href="#6.5.2.5">6.5.2.5</a>).
21316 -- The order in which the operands of an assignment operator are evaluated (<a href="#6.5.16">6.5.16</a>).
21317 -- The alignment of the addressable storage unit allocated to hold a bit-field (<a href="#6.7.2.1">6.7.2.1</a>).
21318 -- Whether a call to an inline function uses the inline definition or the external definition
21319 of the function (<a href="#6.7.4">6.7.4</a>).
21320 -- Whether or not a size expression is evaluated when it is part of the operand of a
21321 sizeof operator and changing the value of the size expression would not affect the
21322 result of the operator (<a href="#6.7.6.2">6.7.6.2</a>).
21323 -- The order in which any side effects occur among the initialization list expressions in
21324 an initializer (<a href="#6.7.9">6.7.9</a>).
21325 -- The layout of storage for function parameters (<a href="#6.9.1">6.9.1</a>).
21326 -- When a fully expanded macro replacement list contains a function-like macro name
21327 as its last preprocessing token and the next preprocessing token from the source file is
21328 a (, and the fully expanded replacement of that macro ends with the name of the first
21329 macro and the next preprocessing token from the source file is again a (, whether that
21330 is considered a nested replacement (<a href="#6.10.3">6.10.3</a>).
21331 -- The order in which # and ## operations are evaluated during macro substitution
21332 (<a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>).
21333 -- The state of the floating-point status flags when execution passes from a part of the
21334 program translated with FENV_ACCESS ''off'' to a part translated with
21335 FENV_ACCESS ''on'' (<a href="#7.6.1">7.6.1</a>).
21336 -- The order in which feraiseexcept raises floating-point exceptions, except as
21337 stated in <a href="#F.8.6">F.8.6</a> (<a href="#7.6.2.3">7.6.2.3</a>).
21338 -- Whether math_errhandling is a macro or an identifier with external linkage
21339 (<a href="#7.12">7.12</a>).
21340 -- The results of the frexp functions when the specified value is not a floating-point
21341 number (<a href="#7.12.6.4">7.12.6.4</a>).
21343 [<a name="p555" href="#p555">page 555</a>] (<a href="#Contents">Contents</a>)
21345 -- The numeric result of the ilogb functions when the correct value is outside the
21346 range of the return type (<a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.10.3.5">F.10.3.5</a>).
21347 -- The result of rounding when the value is out of range (<a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.5">F.10.6.5</a>).
21348 -- The value stored by the remquo functions in the object pointed to by quo when y is
21349 zero (<a href="#7.12.10.3">7.12.10.3</a>).
21350 -- Whether a comparison macro argument that is represented in a format wider than its
21351 semantic type is converted to the semantic type (<a href="#7.12.14">7.12.14</a>).
21352 -- Whether setjmp is a macro or an identifier with external linkage (<a href="#7.13">7.13</a>).
21353 -- Whether va_copy and va_end are macros or identifiers with external linkage
21354 (<a href="#7.16.1">7.16.1</a>).
21355 -- The hexadecimal digit before the decimal point when a non-normalized floating-point
21356 number is printed with an a or A conversion specifier (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21357 -- The value of the file position indicator after a successful call to the ungetc function
21358 for a text stream, or the ungetwc function for any stream, until all pushed-back
21359 characters are read or discarded (<a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.29.3.10">7.29.3.10</a>).
21360 -- The details of the value stored by the fgetpos function (<a href="#7.21.9.1">7.21.9.1</a>).
21361 -- The details of the value returned by the ftell function for a text stream (<a href="#7.21.9.4">7.21.9.4</a>).
21362 -- Whether the strtod, strtof, strtold, wcstod, wcstof, and wcstold
21363 functions convert a minus-signed sequence to a negative number directly or by
21364 negating the value resulting from converting the corresponding unsigned sequence
21365 (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
21366 -- The order and contiguity of storage allocated by successive calls to the calloc,
21367 malloc, and realloc functions (<a href="#7.22.3">7.22.3</a>).
21368 -- The amount of storage allocated by a successful call to the calloc, malloc, or
21369 realloc function when 0 bytes was requested (<a href="#7.22.3">7.22.3</a>).
21370 -- Whether a call to the atexit function that does not happen before the exit
21371 function is called will succeed (<a href="#7.22.4.2">7.22.4.2</a>).
21372 -- Whether a call to the at_quick_exit function that does not happen before the
21373 quick_exit function is called will succeed (<a href="#7.22.4.3">7.22.4.3</a>).
21374 -- Which of two elements that compare as equal is matched by the bsearch function
21375 (<a href="#7.22.5.1">7.22.5.1</a>).
21376 -- The order of two elements that compare as equal in an array sorted by the qsort
21377 function (<a href="#7.22.5.2">7.22.5.2</a>).
21379 [<a name="p556" href="#p556">page 556</a>] (<a href="#Contents">Contents</a>)
21381 -- The encoding of the calendar time returned by the time function (<a href="#7.27.2.4">7.27.2.4</a>).
21382 -- The characters stored by the strftime or wcsftime function if any of the time
21383 values being converted is outside the normal range (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
21384 -- Whether an encoding error occurs if a wchar_t value that does not correspond to a
21385 member of the extended character set appears in the format string for a function in
21386 <a href="#7.29.2">7.29.2</a> or <a href="#7.29.5">7.29.5</a> and the specified semantics do not require that value to be processed
21387 by wcrtomb (<a href="#7.29.1">7.29.1</a>).
21388 -- The conversion state after an encoding error occurs (<a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>,
21389 <a href="#7.29.6.4.2">7.29.6.4.2</a>,
21390 -- The resulting value when the ''invalid'' floating-point exception is raised during
21391 IEC 60559 floating to integer conversion (<a href="#F.4">F.4</a>).
21392 -- Whether conversion of non-integer IEC 60559 floating values to integer raises the
21393 ''inexact'' floating-point exception (<a href="#F.4">F.4</a>).
21394 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise the ''inexact'' floating-point
21395 exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
21396 -- Whether or when library functions in <a href="#7.12">&lt;math.h&gt;</a> raise an undeserved ''underflow''
21397 floating-point exception in an IEC 60559 conformant implementation (<a href="#F.10">F.10</a>).
21398 -- The exponent value stored by frexp for a NaN or infinity (<a href="#F.10.3.4">F.10.3.4</a>).
21399 -- The numeric result returned by the lrint, llrint, lround, and llround
21400 functions if the rounded value is outside the range of the return type (<a href="#F.10.6.5">F.10.6.5</a>,
21401 <a href="#F.10.6.7">F.10.6.7</a>).
21402 -- The sign of one part of the complex result of several math functions for certain
21403 special cases in IEC 60559 compatible implementations (<a href="#G.6.1.1">G.6.1.1</a>, <a href="#G.6.2.2">G.6.2.2</a>, <a href="#G.6.2.3">G.6.2.3</a>,
21404 <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>).
21405 <a name="J.2" href="#J.2"><b> J.2 Undefined behavior</b></a>
21406 1 The behavior is undefined in the following circumstances:
21407 -- A ''shall'' or ''shall not'' requirement that appears outside of a constraint is violated
21408 (clause 4).
21409 -- A nonempty source file does not end in a new-line character which is not immediately
21410 preceded by a backslash character or ends in a partial preprocessing token or
21411 comment (<a href="#5.1.1.2">5.1.1.2</a>).
21412 -- Token concatenation produces a character sequence matching the syntax of a
21413 universal character name (<a href="#5.1.1.2">5.1.1.2</a>).
21414 -- A program in a hosted environment does not define a function named main using one
21415 of the specified forms (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
21417 [<a name="p557" href="#p557">page 557</a>] (<a href="#Contents">Contents</a>)
21419 -- The execution of a program contains a data race (<a href="#5.1.2.4">5.1.2.4</a>).
21420 -- A character not in the basic source character set is encountered in a source file, except
21421 in an identifier, a character constant, a string literal, a header name, a comment, or a
21422 preprocessing token that is never converted to a token (<a href="#5.2.1">5.2.1</a>).
21423 -- An identifier, comment, string literal, character constant, or header name contains an
21424 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>).
21425 -- The same identifier has both internal and external linkage in the same translation unit
21426 (<a href="#6.2.2">6.2.2</a>).
21427 -- An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
21428 -- The value of a pointer to an object whose lifetime has ended is used (<a href="#6.2.4">6.2.4</a>).
21429 -- The value of an object with automatic storage duration is used while it is
21430 indeterminate (<a href="#6.2.4">6.2.4</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.8">6.8</a>).
21431 -- A trap representation is read by an lvalue expression that does not have character type
21432 (<a href="#6.2.6.1">6.2.6.1</a>).
21433 -- A trap representation is produced by a side effect that modifies any part of the object
21434 using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
21435 -- The operands to certain operators are such that they could produce a negative zero
21436 result, but the implementation does not support negative zeros (<a href="#6.2.6.2">6.2.6.2</a>).
21437 -- Two declarations of the same object or function specify types that are not compatible
21438 (<a href="#6.2.7">6.2.7</a>).
21439 -- A program requires the formation of a composite type from a variable length array
21440 type whose size is specified by an expression that is not evaluated (<a href="#6.2.7">6.2.7</a>).
21441 -- Conversion to or from an integer type produces a value outside the range that can be
21442 represented (<a href="#6.3.1.4">6.3.1.4</a>).
21443 -- Demotion of one real floating type to another produces a value outside the range that
21444 can be represented (<a href="#6.3.1.5">6.3.1.5</a>).
21445 -- An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
21446 -- A non-array lvalue with an incomplete type is used in a context that requires the value
21447 of the designated object (<a href="#6.3.2.1">6.3.2.1</a>).
21448 -- An lvalue designating an object of automatic storage duration that could have been
21449 declared with the register storage class is used in a context that requires the value
21450 of the designated object, but the object is uninitialized. (<a href="#6.3.2.1">6.3.2.1</a>).
21451 -- An lvalue having array type is converted to a pointer to the initial element of the
21452 array, and the array object has register storage class (<a href="#6.3.2.1">6.3.2.1</a>).
21454 [<a name="p558" href="#p558">page 558</a>] (<a href="#Contents">Contents</a>)
21456 -- An attempt is made to use the value of a void expression, or an implicit or explicit
21457 conversion (except to void) is applied to a void expression (<a href="#6.3.2.2">6.3.2.2</a>).
21458 -- Conversion of a pointer to an integer type produces a value outside the range that can
21459 be represented (<a href="#6.3.2.3">6.3.2.3</a>).
21460 -- Conversion between two pointer types produces a result that is incorrectly aligned
21461 (<a href="#6.3.2.3">6.3.2.3</a>).
21462 -- A pointer is used to call a function whose type is not compatible with the referenced
21463 type (<a href="#6.3.2.3">6.3.2.3</a>).
21464 -- An unmatched ' or " character is encountered on a logical source line during
21465 tokenization (<a href="#6.4">6.4</a>).
21466 -- A reserved keyword token is used in translation phase 7 or 8 for some purpose other
21467 than as a keyword (<a href="#6.4.1">6.4.1</a>).
21468 -- A universal character name in an identifier does not designate a character whose
21469 encoding falls into one of the specified ranges (<a href="#6.4.2.1">6.4.2.1</a>).
21470 -- The initial character of an identifier is a universal character name designating a digit
21471 (<a href="#6.4.2.1">6.4.2.1</a>).
21472 -- Two identifiers differ only in nonsignificant characters (<a href="#6.4.2.1">6.4.2.1</a>).
21473 -- The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
21474 -- The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
21475 -- The characters ', \, ", //, or /* occur in the sequence between the &lt; and &gt;
21476 delimiters, or the characters ', \, //, or /* occur in the sequence between the "
21477 delimiters, in a header name preprocessing token (<a href="#6.4.7">6.4.7</a>).
21478 -- A side effect on a scalar object is unsequenced relative to either a different side effect
21479 on the same scalar object or a value computation using the value of the same scalar
21480 object (<a href="#6.5">6.5</a>).
21481 -- An exceptional condition occurs during the evaluation of an expression (<a href="#6.5">6.5</a>).
21482 -- An object has its stored value accessed other than by an lvalue of an allowable type
21483 (<a href="#6.5">6.5</a>).
21484 -- For a call to a function without a function prototype in scope, the number of
21485 arguments does not equal the number of parameters (<a href="#6.5.2.2">6.5.2.2</a>).
21486 -- For call to a function without a function prototype in scope where the function is
21487 defined with a function prototype, either the prototype ends with an ellipsis or the
21488 types of the arguments after promotion are not compatible with the types of the
21489 parameters (<a href="#6.5.2.2">6.5.2.2</a>).
21491 [<a name="p559" href="#p559">page 559</a>] (<a href="#Contents">Contents</a>)
21493 -- For a call to a function without a function prototype in scope where the function is not
21494 defined with a function prototype, the types of the arguments after promotion are not
21495 compatible with those of the parameters after promotion (with certain exceptions)
21496 (<a href="#6.5.2.2">6.5.2.2</a>).
21497 -- A function is defined with a type that is not compatible with the type (of the
21498 expression) pointed to by the expression that denotes the called function (<a href="#6.5.2.2">6.5.2.2</a>).
21499 -- A member of an atomic structure or union is accessed (<a href="#6.5.2.3">6.5.2.3</a>).
21500 -- The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
21501 -- A pointer is converted to other than an integer or pointer type (<a href="#6.5.4">6.5.4</a>).
21502 -- The value of the second operand of the / or % operator is zero (<a href="#6.5.5">6.5.5</a>).
21503 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
21504 integer type produces a result that does not point into, or just beyond, the same array
21505 object (<a href="#6.5.6">6.5.6</a>).
21506 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
21507 integer type produces a result that points just beyond the array object and is used as
21508 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
21509 -- Pointers that do not point into, or just beyond, the same array object are subtracted
21510 (<a href="#6.5.6">6.5.6</a>).
21511 -- An array subscript is out of range, even if an object is apparently accessible with the
21512 given subscript (as in the lvalue expression a[1][7] given the declaration int
21513 a[4][5]) (<a href="#6.5.6">6.5.6</a>).
21514 -- The result of subtracting two pointers is not representable in an object of type
21515 ptrdiff_t (<a href="#6.5.6">6.5.6</a>).
21516 -- An expression is shifted by a negative number or by an amount greater than or equal
21517 to the width of the promoted expression (<a href="#6.5.7">6.5.7</a>).
21518 -- An expression having signed promoted type is left-shifted and either the value of the
21519 expression is negative or the result of shifting would be not be representable in the
21520 promoted type (<a href="#6.5.7">6.5.7</a>).
21521 -- Pointers that do not point to the same aggregate or union (nor just beyond the same
21522 array object) are compared using relational operators (<a href="#6.5.8">6.5.8</a>).
21523 -- An object is assigned to an inexactly overlapping object or to an exactly overlapping
21524 object with incompatible type (<a href="#6.5.16.1">6.5.16.1</a>).
21525 -- An expression that is required to be an integer constant expression does not have an
21526 integer type; has operands that are not integer constants, enumeration constants,
21527 character constants, sizeof expressions whose results are integer constants,
21529 [<a name="p560" href="#p560">page 560</a>] (<a href="#Contents">Contents</a>)
21531 _Alignof expressions, or immediately-cast floating constants; or contains casts
21532 (outside operands to sizeof and _Alignof operators) other than conversions of
21533 arithmetic types to integer types (<a href="#6.6">6.6</a>).
21534 -- A constant expression in an initializer is not, or does not evaluate to, one of the
21535 following: an arithmetic constant expression, a null pointer constant, an address
21536 constant, or an address constant for a complete object type plus or minus an integer
21537 constant expression (<a href="#6.6">6.6</a>).
21538 -- An arithmetic constant expression does not have arithmetic type; has operands that
21539 are not integer constants, floating constants, enumeration constants, character
21540 constants, sizeof expressions whose results are integer constants, or _Alignof
21541 expressions; or contains casts (outside operands to sizeof or _Alignof operators)
21542 other than conversions of arithmetic types to arithmetic types (<a href="#6.6">6.6</a>).
21543 -- The value of an object is accessed by an array-subscript [], member-access . or -&gt;,
21544 address &amp;, or indirection * operator or a pointer cast in creating an address constant
21545 (<a href="#6.6">6.6</a>).
21546 -- An identifier for an object is declared with no linkage and the type of the object is
21547 incomplete after its declarator, or after its init-declarator if it has an initializer (<a href="#6.7">6.7</a>).
21548 -- A function is declared at block scope with an explicit storage-class specifier other
21549 than extern (<a href="#6.7.1">6.7.1</a>).
21550 -- A structure or union is defined without any named members (including those
21551 specified indirectly via anonymous structures and unions) (<a href="#6.7.2.1">6.7.2.1</a>).
21552 -- An attempt is made to access, or generate a pointer to just past, a flexible array
21553 member of a structure when the referenced object provides no elements for that array
21554 (<a href="#6.7.2.1">6.7.2.1</a>).
21555 -- When the complete type is needed, an incomplete structure or union type is not
21556 completed in the same scope by another declaration of the tag that defines the content
21557 (<a href="#6.7.2.3">6.7.2.3</a>).
21558 -- An attempt is made to modify an object defined with a const-qualified type through
21559 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
21560 -- An attempt is made to refer to an object defined with a volatile-qualified type through
21561 use of an lvalue with non-volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
21562 -- The specification of a function type includes any type qualifiers (<a href="#6.7.3">6.7.3</a>).
21563 -- Two qualified types that are required to be compatible do not have the identically
21564 qualified version of a compatible type (<a href="#6.7.3">6.7.3</a>).
21565 -- An object which has been modified is accessed through a restrict-qualified pointer to
21566 a const-qualified type, or through a restrict-qualified pointer and another pointer that
21568 [<a name="p561" href="#p561">page 561</a>] (<a href="#Contents">Contents</a>)
21570 are not both based on the same object (<a href="#6.7.3.1">6.7.3.1</a>).
21571 -- A restrict-qualified pointer is assigned a value based on another restricted pointer
21572 whose associated block neither began execution before the block associated with this
21573 pointer, nor ended before the assignment (<a href="#6.7.3.1">6.7.3.1</a>).
21574 -- A function with external linkage is declared with an inline function specifier, but is
21575 not also defined in the same translation unit (<a href="#6.7.4">6.7.4</a>).
21576 -- A function declared with a _Noreturn function specifier returns to its caller (<a href="#6.7.4">6.7.4</a>).
21577 -- The definition of an object has an alignment specifier and another declaration of that
21578 object has a different alignment specifier (<a href="#6.7.5">6.7.5</a>).
21579 -- Declarations of an object in different translation units have different alignment
21580 specifiers (<a href="#6.7.5">6.7.5</a>).
21581 -- Two pointer types that are required to be compatible are not identically qualified, or
21582 are not pointers to compatible types (<a href="#6.7.6.1">6.7.6.1</a>).
21583 -- The size expression in an array declaration is not a constant expression and evaluates
21584 at program execution time to a nonpositive value (<a href="#6.7.6.2">6.7.6.2</a>).
21585 -- In a context requiring two array types to be compatible, they do not have compatible
21586 element types, or their size specifiers evaluate to unequal values (<a href="#6.7.6.2">6.7.6.2</a>).
21587 -- A declaration of an array parameter includes the keyword static within the [ and
21588 ] and the corresponding argument does not provide access to the first element of an
21589 array with at least the specified number of elements (<a href="#6.7.6.3">6.7.6.3</a>).
21590 -- A storage-class specifier or type qualifier modifies the keyword void as a function
21591 parameter type list (<a href="#6.7.6.3">6.7.6.3</a>).
21592 -- In a context requiring two function types to be compatible, they do not have
21593 compatible return types, or their parameters disagree in use of the ellipsis terminator
21594 or the number and type of parameters (after default argument promotion, when there
21595 is no parameter type list or when one type is specified by a function definition with an
21596 identifier list) (<a href="#6.7.6.3">6.7.6.3</a>).
21597 -- The value of an unnamed member of a structure or union is used (<a href="#6.7.9">6.7.9</a>).
21598 -- The initializer for a scalar is neither a single expression nor a single expression
21599 enclosed in braces (<a href="#6.7.9">6.7.9</a>).
21600 -- The initializer for a structure or union object that has automatic storage duration is
21601 neither an initializer list nor a single expression that has compatible structure or union
21602 type (<a href="#6.7.9">6.7.9</a>).
21603 -- The initializer for an aggregate or union, other than an array initialized by a string
21604 literal, is not a brace-enclosed list of initializers for its elements or members (<a href="#6.7.9">6.7.9</a>).
21606 [<a name="p562" href="#p562">page 562</a>] (<a href="#Contents">Contents</a>)
21608 -- An identifier with external linkage is used, but in the program there does not exist
21609 exactly one external definition for the identifier, or the identifier is not used and there
21610 exist multiple external definitions for the identifier (<a href="#6.9">6.9</a>).
21611 -- A function definition includes an identifier list, but the types of the parameters are not
21612 declared in a following declaration list (<a href="#6.9.1">6.9.1</a>).
21613 -- An adjusted parameter type in a function definition is not a complete object type
21614 (<a href="#6.9.1">6.9.1</a>).
21615 -- A function that accepts a variable number of arguments is defined without a
21616 parameter type list that ends with the ellipsis notation (<a href="#6.9.1">6.9.1</a>).
21617 -- The } that terminates a function is reached, and the value of the function call is used
21618 by the caller (<a href="#6.9.1">6.9.1</a>).
21619 -- An identifier for an object with internal linkage and an incomplete type is declared
21620 with a tentative definition (<a href="#6.9.2">6.9.2</a>).
21621 -- The token defined is generated during the expansion of a #if or #elif
21622 preprocessing directive, or the use of the defined unary operator does not match
21623 one of the two specified forms prior to macro replacement (<a href="#6.10.1">6.10.1</a>).
21624 -- The #include preprocessing directive that results after expansion does not match
21625 one of the two header name forms (<a href="#6.10.2">6.10.2</a>).
21626 -- The character sequence in an #include preprocessing directive does not start with a
21627 letter (<a href="#6.10.2">6.10.2</a>).
21628 -- There are sequences of preprocessing tokens within the list of macro arguments that
21629 would otherwise act as preprocessing directives (<a href="#6.10.3">6.10.3</a>).
21630 -- The result of the preprocessing operator # is not a valid character string literal
21631 (<a href="#6.10.3.2">6.10.3.2</a>).
21632 -- The result of the preprocessing operator ## is not a valid preprocessing token
21633 (<a href="#6.10.3.3">6.10.3.3</a>).
21634 -- The #line preprocessing directive that results after expansion does not match one of
21635 the two well-defined forms, or its digit sequence specifies zero or a number greater
21636 than 2147483647 (<a href="#6.10.4">6.10.4</a>).
21637 -- A non-STDC #pragma preprocessing directive that is documented as causing
21638 translation failure or some other form of undefined behavior is encountered (<a href="#6.10.6">6.10.6</a>).
21639 -- A #pragma STDC preprocessing directive does not match one of the well-defined
21640 forms (<a href="#6.10.6">6.10.6</a>).
21641 -- The name of a predefined macro, or the identifier defined, is the subject of a
21642 #define or #undef preprocessing directive (<a href="#6.10.8">6.10.8</a>).
21644 [<a name="p563" href="#p563">page 563</a>] (<a href="#Contents">Contents</a>)
21646 -- An attempt is made to copy an object to an overlapping object by use of a library
21647 function, other than as explicitly allowed (e.g., memmove) (clause 7).
21648 -- A file with the same name as one of the standard headers, not provided as part of the
21649 implementation, is placed in any of the standard places that are searched for included
21650 source files (<a href="#7.1.2">7.1.2</a>).
21651 -- A header is included within an external declaration or definition (<a href="#7.1.2">7.1.2</a>).
21652 -- A function, object, type, or macro that is specified as being declared or defined by
21653 some standard header is used before any header that declares or defines it is included
21654 (<a href="#7.1.2">7.1.2</a>).
21655 -- A standard header is included while a macro is defined with the same name as a
21656 keyword (<a href="#7.1.2">7.1.2</a>).
21657 -- The program attempts to declare a library function itself, rather than via a standard
21658 header, but the declaration does not have external linkage (<a href="#7.1.2">7.1.2</a>).
21659 -- The program declares or defines a reserved identifier, other than as allowed by <a href="#7.1.4">7.1.4</a>
21660 (<a href="#7.1.3">7.1.3</a>).
21661 -- The program removes the definition of a macro whose name begins with an
21662 underscore and either an uppercase letter or another underscore (<a href="#7.1.3">7.1.3</a>).
21663 -- An argument to a library function has an invalid value or a type not expected by a
21664 function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
21665 -- The pointer passed to a library function array parameter does not have a value such
21666 that all address computations and object accesses are valid (<a href="#7.1.4">7.1.4</a>).
21667 -- The macro definition of assert is suppressed in order to access an actual function
21668 (<a href="#7.2">7.2</a>).
21669 -- The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
21670 -- The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
21671 any context other than outside all external declarations or preceding all explicit
21672 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>).
21673 -- The value of an argument to a character handling function is neither equal to the value
21674 of EOF nor representable as an unsigned char (<a href="#7.4">7.4</a>).
21675 -- A macro definition of errno is suppressed in order to access an actual object, or the
21676 program defines an identifier with the name errno (<a href="#7.5">7.5</a>).
21677 -- Part of the program tests floating-point status flags, sets floating-point control modes,
21678 or runs under non-default mode settings, but was translated with the state for the
21679 FENV_ACCESS pragma ''off'' (<a href="#7.6.1">7.6.1</a>).
21681 [<a name="p564" href="#p564">page 564</a>] (<a href="#Contents">Contents</a>)
21683 -- The exception-mask argument for one of the functions that provide access to the
21684 floating-point status flags has a nonzero value not obtained by bitwise OR of the
21685 floating-point exception macros (<a href="#7.6.2">7.6.2</a>).
21686 -- The fesetexceptflag function is used to set floating-point status flags that were
21687 not specified in the call to the fegetexceptflag function that provided the value
21688 of the corresponding fexcept_t object (<a href="#7.6.2.4">7.6.2.4</a>).
21689 -- The argument to fesetenv or feupdateenv is neither an object set by a call to
21690 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>).
21691 -- The value of the result of an integer arithmetic or conversion function cannot be
21692 represented (<a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.22.6.1">7.22.6.1</a>, <a href="#7.22.6.2">7.22.6.2</a>, <a href="#7.22.1">7.22.1</a>).
21693 -- The program modifies the string pointed to by the value returned by the setlocale
21694 function (<a href="#7.11.1.1">7.11.1.1</a>).
21695 -- The program modifies the structure pointed to by the value returned by the
21696 localeconv function (<a href="#7.11.2.1">7.11.2.1</a>).
21697 -- A macro definition of math_errhandling is suppressed or the program defines
21698 an identifier with the name math_errhandling (<a href="#7.12">7.12</a>).
21699 -- An argument to a floating-point classification or comparison macro is not of real
21700 floating type (<a href="#7.12.3">7.12.3</a>, <a href="#7.12.14">7.12.14</a>).
21701 -- A macro definition of setjmp is suppressed in order to access an actual function, or
21702 the program defines an external identifier with the name setjmp (<a href="#7.13">7.13</a>).
21703 -- An invocation of the setjmp macro occurs other than in an allowed context
21704 (<a href="#7.13.2.1">7.13.2.1</a>).
21705 -- The longjmp function is invoked to restore a nonexistent environment (<a href="#7.13.2.1">7.13.2.1</a>).
21706 -- After a longjmp, there is an attempt to access the value of an object of automatic
21707 storage duration that does not have volatile-qualified type, local to the function
21708 containing the invocation of the corresponding setjmp macro, that was changed
21709 between the setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
21710 -- The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
21711 -- A signal handler returns when the signal corresponded to a computational exception
21712 (<a href="#7.14.1.1">7.14.1.1</a>).
21713 -- A signal handler called in response to SIGFPE, SIGILL, SIGSEGV, or any other
21714 implementation-defined value corresponding to a computational exception returns
21715 (<a href="#7.14.1.1">7.14.1.1</a>).
21716 -- A signal occurs as the result of calling the abort or raise function, and the signal
21717 handler calls the raise function (<a href="#7.14.1.1">7.14.1.1</a>).
21719 [<a name="p565" href="#p565">page 565</a>] (<a href="#Contents">Contents</a>)
21721 -- A signal occurs other than as the result of calling the abort or raise function, and
21722 the signal handler refers to an object with static or thread storage duration that is not a
21723 lock-free atomic object other than by assigning a value to an object declared as
21724 volatile sig_atomic_t, or calls any function in the standard library other
21725 than the abort function, the _Exit function, the quick_exit function, or the
21726 signal function (for the same signal number) (<a href="#7.14.1.1">7.14.1.1</a>).
21727 -- The value of errno is referred to after a signal occurred other than as the result of
21728 calling the abort or raise function and the corresponding signal handler obtained
21729 a SIG_ERR return from a call to the signal function (<a href="#7.14.1.1">7.14.1.1</a>).
21730 -- A signal is generated by an asynchronous signal handler (<a href="#7.14.1.1">7.14.1.1</a>).
21731 -- The signal function is used in a multi-threaded program (<a href="#7.14.1.1">7.14.1.1</a>).
21732 -- A function with a variable number of arguments attempts to access its varying
21733 arguments other than through a properly declared and initialized va_list object, or
21734 before the va_start macro is invoked (<a href="#7.16">7.16</a>, <a href="#7.16.1.1">7.16.1.1</a>, <a href="#7.16.1.4">7.16.1.4</a>).
21735 -- The macro va_arg is invoked using the parameter ap that was passed to a function
21736 that invoked the macro va_arg with the same parameter (<a href="#7.16">7.16</a>).
21737 -- A macro definition of va_start, va_arg, va_copy, or va_end is suppressed in
21738 order to access an actual function, or the program defines an external identifier with
21739 the name va_copy or va_end (<a href="#7.16.1">7.16.1</a>).
21740 -- The va_start or va_copy macro is invoked without a corresponding invocation
21741 of the va_end macro in the same function, or vice versa (<a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>,
21742 <a href="#7.16.1.4">7.16.1.4</a>).
21743 -- The type parameter to the va_arg macro is not such that a pointer to an object of
21744 that type can be obtained simply by postfixing a * (<a href="#7.16.1.1">7.16.1.1</a>).
21745 -- The va_arg macro is invoked when there is no actual next argument, or with a
21746 specified type that is not compatible with the promoted type of the actual next
21747 argument, with certain exceptions (<a href="#7.16.1.1">7.16.1.1</a>).
21748 -- The va_copy or va_start macro is called to initialize a va_list that was
21749 previously initialized by either macro without an intervening invocation of the
21750 va_end macro for the same va_list (<a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.4">7.16.1.4</a>).
21751 -- The parameter parmN of a va_start macro is declared with the register
21752 storage class, with a function or array type, or with a type that is not compatible with
21753 the type that results after application of the default argument promotions (<a href="#7.16.1.4">7.16.1.4</a>).
21754 -- The member designator parameter of an offsetof macro is an invalid right
21755 operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.19">7.19</a>).
21757 [<a name="p566" href="#p566">page 566</a>] (<a href="#Contents">Contents</a>)
21759 -- The argument in an instance of one of the integer-constant macros is not a decimal,
21760 octal, or hexadecimal constant, or it has a value that exceeds the limits for the
21761 corresponding type (<a href="#7.20.4">7.20.4</a>).
21762 -- A byte input/output function is applied to a wide-oriented stream, or a wide character
21763 input/output function is applied to a byte-oriented stream (<a href="#7.21.2">7.21.2</a>).
21764 -- Use is made of any portion of a file beyond the most recent wide character written to
21765 a wide-oriented stream (<a href="#7.21.2">7.21.2</a>).
21766 -- The value of a pointer to a FILE object is used after the associated file is closed
21767 (<a href="#7.21.3">7.21.3</a>).
21768 -- The stream for the fflush function points to an input stream or to an update stream
21769 in which the most recent operation was input (<a href="#7.21.5.2">7.21.5.2</a>).
21770 -- The string pointed to by the mode argument in a call to the fopen function does not
21771 exactly match one of the specified character sequences (<a href="#7.21.5.3">7.21.5.3</a>).
21772 -- An output operation on an update stream is followed by an input operation without an
21773 intervening call to the fflush function or a file positioning function, or an input
21774 operation on an update stream is followed by an output operation with an intervening
21775 call to a file positioning function (<a href="#7.21.5.3">7.21.5.3</a>).
21776 -- An attempt is made to use the contents of the array that was supplied in a call to the
21777 setvbuf function (<a href="#7.21.5.6">7.21.5.6</a>).
21778 -- There are insufficient arguments for the format in a call to one of the formatted
21779 input/output functions, or an argument does not have an appropriate type (<a href="#7.21.6.1">7.21.6.1</a>,
21780 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21781 -- The format in a call to one of the formatted input/output functions or to the
21782 strftime or wcsftime function is not a valid multibyte character sequence that
21783 begins and ends in its initial shift state (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>,
21784 <a href="#7.29.5.1">7.29.5.1</a>).
21785 -- In a call to one of the formatted output functions, a precision appears with a
21786 conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21787 -- A conversion specification for a formatted output function uses an asterisk to denote
21788 an argument-supplied field width or precision, but the corresponding argument is not
21789 provided (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21790 -- A conversion specification for a formatted output function uses a # or 0 flag with a
21791 conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21792 -- A conversion specification for one of the formatted input/output functions uses a
21793 length modifier with a conversion specifier other than those described (<a href="#7.21.6.1">7.21.6.1</a>,
21794 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21796 [<a name="p567" href="#p567">page 567</a>] (<a href="#Contents">Contents</a>)
21798 -- An s conversion specifier is encountered by one of the formatted output functions,
21799 and the argument is missing the null terminator (unless a precision is specified that
21800 does not require null termination) (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21801 -- An n conversion specification for one of the formatted input/output functions includes
21802 any flags, an assignment-suppressing character, a field width, or a precision (<a href="#7.21.6.1">7.21.6.1</a>,
21803 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21804 -- A % conversion specifier is encountered by one of the formatted input/output
21805 functions, but the complete conversion specification is not exactly %% (<a href="#7.21.6.1">7.21.6.1</a>,
21806 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21807 -- An invalid conversion specification is found in the format for one of the formatted
21808 input/output functions, or the strftime or wcsftime function (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
21809 <a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.5.1">7.29.5.1</a>).
21810 -- The number of characters or wide characters transmitted by a formatted output
21811 function (or written to an array, or that would have been written to an array) is greater
21812 than INT_MAX (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
21813 -- The number of input items assigned by a formatted input function is greater than
21814 INT_MAX (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21815 -- The result of a conversion by one of the formatted input functions cannot be
21816 represented in the corresponding object, or the receiving object does not have an
21817 appropriate type (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21818 -- A c, s, or [ conversion specifier is encountered by one of the formatted input
21819 functions, and the array pointed to by the corresponding argument is not large enough
21820 to accept the input sequence (and a null terminator if the conversion specifier is s or
21821 [) (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21822 -- A c, s, or [ conversion specifier with an l qualifier is encountered by one of the
21823 formatted input functions, but the input is not a valid multibyte character sequence
21824 that begins in the initial shift state (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21825 -- The input item for a %p conversion by one of the formatted input functions is not a
21826 value converted earlier during the same program execution (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
21827 -- The vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf,
21828 vsscanf, vfwprintf, vfwscanf, vswprintf, vswscanf, vwprintf, or
21829 vwscanf function is called with an improperly initialized va_list argument, or
21830 the argument is used (other than in an invocation of va_end) after the function
21831 returns (<a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>,
21832 <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>).
21833 -- The contents of the array supplied in a call to the fgets or fgetws function are
21834 used after a read error occurred (<a href="#7.21.7.2">7.21.7.2</a>, <a href="#7.29.3.2">7.29.3.2</a>).
21836 [<a name="p568" href="#p568">page 568</a>] (<a href="#Contents">Contents</a>)
21838 -- The file position indicator for a binary stream is used after a call to the ungetc
21839 function where its value was zero before the call (<a href="#7.21.7.10">7.21.7.10</a>).
21840 -- The file position indicator for a stream is used after an error occurred during a call to
21841 the fread or fwrite function (<a href="#7.21.8.1">7.21.8.1</a>, <a href="#7.21.8.2">7.21.8.2</a>).
21842 -- A partial element read by a call to the fread function is used (<a href="#7.21.8.1">7.21.8.1</a>).
21843 -- The fseek function is called for a text stream with a nonzero offset and either the
21844 offset was not returned by a previous successful call to the ftell function on a
21845 stream associated with the same file or whence is not SEEK_SET (<a href="#7.21.9.2">7.21.9.2</a>).
21846 -- The fsetpos function is called to set a position that was not returned by a previous
21847 successful call to the fgetpos function on a stream associated with the same file
21848 (<a href="#7.21.9.3">7.21.9.3</a>).
21849 -- A non-null pointer returned by a call to the calloc, malloc, or realloc function
21850 with a zero requested size is used to access an object (<a href="#7.22.3">7.22.3</a>).
21851 -- The value of a pointer that refers to space deallocated by a call to the free or
21852 realloc function is used (<a href="#7.22.3">7.22.3</a>).
21853 -- The alignment requested of the aligned_alloc function is not valid or not
21854 supported by the implementation, or the size requested is not an integral multiple of
21855 the alignment (<a href="#7.22.3.1">7.22.3.1</a>).
21856 -- The pointer argument to the free or realloc function does not match a pointer
21857 earlier returned by a memory management function, or the space has been deallocated
21858 by a call to free or realloc (<a href="#7.22.3.3">7.22.3.3</a>, <a href="#7.22.3.5">7.22.3.5</a>).
21859 -- The value of the object allocated by the malloc function is used (<a href="#7.22.3.4">7.22.3.4</a>).
21860 -- The value of any bytes in a new object allocated by the realloc function beyond
21861 the size of the old object are used (<a href="#7.22.3.5">7.22.3.5</a>).
21862 -- The program calls the exit or quick_exit function more than once, or calls both
21863 functions (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
21864 -- During the call to a function registered with the atexit or at_quick_exit
21865 function, a call is made to the longjmp function that would terminate the call to the
21866 registered function (<a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.7">7.22.4.7</a>).
21867 -- The string set up by the getenv or strerror function is modified by the program
21868 (<a href="#7.22.4.6">7.22.4.6</a>, <a href="#7.24.6.2">7.24.6.2</a>).
21869 -- A signal is raised while the quick_exit function is executing (<a href="#7.22.4.7">7.22.4.7</a>).
21870 -- A command is executed through the system function in a way that is documented as
21871 causing termination or some other form of undefined behavior (<a href="#7.22.4.8">7.22.4.8</a>).
21873 [<a name="p569" href="#p569">page 569</a>] (<a href="#Contents">Contents</a>)
21875 -- A searching or sorting utility function is called with an invalid pointer argument, even
21876 if the number of elements is zero (<a href="#7.22.5">7.22.5</a>).
21877 -- The comparison function called by a searching or sorting utility function alters the
21878 contents of the array being searched or sorted, or returns ordering values
21879 inconsistently (<a href="#7.22.5">7.22.5</a>).
21880 -- The array being searched by the bsearch function does not have its elements in
21881 proper order (<a href="#7.22.5.1">7.22.5.1</a>).
21882 -- The current conversion state is used by a multibyte/wide character conversion
21883 function after changing the LC_CTYPE category (<a href="#7.22.7">7.22.7</a>).
21884 -- A string or wide string utility function is instructed to access an array beyond the end
21885 of an object (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
21886 -- A string or wide string utility function is called with an invalid pointer argument, even
21887 if the length is zero (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
21888 -- The contents of the destination array are used after a call to the strxfrm,
21889 strftime, wcsxfrm, or wcsftime function in which the specified length was
21890 too small to hold the entire null-terminated result (<a href="#7.24.4.5">7.24.4.5</a>, <a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a>,
21891 <a href="#7.29.5.1">7.29.5.1</a>).
21892 -- The first argument in the very first call to the strtok or wcstok is a null pointer
21893 (<a href="#7.24.5.8">7.24.5.8</a>, <a href="#7.29.4.5.7">7.29.4.5.7</a>).
21894 -- The type of an argument to a type-generic macro is not compatible with the type of
21895 the corresponding parameter of the selected function (<a href="#7.25">7.25</a>).
21896 -- A complex argument is supplied for a generic parameter of a type-generic macro that
21897 has no corresponding complex function (<a href="#7.25">7.25</a>).
21898 -- At least one member of the broken-down time passed to asctime contains a value
21899 outside its normal range, or the calculated year exceeds four digits or is less than the
21900 year 1000 (<a href="#7.27.3.1">7.27.3.1</a>).
21901 -- The argument corresponding to an s specifier without an l qualifier in a call to the
21902 fwprintf function does not point to a valid multibyte character sequence that
21903 begins in the initial shift state (<a href="#7.29.2.11">7.29.2.11</a>).
21904 -- In a call to the wcstok function, the object pointed to by ptr does not have the
21905 value stored by the previous call for the same wide string (<a href="#7.29.4.5.7">7.29.4.5.7</a>).
21906 -- An mbstate_t object is used inappropriately (<a href="#7.29.6">7.29.6</a>).
21907 -- The value of an argument of type wint_t to a wide character classification or case
21908 mapping function is neither equal to the value of WEOF nor representable as a
21909 wchar_t (<a href="#7.30.1">7.30.1</a>).
21911 [<a name="p570" href="#p570">page 570</a>] (<a href="#Contents">Contents</a>)
21913 -- The iswctype function is called using a different LC_CTYPE category from the
21914 one in effect for the call to the wctype function that returned the description
21915 (<a href="#7.30.2.2.1">7.30.2.2.1</a>).
21916 -- The towctrans function is called using a different LC_CTYPE category from the
21917 one in effect for the call to the wctrans function that returned the description
21918 (<a href="#7.30.3.2.1">7.30.3.2.1</a>).
21919 <a name="J.3" href="#J.3"><b> J.3 Implementation-defined behavior</b></a>
21920 1 A conforming implementation is required to document its choice of behavior in each of
21921 the areas listed in this subclause. The following are implementation-defined:
21922 <a name="J.3.1" href="#J.3.1"><b> J.3.1 Translation</b></a>
21923 1 -- How a diagnostic is identified (<a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a>).
21924 -- Whether each nonempty sequence of white-space characters other than new-line is
21925 retained or replaced by one space character in translation phase 3 (<a href="#5.1.1.2">5.1.1.2</a>).
21926 <a name="J.3.2" href="#J.3.2"><b> J.3.2 Environment</b></a>
21927 1 -- The mapping between physical source file multibyte characters and the source
21928 character set in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>).
21929 -- The name and type of the function called at program startup in a freestanding
21930 environment (<a href="#5.1.2.1">5.1.2.1</a>).
21931 -- The effect of program termination in a freestanding environment (<a href="#5.1.2.1">5.1.2.1</a>).
21932 -- An alternative manner in which the main function may be defined (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
21933 -- 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>).
21934 -- What constitutes an interactive device (<a href="#5.1.2.3">5.1.2.3</a>).
21935 -- Whether a program can have more than one thread of execution in a freestanding
21936 environment (<a href="#5.1.2.4">5.1.2.4</a>).
21937 -- The set of signals, their semantics, and their default handling (<a href="#7.14">7.14</a>).
21938 -- Signal values other than SIGFPE, SIGILL, and SIGSEGV that correspond to a
21939 computational exception (<a href="#7.14.1.1">7.14.1.1</a>).
21940 -- Signals for which the equivalent of signal(sig, SIG_IGN); is executed at
21941 program startup (<a href="#7.14.1.1">7.14.1.1</a>).
21942 -- The set of environment names and the method for altering the environment list used
21943 by the getenv function (<a href="#7.22.4.6">7.22.4.6</a>).
21944 -- The manner of execution of the string by the system function (<a href="#7.22.4.8">7.22.4.8</a>).
21946 [<a name="p571" href="#p571">page 571</a>] (<a href="#Contents">Contents</a>)
21948 <a name="J.3.3" href="#J.3.3"><b> J.3.3 Identifiers</b></a>
21949 1 -- Which additional multibyte characters may appear in identifiers and their
21950 correspondence to universal character names (<a href="#6.4.2">6.4.2</a>).
21951 -- 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>).
21952 <a name="J.3.4" href="#J.3.4"><b> J.3.4 Characters</b></a>
21953 1 -- The number of bits in a byte (<a href="#3.6">3.6</a>).
21954 -- The values of the members of the execution character set (<a href="#5.2.1">5.2.1</a>).
21955 -- The unique value of the member of the execution character set produced for each of
21956 the standard alphabetic escape sequences (<a href="#5.2.2">5.2.2</a>).
21957 -- The value of a char object into which has been stored any character other than a
21958 member of the basic execution character set (<a href="#6.2.5">6.2.5</a>).
21959 -- Which of signed char or unsigned char has the same range, representation,
21960 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>).
21961 -- The mapping of members of the source character set (in character constants and string
21962 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>).
21963 -- The value of an integer character constant containing more than one character or
21964 containing a character or escape sequence that does not map to a single-byte
21965 execution character (<a href="#6.4.4.4">6.4.4.4</a>).
21966 -- The value of a wide character constant containing more than one multibyte character
21967 or a single multibyte character that maps to multiple members of the extended
21968 execution character set, or containing a multibyte character or escape sequence not
21969 represented in the extended execution character set (<a href="#6.4.4.4">6.4.4.4</a>).
21970 -- The current locale used to convert a wide character constant consisting of a single
21971 multibyte character that maps to a member of the extended execution character set
21972 into a corresponding wide character code (<a href="#6.4.4.4">6.4.4.4</a>).
21973 -- Whether differently-prefixed wide string literal tokens can be concatenated and, if so,
21974 the treatment of the resulting multibyte character sequence (<a href="#6.4.5">6.4.5</a>).
21975 -- The current locale used to convert a wide string literal into corresponding wide
21976 character codes (<a href="#6.4.5">6.4.5</a>).
21977 -- The value of a string literal containing a multibyte character or escape sequence not
21978 represented in the execution character set (<a href="#6.4.5">6.4.5</a>).
21979 -- The encoding of any of wchar_t, char16_t, and char32_t where the
21980 corresponding standard encoding macro (__STDC_ISO_10646__,
21981 __STDC_UTF_16__, or __STDC_UTF_32__) is not defined (<a href="#6.10.8.2">6.10.8.2</a>).
21983 [<a name="p572" href="#p572">page 572</a>] (<a href="#Contents">Contents</a>)
21985 <a name="J.3.5" href="#J.3.5"><b> J.3.5 Integers</b></a>
21986 1 -- Any extended integer types that exist in the implementation (<a href="#6.2.5">6.2.5</a>).
21987 -- Whether signed integer types are represented using sign and magnitude, two's
21988 complement, or ones' complement, and whether the extraordinary value is a trap
21989 representation or an ordinary value (<a href="#6.2.6.2">6.2.6.2</a>).
21990 -- The rank of any extended integer type relative to another extended integer type with
21991 the same precision (<a href="#6.3.1.1">6.3.1.1</a>).
21992 -- The result of, or the signal raised by, converting an integer to a signed integer type
21993 when the value cannot be represented in an object of that type (<a href="#6.3.1.3">6.3.1.3</a>).
21994 -- The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
21995 <a name="J.3.6" href="#J.3.6"><b> J.3.6 Floating point</b></a>
21996 1 -- The accuracy of the floating-point operations and of the library functions in
21997 <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>).
21998 -- The accuracy of the conversions between floating-point internal representations and
21999 string representations performed by the library functions in <a href="#7.21">&lt;stdio.h&gt;</a>,
22000 <a href="#7.22">&lt;stdlib.h&gt;</a>, and <a href="#7.29">&lt;wchar.h&gt;</a> (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
22001 -- The rounding behaviors characterized by non-standard values of FLT_ROUNDS
22002 (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
22003 -- The evaluation methods characterized by non-standard negative values of
22004 FLT_EVAL_METHOD (<a href="#5.2.4.2.2">5.2.4.2.2</a>).
22005 -- The direction of rounding when an integer is converted to a floating-point number that
22006 cannot exactly represent the original value (<a href="#6.3.1.4">6.3.1.4</a>).
22007 -- The direction of rounding when a floating-point number is converted to a narrower
22008 floating-point number (<a href="#6.3.1.5">6.3.1.5</a>).
22009 -- How the nearest representable value or the larger or smaller representable value
22010 immediately adjacent to the nearest representable value is chosen for certain floating
22011 constants (<a href="#6.4.4.2">6.4.4.2</a>).
22012 -- Whether and how floating expressions are contracted when not disallowed by the
22013 FP_CONTRACT pragma (<a href="#6.5">6.5</a>).
22014 -- The default state for the FENV_ACCESS pragma (<a href="#7.6.1">7.6.1</a>).
22015 -- Additional floating-point exceptions, rounding modes, environments, and
22016 classifications, and their macro names (<a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>).
22017 -- The default state for the FP_CONTRACT pragma (<a href="#7.12.2">7.12.2</a>).
22019 [<a name="p573" href="#p573">page 573</a>] (<a href="#Contents">Contents</a>)
22021 <a name="J.3.7" href="#J.3.7"><b> J.3.7 Arrays and pointers</b></a>
22022 1 -- The result of converting a pointer to an integer or vice versa (<a href="#6.3.2.3">6.3.2.3</a>).
22023 -- The size of the result of subtracting two pointers to elements of the same array
22024 (<a href="#6.5.6">6.5.6</a>).
22025 <a name="J.3.8" href="#J.3.8"><b> J.3.8 Hints</b></a>
22026 1 -- The extent to which suggestions made by using the register storage-class
22027 specifier are effective (<a href="#6.7.1">6.7.1</a>).
22028 -- The extent to which suggestions made by using the inline function specifier are
22029 effective (<a href="#6.7.4">6.7.4</a>).
22030 <a name="J.3.9" href="#J.3.9"><b> J.3.9 Structures, unions, enumerations, and bit-fields</b></a>
22031 1 -- Whether a ''plain'' int bit-field is treated as a signed int bit-field or as an
22032 unsigned int bit-field (<a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.1">6.7.2.1</a>).
22033 -- Allowable bit-field types other than _Bool, signed int, and unsigned int
22034 (<a href="#6.7.2.1">6.7.2.1</a>).
22035 -- Whether atomic types are permitted for bit-fields (<a href="#6.7.2.1">6.7.2.1</a>).
22036 -- Whether a bit-field can straddle a storage-unit boundary (<a href="#6.7.2.1">6.7.2.1</a>).
22037 -- The order of allocation of bit-fields within a unit (<a href="#6.7.2.1">6.7.2.1</a>).
22038 -- The alignment of non-bit-field members of structures (<a href="#6.7.2.1">6.7.2.1</a>). This should present
22039 no problem unless binary data written by one implementation is read by another.
22040 -- The integer type compatible with each enumerated type (<a href="#6.7.2.2">6.7.2.2</a>).
22041 <a name="J.3.10" href="#J.3.10"><b> J.3.10 Qualifiers</b></a>
22042 1 -- What constitutes an access to an object that has volatile-qualified type (<a href="#6.7.3">6.7.3</a>).
22043 <a name="J.3.11" href="#J.3.11"><b> J.3.11 Preprocessing directives</b></a>
22044 1 -- The locations within #pragma directives where header name preprocessing tokens
22045 are recognized (<a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>).
22046 -- How sequences in both forms of header names are mapped to headers or external
22047 source file names (<a href="#6.4.7">6.4.7</a>).
22048 -- Whether the value of a character constant in a constant expression that controls
22049 conditional inclusion matches the value of the same character constant in the
22050 execution character set (<a href="#6.10.1">6.10.1</a>).
22051 -- Whether the value of a single-character character constant in a constant expression
22052 that controls conditional inclusion may have a negative value (<a href="#6.10.1">6.10.1</a>).
22054 [<a name="p574" href="#p574">page 574</a>] (<a href="#Contents">Contents</a>)
22056 -- The places that are searched for an included &lt; &gt; delimited header, and how the places
22057 are specified or the header is identified (<a href="#6.10.2">6.10.2</a>).
22058 -- How the named source file is searched for in an included " " delimited header
22059 (<a href="#6.10.2">6.10.2</a>).
22060 -- The method by which preprocessing tokens (possibly resulting from macro
22061 expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
22062 -- The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
22063 -- Whether the # operator inserts a \ character before the \ character that begins a
22064 universal character name in a character constant or string literal (<a href="#6.10.3.2">6.10.3.2</a>).
22065 -- The behavior on each recognized non-STDC #pragma directive (<a href="#6.10.6">6.10.6</a>).
22066 -- The definitions for __DATE__ and __TIME__ when respectively, the date and
22067 time of translation are not available (<a href="#6.10.8.1">6.10.8.1</a>).
22068 <a name="J.3.12" href="#J.3.12"><b> J.3.12 Library functions</b></a>
22069 1 -- Any library facilities available to a freestanding program, other than the minimal set
22070 required by clause 4 (<a href="#5.1.2.1">5.1.2.1</a>).
22071 -- The format of the diagnostic printed by the assert macro (<a href="#7.2.1.1">7.2.1.1</a>).
22072 -- The representation of the floating-point status flags stored by the
22073 fegetexceptflag function (<a href="#7.6.2.2">7.6.2.2</a>).
22074 -- Whether the feraiseexcept function raises the ''inexact'' floating-point
22075 exception in addition to the ''overflow'' or ''underflow'' floating-point exception
22076 (<a href="#7.6.2.3">7.6.2.3</a>).
22077 -- Strings other than "C" and "" that may be passed as the second argument to the
22078 setlocale function (<a href="#7.11.1.1">7.11.1.1</a>).
22079 -- The types defined for float_t and double_t when the value of the
22080 FLT_EVAL_METHOD macro is less than 0 (<a href="#7.12">7.12</a>).
22081 -- Domain errors for the mathematics functions, other than those required by this
22082 International Standard (<a href="#7.12.1">7.12.1</a>).
22083 -- The values returned by the mathematics functions on domain errors or pole errors
22084 (<a href="#7.12.1">7.12.1</a>).
22085 -- The values returned by the mathematics functions on underflow range errors, whether
22086 errno is set to the value of the macro ERANGE when the integer expression
22087 math_errhandling &amp; MATH_ERRNO is nonzero, and whether the ''underflow''
22088 floating-point exception is raised when the integer expression math_errhandling
22089 &amp; MATH_ERREXCEPT is nonzero. (<a href="#7.12.1">7.12.1</a>).
22091 [<a name="p575" href="#p575">page 575</a>] (<a href="#Contents">Contents</a>)
22093 -- Whether a domain error occurs or zero is returned when an fmod function has a
22094 second argument of zero (<a href="#7.12.10.1">7.12.10.1</a>).
22095 -- Whether a domain error occurs or zero is returned when a remainder function has
22096 a second argument of zero (<a href="#7.12.10.2">7.12.10.2</a>).
22097 -- The base-2 logarithm of the modulus used by the remquo functions in reducing the
22098 quotient (<a href="#7.12.10.3">7.12.10.3</a>).
22099 -- Whether a domain error occurs or zero is returned when a remquo function has a
22100 second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
22101 -- Whether the equivalent of signal(sig, SIG_DFL); is executed prior to the call
22102 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>).
22103 -- The null pointer constant to which the macro NULL expands (<a href="#7.19">7.19</a>).
22104 -- Whether the last line of a text stream requires a terminating new-line character
22105 (<a href="#7.21.2">7.21.2</a>).
22106 -- Whether space characters that are written out to a text stream immediately before a
22107 new-line character appear when read in (<a href="#7.21.2">7.21.2</a>).
22108 -- The number of null characters that may be appended to data written to a binary
22109 stream (<a href="#7.21.2">7.21.2</a>).
22110 -- Whether the file position indicator of an append-mode stream is initially positioned at
22111 the beginning or end of the file (<a href="#7.21.3">7.21.3</a>).
22112 -- Whether a write on a text stream causes the associated file to be truncated beyond that
22113 point (<a href="#7.21.3">7.21.3</a>).
22114 -- The characteristics of file buffering (<a href="#7.21.3">7.21.3</a>).
22115 -- Whether a zero-length file actually exists (<a href="#7.21.3">7.21.3</a>).
22116 -- The rules for composing valid file names (<a href="#7.21.3">7.21.3</a>).
22117 -- Whether the same file can be simultaneously open multiple times (<a href="#7.21.3">7.21.3</a>).
22118 -- The nature and choice of encodings used for multibyte characters in files (<a href="#7.21.3">7.21.3</a>).
22119 -- The effect of the remove function on an open file (<a href="#7.21.4.1">7.21.4.1</a>).
22120 -- The effect if a file with the new name exists prior to a call to the rename function
22121 (<a href="#7.21.4.2">7.21.4.2</a>).
22122 -- Whether an open temporary file is removed upon abnormal program termination
22123 (<a href="#7.21.4.3">7.21.4.3</a>).
22124 -- Which changes of mode are permitted (if any), and under what circumstances
22125 (<a href="#7.21.5.4">7.21.5.4</a>).
22127 [<a name="p576" href="#p576">page 576</a>] (<a href="#Contents">Contents</a>)
22129 -- The style used to print an infinity or NaN, and the meaning of any n-char or n-wchar
22130 sequence printed for a NaN (<a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>).
22131 -- The output for %p conversion in the fprintf or fwprintf function (<a href="#7.21.6.1">7.21.6.1</a>,
22132 <a href="#7.29.2.1">7.29.2.1</a>).
22133 -- The interpretation of a - character that is neither the first nor the last character, nor
22134 the second where a ^ character is the first, in the scanlist for %[ conversion in the
22135 fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>).
22136 -- The set of sequences matched by a %p conversion and the interpretation of the
22137 corresponding input item in the fscanf or fwscanf function (<a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>).
22138 -- The value to which the macro errno is set by the fgetpos, fsetpos, or ftell
22139 functions on failure (<a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.9.4">7.21.9.4</a>).
22140 -- The meaning of any n-char or n-wchar sequence in a string representing a NaN that is
22141 converted by the strtod, strtof, strtold, wcstod, wcstof, or wcstold
22142 function (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
22143 -- Whether or not the strtod, strtof, strtold, wcstod, wcstof, or wcstold
22144 function sets errno to ERANGE when underflow occurs (<a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>).
22145 -- Whether the calloc, malloc, and realloc functions return a null pointer or a
22146 pointer to an allocated object when the size requested is zero (<a href="#7.22.3">7.22.3</a>).
22147 -- Whether open streams with unwritten buffered data are flushed, open streams are
22148 closed, or temporary files are removed when the abort or _Exit function is called
22149 (<a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.22.4.5">7.22.4.5</a>).
22150 -- The termination status returned to the host environment by the abort, exit,
22151 _Exit, or quick_exit function (<a href="#7.22.4.1">7.22.4.1</a>, <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>).
22152 -- The value returned by the system function when its argument is not a null pointer
22153 (<a href="#7.22.4.8">7.22.4.8</a>).
22154 -- The range and precision of times representable in clock_t and time_t (<a href="#7.27">7.27</a>). *
22155 -- The local time zone and Daylight Saving Time (<a href="#7.27.1">7.27.1</a>).
22156 -- The era for the clock function (<a href="#7.27.2.1">7.27.2.1</a>).
22157 -- The TIME_UTC epoch (<a href="#7.27.2.5">7.27.2.5</a>).
22158 -- The replacement string for the %Z specifier to the strftime, and wcsftime
22159 functions in the "C" locale (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
22160 -- Whether the functions in <a href="#7.12">&lt;math.h&gt;</a> honor the rounding direction mode in an
22161 IEC 60559 conformant implementation, unless explicitly specified otherwise (<a href="#F.10">F.10</a>).
22163 [<a name="p577" href="#p577">page 577</a>] (<a href="#Contents">Contents</a>)
22165 <a name="J.3.13" href="#J.3.13"><b> J.3.13 Architecture</b></a>
22166 1 -- The values or expressions assigned to the macros specified in the headers
22167 <a href="#7.7">&lt;float.h&gt;</a>, <a href="#7.10">&lt;limits.h&gt;</a>, and <a href="#7.20">&lt;stdint.h&gt;</a> (<a href="#5.2.4.2">5.2.4.2</a>, <a href="#7.20.2">7.20.2</a>, <a href="#7.20.3">7.20.3</a>).
22168 -- The result of attempting to indirectly access an object with automatic or thread
22169 storage duration from a thread other than the one with which it is associated (<a href="#6.2.4">6.2.4</a>).
22170 -- The number, order, and encoding of bytes in any object (when not explicitly specified
22171 in this International Standard) (<a href="#6.2.6.1">6.2.6.1</a>).
22172 -- Whether any extended alignments are supported and the contexts in which they are
22173 supported (<a href="#6.2.8">6.2.8</a>).
22174 -- Valid alignment values other than those returned by an _Alignof expression for
22175 fundamental types, if any (<a href="#6.2.8">6.2.8</a>).
22176 -- The value of the result of the sizeof and _Alignof operators (<a href="#6.5.3.4">6.5.3.4</a>).
22177 <a name="J.4" href="#J.4"><b> J.4 Locale-specific behavior</b></a>
22178 1 The following characteristics of a hosted environment are locale-specific and are required
22179 to be documented by the implementation:
22180 -- Additional members of the source and execution character sets beyond the basic
22181 character set (<a href="#5.2.1">5.2.1</a>).
22182 -- The presence, meaning, and representation of additional multibyte characters in the
22183 execution character set beyond the basic character set (<a href="#5.2.1.2">5.2.1.2</a>).
22184 -- The shift states used for the encoding of multibyte characters (<a href="#5.2.1.2">5.2.1.2</a>).
22185 -- The direction of writing of successive printing characters (<a href="#5.2.2">5.2.2</a>).
22186 -- The decimal-point character (<a href="#7.1.1">7.1.1</a>).
22187 -- The set of printing characters (<a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>).
22188 -- The set of control characters (<a href="#7.4">7.4</a>, <a href="#7.30.2">7.30.2</a>).
22189 -- The sets of characters tested for by the isalpha, isblank, islower, ispunct,
22190 isspace, isupper, iswalpha, iswblank, iswlower, iswpunct,
22191 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>,
22192 <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>).
22193 -- The native environment (<a href="#7.11.1.1">7.11.1.1</a>).
22194 -- Additional subject sequences accepted by the numeric conversion functions (<a href="#7.22.1">7.22.1</a>,
22195 <a href="#7.29.4.1">7.29.4.1</a>).
22196 -- The collation sequence of the execution character set (<a href="#7.24.4.3">7.24.4.3</a>, <a href="#7.29.4.4.2">7.29.4.4.2</a>).
22198 [<a name="p578" href="#p578">page 578</a>] (<a href="#Contents">Contents</a>)
22200 -- The contents of the error message strings set up by the strerror function
22201 (<a href="#7.24.6.2">7.24.6.2</a>).
22202 -- The formats for time and date (<a href="#7.27.3.5">7.27.3.5</a>, <a href="#7.29.5.1">7.29.5.1</a>).
22203 -- Character mappings that are supported by the towctrans function (<a href="#7.30.1">7.30.1</a>).
22204 -- Character classifications that are supported by the iswctype function (<a href="#7.30.1">7.30.1</a>).
22205 <a name="J.5" href="#J.5"><b> J.5 Common extensions</b></a>
22206 1 The following extensions are widely used in many systems, but are not portable to all
22207 implementations. The inclusion of any extension that may cause a strictly conforming
22208 program to become invalid renders an implementation nonconforming. Examples of such
22209 extensions are new keywords, extra library functions declared in standard headers, or
22210 predefined macros with names that do not begin with an underscore.
22211 <a name="J.5.1" href="#J.5.1"><b> J.5.1 Environment arguments</b></a>
22212 1 In a hosted environment, the main function receives a third argument, char *envp[],
22213 that points to a null-terminated array of pointers to char, each of which points to a string
22214 that provides information about the environment for this execution of the program
22215 (<a href="#5.1.2.2.1">5.1.2.2.1</a>).
22216 <a name="J.5.2" href="#J.5.2"><b> J.5.2 Specialized identifiers</b></a>
22217 1 Characters other than the underscore _, letters, and digits, that are not part of the basic
22218 source character set (such as the dollar sign $, or characters in national character sets)
22219 may appear in an identifier (<a href="#6.4.2">6.4.2</a>).
22220 <a name="J.5.3" href="#J.5.3"><b> J.5.3 Lengths and cases of identifiers</b></a>
22221 1 All characters in identifiers (with or without external linkage) are significant (<a href="#6.4.2">6.4.2</a>).
22222 <a name="J.5.4" href="#J.5.4"><b> J.5.4 Scopes of identifiers</b></a>
22223 1 A function identifier, or the identifier of an object the declaration of which contains the
22224 keyword extern, has file scope (<a href="#6.2.1">6.2.1</a>).
22225 <a name="J.5.5" href="#J.5.5"><b> J.5.5 Writable string literals</b></a>
22226 1 String literals are modifiable (in which case, identical string literals should denote distinct
22227 objects) (<a href="#6.4.5">6.4.5</a>).
22229 [<a name="p579" href="#p579">page 579</a>] (<a href="#Contents">Contents</a>)
22231 <a name="J.5.6" href="#J.5.6"><b> J.5.6 Other arithmetic types</b></a>
22232 1 Additional arithmetic types, such as __int128 or double double, and their
22233 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
22234 more range or precision than long double, may be used for evaluating expressions of
22235 other floating types, and may be used to define float_t or double_t. Additional
22236 floating types may also have less range or precision than float.
22237 <a name="J.5.7" href="#J.5.7"><b> J.5.7 Function pointer casts</b></a>
22238 1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
22239 be invoked as a function (<a href="#6.5.4">6.5.4</a>).
22240 2 A pointer to a function may be cast to a pointer to an object or to void, allowing a
22241 function to be inspected or modified (for example, by a debugger) (<a href="#6.5.4">6.5.4</a>).
22242 <a name="J.5.8" href="#J.5.8"><b> J.5.8 Extended bit-field types</b></a>
22243 1 A bit-field may be declared with a type other than _Bool, unsigned int, or
22244 signed int, with an appropriate maximum width (<a href="#6.7.2.1">6.7.2.1</a>).
22245 <a name="J.5.9" href="#J.5.9"><b> J.5.9 The fortran keyword</b></a>
22246 1 The fortran function specifier may be used in a function declaration to indicate that
22247 calls suitable for FORTRAN should be generated, or that a different representation for the
22248 external name is to be generated (<a href="#6.7.4">6.7.4</a>).
22249 <a name="J.5.10" href="#J.5.10"><b> J.5.10 The asm keyword</b></a>
22250 1 The asm keyword may be used to insert assembly language directly into the translator
22251 output (<a href="#6.8">6.8</a>). The most common implementation is via a statement of the form:
22252 asm ( character-string-literal );
22253 <a name="J.5.11" href="#J.5.11"><b> J.5.11 Multiple external definitions</b></a>
22254 1 There may be more than one external definition for the identifier of an object, with or
22255 without the explicit use of the keyword extern; if the definitions disagree, or more than
22256 one is initialized, the behavior is undefined (<a href="#6.9.2">6.9.2</a>).
22258 [<a name="p580" href="#p580">page 580</a>] (<a href="#Contents">Contents</a>)
22260 <a name="J.5.12" href="#J.5.12"><b> J.5.12 Predefined macro names</b></a>
22261 1 Macro names that do not begin with an underscore, describing the translation and
22262 execution environments, are defined by the implementation before translation begins
22263 (<a href="#6.10.8">6.10.8</a>).
22264 <a name="J.5.13" href="#J.5.13"><b> J.5.13 Floating-point status flags</b></a>
22265 1 If any floating-point status flags are set on normal termination after all calls to functions
22266 registered by the atexit function have been made (see <a href="#7.22.4.4">7.22.4.4</a>), the implementation
22267 writes some diagnostics indicating the fact to the stderr stream, if it is still open,
22268 <a name="J.5.14" href="#J.5.14"><b> J.5.14 Extra arguments for signal handlers</b></a>
22269 1 Handlers for specific signals are called with extra arguments in addition to the signal
22270 number (<a href="#7.14.1.1">7.14.1.1</a>).
22271 <a name="J.5.15" href="#J.5.15"><b> J.5.15 Additional stream types and file-opening modes</b></a>
22272 1 Additional mappings from files to streams are supported (<a href="#7.21.2">7.21.2</a>).
22273 2 Additional file-opening modes may be specified by characters appended to the mode
22274 argument of the fopen function (<a href="#7.21.5.3">7.21.5.3</a>).
22275 <a name="J.5.16" href="#J.5.16"><b> J.5.16 Defined file position indicator</b></a>
22276 1 The file position indicator is decremented by each successful call to the ungetc or
22277 ungetwc function for a text stream, except if its value was zero before a call (<a href="#7.21.7.10">7.21.7.10</a>,
22278 <a name="7.29.3.10)" href="#7.29.3.10)"><b> 7.29.3.10).</b></a>
22279 <a name="J.5.17" href="#J.5.17"><b> J.5.17 Math error reporting</b></a>
22280 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
22281 instead of, or in addition to, setting errno or raising floating-point exceptions (<a href="#7.3">7.3</a>,
22282 <a name="7.12)" href="#7.12)"><b> 7.12).</b></a>
22284 [<a name="p581" href="#p581">page 581</a>] (<a href="#Contents">Contents</a>)
22286 <a name="K" href="#K"><b> Annex K</b></a>
22287 (normative)
22288 Bounds-checking interfaces
22289 <a name="K.1" href="#K.1"><b> K.1 Background</b></a>
22290 1 Traditionally, the C Library has contained many functions that trust the programmer to
22291 provide output character arrays big enough to hold the result being produced. Not only
22292 do these functions not check that the arrays are big enough, they frequently lack the
22293 information needed to perform such checks. While it is possible to write safe, robust, and
22294 error-free code using the existing library, the library tends to promote programming styles
22295 that lead to mysterious failures if a result is too big for the provided array.
22296 2 A common programming style is to declare character arrays large enough to handle most
22297 practical cases. However, if these arrays are not large enough to handle the resulting
22298 strings, data can be written past the end of the array overwriting other data and program
22299 structures. The program never gets any indication that a problem exists, and so never has
22300 a chance to recover or to fail gracefully.
22301 3 Worse, this style of programming has compromised the security of computers and
22302 networks. Buffer overflows can often be exploited to run arbitrary code with the
22303 permissions of the vulnerable (defective) program.
22304 4 If the programmer writes runtime checks to verify lengths before calling library
22305 functions, then those runtime checks frequently duplicate work done inside the library
22306 functions, which discover string lengths as a side effect of doing their job.
22307 5 This annex provides alternative library functions that promote safer, more secure
22308 programming. The alternative functions verify that output buffers are large enough for
22309 the intended result and return a failure indicator if they are not. Data is never written past
22310 the end of an array. All string results are null terminated.
22311 6 This annex also addresses another problem that complicates writing robust code:
22312 functions that are not reentrant because they return pointers to static objects owned by the
22313 function. Such functions can be troublesome since a previously returned result can
22314 change if the function is called again, perhaps by another thread.
22316 [<a name="p582" href="#p582">page 582</a>] (<a href="#Contents">Contents</a>)
22318 <a name="K.2" href="#K.2"><b> K.2 Scope</b></a>
22319 1 This annex specifies a series of optional extensions that can be useful in the mitigation of
22320 security vulnerabilities in programs, and comprise new functions, macros, and types
22321 declared or defined in existing standard headers.
22322 2 An implementation that defines __STDC_LIB_EXT1__ shall conform to the
22323 specifications in this annex.<sup><a href="#note380"><b>380)</b></a></sup>
22324 3 Subclause <a href="#K.3">K.3</a> should be read as if it were merged into the parallel structure of named
22325 subclauses of clause 7.
22326 <a name="K.3" href="#K.3"><b> K.3 Library</b></a>
22327 <a name="K.3.1" href="#K.3.1"><b> K.3.1 Introduction</b></a>
22328 <a name="K.3.1.1" href="#K.3.1.1"><b> K.3.1.1 Standard headers</b></a>
22329 1 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are not
22330 declared or defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
22331 defined as a macro which expands to the integer constant 0 at the point in the source file
22332 where the appropriate header is first included.
22333 2 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are
22334 declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
22335 defined as a macro which expands to the integer constant 1 at the point in the source file
22336 where the appropriate header is first included.<sup><a href="#note381"><b>381)</b></a></sup>
22337 3 It is implementation-defined whether the functions, macros, and types declared or defined
22338 in <a href="#K.3">K.3</a> and its subclauses are declared or defined by their respective headers if
22339 __STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file
22340 where the appropriate header is first included.<sup><a href="#note382"><b>382)</b></a></sup>
22341 4 Within a preprocessing translation unit, __STDC_WANT_LIB_EXT1__ shall be
22342 defined identically for all inclusions of any headers from subclause <a href="#K.3">K.3</a>. If
22343 __STDC_WANT_LIB_EXT1__ is defined differently for any such inclusion, the
22344 implementation shall issue a diagnostic as if a preprocessor error directive were used.
22347 <sup><a name="note380" href="#note380"><b>380)</b></a></sup> Implementations that do not define __STDC_LIB_EXT1__ are not required to conform to these
22348 specifications.
22349 <sup><a name="note381" href="#note381"><b>381)</b></a></sup> Future revisions of this International Standard may define meanings for other values of
22350 __STDC_WANT_LIB_EXT1__.
22351 <sup><a name="note382" href="#note382"><b>382)</b></a></sup> Subclause <a href="#7.1.3">7.1.3</a> reserves certain names and patterns of names that an implementation may use in
22352 headers. All other names are not reserved, and a conforming implementation is not permitted to use
22353 them. While some of the names defined in <a href="#K.3">K.3</a> and its subclauses are reserved, others are not. If an
22354 unreserved name is defined in a header when __STDC_WANT_LIB_EXT1__ is defined as 0, the
22355 implementation is not conforming.
22357 [<a name="p583" href="#p583">page 583</a>] (<a href="#Contents">Contents</a>)
22359 <a name="K.3.1.2" href="#K.3.1.2"><b> K.3.1.2 Reserved identifiers</b></a>
22360 1 Each macro name in any of the following subclauses is reserved for use as specified if it
22361 is defined by any of its associated headers when included; unless explicitly stated
22362 otherwise (see <a href="#7.1.4">7.1.4</a>).
22363 2 All identifiers with external linkage in any of the following subclauses are reserved for
22364 use as identifiers with external linkage if any of them are used by the program. None of
22365 them are reserved if none of them are used.
22366 3 Each identifier with file scope listed in any of the following subclauses is reserved for use
22367 as a macro name and as an identifier with file scope in the same name space if it is
22368 defined by any of its associated headers when included.
22369 <a name="K.3.1.3" href="#K.3.1.3"><b> K.3.1.3 Use of errno</b></a>
22370 1 An implementation may set errno for the functions defined in this annex, but is not
22371 required to.
22372 <a name="K.3.1.4" href="#K.3.1.4"><b> K.3.1.4 Runtime-constraint violations</b></a>
22373 1 Most functions in this annex include as part of their specification a list of runtime-
22374 constraints. These runtime-constraints are requirements on the program using the
22375 library.<sup><a href="#note383"><b>383)</b></a></sup>
22376 2 Implementations shall verify that the runtime-constraints for a function are not violated
22377 by the program. If a runtime-constraint is violated, the implementation shall call the
22378 currently registered runtime-constraint handler (see set_constraint_handler_s
22379 in <a href="#7.22">&lt;stdlib.h&gt;</a>). Multiple runtime-constraint violations in the same call to a library
22380 function result in only one call to the runtime-constraint handler. It is unspecified which
22381 one of the multiple runtime-constraint violations cause the handler to be called.
22382 3 If the runtime-constraints section for a function states an action to be performed when a
22383 runtime-constraint violation occurs, the function shall perform the action before calling
22384 the runtime-constraint handler. If the runtime-constraints section lists actions that are
22385 prohibited when a runtime-constraint violation occurs, then such actions are prohibited to
22386 the function both before calling the handler and after the handler returns.
22387 4 The runtime-constraint handler might not return. If the handler does return, the library
22388 function whose runtime-constraint was violated shall return some indication of failure as
22389 given by the returns section in the function's specification.
22393 <sup><a name="note383" href="#note383"><b>383)</b></a></sup> Although runtime-constraints replace many cases of undefined behavior, undefined behavior still
22394 exists in this annex. Implementations are free to detect any case of undefined behavior and treat it as a
22395 runtime-constraint violation by calling the runtime-constraint handler. This license comes directly
22396 from the definition of undefined behavior.
22398 [<a name="p584" href="#p584">page 584</a>] (<a href="#Contents">Contents</a>)
22400 <a name="K.3.2" href="#K.3.2"><b> K.3.2 Errors &lt;errno.h&gt;</b></a>
22401 1 The header <a href="#7.5">&lt;errno.h&gt;</a> defines a type.
22402 2 The type is
22403 errno_t
22404 which is type int.<sup><a href="#note384"><b>384)</b></a></sup>
22405 <a name="K.3.3" href="#K.3.3"><b> K.3.3 Common definitions &lt;stddef.h&gt;</b></a>
22406 1 The header <a href="#7.19">&lt;stddef.h&gt;</a> defines a type.
22407 2 The type is
22408 rsize_t
22409 which is the type size_t.<sup><a href="#note385"><b>385)</b></a></sup>
22410 <a name="K.3.4" href="#K.3.4"><b> K.3.4 Integer types &lt;stdint.h&gt;</b></a>
22411 1 The header <a href="#7.20">&lt;stdint.h&gt;</a> defines a macro.
22412 2 The macro is
22413 RSIZE_MAX
22414 which expands to a value<sup><a href="#note386"><b>386)</b></a></sup> of type size_t. Functions that have parameters of type
22415 rsize_t consider it a runtime-constraint violation if the values of those parameters are
22416 greater than RSIZE_MAX.
22417 Recommended practice
22418 3 Extremely large object sizes are frequently a sign that an object's size was calculated
22419 incorrectly. For example, negative numbers appear as very large positive numbers when
22420 converted to an unsigned type like size_t. Also, some implementations do not support
22421 objects as large as the maximum value that can be represented by type size_t.
22422 4 For those reasons, it is sometimes beneficial to restrict the range of object sizes to detect
22423 programming errors. For implementations targeting machines with large address spaces,
22424 it is recommended that RSIZE_MAX be defined as the smaller of the size of the largest
22425 object supported or (SIZE_MAX &gt;&gt; 1), even if this limit is smaller than the size of
22426 some legitimate, but very large, objects. Implementations targeting machines with small
22427 address spaces may wish to define RSIZE_MAX as SIZE_MAX, which means that there
22429 <sup><a name="note384" href="#note384"><b>384)</b></a></sup> As a matter of programming style, errno_t may be used as the type of something that deals only
22430 with the values that might be found in errno. For example, a function which returns the value of
22431 errno might be declared as having the return type errno_t.
22432 <sup><a name="note385" href="#note385"><b>385)</b></a></sup> See the description of the RSIZE_MAX macro in <a href="#7.20">&lt;stdint.h&gt;</a>.
22433 <sup><a name="note386" href="#note386"><b>386)</b></a></sup> The macro RSIZE_MAX need not expand to a constant expression.
22435 [<a name="p585" href="#p585">page 585</a>] (<a href="#Contents">Contents</a>)
22437 is no object size that is considered a runtime-constraint violation.
22438 <a name="K.3.5" href="#K.3.5"><b> K.3.5 Input/output &lt;stdio.h&gt;</b></a>
22439 1 The header <a href="#7.21">&lt;stdio.h&gt;</a> defines several macros and two types.
22440 2 The macros are
22441 L_tmpnam_s
22442 which expands to an integer constant expression that is the size needed for an array of
22443 char large enough to hold a temporary file name string generated by the tmpnam_s
22444 function;
22445 TMP_MAX_S
22446 which expands to an integer constant expression that is the maximum number of unique
22447 file names that can be generated by the tmpnam_s function.
22448 3 The types are
22449 errno_t
22450 which is type int; and
22451 rsize_t
22452 which is the type size_t.
22453 <a name="K.3.5.1" href="#K.3.5.1"><b> K.3.5.1 Operations on files</b></a>
22454 <a name="K.3.5.1.1" href="#K.3.5.1.1"><b> K.3.5.1.1 The tmpfile_s function</b></a>
22455 <b> Synopsis</b>
22456 1 #define __STDC_WANT_LIB_EXT1__ 1
22457 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22458 errno_t tmpfile_s(FILE * restrict * restrict streamptr);
22459 Runtime-constraints
22460 2 streamptr shall not be a null pointer.
22461 3 If there is a runtime-constraint violation, tmpfile_s does not attempt to create a file.
22462 <b> Description</b>
22463 4 The tmpfile_s function creates a temporary binary file that is different from any other
22464 existing file and that will automatically be removed when it is closed or at program
22465 termination. If the program terminates abnormally, whether an open temporary file is
22466 removed is implementation-defined. The file is opened for update with "wb+" mode
22467 with the meaning that mode has in the fopen_s function (including the mode's effect
22468 on exclusive access and file permissions).
22470 [<a name="p586" href="#p586">page 586</a>] (<a href="#Contents">Contents</a>)
22472 5 If the file was created successfully, then the pointer to FILE pointed to by streamptr
22473 will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
22474 to FILE pointed to by streamptr will be set to a null pointer.
22475 Recommended practice
22476 It should be possible to open at least TMP_MAX_S temporary files during the lifetime of
22477 the program (this limit may be shared with tmpnam_s) and there should be no limit on
22478 the number simultaneously open other than this limit and any limit on the number of open
22479 files (FOPEN_MAX).
22480 <b> Returns</b>
22481 6 The tmpfile_s function returns zero if it created the file. If it did not create the file or
22482 there was a runtime-constraint violation, tmpfile_s returns a nonzero value.
22483 <a name="K.3.5.1.2" href="#K.3.5.1.2"><b> K.3.5.1.2 The tmpnam_s function</b></a>
22484 <b> Synopsis</b>
22485 1 #define __STDC_WANT_LIB_EXT1__ 1
22486 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22487 errno_t tmpnam_s(char *s, rsize_t maxsize);
22488 Runtime-constraints
22489 2 s shall not be a null pointer. maxsize shall be less than or equal to RSIZE_MAX.
22490 maxsize shall be greater than the length of the generated file name string.
22491 <b> Description</b>
22492 3 The tmpnam_s function generates a string that is a valid file name and that is not the
22493 same as the name of an existing file.<sup><a href="#note387"><b>387)</b></a></sup> The function is potentially capable of generating
22494 TMP_MAX_S different strings, but any or all of them may already be in use by existing
22495 files and thus not be suitable return values. The lengths of these strings shall be less than
22496 the value of the L_tmpnam_s macro.
22497 4 The tmpnam_s function generates a different string each time it is called.
22498 5 It is assumed that s points to an array of at least maxsize characters. This array will be
22499 set to generated string, as specified below.
22503 <sup><a name="note387" href="#note387"><b>387)</b></a></sup> Files created using strings generated by the tmpnam_s function are temporary only in the sense that
22504 their names should not collide with those generated by conventional naming rules for the
22505 implementation. It is still necessary to use the remove function to remove such files when their use
22506 is ended, and before program termination. Implementations should take care in choosing the patterns
22507 used for names returned by tmpnam_s. For example, making a thread id part of the names avoids the
22508 race condition and possible conflict when multiple programs run simultaneously by the same user
22509 generate the same temporary file names.
22511 [<a name="p587" href="#p587">page 587</a>] (<a href="#Contents">Contents</a>)
22513 6 The implementation shall behave as if no library function except tmpnam calls the
22514 tmpnam_s function.<sup><a href="#note388"><b>388)</b></a></sup>
22515 Recommended practice
22516 7 After a program obtains a file name using the tmpnam_s function and before the
22517 program creates a file with that name, the possibility exists that someone else may create
22518 a file with that same name. To avoid this race condition, the tmpfile_s function
22519 should be used instead of tmpnam_s when possible. One situation that requires the use
22520 of the tmpnam_s function is when the program needs to create a temporary directory
22521 rather than a temporary file.
22522 <b> Returns</b>
22523 8 If no suitable string can be generated, or if there is a runtime-constraint violation, the
22524 tmpnam_s function writes a null character to s[0] (only if s is not null and maxsize
22525 is greater than zero) and returns a nonzero value.
22526 9 Otherwise, the tmpnam_s function writes the string in the array pointed to by s and
22527 returns zero.
22528 Environmental limits
22529 10 The value of the macro TMP_MAX_S shall be at least 25.
22530 <a name="K.3.5.2" href="#K.3.5.2"><b> K.3.5.2 File access functions</b></a>
22531 <a name="K.3.5.2.1" href="#K.3.5.2.1"><b> K.3.5.2.1 The fopen_s function</b></a>
22532 <b> Synopsis</b>
22533 1 #define __STDC_WANT_LIB_EXT1__ 1
22534 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22535 errno_t fopen_s(FILE * restrict * restrict streamptr,
22536 const char * restrict filename,
22537 const char * restrict mode);
22538 Runtime-constraints
22539 2 None of streamptr, filename, or mode shall be a null pointer.
22540 3 If there is a runtime-constraint violation, fopen_s does not attempt to open a file.
22541 Furthermore, if streamptr is not a null pointer, fopen_s sets *streamptr to the
22542 null pointer.
22547 <sup><a name="note388" href="#note388"><b>388)</b></a></sup> An implementation may have tmpnam call tmpnam_s (perhaps so there is only one naming
22548 convention for temporary files), but this is not required.
22550 [<a name="p588" href="#p588">page 588</a>] (<a href="#Contents">Contents</a>)
22552 <b> Description</b>
22553 4 The fopen_s function opens the file whose name is the string pointed to by
22554 filename, and associates a stream with it.
22555 5 The mode string shall be as described for fopen, with the addition that modes starting
22556 with the character 'w' or 'a' may be preceded by the character 'u', see below:
22557 uw truncate to zero length or create text file for writing, default
22558 permissions
22559 uwx create text file for writing, default permissions
22560 ua append; open or create text file for writing at end-of-file, default
22561 permissions
22562 uwb truncate to zero length or create binary file for writing, default
22563 permissions
22564 uwbx create binary file for writing, default permissions
22565 uab append; open or create binary file for writing at end-of-file, default
22566 permissions
22567 uw+ truncate to zero length or create text file for update, default
22568 permissions
22569 uw+x create text file for update, default permissions
22570 ua+ append; open or create text file for update, writing at end-of-file,
22571 default permissions
22572 uw+b or uwb+ truncate to zero length or create binary file for update, default
22573 permissions
22574 uw+bx or uwb+x create binary file for update, default permissions
22575 ua+b or uab+ append; open or create binary file for update, writing at end-of-file,
22576 default permissions
22577 6 Opening a file with exclusive mode ('x' as the last character in the mode argument)
22578 fails if the file already exists or cannot be created.
22579 7 To the extent that the underlying system supports the concepts, files opened for writing
22580 shall be opened with exclusive (also known as non-shared) access. If the file is being
22581 created, and the first character of the mode string is not 'u', to the extent that the
22582 underlying system supports it, the file shall have a file permission that prevents other
22583 users on the system from accessing the file. If the file is being created and first character
22584 of the mode string is 'u', then by the time the file has been closed, it shall have the
22585 system default file access permissions.<sup><a href="#note389"><b>389)</b></a></sup>
22586 8 If the file was opened successfully, then the pointer to FILE pointed to by streamptr
22587 will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
22590 <sup><a name="note389" href="#note389"><b>389)</b></a></sup> These are the same permissions that the file would have been created with by fopen.
22592 [<a name="p589" href="#p589">page 589</a>] (<a href="#Contents">Contents</a>)
22594 to FILE pointed to by streamptr will be set to a null pointer.
22595 <b> Returns</b>
22596 9 The fopen_s function returns zero if it opened the file. If it did not open the file or if
22597 there was a runtime-constraint violation, fopen_s returns a nonzero value.
22598 <a name="K.3.5.2.2" href="#K.3.5.2.2"><b> K.3.5.2.2 The freopen_s function</b></a>
22599 <b> Synopsis</b>
22600 1 #define __STDC_WANT_LIB_EXT1__ 1
22601 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22602 errno_t freopen_s(FILE * restrict * restrict newstreamptr,
22603 const char * restrict filename,
22604 const char * restrict mode,
22605 FILE * restrict stream);
22606 Runtime-constraints
22607 2 None of newstreamptr, mode, and stream shall be a null pointer.
22608 3 If there is a runtime-constraint violation, freopen_s neither attempts to close any file
22609 associated with stream nor attempts to open a file. Furthermore, if newstreamptr is
22610 not a null pointer, fopen_s sets *newstreamptr to the null pointer.
22611 <b> Description</b>
22612 4 The freopen_s function opens the file whose name is the string pointed to by
22613 filename and associates the stream pointed to by stream with it. The mode
22614 argument has the same meaning as in the fopen_s function (including the mode's effect
22615 on exclusive access and file permissions).
22616 5 If filename is a null pointer, the freopen_s function attempts to change the mode of
22617 the stream to that specified by mode, as if the name of the file currently associated with
22618 the stream had been used. It is implementation-defined which changes of mode are
22619 permitted (if any), and under what circumstances.
22620 6 The freopen_s function first attempts to close any file that is associated with stream.
22621 Failure to close the file is ignored. The error and end-of-file indicators for the stream are
22622 cleared.
22623 7 If the file was opened successfully, then the pointer to FILE pointed to by
22624 newstreamptr will be set to the value of stream. Otherwise, the pointer to FILE
22625 pointed to by newstreamptr will be set to a null pointer.
22626 <b> Returns</b>
22627 8 The freopen_s function returns zero if it opened the file. If it did not open the file or
22628 there was a runtime-constraint violation, freopen_s returns a nonzero value.
22630 [<a name="p590" href="#p590">page 590</a>] (<a href="#Contents">Contents</a>)
22632 <a name="K.3.5.3" href="#K.3.5.3"><b> K.3.5.3 Formatted input/output functions</b></a>
22633 1 Unless explicitly stated otherwise, if the execution of a function described in this
22634 subclause causes copying to take place between objects that overlap, the objects take on
22635 unspecified values.
22636 <a name="K.3.5.3.1" href="#K.3.5.3.1"><b> K.3.5.3.1 The fprintf_s function</b></a>
22637 <b> Synopsis</b>
22638 1 #define __STDC_WANT_LIB_EXT1__ 1
22639 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22640 int fprintf_s(FILE * restrict stream,
22641 const char * restrict format, ...);
22642 Runtime-constraints
22643 2 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note390"><b>390)</b></a></sup> (modified or
22644 not by flags, field width, or precision) shall not appear in the string pointed to by
22645 format. Any argument to fprintf_s corresponding to a %s specifier shall not be a
22646 null pointer.
22647 3 If there is a runtime-constraint violation,<sup><a href="#note391"><b>391)</b></a></sup> the fprintf_s function does not attempt
22648 to produce further output, and it is unspecified to what extent fprintf_s produced
22649 output before discovering the runtime-constraint violation.
22650 <b> Description</b>
22651 4 The fprintf_s function is equivalent to the fprintf function except for the explicit
22652 runtime-constraints listed above.
22653 <b> Returns</b>
22654 5 The fprintf_s function returns the number of characters transmitted, or a negative
22655 value if an output error, encoding error, or runtime-constraint violation occurred.
22660 <sup><a name="note390" href="#note390"><b>390)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22661 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22662 format string was %%n.
22663 <sup><a name="note391" href="#note391"><b>391)</b></a></sup> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
22664 implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
22665 constraint violation.
22667 [<a name="p591" href="#p591">page 591</a>] (<a href="#Contents">Contents</a>)
22669 <a name="K.3.5.3.2" href="#K.3.5.3.2"><b> K.3.5.3.2 The fscanf_s function</b></a>
22670 <b> Synopsis</b>
22671 1 #define __STDC_WANT_LIB_EXT1__ 1
22672 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22673 int fscanf_s(FILE * restrict stream,
22674 const char * restrict format, ...);
22675 Runtime-constraints
22676 2 Neither stream nor format shall be a null pointer. Any argument indirected though in
22677 order to store converted input shall not be a null pointer.
22678 3 If there is a runtime-constraint violation,<sup><a href="#note392"><b>392)</b></a></sup> the fscanf_s function does not attempt to
22679 perform further input, and it is unspecified to what extent fscanf_s performed input
22680 before discovering the runtime-constraint violation.
22681 <b> Description</b>
22682 4 The fscanf_s function is equivalent to fscanf except that the c, s, and [ conversion
22683 specifiers apply to a pair of arguments (unless assignment suppression is indicated by a
22684 *). The first of these arguments is the same as for fscanf. That argument is
22685 immediately followed in the argument list by the second argument, which has type
22686 rsize_t and gives the number of elements in the array pointed to by the first argument
22687 of the pair. If the first argument points to a scalar object, it is considered to be an array of
22688 one element.<sup><a href="#note393"><b>393)</b></a></sup>
22689 5 A matching failure occurs if the number of elements in a receiving object is insufficient to
22690 hold the converted input (including any trailing null character).
22691 <b> Returns</b>
22692 6 The fscanf_s function returns the value of the macro EOF if an input failure occurs
22693 before any conversion or if there is a runtime-constraint violation. Otherwise, the
22695 <sup><a name="note392" href="#note392"><b>392)</b></a></sup> Because an implementation may treat any undefined behavior as a runtime-constraint violation, an
22696 implementation may treat any unsupported specifiers in the string pointed to by format as a runtime-
22697 constraint violation.
22698 <sup><a name="note393" href="#note393"><b>393)</b></a></sup> If the format is known at translation time, an implementation may issue a diagnostic for any argument
22699 used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
22700 argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
22701 the format is not known at translation time. For example, an implementation may issue a diagnostic
22702 for each argument after format that has of type pointer to one of char, signed char,
22703 unsigned char, or void that is not followed by an argument of a type compatible with
22704 rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
22705 using the hh length modifier, a length argument must follow the pointer argument. Another useful
22706 diagnostic could flag any non-pointer argument following format that did not have a type
22707 compatible with rsize_t.
22709 [<a name="p592" href="#p592">page 592</a>] (<a href="#Contents">Contents</a>)
22711 fscanf_s function returns the number of input items assigned, which can be fewer than
22712 provided for, or even zero, in the event of an early matching failure.
22713 7 EXAMPLE 1 The call:
22714 #define __STDC_WANT_LIB_EXT1__ 1
22715 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22716 /* ... */
22717 int n, i; float x; char name[50];
22718 n = fscanf_s(stdin, "%d%f%s", &amp;i, &amp;x, name, (rsize_t) 50);
22719 with the input line:
22720 25 54.32E-1 thompson
22721 will assign to n the value 3, to i the value 25, to x the value 5.432, and to name the sequence
22722 thompson\0.
22724 8 EXAMPLE 2 The call:
22725 #define __STDC_WANT_LIB_EXT1__ 1
22726 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22727 /* ... */
22728 int n; char s[5];
22729 n = fscanf_s(stdin, "%s", s, sizeof s);
22730 with the input line:
22731 hello
22732 will assign to n the value 0 since a matching failure occurred because the sequence hello\0 requires an
22733 array of six characters to store it.
22735 <a name="K.3.5.3.3" href="#K.3.5.3.3"><b> K.3.5.3.3 The printf_s function</b></a>
22736 <b> Synopsis</b>
22737 1 #define __STDC_WANT_LIB_EXT1__ 1
22738 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22739 int printf_s(const char * restrict format, ...);
22740 Runtime-constraints
22741 2 format shall not be a null pointer. The %n specifier<sup><a href="#note394"><b>394)</b></a></sup> (modified or not by flags, field
22742 width, or precision) shall not appear in the string pointed to by format. Any argument
22743 to printf_s corresponding to a %s specifier shall not be a null pointer.
22744 3 If there is a runtime-constraint violation, the printf_s function does not attempt to
22745 produce further output, and it is unspecified to what extent printf_s produced output
22746 before discovering the runtime-constraint violation.
22749 <sup><a name="note394" href="#note394"><b>394)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22750 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22751 format string was %%n.
22753 [<a name="p593" href="#p593">page 593</a>] (<a href="#Contents">Contents</a>)
22755 <b> Description</b>
22756 4 The printf_s function is equivalent to the printf function except for the explicit
22757 runtime-constraints listed above.
22758 <b> Returns</b>
22759 5 The printf_s function returns the number of characters transmitted, or a negative
22760 value if an output error, encoding error, or runtime-constraint violation occurred.
22761 <a name="K.3.5.3.4" href="#K.3.5.3.4"><b> K.3.5.3.4 The scanf_s function</b></a>
22762 <b> Synopsis</b>
22763 1 #define __STDC_WANT_LIB_EXT1__ 1
22764 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22765 int scanf_s(const char * restrict format, ...);
22766 Runtime-constraints
22767 2 format shall not be a null pointer. Any argument indirected though in order to store
22768 converted input shall not be a null pointer.
22769 3 If there is a runtime-constraint violation, the scanf_s function does not attempt to
22770 perform further input, and it is unspecified to what extent scanf_s performed input
22771 before discovering the runtime-constraint violation.
22772 <b> Description</b>
22773 4 The scanf_s function is equivalent to fscanf_s with the argument stdin
22774 interposed before the arguments to scanf_s.
22775 <b> Returns</b>
22776 5 The scanf_s function returns the value of the macro EOF if an input failure occurs
22777 before any conversion or if there is a runtime-constraint violation. Otherwise, the
22778 scanf_s function returns the number of input items assigned, which can be fewer than
22779 provided for, or even zero, in the event of an early matching failure.
22780 <a name="K.3.5.3.5" href="#K.3.5.3.5"><b> K.3.5.3.5 The snprintf_s function</b></a>
22781 <b> Synopsis</b>
22782 1 #define __STDC_WANT_LIB_EXT1__ 1
22783 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22784 int snprintf_s(char * restrict s, rsize_t n,
22785 const char * restrict format, ...);
22786 Runtime-constraints
22787 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
22788 than RSIZE_MAX. The %n specifier<sup><a href="#note395"><b>395)</b></a></sup> (modified or not by flags, field width, or
22789 precision) shall not appear in the string pointed to by format. Any argument to
22791 [<a name="p594" href="#p594">page 594</a>] (<a href="#Contents">Contents</a>)
22793 snprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
22794 error shall occur.
22795 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
22796 than zero and less than RSIZE_MAX, then the snprintf_s function sets s[0] to the
22797 null character.
22798 <b> Description</b>
22799 4 The snprintf_s function is equivalent to the snprintf function except for the
22800 explicit runtime-constraints listed above.
22801 5 The snprintf_s function, unlike sprintf_s, will truncate the result to fit within the
22802 array pointed to by s.
22803 <b> Returns</b>
22804 6 The snprintf_s function returns the number of characters that would have been
22805 written had n been sufficiently large, not counting the terminating null character, or a
22806 negative value if a runtime-constraint violation occurred. Thus, the null-terminated
22807 output has been completely written if and only if the returned value is nonnegative and
22808 less than n.
22809 <a name="K.3.5.3.6" href="#K.3.5.3.6"><b> K.3.5.3.6 The sprintf_s function</b></a>
22810 <b> Synopsis</b>
22811 1 #define __STDC_WANT_LIB_EXT1__ 1
22812 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22813 int sprintf_s(char * restrict s, rsize_t n,
22814 const char * restrict format, ...);
22815 Runtime-constraints
22816 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
22817 than RSIZE_MAX. The number of characters (including the trailing null) required for the
22818 result to be written to the array pointed to by s shall not be greater than n. The %n
22819 specifier<sup><a href="#note396"><b>396)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
22820 string pointed to by format. Any argument to sprintf_s corresponding to a %s
22821 specifier shall not be a null pointer. No encoding error shall occur.
22825 <sup><a name="note395" href="#note395"><b>395)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22826 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22827 format string was %%n.
22828 <sup><a name="note396" href="#note396"><b>396)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22829 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22830 format string was %%n.
22832 [<a name="p595" href="#p595">page 595</a>] (<a href="#Contents">Contents</a>)
22834 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
22835 than zero and less than RSIZE_MAX, then the sprintf_s function sets s[0] to the
22836 null character.
22837 <b> Description</b>
22838 4 The sprintf_s function is equivalent to the sprintf function except for the
22839 parameter n and the explicit runtime-constraints listed above.
22840 5 The sprintf_s function, unlike snprintf_s, treats a result too big for the array
22841 pointed to by s as a runtime-constraint violation.
22842 <b> Returns</b>
22843 6 If no runtime-constraint violation occurred, the sprintf_s function returns the number
22844 of characters written in the array, not counting the terminating null character. If an
22845 encoding error occurred, sprintf_s returns a negative value. If any other runtime-
22846 constraint violation occurred, sprintf_s returns zero.
22847 <a name="K.3.5.3.7" href="#K.3.5.3.7"><b> K.3.5.3.7 The sscanf_s function</b></a>
22848 <b> Synopsis</b>
22849 1 #define __STDC_WANT_LIB_EXT1__ 1
22850 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22851 int sscanf_s(const char * restrict s,
22852 const char * restrict format, ...);
22853 Runtime-constraints
22854 2 Neither s nor format shall be a null pointer. Any argument indirected though in order
22855 to store converted input shall not be a null pointer.
22856 3 If there is a runtime-constraint violation, the sscanf_s function does not attempt to
22857 perform further input, and it is unspecified to what extent sscanf_s performed input
22858 before discovering the runtime-constraint violation.
22859 <b> Description</b>
22860 4 The sscanf_s function is equivalent to fscanf_s, except that input is obtained from
22861 a string (specified by the argument s) rather than from a stream. Reaching the end of the
22862 string is equivalent to encountering end-of-file for the fscanf_s function. If copying
22863 takes place between objects that overlap, the objects take on unspecified values.
22864 <b> Returns</b>
22865 5 The sscanf_s function returns the value of the macro EOF if an input failure occurs
22866 before any conversion or if there is a runtime-constraint violation. Otherwise, the
22867 sscanf_s function returns the number of input items assigned, which can be fewer than
22868 provided for, or even zero, in the event of an early matching failure.
22870 [<a name="p596" href="#p596">page 596</a>] (<a href="#Contents">Contents</a>)
22872 <a name="K.3.5.3.8" href="#K.3.5.3.8"><b> K.3.5.3.8 The vfprintf_s function</b></a>
22873 <b> Synopsis</b>
22874 1 #define __STDC_WANT_LIB_EXT1__ 1
22875 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22876 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22877 int vfprintf_s(FILE * restrict stream,
22878 const char * restrict format,
22879 va_list arg);
22880 Runtime-constraints
22881 2 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note397"><b>397)</b></a></sup> (modified or
22882 not by flags, field width, or precision) shall not appear in the string pointed to by
22883 format. Any argument to vfprintf_s corresponding to a %s specifier shall not be a
22884 null pointer.
22885 3 If there is a runtime-constraint violation, the vfprintf_s function does not attempt to
22886 produce further output, and it is unspecified to what extent vfprintf_s produced
22887 output before discovering the runtime-constraint violation.
22888 <b> Description</b>
22889 4 The vfprintf_s function is equivalent to the vfprintf function except for the
22890 explicit runtime-constraints listed above.
22891 <b> Returns</b>
22892 5 The vfprintf_s function returns the number of characters transmitted, or a negative
22893 value if an output error, encoding error, or runtime-constraint violation occurred.
22894 <a name="K.3.5.3.9" href="#K.3.5.3.9"><b> K.3.5.3.9 The vfscanf_s function</b></a>
22895 <b> Synopsis</b>
22896 1 #define __STDC_WANT_LIB_EXT1__ 1
22897 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22898 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22899 int vfscanf_s(FILE * restrict stream,
22900 const char * restrict format,
22901 va_list arg);
22906 <sup><a name="note397" href="#note397"><b>397)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22907 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22908 format string was %%n.
22910 [<a name="p597" href="#p597">page 597</a>] (<a href="#Contents">Contents</a>)
22912 Runtime-constraints
22913 2 Neither stream nor format shall be a null pointer. Any argument indirected though in
22914 order to store converted input shall not be a null pointer.
22915 3 If there is a runtime-constraint violation, the vfscanf_s function does not attempt to
22916 perform further input, and it is unspecified to what extent vfscanf_s performed input
22917 before discovering the runtime-constraint violation.
22918 <b> Description</b>
22919 4 The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
22920 replaced by arg, which shall have been initialized by the va_start macro (and
22921 possibly subsequent va_arg calls). The vfscanf_s function does not invoke the
22922 va_end macro.<sup><a href="#note398"><b>398)</b></a></sup>
22923 <b> Returns</b>
22924 5 The vfscanf_s function returns the value of the macro EOF if an input failure occurs
22925 before any conversion or if there is a runtime-constraint violation. Otherwise, the
22926 vfscanf_s function returns the number of input items assigned, which can be fewer
22927 than provided for, or even zero, in the event of an early matching failure.
22928 <a name="K.3.5.3.10" href="#K.3.5.3.10"><b> K.3.5.3.10 The vprintf_s function</b></a>
22929 <b> Synopsis</b>
22930 1 #define __STDC_WANT_LIB_EXT1__ 1
22931 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22932 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22933 int vprintf_s(const char * restrict format,
22934 va_list arg);
22935 Runtime-constraints
22936 2 format shall not be a null pointer. The %n specifier<sup><a href="#note399"><b>399)</b></a></sup> (modified or not by flags, field
22937 width, or precision) shall not appear in the string pointed to by format. Any argument
22938 to vprintf_s corresponding to a %s specifier shall not be a null pointer.
22939 3 If there is a runtime-constraint violation, the vprintf_s function does not attempt to
22940 produce further output, and it is unspecified to what extent vprintf_s produced output
22941 before discovering the runtime-constraint violation.
22943 <sup><a name="note398" href="#note398"><b>398)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
22944 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
22945 indeterminate.
22946 <sup><a name="note399" href="#note399"><b>399)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
22947 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
22948 format string was %%n.
22950 [<a name="p598" href="#p598">page 598</a>] (<a href="#Contents">Contents</a>)
22952 <b> Description</b>
22953 4 The vprintf_s function is equivalent to the vprintf function except for the explicit
22954 runtime-constraints listed above.
22955 <b> Returns</b>
22956 5 The vprintf_s function returns the number of characters transmitted, or a negative
22957 value if an output error, encoding error, or runtime-constraint violation occurred.
22958 <a name="K.3.5.3.11" href="#K.3.5.3.11"><b> K.3.5.3.11 The vscanf_s function</b></a>
22959 <b> Synopsis</b>
22960 1 #define __STDC_WANT_LIB_EXT1__ 1
22961 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22962 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22963 int vscanf_s(const char * restrict format,
22964 va_list arg);
22965 Runtime-constraints
22966 2 format shall not be a null pointer. Any argument indirected though in order to store
22967 converted input shall not be a null pointer.
22968 3 If there is a runtime-constraint violation, the vscanf_s function does not attempt to
22969 perform further input, and it is unspecified to what extent vscanf_s performed input
22970 before discovering the runtime-constraint violation.
22971 <b> Description</b>
22972 4 The vscanf_s function is equivalent to scanf_s, with the variable argument list
22973 replaced by arg, which shall have been initialized by the va_start macro (and
22974 possibly subsequent va_arg calls). The vscanf_s function does not invoke the
22975 va_end macro.<sup><a href="#note400"><b>400)</b></a></sup>
22976 <b> Returns</b>
22977 5 The vscanf_s function returns the value of the macro EOF if an input failure occurs
22978 before any conversion or if there is a runtime-constraint violation. Otherwise, the
22979 vscanf_s function returns the number of input items assigned, which can be fewer than
22980 provided for, or even zero, in the event of an early matching failure.
22985 <sup><a name="note400" href="#note400"><b>400)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
22986 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
22987 indeterminate.
22989 [<a name="p599" href="#p599">page 599</a>] (<a href="#Contents">Contents</a>)
22991 <a name="K.3.5.3.12" href="#K.3.5.3.12"><b> K.3.5.3.12 The vsnprintf_s function</b></a>
22992 <b> Synopsis</b>
22993 1 #define __STDC_WANT_LIB_EXT1__ 1
22994 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
22995 #include <a href="#7.21">&lt;stdio.h&gt;</a>
22996 int vsnprintf_s(char * restrict s, rsize_t n,
22997 const char * restrict format,
22998 va_list arg);
22999 Runtime-constraints
23000 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
23001 than RSIZE_MAX. The %n specifier<sup><a href="#note401"><b>401)</b></a></sup> (modified or not by flags, field width, or
23002 precision) shall not appear in the string pointed to by format. Any argument to
23003 vsnprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
23004 error shall occur.
23005 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
23006 than zero and less than RSIZE_MAX, then the vsnprintf_s function sets s[0] to the
23007 null character.
23008 <b> Description</b>
23009 4 The vsnprintf_s function is equivalent to the vsnprintf function except for the
23010 explicit runtime-constraints listed above.
23011 5 The vsnprintf_s function, unlike vsprintf_s, will truncate the result to fit within
23012 the array pointed to by s.
23013 <b> Returns</b>
23014 6 The vsnprintf_s function returns the number of characters that would have been
23015 written had n been sufficiently large, not counting the terminating null character, or a
23016 negative value if a runtime-constraint violation occurred. Thus, the null-terminated
23017 output has been completely written if and only if the returned value is nonnegative and
23018 less than n.
23023 <sup><a name="note401" href="#note401"><b>401)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
23024 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
23025 format string was %%n.
23027 [<a name="p600" href="#p600">page 600</a>] (<a href="#Contents">Contents</a>)
23029 <a name="K.3.5.3.13" href="#K.3.5.3.13"><b> K.3.5.3.13 The vsprintf_s function</b></a>
23030 <b> Synopsis</b>
23031 1 #define __STDC_WANT_LIB_EXT1__ 1
23032 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
23033 #include <a href="#7.21">&lt;stdio.h&gt;</a>
23034 int vsprintf_s(char * restrict s, rsize_t n,
23035 const char * restrict format,
23036 va_list arg);
23037 Runtime-constraints
23038 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
23039 than RSIZE_MAX. The number of characters (including the trailing null) required for the
23040 result to be written to the array pointed to by s shall not be greater than n. The %n
23041 specifier<sup><a href="#note402"><b>402)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
23042 string pointed to by format. Any argument to vsprintf_s corresponding to a %s
23043 specifier shall not be a null pointer. No encoding error shall occur.
23044 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
23045 than zero and less than RSIZE_MAX, then the vsprintf_s function sets s[0] to the
23046 null character.
23047 <b> Description</b>
23048 4 The vsprintf_s function is equivalent to the vsprintf function except for the
23049 parameter n and the explicit runtime-constraints listed above.
23050 5 The vsprintf_s function, unlike vsnprintf_s, treats a result too big for the array
23051 pointed to by s as a runtime-constraint violation.
23052 <b> Returns</b>
23053 6 If no runtime-constraint violation occurred, the vsprintf_s function returns the
23054 number of characters written in the array, not counting the terminating null character. If
23055 an encoding error occurred, vsprintf_s returns a negative value. If any other
23056 runtime-constraint violation occurred, vsprintf_s returns zero.
23061 <sup><a name="note402" href="#note402"><b>402)</b></a></sup> It is not a runtime-constraint violation for the characters %n to appear in sequence in the string pointed
23062 at by format when those characters are not a interpreted as a %n specifier. For example, if the entire
23063 format string was %%n.
23065 [<a name="p601" href="#p601">page 601</a>] (<a href="#Contents">Contents</a>)
23067 <a name="K.3.5.3.14" href="#K.3.5.3.14"><b> K.3.5.3.14 The vsscanf_s function</b></a>
23068 <b> Synopsis</b>
23069 1 #define __STDC_WANT_LIB_EXT1__ 1
23070 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
23071 #include <a href="#7.21">&lt;stdio.h&gt;</a>
23072 int vsscanf_s(const char * restrict s,
23073 const char * restrict format,
23074 va_list arg);
23075 Runtime-constraints
23076 2 Neither s nor format shall be a null pointer. Any argument indirected though in order
23077 to store converted input shall not be a null pointer.
23078 3 If there is a runtime-constraint violation, the vsscanf_s function does not attempt to
23079 perform further input, and it is unspecified to what extent vsscanf_s performed input
23080 before discovering the runtime-constraint violation.
23081 <b> Description</b>
23082 4 The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
23083 replaced by arg, which shall have been initialized by the va_start macro (and
23084 possibly subsequent va_arg calls). The vsscanf_s function does not invoke the
23085 va_end macro.<sup><a href="#note403"><b>403)</b></a></sup>
23086 <b> Returns</b>
23087 5 The vsscanf_s function returns the value of the macro EOF if an input failure occurs
23088 before any conversion or if there is a runtime-constraint violation. Otherwise, the
23089 vscanf_s function returns the number of input items assigned, which can be fewer than
23090 provided for, or even zero, in the event of an early matching failure.
23091 <a name="K.3.5.4" href="#K.3.5.4"><b> K.3.5.4 Character input/output functions</b></a>
23092 <a name="K.3.5.4.1" href="#K.3.5.4.1"><b> K.3.5.4.1 The gets_s function</b></a>
23093 <b> Synopsis</b>
23094 1 #define __STDC_WANT_LIB_EXT1__ 1
23095 #include <a href="#7.21">&lt;stdio.h&gt;</a>
23096 char *gets_s(char *s, rsize_t n);
23101 <sup><a name="note403" href="#note403"><b>403)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
23102 vsprintf_s, and vsscanf_s invoke the va_arg macro, the value of arg after the return is
23103 indeterminate.
23105 [<a name="p602" href="#p602">page 602</a>] (<a href="#Contents">Contents</a>)
23107 Runtime-constraints
23108 2 s shall not be a null pointer. n shall neither be equal to zero nor be greater than
23109 RSIZE_MAX. A new-line character, end-of-file, or read error shall occur within reading
23110 n-1 characters from stdin.<sup><a href="#note404"><b>404)</b></a></sup>
23111 3 If there is a runtime-constraint violation, s[0] is set to the null character, and characters
23112 are read and discarded from stdin until a new-line character is read, or end-of-file or a
23113 read error occurs.
23114 <b> Description</b>
23115 4 The gets_s function reads at most one less than the number of characters specified by n
23116 from the stream pointed to by stdin, into the array pointed to by s. No additional
23117 characters are read after a new-line character (which is discarded) or after end-of-file.
23118 The discarded new-line character does not count towards number of characters read. A
23119 null character is written immediately after the last character read into the array.
23120 5 If end-of-file is encountered and no characters have been read into the array, or if a read
23121 error occurs during the operation, then s[0] is set to the null character, and the other
23122 elements of s take unspecified values.
23123 Recommended practice
23124 6 The fgets function allows properly-written programs to safely process input lines too
23125 long to store in the result array. In general this requires that callers of fgets pay
23126 attention to the presence or absence of a new-line character in the result array. Consider
23127 using fgets (along with any needed processing based on new-line characters) instead of
23128 gets_s.
23129 <b> Returns</b>
23130 7 The gets_s function returns s if successful. If there was a runtime-constraint violation,
23131 or if end-of-file is encountered and no characters have been read into the array, or if a
23132 read error occurs during the operation, then a null pointer is returned.
23137 <sup><a name="note404" href="#note404"><b>404)</b></a></sup> The gets_s function, unlike the historical gets function, makes it a runtime-constraint violation for
23138 a line of input to overflow the buffer to store it. Unlike the fgets function, gets_s maintains a
23139 one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets
23140 expect such a relationship.
23142 [<a name="p603" href="#p603">page 603</a>] (<a href="#Contents">Contents</a>)
23144 <a name="K.3.6" href="#K.3.6"><b> K.3.6 General utilities &lt;stdlib.h&gt;</b></a>
23145 1 The header <a href="#7.22">&lt;stdlib.h&gt;</a> defines three types.
23146 2 The types are
23147 errno_t
23148 which is type int; and
23149 rsize_t
23150 which is the type size_t; and
23151 constraint_handler_t
23152 which has the following definition
23153 typedef void (*constraint_handler_t)(
23154 const char * restrict msg,
23155 void * restrict ptr,
23156 errno_t error);
23157 <a name="K.3.6.1" href="#K.3.6.1"><b> K.3.6.1 Runtime-constraint handling</b></a>
23158 <a name="K.3.6.1.1" href="#K.3.6.1.1"><b> K.3.6.1.1 The set_constraint_handler_s function</b></a>
23159 <b> Synopsis</b>
23160 1 #define __STDC_WANT_LIB_EXT1__ 1
23161 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23162 constraint_handler_t set_constraint_handler_s(
23163 constraint_handler_t handler);
23164 <b> Description</b>
23165 2 The set_constraint_handler_s function sets the runtime-constraint handler to
23166 be handler. The runtime-constraint handler is the function to be called when a library
23167 function detects a runtime-constraint violation. Only the most recent handler registered
23168 with set_constraint_handler_s is called when a runtime-constraint violation
23169 occurs.
23170 3 When the handler is called, it is passed the following arguments in the following order:
23171 1. A pointer to a character string describing the runtime-constraint violation.
23172 2. A null pointer or a pointer to an implementation defined object.
23173 3. If the function calling the handler has a return type declared as errno_t, the
23174 return value of the function is passed. Otherwise, a positive value of type
23175 errno_t is passed.
23177 [<a name="p604" href="#p604">page 604</a>] (<a href="#Contents">Contents</a>)
23179 4 The implementation has a default constraint handler that is used if no calls to the
23180 set_constraint_handler_s function have been made. The behavior of the
23181 default handler is implementation-defined, and it may cause the program to exit or abort.
23182 5 If the handler argument to set_constraint_handler_s is a null pointer, the
23183 implementation default handler becomes the current constraint handler.
23184 <b> Returns</b>
23185 6 The set_constraint_handler_s function returns a pointer to the previously
23186 registered handler.<sup><a href="#note405"><b>405)</b></a></sup>
23187 <a name="K.3.6.1.2" href="#K.3.6.1.2"><b> K.3.6.1.2 The abort_handler_s function</b></a>
23188 <b> Synopsis</b>
23189 1 #define __STDC_WANT_LIB_EXT1__ 1
23190 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23191 void abort_handler_s(
23192 const char * restrict msg,
23193 void * restrict ptr,
23194 errno_t error);
23195 <b> Description</b>
23196 2 A pointer to the abort_handler_s function shall be a suitable argument to the
23197 set_constraint_handler_s function.
23198 3 The abort_handler_s function writes a message on the standard error stream in an
23199 implementation-defined format. The message shall include the string pointed to by msg.
23200 The abort_handler_s function then calls the abort function.<sup><a href="#note406"><b>406)</b></a></sup>
23201 <b> Returns</b>
23202 4 The abort_handler_s function does not return to its caller.
23207 <sup><a name="note405" href="#note405"><b>405)</b></a></sup> If the previous handler was registered by calling set_constraint_handler_s with a null
23208 pointer argument, a pointer to the implementation default handler is returned (not NULL).
23209 <sup><a name="note406" href="#note406"><b>406)</b></a></sup> Many implementations invoke a debugger when the abort function is called.
23211 [<a name="p605" href="#p605">page 605</a>] (<a href="#Contents">Contents</a>)
23213 <a name="K.3.6.1.3" href="#K.3.6.1.3"><b> K.3.6.1.3 The ignore_handler_s function</b></a>
23214 <b> Synopsis</b>
23215 1 #define __STDC_WANT_LIB_EXT1__ 1
23216 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23217 void ignore_handler_s(
23218 const char * restrict msg,
23219 void * restrict ptr,
23220 errno_t error);
23221 <b> Description</b>
23222 2 A pointer to the ignore_handler_s function shall be a suitable argument to the
23223 set_constraint_handler_s function.
23224 3 The ignore_handler_s function simply returns to its caller.<sup><a href="#note407"><b>407)</b></a></sup>
23225 <b> Returns</b>
23226 4 The ignore_handler_s function returns no value.
23227 <a name="K.3.6.2" href="#K.3.6.2"><b> K.3.6.2 Communication with the environment</b></a>
23228 <a name="K.3.6.2.1" href="#K.3.6.2.1"><b> K.3.6.2.1 The getenv_s function</b></a>
23229 <b> Synopsis</b>
23230 1 #define __STDC_WANT_LIB_EXT1__ 1
23231 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23232 errno_t getenv_s(size_t * restrict len,
23233 char * restrict value, rsize_t maxsize,
23234 const char * restrict name);
23235 Runtime-constraints
23236 2 name shall not be a null pointer. maxsize shall neither equal zero nor be greater than
23237 RSIZE_MAX. If maxsize is not equal to zero, then value shall not be a null pointer.
23238 3 If there is a runtime-constraint violation, the integer pointed to by len is set to 0 (if len
23239 is not null), and the environment list is not searched.
23240 <b> Description</b>
23241 4 The getenv_s function searches an environment list, provided by the host environment,
23242 for a string that matches the string pointed to by name.
23245 <sup><a name="note407" href="#note407"><b>407)</b></a></sup> If the runtime-constraint handler is set to the ignore_handler_s function, any library function in
23246 which a runtime-constraint violation occurs will return to its caller. The caller can determine whether
23247 a runtime-constraint violation occurred based on the library function's specification (usually, the
23248 library function returns a nonzero errno_t).
23250 [<a name="p606" href="#p606">page 606</a>] (<a href="#Contents">Contents</a>)
23252 5 If that name is found then getenv_s performs the following actions. If len is not a
23253 null pointer, the length of the string associated with the matched list member is stored in
23254 the integer pointed to by len. If the length of the associated string is less than maxsize,
23255 then the associated string is copied to the array pointed to by value.
23256 6 If that name is not found then getenv_s performs the following actions. If len is not
23257 a null pointer, zero is stored in the integer pointed to by len. If maxsize is greater than
23258 zero, then value[0] is set to the null character.
23259 7 The set of environment names and the method for altering the environment list are
23260 implementation-defined. The getenv_s function need not avoid data races with other
23261 threads of execution that modify the environment list.<sup><a href="#note408"><b>408)</b></a></sup>
23262 <b> Returns</b>
23263 8 The getenv_s function returns zero if the specified name is found and the associated
23264 string was successfully stored in value. Otherwise, a nonzero value is returned.
23265 <a name="K.3.6.3" href="#K.3.6.3"><b> K.3.6.3 Searching and sorting utilities</b></a>
23266 1 These utilities make use of a comparison function to search or sort arrays of unspecified
23267 type. Where an argument declared as size_t nmemb specifies the length of the array
23268 for a function, if nmemb has the value zero on a call to that function, then the comparison
23269 function is not called, a search finds no matching element, sorting performs no
23270 rearrangement, and the pointer to the array may be null.
23271 2 The implementation shall ensure that the second argument of the comparison function
23272 (when called from bsearch_s), or both arguments (when called from qsort_s), are
23273 pointers to elements of the array.<sup><a href="#note409"><b>409)</b></a></sup> The first argument when called from bsearch_s
23274 shall equal key.
23275 3 The comparison function shall not alter the contents of either the array or search key. The
23276 implementation may reorder elements of the array between calls to the comparison
23277 function, but shall not otherwise alter the contents of any individual element.
23278 4 When the same objects (consisting of size bytes, irrespective of their current positions
23279 in the array) are passed more than once to the comparison function, the results shall be
23280 consistent with one another. That is, for qsort_s they shall define a total ordering on
23281 the array, and for bsearch_s the same object shall always compare the same way with
23282 the key.
23284 <sup><a name="note408" href="#note408"><b>408)</b></a></sup> Many implementations provide non-standard functions that modify the environment list.
23285 <sup><a name="note409" href="#note409"><b>409)</b></a></sup> That is, if the value passed is p, then the following expressions are always valid and nonzero:
23286 ((char *)p - (char *)base) % size == 0
23287 (char *)p &gt;= (char *)base
23288 (char *)p &lt; (char *)base + nmemb * size
23290 [<a name="p607" href="#p607">page 607</a>] (<a href="#Contents">Contents</a>)
23292 5 A sequence point occurs immediately before and immediately after each call to the
23293 comparison function, and also between any call to the comparison function and any
23294 movement of the objects passed as arguments to that call.
23295 <a name="K.3.6.3.1" href="#K.3.6.3.1"><b> K.3.6.3.1 The bsearch_s function</b></a>
23296 <b> Synopsis</b>
23297 1 #define __STDC_WANT_LIB_EXT1__ 1
23298 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23299 void *bsearch_s(const void *key, const void *base,
23300 rsize_t nmemb, rsize_t size,
23301 int (*compar)(const void *k, const void *y,
23302 void *context),
23303 void *context);
23304 Runtime-constraints
23305 2 Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
23306 zero, then none of key, base, or compar shall be a null pointer.
23307 3 If there is a runtime-constraint violation, the bsearch_s function does not search the
23308 array.
23309 <b> Description</b>
23310 4 The bsearch_s function searches an array of nmemb objects, the initial element of
23311 which is pointed to by base, for an element that matches the object pointed to by key.
23312 The size of each element of the array is specified by size.
23313 5 The comparison function pointed to by compar is called with three arguments. The first
23314 two point to the key object and to an array element, in that order. The function shall
23315 return an integer less than, equal to, or greater than zero if the key object is considered,
23316 respectively, to be less than, to match, or to be greater than the array element. The array
23317 shall consist of: all the elements that compare less than, all the elements that compare
23318 equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note410"><b>410)</b></a></sup>
23319 The third argument to the comparison function is the context argument passed to
23320 bsearch_s. The sole use of context by bsearch_s is to pass it to the comparison
23321 function.<sup><a href="#note411"><b>411)</b></a></sup>
23326 <sup><a name="note410" href="#note410"><b>410)</b></a></sup> In practice, this means that the entire array has been sorted according to the comparison function.
23327 <sup><a name="note411" href="#note411"><b>411)</b></a></sup> The context argument is for the use of the comparison function in performing its duties. For
23328 example, it might specify a collating sequence used by the comparison function.
23330 [<a name="p608" href="#p608">page 608</a>] (<a href="#Contents">Contents</a>)
23332 <b> Returns</b>
23333 6 The bsearch_s function returns a pointer to a matching element of the array, or a null
23334 pointer if no match is found or there is a runtime-constraint violation. If two elements
23335 compare as equal, which element is matched is unspecified.
23336 <a name="K.3.6.3.2" href="#K.3.6.3.2"><b> K.3.6.3.2 The qsort_s function</b></a>
23337 <b> Synopsis</b>
23338 1 #define __STDC_WANT_LIB_EXT1__ 1
23339 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23340 errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size,
23341 int (*compar)(const void *x, const void *y,
23342 void *context),
23343 void *context);
23344 Runtime-constraints
23345 2 Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to
23346 zero, then neither base nor compar shall be a null pointer.
23347 3 If there is a runtime-constraint violation, the qsort_s function does not sort the array.
23348 <b> Description</b>
23349 4 The qsort_s function sorts an array of nmemb objects, the initial element of which is
23350 pointed to by base. The size of each object is specified by size.
23351 5 The contents of the array are sorted into ascending order according to a comparison
23352 function pointed to by compar, which is called with three arguments. The first two
23353 point to the objects being compared. The function shall return an integer less than, equal
23354 to, or greater than zero if the first argument is considered to be respectively less than,
23355 equal to, or greater than the second. The third argument to the comparison function is the
23356 context argument passed to qsort_s. The sole use of context by qsort_s is to
23357 pass it to the comparison function.<sup><a href="#note412"><b>412)</b></a></sup>
23358 6 If two elements compare as equal, their relative order in the resulting sorted array is
23359 unspecified.
23360 <b> Returns</b>
23361 7 The qsort_s function returns zero if there was no runtime-constraint violation.
23362 Otherwise, a nonzero value is returned.
23367 <sup><a name="note412" href="#note412"><b>412)</b></a></sup> The context argument is for the use of the comparison function in performing its duties. For
23368 example, it might specify a collating sequence used by the comparison function.
23370 [<a name="p609" href="#p609">page 609</a>] (<a href="#Contents">Contents</a>)
23372 <a name="K.3.6.4" href="#K.3.6.4"><b> K.3.6.4 Multibyte/wide character conversion functions</b></a>
23373 1 The behavior of the multibyte character functions is affected by the LC_CTYPE category
23374 of the current locale. For a state-dependent encoding, each function is placed into its
23375 initial conversion state by a call for which its character pointer argument, s, is a null
23376 pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
23377 state of the function to be altered as necessary. A call with s as a null pointer causes
23378 these functions to set the int pointed to by their status argument to a nonzero value if
23379 encodings have state dependency, and zero otherwise.<sup><a href="#note413"><b>413)</b></a></sup> Changing the LC_CTYPE
23380 category causes the conversion state of these functions to be indeterminate.
23381 <a name="K.3.6.4.1" href="#K.3.6.4.1"><b> K.3.6.4.1 The wctomb_s function</b></a>
23382 <b> Synopsis</b>
23383 1 #define __STDC_WANT_LIB_EXT1__ 1
23384 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23385 errno_t wctomb_s(int * restrict status,
23386 char * restrict s,
23387 rsize_t smax,
23388 wchar_t wc);
23389 Runtime-constraints
23390 2 Let n denote the number of bytes needed to represent the multibyte character
23391 corresponding to the wide character given by wc (including any shift sequences).
23392 3 If s is not a null pointer, then smax shall not be less than n, and smax shall not be
23393 greater than RSIZE_MAX. If s is a null pointer, then smax shall equal zero.
23394 4 If there is a runtime-constraint violation, wctomb_s does not modify the int pointed to
23395 by status, and if s is not a null pointer, no more than smax elements in the array
23396 pointed to by s will be accessed.
23397 <b> Description</b>
23398 5 The wctomb_s function determines n and stores the multibyte character representation
23399 of wc in the array whose first element is pointed to by s (if s is not a null pointer). The
23400 number of characters stored never exceeds MB_CUR_MAX or smax. If wc is a null wide
23401 character, a null byte is stored, preceded by any shift sequence needed to restore the
23402 initial shift state, and the function is left in the initial conversion state.
23403 6 The implementation shall behave as if no library function calls the wctomb_s function.
23407 <sup><a name="note413" href="#note413"><b>413)</b></a></sup> If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
23408 character codes, but are grouped with an adjacent multibyte character.
23410 [<a name="p610" href="#p610">page 610</a>] (<a href="#Contents">Contents</a>)
23412 7 If s is a null pointer, the wctomb_s function stores into the int pointed to by status a
23413 nonzero or zero value, if multibyte character encodings, respectively, do or do not have
23414 state-dependent encodings.
23415 8 If s is not a null pointer, the wctomb_s function stores into the int pointed to by
23416 status either n or -1 if wc, respectively, does or does not correspond to a valid
23417 multibyte character.
23418 9 In no case will the int pointed to by status be set to a value greater than the
23419 MB_CUR_MAX macro.
23420 <b> Returns</b>
23421 10 The wctomb_s function returns zero if successful, and a nonzero value if there was a
23422 runtime-constraint violation or wc did not correspond to a valid multibyte character.
23423 <a name="K.3.6.5" href="#K.3.6.5"><b> K.3.6.5 Multibyte/wide string conversion functions</b></a>
23424 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
23425 the current locale.
23426 <a name="K.3.6.5.1" href="#K.3.6.5.1"><b> K.3.6.5.1 The mbstowcs_s function</b></a>
23427 <b> Synopsis</b>
23428 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23429 errno_t mbstowcs_s(size_t * restrict retval,
23430 wchar_t * restrict dst, rsize_t dstmax,
23431 const char * restrict src, rsize_t len);
23432 Runtime-constraints
23433 2 Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
23434 neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
23435 then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
23436 zero. If dst is not a null pointer and len is not less than dstmax, then a null character
23437 shall occur within the first dstmax multibyte characters of the array pointed to by src.
23438 3 If there is a runtime-constraint violation, then mbstowcs_s does the following. If
23439 retval is not a null pointer, then mbstowcs_s sets *retval to (size_t)(-1). If
23440 dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
23441 then mbstowcs_s sets dst[0] to the null wide character.
23442 <b> Description</b>
23443 4 The mbstowcs_s function converts a sequence of multibyte characters that begins in
23444 the initial shift state from the array pointed to by src into a sequence of corresponding
23445 wide characters. If dst is not a null pointer, the converted characters are stored into the
23446 array pointed to by dst. Conversion continues up to and including a terminating null
23447 character, which is also stored. Conversion stops earlier in two cases: when a sequence of
23449 [<a name="p611" href="#p611">page 611</a>] (<a href="#Contents">Contents</a>)
23451 bytes is encountered that does not form a valid multibyte character, or (if dst is not a
23452 null pointer) when len wide characters have been stored into the array pointed to by
23453 dst.<sup><a href="#note414"><b>414)</b></a></sup> If dst is not a null pointer and no null wide character was stored into the array
23454 pointed to by dst, then dst[len] is set to the null wide character. Each conversion
23455 takes place as if by a call to the mbrtowc function.
23456 5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
23457 sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
23458 the mbstowcs_s function stores the value (size_t)(-1) into *retval.
23459 Otherwise, the mbstowcs_s function stores into *retval the number of multibyte
23460 characters successfully converted, not including the terminating null character (if any).
23461 6 All elements following the terminating null wide character (if any) written by
23462 mbstowcs_s in the array of dstmax wide characters pointed to by dst take
23463 unspecified values when mbstowcs_s returns.<sup><a href="#note415"><b>415)</b></a></sup>
23464 7 If copying takes place between objects that overlap, the objects take on unspecified
23465 values.
23466 <b> Returns</b>
23467 8 The mbstowcs_s function returns zero if no runtime-constraint violation and no
23468 encoding error occurred. Otherwise, a nonzero value is returned.
23469 <a name="K.3.6.5.2" href="#K.3.6.5.2"><b> K.3.6.5.2 The wcstombs_s function</b></a>
23470 <b> Synopsis</b>
23471 1 #include <a href="#7.22">&lt;stdlib.h&gt;</a>
23472 errno_t wcstombs_s(size_t * restrict retval,
23473 char * restrict dst, rsize_t dstmax,
23474 const wchar_t * restrict src, rsize_t len);
23475 Runtime-constraints
23476 2 Neither retval nor src shall be a null pointer. If dst is not a null pointer, then
23477 neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null pointer,
23478 then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall not equal
23479 zero. If dst is not a null pointer and len is not less than dstmax, then the conversion
23480 shall have been stopped (see below) because a terminating null wide character was
23481 reached or because an encoding error occurred.
23486 <sup><a name="note414" href="#note414"><b>414)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
23487 <sup><a name="note415" href="#note415"><b>415)</b></a></sup> This allows an implementation to attempt converting the multibyte string before discovering a
23488 terminating null character did not occur where required.
23490 [<a name="p612" href="#p612">page 612</a>] (<a href="#Contents">Contents</a>)
23492 3 If there is a runtime-constraint violation, then wcstombs_s does the following. If
23493 retval is not a null pointer, then wcstombs_s sets *retval to (size_t)(-1). If
23494 dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
23495 then wcstombs_s sets dst[0] to the null character.
23496 <b> Description</b>
23497 4 The wcstombs_s function converts a sequence of wide characters from the array
23498 pointed to by src into a sequence of corresponding multibyte characters that begins in
23499 the initial shift state. If dst is not a null pointer, the converted characters are then stored
23500 into the array pointed to by dst. Conversion continues up to and including a terminating
23501 null wide character, which is also stored. Conversion stops earlier in two cases:
23502 -- when a wide character is reached that does not correspond to a valid multibyte
23503 character;
23504 -- (if dst is not a null pointer) when the next multibyte character would exceed the
23505 limit of n total bytes to be stored into the array pointed to by dst. If the wide
23506 character being converted is the null wide character, then n is the lesser of len or
23507 dstmax. Otherwise, n is the lesser of len or dstmax-1.
23508 If the conversion stops without converting a null wide character and dst is not a null
23509 pointer, then a null character is stored into the array pointed to by dst immediately
23510 following any multibyte characters already stored. Each conversion takes place as if by a
23511 call to the wcrtomb function.<sup><a href="#note416"><b>416)</b></a></sup>
23512 5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
23513 wide character that does not correspond to a valid multibyte character, an encoding error
23514 occurs: the wcstombs_s function stores the value (size_t)(-1) into *retval.
23515 Otherwise, the wcstombs_s function stores into *retval the number of bytes in the
23516 resulting multibyte character sequence, not including the terminating null character (if
23517 any).
23518 6 All elements following the terminating null character (if any) written by wcstombs_s
23519 in the array of dstmax elements pointed to by dst take unspecified values when
23520 wcstombs_s returns.<sup><a href="#note417"><b>417)</b></a></sup>
23521 7 If copying takes place between objects that overlap, the objects take on unspecified
23522 values.
23525 <sup><a name="note416" href="#note416"><b>416)</b></a></sup> If conversion stops because a terminating null wide character has been reached, the bytes stored
23526 include those necessary to reach the initial shift state immediately before the null byte. However, if
23527 the conversion stops before a terminating null wide character has been reached, the result will be null
23528 terminated, but might not end in the initial shift state.
23529 <sup><a name="note417" href="#note417"><b>417)</b></a></sup> When len is not less than dstmax, the implementation might fill the array before discovering a
23530 runtime-constraint violation.
23532 [<a name="p613" href="#p613">page 613</a>] (<a href="#Contents">Contents</a>)
23534 <b> Returns</b>
23535 8 The wcstombs_s function returns zero if no runtime-constraint violation and no
23536 encoding error occurred. Otherwise, a nonzero value is returned.
23537 <a name="K.3.7" href="#K.3.7"><b> K.3.7 String handling &lt;string.h&gt;</b></a>
23538 1 The header <a href="#7.24">&lt;string.h&gt;</a> defines two types.
23539 2 The types are
23540 errno_t
23541 which is type int; and
23542 rsize_t
23543 which is the type size_t.
23544 <a name="K.3.7.1" href="#K.3.7.1"><b> K.3.7.1 Copying functions</b></a>
23545 <a name="K.3.7.1.1" href="#K.3.7.1.1"><b> K.3.7.1.1 The memcpy_s function</b></a>
23546 <b> Synopsis</b>
23547 1 #define __STDC_WANT_LIB_EXT1__ 1
23548 #include <a href="#7.24">&lt;string.h&gt;</a>
23549 errno_t memcpy_s(void * restrict s1, rsize_t s1max,
23550 const void * restrict s2, rsize_t n);
23551 Runtime-constraints
23552 2 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
23553 RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
23554 objects that overlap.
23555 3 If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first
23556 s1max characters of the object pointed to by s1 if s1 is not a null pointer and s1max is
23557 not greater than RSIZE_MAX.
23558 <b> Description</b>
23559 4 The memcpy_s function copies n characters from the object pointed to by s2 into the
23560 object pointed to by s1.
23561 <b> Returns</b>
23562 5 The memcpy_s function returns zero if there was no runtime-constraint violation.
23563 Otherwise, a nonzero value is returned.
23565 [<a name="p614" href="#p614">page 614</a>] (<a href="#Contents">Contents</a>)
23567 <a name="K.3.7.1.2" href="#K.3.7.1.2"><b> K.3.7.1.2 The memmove_s function</b></a>
23568 <b> Synopsis</b>
23569 1 #define __STDC_WANT_LIB_EXT1__ 1
23570 #include <a href="#7.24">&lt;string.h&gt;</a>
23571 errno_t memmove_s(void *s1, rsize_t s1max,
23572 const void *s2, rsize_t n);
23573 Runtime-constraints
23574 2 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
23575 RSIZE_MAX. n shall not be greater than s1max.
23576 3 If there is a runtime-constraint violation, the memmove_s function stores zeros in the
23577 first s1max characters of the object pointed to by s1 if s1 is not a null pointer and
23578 s1max is not greater than RSIZE_MAX.
23579 <b> Description</b>
23580 4 The memmove_s function copies n characters from the object pointed to by s2 into the
23581 object pointed to by s1. This copying takes place as if the n characters from the object
23582 pointed to by s2 are first copied into a temporary array of n characters that does not
23583 overlap the objects pointed to by s1 or s2, and then the n characters from the temporary
23584 array are copied into the object pointed to by s1.
23585 <b> Returns</b>
23586 5 The memmove_s function returns zero if there was no runtime-constraint violation.
23587 Otherwise, a nonzero value is returned.
23588 <a name="K.3.7.1.3" href="#K.3.7.1.3"><b> K.3.7.1.3 The strcpy_s function</b></a>
23589 <b> Synopsis</b>
23590 1 #define __STDC_WANT_LIB_EXT1__ 1
23591 #include <a href="#7.24">&lt;string.h&gt;</a>
23592 errno_t strcpy_s(char * restrict s1,
23593 rsize_t s1max,
23594 const char * restrict s2);
23595 Runtime-constraints
23596 2 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
23597 s1max shall not equal zero. s1max shall be greater than strnlen_s(s2, s1max).
23598 Copying shall not take place between objects that overlap.
23599 3 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
23600 greater than zero and not greater than RSIZE_MAX, then strcpy_s sets s1[0] to the
23601 null character.
23603 [<a name="p615" href="#p615">page 615</a>] (<a href="#Contents">Contents</a>)
23605 <b> Description</b>
23606 4 The strcpy_s function copies the string pointed to by s2 (including the terminating
23607 null character) into the array pointed to by s1.
23608 5 All elements following the terminating null character (if any) written by strcpy_s in
23609 the array of s1max characters pointed to by s1 take unspecified values when
23610 strcpy_s returns.<sup><a href="#note418"><b>418)</b></a></sup>
23611 <b> Returns</b>
23612 6 The strcpy_s function returns zero<sup><a href="#note419"><b>419)</b></a></sup> if there was no runtime-constraint violation.
23613 Otherwise, a nonzero value is returned.
23614 <a name="K.3.7.1.4" href="#K.3.7.1.4"><b> K.3.7.1.4 The strncpy_s function</b></a>
23615 <b> Synopsis</b>
23616 1 #define __STDC_WANT_LIB_EXT1__ 1
23617 #include <a href="#7.24">&lt;string.h&gt;</a>
23618 errno_t strncpy_s(char * restrict s1,
23619 rsize_t s1max,
23620 const char * restrict s2,
23621 rsize_t n);
23622 Runtime-constraints
23623 2 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
23624 RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
23625 shall be greater than strnlen_s(s2, s1max). Copying shall not take place between
23626 objects that overlap.
23627 3 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
23628 greater than zero and not greater than RSIZE_MAX, then strncpy_s sets s1[0] to the
23629 null character.
23630 <b> Description</b>
23631 4 The strncpy_s function copies not more than n successive characters (characters that
23632 follow a null character are not copied) from the array pointed to by s2 to the array
23633 pointed to by s1. If no null character was copied from s2, then s1[n] is set to a null
23634 character.
23637 <sup><a name="note418" href="#note418"><b>418)</b></a></sup> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
23638 any of those characters are null. Such an approach might write a character to every element of s1
23639 before discovering that the first element should be set to the null character.
23640 <sup><a name="note419" href="#note419"><b>419)</b></a></sup> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
23641 within the array pointed to by s1 and that the result in s1 is null terminated.
23643 [<a name="p616" href="#p616">page 616</a>] (<a href="#Contents">Contents</a>)
23645 5 All elements following the terminating null character (if any) written by strncpy_s in
23646 the array of s1max characters pointed to by s1 take unspecified values when
23647 strncpy_s returns.<sup><a href="#note420"><b>420)</b></a></sup>
23648 <b> Returns</b>
23649 6 The strncpy_s function returns zero<sup><a href="#note421"><b>421)</b></a></sup> if there was no runtime-constraint violation.
23650 Otherwise, a nonzero value is returned.
23651 7 EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result
23652 will not be null terminated or that characters will be written past the end of the destination array.
23653 #define __STDC_WANT_LIB_EXT1__ 1
23654 #include <a href="#7.24">&lt;string.h&gt;</a>
23655 /* ... */
23656 char src1[100] = "hello";
23657 char src2[7] = {'g', 'o', 'o', 'd', 'b', 'y', 'e'};
23658 char dst1[6], dst2[5], dst3[5];
23659 int r1, r2, r3;
23660 r1 = strncpy_s(dst1, 6, src1, 100);
23661 r2 = strncpy_s(dst2, 5, src2, 7);
23662 r3 = strncpy_s(dst3, 5, src2, 4);
23663 The first call will assign to r1 the value zero and to dst1 the sequence hello\0.
23664 The second call will assign to r2 a nonzero value and to dst2 the sequence \0.
23665 The third call will assign to r3 the value zero and to dst3 the sequence good\0.
23667 <a name="K.3.7.2" href="#K.3.7.2"><b> K.3.7.2 Concatenation functions</b></a>
23668 <a name="K.3.7.2.1" href="#K.3.7.2.1"><b> K.3.7.2.1 The strcat_s function</b></a>
23669 <b> Synopsis</b>
23670 1 #define __STDC_WANT_LIB_EXT1__ 1
23671 #include <a href="#7.24">&lt;string.h&gt;</a>
23672 errno_t strcat_s(char * restrict s1,
23673 rsize_t s1max,
23674 const char * restrict s2);
23675 Runtime-constraints
23676 2 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
23677 strcat_s.
23682 <sup><a name="note420" href="#note420"><b>420)</b></a></sup> This allows an implementation to copy characters from s2 to s1 while simultaneously checking if
23683 any of those characters are null. Such an approach might write a character to every element of s1
23684 before discovering that the first element should be set to the null character.
23685 <sup><a name="note421" href="#note421"><b>421)</b></a></sup> A zero return value implies that all of the requested characters from the string pointed to by s2 fit
23686 within the array pointed to by s1 and that the result in s1 is null terminated.
23688 [<a name="p617" href="#p617">page 617</a>] (<a href="#Contents">Contents</a>)
23690 3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
23691 s1max shall not equal zero. m shall not equal zero.<sup><a href="#note422"><b>422)</b></a></sup> m shall be greater than
23692 strnlen_s(s2, m). Copying shall not take place between objects that overlap.
23693 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
23694 greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the
23695 null character.
23696 <b> Description</b>
23697 5 The strcat_s function appends a copy of the string pointed to by s2 (including the
23698 terminating null character) to the end of the string pointed to by s1. The initial character
23699 from s2 overwrites the null character at the end of s1.
23700 6 All elements following the terminating null character (if any) written by strcat_s in
23701 the array of s1max characters pointed to by s1 take unspecified values when
23702 strcat_s returns.<sup><a href="#note423"><b>423)</b></a></sup>
23703 <b> Returns</b>
23704 7 The strcat_s function returns zero<sup><a href="#note424"><b>424)</b></a></sup> if there was no runtime-constraint violation.
23705 Otherwise, a nonzero value is returned.
23706 <a name="K.3.7.2.2" href="#K.3.7.2.2"><b> K.3.7.2.2 The strncat_s function</b></a>
23707 <b> Synopsis</b>
23708 1 #define __STDC_WANT_LIB_EXT1__ 1
23709 #include <a href="#7.24">&lt;string.h&gt;</a>
23710 errno_t strncat_s(char * restrict s1,
23711 rsize_t s1max,
23712 const char * restrict s2,
23713 rsize_t n);
23714 Runtime-constraints
23715 2 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
23716 strncat_s.
23717 3 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
23718 RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note425"><b>425)</b></a></sup> If n is not less
23721 <sup><a name="note422" href="#note422"><b>422)</b></a></sup> Zero means that s1 was not null terminated upon entry to strcat_s.
23722 <sup><a name="note423" href="#note423"><b>423)</b></a></sup> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
23723 any of those characters are null. Such an approach might write a character to every element of s1
23724 before discovering that the first element should be set to the null character.
23725 <sup><a name="note424" href="#note424"><b>424)</b></a></sup> A zero return value implies that all of the requested characters from the string pointed to by s2 were
23726 appended to the string pointed to by s1 and that the result in s1 is null terminated.
23728 [<a name="p618" href="#p618">page 618</a>] (<a href="#Contents">Contents</a>)
23730 than m, then m shall be greater than strnlen_s(s2, m). Copying shall not take
23731 place between objects that overlap.
23732 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
23733 greater than zero and not greater than RSIZE_MAX, then strncat_s sets s1[0] to the
23734 null character.
23735 <b> Description</b>
23736 5 The strncat_s function appends not more than n successive characters (characters
23737 that follow a null character are not copied) from the array pointed to by s2 to the end of
23738 the string pointed to by s1. The initial character from s2 overwrites the null character at
23739 the end of s1. If no null character was copied from s2, then s1[s1max-m+n] is set to
23740 a null character.
23741 6 All elements following the terminating null character (if any) written by strncat_s in
23742 the array of s1max characters pointed to by s1 take unspecified values when
23743 strncat_s returns.<sup><a href="#note426"><b>426)</b></a></sup>
23744 <b> Returns</b>
23745 7 The strncat_s function returns zero<sup><a href="#note427"><b>427)</b></a></sup> if there was no runtime-constraint violation.
23746 Otherwise, a nonzero value is returned.
23747 8 EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result
23748 will not be null terminated or that characters will be written past the end of the destination array.
23749 #define __STDC_WANT_LIB_EXT1__ 1
23750 #include <a href="#7.24">&lt;string.h&gt;</a>
23751 /* ... */
23752 char s1[100] = "good";
23753 char s2[6] = "hello";
23754 char s3[6] = "hello";
23755 char s4[7] = "abc";
23756 char s5[1000] = "bye";
23757 int r1, r2, r3, r4;
23758 r1 = strncat_s(s1, 100, s5, 1000);
23759 r2 = strncat_s(s2, 6, "", 1);
23760 r3 = strncat_s(s3, 6, "X", 2);
23761 r4 = strncat_s(s4, 7, "defghijklmn", 3);
23762 After the first call r1 will have the value zero and s1 will contain the sequence goodbye\0.
23766 <sup><a name="note425" href="#note425"><b>425)</b></a></sup> Zero means that s1 was not null terminated upon entry to strncat_s.
23767 <sup><a name="note426" href="#note426"><b>426)</b></a></sup> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
23768 any of those characters are null. Such an approach might write a character to every element of s1
23769 before discovering that the first element should be set to the null character.
23770 <sup><a name="note427" href="#note427"><b>427)</b></a></sup> A zero return value implies that all of the requested characters from the string pointed to by s2 were
23771 appended to the string pointed to by s1 and that the result in s1 is null terminated.
23773 [<a name="p619" href="#p619">page 619</a>] (<a href="#Contents">Contents</a>)
23775 After the second call r2 will have the value zero and s2 will contain the sequence hello\0.
23776 After the third call r3 will have a nonzero value and s3 will contain the sequence \0.
23777 After the fourth call r4 will have the value zero and s4 will contain the sequence abcdef\0.
23779 <a name="K.3.7.3" href="#K.3.7.3"><b> K.3.7.3 Search functions</b></a>
23780 <a name="K.3.7.3.1" href="#K.3.7.3.1"><b> K.3.7.3.1 The strtok_s function</b></a>
23781 <b> Synopsis</b>
23782 1 #define __STDC_WANT_LIB_EXT1__ 1
23783 #include <a href="#7.24">&lt;string.h&gt;</a>
23784 char *strtok_s(char * restrict s1,
23785 rsize_t * restrict s1max,
23786 const char * restrict s2,
23787 char ** restrict ptr);
23788 Runtime-constraints
23789 2 None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
23790 shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
23791 The end of the token found shall occur within the first *s1max characters of s1 for the
23792 first call, and shall occur within the first *s1max characters of where searching resumes
23793 on subsequent calls.
23794 3 If there is a runtime-constraint violation, the strtok_s function does not indirect
23795 through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
23796 <b> Description</b>
23797 4 A sequence of calls to the strtok_s function breaks the string pointed to by s1 into a
23798 sequence of tokens, each of which is delimited by a character from the string pointed to
23799 by s2. The fourth argument points to a caller-provided char pointer into which the
23800 strtok_s function stores information necessary for it to continue scanning the same
23801 string.
23802 5 The first call in a sequence has a non-null first argument and s1max points to an object
23803 whose value is the number of elements in the character array pointed to by the first
23804 argument. The first call stores an initial value in the object pointed to by ptr and
23805 updates the value pointed to by s1max to reflect the number of elements that remain in
23806 relation to ptr. Subsequent calls in the sequence have a null first argument and the
23807 objects pointed to by s1max and ptr are required to have the values stored by the
23808 previous call in the sequence, which are then updated. The separator string pointed to by
23809 s2 may be different from call to call.
23810 6 The first call in the sequence searches the string pointed to by s1 for the first character
23811 that is not contained in the current separator string pointed to by s2. If no such character
23812 is found, then there are no tokens in the string pointed to by s1 and the strtok_s
23813 function returns a null pointer. If such a character is found, it is the start of the first token.
23815 [<a name="p620" href="#p620">page 620</a>] (<a href="#Contents">Contents</a>)
23817 7 The strtok_s function then searches from there for the first character in s1 that is
23818 contained in the current separator string. If no such character is found, the current token
23819 extends to the end of the string pointed to by s1, and subsequent searches in the same
23820 string for a token return a null pointer. If such a character is found, it is overwritten by a
23821 null character, which terminates the current token.
23822 8 In all cases, the strtok_s function stores sufficient information in the pointer pointed
23823 to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
23824 value for ptr, shall start searching just past the element overwritten by a null character
23825 (if any).
23826 <b> Returns</b>
23827 9 The strtok_s function returns a pointer to the first character of a token, or a null
23828 pointer if there is no token or there is a runtime-constraint violation.
23829 10 EXAMPLE
23830 #define __STDC_WANT_LIB_EXT1__ 1
23831 #include <a href="#7.24">&lt;string.h&gt;</a>
23832 static char str1[] = "?a???b,,,#c";
23833 static char str2[] = "\t \t";
23834 char *t, *ptr1, *ptr2;
23835 rsize_t max1 = sizeof (str1);
23836 rsize_t max2 = sizeof (str2);
23837 t = strtok_s(str1, &amp;max1, "?", &amp;ptr1); // t points to the token "a"
23838 t = strtok_s(NULL, &amp;max1, ",", &amp;ptr1); // t points to the token "??b"
23839 t = strtok_s(str2, &amp;max2, " \t", &amp;ptr2); // t is a null pointer
23840 t = strtok_s(NULL, &amp;max1, "#,", &amp;ptr1); // t points to the token "c"
23841 t = strtok_s(NULL, &amp;max1, "?", &amp;ptr1); // t is a null pointer
23843 <a name="K.3.7.4" href="#K.3.7.4"><b> K.3.7.4 Miscellaneous functions</b></a>
23844 <a name="K.3.7.4.1" href="#K.3.7.4.1"><b> K.3.7.4.1 The memset_s function</b></a>
23845 <b> Synopsis</b>
23846 1 #define __STDC_WANT_LIB_EXT1__ 1
23847 #include <a href="#7.24">&lt;string.h&gt;</a>
23848 errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n)
23849 Runtime-constraints
23850 2 s shall not be a null pointer. Neither smax nor n shall be greater than RSIZE_MAX. n
23851 shall not be greater than smax.
23852 3 If there is a runtime-constraint violation, then if s is not a null pointer and smax is not
23853 greater than RSIZE_MAX, the memset_s function stores the value of c (converted to an
23854 unsigned char) into each of the first smax characters of the object pointed to by s.
23856 [<a name="p621" href="#p621">page 621</a>] (<a href="#Contents">Contents</a>)
23858 <b> Description</b>
23859 4 The memset_s function copies the value of c (converted to an unsigned char) into
23860 each of the first n characters of the object pointed to by s. Unlike memset, any call to
23861 the memset_s function shall be evaluated strictly according to the rules of the abstract
23862 machine as described in (<a href="#5.1.2.3">5.1.2.3</a>). That is, any call to the memset_s function shall
23863 assume that the memory indicated by s and n may be accessible in the future and thus
23864 must contain the values indicated by c.
23865 <b> Returns</b>
23866 5 The memset_s function returns zero if there was no runtime-constraint violation.
23867 Otherwise, a nonzero value is returned.
23868 <a name="K.3.7.4.2" href="#K.3.7.4.2"><b> K.3.7.4.2 The strerror_s function</b></a>
23869 <b> Synopsis</b>
23870 1 #define __STDC_WANT_LIB_EXT1__ 1
23871 #include <a href="#7.24">&lt;string.h&gt;</a>
23872 errno_t strerror_s(char *s, rsize_t maxsize,
23873 errno_t errnum);
23874 Runtime-constraints
23875 2 s shall not be a null pointer. maxsize shall not be greater than RSIZE_MAX.
23876 maxsize shall not equal zero.
23877 3 If there is a runtime-constraint violation, then the array (if any) pointed to by s is not
23878 modified.
23879 <b> Description</b>
23880 4 The strerror_s function maps the number in errnum to a locale-specific message
23881 string. Typically, the values for errnum come from errno, but strerror_s shall
23882 map any value of type int to a message.
23883 5 If the length of the desired string is less than maxsize, then the string is copied to the
23884 array pointed to by s.
23885 6 Otherwise, if maxsize is greater than zero, then maxsize-1 characters are copied
23886 from the string to the array pointed to by s and then s[maxsize-1] is set to the null
23887 character. Then, if maxsize is greater than 3, then s[maxsize-2],
23888 s[maxsize-3], and s[maxsize-4] are set to the character period (.).
23889 <b> Returns</b>
23890 7 The strerror_s function returns zero if the length of the desired string was less than
23891 maxsize and there was no runtime-constraint violation. Otherwise, the strerror_s
23892 function returns a nonzero value.
23894 [<a name="p622" href="#p622">page 622</a>] (<a href="#Contents">Contents</a>)
23896 <a name="K.3.7.4.3" href="#K.3.7.4.3"><b> K.3.7.4.3 The strerrorlen_s function</b></a>
23897 <b> Synopsis</b>
23898 1 #define __STDC_WANT_LIB_EXT1__ 1
23899 #include <a href="#7.24">&lt;string.h&gt;</a>
23900 size_t strerrorlen_s(errno_t errnum);
23901 <b> Description</b>
23902 2 The strerrorlen_s function calculates the length of the (untruncated) locale-specific
23903 message string that the strerror_s function maps to errnum.
23904 <b> Returns</b>
23905 3 The strerrorlen_s function returns the number of characters (not including the null
23906 character) in the full message string.
23907 <a name="K.3.7.4.4" href="#K.3.7.4.4"><b> K.3.7.4.4 The strnlen_s function</b></a>
23908 <b> Synopsis</b>
23909 1 #define __STDC_WANT_LIB_EXT1__ 1
23910 #include <a href="#7.24">&lt;string.h&gt;</a>
23911 size_t strnlen_s(const char *s, size_t maxsize);
23912 <b> Description</b>
23913 2 The strnlen_s function computes the length of the string pointed to by s.
23914 <b> Returns</b>
23915 3 If s is a null pointer,<sup><a href="#note428"><b>428)</b></a></sup> then the strnlen_s function returns zero.
23916 4 Otherwise, the strnlen_s function returns the number of characters that precede the
23917 terminating null character. If there is no null character in the first maxsize characters of
23918 s then strnlen_s returns maxsize. At most the first maxsize characters of s shall
23919 be accessed by strnlen_s.
23924 <sup><a name="note428" href="#note428"><b>428)</b></a></sup> Note that the strnlen_s function has no runtime-constraints. This lack of runtime-constraints
23925 along with the values returned for a null pointer or an unterminated string argument make
23926 strnlen_s useful in algorithms that gracefully handle such exceptional data.
23928 [<a name="p623" href="#p623">page 623</a>] (<a href="#Contents">Contents</a>)
23930 <a name="K.3.8" href="#K.3.8"><b> K.3.8 Date and time &lt;time.h&gt;</b></a>
23931 1 The header <a href="#7.27">&lt;time.h&gt;</a> defines two types.
23932 2 The types are
23933 errno_t
23934 which is type int; and
23935 rsize_t
23936 which is the type size_t.
23937 <a name="K.3.8.1" href="#K.3.8.1"><b> K.3.8.1 Components of time</b></a>
23938 1 A broken-down time is normalized if the values of the members of the tm structure are in
23939 their normal rages.<sup><a href="#note429"><b>429)</b></a></sup>
23940 <a name="K.3.8.2" href="#K.3.8.2"><b> K.3.8.2 Time conversion functions</b></a>
23941 1 Like the strftime function, the asctime_s and ctime_s functions do not return a
23942 pointer to a static object, and other library functions are permitted to call them.
23943 <a name="K.3.8.2.1" href="#K.3.8.2.1"><b> K.3.8.2.1 The asctime_s function</b></a>
23944 <b> Synopsis</b>
23945 1 #define __STDC_WANT_LIB_EXT1__ 1
23946 #include <a href="#7.27">&lt;time.h&gt;</a>
23947 errno_t asctime_s(char *s, rsize_t maxsize,
23948 const struct tm *timeptr);
23949 Runtime-constraints
23950 2 Neither s nor timeptr shall be a null pointer. maxsize shall not be less than 26 and
23951 shall not be greater than RSIZE_MAX. The broken-down time pointed to by timeptr
23952 shall be normalized. The calendar year represented by the broken-down time pointed to
23953 by timeptr shall not be less than calendar year 0 and shall not be greater than calendar
23954 year 9999.
23955 3 If there is a runtime-constraint violation, there is no attempt to convert the time, and
23956 s[0] is set to a null character if s is not a null pointer and maxsize is not zero and is
23957 not greater than RSIZE_MAX.
23958 <b> Description</b>
23959 4 The asctime_s function converts the normalized broken-down time in the structure
23960 pointed to by timeptr into a 26 character (including the null character) string in the
23963 <sup><a name="note429" href="#note429"><b>429)</b></a></sup> The normal ranges are defined in <a href="#7.27.1">7.27.1</a>.
23965 [<a name="p624" href="#p624">page 624</a>] (<a href="#Contents">Contents</a>)
23967 form
23968 Sun Sep 16 01:03:52 1973\n\0
23969 The fields making up this string are (in order):
23970 1. The name of the day of the week represented by timeptr-&gt;tm_wday using the
23971 following three character weekday names: Sun, Mon, Tue, Wed, Thu, Fri, and Sat.
23972 2. The character space.
23973 3. The name of the month represented by timeptr-&gt;tm_mon using the following
23974 three character month names: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct,
23975 Nov, and Dec.
23976 4. The character space.
23977 5. The value of timeptr-&gt;tm_mday as if printed using the fprintf format
23978 "%2d".
23979 6. The character space.
23980 7. The value of timeptr-&gt;tm_hour as if printed using the fprintf format
23981 "%.2d".
23982 8. The character colon.
23983 9. The value of timeptr-&gt;tm_min as if printed using the fprintf format
23984 "%.2d".
23985 10. The character colon.
23986 11. The value of timeptr-&gt;tm_sec as if printed using the fprintf format
23987 "%.2d".
23988 12. The character space.
23989 13. The value of timeptr-&gt;tm_year + 1900 as if printed using the fprintf
23990 format "%4d".
23991 14. The character new line.
23992 15. The null character.
23993 Recommended practice
23994 The strftime function allows more flexible formatting and supports locale-specific
23995 behavior. If you do not require the exact form of the result string produced by the
23996 asctime_s function, consider using the strftime function instead.
23997 <b> Returns</b>
23998 5 The asctime_s function returns zero if the time was successfully converted and stored
23999 into the array pointed to by s. Otherwise, it returns a nonzero value.
24001 [<a name="p625" href="#p625">page 625</a>] (<a href="#Contents">Contents</a>)
24003 <a name="K.3.8.2.2" href="#K.3.8.2.2"><b> K.3.8.2.2 The ctime_s function</b></a>
24004 <b> Synopsis</b>
24005 1 #define __STDC_WANT_LIB_EXT1__ 1
24006 #include <a href="#7.27">&lt;time.h&gt;</a>
24007 errno_t ctime_s(char *s, rsize_t maxsize,
24008 const time_t *timer);
24009 Runtime-constraints
24010 2 Neither s nor timer shall be a null pointer. maxsize shall not be less than 26 and
24011 shall not be greater than RSIZE_MAX.
24012 3 If there is a runtime-constraint violation, s[0] is set to a null character if s is not a null
24013 pointer and maxsize is not equal zero and is not greater than RSIZE_MAX.
24014 <b> Description</b>
24015 4 The ctime_s function converts the calendar time pointed to by timer to local time in
24016 the form of a string. It is equivalent to
24017 asctime_s(s, maxsize, localtime_s(timer))
24018 Recommended practice
24019 The strftime function allows more flexible formatting and supports locale-specific
24020 behavior. If you do not require the exact form of the result string produced by the
24021 ctime_s function, consider using the strftime function instead.
24022 <b> Returns</b>
24023 5 The ctime_s function returns zero if the time was successfully converted and stored
24024 into the array pointed to by s. Otherwise, it returns a nonzero value.
24025 <a name="K.3.8.2.3" href="#K.3.8.2.3"><b> K.3.8.2.3 The gmtime_s function</b></a>
24026 <b> Synopsis</b>
24027 1 #define __STDC_WANT_LIB_EXT1__ 1
24028 #include <a href="#7.27">&lt;time.h&gt;</a>
24029 struct tm *gmtime_s(const time_t * restrict timer,
24030 struct tm * restrict result);
24031 Runtime-constraints
24032 2 Neither timer nor result shall be a null pointer.
24033 3 If there is a runtime-constraint violation, there is no attempt to convert the time.
24034 <b> Description</b>
24035 4 The gmtime_s function converts the calendar time pointed to by timer into a broken-
24036 down time, expressed as UTC. The broken-down time is stored in the structure pointed
24038 [<a name="p626" href="#p626">page 626</a>] (<a href="#Contents">Contents</a>)
24040 to by result.
24041 <b> Returns</b>
24042 5 The gmtime_s function returns result, or a null pointer if the specified time cannot
24043 be converted to UTC or there is a runtime-constraint violation.
24044 <a name="K.3.8.2.4" href="#K.3.8.2.4"><b> K.3.8.2.4 The localtime_s function</b></a>
24045 <b> Synopsis</b>
24046 1 #define __STDC_WANT_LIB_EXT1__ 1
24047 #include <a href="#7.27">&lt;time.h&gt;</a>
24048 struct tm *localtime_s(const time_t * restrict timer,
24049 struct tm * restrict result);
24050 Runtime-constraints
24051 2 Neither timer nor result shall be a null pointer.
24052 3 If there is a runtime-constraint violation, there is no attempt to convert the time.
24053 <b> Description</b>
24054 4 The localtime_s function converts the calendar time pointed to by timer into a
24055 broken-down time, expressed as local time. The broken-down time is stored in the
24056 structure pointed to by result.
24057 <b> Returns</b>
24058 5 The localtime_s function returns result, or a null pointer if the specified time
24059 cannot be converted to local time or there is a runtime-constraint violation.
24060 <a name="K.3.9" href="#K.3.9"><b> K.3.9 Extended multibyte and wide character utilities &lt;wchar.h&gt;</b></a>
24061 1 The header <a href="#7.29">&lt;wchar.h&gt;</a> defines two types.
24062 2 The types are
24063 errno_t
24064 which is type int; and
24065 rsize_t
24066 which is the type size_t.
24067 3 Unless explicitly stated otherwise, if the execution of a function described in this
24068 subclause causes copying to take place between objects that overlap, the objects take on
24069 unspecified values.
24071 [<a name="p627" href="#p627">page 627</a>] (<a href="#Contents">Contents</a>)
24073 <a name="K.3.9.1" href="#K.3.9.1"><b> K.3.9.1 Formatted wide character input/output functions</b></a>
24074 <a name="K.3.9.1.1" href="#K.3.9.1.1"><b> K.3.9.1.1 The fwprintf_s function</b></a>
24075 <b> Synopsis</b>
24076 1 #define __STDC_WANT_LIB_EXT1__ 1
24077 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24078 int fwprintf_s(FILE * restrict stream,
24079 const wchar_t * restrict format, ...);
24080 Runtime-constraints
24081 2 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note430"><b>430)</b></a></sup> (modified or
24082 not by flags, field width, or precision) shall not appear in the wide string pointed to by
24083 format. Any argument to fwprintf_s corresponding to a %s specifier shall not be a
24084 null pointer.
24085 3 If there is a runtime-constraint violation, the fwprintf_s function does not attempt to
24086 produce further output, and it is unspecified to what extent fwprintf_s produced
24087 output before discovering the runtime-constraint violation.
24088 <b> Description</b>
24089 4 The fwprintf_s function is equivalent to the fwprintf function except for the
24090 explicit runtime-constraints listed above.
24091 <b> Returns</b>
24092 5 The fwprintf_s function returns the number of wide characters transmitted, or a
24093 negative value if an output error, encoding error, or runtime-constraint violation occurred.
24094 <a name="K.3.9.1.2" href="#K.3.9.1.2"><b> K.3.9.1.2 The fwscanf_s function</b></a>
24095 <b> Synopsis</b>
24096 1 #define __STDC_WANT_LIB_EXT1__ 1
24097 #include <a href="#7.21">&lt;stdio.h&gt;</a>
24098 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24099 int fwscanf_s(FILE * restrict stream,
24100 const wchar_t * restrict format, ...);
24101 Runtime-constraints
24102 2 Neither stream nor format shall be a null pointer. Any argument indirected though in
24103 order to store converted input shall not be a null pointer.
24106 <sup><a name="note430" href="#note430"><b>430)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24107 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24108 example, if the entire format string was L"%%n".
24110 [<a name="p628" href="#p628">page 628</a>] (<a href="#Contents">Contents</a>)
24112 3 If there is a runtime-constraint violation, the fwscanf_s function does not attempt to
24113 perform further input, and it is unspecified to what extent fwscanf_s performed input
24114 before discovering the runtime-constraint violation.
24115 <b> Description</b>
24116 4 The fwscanf_s function is equivalent to fwscanf except that the c, s, and [
24117 conversion specifiers apply to a pair of arguments (unless assignment suppression is
24118 indicated by a *). The first of these arguments is the same as for fwscanf. That
24119 argument is immediately followed in the argument list by the second argument, which has
24120 type size_t and gives the number of elements in the array pointed to by the first
24121 argument of the pair. If the first argument points to a scalar object, it is considered to be
24122 an array of one element.<sup><a href="#note431"><b>431)</b></a></sup>
24123 5 A matching failure occurs if the number of elements in a receiving object is insufficient to
24124 hold the converted input (including any trailing null character).
24125 <b> Returns</b>
24126 6 The fwscanf_s function returns the value of the macro EOF if an input failure occurs
24127 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24128 fwscanf_s function returns the number of input items assigned, which can be fewer
24129 than provided for, or even zero, in the event of an early matching failure.
24130 <a name="K.3.9.1.3" href="#K.3.9.1.3"><b> K.3.9.1.3 The snwprintf_s function</b></a>
24131 <b> Synopsis</b>
24132 1 #define __STDC_WANT_LIB_EXT1__ 1
24133 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24134 int snwprintf_s(wchar_t * restrict s,
24135 rsize_t n,
24136 const wchar_t * restrict format, ...);
24137 Runtime-constraints
24138 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
24139 than RSIZE_MAX. The %n specifier<sup><a href="#note432"><b>432)</b></a></sup> (modified or not by flags, field width, or
24141 <sup><a name="note431" href="#note431"><b>431)</b></a></sup> If the format is known at translation time, an implementation may issue a diagnostic for any argument
24142 used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
24143 argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
24144 the format is not known at translation time. For example, an implementation may issue a diagnostic
24145 for each argument after format that has of type pointer to one of char, signed char,
24146 unsigned char, or void that is not followed by an argument of a type compatible with
24147 rsize_t. The diagnostic could warn that unless the pointer is being used with a conversion specifier
24148 using the hh length modifier, a length argument must follow the pointer argument. Another useful
24149 diagnostic could flag any non-pointer argument following format that did not have a type
24150 compatible with rsize_t.
24152 [<a name="p629" href="#p629">page 629</a>] (<a href="#Contents">Contents</a>)
24154 precision) shall not appear in the wide string pointed to by format. Any argument to
24155 snwprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
24156 error shall occur.
24157 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
24158 than zero and less than RSIZE_MAX, then the snwprintf_s function sets s[0] to the
24159 null wide character.
24160 <b> Description</b>
24161 4 The snwprintf_s function is equivalent to the swprintf function except for the
24162 explicit runtime-constraints listed above.
24163 5 The snwprintf_s function, unlike swprintf_s, will truncate the result to fit within
24164 the array pointed to by s.
24165 <b> Returns</b>
24166 6 The snwprintf_s function returns the number of wide characters that would have
24167 been written had n been sufficiently large, not counting the terminating wide null
24168 character, or a negative value if a runtime-constraint violation occurred. Thus, the null-
24169 terminated output has been completely written if and only if the returned value is
24170 nonnegative and less than n.
24171 <a name="K.3.9.1.4" href="#K.3.9.1.4"><b> K.3.9.1.4 The swprintf_s function</b></a>
24172 <b> Synopsis</b>
24173 1 #define __STDC_WANT_LIB_EXT1__ 1
24174 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24175 int swprintf_s(wchar_t * restrict s, rsize_t n,
24176 const wchar_t * restrict format, ...);
24177 Runtime-constraints
24178 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
24179 than RSIZE_MAX. The number of wide characters (including the trailing null) required
24180 for the result to be written to the array pointed to by s shall not be greater than n. The %n
24181 specifier<sup><a href="#note433"><b>433)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
24182 wide string pointed to by format. Any argument to swprintf_s corresponding to a
24183 %s specifier shall not be a null pointer. No encoding error shall occur.
24186 <sup><a name="note432" href="#note432"><b>432)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24187 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24188 example, if the entire format string was L"%%n".
24189 <sup><a name="note433" href="#note433"><b>433)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24190 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24191 example, if the entire format string was L"%%n".
24193 [<a name="p630" href="#p630">page 630</a>] (<a href="#Contents">Contents</a>)
24195 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
24196 than zero and less than RSIZE_MAX, then the swprintf_s function sets s[0] to the
24197 null wide character.
24198 <b> Description</b>
24199 4 The swprintf_s function is equivalent to the swprintf function except for the
24200 explicit runtime-constraints listed above.
24201 5 The swprintf_s function, unlike snwprintf_s, treats a result too big for the array
24202 pointed to by s as a runtime-constraint violation.
24203 <b> Returns</b>
24204 6 If no runtime-constraint violation occurred, the swprintf_s function returns the
24205 number of wide characters written in the array, not counting the terminating null wide
24206 character. If an encoding error occurred or if n or more wide characters are requested to
24207 be written, swprintf_s returns a negative value. If any other runtime-constraint
24208 violation occurred, swprintf_s returns zero.
24209 <a name="K.3.9.1.5" href="#K.3.9.1.5"><b> K.3.9.1.5 The swscanf_s function</b></a>
24210 <b> Synopsis</b>
24211 1 #define __STDC_WANT_LIB_EXT1__ 1
24212 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24213 int swscanf_s(const wchar_t * restrict s,
24214 const wchar_t * restrict format, ...);
24215 Runtime-constraints
24216 2 Neither s nor format shall be a null pointer. Any argument indirected though in order
24217 to store converted input shall not be a null pointer.
24218 3 If there is a runtime-constraint violation, the swscanf_s function does not attempt to
24219 perform further input, and it is unspecified to what extent swscanf_s performed input
24220 before discovering the runtime-constraint violation.
24221 <b> Description</b>
24222 4 The swscanf_s function is equivalent to fwscanf_s, except that the argument s
24223 specifies a wide string from which the input is to be obtained, rather than from a stream.
24224 Reaching the end of the wide string is equivalent to encountering end-of-file for the
24225 fwscanf_s function.
24226 <b> Returns</b>
24227 5 The swscanf_s function returns the value of the macro EOF if an input failure occurs
24228 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24229 swscanf_s function returns the number of input items assigned, which can be fewer
24230 than provided for, or even zero, in the event of an early matching failure.
24232 [<a name="p631" href="#p631">page 631</a>] (<a href="#Contents">Contents</a>)
24234 <a name="K.3.9.1.6" href="#K.3.9.1.6"><b> K.3.9.1.6 The vfwprintf_s function</b></a>
24235 <b> Synopsis</b>
24236 1 #define __STDC_WANT_LIB_EXT1__ 1
24237 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24238 #include <a href="#7.21">&lt;stdio.h&gt;</a>
24239 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24240 int vfwprintf_s(FILE * restrict stream,
24241 const wchar_t * restrict format,
24242 va_list arg);
24243 Runtime-constraints
24244 2 Neither stream nor format shall be a null pointer. The %n specifier<sup><a href="#note434"><b>434)</b></a></sup> (modified or
24245 not by flags, field width, or precision) shall not appear in the wide string pointed to by
24246 format. Any argument to vfwprintf_s corresponding to a %s specifier shall not be
24247 a null pointer.
24248 3 If there is a runtime-constraint violation, the vfwprintf_s function does not attempt
24249 to produce further output, and it is unspecified to what extent vfwprintf_s produced
24250 output before discovering the runtime-constraint violation.
24251 <b> Description</b>
24252 4 The vfwprintf_s function is equivalent to the vfwprintf function except for the
24253 explicit runtime-constraints listed above.
24254 <b> Returns</b>
24255 5 The vfwprintf_s function returns the number of wide characters transmitted, or a
24256 negative value if an output error, encoding error, or runtime-constraint violation occurred.
24257 <a name="K.3.9.1.7" href="#K.3.9.1.7"><b> K.3.9.1.7 The vfwscanf_s function</b></a>
24258 <b> Synopsis</b>
24259 1 #define __STDC_WANT_LIB_EXT1__ 1
24260 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24261 #include <a href="#7.21">&lt;stdio.h&gt;</a>
24262 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24263 int vfwscanf_s(FILE * restrict stream,
24264 const wchar_t * restrict format, va_list arg);
24268 <sup><a name="note434" href="#note434"><b>434)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24269 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24270 example, if the entire format string was L"%%n".
24272 [<a name="p632" href="#p632">page 632</a>] (<a href="#Contents">Contents</a>)
24274 Runtime-constraints
24275 2 Neither stream nor format shall be a null pointer. Any argument indirected though in
24276 order to store converted input shall not be a null pointer.
24277 3 If there is a runtime-constraint violation, the vfwscanf_s function does not attempt to
24278 perform further input, and it is unspecified to what extent vfwscanf_s performed input
24279 before discovering the runtime-constraint violation.
24280 <b> Description</b>
24281 4 The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument
24282 list replaced by arg, which shall have been initialized by the va_start macro (and
24283 possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the
24284 va_end macro.<sup><a href="#note435"><b>435)</b></a></sup>
24285 <b> Returns</b>
24286 5 The vfwscanf_s function returns the value of the macro EOF if an input failure occurs
24287 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24288 vfwscanf_s function returns the number of input items assigned, which can be fewer
24289 than provided for, or even zero, in the event of an early matching failure.
24290 <a name="K.3.9.1.8" href="#K.3.9.1.8"><b> K.3.9.1.8 The vsnwprintf_s function</b></a>
24291 <b> Synopsis</b>
24292 1 #define __STDC_WANT_LIB_EXT1__ 1
24293 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24294 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24295 int vsnwprintf_s(wchar_t * restrict s,
24296 rsize_t n,
24297 const wchar_t * restrict format,
24298 va_list arg);
24299 Runtime-constraints
24300 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
24301 than RSIZE_MAX. The %n specifier<sup><a href="#note436"><b>436)</b></a></sup> (modified or not by flags, field width, or
24302 precision) shall not appear in the wide string pointed to by format. Any argument to
24303 vsnwprintf_s corresponding to a %s specifier shall not be a null pointer. No
24304 encoding error shall occur.
24306 <sup><a name="note435" href="#note435"><b>435)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
24307 value of arg after the return is indeterminate.
24308 <sup><a name="note436" href="#note436"><b>436)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24309 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24310 example, if the entire format string was L"%%n".
24312 [<a name="p633" href="#p633">page 633</a>] (<a href="#Contents">Contents</a>)
24314 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
24315 than zero and less than RSIZE_MAX, then the vsnwprintf_s function sets s[0] to
24316 the null wide character.
24317 <b> Description</b>
24318 4 The vsnwprintf_s function is equivalent to the vswprintf function except for the
24319 explicit runtime-constraints listed above.
24320 5 The vsnwprintf_s function, unlike vswprintf_s, will truncate the result to fit
24321 within the array pointed to by s.
24322 <b> Returns</b>
24323 6 The vsnwprintf_s function returns the number of wide characters that would have
24324 been written had n been sufficiently large, not counting the terminating null character, or
24325 a negative value if a runtime-constraint violation occurred. Thus, the null-terminated
24326 output has been completely written if and only if the returned value is nonnegative and
24327 less than n.
24328 <a name="K.3.9.1.9" href="#K.3.9.1.9"><b> K.3.9.1.9 The vswprintf_s function</b></a>
24329 <b> Synopsis</b>
24330 1 #define __STDC_WANT_LIB_EXT1__ 1
24331 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24332 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24333 int vswprintf_s(wchar_t * restrict s,
24334 rsize_t n,
24335 const wchar_t * restrict format,
24336 va_list arg);
24337 Runtime-constraints
24338 2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
24339 than RSIZE_MAX. The number of wide characters (including the trailing null) required
24340 for the result to be written to the array pointed to by s shall not be greater than n. The %n
24341 specifier<sup><a href="#note437"><b>437)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
24342 wide string pointed to by format. Any argument to vswprintf_s corresponding to a
24343 %s specifier shall not be a null pointer. No encoding error shall occur.
24344 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
24345 than zero and less than RSIZE_MAX, then the vswprintf_s function sets s[0] to the
24346 null wide character.
24348 <sup><a name="note437" href="#note437"><b>437)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24349 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24350 example, if the entire format string was L"%%n".
24352 [<a name="p634" href="#p634">page 634</a>] (<a href="#Contents">Contents</a>)
24354 <b> Description</b>
24355 4 The vswprintf_s function is equivalent to the vswprintf function except for the
24356 explicit runtime-constraints listed above.
24357 5 The vswprintf_s function, unlike vsnwprintf_s, treats a result too big for the
24358 array pointed to by s as a runtime-constraint violation.
24359 <b> Returns</b>
24360 6 If no runtime-constraint violation occurred, the vswprintf_s function returns the
24361 number of wide characters written in the array, not counting the terminating null wide
24362 character. If an encoding error occurred or if n or more wide characters are requested to
24363 be written, vswprintf_s returns a negative value. If any other runtime-constraint
24364 violation occurred, vswprintf_s returns zero.
24365 <a name="K.3.9.1.10" href="#K.3.9.1.10"><b> K.3.9.1.10 The vswscanf_s function</b></a>
24366 <b> Synopsis</b>
24367 1 #define __STDC_WANT_LIB_EXT1__ 1
24368 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24369 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24370 int vswscanf_s(const wchar_t * restrict s,
24371 const wchar_t * restrict format,
24372 va_list arg);
24373 Runtime-constraints
24374 2 Neither s nor format shall be a null pointer. Any argument indirected though in order
24375 to store converted input shall not be a null pointer.
24376 3 If there is a runtime-constraint violation, the vswscanf_s function does not attempt to
24377 perform further input, and it is unspecified to what extent vswscanf_s performed input
24378 before discovering the runtime-constraint violation.
24379 <b> Description</b>
24380 4 The vswscanf_s function is equivalent to swscanf_s, with the variable argument
24381 list replaced by arg, which shall have been initialized by the va_start macro (and
24382 possibly subsequent va_arg calls). The vswscanf_s function does not invoke the
24383 va_end macro.<sup><a href="#note438"><b>438)</b></a></sup>
24388 <sup><a name="note438" href="#note438"><b>438)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
24389 value of arg after the return is indeterminate.
24391 [<a name="p635" href="#p635">page 635</a>] (<a href="#Contents">Contents</a>)
24393 <b> Returns</b>
24394 5 The vswscanf_s function returns the value of the macro EOF if an input failure occurs
24395 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24396 vswscanf_s function returns the number of input items assigned, which can be fewer
24397 than provided for, or even zero, in the event of an early matching failure.
24398 <a name="K.3.9.1.11" href="#K.3.9.1.11"><b> K.3.9.1.11 The vwprintf_s function</b></a>
24399 <b> Synopsis</b>
24400 1 #define __STDC_WANT_LIB_EXT1__ 1
24401 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24402 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24403 int vwprintf_s(const wchar_t * restrict format,
24404 va_list arg);
24405 Runtime-constraints
24406 2 format shall not be a null pointer. The %n specifier<sup><a href="#note439"><b>439)</b></a></sup> (modified or not by flags, field
24407 width, or precision) shall not appear in the wide string pointed to by format. Any
24408 argument to vwprintf_s corresponding to a %s specifier shall not be a null pointer.
24409 3 If there is a runtime-constraint violation, the vwprintf_s function does not attempt to
24410 produce further output, and it is unspecified to what extent vwprintf_s produced
24411 output before discovering the runtime-constraint violation.
24412 <b> Description</b>
24413 4 The vwprintf_s function is equivalent to the vwprintf function except for the
24414 explicit runtime-constraints listed above.
24415 <b> Returns</b>
24416 5 The vwprintf_s function returns the number of wide characters transmitted, or a
24417 negative value if an output error, encoding error, or runtime-constraint violation occurred.
24422 <sup><a name="note439" href="#note439"><b>439)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24423 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24424 example, if the entire format string was L"%%n".
24426 [<a name="p636" href="#p636">page 636</a>] (<a href="#Contents">Contents</a>)
24428 <a name="K.3.9.1.12" href="#K.3.9.1.12"><b> K.3.9.1.12 The vwscanf_s function</b></a>
24429 <b> Synopsis</b>
24430 1 #define __STDC_WANT_LIB_EXT1__ 1
24431 #include <a href="#7.16">&lt;stdarg.h&gt;</a>
24432 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24433 int vwscanf_s(const wchar_t * restrict format,
24434 va_list arg);
24435 Runtime-constraints
24436 2 format shall not be a null pointer. Any argument indirected though in order to store
24437 converted input shall not be a null pointer.
24438 3 If there is a runtime-constraint violation, the vwscanf_s function does not attempt to
24439 perform further input, and it is unspecified to what extent vwscanf_s performed input
24440 before discovering the runtime-constraint violation.
24441 <b> Description</b>
24442 4 The vwscanf_s function is equivalent to wscanf_s, with the variable argument list
24443 replaced by arg, which shall have been initialized by the va_start macro (and
24444 possibly subsequent va_arg calls). The vwscanf_s function does not invoke the
24445 va_end macro.<sup><a href="#note440"><b>440)</b></a></sup>
24446 <b> Returns</b>
24447 5 The vwscanf_s function returns the value of the macro EOF if an input failure occurs
24448 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24449 vwscanf_s function returns the number of input items assigned, which can be fewer
24450 than provided for, or even zero, in the event of an early matching failure.
24451 <a name="K.3.9.1.13" href="#K.3.9.1.13"><b> K.3.9.1.13 The wprintf_s function</b></a>
24452 <b> Synopsis</b>
24453 1 #define __STDC_WANT_LIB_EXT1__ 1
24454 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24455 int wprintf_s(const wchar_t * restrict format, ...);
24456 Runtime-constraints
24457 2 format shall not be a null pointer. The %n specifier<sup><a href="#note441"><b>441)</b></a></sup> (modified or not by flags, field
24459 <sup><a name="note440" href="#note440"><b>440)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
24460 value of arg after the return is indeterminate.
24461 <sup><a name="note441" href="#note441"><b>441)</b></a></sup> It is not a runtime-constraint violation for the wide characters %n to appear in sequence in the wide
24462 string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
24463 example, if the entire format string was L"%%n".
24465 [<a name="p637" href="#p637">page 637</a>] (<a href="#Contents">Contents</a>)
24467 width, or precision) shall not appear in the wide string pointed to by format. Any
24468 argument to wprintf_s corresponding to a %s specifier shall not be a null pointer.
24469 3 If there is a runtime-constraint violation, the wprintf_s function does not attempt to
24470 produce further output, and it is unspecified to what extent wprintf_s produced output
24471 before discovering the runtime-constraint violation.
24472 <b> Description</b>
24473 4 The wprintf_s function is equivalent to the wprintf function except for the explicit
24474 runtime-constraints listed above.
24475 <b> Returns</b>
24476 5 The wprintf_s function returns the number of wide characters transmitted, or a
24477 negative value if an output error, encoding error, or runtime-constraint violation occurred.
24478 <a name="K.3.9.1.14" href="#K.3.9.1.14"><b> K.3.9.1.14 The wscanf_s function</b></a>
24479 <b> Synopsis</b>
24480 1 #define __STDC_WANT_LIB_EXT1__ 1
24481 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24482 int wscanf_s(const wchar_t * restrict format, ...);
24483 Runtime-constraints
24484 2 format shall not be a null pointer. Any argument indirected though in order to store
24485 converted input shall not be a null pointer.
24486 3 If there is a runtime-constraint violation, the wscanf_s function does not attempt to
24487 perform further input, and it is unspecified to what extent wscanf_s performed input
24488 before discovering the runtime-constraint violation.
24489 <b> Description</b>
24490 4 The wscanf_s function is equivalent to fwscanf_s with the argument stdin
24491 interposed before the arguments to wscanf_s.
24492 <b> Returns</b>
24493 5 The wscanf_s function returns the value of the macro EOF if an input failure occurs
24494 before any conversion or if there is a runtime-constraint violation. Otherwise, the
24495 wscanf_s function returns the number of input items assigned, which can be fewer than
24496 provided for, or even zero, in the event of an early matching failure.
24498 [<a name="p638" href="#p638">page 638</a>] (<a href="#Contents">Contents</a>)
24500 <a name="K.3.9.2" href="#K.3.9.2"><b> K.3.9.2 General wide string utilities</b></a>
24501 <a name="K.3.9.2.1" href="#K.3.9.2.1"><b> K.3.9.2.1 Wide string copying functions</b></a>
24502 <a name="K.3.9.2.1.1" href="#K.3.9.2.1.1"><b> K.3.9.2.1.1 The wcscpy_s function</b></a>
24503 <b> Synopsis</b>
24504 1 #define __STDC_WANT_LIB_EXT1__ 1
24505 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24506 errno_t wcscpy_s(wchar_t * restrict s1,
24507 rsize_t s1max,
24508 const wchar_t * restrict s2);
24509 Runtime-constraints
24510 2 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
24511 s1max shall not equal zero. s1max shall be greater than wcsnlen_s(s2, s1max).
24512 Copying shall not take place between objects that overlap.
24513 3 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
24514 greater than zero and not greater than RSIZE_MAX, then wcscpy_s sets s1[0] to the
24515 null wide character.
24516 <b> Description</b>
24517 4 The wcscpy_s function copies the wide string pointed to by s2 (including the
24518 terminating null wide character) into the array pointed to by s1.
24519 5 All elements following the terminating null wide character (if any) written by
24520 wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified
24521 values when wcscpy_s returns.<sup><a href="#note442"><b>442)</b></a></sup>
24522 <b> Returns</b>
24523 6 The wcscpy_s function returns zero<sup><a href="#note443"><b>443)</b></a></sup> if there was no runtime-constraint violation.
24524 Otherwise, a nonzero value is returned.
24529 <sup><a name="note442" href="#note442"><b>442)</b></a></sup> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
24530 if any of those wide characters are null. Such an approach might write a wide character to every
24531 element of s1 before discovering that the first element should be set to the null wide character.
24532 <sup><a name="note443" href="#note443"><b>443)</b></a></sup> A zero return value implies that all of the requested wide characters from the string pointed to by s2
24533 fit within the array pointed to by s1 and that the result in s1 is null terminated.
24535 [<a name="p639" href="#p639">page 639</a>] (<a href="#Contents">Contents</a>)
24537 <a name="K.3.9.2.1.2" href="#K.3.9.2.1.2"><b> K.3.9.2.1.2 The wcsncpy_s function</b></a>
24538 <b> Synopsis</b>
24539 7 #define __STDC_WANT_LIB_EXT1__ 1
24540 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24541 errno_t wcsncpy_s(wchar_t * restrict s1,
24542 rsize_t s1max,
24543 const wchar_t * restrict s2,
24544 rsize_t n);
24545 Runtime-constraints
24546 8 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
24547 RSIZE_MAX. s1max shall not equal zero. If n is not less than s1max, then s1max
24548 shall be greater than wcsnlen_s(s2, s1max). Copying shall not take place between
24549 objects that overlap.
24550 9 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
24551 greater than zero and not greater than RSIZE_MAX, then wcsncpy_s sets s1[0] to the
24552 null wide character.
24553 <b> Description</b>
24554 10 The wcsncpy_s function copies not more than n successive wide characters (wide
24555 characters that follow a null wide character are not copied) from the array pointed to by
24556 s2 to the array pointed to by s1. If no null wide character was copied from s2, then
24557 s1[n] is set to a null wide character.
24558 11 All elements following the terminating null wide character (if any) written by
24559 wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified
24560 values when wcsncpy_s returns.<sup><a href="#note444"><b>444)</b></a></sup>
24561 <b> Returns</b>
24562 12 The wcsncpy_s function returns zero<sup><a href="#note445"><b>445)</b></a></sup> if there was no runtime-constraint violation.
24563 Otherwise, a nonzero value is returned.
24564 13 EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the
24565 result will not be null terminated or that wide characters will be written past the end of the destination
24566 array.
24571 <sup><a name="note444" href="#note444"><b>444)</b></a></sup> This allows an implementation to copy wide characters from s2 to s1 while simultaneously checking
24572 if any of those wide characters are null. Such an approach might write a wide character to every
24573 element of s1 before discovering that the first element should be set to the null wide character.
24574 <sup><a name="note445" href="#note445"><b>445)</b></a></sup> A zero return value implies that all of the requested wide characters from the string pointed to by s2
24575 fit within the array pointed to by s1 and that the result in s1 is null terminated.
24577 [<a name="p640" href="#p640">page 640</a>] (<a href="#Contents">Contents</a>)
24579 #define __STDC_WANT_LIB_EXT1__ 1
24580 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24581 /* ... */
24582 wchar_t src1[100] = L"hello";
24583 wchar_t src2[7] = {L'g', L'o', L'o', L'd', L'b', L'y', L'e'};
24584 wchar_t dst1[6], dst2[5], dst3[5];
24585 int r1, r2, r3;
24586 r1 = wcsncpy_s(dst1, 6, src1, 100);
24587 r2 = wcsncpy_s(dst2, 5, src2, 7);
24588 r3 = wcsncpy_s(dst3, 5, src2, 4);
24589 The first call will assign to r1 the value zero and to dst1 the sequence of wide characters hello\0.
24590 The second call will assign to r2 a nonzero value and to dst2 the sequence of wide characters \0.
24591 The third call will assign to r3 the value zero and to dst3 the sequence of wide characters good\0.
24593 <a name="K.3.9.2.1.3" href="#K.3.9.2.1.3"><b> K.3.9.2.1.3 The wmemcpy_s function</b></a>
24594 <b> Synopsis</b>
24595 14 #define __STDC_WANT_LIB_EXT1__ 1
24596 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24597 errno_t wmemcpy_s(wchar_t * restrict s1,
24598 rsize_t s1max,
24599 const wchar_t * restrict s2,
24600 rsize_t n);
24601 Runtime-constraints
24602 15 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
24603 RSIZE_MAX. n shall not be greater than s1max. Copying shall not take place between
24604 objects that overlap.
24605 16 If there is a runtime-constraint violation, the wmemcpy_s function stores zeros in the
24606 first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
24607 s1max is not greater than RSIZE_MAX.
24608 <b> Description</b>
24609 17 The wmemcpy_s function copies n successive wide characters from the object pointed
24610 to by s2 into the object pointed to by s1.
24611 <b> Returns</b>
24612 18 The wmemcpy_s function returns zero if there was no runtime-constraint violation.
24613 Otherwise, a nonzero value is returned.
24615 [<a name="p641" href="#p641">page 641</a>] (<a href="#Contents">Contents</a>)
24617 <a name="K.3.9.2.1.4" href="#K.3.9.2.1.4"><b> K.3.9.2.1.4 The wmemmove_s function</b></a>
24618 <b> Synopsis</b>
24619 19 #define __STDC_WANT_LIB_EXT1__ 1
24620 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24621 errno_t wmemmove_s(wchar_t *s1, rsize_t s1max,
24622 const wchar_t *s2, rsize_t n);
24623 Runtime-constraints
24624 20 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
24625 RSIZE_MAX. n shall not be greater than s1max.
24626 21 If there is a runtime-constraint violation, the wmemmove_s function stores zeros in the
24627 first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and
24628 s1max is not greater than RSIZE_MAX.
24629 <b> Description</b>
24630 22 The wmemmove_s function copies n successive wide characters from the object pointed
24631 to by s2 into the object pointed to by s1. This copying takes place as if the n wide
24632 characters from the object pointed to by s2 are first copied into a temporary array of n
24633 wide characters that does not overlap the objects pointed to by s1 or s2, and then the n
24634 wide characters from the temporary array are copied into the object pointed to by s1.
24635 <b> Returns</b>
24636 23 The wmemmove_s function returns zero if there was no runtime-constraint violation.
24637 Otherwise, a nonzero value is returned.
24638 <a name="K.3.9.2.2" href="#K.3.9.2.2"><b> K.3.9.2.2 Wide string concatenation functions</b></a>
24639 <a name="K.3.9.2.2.1" href="#K.3.9.2.2.1"><b> K.3.9.2.2.1 The wcscat_s function</b></a>
24640 <b> Synopsis</b>
24641 1 #define __STDC_WANT_LIB_EXT1__ 1
24642 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24643 errno_t wcscat_s(wchar_t * restrict s1,
24644 rsize_t s1max,
24645 const wchar_t * restrict s2);
24646 Runtime-constraints
24647 2 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
24648 wcscat_s.
24649 3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
24650 s1max shall not equal zero. m shall not equal zero.<sup><a href="#note446"><b>446)</b></a></sup> m shall be greater than
24651 wcsnlen_s(s2, m). Copying shall not take place between objects that overlap.
24653 [<a name="p642" href="#p642">page 642</a>] (<a href="#Contents">Contents</a>)
24655 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
24656 greater than zero and not greater than RSIZE_MAX, then wcscat_s sets s1[0] to the
24657 null wide character.
24658 <b> Description</b>
24659 5 The wcscat_s function appends a copy of the wide string pointed to by s2 (including
24660 the terminating null wide character) to the end of the wide string pointed to by s1. The
24661 initial wide character from s2 overwrites the null wide character at the end of s1.
24662 6 All elements following the terminating null wide character (if any) written by
24663 wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified
24664 values when wcscat_s returns.<sup><a href="#note447"><b>447)</b></a></sup>
24665 <b> Returns</b>
24666 7 The wcscat_s function returns zero<sup><a href="#note448"><b>448)</b></a></sup> if there was no runtime-constraint violation.
24667 Otherwise, a nonzero value is returned.
24668 <a name="K.3.9.2.2.2" href="#K.3.9.2.2.2"><b> K.3.9.2.2.2 The wcsncat_s function</b></a>
24669 <b> Synopsis</b>
24670 8 #define __STDC_WANT_LIB_EXT1__ 1
24671 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24672 errno_t wcsncat_s(wchar_t * restrict s1,
24673 rsize_t s1max,
24674 const wchar_t * restrict s2,
24675 rsize_t n);
24676 Runtime-constraints
24677 9 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
24678 wcsncat_s.
24679 10 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
24680 RSIZE_MAX. s1max shall not equal zero. m shall not equal zero.<sup><a href="#note449"><b>449)</b></a></sup> If n is not less
24681 than m, then m shall be greater than wcsnlen_s(s2, m). Copying shall not take
24682 place between objects that overlap.
24685 <sup><a name="note446" href="#note446"><b>446)</b></a></sup> Zero means that s1 was not null terminated upon entry to wcscat_s.
24686 <sup><a name="note447" href="#note447"><b>447)</b></a></sup> This allows an implementation to append wide characters from s2 to s1 while simultaneously
24687 checking if any of those wide characters are null. Such an approach might write a wide character to
24688 every element of s1 before discovering that the first element should be set to the null wide character.
24689 <sup><a name="note448" href="#note448"><b>448)</b></a></sup> A zero return value implies that all of the requested wide characters from the wide string pointed to by
24690 s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
24691 <sup><a name="note449" href="#note449"><b>449)</b></a></sup> Zero means that s1 was not null terminated upon entry to wcsncat_s.
24693 [<a name="p643" href="#p643">page 643</a>] (<a href="#Contents">Contents</a>)
24695 11 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
24696 greater than zero and not greater than RSIZE_MAX, then wcsncat_s sets s1[0] to the
24697 null wide character.
24698 <b> Description</b>
24699 12 The wcsncat_s function appends not more than n successive wide characters (wide
24700 characters that follow a null wide character are not copied) from the array pointed to by
24701 s2 to the end of the wide string pointed to by s1. The initial wide character from s2
24702 overwrites the null wide character at the end of s1. If no null wide character was copied
24703 from s2, then s1[s1max-m+n] is set to a null wide character.
24704 13 All elements following the terminating null wide character (if any) written by
24705 wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified
24706 values when wcsncat_s returns.<sup><a href="#note450"><b>450)</b></a></sup>
24707 <b> Returns</b>
24708 14 The wcsncat_s function returns zero<sup><a href="#note451"><b>451)</b></a></sup> if there was no runtime-constraint violation.
24709 Otherwise, a nonzero value is returned.
24710 15 EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the
24711 result will not be null terminated or that wide characters will be written past the end of the destination
24712 array.
24713 #define __STDC_WANT_LIB_EXT1__ 1
24714 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24715 /* ... */
24716 wchar_t s1[100] = L"good";
24717 wchar_t s2[6] = L"hello";
24718 wchar_t s3[6] = L"hello";
24719 wchar_t s4[7] = L"abc";
24720 wchar_t s5[1000] = L"bye";
24721 int r1, r2, r3, r4;
24722 r1 = wcsncat_s(s1, 100, s5, 1000);
24723 r2 = wcsncat_s(s2, 6, L"", 1);
24724 r3 = wcsncat_s(s3, 6, L"X", 2);
24725 r4 = wcsncat_s(s4, 7, L"defghijklmn", 3);
24726 After the first call r1 will have the value zero and s1 will be the wide character sequence goodbye\0.
24727 After the second call r2 will have the value zero and s2 will be the wide character sequence hello\0.
24728 After the third call r3 will have a nonzero value and s3 will be the wide character sequence \0.
24729 After the fourth call r4 will have the value zero and s4 will be the wide character sequence abcdef\0.
24734 <sup><a name="note450" href="#note450"><b>450)</b></a></sup> This allows an implementation to append wide characters from s2 to s1 while simultaneously
24735 checking if any of those wide characters are null. Such an approach might write a wide character to
24736 every element of s1 before discovering that the first element should be set to the null wide character.
24737 <sup><a name="note451" href="#note451"><b>451)</b></a></sup> A zero return value implies that all of the requested wide characters from the wide string pointed to by
24738 s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
24740 [<a name="p644" href="#p644">page 644</a>] (<a href="#Contents">Contents</a>)
24742 <a name="K.3.9.2.3" href="#K.3.9.2.3"><b> K.3.9.2.3 Wide string search functions</b></a>
24743 <a name="K.3.9.2.3.1" href="#K.3.9.2.3.1"><b> K.3.9.2.3.1 The wcstok_s function</b></a>
24744 <b> Synopsis</b>
24745 1 #define __STDC_WANT_LIB_EXT1__ 1
24746 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24747 wchar_t *wcstok_s(wchar_t * restrict s1,
24748 rsize_t * restrict s1max,
24749 const wchar_t * restrict s2,
24750 wchar_t ** restrict ptr);
24751 Runtime-constraints
24752 2 None of s1max, s2, or ptr shall be a null pointer. If s1 is a null pointer, then *ptr
24753 shall not be a null pointer. The value of *s1max shall not be greater than RSIZE_MAX.
24754 The end of the token found shall occur within the first *s1max wide characters of s1 for
24755 the first call, and shall occur within the first *s1max wide characters of where searching
24756 resumes on subsequent calls.
24757 3 If there is a runtime-constraint violation, the wcstok_s function does not indirect
24758 through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr.
24759 <b> Description</b>
24760 4 A sequence of calls to the wcstok_s function breaks the wide string pointed to by s1
24761 into a sequence of tokens, each of which is delimited by a wide character from the wide
24762 string pointed to by s2. The fourth argument points to a caller-provided wchar_t
24763 pointer into which the wcstok_s function stores information necessary for it to
24764 continue scanning the same wide string.
24765 5 The first call in a sequence has a non-null first argument and s1max points to an object
24766 whose value is the number of elements in the wide character array pointed to by the first
24767 argument. The first call stores an initial value in the object pointed to by ptr and
24768 updates the value pointed to by s1max to reflect the number of elements that remain in
24769 relation to ptr. Subsequent calls in the sequence have a null first argument and the
24770 objects pointed to by s1max and ptr are required to have the values stored by the
24771 previous call in the sequence, which are then updated. The separator wide string pointed
24772 to by s2 may be different from call to call.
24773 6 The first call in the sequence searches the wide string pointed to by s1 for the first wide
24774 character that is not contained in the current separator wide string pointed to by s2. If no
24775 such wide character is found, then there are no tokens in the wide string pointed to by s1
24776 and the wcstok_s function returns a null pointer. If such a wide character is found, it is
24777 the start of the first token.
24779 [<a name="p645" href="#p645">page 645</a>] (<a href="#Contents">Contents</a>)
24781 7 The wcstok_s function then searches from there for the first wide character in s1 that
24782 is contained in the current separator wide string. If no such wide character is found, the
24783 current token extends to the end of the wide string pointed to by s1, and subsequent
24784 searches in the same wide string for a token return a null pointer. If such a wide character
24785 is found, it is overwritten by a null wide character, which terminates the current token.
24786 8 In all cases, the wcstok_s function stores sufficient information in the pointer pointed
24787 to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
24788 value for ptr, shall start searching just past the element overwritten by a null wide
24789 character (if any).
24790 <b> Returns</b>
24791 9 The wcstok_s function returns a pointer to the first wide character of a token, or a null
24792 pointer if there is no token or there is a runtime-constraint violation.
24793 10 EXAMPLE
24794 #define __STDC_WANT_LIB_EXT1__ 1
24795 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24796 static wchar_t str1[] = L"?a???b,,,#c";
24797 static wchar_t str2[] = L"\t \t";
24798 wchar_t *t, *ptr1, *ptr2;
24799 rsize_t max1 = wcslen(str1)+1;
24800 rsize_t max2 = wcslen(str2)+1;
24801 t = wcstok_s(str1, &amp;max1, "?", &amp;ptr1); // t points to the token "a"
24802 t = wcstok_s(NULL, &amp;max1, ",", &amp;ptr1); // t points to the token "??b"
24803 t = wcstok_s(str2, &amp;max2, " \t", &amp;ptr2); // t is a null pointer
24804 t = wcstok_s(NULL, &amp;max1, "#,", &amp;ptr1); // t points to the token "c"
24805 t = wcstok_s(NULL, &amp;max1, "?", &amp;ptr1); // t is a null pointer
24807 <a name="K.3.9.2.4" href="#K.3.9.2.4"><b> K.3.9.2.4 Miscellaneous functions</b></a>
24808 <a name="K.3.9.2.4.1" href="#K.3.9.2.4.1"><b> K.3.9.2.4.1 The wcsnlen_s function</b></a>
24809 <b> Synopsis</b>
24810 1 #define __STDC_WANT_LIB_EXT1__ 1
24811 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24812 size_t wcsnlen_s(const wchar_t *s, size_t maxsize);
24813 <b> Description</b>
24814 2 The wcsnlen_s function computes the length of the wide string pointed to by s.
24815 <b> Returns</b>
24816 3 If s is a null pointer,<sup><a href="#note452"><b>452)</b></a></sup> then the wcsnlen_s function returns zero.
24817 4 Otherwise, the wcsnlen_s function returns the number of wide characters that precede
24818 the terminating null wide character. If there is no null wide character in the first
24819 maxsize wide characters of s then wcsnlen_s returns maxsize. At most the first
24821 [<a name="p646" href="#p646">page 646</a>] (<a href="#Contents">Contents</a>)
24823 maxsize wide characters of s shall be accessed by wcsnlen_s.
24824 <a name="K.3.9.3" href="#K.3.9.3"><b> K.3.9.3 Extended multibyte/wide character conversion utilities</b></a>
24825 <a name="K.3.9.3.1" href="#K.3.9.3.1"><b> K.3.9.3.1 Restartable multibyte/wide character conversion functions</b></a>
24826 1 Unlike wcrtomb, wcrtomb_s does not permit the ps parameter (the pointer to the
24827 conversion state) to be a null pointer.
24828 <a name="K.3.9.3.1.1" href="#K.3.9.3.1.1"><b> K.3.9.3.1.1 The wcrtomb_s function</b></a>
24829 <b> Synopsis</b>
24830 2 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24831 errno_t wcrtomb_s(size_t * restrict retval,
24832 char * restrict s, rsize_t smax,
24833 wchar_t wc, mbstate_t * restrict ps);
24834 Runtime-constraints
24835 3 Neither retval nor ps shall be a null pointer. If s is not a null pointer, then smax
24836 shall not equal zero and shall not be greater than RSIZE_MAX. If s is not a null pointer,
24837 then smax shall be not be less than the number of bytes to be stored in the array pointed
24838 to by s. If s is a null pointer, then smax shall equal zero.
24839 4 If there is a runtime-constraint violation, then wcrtomb_s does the following. If s is
24840 not a null pointer and smax is greater than zero and not greater than RSIZE_MAX, then
24841 wcrtomb_s sets s[0] to the null character. If retval is not a null pointer, then
24842 wcrtomb_s sets *retval to (size_t)(-1).
24843 <b> Description</b>
24844 5 If s is a null pointer, the wcrtomb_s function is equivalent to the call
24845 wcrtomb_s(&amp;retval, buf, sizeof buf, L'\0', ps)
24846 where retval and buf are internal variables of the appropriate types, and the size of
24847 buf is greater than MB_CUR_MAX.
24848 6 If s is not a null pointer, the wcrtomb_s function determines the number of bytes
24849 needed to represent the multibyte character that corresponds to the wide character given
24850 by wc (including any shift sequences), and stores the multibyte character representation
24851 in the array whose first element is pointed to by s. At most MB_CUR_MAX bytes are
24852 stored. If wc is a null wide character, a null byte is stored, preceded by any shift
24853 sequence needed to restore the initial shift state; the resulting state described is the initial
24854 conversion state.
24856 <sup><a name="note452" href="#note452"><b>452)</b></a></sup> Note that the wcsnlen_s function has no runtime-constraints. This lack of runtime-constraints
24857 along with the values returned for a null pointer or an unterminated wide string argument make
24858 wcsnlen_s useful in algorithms that gracefully handle such exceptional data.
24860 [<a name="p647" href="#p647">page 647</a>] (<a href="#Contents">Contents</a>)
24862 7 If wc does not correspond to a valid multibyte character, an encoding error occurs: the
24863 wcrtomb_s function stores the value (size_t)(-1) into *retval and the
24864 conversion state is unspecified. Otherwise, the wcrtomb_s function stores into
24865 *retval the number of bytes (including any shift sequences) stored in the array pointed
24866 to by s.
24867 <b> Returns</b>
24868 8 The wcrtomb_s function returns zero if no runtime-constraint violation and no
24869 encoding error occurred. Otherwise, a nonzero value is returned.
24870 <a name="K.3.9.3.2" href="#K.3.9.3.2"><b> K.3.9.3.2 Restartable multibyte/wide string conversion functions</b></a>
24871 1 Unlike mbsrtowcs and wcsrtombs, mbsrtowcs_s and wcsrtombs_s do not
24872 permit the ps parameter (the pointer to the conversion state) to be a null pointer.
24873 <a name="K.3.9.3.2.1" href="#K.3.9.3.2.1"><b> K.3.9.3.2.1 The mbsrtowcs_s function</b></a>
24874 <b> Synopsis</b>
24875 2 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24876 errno_t mbsrtowcs_s(size_t * restrict retval,
24877 wchar_t * restrict dst, rsize_t dstmax,
24878 const char ** restrict src, rsize_t len,
24879 mbstate_t * restrict ps);
24880 Runtime-constraints
24881 3 None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
24882 then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
24883 pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
24884 not equal zero. If dst is not a null pointer and len is not less than dstmax, then a null
24885 character shall occur within the first dstmax multibyte characters of the array pointed to
24886 by *src.
24887 4 If there is a runtime-constraint violation, then mbsrtowcs_s does the following. If
24888 retval is not a null pointer, then mbsrtowcs_s sets *retval to (size_t)(-1).
24889 If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
24890 then mbsrtowcs_s sets dst[0] to the null wide character.
24891 <b> Description</b>
24892 5 The mbsrtowcs_s function converts a sequence of multibyte characters that begins in
24893 the conversion state described by the object pointed to by ps, from the array indirectly
24894 pointed to by src into a sequence of corresponding wide characters. If dst is not a null
24895 pointer, the converted characters are stored into the array pointed to by dst. Conversion
24896 continues up to and including a terminating null character, which is also stored.
24897 Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
24898 not form a valid multibyte character, or (if dst is not a null pointer) when len wide
24900 [<a name="p648" href="#p648">page 648</a>] (<a href="#Contents">Contents</a>)
24902 characters have been stored into the array pointed to by dst.<sup><a href="#note453"><b>453)</b></a></sup> If dst is not a null
24903 pointer and no null wide character was stored into the array pointed to by dst, then
24904 dst[len] is set to the null wide character. Each conversion takes place as if by a call
24905 to the mbrtowc function.
24906 6 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
24907 pointer (if conversion stopped due to reaching a terminating null character) or the address
24908 just past the last multibyte character converted (if any). If conversion stopped due to
24909 reaching a terminating null character and if dst is not a null pointer, the resulting state
24910 described is the initial conversion state.
24911 7 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
24912 sequence of bytes that do not form a valid multibyte character, an encoding error occurs:
24913 the mbsrtowcs_s function stores the value (size_t)(-1) into *retval and the
24914 conversion state is unspecified. Otherwise, the mbsrtowcs_s function stores into
24915 *retval the number of multibyte characters successfully converted, not including the
24916 terminating null character (if any).
24917 8 All elements following the terminating null wide character (if any) written by
24918 mbsrtowcs_s in the array of dstmax wide characters pointed to by dst take
24919 unspecified values when mbsrtowcs_s returns.<sup><a href="#note454"><b>454)</b></a></sup>
24920 9 If copying takes place between objects that overlap, the objects take on unspecified
24921 values.
24922 <b> Returns</b>
24923 10 The mbsrtowcs_s function returns zero if no runtime-constraint violation and no
24924 encoding error occurred. Otherwise, a nonzero value is returned.
24925 <a name="K.3.9.3.2.2" href="#K.3.9.3.2.2"><b> K.3.9.3.2.2 The wcsrtombs_s function</b></a>
24926 <b> Synopsis</b>
24927 11 #include <a href="#7.29">&lt;wchar.h&gt;</a>
24928 errno_t wcsrtombs_s(size_t * restrict retval,
24929 char * restrict dst, rsize_t dstmax,
24930 const wchar_t ** restrict src, rsize_t len,
24931 mbstate_t * restrict ps);
24936 <sup><a name="note453" href="#note453"><b>453)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
24937 <sup><a name="note454" href="#note454"><b>454)</b></a></sup> This allows an implementation to attempt converting the multibyte string before discovering a
24938 terminating null character did not occur where required.
24940 [<a name="p649" href="#p649">page 649</a>] (<a href="#Contents">Contents</a>)
24942 Runtime-constraints
24943 12 None of retval, src, *src, or ps shall be null pointers. If dst is not a null pointer,
24944 then neither len nor dstmax shall be greater than RSIZE_MAX. If dst is a null
24945 pointer, then dstmax shall equal zero. If dst is not a null pointer, then dstmax shall
24946 not equal zero. If dst is not a null pointer and len is not less than dstmax, then the
24947 conversion shall have been stopped (see below) because a terminating null wide character
24948 was reached or because an encoding error occurred.
24949 13 If there is a runtime-constraint violation, then wcsrtombs_s does the following. If
24950 retval is not a null pointer, then wcsrtombs_s sets *retval to (size_t)(-1).
24951 If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX,
24952 then wcsrtombs_s sets dst[0] to the null character.
24953 <b> Description</b>
24954 14 The wcsrtombs_s function converts a sequence of wide characters from the array
24955 indirectly pointed to by src into a sequence of corresponding multibyte characters that
24956 begins in the conversion state described by the object pointed to by ps. If dst is not a
24957 null pointer, the converted characters are then stored into the array pointed to by dst.
24958 Conversion continues up to and including a terminating null wide character, which is also
24959 stored. Conversion stops earlier in two cases:
24960 -- when a wide character is reached that does not correspond to a valid multibyte
24961 character;
24962 -- (if dst is not a null pointer) when the next multibyte character would exceed the
24963 limit of n total bytes to be stored into the array pointed to by dst. If the wide
24964 character being converted is the null wide character, then n is the lesser of len or
24965 dstmax. Otherwise, n is the lesser of len or dstmax-1.
24966 If the conversion stops without converting a null wide character and dst is not a null
24967 pointer, then a null character is stored into the array pointed to by dst immediately
24968 following any multibyte characters already stored. Each conversion takes place as if by a
24969 call to the wcrtomb function.<sup><a href="#note455"><b>455)</b></a></sup>
24970 15 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
24971 pointer (if conversion stopped due to reaching a terminating null wide character) or the
24972 address just past the last wide character converted (if any). If conversion stopped due to
24973 reaching a terminating null wide character, the resulting state described is the initial
24974 conversion state.
24977 <sup><a name="note455" href="#note455"><b>455)</b></a></sup> If conversion stops because a terminating null wide character has been reached, the bytes stored
24978 include those necessary to reach the initial shift state immediately before the null byte. However, if
24979 the conversion stops before a terminating null wide character has been reached, the result will be null
24980 terminated, but might not end in the initial shift state.
24982 [<a name="p650" href="#p650">page 650</a>] (<a href="#Contents">Contents</a>)
24984 16 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
24985 wide character that does not correspond to a valid multibyte character, an encoding error
24986 occurs: the wcsrtombs_s function stores the value (size_t)(-1) into *retval
24987 and the conversion state is unspecified. Otherwise, the wcsrtombs_s function stores
24988 into *retval the number of bytes in the resulting multibyte character sequence, not
24989 including the terminating null character (if any).
24990 17 All elements following the terminating null character (if any) written by wcsrtombs_s
24991 in the array of dstmax elements pointed to by dst take unspecified values when
24992 wcsrtombs_s returns.<sup><a href="#note456"><b>456)</b></a></sup>
24993 18 If copying takes place between objects that overlap, the objects take on unspecified
24994 values.
24995 <b> Returns</b>
24996 19 The wcsrtombs_s function returns zero if no runtime-constraint violation and no
24997 encoding error occurred. Otherwise, a nonzero value is returned.
25002 <sup><a name="note456" href="#note456"><b>456)</b></a></sup> When len is not less than dstmax, the implementation might fill the array before discovering a
25003 runtime-constraint violation.
25005 [<a name="p651" href="#p651">page 651</a>] (<a href="#Contents">Contents</a>)
25007 <a name="L" href="#L"><b> Annex L</b></a>
25008 (normative)
25009 Analyzability
25010 <a name="L.1" href="#L.1"><b> L.1 Scope</b></a>
25011 1 This annex specifies optional behavior that can aid in the analyzability of C programs.
25012 2 An implementation that defines __STDC_ANALYZABLE__ shall conform to the
25013 specifications in this annex.<sup><a href="#note457"><b>457)</b></a></sup>
25014 <a name="L.2" href="#L.2"><b> L.2 Definitions</b></a>
25015 <a name="L.2.1" href="#L.2.1"><b> L.2.1</b></a>
25016 1 out-of-bounds store
25017 an (attempted) access (<a href="#3.1">3.1</a>) that, at run time, for a given computational state, would
25018 modify (or, for an object declared volatile, fetch) one or more bytes that lie outside
25019 the bounds permitted by this Standard.
25020 <a name="L.2.2" href="#L.2.2"><b> L.2.2</b></a>
25021 1 bounded undefined behavior
25022 undefined behavior (<a href="#3.4.3">3.4.3</a>) that does not perform an out-of-bounds store.
25023 2 NOTE 1 The behavior might perform a trap.
25025 3 NOTE 2 Any values produced or stored might be indeterminate values.
25027 <a name="L.2.3" href="#L.2.3"><b> L.2.3</b></a>
25028 1 critical undefined behavior
25029 undefined behavior that is not bounded undefined behavior.
25030 2 NOTE The behavior might perform an out-of-bounds store or perform a trap.
25035 <sup><a name="note457" href="#note457"><b>457)</b></a></sup> Implementations that do not define __STDC_ANALYZABLE__ are not required to conform to these
25036 specifications.
25038 [<a name="p652" href="#p652">page 652</a>] (<a href="#Contents">Contents</a>)
25040 <a name="L.3" href="#L.3"><b> L.3 Requirements</b></a>
25041 1 If the program performs a trap (<a href="#3.19.5">3.19.5</a>), the implementation is permitted to invoke a
25042 runtime-constraint handler. Any such semantics are implementation-defined.
25043 2 All undefined behavior shall be limited to bounded undefined behavior, except for the
25044 following which are permitted to result in critical undefined behavior:
25045 -- An object is referred to outside of its lifetime (<a href="#6.2.4">6.2.4</a>).
25046 -- A store is performed to an object that has two incompatible declarations (<a href="#6.2.7">6.2.7</a>),
25047 -- A pointer is used to call a function whose type is not compatible with the referenced
25048 type (<a href="#6.2.7">6.2.7</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>).
25049 -- An lvalue does not designate an object when evaluated (<a href="#6.3.2.1">6.3.2.1</a>).
25050 -- The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
25051 -- The operand of the unary * operator has an invalid value (<a href="#6.5.3.2">6.5.3.2</a>).
25052 -- Addition or subtraction of a pointer into, or just beyond, an array object and an
25053 integer type produces a result that points just beyond the array object and is used as
25054 the operand of a unary * operator that is evaluated (<a href="#6.5.6">6.5.6</a>).
25055 -- An attempt is made to modify an object defined with a const-qualified type through
25056 use of an lvalue with non-const-qualified type (<a href="#6.7.3">6.7.3</a>).
25057 -- An argument to a function or macro defined in the standard library has an invalid
25058 value or a type not expected by a function with variable number of arguments (<a href="#7.1.4">7.1.4</a>).
25059 -- The longjmp function is called with a jmp_buf argument where the most recent
25060 invocation of the setjmp macro in the same invocation of the program with the
25061 corresponding jmp_buf argument is nonexistent, or the invocation was from another
25062 thread of execution, or the function containing the invocation has terminated
25063 execution in the interim, or the invocation was within the scope of an identifier with
25064 variably modified type and execution has left that scope in the interim (<a href="#7.13.2.1">7.13.2.1</a>).
25065 -- The value of a pointer that refers to space deallocated by a call to the free or realloc
25066 function is used (<a href="#7.22.3">7.22.3</a>).
25067 -- A string or wide string utility function accesses an array beyond the end of an object
25068 (<a href="#7.24.1">7.24.1</a>, <a href="#7.29.4">7.29.4</a>).
25070 [<a name="p653" href="#p653">page 653</a>] (<a href="#Contents">Contents</a>)
25073 <a name="Bibliography" href="#Bibliography"><b> Bibliography</b></a>
25074 1. ''The C Reference Manual'' by Dennis M. Ritchie, a version of which was
25075 published in The C Programming Language by Brian W. Kernighan and Dennis
25076 M. Ritchie, Prentice-Hall, Inc., (1978). Copyright owned by AT&amp;T.
25077 2. 1984 /usr/group Standard by the /usr/group Standards Committee, Santa Clara,
25078 California, USA, November 1984.
25079 3. ANSI X3/TR-1-82 (1982), American National Dictionary for Information
25080 Processing Systems, Information Processing Systems Technical Report.
25081 4. ANSI/IEEE 754-1985, American National Standard for Binary Floating-Point
25082 Arithmetic.
25083 5. ANSI/IEEE 854-1988, American National Standard for Radix-Independent
25084 Floating-Point Arithmetic.
25085 6. IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems,
25086 second edition (previously designated IEC 559:1989).
25087 7. ISO 31-11:1992, Quantities and units -- Part 11: Mathematical signs and
25088 symbols for use in the physical sciences and technology.
25089 8. ISO/IEC 646:1991, Information technology -- ISO 7-bit coded character set for
25090 information interchange.
25091 9. ISO/IEC 2382-1:1993, Information technology -- Vocabulary -- Part 1:
25092 Fundamental terms.
25093 10. ISO 4217:1995, Codes for the representation of currencies and funds.
25094 11. ISO 8601:1988, Data elements and interchange formats -- Information
25095 interchange -- Representation of dates and times.
25096 12. ISO/IEC 9899:1990, Programming languages -- C.
25097 13. ISO/IEC 9899/COR1:1994, Technical Corrigendum 1.
25098 14. ISO/IEC 9899/COR2:1996, Technical Corrigendum 2.
25099 15. ISO/IEC 9899/AMD1:1995, Amendment 1 to ISO/IEC 9899:1990 C Integrity.
25100 16. ISO/IEC 9899:1999, Programming languages -- C.
25101 17. ISO/IEC 9899:1999/Cor.1:2001, Technical Corrigendum 1.
25102 18. ISO/IEC 9899:1999/Cor.2:2004, Technical Corrigendum 2.
25103 19. ISO/IEC 9899:1999/Cor.3:2007, Technical Corrigendum 3.
25105 [<a name="p654" href="#p654">page 654</a>] (<a href="#Contents">Contents</a>)
25107 20. ISO/IEC 9945-2:1993, Information technology -- Portable Operating System
25108 Interface (POSIX) -- Part 2: Shell and Utilities.
25109 21. ISO/IEC TR 10176:1998, Information technology -- Guidelines for the
25110 preparation of programming language standards.
25111 22. ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
25112 Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
25113 23. ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
25114 ISO/IEC 10646-1:1993.
25115 24. ISO/IEC 10646-1/COR2:1998, Technical Corrigendum 2 to
25116 ISO/IEC 10646-1:1993.
25117 25. ISO/IEC 10646-1/AMD1:1996, Amendment 1 to ISO/IEC 10646-1:1993
25118 Transformation Format for 16 planes of group 00 (UTF-16).
25119 26. ISO/IEC 10646-1/AMD2:1996, Amendment 2 to ISO/IEC 10646-1:1993 UCS
25120 Transformation Format 8 (UTF-8).
25121 27. ISO/IEC 10646-1/AMD3:1996, Amendment 3 to ISO/IEC 10646-1:1993.
25122 28. ISO/IEC 10646-1/AMD4:1996, Amendment 4 to ISO/IEC 10646-1:1993.
25123 29. ISO/IEC 10646-1/AMD5:1998, Amendment 5 to ISO/IEC 10646-1:1993 Hangul
25124 syllables.
25125 30. ISO/IEC 10646-1/AMD6:1997, Amendment 6 to ISO/IEC 10646-1:1993
25126 Tibetan.
25127 31. ISO/IEC 10646-1/AMD7:1997, Amendment 7 to ISO/IEC 10646-1:1993 33
25128 additional characters.
25129 32. ISO/IEC 10646-1/AMD8:1997, Amendment 8 to ISO/IEC 10646-1:1993.
25130 33. ISO/IEC 10646-1/AMD9:1997, Amendment 9 to ISO/IEC 10646-1:1993
25131 Identifiers for characters.
25132 34. ISO/IEC 10646-1/AMD10:1998, Amendment 10 to ISO/IEC 10646-1:1993
25133 Ethiopic.
25134 35. ISO/IEC 10646-1/AMD11:1998, Amendment 11 to ISO/IEC 10646-1:1993
25135 Unified Canadian Aboriginal Syllabics.
25136 36. ISO/IEC 10646-1/AMD12:1998, Amendment 12 to ISO/IEC 10646-1:1993
25137 Cherokee.
25138 37. ISO/IEC 10967-1:1994, Information technology -- Language independent
25139 arithmetic -- Part 1: Integer and floating point arithmetic.
25141 [<a name="p655" href="#p655">page 655</a>] (<a href="#Contents">Contents</a>)
25143 38. ISO/IEC TR 19769:2004, Information technology -- Programming languages,
25144 their environments and system software interfaces -- Extensions for the
25145 programming language C to support new character data types.
25146 39. ISO/IEC TR 24731-1:2007, Information technology -- Programming languages,
25147 their environments and system software interfaces -- Extensions to the C library
25148 -- Part 1: Bounds-checking interfaces.
25150 [<a name="p656" href="#p656">page 656</a>] (<a href="#Contents">Contents</a>)
25153 <a name="Index" href="#Index"><b>Index</b></a>
25154 [^ x ^], <a href="#3.20">3.20</a> , (comma operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.17">6.5.17</a>
25155 , (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>,
25156 [_ x _], <a href="#3.21">3.21</a> <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a>
25157 ! (logical negation operator), <a href="#6.5.3.3">6.5.3.3</a> - (subtraction operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a>
25158 != (inequality operator), <a href="#6.5.9">6.5.9</a> - (unary minus operator), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
25159 # operator, <a href="#6.10.3.2">6.10.3.2</a> -- (postfix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a>
25160 # preprocessing directive, <a href="#6.10.7">6.10.7</a> -- (prefix decrement operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>
25161 # punctuator, <a href="#6.10">6.10</a> -= (subtraction assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25162 ## operator, <a href="#6.10.3.3">6.10.3.3</a> -&gt; (structure/union pointer operator), <a href="#6.5.2.3">6.5.2.3</a>
25163 #define preprocessing directive, <a href="#6.10.3">6.10.3</a> . (structure/union member operator), <a href="#6.3.2.1">6.3.2.1</a>,
25164 #elif preprocessing directive, <a href="#6.10.1">6.10.1</a> <a href="#6.5.2.3">6.5.2.3</a>
25165 #else preprocessing directive, <a href="#6.10.1">6.10.1</a> . punctuator, <a href="#6.7.9">6.7.9</a>
25166 #endif preprocessing directive, <a href="#6.10.1">6.10.1</a> ... (ellipsis punctuator), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>
25167 #error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> / (division operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a>
25168 #if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, /* */ (comment delimiters), <a href="#6.4.9">6.4.9</a>
25169 <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a> // (comment delimiter), <a href="#6.4.9">6.4.9</a>
25170 #ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a> /= (division assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25171 #ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a> : (colon punctuator), <a href="#6.7.2.1">6.7.2.1</a>
25172 #include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, :&gt; (alternative spelling of ]), <a href="#6.4.6">6.4.6</a>
25173 <a href="#6.10.2">6.10.2</a> ; (semicolon punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>,
25174 #line preprocessing directive, <a href="#6.10.4">6.10.4</a> <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a>
25175 #pragma preprocessing directive, <a href="#6.10.6">6.10.6</a> &lt; (less-than operator), <a href="#6.5.8">6.5.8</a>
25176 #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>
25177 <a href="#7.1.4">7.1.4</a> &lt;: (alternative spelling of [), <a href="#6.4.6">6.4.6</a>
25178 % (remainder operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a> &lt;&lt; (left-shift operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
25179 %: (alternative spelling of #), <a href="#6.4.6">6.4.6</a> &lt;&lt;= (left-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25180 %:%: (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>
25181 %= (remainder assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.2">&lt;assert.h&gt;</a> header, <a href="#7.2">7.2</a>
25182 %&gt; (alternative spelling of }), <a href="#6.4.6">6.4.6</a> <a href="#7.3">&lt;complex.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>,
25183 &amp; (address operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#7.3">7.3</a>, <a href="#7.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
25184 &amp; (bitwise AND operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a> <a href="#7.4">&lt;ctype.h&gt;</a> header, <a href="#7.4">7.4</a>, <a href="#7.31.2">7.31.2</a>
25185 &amp;&amp; (logical AND operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a> <a href="#7.5">&lt;errno.h&gt;</a> header, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a>
25186 &amp;= (bitwise AND assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.6">&lt;fenv.h&gt;</a> header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>,
25187 ' ' (space character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.31.4">7.31.4</a>, <a href="#F">F</a>, <a href="#H">H</a>
25188 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a> <a href="#7.7">&lt;float.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.22.1.3">7.22.1.3</a>,
25189 ( ) (cast operator), <a href="#6.5.4">6.5.4</a> <a href="#7.29.4.1.1">7.29.4.1.1</a>
25190 ( ) (function-call operator), <a href="#6.5.2.2">6.5.2.2</a> <a href="#7.8">&lt;inttypes.h&gt;</a> header, <a href="#7.8">7.8</a>, <a href="#7.31.5">7.31.5</a>
25191 ( ) (parentheses punctuator), <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> <a href="#7.9">&lt;iso646.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.9">7.9</a>
25192 ( ){ } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> <a href="#7.10">&lt;limits.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
25193 * (asterisk punctuator), <a href="#6.7.6.1">6.7.6.1</a>, <a href="#6.7.6.2">6.7.6.2</a> <a href="#7.11">&lt;locale.h&gt;</a> header, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
25194 * (indirection operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#7.12">&lt;math.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.25">7.25</a>, <a href="#F">F</a>,
25195 * (multiplication operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10">F.10</a>, <a href="#J.5.17">J.5.17</a>
25196 <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>
25197 *= (multiplication assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.14">&lt;signal.h&gt;</a> header, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
25198 + (addition operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, <a href="#7.15">&lt;stdalign.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.15">7.15</a>
25199 <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> <a href="#7.16">&lt;stdarg.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a>
25200 + (unary plus operator), <a href="#6.5.3.3">6.5.3.3</a> <a href="#7.17">&lt;stdatomic.h&gt;</a> header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a>,
25201 ++ (postfix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a> <a href="#7.31.8">7.31.8</a>
25202 ++ (prefix increment operator), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a> <a href="#7.18">&lt;stdbool.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a>
25203 += (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a>
25205 [<a name="p657" href="#p657">page 657</a>] (<a href="#Contents">Contents</a>)
25207 <a href="#7.19">&lt;stddef.h&gt;</a> header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, \u (universal character names), <a href="#6.4.3">6.4.3</a>
25208 <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.19">7.19</a>, <a href="#K.3.3">K.3.3</a> \v (vertical-tab escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
25209 <a href="#7.20">&lt;stdint.h&gt;</a> header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.4.1.10">7.4.1.10</a>
25210 <a href="#7.20">7.20</a>, <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a> \x hexadecimal digits (hexadecimal-character
25211 <a href="#7.21">&lt;stdio.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.31.11">7.31.11</a>, <a href="#F">F</a>, escape sequence), <a href="#6.4.4.4">6.4.4.4</a>
25212 <a href="#K.3.5">K.3.5</a> ^ (bitwise exclusive OR operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
25213 <a href="#7.22">&lt;stdlib.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a>, <a href="#F">F</a>, ^= (bitwise exclusive OR assignment operator),
25214 <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a> <a href="#6.5.16.2">6.5.16.2</a>
25215 <a href="#7.23">&lt;stdnoreturn.h&gt;</a> header, <a href="#4">4</a>, <a href="#7.23">7.23</a> __alignas_is_defined macro, <a href="#7.15">7.15</a>
25216 <a href="#7.24">&lt;string.h&gt;</a> header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a> __alignof_is_defined macro, <a href="#7.15">7.15</a>
25217 <a href="#7.25">&lt;tgmath.h&gt;</a> header, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> __bool_true_false_are_defined
25218 <a href="#7.26">&lt;threads.h&gt;</a> header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.26">7.26</a>, macro, <a href="#7.18">7.18</a>
25219 <a href="#7.31.15">7.31.15</a> __cplusplus macro, <a href="#6.10.8">6.10.8</a>
25220 <a href="#7.27">&lt;time.h&gt;</a> header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a> __DATE__ macro, <a href="#6.10.8.1">6.10.8.1</a>
25221 <a href="#7.28">&lt;uchar.h&gt;</a> header, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.28">7.28</a> __FILE__ macro, <a href="#6.10.8.1">6.10.8.1</a>, <a href="#7.2.1.1">7.2.1.1</a>
25222 <a href="#7.29">&lt;wchar.h&gt;</a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.29">7.29</a>, __func__ identifier, <a href="#6.4.2.2">6.4.2.2</a>, <a href="#7.2.1.1">7.2.1.1</a>
25223 <a href="#7.31.16">7.31.16</a>, <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a> __LINE__ macro, <a href="#6.10.8.1">6.10.8.1</a>, <a href="#7.2.1.1">7.2.1.1</a>
25224 <a href="#7.30">&lt;wctype.h&gt;</a> header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a> __STDC_, <a href="#6.11.9">6.11.9</a>
25225 = (equal-sign punctuator), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.9">6.7.9</a> __STDC__ macro, <a href="#6.10.8.1">6.10.8.1</a>
25226 = (simple assignment operator), <a href="#6.5.16.1">6.5.16.1</a> __STDC_ANALYZABLE__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#L.1">L.1</a>
25227 == (equality operator), <a href="#6.5.9">6.5.9</a> __STDC_HOSTED__ macro, <a href="#6.10.8.1">6.10.8.1</a>
25228 &gt; (greater-than operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#F.1">F.1</a>
25229 &gt;= (greater-than-or-equal-to operator), <a href="#6.5.8">6.5.8</a> __STDC_IEC_559_COMPLEX__ macro,
25230 &gt;&gt; (right-shift operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a> <a href="#6.10.8.3">6.10.8.3</a>, <a href="#G.1">G.1</a>
25231 &gt;&gt;= (right-shift assignment operator), <a href="#6.5.16.2">6.5.16.2</a> __STDC_ISO_10646__ macro, <a href="#6.10.8.2">6.10.8.2</a>
25232 ? : (conditional operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a> __STDC_LIB_EXT1__ macro, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#K.2">K.2</a>
25233 ?? (trigraph sequences), <a href="#5.2.1.1">5.2.1.1</a> __STDC_MB_MIGHT_NEQ_WC__ macro,
25234 [ ] (array subscript operator), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.19">7.19</a>
25235 [ ] (brackets punctuator), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a> __STDC_NO_ATOMICS__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
25236 \ (backslash character), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a> <a href="#7.17.1">7.17.1</a>
25237 \ (escape character), <a href="#6.4.4.4">6.4.4.4</a> __STDC_NO_COMPLEX__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
25238 \" (double-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.3.1">7.3.1</a>
25239 <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a> __STDC_NO_THREADS__ macro, <a href="#6.10.8.3">6.10.8.3</a>,
25240 \\ (backslash escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a> <a href="#7.26.1">7.26.1</a>
25241 \' (single-quote escape sequence), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> __STDC_NO_VLA__ macro, <a href="#6.10.8.3">6.10.8.3</a>
25242 \0 (null character), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> __STDC_UTF_16__ macro, <a href="#6.10.8.2">6.10.8.2</a>
25243 padding of binary stream, <a href="#7.21.2">7.21.2</a> __STDC_UTF_32__ macro, <a href="#6.10.8.2">6.10.8.2</a>
25244 \? (question-mark escape sequence), <a href="#6.4.4.4">6.4.4.4</a> __STDC_VERSION__ macro, <a href="#6.10.8.1">6.10.8.1</a>
25245 \a (alert escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> __STDC_WANT_LIB_EXT1__ macro, <a href="#K.3.1.1">K.3.1.1</a>
25246 \b (backspace escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> __TIME__ macro, <a href="#6.10.8.1">6.10.8.1</a>
25247 \f (form-feed escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, __VA_ARGS__ identifier, <a href="#6.10.3">6.10.3</a>, <a href="#6.10.3.1">6.10.3.1</a>
25248 <a href="#7.4.1.10">7.4.1.10</a> _Alignas, <a href="#6.7.5">6.7.5</a>
25249 \n (new-line escape sequence), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, _Alignof operator, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3">6.5.3</a>, <a href="#6.5.3.4">6.5.3.4</a>
25250 <a href="#7.4.1.10">7.4.1.10</a> _Atomic type qualifier, <a href="#6.7.3">6.7.3</a>
25251 \octal digits (octal-character escape sequence), _Atomic type specifier, <a href="#6.7.2.4">6.7.2.4</a>
25252 <a href="#6.4.4.4">6.4.4.4</a> _Bool type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#F.4">F.4</a>
25253 \r (carriage-return escape sequence), <a href="#5.2.2">5.2.2</a>, _Bool type conversions, <a href="#6.3.1.2">6.3.1.2</a>
25254 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> _Complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a>
25255 \t (horizontal-tab escape sequence), <a href="#5.2.2">5.2.2</a>, _Complex_I macro, <a href="#7.3.1">7.3.1</a>
25256 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a> _Exit function, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>
25257 \U (universal character names), <a href="#6.4.3">6.4.3</a> _Imaginary keyword, <a href="#G.2">G.2</a>
25259 [<a name="p658" href="#p658">page 658</a>] (<a href="#Contents">Contents</a>)
25261 _Imaginary types, <a href="#7.3.1">7.3.1</a>, <a href="#G">G</a> aliasing, <a href="#6.5">6.5</a>
25262 _Imaginary_I macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a> alignas macro, <a href="#7.15">7.15</a>
25263 _IOFBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a> aligned_alloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.1">7.22.3.1</a>
25264 _IOLBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.6">7.21.5.6</a> alignment, <a href="#3.2">3.2</a>, <a href="#6.2.8">6.2.8</a>, <a href="#7.22.3.1">7.22.3.1</a>
25265 _IONBF macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a> pointer, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.3">6.3.2.3</a>
25266 _Noreturn, <a href="#6.7.4">6.7.4</a> structure/union member, <a href="#6.7.2.1">6.7.2.1</a>
25267 _Noreturn header, <a href="#7.23">7.23</a> alignment header, <a href="#7.15">7.15</a>
25268 _Pragma operator, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a> alignment specifier, <a href="#6.7.5">6.7.5</a>
25269 _Static_assert, <a href="#6.7.10">6.7.10</a>, <a href="#7.2">7.2</a> alignof macro, <a href="#7.15">7.15</a>
25270 _Thread_local storage-class specifier, <a href="#6.2.4">6.2.4</a>, allocated storage, order and contiguity, <a href="#7.22.3">7.22.3</a>
25271 <a href="#6.7.1">6.7.1</a>, <a href="#7.26.1">7.26.1</a> alternative spellings header, <a href="#7.9">7.9</a>
25272 { } (braces punctuator), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a>, and macro, <a href="#7.9">7.9</a>
25273 <a href="#6.8.2">6.8.2</a> AND operators
25274 { } (compound-literal operator), <a href="#6.5.2.5">6.5.2.5</a> bitwise (&amp;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
25275 | (bitwise inclusive OR operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a> bitwise assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
25276 |= (bitwise inclusive OR assignment operator), logical (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a>
25277 <a href="#6.5.16.2">6.5.16.2</a> and_eq macro, <a href="#7.9">7.9</a>
25278 || (logical OR operator), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a> anonymous structure, <a href="#6.7.2.1">6.7.2.1</a>
25279 ~ (bitwise complement operator), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a> anonymous union, <a href="#6.7.2.1">6.7.2.1</a>
25280 ANSI/IEEE 754, <a href="#F.1">F.1</a>
25281 abort function, <a href="#7.2.1.1">7.2.1.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.21.3">7.21.3</a>, ANSI/IEEE 854, <a href="#F.1">F.1</a>
25282 <a href="#7.22.4.1">7.22.4.1</a>, <a href="#K.3.6.1.2">K.3.6.1.2</a> argc (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
25283 abort_handler_s function, <a href="#K.3.6.1.2">K.3.6.1.2</a> argument, <a href="#3.3">3.3</a>
25284 abs function, <a href="#7.22.6.1">7.22.6.1</a> array, <a href="#6.9.1">6.9.1</a>
25285 absolute-value functions default promotions, <a href="#6.5.2.2">6.5.2.2</a>
25286 complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a> function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
25287 integer, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.22.6.1">7.22.6.1</a> macro, substitution, <a href="#6.10.3.1">6.10.3.1</a>
25288 real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a> argument, complex, <a href="#7.3.9.1">7.3.9.1</a>
25289 abstract declarator, <a href="#6.7.7">6.7.7</a> argv (main function parameter), <a href="#5.1.2.2.1">5.1.2.2.1</a>
25290 abstract machine, <a href="#5.1.2.3">5.1.2.3</a> arithmetic constant expression, <a href="#6.6">6.6</a>
25291 access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a>, <a href="#L.2.1">L.2.1</a> arithmetic conversions, usual, see usual arithmetic
25292 accuracy, see floating-point accuracy conversions
25293 acos functions, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#F.10.1.1">F.10.1.1</a> arithmetic operators
25294 acos type-generic macro, <a href="#7.25">7.25</a> additive, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a>
25295 acosh functions, <a href="#7.12.5.1">7.12.5.1</a>, <a href="#F.10.2.1">F.10.2.1</a> bitwise, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a>, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a>
25296 acosh type-generic macro, <a href="#7.25">7.25</a> increment and decrement, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.3.1">6.5.3.1</a>
25297 acquire fence, <a href="#7.17.4">7.17.4</a> multiplicative, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
25298 acquire operation, <a href="#5.1.2.4">5.1.2.4</a> shift, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
25299 active position, <a href="#5.2.2">5.2.2</a> unary, <a href="#6.5.3.3">6.5.3.3</a>
25300 actual argument, <a href="#3.3">3.3</a> arithmetic types, <a href="#6.2.5">6.2.5</a>
25301 actual parameter (deprecated), <a href="#3.3">3.3</a> arithmetic, pointer, <a href="#6.5.6">6.5.6</a>
25302 addition assignment operator (+=), <a href="#6.5.16.2">6.5.16.2</a> array
25303 addition operator (+), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>, argument, <a href="#6.9.1">6.9.1</a>
25304 <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> declarator, <a href="#6.7.6.2">6.7.6.2</a>
25305 additive expressions, <a href="#6.5.6">6.5.6</a>, <a href="#G.5.2">G.5.2</a> initialization, <a href="#6.7.9">6.7.9</a>
25306 address constant, <a href="#6.6">6.6</a> multidimensional, <a href="#6.5.2.1">6.5.2.1</a>
25307 address operator (&amp;), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> parameter, <a href="#6.9.1">6.9.1</a>
25308 address-free, <a href="#7.17.5">7.17.5</a> storage order, <a href="#6.5.2.1">6.5.2.1</a>
25309 aggregate initialization, <a href="#6.7.9">6.7.9</a> subscript operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a>
25310 aggregate types, <a href="#6.2.5">6.2.5</a> subscripting, <a href="#6.5.2.1">6.5.2.1</a>
25311 alert escape sequence (\a), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> type, <a href="#6.2.5">6.2.5</a>
25313 [<a name="p659" href="#p659">page 659</a>] (<a href="#Contents">Contents</a>)
25315 type conversion, <a href="#6.3.2.1">6.3.2.1</a> <a href="#7.17.7.5">7.17.7.5</a>
25316 variable length, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a> atomic_flag type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a>
25317 arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> atomic_flag_clear functions, <a href="#7.17.8.2">7.17.8.2</a>
25318 as-if rule, <a href="#5.1.2.3">5.1.2.3</a> ATOMIC_FLAG_INIT macro, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.8">7.17.8</a>
25319 ASCII code set, <a href="#5.2.1.1">5.2.1.1</a> atomic_flag_test_and_set functions,
25320 asctime function, <a href="#7.27.3.1">7.27.3.1</a> <a href="#7.17.8.1">7.17.8.1</a>
25321 asctime_s function, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a> atomic_init generic function, <a href="#7.17.2.2">7.17.2.2</a>
25322 asin functions, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#F.10.1.2">F.10.1.2</a> ATOMIC_INT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25323 asin type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> atomic_is_lock_free generic function,
25324 asinh functions, <a href="#7.12.5.2">7.12.5.2</a>, <a href="#F.10.2.2">F.10.2.2</a> <a href="#7.17.5.1">7.17.5.1</a>
25325 asinh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> ATOMIC_LLONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25326 asm keyword, <a href="#J.5.10">J.5.10</a> atomic_load generic functions, <a href="#7.17.7.2">7.17.7.2</a>
25327 assert macro, <a href="#7.2.1.1">7.2.1.1</a> ATOMIC_LONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25328 assert.h header, <a href="#7.2">7.2</a> ATOMIC_LLONG_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25329 assignment ATOMIC_SHORT_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25330 compound, <a href="#6.5.16.2">6.5.16.2</a> atomic_signal_fence function, <a href="#7.17.4.2">7.17.4.2</a>
25331 conversion, <a href="#6.5.16.1">6.5.16.1</a> atomic_store generic functions, <a href="#7.17.7.1">7.17.7.1</a>
25332 expression, <a href="#6.5.16">6.5.16</a> atomic_thread_fence function, <a href="#7.17.4.1">7.17.4.1</a>
25333 operators, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a> ATOMIC_VAR_INIT macro, <a href="#7.17.2.1">7.17.2.1</a>
25334 simple, <a href="#6.5.16.1">6.5.16.1</a> ATOMIC_WCHAR_T_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a>
25335 associativity of operators, <a href="#6.5">6.5</a> atomics header, <a href="#7.17">7.17</a>, <a href="#7.31.8">7.31.8</a>
25336 asterisk punctuator (*), <a href="#6.7.6.1">6.7.6.1</a>, <a href="#6.7.6.2">6.7.6.2</a> auto storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
25337 at_quick_exit function, <a href="#7.22.4.2">7.22.4.2</a>, <a href="#7.22.4.3">7.22.4.3</a>, automatic storage duration, <a href="#5.2.3">5.2.3</a>, <a href="#6.2.4">6.2.4</a>
25338 <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>
25339 atan functions, <a href="#7.12.4.3">7.12.4.3</a>, <a href="#F.10.1.3">F.10.1.3</a> backslash character (\), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
25340 atan type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> backslash escape sequence (\\), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.10.9">6.10.9</a>
25341 atan2 functions, <a href="#7.12.4.4">7.12.4.4</a>, <a href="#F.10.1.4">F.10.1.4</a> backspace escape sequence (\b), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
25342 atan2 type-generic macro, <a href="#7.25">7.25</a> basic character set, <a href="#3.6">3.6</a>, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>
25343 atanh functions, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#F.10.2.3">F.10.2.3</a> basic types, <a href="#6.2.5">6.2.5</a>
25344 atanh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> behavior, <a href="#3.4">3.4</a>
25345 atexit function, <a href="#7.22.4.2">7.22.4.2</a>, <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>, binary streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>,
25346 <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>, <a href="#J.5.13">J.5.13</a> <a href="#7.21.9.4">7.21.9.4</a>
25347 atof function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.1">7.22.1.1</a> bit, <a href="#3.5">3.5</a>
25348 atoi function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> high order, <a href="#3.6">3.6</a>
25349 atol function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> low order, <a href="#3.6">3.6</a>
25350 atoll function, <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.2">7.22.1.2</a> bit-field, <a href="#6.7.2.1">6.7.2.1</a>
25351 atomic lock-free macros, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.5">7.17.5</a> bitand macro, <a href="#7.9">7.9</a>
25352 atomic operations, <a href="#5.1.2.4">5.1.2.4</a> bitor macro, <a href="#7.9">7.9</a>
25353 atomic types, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, bitwise operators, <a href="#6.5">6.5</a>
25354 <a href="#6.5.2.3">6.5.2.3</a>, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, <a href="#6.7.2.4">6.7.2.4</a>, <a href="#6.10.8.3">6.10.8.3</a>, AND, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.10">6.5.10</a>
25355 <a href="#7.17.6">7.17.6</a> AND assignment (&amp;=), <a href="#6.5.16.2">6.5.16.2</a>
25356 ATOMIC_CHAR_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a> complement (~), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a>
25357 ATOMIC_CHAR16_T_LOCK_FREE macro, exclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
25358 <a href="#7.17.1">7.17.1</a> exclusive OR assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
25359 ATOMIC_CHAR32_T_LOCK_FREE macro, inclusive OR, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a>
25360 <a href="#7.17.1">7.17.1</a> inclusive OR assignment (|=), <a href="#6.5.16.2">6.5.16.2</a>
25361 ATOMIC_CHAR_LOCK_FREE macro, <a href="#7.17.1">7.17.1</a> shift, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
25362 atomic_compare_exchange generic blank character, <a href="#7.4.1.3">7.4.1.3</a>
25363 functions, <a href="#7.17.7.4">7.17.7.4</a> block, <a href="#6.8">6.8</a>, <a href="#6.8.2">6.8.2</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a>
25364 atomic_exchange generic functions, <a href="#7.17.7.3">7.17.7.3</a> block scope, <a href="#6.2.1">6.2.1</a>
25365 atomic_fetch and modify generic functions, block structure, <a href="#6.2.1">6.2.1</a>
25367 [<a name="p660" href="#p660">page 660</a>] (<a href="#Contents">Contents</a>)
25369 bold type convention, <a href="#6.1">6.1</a> type-generic macro for, <a href="#7.25">7.25</a>
25370 bool macro, <a href="#7.18">7.18</a> cast expression, <a href="#6.5.4">6.5.4</a>
25371 boolean type, <a href="#6.3.1.2">6.3.1.2</a> cast operator (( )), <a href="#6.5.4">6.5.4</a>
25372 boolean type and values header, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a> catan functions, <a href="#7.3.5.3">7.3.5.3</a>, <a href="#G.6">G.6</a>
25373 boolean type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.2">6.3.1.2</a> type-generic macro for, <a href="#7.25">7.25</a>
25374 bounded undefined behavior, <a href="#L.2.2">L.2.2</a> catanh functions, <a href="#7.3.6.3">7.3.6.3</a>, <a href="#G.6.2.3">G.6.2.3</a>
25375 braces punctuator ({ }), <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a>, type-generic macro for, <a href="#7.25">7.25</a>
25376 <a href="#6.8.2">6.8.2</a> cbrt functions, <a href="#7.12.7.1">7.12.7.1</a>, <a href="#F.10.4.1">F.10.4.1</a>
25377 brackets operator ([ ]), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> cbrt type-generic macro, <a href="#7.25">7.25</a>
25378 brackets punctuator ([ ]), <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a> ccos functions, <a href="#7.3.5.4">7.3.5.4</a>, <a href="#G.6">G.6</a>
25379 branch cuts, <a href="#7.3.3">7.3.3</a> type-generic macro for, <a href="#7.25">7.25</a>
25380 break statement, <a href="#6.8.6.3">6.8.6.3</a> ccosh functions, <a href="#7.3.6.4">7.3.6.4</a>, <a href="#G.6.2.4">G.6.2.4</a>
25381 broken-down time, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.3">7.27.3</a>, type-generic macro for, <a href="#7.25">7.25</a>
25382 <a href="#7.27.3.1">7.27.3.1</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#7.27.3.5">7.27.3.5</a>, ceil functions, <a href="#7.12.9.1">7.12.9.1</a>, <a href="#F.10.6.1">F.10.6.1</a>
25383 <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> ceil type-generic macro, <a href="#7.25">7.25</a>
25384 bsearch function, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.1">7.22.5.1</a> cerf function, <a href="#7.31.1">7.31.1</a>
25385 bsearch_s function, <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a> cerfc function, <a href="#7.31.1">7.31.1</a>
25386 btowc function, <a href="#7.29.6.1.1">7.29.6.1.1</a> cexp functions, <a href="#7.3.7.1">7.3.7.1</a>, <a href="#G.6.3.1">G.6.3.1</a>
25387 BUFSIZ macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.5">7.21.5.5</a> type-generic macro for, <a href="#7.25">7.25</a>
25388 byte, <a href="#3.6">3.6</a>, <a href="#6.5.3.4">6.5.3.4</a> cexp2 function, <a href="#7.31.1">7.31.1</a>
25389 byte input/output functions, <a href="#7.21.1">7.21.1</a> cexpm1 function, <a href="#7.31.1">7.31.1</a>
25390 byte-oriented stream, <a href="#7.21.2">7.21.2</a> char type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>,
25391 <a href="#K.3.9.1.2">K.3.9.1.2</a>
25392 C program, <a href="#5.1.1.1">5.1.1.1</a> char type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
25393 c16rtomb function, <a href="#7.28.1.2">7.28.1.2</a> <a href="#6.3.1.8">6.3.1.8</a>
25394 c32rtomb function, <a href="#7.28.1.4">7.28.1.4</a> char16_t type, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>,
25395 cabs functions, <a href="#7.3.8.1">7.3.8.1</a>, <a href="#G.6">G.6</a> <a href="#7.28">7.28</a>
25396 type-generic macro for, <a href="#7.25">7.25</a> char32_t type, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>,
25397 cacos functions, <a href="#7.3.5.1">7.3.5.1</a>, <a href="#G.6.1.1">G.6.1.1</a> <a href="#7.28">7.28</a>
25398 type-generic macro for, <a href="#7.25">7.25</a> CHAR_BIT macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.7.2.1">6.7.2.1</a>
25399 cacosh functions, <a href="#7.3.6.1">7.3.6.1</a>, <a href="#G.6.2.1">G.6.2.1</a> CHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
25400 type-generic macro for, <a href="#7.25">7.25</a> CHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
25401 calendar time, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.2">7.27.2.2</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.2.4">7.27.2.4</a>, character, <a href="#3.7">3.7</a>, <a href="#3.7.1">3.7.1</a>
25402 <a href="#7.27.3.2">7.27.3.2</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>, character array initialization, <a href="#6.7.9">6.7.9</a>
25403 <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a> character case mapping functions, <a href="#7.4.2">7.4.2</a>
25404 call by value, <a href="#6.5.2.2">6.5.2.2</a> wide character, <a href="#7.30.3.1">7.30.3.1</a>
25405 call_once function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.2.1">7.26.2.1</a> extensible, <a href="#7.30.3.2">7.30.3.2</a>
25406 calloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.2">7.22.3.2</a> character classification functions, <a href="#7.4.1">7.4.1</a>
25407 carg functions, <a href="#7.3.9.1">7.3.9.1</a>, <a href="#G.6">G.6</a> wide character, <a href="#7.30.2.1">7.30.2.1</a>
25408 carg type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> extensible, <a href="#7.30.2.2">7.30.2.2</a>
25409 carriage-return escape sequence (\r), <a href="#5.2.2">5.2.2</a>, character constant, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
25410 <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.10">7.4.1.10</a> character display semantics, <a href="#5.2.2">5.2.2</a>
25411 carries a dependency, <a href="#5.1.2.4">5.1.2.4</a> character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.31.2">7.31.2</a>
25412 case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> character input/output functions, <a href="#7.21.7">7.21.7</a>, <a href="#K.3.5.4">K.3.5.4</a>
25413 case mapping functions wide character, <a href="#7.29.3">7.29.3</a>
25414 character, <a href="#7.4.2">7.4.2</a> character sets, <a href="#5.2.1">5.2.1</a>
25415 wide character, <a href="#7.30.3.1">7.30.3.1</a> character string literal, see string literal
25416 extensible, <a href="#7.30.3.2">7.30.3.2</a> character type conversion, <a href="#6.3.1.1">6.3.1.1</a>
25417 casin functions, <a href="#7.3.5.2">7.3.5.2</a>, <a href="#G.6">G.6</a> character types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.9">6.7.9</a>
25418 type-generic macro for, <a href="#7.25">7.25</a> characteristics of floating types header, <a href="#7.7">7.7</a>
25419 casinh functions, <a href="#7.3.6.2">7.3.6.2</a>, <a href="#G.6.2.2">G.6.2.2</a> cimag functions, <a href="#7.3.9.2">7.3.9.2</a>, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a>
25421 [<a name="p661" href="#p661">page 661</a>] (<a href="#Contents">Contents</a>)
25423 cimag type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> complex macro, <a href="#7.3.1">7.3.1</a>
25424 cis function, <a href="#G.6">G.6</a> complex numbers, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a>
25425 classification functions complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, <a href="#6.3.1.7">6.3.1.7</a>
25426 character, <a href="#7.4.1">7.4.1</a> complex type domain, <a href="#6.2.5">6.2.5</a>
25427 floating-point, <a href="#7.12.3">7.12.3</a> complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#G">G</a>
25428 wide character, <a href="#7.30.2.1">7.30.2.1</a> complex.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>,
25429 extensible, <a href="#7.30.2.2">7.30.2.2</a> <a href="#7.3">7.3</a>, <a href="#7.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
25430 clearerr function, <a href="#7.21.10.1">7.21.10.1</a> compliance, see conformance
25431 clgamma function, <a href="#7.31.1">7.31.1</a> components of time, <a href="#7.27.1">7.27.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
25432 clock function, <a href="#7.27.2.1">7.27.2.1</a> composite type, <a href="#6.2.7">6.2.7</a>
25433 clock_t type, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.1">7.27.2.1</a> compound assignment, <a href="#6.5.16.2">6.5.16.2</a>
25434 CLOCKS_PER_SEC macro, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.1">7.27.2.1</a> compound literals, <a href="#6.5.2.5">6.5.2.5</a>
25435 clog functions, <a href="#7.3.7.2">7.3.7.2</a>, <a href="#G.6.3.2">G.6.3.2</a> compound statement, <a href="#6.8.2">6.8.2</a>
25436 type-generic macro for, <a href="#7.25">7.25</a> compound-literal operator (( ){ }), <a href="#6.5.2.5">6.5.2.5</a>
25437 clog10 function, <a href="#7.31.1">7.31.1</a> concatenation functions
25438 clog1p function, <a href="#7.31.1">7.31.1</a> string, <a href="#7.24.3">7.24.3</a>, <a href="#K.3.7.2">K.3.7.2</a>
25439 clog2 function, <a href="#7.31.1">7.31.1</a> wide string, <a href="#7.29.4.3">7.29.4.3</a>, <a href="#K.3.9.2.2">K.3.9.2.2</a>
25440 CMPLX macros, <a href="#7.3.9.3">7.3.9.3</a> concatenation, preprocessing, see preprocessing
25441 cnd_broadcast function, <a href="#7.26.3.1">7.26.3.1</a>, <a href="#7.26.3.5">7.26.3.5</a>, concatenation
25442 <a href="#7.26.3.6">7.26.3.6</a> conceptual models, <a href="#5.1">5.1</a>
25443 cnd_destroy function, <a href="#7.26.3.2">7.26.3.2</a> conditional features, <a href="#4">4</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a>,
25444 cnd_init function, <a href="#7.26.3.3">7.26.3.3</a> <a href="#7.1.2">7.1.2</a>, <a href="#F.1">F.1</a>, <a href="#G.1">G.1</a>, <a href="#K.2">K.2</a>, <a href="#L.1">L.1</a>
25445 cnd_signal function, <a href="#7.26.3.4">7.26.3.4</a>, <a href="#7.26.3.5">7.26.3.5</a>, conditional inclusion, <a href="#6.10.1">6.10.1</a>
25446 <a href="#7.26.3.6">7.26.3.6</a> conditional operator (? :), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.15">6.5.15</a>
25447 cnd_t type, <a href="#7.26.1">7.26.1</a> conflict, <a href="#5.1.2.4">5.1.2.4</a>
25448 cnd_timedwait function, <a href="#7.26.3.5">7.26.3.5</a> conformance, <a href="#4">4</a>
25449 cnd_wait function, <a href="#7.26.3.3">7.26.3.3</a>, <a href="#7.26.3.6">7.26.3.6</a> conj functions, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a>
25450 collating sequences, <a href="#5.2.1">5.2.1</a> conj type-generic macro, <a href="#7.25">7.25</a>
25451 colon punctuator (:), <a href="#6.7.2.1">6.7.2.1</a> const type qualifier, <a href="#6.7.3">6.7.3</a>
25452 comma operator (,), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.17">6.5.17</a> const-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.7.3">6.7.3</a>
25453 comma punctuator (,), <a href="#6.5.2">6.5.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.7.2.2">6.7.2.2</a>, constant expression, <a href="#6.6">6.6</a>, <a href="#F.8.4">F.8.4</a>
25454 <a href="#6.7.2.3">6.7.2.3</a>, <a href="#6.7.9">6.7.9</a> constants, <a href="#6.4.4">6.4.4</a>
25455 command processor, <a href="#7.22.4.8">7.22.4.8</a> as primary expression, <a href="#6.5.1">6.5.1</a>
25456 comment delimiters (/* */ and //), <a href="#6.4.9">6.4.9</a> character, <a href="#6.4.4.4">6.4.4.4</a>
25457 comments, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.4.9">6.4.9</a> enumeration, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
25458 common definitions header, <a href="#7.19">7.19</a> floating, <a href="#6.4.4.2">6.4.4.2</a>
25459 common extensions, <a href="#J.5">J.5</a> hexadecimal, <a href="#6.4.4.1">6.4.4.1</a>
25460 common initial sequence, <a href="#6.5.2.3">6.5.2.3</a> integer, <a href="#6.4.4.1">6.4.4.1</a>
25461 common real type, <a href="#6.3.1.8">6.3.1.8</a> octal, <a href="#6.4.4.1">6.4.4.1</a>
25462 common warnings, <a href="#I">I</a> constraint, <a href="#3.8">3.8</a>, <a href="#4">4</a>
25463 comparison functions, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.1">7.22.5.1</a>, <a href="#7.22.5.2">7.22.5.2</a>, constraint_handler_t type, <a href="#K.3.6">K.3.6</a>
25464 <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a> consume operation, <a href="#5.1.2.4">5.1.2.4</a>
25465 string, <a href="#7.24.4">7.24.4</a> content of structure/union/enumeration, <a href="#6.7.2.3">6.7.2.3</a>
25466 wide string, <a href="#7.29.4.4">7.29.4.4</a> contiguity of allocated storage, <a href="#7.22.3">7.22.3</a>
25467 comparison macros, <a href="#7.12.14">7.12.14</a> continue statement, <a href="#6.8.6.2">6.8.6.2</a>
25468 comparison, pointer, <a href="#6.5.8">6.5.8</a> contracted expression, <a href="#6.5">6.5</a>, <a href="#7.12.2">7.12.2</a>, <a href="#F.7">F.7</a>
25469 compatible type, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.6">6.7.6</a> control character, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a>
25470 compl macro, <a href="#7.9">7.9</a> control wide character, <a href="#7.30.2">7.30.2</a>
25471 complement operator (~), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.3.3">6.5.3.3</a> conversion, <a href="#6.3">6.3</a>
25472 complete type, <a href="#6.2.5">6.2.5</a> arithmetic operands, <a href="#6.3.1">6.3.1</a>
25473 complex arithmetic header, <a href="#7.3">7.3</a>, <a href="#7.31.1">7.31.1</a> array argument, <a href="#6.9.1">6.9.1</a>
25475 [<a name="p662" href="#p662">page 662</a>] (<a href="#Contents">Contents</a>)
25477 array parameter, <a href="#6.9.1">6.9.1</a> correctly rounded result, <a href="#3.9">3.9</a>
25478 arrays, <a href="#6.3.2.1">6.3.2.1</a> corresponding real type, <a href="#6.2.5">6.2.5</a>
25479 boolean, <a href="#6.3.1.2">6.3.1.2</a> cos functions, <a href="#7.12.4.5">7.12.4.5</a>, <a href="#F.10.1.5">F.10.1.5</a>
25480 boolean, characters, and integers, <a href="#6.3.1.1">6.3.1.1</a> cos type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
25481 by assignment, <a href="#6.5.16.1">6.5.16.1</a> cosh functions, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#F.10.2.4">F.10.2.4</a>
25482 by return statement, <a href="#6.8.6.4">6.8.6.4</a> cosh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
25483 complex types, <a href="#6.3.1.6">6.3.1.6</a> cpow functions, <a href="#7.3.8.2">7.3.8.2</a>, <a href="#G.6.4.1">G.6.4.1</a>
25484 explicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.25">7.25</a>
25485 function, <a href="#6.3.2.1">6.3.2.1</a> cproj functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a>
25486 function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a> cproj type-generic macro, <a href="#7.25">7.25</a>
25487 function designators, <a href="#6.3.2.1">6.3.2.1</a> creal functions, <a href="#7.3.9.6">7.3.9.6</a>, <a href="#G.6">G.6</a>
25488 function parameter, <a href="#6.9.1">6.9.1</a> creal type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
25489 imaginary, <a href="#G.4.1">G.4.1</a> critical undefined behavior, <a href="#L.2.3">L.2.3</a>
25490 imaginary and complex, <a href="#G.4.3">G.4.3</a> csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a>
25491 implicit, <a href="#6.3">6.3</a> type-generic macro for, <a href="#7.25">7.25</a>
25492 lvalues, <a href="#6.3.2.1">6.3.2.1</a> csinh functions, <a href="#7.3.6.5">7.3.6.5</a>, <a href="#G.6.2.5">G.6.2.5</a>
25493 pointer, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> type-generic macro for, <a href="#7.25">7.25</a>
25494 real and complex, <a href="#6.3.1.7">6.3.1.7</a> csqrt functions, <a href="#7.3.8.3">7.3.8.3</a>, <a href="#G.6.4.2">G.6.4.2</a>
25495 real and imaginary, <a href="#G.4.2">G.4.2</a> type-generic macro for, <a href="#7.25">7.25</a>
25496 real floating and integer, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> ctan functions, <a href="#7.3.5.6">7.3.5.6</a>, <a href="#G.6">G.6</a>
25497 real floating types, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#F.3">F.3</a> type-generic macro for, <a href="#7.25">7.25</a>
25498 signed and unsigned integers, <a href="#6.3.1.3">6.3.1.3</a> ctanh functions, <a href="#7.3.6.6">7.3.6.6</a>, <a href="#G.6.2.6">G.6.2.6</a>
25499 usual arithmetic, see usual arithmetic type-generic macro for, <a href="#7.25">7.25</a>
25500 conversions ctgamma function, <a href="#7.31.1">7.31.1</a>
25501 void type, <a href="#6.3.2.2">6.3.2.2</a> ctime function, <a href="#7.27.3.2">7.27.3.2</a>
25502 conversion functions ctime_s function, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>
25503 multibyte/wide character, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a> ctype.h header, <a href="#7.4">7.4</a>, <a href="#7.31.2">7.31.2</a>
25504 extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a> current object, <a href="#6.7.9">6.7.9</a>
25505 restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a> CX_LIMITED_RANGE pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.3.4">7.3.4</a>
25506 multibyte/wide string, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
25507 restartable, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> data race, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.2.2">7.22.2.2</a>, <a href="#7.22.3">7.22.3</a>,
25508 numeric, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a> <a href="#7.22.4.6">7.22.4.6</a>, <a href="#7.24.5.8">7.24.5.8</a>, <a href="#7.24.6.2">7.24.6.2</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.28.1">7.28.1</a>,
25509 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1">7.29.4.1</a> <a href="#7.29.6.3">7.29.6.3</a>, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>
25510 single byte/wide character, <a href="#7.29.6.1">7.29.6.1</a> data stream, see streams
25511 time, <a href="#7.27.3">7.27.3</a>, <a href="#K.3.8.2">K.3.8.2</a> date and time header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
25512 wide character, <a href="#7.29.5">7.29.5</a> Daylight Saving Time, <a href="#7.27.1">7.27.1</a>
25513 conversion specifier, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, DBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25514 <a href="#7.29.2.2">7.29.2.2</a> DBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25515 conversion state, <a href="#7.22.7">7.22.7</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.28.1.1">7.28.1.1</a>, DBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25516 <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.6">7.29.6</a>, DBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25517 <a href="#7.29.6.2.1">7.29.6.2.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, DBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25518 <a href="#7.29.6.4">7.29.6.4</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#K.3.6.4">K.3.6.4</a>, DBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25519 <a href="#K.3.9.3.1">K.3.9.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>, DBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25520 <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a> DBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25521 conversion state functions, <a href="#7.29.6.2">7.29.6.2</a> DBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25522 copying functions DBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25523 string, <a href="#7.24.2">7.24.2</a>, <a href="#K.3.7.1">K.3.7.1</a> DBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25524 wide string, <a href="#7.29.4.2">7.29.4.2</a>, <a href="#K.3.9.2.1">K.3.9.2.1</a> DBL_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25525 copysign functions, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#7.12.11.1">7.12.11.1</a>, <a href="#F.3">F.3</a>, decimal constant, <a href="#6.4.4.1">6.4.4.1</a>
25526 <a href="#F.10.8.1">F.10.8.1</a> decimal digit, <a href="#5.2.1">5.2.1</a>
25527 copysign type-generic macro, <a href="#7.25">7.25</a> decimal-point character, <a href="#7.1.1">7.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
25529 [<a name="p663" href="#p663">page 663</a>] (<a href="#Contents">Contents</a>)
25531 DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.2">F.2</a>
25532 <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.5">F.5</a> double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>,
25533 declaration specifiers, <a href="#6.7">6.7</a> <a href="#6.3.1.8">6.3.1.8</a>
25534 declarations, <a href="#6.7">6.7</a> double-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a>
25535 function, <a href="#6.7.6.3">6.7.6.3</a> double-quote escape sequence (\"), <a href="#6.4.4.4">6.4.4.4</a>,
25536 pointer, <a href="#6.7.6.1">6.7.6.1</a> <a href="#6.4.5">6.4.5</a>, <a href="#6.10.9">6.10.9</a>
25537 structure/union, <a href="#6.7.2.1">6.7.2.1</a> double_t type, <a href="#7.12">7.12</a>
25538 typedef, <a href="#6.7.8">6.7.8</a>
25539 declarator, <a href="#6.7.6">6.7.6</a> EDOM macro, <a href="#7.5">7.5</a>, <a href="#7.12.1">7.12.1</a>, see also domain error
25540 abstract, <a href="#6.7.7">6.7.7</a> effective type, <a href="#6.5">6.5</a>
25541 declarator type derivation, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.6">6.7.6</a> EILSEQ macro, <a href="#7.5">7.5</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.28.1.1">7.28.1.1</a>, <a href="#7.28.1.2">7.28.1.2</a>,
25542 decrement operators, see arithmetic operators, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.3</a>,
25543 increment and decrement <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>,
25544 default argument promotions, <a href="#6.5.2.2">6.5.2.2</a> see also encoding error
25545 default initialization, <a href="#6.7.9">6.7.9</a> element type, <a href="#6.2.5">6.2.5</a>
25546 default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> elif preprocessing directive, <a href="#6.10.1">6.10.1</a>
25547 define preprocessing directive, <a href="#6.10.3">6.10.3</a> ellipsis punctuator (...), <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a>
25548 defined operator, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.8">6.10.8</a> else preprocessing directive, <a href="#6.10.1">6.10.1</a>
25549 definition, <a href="#6.7">6.7</a> else statement, <a href="#6.8.4.1">6.8.4.1</a>
25550 function, <a href="#6.9.1">6.9.1</a> empty statement, <a href="#6.8.3">6.8.3</a>
25551 dependency-ordered before, <a href="#5.1.2.4">5.1.2.4</a> encoding error, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
25552 derived declarator types, <a href="#6.2.5">6.2.5</a> <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.6">7.21.6.6</a>, <a href="#7.21.6.8">7.21.6.8</a>,
25553 derived types, <a href="#6.2.5">6.2.5</a> <a href="#7.21.6.10">7.21.6.10</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.28.1.1">7.28.1.1</a>,
25554 designated initializer, <a href="#6.7.9">6.7.9</a> <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
25555 destringizing, <a href="#6.10.9">6.10.9</a> <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.7">7.29.2.7</a>,
25556 device input/output, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.11">7.29.2.11</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.2">7.29.3.2</a>,
25557 diagnostic message, <a href="#3.10">3.10</a>, <a href="#5.1.1.3">5.1.1.3</a> <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.4">7.29.3.4</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>,
25558 diagnostics, <a href="#5.1.1.3">5.1.1.3</a> <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.6.5.2">K.3.6.5.2</a>,
25559 diagnostics header, <a href="#7.2">7.2</a> <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a>
25560 difftime function, <a href="#7.27.2.2">7.27.2.2</a> end-of-file, <a href="#7.29.1">7.29.1</a>
25561 digit, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> end-of-file indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>,
25562 digraphs, <a href="#6.4.6">6.4.6</a> <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>,
25563 direct input/output functions, <a href="#7.21.8">7.21.8</a> <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.10.1">7.21.10.1</a>, <a href="#7.21.10.2">7.21.10.2</a>, <a href="#7.29.3.1">7.29.3.1</a>,
25564 display device, <a href="#5.2.2">5.2.2</a> <a href="#7.29.3.10">7.29.3.10</a>
25565 div function, <a href="#7.22.6.2">7.22.6.2</a> end-of-file macro, see EOF macro
25566 div_t type, <a href="#7.22">7.22</a> end-of-line indicator, <a href="#5.2.1">5.2.1</a>
25567 division assignment operator (/=), <a href="#6.5.16.2">6.5.16.2</a> endif preprocessing directive, <a href="#6.10.1">6.10.1</a>
25568 division operator (/), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, <a href="#G.5.1">G.5.1</a> enum type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.2.2">6.7.2.2</a>
25569 do statement, <a href="#6.8.5.2">6.8.5.2</a> enumerated type, <a href="#6.2.5">6.2.5</a>
25570 documentation of implementation, <a href="#4">4</a> enumeration, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.2">6.7.2.2</a>
25571 domain error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.4.1">7.12.4.1</a>, <a href="#7.12.4.2">7.12.4.2</a>, <a href="#7.12.4.4">7.12.4.4</a>, enumeration constant, <a href="#6.2.1">6.2.1</a>, <a href="#6.4.4.3">6.4.4.3</a>
25572 <a href="#7.12.5.1">7.12.5.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#7.12.6.7">7.12.6.7</a>, enumeration content, <a href="#6.7.2.3">6.7.2.3</a>
25573 <a href="#7.12.6.8">7.12.6.8</a>, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, enumeration members, <a href="#6.7.2.2">6.7.2.2</a>
25574 <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#7.12.9.5">7.12.9.5</a>, enumeration specifiers, <a href="#6.7.2.2">6.7.2.2</a>
25575 <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a> enumeration tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
25576 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> enumerator, <a href="#6.7.2.2">6.7.2.2</a>
25577 double _Complex type, <a href="#6.2.5">6.2.5</a> environment, <a href="#5">5</a>
25578 double _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>, environment functions, <a href="#7.22.4">7.22.4</a>, <a href="#K.3.6.2">K.3.6.2</a>
25579 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a> environment list, <a href="#7.22.4.6">7.22.4.6</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>
25580 double _Imaginary type, <a href="#G.2">G.2</a> environmental considerations, <a href="#5.2">5.2</a>
25581 double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.2">7.21.6.2</a>, environmental limits, <a href="#5.2.4">5.2.4</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.21.2">7.21.2</a>,
25583 [<a name="p664" href="#p664">page 664</a>] (<a href="#Contents">Contents</a>)
25585 <a href="#7.21.3">7.21.3</a>, <a href="#7.21.4.4">7.21.4.4</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.4.2">7.22.4.2</a>, evaluation format, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#7.12">7.12</a>
25586 <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a> evaluation method, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#F.8.5">F.8.5</a>
25587 EOF macro, <a href="#7.4">7.4</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.1">7.21.5.1</a>, <a href="#7.21.5.2">7.21.5.2</a>, evaluation of expression, <a href="#5.1.2.3">5.1.2.3</a>
25588 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.11">7.21.6.11</a>, evaluation order, see order of evaluation
25589 <a href="#7.21.6.14">7.21.6.14</a>, <a href="#7.21.7.1">7.21.7.1</a>, <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.4">7.21.7.4</a>, exceptional condition, <a href="#6.5">6.5</a>
25590 <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.7.9">7.21.7.9</a>, excess precision, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>
25591 <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.4">7.29.2.4</a>, excess range, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>
25592 <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.2.12">7.29.2.12</a>, exclusive OR operators
25593 <a href="#7.29.3.4">7.29.3.4</a>, <a href="#7.29.6.1.1">7.29.6.1.1</a>, <a href="#7.29.6.1.2">7.29.6.1.2</a>, <a href="#K.3.5.3.7">K.3.5.3.7</a>, bitwise (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a>
25594 <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>, bitwise assignment (^=), <a href="#6.5.16.2">6.5.16.2</a>
25595 <a href="#K.3.9.1.5">K.3.9.1.5</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>, executable program, <a href="#5.1.1.1">5.1.1.1</a>
25596 <a href="#K.3.9.1.14">K.3.9.1.14</a> execution character set, <a href="#5.2.1">5.2.1</a>
25597 epoch, <a href="#7.27.2.5">7.27.2.5</a> execution environment, <a href="#5">5</a>, <a href="#5.1.2">5.1.2</a>, see also
25598 equal-sign punctuator (=), <a href="#6.7">6.7</a>, <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.9">6.7.9</a> environmental limits
25599 equal-to operator, see equality operator execution sequence, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.8">6.8</a>
25600 equality expressions, <a href="#6.5.9">6.5.9</a> exit function, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>,
25601 equality operator (==), <a href="#6.5.9">6.5.9</a> <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>, <a href="#7.26.5.5">7.26.5.5</a>
25602 ERANGE macro, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.12.1">7.12.1</a>, EXIT_FAILURE macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>
25603 <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, see EXIT_SUCCESS macro, <a href="#7.22">7.22</a>, <a href="#7.22.4.4">7.22.4.4</a>, <a href="#7.26.5.5">7.26.5.5</a>
25604 also range error, pole error exp functions, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#F.10.3.1">F.10.3.1</a>
25605 erf functions, <a href="#7.12.8.1">7.12.8.1</a>, <a href="#F.10.5.1">F.10.5.1</a> exp type-generic macro, <a href="#7.25">7.25</a>
25606 erf type-generic macro, <a href="#7.25">7.25</a> exp2 functions, <a href="#7.12.6.2">7.12.6.2</a>, <a href="#F.10.3.2">F.10.3.2</a>
25607 erfc functions, <a href="#7.12.8.2">7.12.8.2</a>, <a href="#F.10.5.2">F.10.5.2</a> exp2 type-generic macro, <a href="#7.25">7.25</a>
25608 erfc type-generic macro, <a href="#7.25">7.25</a> explicit conversion, <a href="#6.3">6.3</a>
25609 errno macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.3.2">7.3.2</a>, <a href="#7.5">7.5</a>, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, expm1 functions, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#F.10.3.3">F.10.3.3</a>
25610 <a href="#7.12.1">7.12.1</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.10.4">7.21.10.4</a>, expm1 type-generic macro, <a href="#7.25">7.25</a>
25611 <a href="#7.22.1">7.22.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.24.6.2">7.24.6.2</a>, <a href="#7.28.1.1">7.28.1.1</a>, exponent part, <a href="#6.4.4.2">6.4.4.2</a>
25612 <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.3">7.28.1.3</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.3.1">7.29.3.1</a>, exponential functions
25613 <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>, complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
25614 <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#J.5.17">J.5.17</a>, real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a>
25615 <a href="#K.3.1.3">K.3.1.3</a>, <a href="#K.3.7.4.2">K.3.7.4.2</a> expression, <a href="#6.5">6.5</a>
25616 errno.h header, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a> assignment, <a href="#6.5.16">6.5.16</a>
25617 errno_t type, <a href="#K.3.2">K.3.2</a>, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.6">K.3.6</a>, <a href="#K.3.6.1.1">K.3.6.1.1</a>, cast, <a href="#6.5.4">6.5.4</a>
25618 <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a> constant, <a href="#6.6">6.6</a>
25619 error evaluation, <a href="#5.1.2.3">5.1.2.3</a>
25620 domain, see domain error full, <a href="#6.8">6.8</a>
25621 encoding, see encoding error order of evaluation, see order of evaluation
25622 pole, see pole error parenthesized, <a href="#6.5.1">6.5.1</a>
25623 range, see range error primary, <a href="#6.5.1">6.5.1</a>
25624 error conditions, <a href="#7.12.1">7.12.1</a> unary, <a href="#6.5.3">6.5.3</a>
25625 error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a> expression statement, <a href="#6.8.3">6.8.3</a>
25626 error indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, extended alignment, <a href="#6.2.8">6.2.8</a>
25627 <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.21.7.7">7.21.7.7</a>, extended character set, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.1.2">5.2.1.2</a>
25628 <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.10.1">7.21.10.1</a>, <a href="#7.21.10.3">7.21.10.3</a>, extended characters, <a href="#5.2.1">5.2.1</a>
25629 <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.3</a> extended integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>,
25630 error preprocessing directive, <a href="#4">4</a>, <a href="#6.10.5">6.10.5</a> <a href="#7.20">7.20</a>
25631 error-handling functions, <a href="#7.21.10">7.21.10</a>, <a href="#7.24.6.2">7.24.6.2</a>, extended multibyte and wide character utilities
25632 <a href="#K.3.7.4.2">K.3.7.4.2</a>, <a href="#K.3.7.4.3">K.3.7.4.3</a> header, <a href="#7.29">7.29</a>, <a href="#7.31.16">7.31.16</a>
25633 errors header, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a> extended multibyte/wide character conversion
25634 escape character (\), <a href="#6.4.4.4">6.4.4.4</a> utilities, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
25635 escape sequences, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.11.4">6.11.4</a> extensible wide character case mapping functions,
25637 [<a name="p665" href="#p665">page 665</a>] (<a href="#Contents">Contents</a>)
25639 <a href="#7.30.3.2">7.30.3.2</a> <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.8.1">7.21.8.1</a>
25640 extensible wide character classification functions, fgetpos function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a>
25641 <a href="#7.30.2.2">7.30.2.2</a> fgets function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.2">7.21.7.2</a>, <a href="#K.3.5.4.1">K.3.5.4.1</a>
25642 extern storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.7.1">6.7.1</a> fgetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.29.3.1">7.29.3.1</a>,
25643 external definition, <a href="#6.9">6.9</a> <a href="#7.29.3.6">7.29.3.6</a>
25644 external identifiers, underscore, <a href="#7.1.3">7.1.3</a> fgetws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.2">7.29.3.2</a>
25645 external linkage, <a href="#6.2.2">6.2.2</a> field width, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>
25646 external name, <a href="#6.4.2.1">6.4.2.1</a> file, <a href="#7.21.3">7.21.3</a>
25647 external object definitions, <a href="#6.9.2">6.9.2</a> access functions, <a href="#7.21.5">7.21.5</a>, <a href="#K.3.5.2">K.3.5.2</a>
25648 name, <a href="#7.21.3">7.21.3</a>
25649 fabs functions, <a href="#7.12.7.2">7.12.7.2</a>, <a href="#F.3">F.3</a>, <a href="#F.10.4.2">F.10.4.2</a> operations, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a>
25650 fabs type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> position indicator, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>,
25651 false macro, <a href="#7.18">7.18</a> <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, <a href="#7.21.7.3">7.21.7.3</a>, <a href="#7.21.7.10">7.21.7.10</a>,
25652 fclose function, <a href="#7.21.5.1">7.21.5.1</a> <a href="#7.21.8.1">7.21.8.1</a>, <a href="#7.21.8.2">7.21.8.2</a>, <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.2">7.21.9.2</a>,
25653 fdim functions, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#F.10.9.1">F.10.9.1</a> <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.21.9.4">7.21.9.4</a>, <a href="#7.21.9.5">7.21.9.5</a>, <a href="#7.29.3.1">7.29.3.1</a>,
25654 fdim type-generic macro, <a href="#7.25">7.25</a> <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.10">7.29.3.10</a>
25655 FE_ALL_EXCEPT macro, <a href="#7.6">7.6</a> positioning functions, <a href="#7.21.9">7.21.9</a>
25656 FE_DFL_ENV macro, <a href="#7.6">7.6</a> file scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.9">6.9</a>
25657 FE_DIVBYZERO macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> FILE type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
25658 FE_DOWNWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> FILENAME_MAX macro, <a href="#7.21.1">7.21.1</a>
25659 FE_INEXACT macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> flags, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>, see also floating-point
25660 FE_INVALID macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> status flag
25661 FE_OVERFLOW macro, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> flexible array member, <a href="#6.7.2.1">6.7.2.1</a>
25662 FE_TONEAREST macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> float _Complex type, <a href="#6.2.5">6.2.5</a>
25663 FE_TOWARDZERO macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> float _Complex type conversion, <a href="#6.3.1.6">6.3.1.6</a>,
25664 FE_UNDERFLOW macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
25665 FE_UPWARD macro, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> float _Imaginary type, <a href="#G.2">G.2</a>
25666 feclearexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.1">7.6.2.1</a>, <a href="#F.3">F.3</a> float type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#F.2">F.2</a>
25667 fegetenv function, <a href="#7.6.4.1">7.6.4.1</a>, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a> float type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>,
25668 fegetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.2">7.6.2.2</a>, <a href="#F.3">F.3</a> <a href="#6.3.1.8">6.3.1.8</a>
25669 fegetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.1">7.6.3.1</a>, <a href="#F.3">F.3</a> float.h header, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.22.1.3">7.22.1.3</a>,
25670 feholdexcept function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>
25671 <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a> float_t type, <a href="#7.12">7.12</a>
25672 fence, <a href="#5.1.2.4">5.1.2.4</a> floating constant, <a href="#6.4.4.2">6.4.4.2</a>
25673 fences, <a href="#7.17.4">7.17.4</a> floating suffix, f or <a href="#F">F</a>, <a href="#6.4.4.2">6.4.4.2</a>
25674 fenv.h header, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, <a href="#6.3.1.7">6.3.1.7</a>,
25675 <a href="#7.31.4">7.31.4</a>, <a href="#F">F</a>, <a href="#H">H</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
25676 FENV_ACCESS pragma, <a href="#6.10.6">6.10.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#F.8">F.8</a>, <a href="#F.9">F.9</a>, floating types, <a href="#6.2.5">6.2.5</a>, <a href="#6.11.1">6.11.1</a>
25677 <a href="#F.10">F.10</a> floating-point accuracy, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.5">6.5</a>,
25678 fenv_t type, <a href="#7.6">7.6</a> <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.5">F.5</a>, see also contracted expression
25679 feof function, <a href="#7.21.10.2">7.21.10.2</a> floating-point arithmetic functions, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a>
25680 feraiseexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.3">7.6.2.3</a>, <a href="#F.3">F.3</a> floating-point classification functions, <a href="#7.12.3">7.12.3</a>
25681 ferror function, <a href="#7.21.10.3">7.21.10.3</a> floating-point control mode, <a href="#7.6">7.6</a>, <a href="#F.8.6">F.8.6</a>
25682 fesetenv function, <a href="#7.6.4.3">7.6.4.3</a>, <a href="#F.3">F.3</a> floating-point environment, <a href="#7.6">7.6</a>, <a href="#F.8">F.8</a>, <a href="#F.8.6">F.8.6</a>
25683 fesetexceptflag function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.4">7.6.2.4</a>, <a href="#F.3">F.3</a> floating-point environment header, <a href="#7.6">7.6</a>, <a href="#7.31.4">7.31.4</a>
25684 fesetround function, <a href="#7.6">7.6</a>, <a href="#7.6.3.2">7.6.3.2</a>, <a href="#F.3">F.3</a> floating-point exception, <a href="#7.6">7.6</a>, <a href="#7.6.2">7.6.2</a>, <a href="#F.10">F.10</a>
25685 fetestexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.5">7.6.2.5</a>, <a href="#F.3">F.3</a> floating-point number, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.2.5">6.2.5</a>
25686 feupdateenv function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a> floating-point rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25687 fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.8.6">F.8.6</a>
25688 fflush function, <a href="#7.21.5.2">7.21.5.2</a>, <a href="#7.21.5.3">7.21.5.3</a> floor functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.10.6.2">F.10.6.2</a>
25689 fgetc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.7.1">7.21.7.1</a>, floor type-generic macro, <a href="#7.25">7.25</a>
25691 [<a name="p666" href="#p666">page 666</a>] (<a href="#Contents">Contents</a>)
25693 FLT_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> FP_NAN macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
25694 FLT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> FP_NORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
25695 FLT_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> FP_SUBNORMAL macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
25696 FLT_EVAL_METHOD macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.6">6.6</a>, <a href="#7.12">7.12</a>, FP_ZERO macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a>
25697 <a href="#F.10.11">F.10.11</a> fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a>
25698 FLT_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fpos_t type, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>
25699 FLT_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.1">7.21.6.1</a>,
25700 FLT_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.6">7.21.6.6</a>,
25701 FLT_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.3">F.3</a>, <a href="#K.3.5.3.1">K.3.5.3.1</a>
25702 FLT_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fprintf_s function, <a href="#K.3.5.3.1">K.3.5.3.1</a>
25703 FLT_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fputc function, <a href="#5.2.2">5.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.7.3">7.21.7.3</a>,
25704 FLT_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.21.8.2">7.21.8.2</a>
25705 FLT_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fputs function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.4">7.21.7.4</a>
25706 FLT_RADIX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.22.1.3">7.22.1.3</a>, fputwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.29.3.3">7.29.3.3</a>,
25707 <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a> <a href="#7.29.3.8">7.29.3.8</a>
25708 FLT_ROUNDS macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> fputws function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.4">7.29.3.4</a>
25709 FLT_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> fread function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.1">7.21.8.1</a>
25710 fma functions, <a href="#7.12">7.12</a>, <a href="#7.12.13.1">7.12.13.1</a>, <a href="#F.10.10.1">F.10.10.1</a> free function, <a href="#7.22.3.3">7.22.3.3</a>, <a href="#7.22.3.5">7.22.3.5</a>
25711 fma type-generic macro, <a href="#7.25">7.25</a> freestanding execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>,
25712 fmax functions, <a href="#7.12.12.2">7.12.12.2</a>, <a href="#F.10.9.2">F.10.9.2</a> <a href="#5.1.2.1">5.1.2.1</a>
25713 fmax type-generic macro, <a href="#7.25">7.25</a> freopen function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.4">7.21.5.4</a>
25714 fmin functions, <a href="#7.12.12.3">7.12.12.3</a>, <a href="#F.10.9.3">F.10.9.3</a> freopen_s function, <a href="#K.3.5.2.2">K.3.5.2.2</a>
25715 fmin type-generic macro, <a href="#7.25">7.25</a> frexp functions, <a href="#7.12.6.4">7.12.6.4</a>, <a href="#F.10.3.4">F.10.3.4</a>
25716 fmod functions, <a href="#7.12.10.1">7.12.10.1</a>, <a href="#F.10.7.1">F.10.7.1</a> frexp type-generic macro, <a href="#7.25">7.25</a>
25717 fmod type-generic macro, <a href="#7.25">7.25</a> fscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
25718 fopen function, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.5.4">7.21.5.4</a>, <a href="#K.3.5.2.1">K.3.5.2.1</a> <a href="#7.21.6.4">7.21.6.4</a>, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#F.3">F.3</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>
25719 FOPEN_MAX macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.4.3">7.21.4.3</a>, fscanf_s function, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>,
25720 <a href="#K.3.5.1.1">K.3.5.1.1</a> <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>
25721 fopen_s function, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.2.1">K.3.5.2.1</a>, fseek function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>,
25722 <a href="#K.3.5.2.2">K.3.5.2.2</a> <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a>, <a href="#7.21.9.5">7.21.9.5</a>, <a href="#7.29.3.10">7.29.3.10</a>
25723 for statement, <a href="#6.8.5">6.8.5</a>, <a href="#6.8.5.3">6.8.5.3</a> fsetpos function, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>,
25724 form-feed character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> <a href="#7.21.9.1">7.21.9.1</a>, <a href="#7.21.9.3">7.21.9.3</a>, <a href="#7.29.3.10">7.29.3.10</a>
25725 form-feed escape sequence (\f), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, ftell function, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a>
25726 <a href="#7.4.1.10">7.4.1.10</a> full declarator, <a href="#6.7.6">6.7.6</a>
25727 formal argument (deprecated), <a href="#3.16">3.16</a> full expression, <a href="#6.8">6.8</a>
25728 formal parameter, <a href="#3.16">3.16</a> fully buffered stream, <a href="#7.21.3">7.21.3</a>
25729 format conversion of integer types header, <a href="#7.8">7.8</a>, function
25730 <a href="#7.31.5">7.31.5</a> argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
25731 formatted input/output functions, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.21.6">7.21.6</a>, body, <a href="#6.9.1">6.9.1</a>
25732 <a href="#K.3.5.3">K.3.5.3</a> call, <a href="#6.5.2.2">6.5.2.2</a>
25733 wide character, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</a> library, <a href="#7.1.4">7.1.4</a>
25734 fortran keyword, <a href="#J.5.9">J.5.9</a> declarator, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.11.6">6.11.6</a>
25735 forward reference, <a href="#3.11">3.11</a> definition, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.7">6.11.7</a>
25736 FP_CONTRACT pragma, <a href="#6.5">6.5</a>, <a href="#6.10.6">6.10.6</a>, <a href="#7.12.2">7.12.2</a>, see designator, <a href="#6.3.2.1">6.3.2.1</a>
25737 also contracted expression image, <a href="#5.2.3">5.2.3</a>
25738 FP_FAST_FMA macro, <a href="#7.12">7.12</a> inline, <a href="#6.7.4">6.7.4</a>
25739 FP_FAST_FMAF macro, <a href="#7.12">7.12</a> library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.4">7.1.4</a>
25740 FP_FAST_FMAL macro, <a href="#7.12">7.12</a> name length, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a>
25741 FP_ILOGB0 macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a> no-return, <a href="#6.7.4">6.7.4</a>
25742 FP_ILOGBNAN macro, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a> parameter, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a>
25743 FP_INFINITE macro, <a href="#7.12">7.12</a>, <a href="#F.3">F.3</a> prototype, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.7">6.2.7</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>,
25745 [<a name="p667" href="#p667">page 667</a>] (<a href="#Contents">Contents</a>)
25747 <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.9.1">6.9.1</a>, <a href="#6.11.6">6.11.6</a>, <a href="#6.11.7">6.11.7</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.12">7.12</a> header, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7.1.2">7.1.2</a>, see also standard headers
25748 prototype scope, <a href="#6.2.1">6.2.1</a>, <a href="#6.7.6.2">6.7.6.2</a> header names, <a href="#6.4">6.4</a>, <a href="#6.4.7">6.4.7</a>, <a href="#6.10.2">6.10.2</a>
25749 recursive call, <a href="#6.5.2.2">6.5.2.2</a> hexadecimal constant, <a href="#6.4.4.1">6.4.4.1</a>
25750 return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a> hexadecimal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
25751 scope, <a href="#6.2.1">6.2.1</a> hexadecimal prefix, <a href="#6.4.4.1">6.4.4.1</a>
25752 type, <a href="#6.2.5">6.2.5</a> hexadecimal-character escape sequence
25753 type conversion, <a href="#6.3.2.1">6.3.2.1</a> (\x hexadecimal digits), <a href="#6.4.4.4">6.4.4.4</a>
25754 function specifiers, <a href="#6.7.4">6.7.4</a> high-order bit, <a href="#3.6">3.6</a>
25755 function type, <a href="#6.2.5">6.2.5</a> horizontal-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
25756 function-call operator (( )), <a href="#6.5.2.2">6.5.2.2</a> horizontal-tab escape sequence (\r), <a href="#7.30.2.1.3">7.30.2.1.3</a>
25757 function-like macro, <a href="#6.10.3">6.10.3</a> horizontal-tab escape sequence (\t), <a href="#5.2.2">5.2.2</a>,
25758 fundamental alignment, <a href="#6.2.8">6.2.8</a> <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, <a href="#7.4.1.10">7.4.1.10</a>
25759 future directions hosted execution environment, <a href="#4">4</a>, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.2">5.1.2.2</a>
25760 language, <a href="#6.11">6.11</a> HUGE_VAL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>,
25761 library, <a href="#7.31">7.31</a> <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
25762 fwide function, <a href="#7.21.2">7.21.2</a>, <a href="#7.29.3.5">7.29.3.5</a> HUGE_VALF macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>,
25763 fwprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
25764 <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.5">7.29.2.5</a>, HUGE_VALL macro, <a href="#7.12">7.12</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.22.1.3">7.22.1.3</a>,
25765 <a href="#7.29.2.11">7.29.2.11</a>, <a href="#K.3.9.1.1">K.3.9.1.1</a> <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#F.10">F.10</a>
25766 fwprintf_s function, <a href="#K.3.9.1.1">K.3.9.1.1</a> hyperbolic functions
25767 fwrite function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.8.2">7.21.8.2</a> complex, <a href="#7.3.6">7.3.6</a>, <a href="#G.6.2">G.6.2</a>
25768 fwscanf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, real, <a href="#7.12.5">7.12.5</a>, <a href="#F.10.2">F.10.2</a>
25769 <a href="#7.29.2.4">7.29.2.4</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.12">7.29.2.12</a>, <a href="#7.29.3.10">7.29.3.10</a>, hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.10.4.3">F.10.4.3</a>
25770 <a href="#K.3.9.1.2">K.3.9.1.2</a> hypot type-generic macro, <a href="#7.25">7.25</a>
25771 fwscanf_s function, <a href="#K.3.9.1.2">K.3.9.1.2</a>, <a href="#K.3.9.1.5">K.3.9.1.5</a>,
25772 <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a> <a href="#I">I</a> macro, <a href="#7.3.1">7.3.1</a>, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#G.6">G.6</a>
25773 identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a>
25774 gamma functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.10.5">F.10.5</a> linkage, see linkage
25775 general utilities, <a href="#K.3.6">K.3.6</a> maximum length, <a href="#6.4.2.1">6.4.2.1</a>
25776 wide string, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a> name spaces, <a href="#6.2.3">6.2.3</a>
25777 general utilities header, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a> reserved, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a>, <a href="#K.3.1.2">K.3.1.2</a>
25778 general wide string utilities, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a> scope, <a href="#6.2.1">6.2.1</a>
25779 generic association, <a href="#6.5.1.1">6.5.1.1</a> type, <a href="#6.2.5">6.2.5</a>
25780 generic parameters, <a href="#7.25">7.25</a> identifier list, <a href="#6.7.6">6.7.6</a>
25781 generic selection, <a href="#6.5.1">6.5.1</a>, <a href="#6.5.1.1">6.5.1.1</a> identifier nondigit, <a href="#6.4.2.1">6.4.2.1</a>
25782 getc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.5">7.21.7.5</a>, <a href="#7.21.7.6">7.21.7.6</a> IEC 559, <a href="#F.1">F.1</a>
25783 getchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.6">7.21.7.6</a> IEC 60559, <a href="#2">2</a>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.3.3">7.3.3</a>,
25784 getenv function, <a href="#7.22.4.6">7.22.4.6</a> <a href="#7.6">7.6</a>, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.14">7.12.14</a>, <a href="#F">F</a>, <a href="#G">G</a>,
25785 getenv_s function, <a href="#K.3.6.2.1">K.3.6.2.1</a> <a href="#H.1">H.1</a>
25786 gets function, <a href="#K.3.5.4.1">K.3.5.4.1</a> IEEE 754, <a href="#F.1">F.1</a>
25787 gets_s function, <a href="#K.3.5.4.1">K.3.5.4.1</a> IEEE 854, <a href="#F.1">F.1</a>
25788 getwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.6">7.29.3.6</a>, <a href="#7.29.3.7">7.29.3.7</a> IEEE floating-point arithmetic standard, see
25789 getwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.7">7.29.3.7</a> IEC 60559, ANSI/IEEE 754,
25790 gmtime function, <a href="#7.27.3.3">7.27.3.3</a> ANSI/IEEE 854
25791 gmtime_s function, <a href="#K.3.8.2.3">K.3.8.2.3</a> if preprocessing directive, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>,
25792 goto statement, <a href="#6.2.1">6.2.1</a>, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.6.1">6.8.6.1</a> <a href="#6.10.1">6.10.1</a>, <a href="#7.1.4">7.1.4</a>
25793 graphic characters, <a href="#5.2.1">5.2.1</a> if statement, <a href="#6.8.4.1">6.8.4.1</a>
25794 greater-than operator (&gt;), <a href="#6.5.8">6.5.8</a> ifdef preprocessing directive, <a href="#6.10.1">6.10.1</a>
25795 greater-than-or-equal-to operator (&gt;=), <a href="#6.5.8">6.5.8</a> ifndef preprocessing directive, <a href="#6.10.1">6.10.1</a>
25796 ignore_handler_s function, <a href="#K.3.6.1.3">K.3.6.1.3</a>
25797 happens before, <a href="#5.1.2.4">5.1.2.4</a> ilogb functions, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.10.3.5">F.10.3.5</a>
25799 [<a name="p668" href="#p668">page 668</a>] (<a href="#Contents">Contents</a>)
25801 ilogb type-generic macro, <a href="#7.25">7.25</a> formatted, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</a>
25802 imaginary macro, <a href="#7.3.1">7.3.1</a>, <a href="#G.6">G.6</a> input/output header, <a href="#7.21">7.21</a>, <a href="#7.31.11">7.31.11</a>, <a href="#K.3.5">K.3.5</a>
25803 imaginary numbers, <a href="#G">G</a> input/output, device, <a href="#5.1.2.3">5.1.2.3</a>
25804 imaginary type domain, <a href="#G.2">G.2</a> int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.7.2">6.7.2</a>
25805 imaginary types, <a href="#G">G</a> int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
25806 imaxabs function, <a href="#7.8.2.1">7.8.2.1</a> <a href="#6.3.1.8">6.3.1.8</a>
25807 imaxdiv function, <a href="#7.8">7.8</a>, <a href="#7.8.2.2">7.8.2.2</a> INT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a>
25808 imaxdiv_t type, <a href="#7.8">7.8</a> INT_FASTN_MIN macros, <a href="#7.20.2.3">7.20.2.3</a>
25809 implementation, <a href="#3.12">3.12</a> int_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a>
25810 implementation limit, <a href="#3.13">3.13</a>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.4.2.1">6.4.2.1</a>, INT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a>
25811 <a href="#6.7.6">6.7.6</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#E">E</a>, see also environmental INT_LEASTN_MIN macros, <a href="#7.20.2.2">7.20.2.2</a>
25812 limits int_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a>
25813 implementation-defined behavior, <a href="#3.4.1">3.4.1</a>, <a href="#4">4</a>, <a href="#J.3">J.3</a> INT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>, <a href="#7.12.6.5">7.12.6.5</a>
25814 implementation-defined value, <a href="#3.19.1">3.19.1</a> INT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.12">7.12</a>
25815 implicit conversion, <a href="#6.3">6.3</a> integer arithmetic functions, <a href="#7.8.2.1">7.8.2.1</a>, <a href="#7.8.2.2">7.8.2.2</a>,
25816 implicit initialization, <a href="#6.7.9">6.7.9</a> <a href="#7.22.6">7.22.6</a>
25817 include preprocessing directive, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.2">6.10.2</a> integer character constant, <a href="#6.4.4.4">6.4.4.4</a>
25818 inclusive OR operators integer constant, <a href="#6.4.4.1">6.4.4.1</a>
25819 bitwise (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a> integer constant expression, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.6">6.6</a>, <a href="#6.7.2.1">6.7.2.1</a>,
25820 bitwise assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> <a href="#6.7.2.2">6.7.2.2</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.7.10">6.7.10</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#6.10.1">6.10.1</a>,
25821 incomplete type, <a href="#6.2.5">6.2.5</a> <a href="#7.1.4">7.1.4</a>
25822 increment operators, see arithmetic operators, integer conversion rank, <a href="#6.3.1.1">6.3.1.1</a>
25823 increment and decrement integer promotions, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.3.1.1">6.3.1.1</a>,
25824 indeterminate value, <a href="#3.19.2">3.19.2</a> <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.3.3">6.5.3.3</a>, <a href="#6.5.7">6.5.7</a>, <a href="#6.8.4.2">6.8.4.2</a>, <a href="#7.20.2">7.20.2</a>, <a href="#7.20.3">7.20.3</a>,
25825 indeterminately sequenced, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>
25826 <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, see also sequenced before, integer suffix, <a href="#6.4.4.1">6.4.4.1</a>
25827 unsequenced integer type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
25828 indirection operator (*), <a href="#6.5.2.1">6.5.2.1</a>, <a href="#6.5.3.2">6.5.3.2</a> <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a>
25829 inequality operator (!=), <a href="#6.5.9">6.5.9</a> integer types, <a href="#6.2.5">6.2.5</a>, <a href="#7.20">7.20</a>
25830 infinitary, <a href="#7.12.1">7.12.1</a> extended, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#7.20">7.20</a>
25831 INFINITY macro, <a href="#7.3.9.5">7.3.9.5</a>, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> integer types header, <a href="#7.20">7.20</a>, <a href="#7.31.10">7.31.10</a>
25832 initial position, <a href="#5.2.2">5.2.2</a> inter-thread happens before, <a href="#5.1.2.4">5.1.2.4</a>
25833 initial shift state, <a href="#5.2.1.2">5.2.1.2</a> interactive device, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.3">7.21.5.3</a>
25834 initialization, <a href="#5.1.2">5.1.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.5">6.5.2.5</a>, <a href="#6.7.9">6.7.9</a>, internal linkage, <a href="#6.2.2">6.2.2</a>
25835 <a href="#F.8.5">F.8.5</a> internal name, <a href="#6.4.2.1">6.4.2.1</a>
25836 in blocks, <a href="#6.8">6.8</a> interrupt, <a href="#5.2.3">5.2.3</a>
25837 initializer, <a href="#6.7.9">6.7.9</a> INTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a>
25838 permitted form, <a href="#6.6">6.6</a> INTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.2.5">7.20.2.5</a>
25839 string literal, <a href="#6.3.2.1">6.3.2.1</a> INTMAX_MIN macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.2.5">7.20.2.5</a>
25840 inline, <a href="#6.7.4">6.7.4</a> intmax_t type, <a href="#7.20.1.5">7.20.1.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
25841 inner scope, <a href="#6.2.1">6.2.1</a> <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
25842 input failure, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>, INTN_C macros, <a href="#7.20.4.1">7.20.4.1</a>
25843 <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>, <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, INTN_MAX macros, <a href="#7.20.2.1">7.20.2.1</a>
25844 <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>, <a href="#K.3.9.1.5">K.3.9.1.5</a>, INTN_MIN macros, <a href="#7.20.2.1">7.20.2.1</a>
25845 <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a> intN_t types, <a href="#7.20.1.1">7.20.1.1</a>
25846 input/output functions INTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a>
25847 character, <a href="#7.21.7">7.21.7</a>, <a href="#K.3.5.4">K.3.5.4</a> INTPTR_MIN macro, <a href="#7.20.2.4">7.20.2.4</a>
25848 direct, <a href="#7.21.8">7.21.8</a> intptr_t type, <a href="#7.20.1.4">7.20.1.4</a>
25849 formatted, <a href="#7.21.6">7.21.6</a>, <a href="#K.3.5.3">K.3.5.3</a> inttypes.h header, <a href="#7.8">7.8</a>, <a href="#7.31.5">7.31.5</a>
25850 wide character, <a href="#7.29.2">7.29.2</a>, <a href="#K.3.9.1">K.3.9.1</a> isalnum function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.9">7.4.1.9</a>, <a href="#7.4.1.10">7.4.1.10</a>
25851 wide character, <a href="#7.29.3">7.29.3</a> isalpha function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a>
25853 [<a name="p669" href="#p669">page 669</a>] (<a href="#Contents">Contents</a>)
25855 isblank function, <a href="#7.4.1.3">7.4.1.3</a> iswpunct function, <a href="#7.30.2.1">7.30.2.1</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>,
25856 iscntrl function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.4">7.4.1.4</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>,
25857 <a href="#7.4.1.11">7.4.1.11</a> <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
25858 isdigit function, <a href="#7.4.1.1">7.4.1.1</a>, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.5">7.4.1.5</a>, iswspace function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>,
25859 <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.11.1.1">7.11.1.1</a> <a href="#7.29.4.1.1">7.29.4.1.1</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.6">7.30.2.1.6</a>,
25860 isfinite macro, <a href="#7.12.3.2">7.12.3.2</a>, <a href="#F.3">F.3</a> <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.2.1.10">7.30.2.1.10</a>,
25861 isgraph function, <a href="#7.4.1.6">7.4.1.6</a> <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
25862 isgreater macro, <a href="#7.12.14.1">7.12.14.1</a>, <a href="#F.3">F.3</a> iswupper function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>,
25863 isgreaterequal macro, <a href="#7.12.14.2">7.12.14.2</a>, <a href="#F.3">F.3</a> <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.1.2">7.30.3.1.2</a>
25864 isinf macro, <a href="#7.12.3.3">7.12.3.3</a> iswxdigit function, <a href="#7.30.2.1.12">7.30.2.1.12</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>
25865 isless macro, <a href="#7.12.14.3">7.12.14.3</a>, <a href="#F.3">F.3</a> isxdigit function, <a href="#7.4.1.12">7.4.1.12</a>, <a href="#7.11.1.1">7.11.1.1</a>
25866 islessequal macro, <a href="#7.12.14.4">7.12.14.4</a>, <a href="#F.3">F.3</a> italic type convention, <a href="#3">3</a>, <a href="#6.1">6.1</a>
25867 islessgreater macro, <a href="#7.12.14.5">7.12.14.5</a>, <a href="#F.3">F.3</a> iteration statements, <a href="#6.8.5">6.8.5</a>
25868 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>,
25869 <a href="#7.4.2.2">7.4.2.2</a> jmp_buf type, <a href="#7.13">7.13</a>
25870 isnan macro, <a href="#7.12.3.4">7.12.3.4</a>, <a href="#F.3">F.3</a> jump statements, <a href="#6.8.6">6.8.6</a>
25871 isnormal macro, <a href="#7.12.3.5">7.12.3.5</a>
25872 ISO 31-11, <a href="#2">2</a>, <a href="#3">3</a> keywords, <a href="#6.4.1">6.4.1</a>, <a href="#G.2">G.2</a>, <a href="#J.5.9">J.5.9</a>, <a href="#J.5.10">J.5.10</a>
25873 ISO 4217, <a href="#2">2</a>, <a href="#7.11.2.1">7.11.2.1</a> kill_dependency macro, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.17.3.1">7.17.3.1</a>
25874 ISO 8601, <a href="#2">2</a>, <a href="#7.27.3.5">7.27.3.5</a> known constant size, <a href="#6.2.5">6.2.5</a>
25875 ISO/IEC 10646, <a href="#2">2</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.4.3">6.4.3</a>, <a href="#6.10.8.2">6.10.8.2</a>
25876 ISO/IEC 10976-1, <a href="#H.1">H.1</a> <a href="#L">L</a>_tmpnam macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.4">7.21.4.4</a>
25877 ISO/IEC 2382-1, <a href="#2">2</a>, <a href="#3">3</a> <a href="#L">L</a>_tmpnam_s macro, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
25878 ISO/IEC 646, <a href="#2">2</a>, <a href="#5.2.1.1">5.2.1.1</a> label name, <a href="#6.2.1">6.2.1</a>, <a href="#6.2.3">6.2.3</a>
25879 ISO/IEC 9945-2, <a href="#7.11">7.11</a> labeled statement, <a href="#6.8.1">6.8.1</a>
25880 iso646.h header, <a href="#4">4</a>, <a href="#7.9">7.9</a> labs function, <a href="#7.22.6.1">7.22.6.1</a>
25881 isprint function, <a href="#5.2.2">5.2.2</a>, <a href="#7.4.1.8">7.4.1.8</a> language, <a href="#6">6</a>
25882 ispunct function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, future directions, <a href="#6.11">6.11</a>
25883 <a href="#7.4.1.11">7.4.1.11</a> syntax summary, <a href="#A">A</a>
25884 isspace function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.7">7.4.1.7</a>, <a href="#7.4.1.9">7.4.1.9</a>, Latin alphabet, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
25885 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, LC_ALL macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
25886 <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.2.2">7.29.2.2</a> LC_COLLATE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.4.3">7.24.4.3</a>,
25887 isunordered macro, <a href="#7.12.14.6">7.12.14.6</a>, <a href="#F.3">F.3</a> <a href="#7.29.4.4.2">7.29.4.4.2</a>
25888 isupper function, <a href="#7.4.1.2">7.4.1.2</a>, <a href="#7.4.1.11">7.4.1.11</a>, <a href="#7.4.2.1">7.4.2.1</a>, LC_CTYPE macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.22">7.22</a>, <a href="#7.22.7">7.22.7</a>,
25889 <a href="#7.4.2.2">7.4.2.2</a> <a href="#7.22.8">7.22.8</a>, <a href="#7.29.6">7.29.6</a>, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>,
25890 iswalnum function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.9">7.30.2.1.9</a>, <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>, <a href="#K.3.6.4">K.3.6.4</a>, <a href="#K.3.6.5">K.3.6.5</a>
25891 <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a> LC_MONETARY macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
25892 iswalpha function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, LC_NUMERIC macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
25893 <a href="#7.30.2.2.1">7.30.2.2.1</a> LC_TIME macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.27.3.5">7.27.3.5</a>
25894 iswblank function, <a href="#7.30.2.1.3">7.30.2.1.3</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a> lconv structure type, <a href="#7.11">7.11</a>
25895 iswcntrl function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.4">7.30.2.1.4</a>, LDBL_DECIMAL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25896 <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a> LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25897 iswctype function, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a> LDBL_EPSILON macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25898 iswdigit function, <a href="#7.30.2.1.1">7.30.2.1.1</a>, <a href="#7.30.2.1.2">7.30.2.1.2</a>, LDBL_HAS_SUBNORM macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25899 <a href="#7.30.2.1.5">7.30.2.1.5</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, <a href="#7.30.2.1.11">7.30.2.1.11</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a> LDBL_MANT_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25900 iswgraph function, <a href="#7.30.2.1">7.30.2.1</a>, <a href="#7.30.2.1.6">7.30.2.1.6</a>, LDBL_MAX macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25901 <a href="#7.30.2.1.10">7.30.2.1.10</a>, <a href="#7.30.2.2.1">7.30.2.2.1</a> LDBL_MAX_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25902 iswlower function, <a href="#7.30.2.1.2">7.30.2.1.2</a>, <a href="#7.30.2.1.7">7.30.2.1.7</a>, LDBL_MAX_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25903 <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.1.2">7.30.3.1.2</a> LDBL_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25904 iswprint function, <a href="#7.30.2.1.6">7.30.2.1.6</a>, <a href="#7.30.2.1.8">7.30.2.1.8</a>, LDBL_MIN_10_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25905 <a href="#7.30.2.2.1">7.30.2.2.1</a> LDBL_MIN_EXP macro, <a href="#5.2.4.2.2">5.2.4.2.2</a>
25907 [<a name="p670" href="#p670">page 670</a>] (<a href="#Contents">Contents</a>)
25909 LDBL_TRUE_MIN macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> llround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a>
25910 ldexp functions, <a href="#7.12.6.6">7.12.6.6</a>, <a href="#F.10.3.6">F.10.3.6</a> llround type-generic macro, <a href="#7.25">7.25</a>
25911 ldexp type-generic macro, <a href="#7.25">7.25</a> local time, <a href="#7.27.1">7.27.1</a>
25912 ldiv function, <a href="#7.22.6.2">7.22.6.2</a> locale, <a href="#3.4.2">3.4.2</a>
25913 ldiv_t type, <a href="#7.22">7.22</a> locale-specific behavior, <a href="#3.4.2">3.4.2</a>, <a href="#J.4">J.4</a>
25914 leading underscore in identifiers, <a href="#7.1.3">7.1.3</a> locale.h header, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
25915 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>
25916 left-shift operator (&lt;&lt;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a> localization header, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
25917 length localtime function, <a href="#7.27.3.4">7.27.3.4</a>
25918 external name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> localtime_s function, <a href="#K.3.8.2.4">K.3.8.2.4</a>
25919 function name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> log functions, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#F.10.3.7">F.10.3.7</a>
25920 identifier, <a href="#6.4.2.1">6.4.2.1</a> log type-generic macro, <a href="#7.25">7.25</a>
25921 internal name, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a> log10 functions, <a href="#7.12.6.8">7.12.6.8</a>, <a href="#F.10.3.8">F.10.3.8</a>
25922 length function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.24.6.3">7.24.6.3</a>, <a href="#7.29.4.6.1">7.29.4.6.1</a>, log10 type-generic macro, <a href="#7.25">7.25</a>
25923 <a href="#7.29.6.3.1">7.29.6.3.1</a>, <a href="#K.3.7.4.4">K.3.7.4.4</a>, <a href="#K.3.9.2.4.1">K.3.9.2.4.1</a> log1p functions, <a href="#7.12.6.9">7.12.6.9</a>, <a href="#F.10.3.9">F.10.3.9</a>
25924 length modifier, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, log1p type-generic macro, <a href="#7.25">7.25</a>
25925 <a href="#7.29.2.2">7.29.2.2</a> log2 functions, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#F.10.3.10">F.10.3.10</a>
25926 less-than operator (&lt;), <a href="#6.5.8">6.5.8</a> log2 type-generic macro, <a href="#7.25">7.25</a>
25927 less-than-or-equal-to operator (&lt;=), <a href="#6.5.8">6.5.8</a> logarithmic functions
25928 letter, <a href="#5.2.1">5.2.1</a>, <a href="#7.4">7.4</a> complex, <a href="#7.3.7">7.3.7</a>, <a href="#G.6.3">G.6.3</a>
25929 lexical elements, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a> real, <a href="#7.12.6">7.12.6</a>, <a href="#F.10.3">F.10.3</a>
25930 lgamma functions, <a href="#7.12.8.3">7.12.8.3</a>, <a href="#F.10.5.3">F.10.5.3</a> logb functions, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.11">F.10.3.11</a>
25931 lgamma type-generic macro, <a href="#7.25">7.25</a> logb type-generic macro, <a href="#7.25">7.25</a>
25932 library, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#7">7</a>, <a href="#K.3">K.3</a> logical operators
25933 future directions, <a href="#7.31">7.31</a> AND (&amp;&amp;), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.13">6.5.13</a>
25934 summary, <a href="#B">B</a> negation (!), <a href="#6.5.3.3">6.5.3.3</a>
25935 terms, <a href="#7.1.1">7.1.1</a> OR (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a>
25936 use of functions, <a href="#7.1.4">7.1.4</a> logical source lines, <a href="#5.1.1.2">5.1.1.2</a>
25937 lifetime, <a href="#6.2.4">6.2.4</a> long double _Complex type, <a href="#6.2.5">6.2.5</a>
25938 limits long double _Complex type conversion,
25939 environmental, see environmental limits <a href="#6.3.1.6">6.3.1.6</a>, <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
25940 implementation, see implementation limits long double _Imaginary type, <a href="#G.2">G.2</a>
25941 numerical, see numerical limits long double suffix, l or <a href="#L">L</a>, <a href="#6.4.4.2">6.4.4.2</a>
25942 translation, see translation limits long double type, <a href="#6.2.5">6.2.5</a>, <a href="#6.4.4.2">6.4.4.2</a>, <a href="#6.7.2">6.7.2</a>,
25943 limits.h header, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a> <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.2">F.2</a>
25944 line buffered stream, <a href="#7.21.3">7.21.3</a> long double type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>,
25945 line number, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8.1">6.10.8.1</a> <a href="#6.3.1.7">6.3.1.7</a>, <a href="#6.3.1.8">6.3.1.8</a>
25946 line preprocessing directive, <a href="#6.10.4">6.10.4</a> long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.1">7.21.6.1</a>,
25947 lines, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#7.21.2">7.21.2</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
25948 preprocessing directive, <a href="#6.10">6.10</a> long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
25949 linkage, <a href="#6.2.2">6.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.4">6.7.4</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.9">6.9</a>, <a href="#6.9.2">6.9.2</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
25950 <a href="#6.11.2">6.11.2</a> long integer suffix, l or <a href="#L">L</a>, <a href="#6.4.4.1">6.4.4.1</a>
25951 llabs function, <a href="#7.22.6.1">7.22.6.1</a> long long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>,
25952 lldiv function, <a href="#7.22.6.2">7.22.6.2</a> <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
25953 lldiv_t type, <a href="#7.22">7.22</a> long long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>,
25954 LLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
25955 <a href="#7.29.4.1.2">7.29.4.1.2</a> long long integer suffix, ll or LL, <a href="#6.4.4.1">6.4.4.1</a>
25956 LLONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, LONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>
25957 <a href="#7.29.4.1.2">7.29.4.1.2</a> LONG_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>
25958 llrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.5">F.10.6.5</a> longjmp function, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>, <a href="#7.22.4.4">7.22.4.4</a>,
25959 llrint type-generic macro, <a href="#7.25">7.25</a> <a href="#7.22.4.7">7.22.4.7</a>
25961 [<a name="p671" href="#p671">page 671</a>] (<a href="#Contents">Contents</a>)
25963 loop body, <a href="#6.8.5">6.8.5</a> <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6.3.1">7.29.6.3.1</a>, <a href="#7.29.6.3.2">7.29.6.3.2</a>,
25964 low-order bit, <a href="#3.6">3.6</a> <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>
25965 lowercase letter, <a href="#5.2.1">5.2.1</a> mbsinit function, <a href="#7.29.6.2.1">7.29.6.2.1</a>
25966 lrint functions, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.5">F.10.6.5</a> mbsrtowcs function, <a href="#7.29.6.4.1">7.29.6.4.1</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
25967 lrint type-generic macro, <a href="#7.25">7.25</a> mbsrtowcs_s function, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>
25968 lround functions, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.10.6.7">F.10.6.7</a> mbstate_t type, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.1">7.21.6.1</a>,
25969 lround type-generic macro, <a href="#7.25">7.25</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.28">7.28</a>, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
25970 lvalue, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.3.1">6.5.3.1</a>, <a href="#6.5.16">6.5.16</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6">7.29.6</a>, <a href="#7.29.6.2.1">7.29.6.2.1</a>, <a href="#7.29.6.3">7.29.6.3</a>,
25971 <a href="#6.7.2.4">6.7.2.4</a> <a href="#7.29.6.3.1">7.29.6.3.1</a>, <a href="#7.29.6.4">7.29.6.4</a>
25972 lvalue conversion, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.5.16.1">6.5.16.1</a>, mbstowcs function, <a href="#6.4.5">6.4.5</a>, <a href="#7.22.8.1">7.22.8.1</a>, <a href="#7.29.6.4">7.29.6.4</a>
25973 <a href="#6.5.16.2">6.5.16.2</a> mbstowcs_s function, <a href="#K.3.6.5.1">K.3.6.5.1</a>
25974 mbtowc function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.22.7.2">7.22.7.2</a>,
25975 macro argument substitution, <a href="#6.10.3.1">6.10.3.1</a> <a href="#7.22.8.1">7.22.8.1</a>, <a href="#7.29.6.3">7.29.6.3</a>
25976 macro definition member access operators (. and -&gt;), <a href="#6.5.2.3">6.5.2.3</a>
25977 library function, <a href="#7.1.4">7.1.4</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
25978 macro invocation, <a href="#6.10.3">6.10.3</a> memchr function, <a href="#7.24.5.1">7.24.5.1</a>
25979 macro name, <a href="#6.10.3">6.10.3</a> memcmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.1">7.24.4.1</a>
25980 length, <a href="#5.2.4.1">5.2.4.1</a> memcpy function, <a href="#7.24.2.1">7.24.2.1</a>
25981 predefined, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a> memcpy_s function, <a href="#K.3.7.1.1">K.3.7.1.1</a>
25982 redefinition, <a href="#6.10.3">6.10.3</a> memmove function, <a href="#7.24.2.2">7.24.2.2</a>
25983 scope, <a href="#6.10.3.5">6.10.3.5</a> memmove_s function, <a href="#K.3.7.1.2">K.3.7.1.2</a>
25984 macro parameter, <a href="#6.10.3">6.10.3</a> memory location, <a href="#3.14">3.14</a>
25985 macro preprocessor, <a href="#6.10">6.10</a> memory management functions, <a href="#7.22.3">7.22.3</a>
25986 macro replacement, <a href="#6.10.3">6.10.3</a> memory_order type, <a href="#7.17.1">7.17.1</a>, <a href="#7.17.3">7.17.3</a>
25987 magnitude, complex, <a href="#7.3.8.1">7.3.8.1</a> memset function, <a href="#7.24.6.1">7.24.6.1</a>, <a href="#K.3.7.4.1">K.3.7.4.1</a>
25988 main function, <a href="#5.1.2.2.1">5.1.2.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>, <a href="#6.7.3.1">6.7.3.1</a>, <a href="#6.7.4">6.7.4</a>, memset_s function, <a href="#K.3.7.4.1">K.3.7.4.1</a>
25989 <a href="#7.21.3">7.21.3</a> minimum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a>
25990 malloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.4">7.22.3.4</a>, <a href="#7.22.3.5">7.22.3.5</a> minus operator, unary, <a href="#6.5.3.3">6.5.3.3</a>
25991 manipulation functions miscellaneous functions
25992 complex, <a href="#7.3.9">7.3.9</a> string, <a href="#7.24.6">7.24.6</a>, <a href="#K.3.7.4">K.3.7.4</a>
25993 real, <a href="#7.12.11">7.12.11</a>, <a href="#F.10.8">F.10.8</a> wide string, <a href="#7.29.4.6">7.29.4.6</a>, <a href="#K.3.9.2.4">K.3.9.2.4</a>
25994 matching failure, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.10">7.29.2.10</a>, mktime function, <a href="#7.27.2.3">7.27.2.3</a>
25995 <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a> modf functions, <a href="#7.12.6.12">7.12.6.12</a>, <a href="#F.10.3.12">F.10.3.12</a>
25996 math.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.25">7.25</a>, <a href="#F">F</a>, modifiable lvalue, <a href="#6.3.2.1">6.3.2.1</a>
25997 <a href="#F.10">F.10</a>, <a href="#J.5.17">J.5.17</a> modification order, <a href="#5.1.2.4">5.1.2.4</a>
25998 MATH_ERREXCEPT macro, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a> modulus functions, <a href="#7.12.6.12">7.12.6.12</a>
25999 math_errhandling macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.12">7.12</a>, <a href="#F.10">F.10</a> modulus, complex, <a href="#7.3.8.1">7.3.8.1</a>
26000 MATH_ERRNO macro, <a href="#7.12">7.12</a> mtx_destroy function, <a href="#7.26.4.1">7.26.4.1</a>
26001 mathematics header, <a href="#7.12">7.12</a> mtx_init function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.4.2">7.26.4.2</a>
26002 max_align_t type, <a href="#7.19">7.19</a> mtx_lock function, <a href="#7.26.4.3">7.26.4.3</a>
26003 maximal munch, <a href="#6.4">6.4</a> mtx_t type, <a href="#7.26.1">7.26.1</a>
26004 maximum functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a> mtx_timedlock function, <a href="#7.26.4.4">7.26.4.4</a>
26005 MB_CUR_MAX macro, <a href="#7.1.1">7.1.1</a>, <a href="#7.22">7.22</a>, <a href="#7.22.7.2">7.22.7.2</a>, mtx_trylock function, <a href="#7.26.4.5">7.26.4.5</a>
26006 <a href="#7.22.7.3">7.22.7.3</a>, <a href="#7.28.1.2">7.28.1.2</a>, <a href="#7.28.1.4">7.28.1.4</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, mtx_unlock function, <a href="#7.26.4.3">7.26.4.3</a>, <a href="#7.26.4.4">7.26.4.4</a>,
26007 <a href="#K.3.6.4.1">K.3.6.4.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a> <a href="#7.26.4.5">7.26.4.5</a>, <a href="#7.26.4.6">7.26.4.6</a>
26008 MB_LEN_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.1.1">7.1.1</a>, <a href="#7.22">7.22</a> multibyte character, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#6.4.4.4">6.4.4.4</a>
26009 mblen function, <a href="#7.22.7.1">7.22.7.1</a>, <a href="#7.29.6.3">7.29.6.3</a> multibyte conversion functions
26010 mbrlen function, <a href="#7.29.6.3.1">7.29.6.3.1</a> wide character, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a>
26011 mbrtoc16 function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.28.1.1">7.28.1.1</a> extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a>
26012 mbrtoc32 function, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.28.1.3">7.28.1.3</a> restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
26013 mbrtowc function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, wide string, <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a>
26015 [<a name="p672" href="#p672">page 672</a>] (<a href="#Contents">Contents</a>)
26017 restartable, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> not macro, <a href="#7.9">7.9</a>
26018 multibyte string, <a href="#7.1.1">7.1.1</a> not-equal-to operator, see inequality operator
26019 multibyte/wide character conversion functions, not_eq macro, <a href="#7.9">7.9</a>
26020 <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a> null character (\0), <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>
26021 extended, <a href="#7.29.6">7.29.6</a>, <a href="#K.3.9.3">K.3.9.3</a> padding of binary stream, <a href="#7.21.2">7.21.2</a>
26022 restartable, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a> NULL macro, <a href="#7.11">7.11</a>, <a href="#7.19">7.19</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.22">7.22</a>, <a href="#7.24.1">7.24.1</a>,
26023 multibyte/wide string conversion functions, <a href="#7.27.1">7.27.1</a>, <a href="#7.29.1">7.29.1</a>
26024 <a href="#7.22.8">7.22.8</a>, <a href="#K.3.6.5">K.3.6.5</a> null pointer, <a href="#6.3.2.3">6.3.2.3</a>
26025 restartable, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> null pointer constant, <a href="#6.3.2.3">6.3.2.3</a>
26026 multidimensional array, <a href="#6.5.2.1">6.5.2.1</a> null preprocessing directive, <a href="#6.10.7">6.10.7</a>
26027 multiplication assignment operator (*=), <a href="#6.5.16.2">6.5.16.2</a> null statement, <a href="#6.8.3">6.8.3</a>
26028 multiplication operator (*), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#F.3">F.3</a>, null wide character, <a href="#7.1.1">7.1.1</a>
26029 <a href="#G.5.1">G.5.1</a> number classification macros, <a href="#7.12">7.12</a>, <a href="#7.12.3.1">7.12.3.1</a>
26030 multiplicative expressions, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a> numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a>
26031 wide string, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1">7.29.4.1</a>
26032 n-char sequence, <a href="#7.22.1.3">7.22.1.3</a> numerical limits, <a href="#5.2.4.2">5.2.4.2</a>
26033 n-wchar sequence, <a href="#7.29.4.1.1">7.29.4.1.1</a>
26034 name object, <a href="#3.15">3.15</a>
26035 external, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.11.3">6.11.3</a> object representation, <a href="#6.2.6.1">6.2.6.1</a>
26036 file, <a href="#7.21.3">7.21.3</a> object type, <a href="#6.2.5">6.2.5</a>
26037 internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a> object-like macro, <a href="#6.10.3">6.10.3</a>
26038 label, <a href="#6.2.3">6.2.3</a> observable behavior, <a href="#5.1.2.3">5.1.2.3</a>
26039 structure/union member, <a href="#6.2.3">6.2.3</a> obsolescence, <a href="#6.11">6.11</a>, <a href="#7.31">7.31</a>
26040 name spaces, <a href="#6.2.3">6.2.3</a> octal constant, <a href="#6.4.4.1">6.4.4.1</a>
26041 named label, <a href="#6.8.1">6.8.1</a> octal digit, <a href="#6.4.4.1">6.4.4.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
26042 NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a> octal-character escape sequence (\octal digits),
26043 nan functions, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#F.2.1">F.2.1</a>, <a href="#F.10.8.2">F.10.8.2</a> <a href="#6.4.4.4">6.4.4.4</a>
26044 NAN macro, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> offsetof macro, <a href="#7.19">7.19</a>
26045 NDEBUG macro, <a href="#7.2">7.2</a> on-off switch, <a href="#6.10.6">6.10.6</a>
26046 nearbyint functions, <a href="#7.12.9.3">7.12.9.3</a>, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, once_flag type, <a href="#7.26.1">7.26.1</a>
26047 <a href="#F.10.6.3">F.10.6.3</a> ONCE_FLAG_INIT macro, <a href="#7.26.1">7.26.1</a>
26048 nearbyint type-generic macro, <a href="#7.25">7.25</a> ones' complement, <a href="#6.2.6.2">6.2.6.2</a>
26049 nearest integer functions, <a href="#7.12.9">7.12.9</a>, <a href="#F.10.6">F.10.6</a> operand, <a href="#6.4.6">6.4.6</a>, <a href="#6.5">6.5</a>
26050 negation operator (!), <a href="#6.5.3.3">6.5.3.3</a> operating system, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#7.22.4.8">7.22.4.8</a>
26051 negative zero, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.12.11.1">7.12.11.1</a> operations on files, <a href="#7.21.4">7.21.4</a>, <a href="#K.3.5.1">K.3.5.1</a>
26052 new-line character, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#6.10.4">6.10.4</a> operator, <a href="#6.4.6">6.4.6</a>
26053 new-line escape sequence (\n), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>, operators, <a href="#6.5">6.5</a>
26054 <a href="#7.4.1.10">7.4.1.10</a> _Alignof, <a href="#6.5.3.4">6.5.3.4</a>
26055 nextafter functions, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, additive, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>
26056 <a href="#F.10.8.3">F.10.8.3</a> assignment, <a href="#6.5.16">6.5.16</a>
26057 nextafter type-generic macro, <a href="#7.25">7.25</a> associativity, <a href="#6.5">6.5</a>
26058 nexttoward functions, <a href="#7.12.11.4">7.12.11.4</a>, <a href="#F.3">F.3</a>, <a href="#F.10.8.4">F.10.8.4</a> equality, <a href="#6.5.9">6.5.9</a>
26059 nexttoward type-generic macro, <a href="#7.25">7.25</a> multiplicative, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>, <a href="#G.5.1">G.5.1</a>
26060 no linkage, <a href="#6.2.2">6.2.2</a> postfix, <a href="#6.5.2">6.5.2</a>
26061 no-return function, <a href="#6.7.4">6.7.4</a> precedence, <a href="#6.5">6.5</a>
26062 non-stop floating-point control mode, <a href="#7.6.4.2">7.6.4.2</a> preprocessing, <a href="#6.10.1">6.10.1</a>, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>, <a href="#6.10.9">6.10.9</a>
26063 nongraphic characters, <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a> relational, <a href="#6.5.8">6.5.8</a>
26064 nonlocal jumps header, <a href="#7.13">7.13</a> shift, <a href="#6.5.7">6.5.7</a>
26065 noreturn macro, <a href="#7.23">7.23</a> sizeof, <a href="#6.5.3.4">6.5.3.4</a>
26066 norm, complex, <a href="#7.3.8.1">7.3.8.1</a> unary, <a href="#6.5.3">6.5.3</a>
26067 normalized broken-down time, <a href="#K.3.8.1">K.3.8.1</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a> unary arithmetic, <a href="#6.5.3.3">6.5.3.3</a>
26069 [<a name="p673" href="#p673">page 673</a>] (<a href="#Contents">Contents</a>)
26071 optional features, see conditional features portability, <a href="#4">4</a>, <a href="#J">J</a>
26072 or macro, <a href="#7.9">7.9</a> position indicator, file, see file position indicator
26073 OR operators positive difference, <a href="#7.12.12.1">7.12.12.1</a>
26074 bitwise exclusive (^), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.11">6.5.11</a> positive difference functions, <a href="#7.12.12">7.12.12</a>, <a href="#F.10.9">F.10.9</a>
26075 bitwise exclusive assignment (^=), <a href="#6.5.16.2">6.5.16.2</a> postfix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a>
26076 bitwise inclusive (|), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.12">6.5.12</a> postfix expressions, <a href="#6.5.2">6.5.2</a>
26077 bitwise inclusive assignment (|=), <a href="#6.5.16.2">6.5.16.2</a> postfix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.4">6.5.2.4</a>
26078 logical (||), <a href="#5.1.2.4">5.1.2.4</a>, <a href="#6.5.14">6.5.14</a> pow functions, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#F.10.4.4">F.10.4.4</a>
26079 or_eq macro, <a href="#7.9">7.9</a> pow type-generic macro, <a href="#7.25">7.25</a>
26080 order of allocated storage, <a href="#7.22.3">7.22.3</a> power functions
26081 order of evaluation, <a href="#6.5">6.5</a>, <a href="#6.5.16">6.5.16</a>, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.3.3">6.10.3.3</a>, complex, <a href="#7.3.8">7.3.8</a>, <a href="#G.6.4">G.6.4</a>
26082 see also sequence points real, <a href="#7.12.7">7.12.7</a>, <a href="#F.10.4">F.10.4</a>
26083 ordinary identifier name space, <a href="#6.2.3">6.2.3</a> pp-number, <a href="#6.4.8">6.4.8</a>
26084 orientation of stream, <a href="#7.21.2">7.21.2</a>, <a href="#7.29.3.5">7.29.3.5</a> pragma operator, <a href="#6.10.9">6.10.9</a>
26085 out-of-bounds store, <a href="#L.2.1">L.2.1</a> pragma preprocessing directive, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a>
26086 outer scope, <a href="#6.2.1">6.2.1</a> precedence of operators, <a href="#6.5">6.5</a>
26087 over-aligned, <a href="#6.2.8">6.2.8</a> precedence of syntax rules, <a href="#5.1.1.2">5.1.1.2</a>
26088 precision, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.2.1">7.29.2.1</a>
26089 padding excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a>
26090 binary stream, <a href="#7.21.2">7.21.2</a> predefined macro names, <a href="#6.10.8">6.10.8</a>, <a href="#6.11.9">6.11.9</a>
26091 bits, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.20.1.1">7.20.1.1</a> prefix decrement operator (--), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>
26092 structure/union, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a> prefix increment operator (++), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3.1">6.5.3.1</a>
26093 parameter, <a href="#3.16">3.16</a> preprocessing concatenation, <a href="#6.10.3.3">6.10.3.3</a>
26094 array, <a href="#6.9.1">6.9.1</a> preprocessing directives, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10">6.10</a>
26095 ellipsis, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.10.3">6.10.3</a> preprocessing file, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.10">6.10</a>
26096 function, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.9.1">6.9.1</a> preprocessing numbers, <a href="#6.4">6.4</a>, <a href="#6.4.8">6.4.8</a>
26097 macro, <a href="#6.10.3">6.10.3</a> preprocessing operators
26098 main function, <a href="#5.1.2.2.1">5.1.2.2.1</a> #, <a href="#6.10.3.2">6.10.3.2</a>
26099 program, <a href="#5.1.2.2.1">5.1.2.2.1</a> ##, <a href="#6.10.3.3">6.10.3.3</a>
26100 parameter type list, <a href="#6.7.6.3">6.7.6.3</a> _Pragma, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.10.9">6.10.9</a>
26101 parentheses punctuator (( )), <a href="#6.7.6.3">6.7.6.3</a>, <a href="#6.8.4">6.8.4</a>, <a href="#6.8.5">6.8.5</a> defined, <a href="#6.10.1">6.10.1</a>
26102 parenthesized expression, <a href="#6.5.1">6.5.1</a> preprocessing tokens, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>
26103 parse state, <a href="#7.21.2">7.21.2</a> preprocessing translation unit, <a href="#5.1.1.1">5.1.1.1</a>
26104 perform a trap, <a href="#3.19.5">3.19.5</a> preprocessor, <a href="#6.10">6.10</a>
26105 permitted form of initializer, <a href="#6.6">6.6</a> PRIcFASTN macros, <a href="#7.8.1">7.8.1</a>
26106 perror function, <a href="#7.21.10.4">7.21.10.4</a> PRIcLEASTN macros, <a href="#7.8.1">7.8.1</a>
26107 phase angle, complex, <a href="#7.3.9.1">7.3.9.1</a> PRIcMAX macros, <a href="#7.8.1">7.8.1</a>
26108 physical source lines, <a href="#5.1.1.2">5.1.1.2</a> PRIcN macros, <a href="#7.8.1">7.8.1</a>
26109 placemarker, <a href="#6.10.3.3">6.10.3.3</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
26110 plus operator, unary, <a href="#6.5.3.3">6.5.3.3</a> primary expression, <a href="#6.5.1">6.5.1</a>
26111 pointer arithmetic, <a href="#6.5.6">6.5.6</a> printf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.3">7.21.6.3</a>, <a href="#7.21.6.10">7.21.6.10</a>,
26112 pointer comparison, <a href="#6.5.8">6.5.8</a> <a href="#K.3.5.3.3">K.3.5.3.3</a>
26113 pointer declarator, <a href="#6.7.6.1">6.7.6.1</a> printf_s function, <a href="#K.3.5.3.3">K.3.5.3.3</a>
26114 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> printing character, <a href="#5.2.2">5.2.2</a>, <a href="#7.4">7.4</a>, <a href="#7.4.1.8">7.4.1.8</a>
26115 pointer to function, <a href="#6.5.2.2">6.5.2.2</a> printing wide character, <a href="#7.30.2">7.30.2</a>
26116 pointer type, <a href="#6.2.5">6.2.5</a> program diagnostics, <a href="#7.2.1">7.2.1</a>
26117 pointer type conversion, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a> program execution, <a href="#5.1.2.2.2">5.1.2.2.2</a>, <a href="#5.1.2.3">5.1.2.3</a>
26118 pointer, null, <a href="#6.3.2.3">6.3.2.3</a> program file, <a href="#5.1.1.1">5.1.1.1</a>
26119 pole error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.5.3">7.12.5.3</a>, <a href="#7.12.6.7">7.12.6.7</a>, <a href="#7.12.6.8">7.12.6.8</a>, program image, <a href="#5.1.1.2">5.1.1.2</a>
26120 <a href="#7.12.6.9">7.12.6.9</a>, <a href="#7.12.6.10">7.12.6.10</a>, <a href="#7.12.6.11">7.12.6.11</a>, <a href="#7.12.7.4">7.12.7.4</a>, program name (argv[0]), <a href="#5.1.2.2.1">5.1.2.2.1</a>
26121 <a href="#7.12.8.3">7.12.8.3</a>, <a href="#7.12.8.4">7.12.8.4</a> program parameters, <a href="#5.1.2.2.1">5.1.2.2.1</a>
26123 [<a name="p674" href="#p674">page 674</a>] (<a href="#Contents">Contents</a>)
26125 program startup, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.1">5.1.2.2.1</a> recursion, <a href="#6.5.2.2">6.5.2.2</a>
26126 program structure, <a href="#5.1.1.1">5.1.1.1</a> recursive function call, <a href="#6.5.2.2">6.5.2.2</a>
26127 program termination, <a href="#5.1.2">5.1.2</a>, <a href="#5.1.2.1">5.1.2.1</a>, <a href="#5.1.2.2.3">5.1.2.2.3</a>, redefinition of macro, <a href="#6.10.3">6.10.3</a>
26128 <a href="#5.1.2.3">5.1.2.3</a> reentrancy, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>
26129 program, conforming, <a href="#4">4</a> library functions, <a href="#7.1.4">7.1.4</a>
26130 program, strictly conforming, <a href="#4">4</a> referenced type, <a href="#6.2.5">6.2.5</a>
26131 promotions register storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.9">6.9</a>
26132 default argument, <a href="#6.5.2.2">6.5.2.2</a> relational expressions, <a href="#6.5.8">6.5.8</a>
26133 integer, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.3.1.1">6.3.1.1</a> relaxed atomic operations, <a href="#5.1.2.4">5.1.2.4</a>
26134 prototype, see function prototype release fence, <a href="#7.17.4">7.17.4</a>
26135 pseudo-random sequence functions, <a href="#7.22.2">7.22.2</a> release operation, <a href="#5.1.2.4">5.1.2.4</a>
26136 PTRDIFF_MAX macro, <a href="#7.20.3">7.20.3</a> release sequence, <a href="#5.1.2.4">5.1.2.4</a>
26137 PTRDIFF_MIN macro, <a href="#7.20.3">7.20.3</a> reliability of data, interrupted, <a href="#5.1.2.3">5.1.2.3</a>
26138 ptrdiff_t type, <a href="#7.17.1">7.17.1</a>, <a href="#7.19">7.19</a>, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, remainder assignment operator (%=), <a href="#6.5.16.2">6.5.16.2</a>
26139 <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a> remainder functions, <a href="#7.12.10">7.12.10</a>, <a href="#F.10.7">F.10.7</a>
26140 punctuators, <a href="#6.4.6">6.4.6</a> remainder functions, <a href="#7.12.10.2">7.12.10.2</a>, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>,
26141 putc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.21.7.8">7.21.7.8</a> <a href="#F.10.7.2">F.10.7.2</a>
26142 putchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.8">7.21.7.8</a> remainder operator (%), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.5">6.5.5</a>
26143 puts function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.9">7.21.7.9</a> remainder type-generic macro, <a href="#7.25">7.25</a>
26144 putwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#7.29.3.9">7.29.3.9</a> remove function, <a href="#7.21.4.1">7.21.4.1</a>, <a href="#7.21.4.4">7.21.4.4</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
26145 putwchar function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.9">7.29.3.9</a> remquo functions, <a href="#7.12.10.3">7.12.10.3</a>, <a href="#F.3">F.3</a>, <a href="#F.10.7.3">F.10.7.3</a>
26146 remquo type-generic macro, <a href="#7.25">7.25</a>
26147 qsort function, <a href="#7.22.5">7.22.5</a>, <a href="#7.22.5.2">7.22.5.2</a> rename function, <a href="#7.21.4.2">7.21.4.2</a>
26148 qsort_s function, <a href="#K.3.6.3">K.3.6.3</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a> representations of types, <a href="#6.2.6">6.2.6</a>
26149 qualified types, <a href="#6.2.5">6.2.5</a> pointer, <a href="#6.2.5">6.2.5</a>
26150 qualified version of type, <a href="#6.2.5">6.2.5</a> rescanning and replacement, <a href="#6.10.3.4">6.10.3.4</a>
26151 question-mark escape sequence (\?), <a href="#6.4.4.4">6.4.4.4</a> reserved identifiers, <a href="#6.4.1">6.4.1</a>, <a href="#7.1.3">7.1.3</a>, <a href="#K.3.1.2">K.3.1.2</a>
26152 quick_exit function, <a href="#7.22.4.3">7.22.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>, restartable multibyte/wide character conversion
26153 <a href="#7.22.4.7">7.22.4.7</a> functions, <a href="#7.28.1">7.28.1</a>, <a href="#7.29.6.3">7.29.6.3</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>
26154 quiet NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a> restartable multibyte/wide string conversion
26155 functions, <a href="#7.29.6.4">7.29.6.4</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a>
26156 raise function, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a>, <a href="#7.22.4.1">7.22.4.1</a> restore calling environment function, <a href="#7.13.2">7.13.2</a>
26157 rand function, <a href="#7.22">7.22</a>, <a href="#7.22.2.1">7.22.2.1</a>, <a href="#7.22.2.2">7.22.2.2</a> restrict type qualifier, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a>
26158 RAND_MAX macro, <a href="#7.22">7.22</a>, <a href="#7.22.2.1">7.22.2.1</a> restrict-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
26159 range return statement, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
26160 excess, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.8.6.4">6.8.6.4</a> rewind function, <a href="#7.21.5.3">7.21.5.3</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.5">7.21.9.5</a>,
26161 range error, <a href="#7.12.1">7.12.1</a>, <a href="#7.12.5.4">7.12.5.4</a>, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#7.12.6.1">7.12.6.1</a>, <a href="#7.29.3.10">7.29.3.10</a>
26162 <a href="#7.12.6.2">7.12.6.2</a>, <a href="#7.12.6.3">7.12.6.3</a>, <a href="#7.12.6.5">7.12.6.5</a>, <a href="#7.12.6.6">7.12.6.6</a>, right-shift assignment operator (&gt;&gt;=), <a href="#6.5.16.2">6.5.16.2</a>
26163 <a href="#7.12.6.13">7.12.6.13</a>, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#7.12.7.4">7.12.7.4</a>, <a href="#7.12.8.2">7.12.8.2</a>, right-shift operator (&gt;&gt;), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.7">6.5.7</a>
26164 <a href="#7.12.8.3">7.12.8.3</a>, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, rint functions, <a href="#7.12.9.4">7.12.9.4</a>, <a href="#F.3">F.3</a>, <a href="#F.10.6.4">F.10.6.4</a>
26165 <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.12.1">7.12.12.1</a>, <a href="#7.12.13.1">7.12.13.1</a> rint type-generic macro, <a href="#7.25">7.25</a>
26166 rank, see integer conversion rank round functions, <a href="#7.12.9.6">7.12.9.6</a>, <a href="#F.10.6.6">F.10.6.6</a>
26167 read-modify-write operations, <a href="#5.1.2.4">5.1.2.4</a> round type-generic macro, <a href="#7.25">7.25</a>
26168 real floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, rounding mode, floating point, <a href="#5.2.4.2.2">5.2.4.2.2</a>
26169 <a href="#6.3.1.7">6.3.1.7</a>, <a href="#F.3">F.3</a>, <a href="#F.4">F.4</a> RSIZE_MAX macro, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>,
26170 real floating types, <a href="#6.2.5">6.2.5</a> <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a>, <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>,
26171 real type domain, <a href="#6.2.5">6.2.5</a> <a href="#K.3.5.4.1">K.3.5.4.1</a>, <a href="#K.3.6.2.1">K.3.6.2.1</a>, <a href="#K.3.6.3.1">K.3.6.3.1</a>, <a href="#K.3.6.3.2">K.3.6.3.2</a>,
26172 real types, <a href="#6.2.5">6.2.5</a> <a href="#K.3.6.4.1">K.3.6.4.1</a>, <a href="#K.3.6.5.1">K.3.6.5.1</a>, <a href="#K.3.6.5.2">K.3.6.5.2</a>, <a href="#K.3.7.1.1">K.3.7.1.1</a>,
26173 real-floating, <a href="#7.12.3">7.12.3</a> <a href="#K.3.7.1.2">K.3.7.1.2</a>, <a href="#K.3.7.1.3">K.3.7.1.3</a>, <a href="#K.3.7.1.4">K.3.7.1.4</a>, <a href="#K.3.7.2.1">K.3.7.2.1</a>,
26174 realloc function, <a href="#7.22.3">7.22.3</a>, <a href="#7.22.3.5">7.22.3.5</a> <a href="#K.3.7.2.2">K.3.7.2.2</a>, <a href="#K.3.7.3.1">K.3.7.3.1</a>, <a href="#K.3.7.4.1">K.3.7.4.1</a>, <a href="#K.3.7.4.2">K.3.7.4.2</a>,
26175 recommended practice, <a href="#3.17">3.17</a> <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a>,
26177 [<a name="p675" href="#p675">page 675</a>] (<a href="#Contents">Contents</a>)
26179 <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a>, <a href="#K.3.9.2.1.1">K.3.9.2.1.1</a>, <a href="#K.3.9.2.1.2">K.3.9.2.1.2</a>, <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6.1.1">K.3.6.1.1</a>, <a href="#K.3.6.1.2">K.3.6.1.2</a>, <a href="#K.3.6.1.3">K.3.6.1.3</a>
26180 <a href="#K.3.9.2.1.3">K.3.9.2.1.3</a>, <a href="#K.3.9.2.1.4">K.3.9.2.1.4</a>, <a href="#K.3.9.2.2.1">K.3.9.2.2.1</a>, setbuf function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.1">7.21.5.1</a>, <a href="#7.21.5.5">7.21.5.5</a>
26181 <a href="#K.3.9.2.2.2">K.3.9.2.2.2</a>, <a href="#K.3.9.2.3.1">K.3.9.2.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a>, setjmp macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.13.1.1">7.13.1.1</a>, <a href="#7.13.2.1">7.13.2.1</a>
26182 <a href="#K.3.9.3.2.1">K.3.9.3.2.1</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a> setjmp.h header, <a href="#7.13">7.13</a>
26183 rsize_t type, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>, setlocale function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
26184 <a href="#K.3.6">K.3.6</a>, <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a> setvbuf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.1">7.21.5.1</a>,
26185 runtime-constraint, <a href="#3.18">3.18</a> <a href="#7.21.5.5">7.21.5.5</a>, <a href="#7.21.5.6">7.21.5.6</a>
26186 Runtime-constraint handling functions, <a href="#K.3.6.1">K.3.6.1</a> shall, <a href="#4">4</a>
26187 rvalue, <a href="#6.3.2.1">6.3.2.1</a> shift expressions, <a href="#6.5.7">6.5.7</a>
26188 shift sequence, <a href="#7.1.1">7.1.1</a>
26189 same scope, <a href="#6.2.1">6.2.1</a> shift states, <a href="#5.2.1.2">5.2.1.2</a>
26190 save calling environment function, <a href="#7.13.1">7.13.1</a> short identifier, character, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.3">6.4.3</a>
26191 scalar types, <a href="#6.2.5">6.2.5</a> short int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.1">7.21.6.1</a>,
26192 scalbln function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.13">F.10.3.13</a> <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
26193 scalbln type-generic macro, <a href="#7.25">7.25</a> short int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>,
26194 scalbn function, <a href="#7.12.6.13">7.12.6.13</a>, <a href="#F.3">F.3</a>, <a href="#F.10.3.13">F.10.3.13</a> <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a>
26195 scalbn type-generic macro, <a href="#7.25">7.25</a> SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26196 scanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.4">7.21.6.4</a>, <a href="#7.21.6.11">7.21.6.11</a> SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26197 scanf_s function, <a href="#K.3.5.3.4">K.3.5.3.4</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a> side effects, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.5">6.5</a>, <a href="#6.5.2.4">6.5.2.4</a>,
26198 scanlist, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a> <a href="#6.5.16">6.5.16</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.8.3">6.8.3</a>, <a href="#7.6">7.6</a>, <a href="#7.6.1">7.6.1</a>, <a href="#7.21.7.5">7.21.7.5</a>,
26199 scanset, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a> <a href="#7.21.7.7">7.21.7.7</a>, <a href="#7.29.3.6">7.29.3.6</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#F.8.1">F.8.1</a>, <a href="#F.9.1">F.9.1</a>,
26200 SCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> <a href="#F.9.3">F.9.3</a>
26201 SCHAR_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> SIG_ATOMIC_MAX macro, <a href="#7.20.3">7.20.3</a>
26202 SCNcFASTN macros, <a href="#7.8.1">7.8.1</a> SIG_ATOMIC_MIN macro, <a href="#7.20.3">7.20.3</a>
26203 SCNcLEASTN macros, <a href="#7.8.1">7.8.1</a> sig_atomic_t type, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>,
26204 SCNcMAX macros, <a href="#7.8.1">7.8.1</a> <a href="#7.20.3">7.20.3</a>
26205 SCNcN macros, <a href="#7.8.1">7.8.1</a> SIG_DFL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
26206 SCNcPTR macros, <a href="#7.8.1">7.8.1</a> SIG_ERR macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
26207 scope of identifier, <a href="#6.2.1">6.2.1</a>, <a href="#6.9.2">6.9.2</a> SIG_IGN macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>
26208 search functions SIGABRT macro, <a href="#7.14">7.14</a>, <a href="#7.22.4.1">7.22.4.1</a>
26209 string, <a href="#7.24.5">7.24.5</a>, <a href="#K.3.7.3">K.3.7.3</a> SIGFPE macro, <a href="#7.12.1">7.12.1</a>, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.2">J.2</a>, <a href="#J.5.17">J.5.17</a>
26210 utility, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a> SIGILL macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.2">J.2</a>
26211 wide string, <a href="#7.29.4.5">7.29.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a> SIGINT macro, <a href="#7.14">7.14</a>
26212 SEEK_CUR macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> sign and magnitude, <a href="#6.2.6.2">6.2.6.2</a>
26213 SEEK_END macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> sign bit, <a href="#6.2.6.2">6.2.6.2</a>
26214 SEEK_SET macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.9.2">7.21.9.2</a> signal function, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.22.4.5">7.22.4.5</a>, <a href="#7.22.4.7">7.22.4.7</a>
26215 selection statements, <a href="#6.8.4">6.8.4</a> signal handler, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#7.14.2.1">7.14.2.1</a>
26216 self-referential structure, <a href="#6.7.2.3">6.7.2.3</a> signal handling functions, <a href="#7.14.1">7.14.1</a>
26217 semicolon punctuator (;), <a href="#6.7">6.7</a>, <a href="#6.7.2.1">6.7.2.1</a>, <a href="#6.8.3">6.8.3</a>, signal handling header, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
26218 <a href="#6.8.5">6.8.5</a>, <a href="#6.8.6">6.8.6</a> signal.h header, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
26219 separate compilation, <a href="#5.1.1.1">5.1.1.1</a> signaling NaN, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#F.2.1">F.2.1</a>
26220 separate translation, <a href="#5.1.1.1">5.1.1.1</a> signals, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.3">5.2.3</a>, <a href="#7.14.1">7.14.1</a>
26221 sequence points, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.13">6.5.13</a>, <a href="#6.5.14">6.5.14</a>, signbit macro, <a href="#7.12.3.6">7.12.3.6</a>, <a href="#F.3">F.3</a>
26222 <a href="#6.5.15">6.5.15</a>, <a href="#6.5.17">6.5.17</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.3.1">6.7.3.1</a>, <a href="#6.7.6">6.7.6</a>, <a href="#6.8">6.8</a>, signed char type, <a href="#6.2.5">6.2.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
26223 <a href="#7.1.4">7.1.4</a>, <a href="#7.21.6">7.21.6</a>, <a href="#7.22.5">7.22.5</a>, <a href="#7.29.2">7.29.2</a>, <a href="#C">C</a>, <a href="#K.3.6.3">K.3.6.3</a> <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a>
26224 sequenced after, see sequenced before signed character, <a href="#6.3.1.1">6.3.1.1</a>
26225 sequenced before, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.5.2.4">6.5.2.4</a>, signed integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a>
26226 <a href="#6.5.16">6.5.16</a>, see also indeterminately sequenced, signed type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.3.1.4">6.3.1.4</a>,
26227 unsequenced <a href="#6.3.1.8">6.3.1.8</a>
26228 sequencing of statements, <a href="#6.8">6.8</a> signed types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>
26229 set_constraint_handler_s function, significand part, <a href="#6.4.4.2">6.4.4.2</a>
26231 [<a name="p676" href="#p676">page 676</a>] (<a href="#Contents">Contents</a>)
26233 SIGSEGV macro, <a href="#7.14">7.14</a>, <a href="#7.14.1.1">7.14.1.1</a>, <a href="#J.2">J.2</a> <a href="#7.8">&lt;inttypes.h&gt;</a>, <a href="#7.8">7.8</a>, <a href="#7.31.5">7.31.5</a>
26234 SIGTERM macro, <a href="#7.14">7.14</a> <a href="#7.9">&lt;iso646.h&gt;</a>, <a href="#4">4</a>, <a href="#7.9">7.9</a>
26235 simple assignment operator (=), <a href="#6.5.16.1">6.5.16.1</a> <a href="#7.10">&lt;limits.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#6.2.5">6.2.5</a>, <a href="#7.10">7.10</a>
26236 sin functions, <a href="#7.12.4.6">7.12.4.6</a>, <a href="#F.10.1.6">F.10.1.6</a> <a href="#7.11">&lt;locale.h&gt;</a>, <a href="#7.11">7.11</a>, <a href="#7.31.6">7.31.6</a>
26237 sin type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> <a href="#7.12">&lt;math.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.5">6.5</a>, <a href="#7.12">7.12</a>, <a href="#7.25">7.25</a>, <a href="#F">F</a>, <a href="#F.10">F.10</a>,
26238 single-byte character, <a href="#3.7.1">3.7.1</a>, <a href="#5.2.1.2">5.2.1.2</a> <a href="#J.5.17">J.5.17</a>
26239 single-byte/wide character conversion functions, <a href="#7.13">&lt;setjmp.h&gt;</a>, <a href="#7.13">7.13</a>
26240 <a href="#7.29.6.1">7.29.6.1</a> <a href="#7.14">&lt;signal.h&gt;</a>, <a href="#7.14">7.14</a>, <a href="#7.31.7">7.31.7</a>
26241 single-precision arithmetic, <a href="#5.1.2.3">5.1.2.3</a> <a href="#7.15">&lt;stdalign.h&gt;</a>, <a href="#4">4</a>, <a href="#7.15">7.15</a>
26242 single-quote escape sequence (\'), <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a> <a href="#7.16">&lt;stdarg.h&gt;</a>, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a>
26243 singularity, <a href="#7.12.1">7.12.1</a> <a href="#7.17">&lt;stdatomic.h&gt;</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a>,
26244 sinh functions, <a href="#7.12.5.5">7.12.5.5</a>, <a href="#F.10.2.5">F.10.2.5</a> <a href="#7.31.8">7.31.8</a>
26245 sinh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> <a href="#7.18">&lt;stdbool.h&gt;</a>, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a>
26246 SIZE_MAX macro, <a href="#7.20.3">7.20.3</a> <a href="#7.19">&lt;stddef.h&gt;</a>, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>,
26247 size_t type, <a href="#6.2.8">6.2.8</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#7.19">7.19</a>, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.1">7.21.1</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.19">7.19</a>, <a href="#K.3.3">K.3.3</a>
26248 <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22">7.22</a>, <a href="#7.24.1">7.24.1</a>, <a href="#7.27.1">7.27.1</a>, <a href="#7.28">7.28</a>, <a href="#7.20">&lt;stdint.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.20">7.20</a>,
26249 <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>, <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a>
26250 <a href="#K.3.5">K.3.5</a>, <a href="#K.3.6">K.3.6</a>, <a href="#K.3.7">K.3.7</a>, <a href="#K.3.8">K.3.8</a>, <a href="#K.3.9">K.3.9</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a> <a href="#7.21">&lt;stdio.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.31.11">7.31.11</a>, <a href="#F">F</a>, <a href="#K.3.5">K.3.5</a>
26251 sizeof operator, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.3">6.5.3</a>, <a href="#6.5.3.4">6.5.3.4</a> <a href="#7.22">&lt;stdlib.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a>, <a href="#F">F</a>,
26252 sizes of integer types header, <a href="#7.10">7.10</a> <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a>
26253 snprintf function, <a href="#7.21.6.5">7.21.6.5</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.23">&lt;stdnoreturn.h&gt;</a>, <a href="#4">4</a>, <a href="#7.23">7.23</a>
26254 <a href="#K.3.5.3.5">K.3.5.3.5</a> <a href="#7.24">&lt;string.h&gt;</a>, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
26255 snprintf_s function, <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a> <a href="#7.25">&lt;tgmath.h&gt;</a>, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a>
26256 snwprintf_s function, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a> <a href="#7.26">&lt;threads.h&gt;</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.26">7.26</a>, <a href="#7.31.15">7.31.15</a>
26257 sorting utility functions, <a href="#7.22.5">7.22.5</a>, <a href="#K.3.6.3">K.3.6.3</a> <a href="#7.27">&lt;time.h&gt;</a>, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
26258 source character set, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a> <a href="#7.28">&lt;uchar.h&gt;</a>, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.28">7.28</a>
26259 source file, <a href="#5.1.1.1">5.1.1.1</a> <a href="#7.29">&lt;wchar.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.29">7.29</a>, <a href="#7.31.16">7.31.16</a>,
26260 name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8.1">6.10.8.1</a> <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a>
26261 source file inclusion, <a href="#6.10.2">6.10.2</a> <a href="#7.30">&lt;wctype.h&gt;</a>, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
26262 source lines, <a href="#5.1.1.2">5.1.1.2</a> standard input stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
26263 source text, <a href="#5.1.1.2">5.1.1.2</a> standard integer types, <a href="#6.2.5">6.2.5</a>
26264 space character (' '), <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>, <a href="#7.4.1.3">7.4.1.3</a>, standard output stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>
26265 <a href="#7.4.1.10">7.4.1.10</a>, <a href="#7.30.2.1.3">7.30.2.1.3</a> standard signed integer types, <a href="#6.2.5">6.2.5</a>
26266 sprintf function, <a href="#7.21.6.6">7.21.6.6</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a> state-dependent encoding, <a href="#5.2.1.2">5.2.1.2</a>, <a href="#7.22.7">7.22.7</a>, <a href="#K.3.6.4">K.3.6.4</a>
26267 sprintf_s function, <a href="#K.3.5.3.5">K.3.5.3.5</a>, <a href="#K.3.5.3.6">K.3.5.3.6</a> statements, <a href="#6.8">6.8</a>
26268 sqrt functions, <a href="#7.12.7.5">7.12.7.5</a>, <a href="#F.3">F.3</a>, <a href="#F.10.4.5">F.10.4.5</a> break, <a href="#6.8.6.3">6.8.6.3</a>
26269 sqrt type-generic macro, <a href="#7.25">7.25</a> compound, <a href="#6.8.2">6.8.2</a>
26270 srand function, <a href="#7.22.2.2">7.22.2.2</a> continue, <a href="#6.8.6.2">6.8.6.2</a>
26271 sscanf function, <a href="#7.21.6.7">7.21.6.7</a>, <a href="#7.21.6.14">7.21.6.14</a> do, <a href="#6.8.5.2">6.8.5.2</a>
26272 sscanf_s function, <a href="#K.3.5.3.7">K.3.5.3.7</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a> else, <a href="#6.8.4.1">6.8.4.1</a>
26273 standard error stream, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.10.4">7.21.10.4</a> expression, <a href="#6.8.3">6.8.3</a>
26274 standard headers, <a href="#4">4</a>, <a href="#7.1.2">7.1.2</a> for, <a href="#6.8.5.3">6.8.5.3</a>
26275 <a href="#7.2">&lt;assert.h&gt;</a>, <a href="#7.2">7.2</a> goto, <a href="#6.8.6.1">6.8.6.1</a>
26276 <a href="#7.3">&lt;complex.h&gt;</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.3">7.3</a>, if, <a href="#6.8.4.1">6.8.4.1</a>
26277 <a href="#7.25">7.25</a>, <a href="#7.31.1">7.31.1</a>, <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a> iteration, <a href="#6.8.5">6.8.5</a>
26278 <a href="#7.4">&lt;ctype.h&gt;</a>, <a href="#7.4">7.4</a>, <a href="#7.31.2">7.31.2</a> jump, <a href="#6.8.6">6.8.6</a>
26279 <a href="#7.5">&lt;errno.h&gt;</a>, <a href="#7.5">7.5</a>, <a href="#7.31.3">7.31.3</a>, <a href="#K.3.2">K.3.2</a> labeled, <a href="#6.8.1">6.8.1</a>
26280 <a href="#7.6">&lt;fenv.h&gt;</a>, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.6">7.6</a>, <a href="#7.12">7.12</a>, null, <a href="#6.8.3">6.8.3</a>
26281 <a href="#7.31.4">7.31.4</a>, <a href="#F">F</a>, <a href="#H">H</a> return, <a href="#6.8.6.4">6.8.6.4</a>, <a href="#F.6">F.6</a>
26282 <a href="#7.7">&lt;float.h&gt;</a>, <a href="#4">4</a>, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.7">7.7</a>, <a href="#7.22.1.3">7.22.1.3</a>, selection, <a href="#6.8.4">6.8.4</a>
26283 <a href="#7.29.4.1.1">7.29.4.1.1</a> sequencing, <a href="#6.8">6.8</a>
26285 [<a name="p677" href="#p677">page 677</a>] (<a href="#Contents">Contents</a>)
26287 switch, <a href="#6.8.4.2">6.8.4.2</a> strerrorlen_s function, <a href="#K.3.7.4.3">K.3.7.4.3</a>
26288 while, <a href="#6.8.5.1">6.8.5.1</a> strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.27.3.5">7.27.3.5</a>,
26289 static assertions, <a href="#6.7.10">6.7.10</a> <a href="#7.29.5.1">7.29.5.1</a>, <a href="#K.3.8.2">K.3.8.2</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>
26290 static storage duration, <a href="#6.2.4">6.2.4</a> stricter, <a href="#6.2.8">6.2.8</a>
26291 static storage-class specifier, <a href="#6.2.2">6.2.2</a>, <a href="#6.2.4">6.2.4</a>, <a href="#6.7.1">6.7.1</a> strictly conforming program, <a href="#4">4</a>
26292 static, in array declarators, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.7.6.3">6.7.6.3</a> string, <a href="#7.1.1">7.1.1</a>
26293 static_assert declaration, <a href="#6.7.10">6.7.10</a> comparison functions, <a href="#7.24.4">7.24.4</a>
26294 static_assert macro, <a href="#7.2">7.2</a> concatenation functions, <a href="#7.24.3">7.24.3</a>, <a href="#K.3.7.2">K.3.7.2</a>
26295 stdalign.h header, <a href="#4">4</a>, <a href="#7.15">7.15</a> conversion functions, <a href="#7.11.1.1">7.11.1.1</a>
26296 stdarg.h header, <a href="#4">4</a>, <a href="#6.7.6.3">6.7.6.3</a>, <a href="#7.16">7.16</a> copying functions, <a href="#7.24.2">7.24.2</a>, <a href="#K.3.7.1">K.3.7.1</a>
26297 stdatomic.h header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.17">7.17</a>, library function conventions, <a href="#7.24.1">7.24.1</a>
26298 <a href="#7.31.8">7.31.8</a> literal, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.5.1">6.5.1</a>, <a href="#6.7.9">6.7.9</a>
26299 stdbool.h header, <a href="#4">4</a>, <a href="#7.18">7.18</a>, <a href="#7.31.9">7.31.9</a>, <a href="#H">H</a> miscellaneous functions, <a href="#7.24.6">7.24.6</a>, <a href="#K.3.7.4">K.3.7.4</a>
26300 STDC, <a href="#6.10.6">6.10.6</a>, <a href="#6.11.8">6.11.8</a> numeric conversion functions, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1">7.22.1</a>
26301 stddef.h header, <a href="#4">4</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.4.4.4">6.4.4.4</a>, search functions, <a href="#7.24.5">7.24.5</a>, <a href="#K.3.7.3">K.3.7.3</a>
26302 <a href="#6.4.5">6.4.5</a>, <a href="#6.5.3.4">6.5.3.4</a>, <a href="#6.5.6">6.5.6</a>, <a href="#7.19">7.19</a>, <a href="#K.3.3">K.3.3</a> string handling header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
26303 stderr macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a> string.h header, <a href="#7.24">7.24</a>, <a href="#7.31.13">7.31.13</a>, <a href="#K.3.7">K.3.7</a>
26304 stdin macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.4">7.21.6.4</a>, stringizing, <a href="#6.10.3.2">6.10.3.2</a>, <a href="#6.10.9">6.10.9</a>
26305 <a href="#7.21.7.6">7.21.7.6</a>, <a href="#7.29.2.12">7.29.2.12</a>, <a href="#7.29.3.7">7.29.3.7</a>, <a href="#K.3.5.3.4">K.3.5.3.4</a>, strlen function, <a href="#7.24.6.3">7.24.6.3</a>
26306 <a href="#K.3.5.4.1">K.3.5.4.1</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a> strncat function, <a href="#7.24.3.2">7.24.3.2</a>
26307 stdint.h header, <a href="#4">4</a>, <a href="#5.2.4.2">5.2.4.2</a>, <a href="#6.10.1">6.10.1</a>, <a href="#7.8">7.8</a>, <a href="#7.20">7.20</a>, strncat_s function, <a href="#K.3.7.2.2">K.3.7.2.2</a>
26308 <a href="#7.31.10">7.31.10</a>, <a href="#K.3.3">K.3.3</a>, <a href="#K.3.4">K.3.4</a> strncmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.4">7.24.4.4</a>
26309 stdio.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21">7.21</a>, <a href="#7.31.11">7.31.11</a>, <a href="#F">F</a>, strncpy function, <a href="#7.24.2.4">7.24.2.4</a>
26310 <a href="#K.3.5">K.3.5</a> strncpy_s function, <a href="#K.3.7.1.4">K.3.7.1.4</a>
26311 stdlib.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a>, <a href="#F">F</a>, strnlen_s function, <a href="#K.3.7.4.4">K.3.7.4.4</a>
26312 <a href="#K.3.1.4">K.3.1.4</a>, <a href="#K.3.6">K.3.6</a> stronger, <a href="#6.2.8">6.2.8</a>
26313 stdnoreturn.h header, <a href="#4">4</a>, <a href="#7.23">7.23</a> strpbrk function, <a href="#7.24.5.4">7.24.5.4</a>
26314 stdout macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.3">7.21.6.3</a>, strrchr function, <a href="#7.24.5.5">7.24.5.5</a>
26315 <a href="#7.21.7.8">7.21.7.8</a>, <a href="#7.21.7.9">7.21.7.9</a>, <a href="#7.29.2.11">7.29.2.11</a>, <a href="#7.29.3.9">7.29.3.9</a> strspn function, <a href="#7.24.5.6">7.24.5.6</a>
26316 storage duration, <a href="#6.2.4">6.2.4</a> strstr function, <a href="#7.24.5.7">7.24.5.7</a>
26317 storage order of array, <a href="#6.5.2.1">6.5.2.1</a> strtod function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.3">7.22.1.3</a>,
26318 storage unit (bit-field), <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.7.2.1">6.7.2.1</a> <a href="#7.29.2.2">7.29.2.2</a>, <a href="#F.3">F.3</a>
26319 storage-class specifiers, <a href="#6.7.1">6.7.1</a>, <a href="#6.11.5">6.11.5</a> strtof function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.3">F.3</a>
26320 strcat function, <a href="#7.24.3.1">7.24.3.1</a> strtoimax function, <a href="#7.8.2.3">7.8.2.3</a>
26321 strcat_s function, <a href="#K.3.7.2.1">K.3.7.2.1</a> strtok function, <a href="#7.24.5.8">7.24.5.8</a>
26322 strchr function, <a href="#7.24.5.2">7.24.5.2</a> strtok_s function, <a href="#K.3.7.3.1">K.3.7.3.1</a>
26323 strcmp function, <a href="#7.24.4">7.24.4</a>, <a href="#7.24.4.2">7.24.4.2</a> strtol function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.2">7.22.1.2</a>,
26324 strcoll function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.4.3">7.24.4.3</a>, <a href="#7.24.4.5">7.24.4.5</a> <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.2.2">7.29.2.2</a>
26325 strcpy function, <a href="#7.24.2.3">7.24.2.3</a> strtold function, <a href="#7.12.11.2">7.12.11.2</a>, <a href="#7.22.1.3">7.22.1.3</a>, <a href="#F.3">F.3</a>
26326 strcpy_s function, <a href="#K.3.7.1.3">K.3.7.1.3</a> strtoll function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1.2">7.22.1.2</a>, <a href="#7.22.1.4">7.22.1.4</a>
26327 strcspn function, <a href="#7.24.5.3">7.24.5.3</a> strtoul function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22.1.2">7.22.1.2</a>,
26328 streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.22.4.4">7.22.4.4</a> <a href="#7.22.1.4">7.22.1.4</a>, <a href="#7.29.2.2">7.29.2.2</a>
26329 fully buffered, <a href="#7.21.3">7.21.3</a> strtoull function, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.22.1.2">7.22.1.2</a>, <a href="#7.22.1.4">7.22.1.4</a>
26330 line buffered, <a href="#7.21.3">7.21.3</a> strtoumax function, <a href="#7.8.2.3">7.8.2.3</a>
26331 orientation, <a href="#7.21.2">7.21.2</a> struct hack, see flexible array member
26332 standard error, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> struct lconv, <a href="#7.11">7.11</a>
26333 standard input, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> struct timespec, <a href="#7.27.1">7.27.1</a>
26334 standard output, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.3">7.21.3</a> struct tm, <a href="#7.27.1">7.27.1</a>
26335 unbuffered, <a href="#7.21.3">7.21.3</a> structure
26336 strerror function, <a href="#7.21.10.4">7.21.10.4</a>, <a href="#7.24.6.2">7.24.6.2</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26337 strerror_s function, <a href="#K.3.7.4.2">K.3.7.4.2</a>, <a href="#K.3.7.4.3">K.3.7.4.3</a> content, <a href="#6.7.2.3">6.7.2.3</a>
26339 [<a name="p678" href="#p678">page 678</a>] (<a href="#Contents">Contents</a>)
26341 dot operator (.), <a href="#6.5.2.3">6.5.2.3</a> thrd_current function, <a href="#7.26.5.2">7.26.5.2</a>
26342 initialization, <a href="#6.7.9">6.7.9</a> thrd_detach function, <a href="#7.26.5.3">7.26.5.3</a>
26343 member alignment, <a href="#6.7.2.1">6.7.2.1</a> thrd_equal function, <a href="#7.26.5.4">7.26.5.4</a>
26344 member name space, <a href="#6.2.3">6.2.3</a> thrd_exit function, <a href="#7.26.5.5">7.26.5.5</a>
26345 member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a> thrd_join function, <a href="#7.26.5.6">7.26.5.6</a>
26346 pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a> thrd_sleep function, <a href="#7.26.5.7">7.26.5.7</a>
26347 specifier, <a href="#6.7.2.1">6.7.2.1</a> thrd_start_t type, <a href="#7.26.1">7.26.1</a>
26348 tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a> thrd_t type, <a href="#7.26.1">7.26.1</a>
26349 type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a> thrd_yield function, <a href="#7.26.5.8">7.26.5.8</a>
26350 strxfrm function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.24.4.5">7.24.4.5</a> thread of execution, <a href="#5.1.2.4">5.1.2.4</a>, <a href="#7.1.4">7.1.4</a>, <a href="#7.6">7.6</a>, <a href="#7.22.4.6">7.22.4.6</a>,
26351 subnormal floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a> <a href="#K.3.6.2.1">K.3.6.2.1</a>
26352 subscripting, <a href="#6.5.2.1">6.5.2.1</a> thread storage duration, <a href="#6.2.4">6.2.4</a>, <a href="#7.6">7.6</a>
26353 subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a> threads header, <a href="#7.26">7.26</a>, <a href="#7.31.15">7.31.15</a>
26354 subtraction operator (-), <a href="#6.2.6.2">6.2.6.2</a>, <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> threads.h header, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.1.2">7.1.2</a>, <a href="#7.26">7.26</a>,
26355 suffix <a href="#7.31.15">7.31.15</a>
26356 floating constant, <a href="#6.4.4.2">6.4.4.2</a> time
26357 integer constant, <a href="#6.4.4.1">6.4.4.1</a> broken down, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.3">7.27.3</a>, <a href="#7.27.3.1">7.27.3.1</a>,
26358 switch body, <a href="#6.8.4.2">6.8.4.2</a> <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#7.27.3.5">7.27.3.5</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>,
26359 switch case label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a>
26360 switch default label, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> calendar, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.2">7.27.2.2</a>, <a href="#7.27.2.3">7.27.2.3</a>, <a href="#7.27.2.4">7.27.2.4</a>,
26361 switch statement, <a href="#6.8.1">6.8.1</a>, <a href="#6.8.4.2">6.8.4.2</a> <a href="#7.27.3.2">7.27.3.2</a>, <a href="#7.27.3.3">7.27.3.3</a>, <a href="#7.27.3.4">7.27.3.4</a>, <a href="#K.3.8.2.2">K.3.8.2.2</a>,
26362 swprintf function, <a href="#7.29.2.3">7.29.2.3</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#K.3.8.2.3">K.3.8.2.3</a>, <a href="#K.3.8.2.4">K.3.8.2.4</a>
26363 <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a> components, <a href="#7.27.1">7.27.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
26364 swprintf_s function, <a href="#K.3.9.1.3">K.3.9.1.3</a>, <a href="#K.3.9.1.4">K.3.9.1.4</a> conversion functions, <a href="#7.27.3">7.27.3</a>, <a href="#K.3.8.2">K.3.8.2</a>
26365 swscanf function, <a href="#7.29.2.4">7.29.2.4</a>, <a href="#7.29.2.8">7.29.2.8</a> wide character, <a href="#7.29.5">7.29.5</a>
26366 swscanf_s function, <a href="#K.3.9.1.5">K.3.9.1.5</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a> local, <a href="#7.27.1">7.27.1</a>
26367 symbols, <a href="#3">3</a> manipulation functions, <a href="#7.27.2">7.27.2</a>
26368 synchronization operation, <a href="#5.1.2.4">5.1.2.4</a> normalized broken down, <a href="#K.3.8.1">K.3.8.1</a>, <a href="#K.3.8.2.1">K.3.8.2.1</a>
26369 synchronize with, <a href="#5.1.2.4">5.1.2.4</a> time base, <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.5">7.27.2.5</a>
26370 syntactic categories, <a href="#6.1">6.1</a> time function, <a href="#7.27.2.4">7.27.2.4</a>
26371 syntax notation, <a href="#6.1">6.1</a> time.h header, <a href="#7.26.1">7.26.1</a>, <a href="#7.27">7.27</a>, <a href="#7.31.14">7.31.14</a>, <a href="#K.3.8">K.3.8</a>
26372 syntax rule precedence, <a href="#5.1.1.2">5.1.1.2</a> time_t type, <a href="#7.27.1">7.27.1</a>
26373 syntax summary, language, <a href="#A">A</a> TIME_UTC macro, <a href="#7.26.3.5">7.26.3.5</a>, <a href="#7.26.4.4">7.26.4.4</a>, <a href="#7.26.5.7">7.26.5.7</a>,
26374 system function, <a href="#7.22.4.8">7.22.4.8</a> <a href="#7.27.1">7.27.1</a>, <a href="#7.27.2.5">7.27.2.5</a>
26375 timespec structure type, <a href="#7.27.1">7.27.1</a>
26376 tab characters, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a> timespec_get function, <a href="#7.27.2.5">7.27.2.5</a>
26377 tag compatibility, <a href="#6.2.7">6.2.7</a> tm structure type, <a href="#7.27.1">7.27.1</a>, <a href="#7.29.1">7.29.1</a>, <a href="#K.3.8.1">K.3.8.1</a>
26378 tag name space, <a href="#6.2.3">6.2.3</a> TMP_MAX macro, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.4">7.21.4.4</a>
26379 tags, <a href="#6.7.2.3">6.7.2.3</a> TMP_MAX_S macro, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
26380 tan functions, <a href="#7.12.4.7">7.12.4.7</a>, <a href="#F.10.1.7">F.10.1.7</a> tmpfile function, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.22.4.4">7.22.4.4</a>
26381 tan type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> tmpfile_s function, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
26382 tanh functions, <a href="#7.12.5.6">7.12.5.6</a>, <a href="#F.10.2.6">F.10.2.6</a> tmpnam function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.4.3">7.21.4.3</a>, <a href="#7.21.4.4">7.21.4.4</a>,
26383 tanh type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> <a href="#K.3.5.1.2">K.3.5.1.2</a>
26384 temporary lifetime, <a href="#6.2.4">6.2.4</a> tmpnam_s function, <a href="#K.3.5">K.3.5</a>, <a href="#K.3.5.1.1">K.3.5.1.1</a>, <a href="#K.3.5.1.2">K.3.5.1.2</a>
26385 tentative definition, <a href="#6.9.2">6.9.2</a> token, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, see also preprocessing tokens
26386 terms, <a href="#3">3</a> token concatenation, <a href="#6.10.3.3">6.10.3.3</a>
26387 text streams, <a href="#7.21.2">7.21.2</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>, <a href="#7.21.9.4">7.21.9.4</a> token pasting, <a href="#6.10.3.3">6.10.3.3</a>
26388 tgamma functions, <a href="#7.12.8.4">7.12.8.4</a>, <a href="#F.10.5.4">F.10.5.4</a> tolower function, <a href="#7.4.2.1">7.4.2.1</a>
26389 tgamma type-generic macro, <a href="#7.25">7.25</a> toupper function, <a href="#7.4.2.2">7.4.2.2</a>
26390 tgmath.h header, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> towctrans function, <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
26391 thrd_create function, <a href="#7.26.1">7.26.1</a>, <a href="#7.26.5.1">7.26.5.1</a> towlower function, <a href="#7.30.3.1.1">7.30.3.1.1</a>, <a href="#7.30.3.2.1">7.30.3.2.1</a>
26393 [<a name="p679" href="#p679">page 679</a>] (<a href="#Contents">Contents</a>)
26395 towupper function, <a href="#7.30.3.1.2">7.30.3.1.2</a>, <a href="#7.30.3.2.1">7.30.3.2.1</a> UCHAR_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26396 translation environment, <a href="#5">5</a>, <a href="#5.1.1">5.1.1</a> UINT_FASTN_MAX macros, <a href="#7.20.2.3">7.20.2.3</a>
26397 translation limits, <a href="#5.2.4.1">5.2.4.1</a> uint_fastN_t types, <a href="#7.20.1.3">7.20.1.3</a>
26398 translation phases, <a href="#5.1.1.2">5.1.1.2</a> uint_least16_t type, <a href="#7.28">7.28</a>
26399 translation unit, <a href="#5.1.1.1">5.1.1.1</a>, <a href="#6.9">6.9</a> uint_least32_t type, <a href="#7.28">7.28</a>
26400 trap, see perform a trap UINT_LEASTN_MAX macros, <a href="#7.20.2.2">7.20.2.2</a>
26401 trap representation, <a href="#3.19.4">3.19.4</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.2.6.2">6.2.6.2</a>, uint_leastN_t types, <a href="#7.20.1.2">7.20.1.2</a>
26402 <a href="#6.3.2.3">6.3.2.3</a>, <a href="#6.5.2.3">6.5.2.3</a> UINT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
26403 trigonometric functions UINTMAX_C macro, <a href="#7.20.4.2">7.20.4.2</a>
26404 complex, <a href="#7.3.5">7.3.5</a>, <a href="#G.6.1">G.6.1</a> UINTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.20.2.5">7.20.2.5</a>
26405 real, <a href="#7.12.4">7.12.4</a>, <a href="#F.10.1">F.10.1</a> uintmax_t type, <a href="#7.20.1.5">7.20.1.5</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>,
26406 trigraph sequences, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1.1">5.2.1.1</a> <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a>
26407 true macro, <a href="#7.18">7.18</a> UINTN_C macros, <a href="#7.20.4.1">7.20.4.1</a>
26408 trunc functions, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#F.10.6.8">F.10.6.8</a> UINTN_MAX macros, <a href="#7.20.2.1">7.20.2.1</a>
26409 trunc type-generic macro, <a href="#7.25">7.25</a> uintN_t types, <a href="#7.20.1.1">7.20.1.1</a>
26410 truncation, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#7.12.9.8">7.12.9.8</a>, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.5.3">7.21.5.3</a> UINTPTR_MAX macro, <a href="#7.20.2.4">7.20.2.4</a>
26411 truncation toward zero, <a href="#6.5.5">6.5.5</a> uintptr_t type, <a href="#7.20.1.4">7.20.1.4</a>
26412 tss_create function, <a href="#7.26.6.1">7.26.6.1</a> ULLONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>,
26413 tss_delete function, <a href="#7.26.6.2">7.26.6.2</a> <a href="#7.29.4.1.2">7.29.4.1.2</a>
26414 TSS_DTOR_ITERATIONS macro, <a href="#7.26.1">7.26.1</a> ULONG_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>, <a href="#7.22.1.4">7.22.1.4</a>,
26415 tss_dtor_t type, <a href="#7.26.1">7.26.1</a> <a href="#7.29.4.1.2">7.29.4.1.2</a>
26416 tss_get function, <a href="#7.26.6.3">7.26.6.3</a> unary arithmetic operators, <a href="#6.5.3.3">6.5.3.3</a>
26417 tss_set function, <a href="#7.26.6.4">7.26.6.4</a> unary expression, <a href="#6.5.3">6.5.3</a>
26418 tss_t type, <a href="#7.26.1">7.26.1</a> unary minus operator (-), <a href="#6.5.3.3">6.5.3.3</a>, <a href="#F.3">F.3</a>
26419 two's complement, <a href="#6.2.6.2">6.2.6.2</a>, <a href="#7.20.1.1">7.20.1.1</a> unary operators, <a href="#6.5.3">6.5.3</a>
26420 type category, <a href="#6.2.5">6.2.5</a> unary plus operator (+), <a href="#6.5.3.3">6.5.3.3</a>
26421 type conversion, <a href="#6.3">6.3</a> unbuffered stream, <a href="#7.21.3">7.21.3</a>
26422 type definitions, <a href="#6.7.8">6.7.8</a> undef preprocessing directive, <a href="#6.10.3.5">6.10.3.5</a>, <a href="#7.1.3">7.1.3</a>,
26423 type domain, <a href="#6.2.5">6.2.5</a>, <a href="#G.2">G.2</a> <a href="#7.1.4">7.1.4</a>
26424 type names, <a href="#6.7.7">6.7.7</a> undefined behavior, <a href="#3.4.3">3.4.3</a>, <a href="#4">4</a>, <a href="#J.2">J.2</a>
26425 type punning, <a href="#6.5.2.3">6.5.2.3</a> underscore character, <a href="#6.4.2.1">6.4.2.1</a>
26426 type qualifiers, <a href="#6.7.3">6.7.3</a> underscore, leading, in identifier, <a href="#7.1.3">7.1.3</a>
26427 type specifiers, <a href="#6.7.2">6.7.2</a> ungetc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.7.10">7.21.7.10</a>, <a href="#7.21.9.2">7.21.9.2</a>,
26428 type-generic macro, <a href="#7.25">7.25</a>, <a href="#G.7">G.7</a> <a href="#7.21.9.3">7.21.9.3</a>
26429 type-generic math header, <a href="#7.25">7.25</a> ungetwc function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3.10">7.29.3.10</a>
26430 typedef declaration, <a href="#6.7.8">6.7.8</a> Unicode, <a href="#7.28">7.28</a>, see also char16_t type,
26431 typedef storage-class specifier, <a href="#6.7.1">6.7.1</a>, <a href="#6.7.8">6.7.8</a> char32_t type, wchar_t type
26432 types, <a href="#6.2.5">6.2.5</a> Unicode required set, <a href="#6.10.8.2">6.10.8.2</a>
26433 atomic, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.2.5">6.2.5</a>, <a href="#6.2.6.1">6.2.6.1</a>, <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>, unicode utilities header, <a href="#7.28">7.28</a>
26434 <a href="#6.5.2.4">6.5.2.4</a>, <a href="#6.5.16.2">6.5.16.2</a>, <a href="#6.7.2.4">6.7.2.4</a>, <a href="#6.10.8.3">6.10.8.3</a>, <a href="#7.17.6">7.17.6</a> union
26435 character, <a href="#6.7.9">6.7.9</a> arrow operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26436 compatible, <a href="#6.2.7">6.2.7</a>, <a href="#6.7.2">6.7.2</a>, <a href="#6.7.3">6.7.3</a>, <a href="#6.7.6">6.7.6</a> content, <a href="#6.7.2.3">6.7.2.3</a>
26437 complex, <a href="#6.2.5">6.2.5</a>, <a href="#G">G</a> dot operator (.), <a href="#6.5.2.3">6.5.2.3</a>
26438 composite, <a href="#6.2.7">6.2.7</a> initialization, <a href="#6.7.9">6.7.9</a>
26439 const qualified, <a href="#6.7.3">6.7.3</a> member alignment, <a href="#6.7.2.1">6.7.2.1</a>
26440 conversions, <a href="#6.3">6.3</a> member name space, <a href="#6.2.3">6.2.3</a>
26441 imaginary, <a href="#G">G</a> member operator (.), <a href="#6.3.2.1">6.3.2.1</a>, <a href="#6.5.2.3">6.5.2.3</a>
26442 restrict qualified, <a href="#6.7.3">6.7.3</a> pointer operator (-&gt;), <a href="#6.5.2.3">6.5.2.3</a>
26443 volatile qualified, <a href="#6.7.3">6.7.3</a> specifier, <a href="#6.7.2.1">6.7.2.1</a>
26444 tag, <a href="#6.2.3">6.2.3</a>, <a href="#6.7.2.3">6.7.2.3</a>
26445 uchar.h header, <a href="#6.4.4.4">6.4.4.4</a>, <a href="#6.4.5">6.4.5</a>, <a href="#7.28">7.28</a> type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2.1">6.7.2.1</a>
26447 [<a name="p680" href="#p680">page 680</a>] (<a href="#Contents">Contents</a>)
26449 universal character name, <a href="#6.4.3">6.4.3</a> value bits, <a href="#6.2.6.2">6.2.6.2</a>
26450 unnormalized floating-point numbers, <a href="#5.2.4.2.2">5.2.4.2.2</a> variable arguments, <a href="#6.10.3">6.10.3</a>
26451 unqualified type, <a href="#6.2.5">6.2.5</a> variable arguments header, <a href="#7.16">7.16</a>
26452 unqualified version of type, <a href="#6.2.5">6.2.5</a> variable length array, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a>
26453 unsequenced, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a>, <a href="#6.5.16">6.5.16</a>, see also variably modified type, <a href="#6.7.6">6.7.6</a>, <a href="#6.7.6.2">6.7.6.2</a>, <a href="#6.10.8.3">6.10.8.3</a>
26454 indeterminately sequenced, sequenced vertical-tab character, <a href="#5.2.1">5.2.1</a>, <a href="#6.4">6.4</a>
26455 before vertical-tab escape sequence (\v), <a href="#5.2.2">5.2.2</a>, <a href="#6.4.4.4">6.4.4.4</a>,
26456 unsigned char type, <a href="#K.3.5.3.2">K.3.5.3.2</a>, <a href="#K.3.9.1.2">K.3.9.1.2</a> <a href="#7.4.1.10">7.4.1.10</a>
26457 unsigned integer suffix, u or <a href="#U">U</a>, <a href="#6.4.4.1">6.4.4.1</a> vfprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#K.3.5.3.8">K.3.5.3.8</a>
26458 unsigned integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#6.4.4.1">6.4.4.1</a> vfprintf_s function, <a href="#K.3.5.3.8">K.3.5.3.8</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>,
26459 unsigned type conversion, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.3.1.3">6.3.1.3</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26460 <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.8">6.3.1.8</a> vfscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>
26461 unsigned types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, vfscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
26462 <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a> <a href="#K.3.5.3.14">K.3.5.3.14</a>
26463 unspecified behavior, <a href="#3.4.4">3.4.4</a>, <a href="#4">4</a>, <a href="#J.1">J.1</a> vfwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.5">7.29.2.5</a>, <a href="#K.3.9.1.6">K.3.9.1.6</a>
26464 unspecified value, <a href="#3.19.3">3.19.3</a> vfwprintf_s function, <a href="#K.3.9.1.6">K.3.9.1.6</a>
26465 uppercase letter, <a href="#5.2.1">5.2.1</a> vfwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.3.10">7.29.3.10</a>
26466 use of library functions, <a href="#7.1.4">7.1.4</a> vfwscanf_s function, <a href="#K.3.9.1.7">K.3.9.1.7</a>
26467 USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a> visibility of identifier, <a href="#6.2.1">6.2.1</a>
26468 usual arithmetic conversions, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.5.5">6.5.5</a>, <a href="#6.5.6">6.5.6</a>, visible sequence of side effects, <a href="#5.1.2.4">5.1.2.4</a>
26469 <a href="#6.5.8">6.5.8</a>, <a href="#6.5.9">6.5.9</a>, <a href="#6.5.10">6.5.10</a>, <a href="#6.5.11">6.5.11</a>, <a href="#6.5.12">6.5.12</a>, <a href="#6.5.15">6.5.15</a> visible side effect, <a href="#5.1.2.4">5.1.2.4</a>
26470 UTF-16, <a href="#6.10.8.2">6.10.8.2</a> VLA, see variable length array
26471 UTF-32, <a href="#6.10.8.2">6.10.8.2</a> void expression, <a href="#6.3.2.2">6.3.2.2</a>
26472 UTF-8 string literal, see string literal void function parameter, <a href="#6.7.6.3">6.7.6.3</a>
26473 utilities, general, <a href="#7.22">7.22</a>, <a href="#7.31.12">7.31.12</a>, <a href="#K.3.6">K.3.6</a> void type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.2.2">6.3.2.2</a>, <a href="#6.7.2">6.7.2</a>, <a href="#K.3.5.3.2">K.3.5.3.2</a>,
26474 wide string, <a href="#7.29.4">7.29.4</a>, <a href="#K.3.9.2">K.3.9.2</a> <a href="#K.3.9.1.2">K.3.9.1.2</a>
26475 utilities, unicode, <a href="#7.28">7.28</a> void type conversion, <a href="#6.3.2.2">6.3.2.2</a>
26476 volatile storage, <a href="#5.1.2.3">5.1.2.3</a>
26477 va_arg macro, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>, <a href="#7.16.1.2">7.16.1.2</a>, volatile type qualifier, <a href="#6.7.3">6.7.3</a>
26478 <a href="#7.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, volatile-qualified type, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.3">6.7.3</a>
26479 <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>, vprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.10">7.21.6.10</a>,
26480 <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#K.3.5.3.10">K.3.5.3.10</a>
26481 <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, vprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.10">K.3.5.3.10</a>,
26482 <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a> <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26483 va_copy macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>, vscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.11">7.21.6.11</a>
26484 <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a> vscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
26485 va_end macro, <a href="#7.1.3">7.1.3</a>, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.3">7.16.1.3</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26486 <a href="#7.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, vsnprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.12">7.21.6.12</a>,
26487 <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>, <a href="#K.3.5.3.12">K.3.5.3.12</a>
26488 <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, vsnprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
26489 <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26490 <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a> vsnwprintf_s function, <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a>
26491 va_list type, <a href="#7.16">7.16</a>, <a href="#7.16.1.3">7.16.1.3</a> vsprintf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.13">7.21.6.13</a>,
26492 va_start macro, <a href="#7.16">7.16</a>, <a href="#7.16.1">7.16.1</a>, <a href="#7.16.1.1">7.16.1.1</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>
26493 <a href="#7.16.1.2">7.16.1.2</a>, <a href="#7.16.1.3">7.16.1.3</a>, <a href="#7.16.1.4">7.16.1.4</a>, <a href="#7.21.6.8">7.21.6.8</a>, vsprintf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
26494 <a href="#7.21.6.9">7.21.6.9</a>, <a href="#7.21.6.10">7.21.6.10</a>, <a href="#7.21.6.11">7.21.6.11</a>, <a href="#7.21.6.12">7.21.6.12</a>, <a href="#K.3.5.3.12">K.3.5.3.12</a>, <a href="#K.3.5.3.13">K.3.5.3.13</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26495 <a href="#7.21.6.13">7.21.6.13</a>, <a href="#7.21.6.14">7.21.6.14</a>, <a href="#7.29.2.5">7.29.2.5</a>, <a href="#7.29.2.6">7.29.2.6</a>, vsscanf function, <a href="#7.21.6.8">7.21.6.8</a>, <a href="#7.21.6.14">7.21.6.14</a>
26496 <a href="#7.29.2.7">7.29.2.7</a>, <a href="#7.29.2.8">7.29.2.8</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.10">7.29.2.10</a>, vsscanf_s function, <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>,
26497 <a href="#K.3.5.3.9">K.3.5.3.9</a>, <a href="#K.3.5.3.11">K.3.5.3.11</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>, <a href="#K.3.9.1.7">K.3.9.1.7</a>, <a href="#K.3.5.3.14">K.3.5.3.14</a>
26498 <a href="#K.3.9.1.10">K.3.9.1.10</a>, <a href="#K.3.9.1.12">K.3.9.1.12</a> vswprintf function, <a href="#7.29.2.7">7.29.2.7</a>, <a href="#K.3.9.1.8">K.3.9.1.8</a>,
26499 value, <a href="#3.19">3.19</a> <a href="#K.3.9.1.9">K.3.9.1.9</a>
26501 [<a name="p681" href="#p681">page 681</a>] (<a href="#Contents">Contents</a>)
26503 vswprintf_s function, <a href="#K.3.9.1.8">K.3.9.1.8</a>, <a href="#K.3.9.1.9">K.3.9.1.9</a> wcstoll function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>
26504 vswscanf function, <a href="#7.29.2.8">7.29.2.8</a> wcstombs function, <a href="#7.22.8.2">7.22.8.2</a>, <a href="#7.29.6.4">7.29.6.4</a>
26505 vswscanf_s function, <a href="#K.3.9.1.10">K.3.9.1.10</a> wcstombs_s function, <a href="#K.3.6.5.2">K.3.6.5.2</a>
26506 vwprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#K.3.9.1.11">K.3.9.1.11</a> wcstoul function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>,
26507 vwprintf_s function, <a href="#K.3.9.1.11">K.3.9.1.11</a> <a href="#7.29.4.1.2">7.29.4.1.2</a>
26508 vwscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.3.10">7.29.3.10</a> wcstoull function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.29.4.1.2">7.29.4.1.2</a>
26509 vwscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a> wcstoumax function, <a href="#7.8.2.4">7.8.2.4</a>
26510 wcsxfrm function, <a href="#7.29.4.4.4">7.29.4.4.4</a>
26511 warnings, <a href="#I">I</a> wctob function, <a href="#7.29.6.1.2">7.29.6.1.2</a>, <a href="#7.30.2.1">7.30.2.1</a>
26512 wchar.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.21.1">7.21.1</a>, <a href="#7.29">7.29</a>, <a href="#7.31.16">7.31.16</a>, wctomb function, <a href="#7.22.7.3">7.22.7.3</a>, <a href="#7.22.8.2">7.22.8.2</a>, <a href="#7.29.6.3">7.29.6.3</a>
26513 <a href="#F">F</a>, <a href="#K.3.9">K.3.9</a> wctomb_s function, <a href="#K.3.6.4.1">K.3.6.4.1</a>
26514 WCHAR_MAX macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.29.1">7.29.1</a> wctrans function, <a href="#7.30.3.2.1">7.30.3.2.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
26515 WCHAR_MIN macro, <a href="#7.20.3">7.20.3</a>, <a href="#7.29.1">7.29.1</a> wctrans_t type, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.3.2.2">7.30.3.2.2</a>
26516 wchar_t type, <a href="#3.7.3">3.7.3</a>, <a href="#6.4.5">6.4.5</a>, <a href="#6.7.9">6.7.9</a>, <a href="#6.10.8.2">6.10.8.2</a>, <a href="#7.19">7.19</a>, wctype function, <a href="#7.30.2.2.1">7.30.2.2.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>
26517 <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.22">7.22</a>, <a href="#7.29.1">7.29.1</a>, wctype.h header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
26518 <a href="#7.29.2.1">7.29.2.1</a>, <a href="#7.29.2.2">7.29.2.2</a> wctype_t type, <a href="#7.30.1">7.30.1</a>, <a href="#7.30.2.2.2">7.30.2.2.2</a>
26519 wcrtomb function, <a href="#7.21.3">7.21.3</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.1">7.29.1</a>, weaker, <a href="#6.2.8">6.2.8</a>
26520 <a href="#7.29.2.2">7.29.2.2</a>, <a href="#7.29.6.3.3">7.29.6.3.3</a>, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#J.1">J.1</a>, WEOF macro, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.3.1">7.29.3.1</a>, <a href="#7.29.3.3">7.29.3.3</a>, <a href="#7.29.3.6">7.29.3.6</a>,
26521 <a href="#K.3.6.5.2">K.3.6.5.2</a>, <a href="#K.3.9.3.1">K.3.9.3.1</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a> <a href="#7.29.3.7">7.29.3.7</a>, <a href="#7.29.3.8">7.29.3.8</a>, <a href="#7.29.3.9">7.29.3.9</a>, <a href="#7.29.3.10">7.29.3.10</a>,
26522 wcrtomb_s function, <a href="#K.3.9.3.1">K.3.9.3.1</a>, <a href="#K.3.9.3.1.1">K.3.9.3.1.1</a> <a href="#7.29.6.1.1">7.29.6.1.1</a>, <a href="#7.30.1">7.30.1</a>
26523 wcscat function, <a href="#7.29.4.3.1">7.29.4.3.1</a> while statement, <a href="#6.8.5.1">6.8.5.1</a>
26524 wcscat_s function, <a href="#K.3.9.2.2.1">K.3.9.2.2.1</a> white space, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#6.4">6.4</a>, <a href="#6.10">6.10</a>, <a href="#7.4.1.10">7.4.1.10</a>,
26525 wcschr function, <a href="#7.29.4.5.1">7.29.4.5.1</a> <a href="#7.30.2.1.10">7.30.2.1.10</a>
26526 wcscmp function, <a href="#7.29.4.4.1">7.29.4.4.1</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a> white-space characters, <a href="#6.4">6.4</a>
26527 wcscoll function, <a href="#7.29.4.4.2">7.29.4.4.2</a>, <a href="#7.29.4.4.4">7.29.4.4.4</a> wide character, <a href="#3.7.3">3.7.3</a>
26528 wcscpy function, <a href="#7.29.4.2.1">7.29.4.2.1</a> case mapping functions, <a href="#7.30.3.1">7.30.3.1</a>
26529 wcscpy_s function, <a href="#K.3.9.2.1.1">K.3.9.2.1.1</a> extensible, <a href="#7.30.3.2">7.30.3.2</a>
26530 wcscspn function, <a href="#7.29.4.5.2">7.29.4.5.2</a> classification functions, <a href="#7.30.2.1">7.30.2.1</a>
26531 wcsftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.29.5.1">7.29.5.1</a> extensible, <a href="#7.30.2.2">7.30.2.2</a>
26532 wcslen function, <a href="#7.29.4.6.1">7.29.4.6.1</a> constant, <a href="#6.4.4.4">6.4.4.4</a>
26533 wcsncat function, <a href="#7.29.4.3.2">7.29.4.3.2</a> formatted input/output functions, <a href="#7.29.2">7.29.2</a>,
26534 wcsncat_s function, <a href="#K.3.9.2.2.2">K.3.9.2.2.2</a> <a href="#K.3.9.1">K.3.9.1</a>
26535 wcsncmp function, <a href="#7.29.4.4.3">7.29.4.4.3</a> input functions, <a href="#7.21.1">7.21.1</a>
26536 wcsncpy function, <a href="#7.29.4.2.2">7.29.4.2.2</a> input/output functions, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.3">7.29.3</a>
26537 wcsncpy_s function, <a href="#K.3.9.2.1.2">K.3.9.2.1.2</a> output functions, <a href="#7.21.1">7.21.1</a>
26538 wcsnlen_s function, <a href="#K.3.9.2.4.1">K.3.9.2.4.1</a> single-byte conversion functions, <a href="#7.29.6.1">7.29.6.1</a>
26539 wcspbrk function, <a href="#7.29.4.5.3">7.29.4.5.3</a> wide character classification and mapping utilities
26540 wcsrchr function, <a href="#7.29.4.5.4">7.29.4.5.4</a> header, <a href="#7.30">7.30</a>, <a href="#7.31.17">7.31.17</a>
26541 wcsrtombs function, <a href="#7.29.6.4.2">7.29.6.4.2</a>, <a href="#K.3.9.3.2">K.3.9.3.2</a> wide string, <a href="#7.1.1">7.1.1</a>
26542 wcsrtombs_s function, <a href="#K.3.9.3.2">K.3.9.3.2</a>, <a href="#K.3.9.3.2.2">K.3.9.3.2.2</a> wide string comparison functions, <a href="#7.29.4.4">7.29.4.4</a>
26543 wcsspn function, <a href="#7.29.4.5.5">7.29.4.5.5</a> wide string concatenation functions, <a href="#7.29.4.3">7.29.4.3</a>,
26544 wcsstr function, <a href="#7.29.4.5.6">7.29.4.5.6</a> <a href="#K.3.9.2.2">K.3.9.2.2</a>
26545 wcstod function, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a> wide string copying functions, <a href="#7.29.4.2">7.29.4.2</a>, <a href="#K.3.9.2.1">K.3.9.2.1</a>
26546 wcstod function, <a href="#7.29.4.1.1">7.29.4.1.1</a> wide string literal, see string literal
26547 wcstof function, <a href="#7.29.4.1.1">7.29.4.1.1</a> wide string miscellaneous functions, <a href="#7.29.4.6">7.29.4.6</a>,
26548 wcstoimax function, <a href="#7.8.2.4">7.8.2.4</a> <a href="#K.3.9.2.4">K.3.9.2.4</a>
26549 wcstok function, <a href="#7.29.4.5.7">7.29.4.5.7</a> wide string numeric conversion functions, <a href="#7.8.2.4">7.8.2.4</a>,
26550 wcstok_s function, <a href="#K.3.9.2.3.1">K.3.9.2.3.1</a> <a href="#7.29.4.1">7.29.4.1</a>
26551 wcstol function, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.21.6.2">7.21.6.2</a>, <a href="#7.29.2.2">7.29.2.2</a>, wide string search functions, <a href="#7.29.4.5">7.29.4.5</a>, <a href="#K.3.9.2.3">K.3.9.2.3</a>
26552 <a href="#7.29.4.1.2">7.29.4.1.2</a> wide-oriented stream, <a href="#7.21.2">7.21.2</a>
26553 wcstold function, <a href="#7.29.4.1.1">7.29.4.1.1</a> width, <a href="#6.2.6.2">6.2.6.2</a>
26555 [<a name="p682" href="#p682">page 682</a>] (<a href="#Contents">Contents</a>)
26557 WINT_MAX macro, <a href="#7.20.3">7.20.3</a>
26558 WINT_MIN macro, <a href="#7.20.3">7.20.3</a>
26559 wint_t type, <a href="#7.20.3">7.20.3</a>, <a href="#7.21.6.1">7.21.6.1</a>, <a href="#7.29.1">7.29.1</a>, <a href="#7.29.2.1">7.29.2.1</a>,
26560 <a href="#7.30.1">7.30.1</a>
26561 wmemchr function, <a href="#7.29.4.5.8">7.29.4.5.8</a>
26562 wmemcmp function, <a href="#7.29.4.4.5">7.29.4.4.5</a>
26563 wmemcpy function, <a href="#7.29.4.2.3">7.29.4.2.3</a>
26564 wmemcpy_s function, <a href="#K.3.9.2.1.3">K.3.9.2.1.3</a>
26565 wmemmove function, <a href="#7.29.4.2.4">7.29.4.2.4</a>
26566 wmemmove_s function, <a href="#K.3.9.2.1.4">K.3.9.2.1.4</a>
26567 wmemset function, <a href="#7.29.4.6.2">7.29.4.6.2</a>
26568 wprintf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.9">7.29.2.9</a>, <a href="#7.29.2.11">7.29.2.11</a>,
26569 <a href="#K.3.9.1.13">K.3.9.1.13</a>
26570 wprintf_s function, <a href="#K.3.9.1.13">K.3.9.1.13</a>
26571 wscanf function, <a href="#7.21.1">7.21.1</a>, <a href="#7.29.2.10">7.29.2.10</a>, <a href="#7.29.2.12">7.29.2.12</a>,
26572 <a href="#7.29.3.10">7.29.3.10</a>
26573 wscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a>
26575 xor macro, <a href="#7.9">7.9</a>
26576 xor_eq macro, <a href="#7.9">7.9</a> *
26578 [<a name="p683" href="#p683">page 683</a>] (<a href="#Contents">Contents</a>)
26579 </pre></body></html>