-[<a name="#pix" href="pix">page ix</a>] (<a href="#Contents">Contents</a>)
+[<a name="pix" href="#pix">page ix</a>] (<a href="#Contents">Contents</a>)
-[<a name="#px" href="px">page x</a>] (<a href="#Contents">Contents</a>)
+[<a name="px" href="#px">page x</a>] (<a href="#Contents">Contents</a>)
<a name="Foreword" href="#Foreword"><b> Foreword</b></a>
1 ISO (the International Organization for Standardization) and IEC (the International
-- the long long int type and library functions
-[<a name="#pxi" href="pxi">page xi</a>] (<a href="#Contents">Contents</a>)
+[<a name="pxi" href="#pxi">page xi</a>] (<a href="#Contents">Contents</a>)
-- increased minimum translation limits
-- additional floating-point characteristics in <a href="#7.7"><float.h></a>
-- empty macro arguments
-[<a name="#pxii" href="pxii">page xii</a>] (<a href="#Contents">Contents</a>)
+[<a name="pxii" href="#pxii">page xii</a>] (<a href="#Contents">Contents</a>)
-- new structure type compatibility rules (tag compatibility)
-- additional predefined macro names
-[<a name="#pxiii" href="pxiii">page xiii</a>] (<a href="#Contents">Contents</a>)
+[<a name="pxiii" href="#pxiii">page xiii</a>] (<a href="#Contents">Contents</a>)
<a name="Introduction" href="#Introduction"><b> Introduction</b></a>
1 With the introduction of new devices and extended character sets, new features may be
-[<a name="#pxiv" href="pxiv">page xiv</a>] (<a href="#Contents">Contents</a>)
+[<a name="pxiv" href="#pxiv">page xiv</a>] (<a href="#Contents">Contents</a>)
1) This International Standard is designed to promote the portability of C programs among a variety of
data-processing systems. It is intended for use by implementors and programmers.
-[<a name="#p1" href="p1">page 1</a>] (<a href="#Contents">Contents</a>)
+[<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
-- all minimal requirements of a data-processing system that is capable of supporting a
conforming implementation.
-[<a name="#p2" href="p2">page 2</a>] (<a href="#Contents">Contents</a>)
+[<a name="p2" href="#p2">page 2</a>] (<a href="#Contents">Contents</a>)
<a name="3" href="#3"><b> 3. Terms, definitions, and symbols</b></a>
implementation documents
-[<a name="#p3" href="p3">page 3</a>] (<a href="#Contents">Contents</a>)
+[<a name="p3" href="#p3">page 3</a>] (<a href="#Contents">Contents</a>)
2 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for
characters other than the 26 lowercase Latin letters.
1 character
single-byte character
<C> bit representation that fits in a byte
-[<a name="#p4" href="p4">page 4</a>] (<a href="#Contents">Contents</a>)
+[<a name="p4" href="#p4">page 4</a>] (<a href="#Contents">Contents</a>)
<a name="3.7.2" href="#3.7.2"><b> 3.7.2</b></a>
1 multibyte character
region of data storage in the execution environment, the contents of which can represent
values
-[<a name="#p5" href="p5">page 5</a>] (<a href="#Contents">Contents</a>)
+[<a name="p5" href="#p5">page 5</a>] (<a href="#Contents">Contents</a>)
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>.
-[<a name="#p6" href="p6">page 6</a>] (<a href="#Contents">Contents</a>)
+[<a name="p6" href="#p6">page 6</a>] (<a href="#Contents">Contents</a>)
<a name="4" href="#4"><b> 4. Conformance</b></a>
3) This implies that a conforming implementation reserves no identifiers other than those explicitly
reserved in this International Standard.
-[<a name="#p7" href="p7">page 7</a>] (<a href="#Contents">Contents</a>)
+[<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
7 A conforming program is one that is acceptable to a conforming implementation.4)
8 An implementation shall be accompanied by a document that defines all implementation-
implementations. Conforming programs may depend upon nonportable features of a conforming
implementation.
-[<a name="#p8" href="p8">page 8</a>] (<a href="#Contents">Contents</a>)
+[<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
<a name="5" href="#5"><b> 5. Environment</b></a>
and any external representation. The description is conceptual only, and does not specify any
particular implementation.
-[<a name="#p9" href="p9">page 9</a>] (<a href="#Contents">Contents</a>)
+[<a name="p9" href="#p9">page 9</a>] (<a href="#Contents">Contents</a>)
2. Each instance of a backslash character (\) immediately followed by a new-line
character is deleted, splicing physical source lines to form logical source lines.
7) An implementation need not convert all non-corresponding source characters to the same execution
character.
-[<a name="#p10" href="p10">page 10</a>] (<a href="#Contents">Contents</a>)
+[<a name="p10" href="#p10">page 10</a>] (<a href="#Contents">Contents</a>)
<a name="5.1.1.3" href="#5.1.1.3"><b> 5.1.1.3 Diagnostics</b></a>
1 A conforming implementation shall produce at least one diagnostic message (identified in
violation. Of course, an implementation is free to produce any number of diagnostics as long as a
valid program is still correctly translated. It may also successfully translate an invalid program.
-[<a name="#p11" href="p11">page 11</a>] (<a href="#Contents">Contents</a>)
+[<a name="p11" href="#p11">page 11</a>] (<a href="#Contents">Contents</a>)
<a name="5.1.2.2.1" href="#5.1.2.2.1"><b> 5.1.2.2.1 Program startup</b></a>
1 The function called at program startup is named main. The implementation declares no
9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
char ** argv, and so on.
-[<a name="#p12" href="p12">page 12</a>] (<a href="#Contents">Contents</a>)
+[<a name="p12" href="#p12">page 12</a>] (<a href="#Contents">Contents</a>)
<a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
1 If the return type of the main function is a type compatible with int, a return from the
environment library <a href="#7.6"><fenv.h></a> provides a programming facility for indicating when these side
effects matter, freeing the implementations in other cases.
-[<a name="#p13" href="p13">page 13</a>] (<a href="#Contents">Contents</a>)
+[<a name="p13" href="#p13">page 13</a>] (<a href="#Contents">Contents</a>)
-- At program termination, all data written into files shall be identical to the result that
execution of the program according to the abstract semantics would have produced.
f1 = f2 * d;
the multiplication may be executed using single-precision arithmetic if the implementation can ascertain
that the result would be the same as if it were executed using double-precision arithmetic (for example, if d
- were replaced by the constant <a href="#2.0">2.0</a>, which has type double).
+ were replaced by the constant 2.0, which has type double).
-[<a name="#p14" href="p14">page 14</a>] (<a href="#Contents">Contents</a>)
+[<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
12 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate
semantics. Values are independent of whether they are represented in a register or in memory. For
/* ... */
x = (x * y) * z; // not equivalent to x *= y * z;
z = (x - y) + y ; // not equivalent to z = x;
- z = x + x * y; // not equivalent to z = x * (<a href="#1.0">1.0</a> + y);
- y = x / <a href="#5.0">5.0</a>; // not equivalent to y = x * 0.2;
+ z = x + x * y; // not equivalent to z = x * (1.0 + y);
+ y = x / 5.0; // not equivalent to y = x * 0.2;
14 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment
int a, b;
-[<a name="#p15" href="p15">page 15</a>] (<a href="#Contents">Contents</a>)
+[<a name="p15" href="#p15">page 15</a>] (<a href="#Contents">Contents</a>)
15 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the
following fragment
-[<a name="#p16" href="p16">page 16</a>] (<a href="#Contents">Contents</a>)
+[<a name="p16" href="#p16">page 16</a>] (<a href="#Contents">Contents</a>)
<a name="5.2" href="#5.2"><b> 5.2 Environmental considerations</b></a>
<a name="5.2.1" href="#5.2.1"><b> 5.2.1 Character sets</b></a>
other characters are encountered in a source file (except in an identifier, a character
constant, a string literal, a header name, a comment, or a preprocessing token that is never
-[<a name="#p17" href="p17">page 17</a>] (<a href="#Contents">Contents</a>)
+[<a name="p17" href="#p17">page 17</a>] (<a href="#Contents">Contents</a>)
converted to a token), the behavior is undefined.
4 A letter is an uppercase letter or a lowercase letter as defined above; in this International
12) The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
-[<a name="#p18" href="p18">page 18</a>] (<a href="#Contents">Contents</a>)
+[<a name="p18" href="#p18">page 18</a>] (<a href="#Contents">Contents</a>)
-- A multibyte character set may have a state-dependent encoding, wherein each
sequence of multibyte characters begins in an initial shift state and enters other
tabulation position, the behavior of the display device is unspecified.
\v (vertical tab) Moves the active position to the initial position of the next vertical
tabulation position. If the active position is at or past the last defined vertical
-[<a name="#p19" href="p19">page 19</a>] (<a href="#Contents">Contents</a>)
+[<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
tabulation position, the behavior of the display device is unspecified.
3 Each of these escape sequences shall produce a unique implementation-defined value
13) Implementations should avoid imposing fixed translation limits whenever possible.
-[<a name="#p20" href="p20">page 20</a>] (<a href="#Contents">Contents</a>)
+[<a name="p20" href="#p20">page 20</a>] (<a href="#Contents">Contents</a>)
universal character name specifying a short identifier of 00010000 or more is
considered 10 characters, and each extended source character is considered the same
14) See ''future language directions'' (<a href="#6.11.3">6.11.3</a>).
-[<a name="#p21" href="p21">page 21</a>] (<a href="#Contents">Contents</a>)
+[<a name="p21" href="#p21">page 21</a>] (<a href="#Contents">Contents</a>)
(absolute value) to those shown, with the same sign.
-- number of bits for smallest object that is not a bit-field (byte)
ULONG_MAX 4294967295 // 232 - 1
-[<a name="#p22" href="p22">page 22</a>] (<a href="#Contents">Contents</a>)
+[<a name="p22" href="#p22">page 22</a>] (<a href="#Contents">Contents</a>)
-- minimum value for an object of type long long int
LLONG_MIN -9223372036854775807 // -(263 - 1)
16) The floating-point model is intended to clarify the description of each floating-point characteristic and
does not require the floating-point arithmetic of the implementation to be identical.
-[<a name="#p23" href="p23">page 23</a>] (<a href="#Contents">Contents</a>)
+[<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
arithmetic operand.17)
4 An implementation may give zero and non-numeric values (such as infinities and NaNs) a
18) Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through
the function fesetround in <a href="#7.6"><fenv.h></a>.
-[<a name="#p24" href="p24">page 24</a>] (<a href="#Contents">Contents</a>)
+[<a name="p24" href="#p24">page 24</a>] (<a href="#Contents">Contents</a>)
-1 indeterminable;
0 evaluate all operations and constants just to the range and precision of the
_Complex operands is represented in the double _Complex format, and its parts are evaluated to
double.
-[<a name="#p25" href="p25">page 25</a>] (<a href="#Contents">Contents</a>)
+[<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
??? p log10 b if b is a power of 10
???
implementation-defined (positive) values that are less than or equal to those shown:
-- the difference between 1 and the least value greater than 1 that is representable in the
given floating point type, b1- p
-[<a name="#p26" href="p26">page 26</a>] (<a href="#Contents">Contents</a>)
+[<a name="p26" href="#p26">page 26</a>] (<a href="#Contents">Contents</a>)
FLT_EPSILON 1E-5
DBL_EPSILON 1E-9
20) The floating-point model in that standard sums powers of b from zero, so the values of the exponent
limits are one less than shown here.
-[<a name="#p27" href="p27">page 27</a>] (<a href="#Contents">Contents</a>)
+[<a name="p27" href="#p27">page 27</a>] (<a href="#Contents">Contents</a>)
FLT_DIG 6
FLT_MIN_EXP -125
-[<a name="#p28" href="p28">page 28</a>] (<a href="#Contents">Contents</a>)
+[<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
<a name="6" href="#6"><b> 6. Language</b></a>
declares the identifier appears inside a block or within the list of parameter declarations in
a function definition, the identifier has block scope, which terminates at the end of the
associated block. If the declarator or type specifier that declares the identifier appears
-[<a name="#p29" href="p29">page 29</a>] (<a href="#Contents">Contents</a>)
+[<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
within the list of parameter declarations in a function prototype (not part of a function
definition), the identifier has function prototype scope, which terminates at the end of the
21) There is no linkage between different identifiers.
22) A function declaration can contain the storage-class specifier static only if it is at file scope; see
-<a name="6.7.1" href="#6.7.1"><b> 6.7.1.</b></a>
+ <a href="#6.7.1">6.7.1</a>.
-[<a name="#p30" href="p30">page 30</a>] (<a href="#Contents">Contents</a>)
+[<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
prior declaration of that identifier is visible,23) if the prior declaration specifies internal or
external linkage, the linkage of the identifier at the later declaration is the same as the
23) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
24) There is only one name space for tags even though three are possible.
-[<a name="#p31" href="p31">page 31</a>] (<a href="#Contents">Contents</a>)
+[<a name="p31" href="#p31">page 31</a>] (<a href="#Contents">Contents</a>)
<a name="6.2.4" href="#6.2.4"><b> 6.2.4 Storage durations of objects</b></a>
1 An object has a storage duration that determines its lifetime. There are three storage
27) Leaving the innermost block containing the declaration, or jumping to a point in that block or an
embedded block prior to the declaration, leaves the scope of the declaration.
-[<a name="#p32" href="p32">page 32</a>] (<a href="#Contents">Contents</a>)
+[<a name="p32" href="#p32">page 32</a>] (<a href="#Contents">Contents</a>)
<a name="6.2.5" href="#6.2.5"><b> 6.2.5 Types</b></a>
1 The meaning of a value stored in an object or returned by a function is determined by the
30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended
unsigned integer types.
-[<a name="#p33" href="p33">page 33</a>] (<a href="#Contents">Contents</a>)
+[<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
7 The standard signed integer types and standard unsigned integer types are collectively
called the standard integer types, the extended signed integer types and extended
Implementation-defined keywords shall have the form of an identifier reserved for any use as
described in <a href="#7.1.3">7.1.3</a>.
-[<a name="#p34" href="p34">page 34</a>] (<a href="#Contents">Contents</a>)
+[<a name="p34" href="#p34">page 34</a>] (<a href="#Contents">Contents</a>)
15 The three types char, signed char, and unsigned char are collectively called
the character types. The implementation shall define char to have the same range,
other two and is not compatible with either.
36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed.
-[<a name="#p35" href="p35">page 35</a>] (<a href="#Contents">Contents</a>)
+[<a name="p35" href="#p35">page 35</a>] (<a href="#Contents">Contents</a>)
-- A pointer type may be derived from a function type, an object type, or an incomplete
type, called the referenced type. A pointer type describes an object whose value
39) The same representation and alignment requirements are meant to imply interchangeability as
arguments to functions, return values from functions, and members of unions.
-[<a name="#p36" href="p36">page 36</a>] (<a href="#Contents">Contents</a>)
+[<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
pointers to structure types shall have the same representation and alignment requirements
as each other. All pointers to union types shall have the same representation and
CHAR_BIT
- 1.
-[<a name="#p37" href="p37">page 37</a>] (<a href="#Contents">Contents</a>)
+[<a name="p37" href="#p37">page 37</a>] (<a href="#Contents">Contents</a>)
a trap representation.
6 When a value is stored in an object of structure or union type, including in a member
with unsigned types. All other combinations of padding bits are alternative object representations of
the value specified by the value bits.
-[<a name="#p38" href="p38">page 38</a>] (<a href="#Contents">Contents</a>)
+[<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as
the same bit in the object representation of the corresponding unsigned type (if there are
combinations of padding bits are alternative object representations of the value specified by the value
bits.
-[<a name="#p39" href="p39">page 39</a>] (<a href="#Contents">Contents</a>)
+[<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
for signed integer types the width is one greater than the precision.
<a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
46) Two types need not be identical to be compatible.
47) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
-[<a name="#p40" href="p40">page 40</a>] (<a href="#Contents">Contents</a>)
+[<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
5 EXAMPLE Given the following two file scope declarations:
int f(int (*)(), double (*)[3]);
-[<a name="#p41" href="p41">page 41</a>] (<a href="#Contents">Contents</a>)
+[<a name="p41" href="#p41">page 41</a>] (<a href="#Contents">Contents</a>)
<a name="6.3" href="#6.3"><b> 6.3 Conversions</b></a>
1 Several operators convert operand values from one type to another automatically. This
2 The following may be used in an expression wherever an int or unsigned int may
be used:
-[<a name="#p42" href="p42">page 42</a>] (<a href="#Contents">Contents</a>)
+[<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
-- An object or expression with an integer type whose integer conversion rank is less
than or equal to the rank of int and unsigned int.
need not be performed when a value of real floating type is converted to unsigned type. Thus, the
range of portable real floating values is (-1, Utype_MAX+1).
-[<a name="#p43" href="p43">page 43</a>] (<a href="#Contents">Contents</a>)
+[<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
exactly, the result is either the nearest higher or nearest lower representable value, chosen
in an implementation-defined manner. If the value being converted is outside the range of
operand is converted, without change of type domain, to a type whose
corresponding real type is long double.
-[<a name="#p44" href="p44">page 44</a>] (<a href="#Contents">Contents</a>)
+[<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
Otherwise, if the corresponding real type of either operand is double, the other
operand is converted, without change of type domain, to a type whose
52) The cast and assignment operators are still required to perform their specified conversions as
described in <a href="#6.3.1.4">6.3.1.4</a> and <a href="#6.3.1.5">6.3.1.5</a>.
-[<a name="#p45" href="p45">page 45</a>] (<a href="#Contents">Contents</a>)
+[<a name="p45" href="#p45">page 45</a>] (<a href="#Contents">Contents</a>)
<a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
<a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
54) Because this conversion does not occur, the operand of the sizeof operator remains a function
designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
-[<a name="#p46" href="p46">page 46</a>] (<a href="#Contents">Contents</a>)
+[<a name="p46" href="#p46">page 46</a>] (<a href="#Contents">Contents</a>)
<a href="#6.3.2.2">6.3.2.2</a> void
1 The (nonexistent) value of a void expression (an expression that has type void) shall not
pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
correctly aligned for a pointer to type C.
-[<a name="#p47" href="p47">page 47</a>] (<a href="#Contents">Contents</a>)
+[<a name="p47" href="#p47">page 47</a>] (<a href="#Contents">Contents</a>)
converted to a pointer to a character type, the result points to the lowest addressed byte of
the object. Successive increments of the result, up to the size of the object, yield pointers
-[<a name="#p48" href="p48">page 48</a>] (<a href="#Contents">Contents</a>)
+[<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
<a name="6.4" href="#6.4"><b> 6.4 Lexical elements</b></a>
- Syntax
+<b> Syntax</b>
1 token:
keyword
identifier
string-literal
punctuator
each non-white-space character that cannot be one of the above
- Constraints
+<b> Constraints</b>
2 Each preprocessing token that is converted to a token shall have the lexical form of a
keyword, an identifier, a constant, a string literal, or a punctuator.
- Semantics
+<b> Semantics</b>
3 A token is the minimal lexical element of the language in translation phases 7 and 8. The
categories of tokens are: keywords, identifiers, constants, string literals, and punctuators.
A preprocessing token is the minimal lexical element of the language in translation
58) An additional category, placemarkers, is used internally in translation phase 4 (see <a href="#6.10.3.3">6.10.3.3</a>); it cannot
occur in source files.
-[<a name="#p49" href="p49">page 49</a>] (<a href="#Contents">Contents</a>)
+[<a name="p49" href="#p49">page 49</a>] (<a href="#Contents">Contents</a>)
4 If the input stream has been parsed into preprocessing tokens up to a given character, the
next preprocessing token is the longest sequence of characters that could constitute a
(<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
(<a href="#6.4.5">6.4.5</a>).
<a name="6.4.1" href="#6.4.1"><b> 6.4.1 Keywords</b></a>
- Syntax
+<b> Syntax</b>
1 keyword: one of
auto enum restrict unsigned
break extern return void
do int switch
double long typedef
else register union
- Semantics
+<b> Semantics</b>
2 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as
keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
specifying imaginary types.59)
59) One possible specification for imaginary types appears in <a href="#G">annex G</a>.
-[<a name="#p50" href="p50">page 50</a>] (<a href="#Contents">Contents</a>)
+[<a name="p50" href="#p50">page 50</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
<a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
- Syntax
+<b> Syntax</b>
1 identifier:
identifier-nondigit
identifier identifier-nondigit
N O P Q R S T U V W X Y Z
digit: one of
0 1 2 3 4 5 6 7 8 9
- Semantics
+<b> Semantics</b>
2 An identifier is a sequence of nondigit characters (including the underscore _, the
lowercase and uppercase Latin letters, and other characters) and digits, which designates
one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
character or sequence of characters may be used to encode the \u in a universal character name.
Extended characters may produce a long external identifier.
-[<a name="#p51" href="p51">page 51</a>] (<a href="#Contents">Contents</a>)
+[<a name="p51" href="#p51">page 51</a>] (<a href="#Contents">Contents</a>)
Implementation limits
5 As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
identifiers differ only in nonsignificant characters, the behavior is undefined.
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>).
<a name="6.4.2.2" href="#6.4.2.2"><b> 6.4.2.2 Predefined identifiers</b></a>
- Semantics
+<b> Semantics</b>
1 The identifier __func__ shall be implicitly declared by the translator as if,
immediately following the opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
61) Since the name __func__ is reserved for any use by the implementation (<a href="#7.1.3">7.1.3</a>), if any other
identifier is explicitly declared using the name __func__, the behavior is undefined.
-[<a name="#p52" href="p52">page 52</a>] (<a href="#Contents">Contents</a>)
+[<a name="p52" href="#p52">page 52</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.3" href="#6.4.3"><b> 6.4.3 Universal character names</b></a>
- Syntax
+<b> Syntax</b>
1 universal-character-name:
\u hex-quad
\U hex-quad hex-quad
hex-quad:
hexadecimal-digit hexadecimal-digit
hexadecimal-digit hexadecimal-digit
- Constraints
+<b> Constraints</b>
2 A universal character name shall not specify a character whose short identifier is less than
00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
DFFF inclusive.62)
- Description
+<b> Description</b>
3 Universal character names may be used in identifiers, character constants, and string
literals to designate characters that are not in the basic character set.
- Semantics
+<b> Semantics</b>
4 The universal character name \Unnnnnnnn designates the character whose eight-digit
short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.63) Similarly, the universal
character name \unnnn designates the character whose four-digit short identifier is nnnn
UTF-16).
63) Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
-[<a name="#p53" href="p53">page 53</a>] (<a href="#Contents">Contents</a>)
+[<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.4" href="#6.4.4"><b> 6.4.4 Constants</b></a>
- Syntax
+<b> Syntax</b>
1 constant:
integer-constant
floating-constant
enumeration-constant
character-constant
- Constraints
+<b> Constraints</b>
2 Each constant shall have a type and the value of a constant shall be in the range of
representable values for its type.
- Semantics
+<b> Semantics</b>
3 Each constant has a type, determined by its form and value, as detailed later.
<a name="6.4.4.1" href="#6.4.4.1"><b> 6.4.4.1 Integer constants</b></a>
- Syntax
+<b> Syntax</b>
1 integer-constant:
decimal-constant integer-suffixopt
octal-constant integer-suffixopt
-[<a name="#p54" href="p54">page 54</a>] (<a href="#Contents">Contents</a>)
+[<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
hexadecimal-digit: one of
0 1 2 3 4 5 6 7 8 9
l L
long-long-suffix: one of
ll LL
- Description
+<b> Description</b>
2 An integer constant begins with a digit, but has no period or exponent part. It may have a
prefix that specifies its base and a suffix that specifies its type.
3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal
digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed
by a sequence of the decimal digits and the letters a (or A) through f (or F) with values
10 through 15 respectively.
- Semantics
+<b> Semantics</b>
4 The value of a decimal constant is computed base 10; that of an octal constant, base 8;
that of a hexadecimal constant, base 16. The lexically first digit is the most significant.
5 The type of an integer constant is the first of the corresponding list in which its value can
-[<a name="#p55" href="p55">page 55</a>] (<a href="#Contents">Contents</a>)
+[<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
Octal or Hexadecimal
Suffix Decimal Constant Constant
-[<a name="#p56" href="p56">page 56</a>] (<a href="#Contents">Contents</a>)
+[<a name="p56" href="#p56">page 56</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.4.2" href="#6.4.4.2"><b> 6.4.4.2 Floating constants</b></a>
- Syntax
+<b> Syntax</b>
1 floating-constant:
decimal-floating-constant
hexadecimal-floating-constant
floating-suffix: one of
f l F L
-[<a name="#p57" href="p57">page 57</a>] (<a href="#Contents">Contents</a>)
+[<a name="p57" href="#p57">page 57</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 A floating constant has a significand part that may be followed by an exponent part and a
suffix that specifies its type. The components of the significand part may include a digit
sequence representing the whole-number part, followed by a period (.), followed by a
e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence.
Either the whole-number part or the fraction part has to be present; for decimal floating
constants, either the period or the exponent part has to be present.
- Semantics
+<b> Semantics</b>
3 The significand part is interpreted as a (decimal or hexadecimal) rational number; the
digit sequence in the exponent part is interpreted as a decimal integer. For decimal
floating constants, the exponent indicates the power of 10 by which the significand part is
64) The specification for the library functions recommends more accurate conversion than required for
floating constants (see <a href="#7.20.1.3">7.20.1.3</a>).
-[<a name="#p58" href="p58">page 58</a>] (<a href="#Contents">Contents</a>)
+[<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.4.3" href="#6.4.4.3"><b> 6.4.4.3 Enumeration constants</b></a>
- Syntax
+<b> Syntax</b>
1 enumeration-constant:
identifier
- Semantics
+<b> Semantics</b>
2 An identifier declared as an enumeration constant has type int.
Forward references: enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>).
<a name="6.4.4.4" href="#6.4.4.4"><b> 6.4.4.4 Character constants</b></a>
- Syntax
+<b> Syntax</b>
1 character-constant:
' c-char-sequence '
L' c-char-sequence '
-[<a name="#p59" href="p59">page 59</a>] (<a href="#Contents">Contents</a>)
+[<a name="p59" href="#p59">page 59</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 An integer character constant is a sequence of one or more multibyte characters enclosed
in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the
letter L. With a few exceptions detailed later, the elements of the sequence are any
65) The semantics of these characters were discussed in <a href="#5.2.2">5.2.2</a>. If any other character follows a backslash,
the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
-[<a name="#p60" href="p60">page 60</a>] (<a href="#Contents">Contents</a>)
+[<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
- Constraints
+<b> Constraints</b>
9 The value of an octal or hexadecimal escape sequence shall be in the range of
representable values for the type unsigned char for an integer character constant, or
the unsigned type corresponding to wchar_t for a wide character constant.
- Semantics
+<b> Semantics</b>
10 An integer character constant has type int. The value of an integer character constant
containing a single character that maps to a single-byte execution character is the
numerical value of the representation of the mapped character interpreted as an integer.
-[<a name="#p61" href="p61">page 61</a>] (<a href="#Contents">Contents</a>)
+[<a name="p61" href="#p61">page 61</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.5" href="#6.4.5"><b> 6.4.5 String literals</b></a>
- Syntax
+<b> Syntax</b>
1 string-literal:
" s-char-sequenceopt "
L" s-char-sequenceopt "
any member of the source character set except
the double-quote ", backslash \, or new-line character
escape-sequence
- Description
+<b> Description</b>
2 A character string literal is a sequence of zero or more multibyte characters enclosed in
double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the
letter L.
character constant, except that the single-quote ' is representable either by itself or by the
escape sequence \', but the double-quote " shall be represented by the escape sequence
\".
- Semantics
+<b> Semantics</b>
4 In translation phase 6, the multibyte character sequences specified by any sequence of
adjacent character and wide string literal tokens are concatenated into a single multibyte
character sequence. If any of the tokens are wide string literal tokens, the resulting
66) A character string literal need not be a string (see <a href="#7.1.1">7.1.1</a>), because a null character may be embedded in
it by a \0 escape sequence.
-[<a name="#p62" href="p62">page 62</a>] (<a href="#Contents">Contents</a>)
+[<a name="p62" href="#p62">page 62</a>] (<a href="#Contents">Contents</a>)
sequence, as defined by the mbstowcs function with an implementation-defined current
locale. The value of a string literal containing a multibyte character or escape sequence
Forward references: common definitions <a href="#7.17"><stddef.h></a> (<a href="#7.17">7.17</a>), the mbstowcs
function (<a href="#7.20.8.1">7.20.8.1</a>).
<a name="6.4.6" href="#6.4.6"><b> 6.4.6 Punctuators</b></a>
- Syntax
+<b> Syntax</b>
1 punctuator: one of
[ ] ( ) { } . ->
++ -- & * + - ~ !
= *= /= %= += -= <<= >>= &= ^= |=
, # ##
<: :> <% %> %: %:%:
- Semantics
+<b> Semantics</b>
2 A punctuator is a symbol that has independent syntactic and semantic significance.
Depending on context, it may specify an operation to be performed (which in turn may
yield a value or a function designator, produce a side effect, or some combination thereof)
-[<a name="#p63" href="p63">page 63</a>] (<a href="#Contents">Contents</a>)
+[<a name="p63" href="#p63">page 63</a>] (<a href="#Contents">Contents</a>)
3 In all aspects of the language, the six tokens67)
<: :> <% %> %: %:%:
Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
(<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
<a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
- Syntax
+<b> Syntax</b>
1 header-name:
< h-char-sequence >
" q-char-sequence "
q-char:
any member of the source character set except
the new-line character and "
- Semantics
+<b> Semantics</b>
2 The sequences in both forms of header names are mapped in an implementation-defined
manner to headers or external source file names as specified in <a href="#6.10.2">6.10.2</a>.
3 If the characters ', \, ", //, or /* occur in the sequence between the < and > delimiters,
68) Thus [ and <: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
interchanged.
-[<a name="#p64" href="p64">page 64</a>] (<a href="#Contents">Contents</a>)
+[<a name="p64" href="#p64">page 64</a>] (<a href="#Contents">Contents</a>)
sequence between the " delimiters, the behavior is undefined.69) Header name
preprocessing tokens are recognized only within #include preprocessing directives and
Forward references: source file inclusion (<a href="#6.10.2">6.10.2</a>).
<a name="6.4.8" href="#6.4.8"><b> 6.4.8 Preprocessing numbers</b></a>
- Syntax
+<b> Syntax</b>
1 pp-number:
digit
. digit
pp-number p sign
pp-number P sign
pp-number .
- Description
+<b> Description</b>
2 A preprocessing number begins with a digit optionally preceded by a period (.) and may
be followed by valid identifier characters and the character sequences e+, e-, E+, E-,
p+, p-, P+, or P-.
3 Preprocessing number tokens lexically include all floating and integer constant tokens.
- Semantics
+<b> Semantics</b>
4 A preprocessing number does not have type or a value; it acquires both after a successful
conversion (as part of translation phase 7) to a floating constant token or an integer
constant token.
69) Thus, sequences of characters that resemble escape sequences cause undefined behavior.
70) For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
-[<a name="#p65" href="p65">page 65</a>] (<a href="#Contents">Contents</a>)
+[<a name="p65" href="#p65">page 65</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
1 Except within a character constant, a string literal, or a comment, the characters /*
71) Thus, /* ... */ comments do not nest.
-[<a name="#p66" href="p66">page 66</a>] (<a href="#Contents">Contents</a>)
+[<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
<a name="6.5" href="#6.5"><b> 6.5 Expressions</b></a>
1 An expression is a sequence of operators and operands that specifies computation of a
indicated in each subclause by the syntax for the expressions discussed therein.
75) Allocated objects have no declared type.
-[<a name="#p67" href="p67">page 67</a>] (<a href="#Contents">Contents</a>)
+[<a name="p67" href="#p67">page 67</a>] (<a href="#Contents">Contents</a>)
effective type of the object for that access and for subsequent accesses that do not modify
the stored value. If a value is copied into an object having no declared type using
decrease accuracy for containing expressions, their use needs to be well-defined and clearly
documented.
-[<a name="#p68" href="p68">page 68</a>] (<a href="#Contents">Contents</a>)
+[<a name="p68" href="#p68">page 68</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.1" href="#6.5.1"><b> 6.5.1 Primary expressions</b></a>
- Syntax
+<b> Syntax</b>
1 primary-expression:
identifier
constant
string-literal
( expression )
- Semantics
+<b> Semantics</b>
2 An identifier is a primary expression, provided it has been declared as designating an
object (in which case it is an lvalue) or a function (in which case it is a function
designator).79)
3 A constant is a primary expression. Its type depends on its form and value, as detailed in
-<a name="6.4.4" href="#6.4.4"><b> 6.4.4.</b></a>
+ <a href="#6.4.4">6.4.4</a>.
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>.
5 A parenthesized expression is a primary expression. Its type and value are identical to
those of the unparenthesized expression. It is an lvalue, a function designator, or a void
designator, or a void expression.
Forward references: declarations (<a href="#6.7">6.7</a>).
<a name="6.5.2" href="#6.5.2"><b> 6.5.2 Postfix operators</b></a>
- Syntax
+<b> Syntax</b>
1 postfix-expression:
primary-expression
postfix-expression [ expression ]
79) Thus, an undeclared identifier is a violation of the syntax.
-[<a name="#p69" href="p69">page 69</a>] (<a href="#Contents">Contents</a>)
+[<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
argument-expression-list:
assignment-expression
argument-expression-list , assignment-expression
<a name="6.5.2.1" href="#6.5.2.1"><b> 6.5.2.1 Array subscripting</b></a>
- Constraints
+<b> Constraints</b>
1 One of the expressions shall have type ''pointer to object type'', the other expression shall
have integer type, and the result has type ''type''.
- Semantics
+<b> Semantics</b>
2 A postfix expression followed by an expression in square brackets [] is a subscripted
designation of an element of an array object. The definition of the subscript operator []
is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that
-[<a name="#p70" href="p70">page 70</a>] (<a href="#Contents">Contents</a>)
+[<a name="p70" href="#p70">page 70</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
- Constraints
+<b> Constraints</b>
1 The expression that denotes the called function80) shall have type pointer to function
returning void or returning an object type other than an array type.
2 If the expression that denotes the called function has a type that includes a prototype, the
number of arguments shall agree with the number of parameters. Each argument shall
have a type such that its value may be assigned to an object with the unqualified version
of the type of its corresponding parameter.
- Semantics
+<b> Semantics</b>
3 A postfix expression followed by parentheses () containing a possibly empty, comma-
separated list of expressions is a function call. The postfix expression denotes the called
function. The list of expressions specifies the arguments to the function.
change the value of the object pointed to. A parameter declared to have array or function type is
adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
-[<a name="#p71" href="p71">page 71</a>] (<a href="#Contents">Contents</a>)
+[<a name="p71" href="#p71">page 71</a>] (<a href="#Contents">Contents</a>)
-- one promoted type is a signed integer type, the other promoted type is the
corresponding unsigned integer type, and the value is representable in both types;
Forward references: function declarators (including prototypes) (<a href="#6.7.5.3">6.7.5.3</a>), function
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>).
<a name="6.5.2.3" href="#6.5.2.3"><b> 6.5.2.3 Structure and union members</b></a>
- Constraints
+<b> Constraints</b>
1 The first operand of the . operator shall have a qualified or unqualified structure or union
type, and the second operand shall name a member of that type.
2 The first operand of the -> operator shall have type ''pointer to qualified or unqualified
-[<a name="#p72" href="p72">page 72</a>] (<a href="#Contents">Contents</a>)
+[<a name="p72" href="#p72">page 72</a>] (<a href="#Contents">Contents</a>)
- Semantics
+<b> Semantics</b>
3 A postfix expression followed by the . operator and an identifier designates a member of
a structure or union object. The value is that of the named member,82) and is an lvalue if
the first expression is an lvalue. If the first expression has qualified type, the result has
83) If &E is a valid pointer expression (where & is the ''address-of '' operator, which generates a pointer to
its operand), the expression (&E)->MOS is the same as E.MOS.
-[<a name="#p73" href="p73">page 73</a>] (<a href="#Contents">Contents</a>)
+[<a name="p73" href="#p73">page 73</a>] (<a href="#Contents">Contents</a>)
8 EXAMPLE 3 The following is a valid fragment:
union {
-[<a name="#p74" href="p74">page 74</a>] (<a href="#Contents">Contents</a>)
+[<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.2.4" href="#6.5.2.4"><b> 6.5.2.4 Postfix increment and decrement operators</b></a>
- Constraints
+<b> Constraints</b>
1 The operand of the postfix increment or decrement operator shall have qualified or
unqualified real or pointer type and shall be a modifiable lvalue.
- Semantics
+<b> Semantics</b>
2 The result of the postfix ++ operator is the value of the operand. After the result is
obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate
type is added to it.) See the discussions of additive operators and compound assignment
it).
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>).
<a name="6.5.2.5" href="#6.5.2.5"><b> 6.5.2.5 Compound literals</b></a>
- Constraints
+<b> Constraints</b>
1 The type name shall specify an object type or an array of unknown size, but not a variable
length array type.
2 No initializer shall attempt to provide a value for an object not contained within the entire
unnamed object specified by the compound literal.
3 If the compound literal occurs outside the body of a function, the initializer list shall
consist of constant expressions.
- Semantics
+<b> Semantics</b>
4 A postfix expression that consists of a parenthesized type name followed by a brace-
enclosed list of initializers is a compound literal. It provides an unnamed object whose
value is given by the initializer list.84)
84) Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types
or void only, and the result of a cast expression is not an lvalue.
-[<a name="#p75" href="p75">page 75</a>] (<a href="#Contents">Contents</a>)
+[<a name="p75" href="#p75">page 75</a>] (<a href="#Contents">Contents</a>)
6 The value of the compound literal is that of an unnamed object initialized by the
initializer list. If the compound literal occurs outside the body of a function, the object
86) This allows implementations to share storage for string literals and constant compound literals with
the same or overlapping representations.
-[<a name="#p76" href="p76">page 76</a>] (<a href="#Contents">Contents</a>)
+[<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
13 EXAMPLE 5 The following three expressions have different meanings:
"/tmp/fileXXXXXX"
-[<a name="#p77" href="p77">page 77</a>] (<a href="#Contents">Contents</a>)
+[<a name="p77" href="#p77">page 77</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.3" href="#6.5.3"><b> 6.5.3 Unary operators</b></a>
- Syntax
+<b> Syntax</b>
1 unary-expression:
postfix-expression
++ unary-expression
unary-operator: one of
& * + - ~ !
<a name="6.5.3.1" href="#6.5.3.1"><b> 6.5.3.1 Prefix increment and decrement operators</b></a>
- Constraints
+<b> Constraints</b>
1 The operand of the prefix increment or decrement operator shall have qualified or
unqualified real or pointer type and shall be a modifiable lvalue.
- Semantics
+<b> Semantics</b>
2 The value of the operand of the prefix ++ operator is incremented. The result is the new
value of the operand after incrementation. The expression ++E is equivalent to (E+=1).
See the discussions of additive operators and compound assignment for information on
operand is decremented.
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>).
<a name="6.5.3.2" href="#6.5.3.2"><b> 6.5.3.2 Address and indirection operators</b></a>
- Constraints
+<b> Constraints</b>
1 The operand of the unary & operator shall be either a function designator, the result of a
[] or unary * operator, or an lvalue that designates an object that is not a bit-field and is
not declared with the register storage-class specifier.
2 The operand of the unary * operator shall have pointer type.
- Semantics
+<b> Semantics</b>
3 The unary & operator yields the address of its operand. If the operand has type ''type'',
the result has type ''pointer to type''. If the operand is the result of a unary * operator,
neither that operator nor the & operator is evaluated and the result is as if both were
omitted, except that the constraints on the operators still apply and the result is not an
lvalue. Similarly, if the operand is the result of a [] operator, neither the & operator nor
-[<a name="#p78" href="p78">page 78</a>] (<a href="#Contents">Contents</a>)
+[<a name="p78" href="#p78">page 78</a>] (<a href="#Contents">Contents</a>)
the unary * that is implied by the [] is evaluated and the result is as if the & operator
were removed and the [] operator were changed to a + operator. Otherwise, the result is
Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
(<a href="#6.7.2.1">6.7.2.1</a>).
<a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
- Constraints
+<b> Constraints</b>
1 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator,
integer type; of the ! operator, scalar type.
- Semantics
+<b> Semantics</b>
2 The result of the unary + operator is the value of its (promoted) operand. The integer
promotions are performed on the operand, and the result has the promoted type.
3 The result of the unary - operator is the negative of its (promoted) operand. The integer
address inappropriately aligned for the type of object pointed to, and the address of an object after the
end of its lifetime.
-[<a name="#p79" href="p79">page 79</a>] (<a href="#Contents">Contents</a>)
+[<a name="p79" href="#p79">page 79</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.3.4" href="#6.5.3.4"><b> 6.5.3.4 The sizeof operator</b></a>
- Constraints
+<b> Constraints</b>
1 The sizeof operator shall not be applied to an expression that has function type or an
incomplete type, to the parenthesized name of such a type, or to an expression that
designates a bit-field member.
- Semantics
+<b> Semantics</b>
2 The sizeof operator yields the size (in bytes) of its operand, which may be an
expression or the parenthesized name of a type. The size is determined from the type of
the operand. The result is an integer. If the type of the operand is a variable length array
88) When applied to a parameter declared to have array or function type, the sizeof operator yields the
size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
-[<a name="#p80" href="p80">page 80</a>] (<a href="#Contents">Contents</a>)
+[<a name="p80" href="#p80">page 80</a>] (<a href="#Contents">Contents</a>)
int main()
{
Forward references: common definitions <a href="#7.17"><stddef.h></a> (<a href="#7.17">7.17</a>), declarations (<a href="#6.7">6.7</a>),
structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), type names (<a href="#6.7.6">6.7.6</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>).
<a name="6.5.4" href="#6.5.4"><b> 6.5.4 Cast operators</b></a>
- Syntax
+<b> Syntax</b>
1 cast-expression:
unary-expression
( type-name ) cast-expression
- Constraints
+<b> Constraints</b>
2 Unless the type name specifies a void type, the type name shall specify qualified or
unqualified scalar type and the operand shall have scalar type.
3 Conversions that involve pointers, other than where permitted by the constraints of
<a href="#6.5.16.1">6.5.16.1</a>, shall be specified by means of an explicit cast.
- Semantics
+<b> Semantics</b>
4 Preceding an expression by a parenthesized type name converts the value of the
expression to the named type. This construction is called a cast.89) A cast that specifies
no conversion has no effect on the type or value of an expression.
89) A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
unqualified version of the type.
-[<a name="#p81" href="p81">page 81</a>] (<a href="#Contents">Contents</a>)
+[<a name="p81" href="#p81">page 81</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.5" href="#6.5.5"><b> 6.5.5 Multiplicative operators</b></a>
- Syntax
+<b> Syntax</b>
1 multiplicative-expression:
cast-expression
multiplicative-expression * cast-expression
multiplicative-expression / cast-expression
multiplicative-expression % cast-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have arithmetic type. The operands of the % operator shall
have integer type.
- Semantics
+<b> Semantics</b>
3 The usual arithmetic conversions are performed on the operands.
4 The result of the binary * operator is the product of the operands.
5 The result of the / operator is the quotient from the division of the first operand by the
fractional part discarded.90) If the quotient a/b is representable, the expression
(a/b)*b + a%b shall equal a.
<a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
- Syntax
+<b> Syntax</b>
1 additive-expression:
multiplicative-expression
additive-expression + multiplicative-expression
additive-expression - multiplicative-expression
- Constraints
+<b> Constraints</b>
2 For addition, either both operands shall have arithmetic type, or one operand shall be a
pointer to an object type and the other shall have integer type. (Incrementing is
equivalent to adding 1.)
90) This is often called ''truncation toward zero''.
-[<a name="#p82" href="p82">page 82</a>] (<a href="#Contents">Contents</a>)
+[<a name="p82" href="#p82">page 82</a>] (<a href="#Contents">Contents</a>)
-- both operands are pointers to qualified or unqualified versions of compatible object
types; or
-- the left operand is a pointer to an object type and the right operand has integer type.
(Decrementing is equivalent to subtracting 1.)
- Semantics
+<b> Semantics</b>
4 If both operands have arithmetic type, the usual arithmetic conversions are performed on
them.
5 The result of the binary + operator is the sum of the operands.
object of type ptrdiff_t. Moreover, if the expression P points either to an element of
an array object or one past the last element of an array object, and the expression Q points
to the last element of the same array object, the expression ((Q)+1)-(P) has the same
-[<a name="#p83" href="p83">page 83</a>] (<a href="#Contents">Contents</a>)
+[<a name="p83" href="#p83">page 83</a>] (<a href="#Contents">Contents</a>)
value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
expression P points one past the last element of the array object, even though the
Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), common definitions <a href="#7.17"><stddef.h></a>
(<a href="#7.17">7.17</a>).
<a name="6.5.7" href="#6.5.7"><b> 6.5.7 Bitwise shift operators</b></a>
- Syntax
+<b> Syntax</b>
1 shift-expression:
additive-expression
shift-expression << additive-expression
shift-expression >> additive-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have integer type.
- Semantics
+<b> Semantics</b>
3 The integer promotions are performed on each of the operands. The type of the result is
that of the promoted left operand. If the value of the right operand is negative or is
greater than or equal to the width of the promoted left operand, the behavior is undefined.
another object in the program) just after the end of the object in order to satisfy the ''one past the last
element'' requirements.
-[<a name="#p84" href="p84">page 84</a>] (<a href="#Contents">Contents</a>)
+[<a name="p84" href="#p84">page 84</a>] (<a href="#Contents">Contents</a>)
4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
resulting value is implementation-defined.
<a name="6.5.8" href="#6.5.8"><b> 6.5.8 Relational operators</b></a>
- Syntax
+<b> Syntax</b>
1 relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
- Constraints
+<b> Constraints</b>
2 One of the following shall hold:
-- both operands have real type;
-- both operands are pointers to qualified or unqualified versions of compatible object
types; or
-- both operands are pointers to qualified or unqualified versions of compatible
incomplete types.
- Semantics
+<b> Semantics</b>
3 If both of the operands have arithmetic type, the usual arithmetic conversions are
performed.
4 For the purposes of these operators, a pointer to an object that is not an element of an
pointers to structure members declared later compare greater than pointers to members
declared earlier in the structure, and pointers to array elements with larger subscript
-[<a name="#p85" href="p85">page 85</a>] (<a href="#Contents">Contents</a>)
+[<a name="p85" href="#p85">page 85</a>] (<a href="#Contents">Contents</a>)
values compare greater than pointers to elements of the same array with lower subscript
values. All pointers to members of the same union object compare equal. If the
(greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.92)
The result has type int.
<a name="6.5.9" href="#6.5.9"><b> 6.5.9 Equality operators</b></a>
- Syntax
+<b> Syntax</b>
1 equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
- Constraints
+<b> Constraints</b>
2 One of the following shall hold:
-- both operands have arithmetic type;
-- both operands are pointers to qualified or unqualified versions of compatible types;
-- one operand is a pointer to an object or incomplete type and the other is a pointer to a
qualified or unqualified version of void; or
-- one operand is a pointer and the other is a null pointer constant.
- Semantics
+<b> Semantics</b>
3 The == (equal to) and != (not equal to) operators are analogous to the relational
operators except for their lower precedence.93) Each of the operators yields 1 if the
specified relation is true and 0 if it is false. The result has type int. For any pair of
means (a<b)<c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
93) Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value.
-[<a name="#p86" href="p86">page 86</a>] (<a href="#Contents">Contents</a>)
+[<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
5 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a
null pointer constant, the null pointer constant is converted to the type of the pointer. If
array behaves the same as a pointer to the first element of an array of length one with the
type of the object as its element type.
<a name="6.5.10" href="#6.5.10"><b> 6.5.10 Bitwise AND operator</b></a>
- Syntax
+<b> Syntax</b>
1 AND-expression:
equality-expression
AND-expression & equality-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have integer type.
- Semantics
+<b> Semantics</b>
3 The usual arithmetic conversions are performed on the operands.
4 The result of the binary & operator is the bitwise AND of the operands (that is, each bit in
the result is set if and only if each of the corresponding bits in the converted operands is
outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
behavior.
-[<a name="#p87" href="p87">page 87</a>] (<a href="#Contents">Contents</a>)
+[<a name="p87" href="#p87">page 87</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.11" href="#6.5.11"><b> 6.5.11 Bitwise exclusive OR operator</b></a>
- Syntax
+<b> Syntax</b>
1 exclusive-OR-expression:
AND-expression
exclusive-OR-expression ^ AND-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have integer type.
- Semantics
+<b> Semantics</b>
3 The usual arithmetic conversions are performed on the operands.
4 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit
in the result is set if and only if exactly one of the corresponding bits in the converted
operands is set).
<a name="6.5.12" href="#6.5.12"><b> 6.5.12 Bitwise inclusive OR operator</b></a>
- Syntax
+<b> Syntax</b>
1 inclusive-OR-expression:
exclusive-OR-expression
inclusive-OR-expression | exclusive-OR-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have integer type.
- Semantics
+<b> Semantics</b>
3 The usual arithmetic conversions are performed on the operands.
4 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in
the result is set if and only if at least one of the corresponding bits in the converted
-[<a name="#p88" href="p88">page 88</a>] (<a href="#Contents">Contents</a>)
+[<a name="p88" href="#p88">page 88</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.13" href="#6.5.13"><b> 6.5.13 Logical AND operator</b></a>
- Syntax
+<b> Syntax</b>
1 logical-AND-expression:
inclusive-OR-expression
logical-AND-expression && inclusive-OR-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have scalar type.
- Semantics
+<b> Semantics</b>
3 The && operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it
yields 0. The result has type int.
4 Unlike the bitwise binary & operator, the && operator guarantees left-to-right evaluation;
there is a sequence point after the evaluation of the first operand. If the first operand
compares equal to 0, the second operand is not evaluated.
<a name="6.5.14" href="#6.5.14"><b> 6.5.14 Logical OR operator</b></a>
- Syntax
+<b> Syntax</b>
1 logical-OR-expression:
logical-AND-expression
logical-OR-expression || logical-AND-expression
- Constraints
+<b> Constraints</b>
2 Each of the operands shall have scalar type.
- Semantics
+<b> Semantics</b>
3 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it
yields 0. The result has type int.
4 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is
-[<a name="#p89" href="p89">page 89</a>] (<a href="#Contents">Contents</a>)
+[<a name="p89" href="#p89">page 89</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.15" href="#6.5.15"><b> 6.5.15 Conditional operator</b></a>
- Syntax
+<b> Syntax</b>
1 conditional-expression:
logical-OR-expression
logical-OR-expression ? expression : conditional-expression
- Constraints
+<b> Constraints</b>
2 The first operand shall have scalar type.
3 One of the following shall hold for the second and third operands:
-- both operands have arithmetic type;
-- one operand is a pointer and the other is a null pointer constant; or
-- one operand is a pointer to an object or incomplete type and the other is a pointer to a
qualified or unqualified version of void.
- Semantics
+<b> Semantics</b>
4 The first operand is evaluated; there is a sequence point after its evaluation. The second
operand is evaluated only if the first compares unequal to 0; the third operand is evaluated
only if the first compares equal to 0; the result is the value of the second or third operand
95) A conditional expression does not yield an lvalue.
-[<a name="#p90" href="p90">page 90</a>] (<a href="#Contents">Contents</a>)
+[<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
pointer to an appropriately qualified version of void.
7 EXAMPLE The common type that results when the second and third operands are pointers is determined
vp ip void *
<a name="6.5.16" href="#6.5.16"><b> 6.5.16 Assignment operators</b></a>
- Syntax
+<b> Syntax</b>
1 assignment-expression:
conditional-expression
unary-expression assignment-operator assignment-expression
assignment-operator: one of
= *= /= %= += -= <<= >>= &= ^= |=
- Constraints
+<b> Constraints</b>
2 An assignment operator shall have a modifiable lvalue as its left operand.
- Semantics
+<b> Semantics</b>
3 An assignment operator stores a value in the object designated by the left operand. An
assignment expression has the value of the left operand after the assignment, but is not an
lvalue. The type of an assignment expression is the type of the left operand unless the
behavior is undefined.
-[<a name="#p91" href="p91">page 91</a>] (<a href="#Contents">Contents</a>)
+[<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
- Constraints
+<b> Constraints</b>
1 One of the following shall hold:96)
-- the left operand has qualified or unqualified arithmetic type and the right has
arithmetic type;
the qualifiers of the type pointed to by the right;
-- the left operand is a pointer and the right is a null pointer constant; or
-- the left operand has type _Bool and the right is a pointer.
- Semantics
+<b> Semantics</b>
2 In simple assignment (=), the value of the right operand is converted to the type of the
assignment expression and replaces the value stored in the object designated by the left
operand.
qualifiers that were applied to the type category of the expression (for example, it removes const but
not volatile from the type int volatile * const).
-[<a name="#p92" href="p92">page 92</a>] (<a href="#Contents">Contents</a>)
+[<a name="p92" href="#p92">page 92</a>] (<a href="#Contents">Contents</a>)
negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the
variable c should be declared as int.
value of the const object c.
<a name="6.5.16.2" href="#6.5.16.2"><b> 6.5.16.2 Compound assignment</b></a>
- Constraints
+<b> Constraints</b>
1 For the operators += and -= only, either the left operand shall be a pointer to an object
type and the right shall have integer type, or the left operand shall have qualified or
unqualified arithmetic type and the right shall have arithmetic type.
2 For the other operators, each operand shall have arithmetic type consistent with those
allowed by the corresponding binary operator.
- Semantics
+<b> Semantics</b>
3 A compound assignment of the form E1 op = E2 differs from the simple assignment
expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once.
-[<a name="#p93" href="p93">page 93</a>] (<a href="#Contents">Contents</a>)
+[<a name="p93" href="#p93">page 93</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.17" href="#6.5.17"><b> 6.5.17 Comma operator</b></a>
- Syntax
+<b> Syntax</b>
1 expression:
assignment-expression
expression , assignment-expression
- Semantics
+<b> Semantics</b>
2 The left operand of a comma operator is evaluated as a void expression; there is a
sequence point after its evaluation. Then the right operand is evaluated; the result has its
type and value.97) If an attempt is made to modify the result of a comma operator or to
97) A comma operator does not yield an lvalue.
-[<a name="#p94" href="p94">page 94</a>] (<a href="#Contents">Contents</a>)
+[<a name="p94" href="#p94">page 94</a>] (<a href="#Contents">Contents</a>)
<a name="6.6" href="#6.6"><b> 6.6 Constant expressions</b></a>
- Syntax
+<b> Syntax</b>
1 constant-expression:
conditional-expression
- Description
+<b> Description</b>
2 A constant expression can be evaluated during translation rather than runtime, and
accordingly may be used in any place that a constant may be.
- Constraints
+<b> Constraints</b>
3 Constant expressions shall not contain assignment, increment, decrement, function-call,
or comma operators, except when they are contained within a subexpression that is not
evaluated.98)
4 Each constant expression shall evaluate to a constant that is in the range of representable
values for its type.
- Semantics
+<b> Semantics</b>
5 An expression that evaluates to a constant is required in several contexts. If a floating
expression is evaluated in the translation environment, the arithmetic precision and range
shall be at least as great as if the expression were being evaluated in the execution
constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing
directives are discussed in <a href="#6.10.1">6.10.1</a>.
-[<a name="#p95" href="p95">page 95</a>] (<a href="#Contents">Contents</a>)
+[<a name="p95" href="#p95">page 95</a>] (<a href="#Contents">Contents</a>)
-- an address constant, or
-- an address constant for an object type plus or minus an integer constant expression.
static int i = 2 || 1 / 0;
the expression is a valid integer constant expression with value one.
-[<a name="#p96" href="p96">page 96</a>] (<a href="#Contents">Contents</a>)
+[<a name="p96" href="#p96">page 96</a>] (<a href="#Contents">Contents</a>)
<a name="6.7" href="#6.7"><b> 6.7 Declarations</b></a>
- Syntax
+<b> Syntax</b>
1 declaration:
declaration-specifiers init-declarator-listopt ;
declaration-specifiers:
init-declarator:
declarator
declarator = initializer
- Constraints
+<b> Constraints</b>
2 A declaration shall declare at least a declarator (other than the parameters of a function or
the members of a structure or union), a tag, or the members of an enumeration.
3 If an identifier has no linkage, there shall be no more than one declaration of the identifier
for tags as specified in <a href="#6.7.2.3">6.7.2.3</a>.
4 All declarations in the same scope that refer to the same object or function shall specify
compatible types.
- Semantics
+<b> Semantics</b>
5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
of an identifier is a declaration for that identifier that:
-- for an object, causes storage to be reserved for that object;
101) Function definitions have a different syntax, described in <a href="#6.9.1">6.9.1</a>.
-[<a name="#p97" href="p97">page 97</a>] (<a href="#Contents">Contents</a>)
+[<a name="p97" href="#p97">page 97</a>] (<a href="#Contents">Contents</a>)
additional type information, or an initializer, or both. The declarators contain the
identifiers (if any) being declared.
Forward references: declarators (<a href="#6.7.5">6.7.5</a>), enumeration specifiers (<a href="#6.7.2.2">6.7.2.2</a>), initialization
(<a href="#6.7.8">6.7.8</a>).
<a name="6.7.1" href="#6.7.1"><b> 6.7.1 Storage-class specifiers</b></a>
- Syntax
+<b> Syntax</b>
1 storage-class-specifier:
typedef
extern
static
auto
register
- Constraints
+<b> Constraints</b>
2 At most, one storage-class specifier may be given in the declaration specifiers in a
declaration.102)
- Semantics
+<b> Semantics</b>
3 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience
only; it is discussed in <a href="#6.7.7">6.7.7</a>. The meanings of the various linkages and storage durations
were discussed in <a href="#6.2.2">6.2.2</a> and <a href="#6.2.4">6.2.4</a>.
<a href="#6.3.2.1">6.3.2.1</a>). Thus, the only operator that can be applied to an array declared with storage-class specifier
register is sizeof.
-[<a name="#p98" href="p98">page 98</a>] (<a href="#Contents">Contents</a>)
+[<a name="p98" href="#p98">page 98</a>] (<a href="#Contents">Contents</a>)
6 If an aggregate or union object is declared with a storage-class specifier other than
typedef, the properties resulting from the storage-class specifier, except with respect to
or union member objects.
Forward references: type definitions (<a href="#6.7.7">6.7.7</a>).
<a name="6.7.2" href="#6.7.2"><b> 6.7.2 Type specifiers</b></a>
- Syntax
+<b> Syntax</b>
1 type-specifier:
void
char
struct-or-union-specifier *
enum-specifier
typedef-name
- Constraints
+<b> Constraints</b>
2 At least one type specifier shall be given in the declaration specifiers in each declaration,
and in the specifier-qualifier list in each struct declaration and type name. Each list of
type specifiers shall be one of the following sets (delimited by commas, when there is
-- int, signed, or signed int
-[<a name="#p99" href="p99">page 99</a>] (<a href="#Contents">Contents</a>)
+[<a name="p99" href="#p99">page 99</a>] (<a href="#Contents">Contents</a>)
-- unsigned, or unsigned int
-- long, signed long, long int, or signed long int
-- typedef name
3 The type specifier _Complex shall not be used if the implementation does not provide
complex types.104)
- Semantics
+<b> Semantics</b>
4 Specifiers for structures, unions, and enumerations are discussed in <a href="#6.7.2.1">6.7.2.1</a> through
<a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3. Declarations of typedef names are discussed in 6.7.7. The characteristics of the</b></a>
other types are discussed in <a href="#6.2.5">6.2.5</a>.
104) Freestanding implementations are not required to provide complex types. *
-[<a name="#p100" href="p100">page 100</a>] (<a href="#Contents">Contents</a>)
+[<a name="p100" href="#p100">page 100</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.2.1" href="#6.7.2.1"><b> 6.7.2.1 Structure and union specifiers</b></a>
- Syntax
+<b> Syntax</b>
1 struct-or-union-specifier:
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
struct-declarator:
declarator
declaratoropt : constant-expression
- Constraints
+<b> Constraints</b>
2 A structure or union shall not contain a member with incomplete or function type (hence,
a structure shall not contain an instance of itself, but may contain a pointer to an instance
of itself), except that the last member of a structure with more than one named member
int, unsigned int, or some other implementation-defined type.
-[<a name="#p101" href="p101">page 101</a>] (<a href="#Contents">Contents</a>)
+[<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
- Semantics
+<b> Semantics</b>
5 As discussed in <a href="#6.2.5">6.2.5</a>, a structure is a type consisting of a sequence of members, whose
storage is allocated in an ordered sequence, and a union is a type consisting of a sequence
of members whose storage overlap.
108) An unnamed bit-field structure member is useful for padding to conform to externally imposed
layouts.
-[<a name="#p102" href="p102">page 102</a>] (<a href="#Contents">Contents</a>)
+[<a name="p102" href="#p102">page 102</a>] (<a href="#Contents">Contents</a>)
12 Each non-bit-field member of a structure or union object is aligned in an implementation-
defined manner appropriate to its type.
-[<a name="#p103" href="p103">page 103</a>] (<a href="#Contents">Contents</a>)
+[<a name="p103" href="#p103">page 103</a>] (<a href="#Contents">Contents</a>)
struct s t1 = { 0 }; // valid
struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
-[<a name="#p104" href="p104">page 104</a>] (<a href="#Contents">Contents</a>)
+[<a name="p104" href="#p104">page 104</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.2.2" href="#6.7.2.2"><b> 6.7.2.2 Enumeration specifiers</b></a>
- Syntax
+<b> Syntax</b>
1 enum-specifier:
enum identifieropt { enumerator-list }
enum identifieropt { enumerator-list , }
enumerator:
enumeration-constant
enumeration-constant = constant-expression
- Constraints
+<b> Constraints</b>
2 The expression that defines the value of an enumeration constant shall be an integer
constant expression that has a value representable as an int.
- Semantics
+<b> Semantics</b>
3 The identifiers in an enumerator list are declared as constants that have type int and
may appear wherever such are permitted.109) An enumerator with = defines its
enumeration constant as the value of the constant expression. If the first enumerator has
110) An implementation may delay the choice of which integer type until all enumeration constants have
been seen.
-[<a name="#p105" href="p105">page 105</a>] (<a href="#Contents">Contents</a>)
+[<a name="p105" href="#p105">page 105</a>] (<a href="#Contents">Contents</a>)
5 EXAMPLE The following fragment:
enum hue { chartreuse, burgundy, claret=20, winedark };
Forward references: tags (<a href="#6.7.2.3">6.7.2.3</a>).
<a name="6.7.2.3" href="#6.7.2.3"><b> 6.7.2.3 Tags</b></a>
- Constraints
+<b> Constraints</b>
1 A specific type shall have its content defined at most once.
2 Where two declarations that use the same tag declare the same type, they shall both use
the same choice of struct, union, or enum.
3 A type specifier of the form
enum identifier
without an enumerator list shall only appear after the type it specifies is complete.
- Semantics
+<b> Semantics</b>
4 All declarations of structure, union, or enumerated types that have the same scope and
use the same tag declare the same type. The type is incomplete111) until the closing brace
of the list defining the content, and complete thereafter.
when a pointer to or a function returning a structure or union is being declared. (See incomplete types
in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
-[<a name="#p106" href="p106">page 106</a>] (<a href="#Contents">Contents</a>)
+[<a name="p106" href="#p106">page 106</a>] (<a href="#Contents">Contents</a>)
union content, or enumeration content. If an identifier is provided,112) the type specifier
also declares the identifier to be the tag of that type.
enumerated type.
113) A similar construction with enum does not exist.
-[<a name="#p107" href="p107">page 107</a>] (<a href="#Contents">Contents</a>)
+[<a name="p107" href="#p107">page 107</a>] (<a href="#Contents">Contents</a>)
typedef struct tnode TNODE;
struct tnode {
Forward references: declarators (<a href="#6.7.5">6.7.5</a>), array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions
(<a href="#6.7.7">6.7.7</a>).
<a name="6.7.3" href="#6.7.3"><b> 6.7.3 Type qualifiers</b></a>
- Syntax
+<b> Syntax</b>
1 type-qualifier:
const
restrict
volatile
- Constraints
+<b> Constraints</b>
2 Types other than pointer types derived from object or incomplete types shall not be
restrict-qualified.
- Semantics
+<b> Semantics</b>
3 The properties associated with qualified types are meaningful only for expressions that
are lvalues.114)
4 If the same qualifier appears more than once in the same specifier-qualifier-list, either
storage. Moreover, the implementation need not allocate storage for such an object if its address is
never used.
-[<a name="#p108" href="p108">page 108</a>] (<a href="#Contents">Contents</a>)
+[<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
5 If an attempt is made to modify an object defined with a const-qualified type through use
of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
association between the allocated object and the pointer.
118) Both of these can occur through the use of typedefs.
-[<a name="#p109" href="p109">page 109</a>] (<a href="#Contents">Contents</a>)
+[<a name="p109" href="#p109">page 109</a>] (<a href="#Contents">Contents</a>)
11 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers
modify an aggregate type:
expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
expressions *p and p[1] are not.
-[<a name="#p110" href="p110">page 110</a>] (<a href="#Contents">Contents</a>)
+[<a name="p110" href="#p110">page 110</a>] (<a href="#Contents">Contents</a>)
associated with B.
6 A translator is free to ignore any or all aliasing implications of uses of restrict.
-[<a name="#p111" href="p111">page 111</a>] (<a href="#Contents">Contents</a>)
+[<a name="p111" href="#p111">page 111</a>] (<a href="#Contents">Contents</a>)
{
int * restrict p1;
}
<a name="6.7.4" href="#6.7.4"><b> 6.7.4 Function specifiers</b></a>
- Syntax
+<b> Syntax</b>
1 function-specifier:
inline
- Constraints
+<b> Constraints</b>
2 Function specifiers shall be used only in the declaration of an identifier for a function.
3 An inline definition of a function with external linkage shall not contain a definition of a
modifiable object with static storage duration, and shall not contain a reference to an
identifier with internal linkage.
4 In a hosted environment, the inline function specifier shall not appear in a declaration
of main.
- Semantics
+<b> Semantics</b>
5 A function declared with an inline function specifier is an inline function. The
function specifier may appear more than once; the behavior is the same as if it appeared
only once. Making a function an inline function suggests that calls to the function be as
implementation-defined.121)
6 Any function with internal linkage can be an inline function. For a function with external
linkage, the following restrictions apply: If a function is declared with an inline
-[<a name="#p112" href="p112">page 112</a>] (<a href="#Contents">Contents</a>)
+[<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
function specifier, then it shall also be defined in the same translation unit. If all of the
file scope declarations for a function in a translation unit include the inline function
extern creates an external definition. The following example shows an entire translation unit.
inline double fahr(double t)
{
- return (<a href="#9.0">9.0</a> * t) / <a href="#5.0">5.0</a> + 32.0;
+ return (9.0 * t) / 5.0 + 32.0;
}
inline double cels(double t)
{
- return (<a href="#5.0">5.0</a> * (t - 32.0)) / <a href="#9.0">9.0</a>;
+ return (5.0 * (t - 32.0)) / 9.0;
}
extern double fahr(double); // creates an external definition
double convert(int is_fahr, double temp)
corresponding inline definitions in other translation units, all corresponding objects with static storage
duration are also distinct in each of the definitions.
-[<a name="#p113" href="p113">page 113</a>] (<a href="#Contents">Contents</a>)
+[<a name="p113" href="#p113">page 113</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.5" href="#6.7.5"><b> 6.7.5 Declarators</b></a>
- Syntax
+<b> Syntax</b>
1 declarator:
pointeropt direct-declarator
direct-declarator:
identifier-list:
identifier
identifier-list , identifier
- Semantics
+<b> Semantics</b>
2 Each declarator declares one identifier, and asserts that when an operand of the same
form as the declarator appears in an expression, it designates a function or object with the
scope, storage duration, and type indicated by the declaration specifiers.
3 A full declarator is a declarator that is not part of another declarator. The end of a full
declarator is a sequence point. If, in the nested sequence of declarators in a full
-[<a name="#p114" href="p114">page 114</a>] (<a href="#Contents">Contents</a>)
+[<a name="p114" href="#p114">page 114</a>] (<a href="#Contents">Contents</a>)
declarator, there is a declarator specifying a variable length array type, the type specified
by the full declarator is said to be variably modified. Furthermore, any type derived by
directly or via one or more typedefs.
Forward references: array declarators (<a href="#6.7.5.2">6.7.5.2</a>), type definitions (<a href="#6.7.7">6.7.7</a>).
<a name="6.7.5.1" href="#6.7.5.1"><b> 6.7.5.1 Pointer declarators</b></a>
- Semantics
+<b> Semantics</b>
1 If, in the declaration ''T D1'', D1 has the form
* type-qualifier-listopt D
and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
-[<a name="#p115" href="p115">page 115</a>] (<a href="#Contents">Contents</a>)
+[<a name="p115" href="#p115">page 115</a>] (<a href="#Contents">Contents</a>)
const int *ptr_to_constant;
int *const constant_ptr;
declares constant_ptr as an object that has type ''const-qualified pointer to int''.
<a name="6.7.5.2" href="#6.7.5.2"><b> 6.7.5.2 Array declarators</b></a>
- Constraints
+<b> Constraints</b>
1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit
an expression or *. If they delimit an expression (which specifies the size of an array), the
expression shall have an integer type. If the expression is a constant expression, it shall
2 An ordinary identifier (as defined in <a href="#6.2.3">6.2.3</a>) that has a variably modified type shall have
either block scope and no linkage or function prototype scope. If an identifier is declared
to be an object with static storage duration, it shall not have a variable length array type.
- Semantics
+<b> Semantics</b>
3 If, in the declaration ''T D1'', D1 has one of the forms:
D[ type-qualifier-listopt assignment-expressionopt ]
D[ static type-qualifier-listopt assignment-expression ]
123) When several ''array of'' specifications are adjacent, a multidimensional array is declared.
-[<a name="#p116" href="p116">page 116</a>] (<a href="#Contents">Contents</a>)
+[<a name="p116" href="#p116">page 116</a>] (<a href="#Contents">Contents</a>)
type has a known constant size, the array type is not a variable length array type;
otherwise, the array type is a variable length array type.
124) Thus, * can be used only in function declarations that are not definitions (see <a href="#6.7.5.3">6.7.5.3</a>).
-[<a name="#p117" href="p117">page 117</a>] (<a href="#Contents">Contents</a>)
+[<a name="p117" href="#p117">page 117</a>] (<a href="#Contents">Contents</a>)
10 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or
function prototype scope. Array objects declared with the static or extern storage-class specifier
Forward references: function declarators (<a href="#6.7.5.3">6.7.5.3</a>), function definitions (<a href="#6.9.1">6.9.1</a>),
initialization (<a href="#6.7.8">6.7.8</a>).
<a name="6.7.5.3" href="#6.7.5.3"><b> 6.7.5.3 Function declarators (including prototypes)</b></a>
- Constraints
+<b> Constraints</b>
1 A function declarator shall not specify a return type that is a function type or an array
type.
2 The only storage-class specifier that shall occur in a parameter declaration is register.
shall be empty.
4 After adjustment, the parameters in a parameter type list in a function declarator that is
part of a definition of that function shall not have incomplete type.
- Semantics
+<b> Semantics</b>
5 If, in the declaration ''T D1'', D1 has the form
D( parameter-type-list )
or
D( identifier-listopt )
-[<a name="#p118" href="p118">page 118</a>] (<a href="#Contents">Contents</a>)
+[<a name="p118" href="#p118">page 118</a>] (<a href="#Contents">Contents</a>)
and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
T '', then the type specified for ident is ''derived-declarator-type-list function returning
126) See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
127) If both function types are ''old style'', parameter types are not compared.
-[<a name="#p119" href="p119">page 119</a>] (<a href="#Contents">Contents</a>)
+[<a name="p119" href="#p119">page 119</a>] (<a href="#Contents">Contents</a>)
Moreover, the parameter type lists, if both are present, shall agree in the number of
parameters and in use of the ellipsis terminator; corresponding parameters shall have
-[<a name="#p120" href="p120">page 120</a>] (<a href="#Contents">Contents</a>)
+[<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
20 EXAMPLE 4 The following prototype has a variably modified parameter.
void addscalar(int n, int m,
-[<a name="#p121" href="p121">page 121</a>] (<a href="#Contents">Contents</a>)
+[<a name="p121" href="#p121">page 121</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.6" href="#6.7.6"><b> 6.7.6 Type names</b></a>
- Syntax
+<b> Syntax</b>
1 type-name:
specifier-qualifier-list abstract-declaratoropt
abstract-declarator:
assignment-expression ]
direct-abstract-declaratoropt [ * ]
direct-abstract-declaratoropt ( parameter-type-listopt )
- Semantics
+<b> Semantics</b>
2 In several contexts, it is necessary to specify a type. This is accomplished using a type
name, which is syntactically a declaration for a function or an object of that type that
omits the identifier.128)
128) As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
parameter specification'', rather than redundant parentheses around the omitted identifier.
-[<a name="#p122" href="p122">page 122</a>] (<a href="#Contents">Contents</a>)
+[<a name="p122" href="#p122">page 122</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.7" href="#6.7.7"><b> 6.7.7 Type definitions</b></a>
- Syntax
+<b> Syntax</b>
1 typedef-name:
identifier
- Constraints
+<b> Constraints</b>
2 If a typedef name specifies a variably modified type then it shall have block scope.
- Semantics
+<b> Semantics</b>
3 In a declaration whose storage-class specifier is typedef, each declarator defines an
identifier to be a typedef name that denotes the type specified for the identifier in the way
described in <a href="#6.7.5">6.7.5</a>. Any array size expressions associated with variable length array
-[<a name="#p123" href="p123">page 123</a>] (<a href="#Contents">Contents</a>)
+[<a name="p123" href="#p123">page 123</a>] (<a href="#Contents">Contents</a>)
6 EXAMPLE 3 The following obscure constructions
typedef signed int t;
-[<a name="#p124" href="p124">page 124</a>] (<a href="#Contents">Contents</a>)
+[<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
<a name="6.7.8" href="#6.7.8"><b> 6.7.8 Initialization</b></a>
- Syntax
+<b> Syntax</b>
1 initializer:
assignment-expression
{ initializer-list }
designator:
[ constant-expression ]
. identifier
- Constraints
+<b> Constraints</b>
2 No initializer shall attempt to provide a value for an object not contained within the entity
being initialized.
3 The type of the entity to be initialized shall be an array of unknown size or an object type
. identifier
then the current object (defined below) shall have structure or union type and the
identifier shall be the name of a member of that type.
-[<a name="#p125" href="p125">page 125</a>] (<a href="#Contents">Contents</a>)
+[<a name="p125" href="#p125">page 125</a>] (<a href="#Contents">Contents</a>)
- Semantics
+<b> Semantics</b>
8 An initializer specifies the initial value stored in an object.
9 Except where explicitly stated otherwise, for the purposes of this subclause unnamed
members of objects of structure and union type do not participate in initialization.
17 Each brace-enclosed initializer list has an associated current object. When no
designations are present, subobjects of the current object are initialized in order according
to the type of the current object: array elements in increasing subscript order, structure
-[<a name="#p126" href="p126">page 126</a>] (<a href="#Contents">Contents</a>)
+[<a name="p126" href="#p126">page 126</a>] (<a href="#Contents">Contents</a>)
members in declaration order, and the first named member of a union.129) In contrast, a
designation causes the following initializer to begin initialization of the subobject
132) Any initializer for the subobject which is overridden and so not used to initialize that subobject might
not be evaluated at all.
-[<a name="#p127" href="p127">page 127</a>] (<a href="#Contents">Contents</a>)
+[<a name="p127" href="#p127">page 127</a>] (<a href="#Contents">Contents</a>)
23 The order in which any side effects occur among the initialization list expressions is
unspecified.133)
24 EXAMPLE 1 Provided that <a href="#7.3"><complex.h></a> has been #included, the declarations
int i = <a href="#3.5">3.5</a>;
double complex c = 5 + 3 * I;
- define and initialize i with the value 3 and c with the value <a href="#5.0">5.0</a> + i3.0.
+ define and initialize i with the value 3 and c with the value 5.0 + i3.0.
25 EXAMPLE 2 The declaration
int x[] = { 1, 3, 5 };
133) In particular, the evaluation order need not be the same as the order of subobject initialization.
-[<a name="#p128" href="p128">page 128</a>] (<a href="#Contents">Contents</a>)
+[<a name="p128" href="#p128">page 128</a>] (<a href="#Contents">Contents</a>)
29 EXAMPLE 6 The declaration
short q[4][3][2] = {
-[<a name="#p129" href="p129">page 129</a>] (<a href="#Contents">Contents</a>)
+[<a name="p129" href="#p129">page 129</a>] (<a href="#Contents">Contents</a>)
32 EXAMPLE 8 The declaration
char s[] = "abc", t[3] = "abc";
-[<a name="#p130" href="p130">page 130</a>] (<a href="#Contents">Contents</a>)
+[<a name="p130" href="#p130">page 130</a>] (<a href="#Contents">Contents</a>)
<a name="6.8" href="#6.8"><b> 6.8 Statements and blocks</b></a>
- Syntax
+<b> Syntax</b>
1 statement:
labeled-statement
compound-statement
selection-statement
iteration-statement
jump-statement
- Semantics
+<b> Semantics</b>
2 A statement specifies an action to be performed. Except as indicated, statements are
executed in sequence.
3 A block allows a set of declarations and statements to be grouped into one syntactic unit.
Forward references: expression and null statements (<a href="#6.8.3">6.8.3</a>), selection statements
(<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>).
<a name="6.8.1" href="#6.8.1"><b> 6.8.1 Labeled statements</b></a>
- Syntax
+<b> Syntax</b>
1 labeled-statement:
identifier : statement
case constant-expression : statement
default : statement
- Constraints
+<b> Constraints</b>
2 A case or default label shall appear only in a switch statement. Further
constraints on such labels are discussed under the switch statement.
-[<a name="#p131" href="p131">page 131</a>] (<a href="#Contents">Contents</a>)
+[<a name="p131" href="#p131">page 131</a>] (<a href="#Contents">Contents</a>)
3 Label names shall be unique within a function.
- Semantics
+<b> Semantics</b>
4 Any statement may be preceded by a prefix that declares an identifier as a label name.
Labels in themselves do not alter the flow of control, which continues unimpeded across
them.
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>).
<a name="6.8.2" href="#6.8.2"><b> 6.8.2 Compound statement</b></a>
- Syntax
+<b> Syntax</b>
1 compound-statement:
{ block-item-listopt }
block-item-list:
block-item:
declaration
statement
- Semantics
+<b> Semantics</b>
2 A compound statement is a block.
<a name="6.8.3" href="#6.8.3"><b> 6.8.3 Expression and null statements</b></a>
- Syntax
+<b> Syntax</b>
1 expression-statement:
expressionopt ;
- Semantics
+<b> Semantics</b>
2 The expression in an expression statement is evaluated as a void expression for its side
effects.134)
3 A null statement (consisting of just a semicolon) performs no operations.
134) Such as assignments, and function calls which have side effects.
-[<a name="#p132" href="p132">page 132</a>] (<a href="#Contents">Contents</a>)
+[<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
5 EXAMPLE 2 In the program fragment
char *s;
Forward references: iteration statements (<a href="#6.8.5">6.8.5</a>).
<a name="6.8.4" href="#6.8.4"><b> 6.8.4 Selection statements</b></a>
- Syntax
+<b> Syntax</b>
1 selection-statement:
if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement
- Semantics
+<b> Semantics</b>
2 A selection statement selects among a set of statements depending on the value of a
controlling expression.
3 A selection statement is a block whose scope is a strict subset of the scope of its
enclosing block. Each associated substatement is also a block whose scope is a strict
subset of the scope of the selection statement.
<a name="6.8.4.1" href="#6.8.4.1"><b> 6.8.4.1 The if statement</b></a>
- Constraints
+<b> Constraints</b>
1 The controlling expression of an if statement shall have scalar type.
- Semantics
+<b> Semantics</b>
2 In both forms, the first substatement is executed if the expression compares unequal to 0.
In the else form, the second substatement is executed if the expression compares equal
-[<a name="#p133" href="p133">page 133</a>] (<a href="#Contents">Contents</a>)
+[<a name="p133" href="#p133">page 133</a>] (<a href="#Contents">Contents</a>)
to 0. If the first substatement is reached via a label, the second substatement is not
executed.
3 An else is associated with the lexically nearest preceding if that is allowed by the
syntax.
<a name="6.8.4.2" href="#6.8.4.2"><b> 6.8.4.2 The switch statement</b></a>
- Constraints
+<b> Constraints</b>
1 The controlling expression of a switch statement shall have integer type.
2 If a switch statement has an associated case or default label within the scope of an
identifier with a variably modified type, the entire switch statement shall be within the
(Any enclosed switch statement may have a default label or case constant
expressions with values that duplicate case constant expressions in the enclosing
switch statement.)
- Semantics
+<b> Semantics</b>
4 A switch statement causes control to jump to, into, or past the statement that is the
switch body, depending on the value of a controlling expression, and on the presence of a
default label and the values of any case labels on or in the switch body. A case or
135) That is, the declaration either precedes the switch statement, or it follows the last case or
default label associated with the switch that is in the block containing the declaration.
-[<a name="#p134" href="p134">page 134</a>] (<a href="#Contents">Contents</a>)
+[<a name="p134" href="#p134">page 134</a>] (<a href="#Contents">Contents</a>)
7 EXAMPLE In the artificial program fragment
switch (expr)
access an indeterminate value. Similarly, the call to the function f cannot be reached.
<a name="6.8.5" href="#6.8.5"><b> 6.8.5 Iteration statements</b></a>
- Syntax
+<b> Syntax</b>
1 iteration-statement:
while ( expression ) statement
do statement while ( expression ) ;
for ( expressionopt ; expressionopt ; expressionopt ) statement
for ( declaration expressionopt ; expressionopt ) statement
- Constraints
+<b> Constraints</b>
2 The controlling expression of an iteration statement shall have scalar type.
3 The declaration part of a for statement shall only declare identifiers for objects having
storage class auto or register.
- Semantics
+<b> Semantics</b>
4 An iteration statement causes a statement called the loop body to be executed repeatedly
until the controlling expression compares equal to 0. The repetition occurs regardless of
whether the loop body is entered from the iteration statement or by a jump.136)
136) Code jumped over is not executed. In particular, the controlling expression of a for or while
statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
-[<a name="#p135" href="p135">page 135</a>] (<a href="#Contents">Contents</a>)
+[<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
<a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
1 The evaluation of the controlling expression takes place before each execution of the loop
2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
nonzero constant.
<a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
- Syntax
+<b> Syntax</b>
1 jump-statement:
goto identifier ;
continue ;
break ;
return expressionopt ;
- Semantics
+<b> Semantics</b>
2 A jump statement causes an unconditional jump to another place.
such that execution of the loop continues until the expression compares equal to 0; and expression-3
specifies an operation (such as incrementing) that is performed after each iteration.
-[<a name="#p136" href="p136">page 136</a>] (<a href="#Contents">Contents</a>)
+[<a name="p136" href="#p136">page 136</a>] (<a href="#Contents">Contents</a>)
<a name="6.8.6.1" href="#6.8.6.1"><b> 6.8.6.1 The goto statement</b></a>
- Constraints
+<b> Constraints</b>
1 The identifier in a goto statement shall name a label located somewhere in the enclosing
function. A goto statement shall not jump from outside the scope of an identifier having
a variably modified type to inside the scope of that identifier.
- Semantics
+<b> Semantics</b>
2 A goto statement causes an unconditional jump to the statement prefixed by the named
label in the enclosing function.
3 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The
-[<a name="#p137" href="p137">page 137</a>] (<a href="#Contents">Contents</a>)
+[<a name="p137" href="#p137">page 137</a>] (<a href="#Contents">Contents</a>)
4 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably
modified types. A jump within the scope, however, is permitted.
goto lab4; // invalid: going INTO scope of VLA.
<a name="6.8.6.2" href="#6.8.6.2"><b> 6.8.6.2 The continue statement</b></a>
- Constraints
+<b> Constraints</b>
1 A continue statement shall appear only in or as a loop body.
- Semantics
+<b> Semantics</b>
2 A continue statement causes a jump to the loop-continuation portion of the smallest
enclosing iteration statement; that is, to the end of the loop body. More precisely, in each
of the statements
unless the continue statement shown is in an enclosed iteration statement (in which
case it is interpreted within that statement), it is equivalent to goto contin;.138)
<a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
- Constraints
+<b> Constraints</b>
1 A break statement shall appear only in or as a switch body or loop body.
- Semantics
+<b> Semantics</b>
2 A break statement terminates execution of the smallest enclosing switch or iteration
statement.
138) Following the contin: label is a null statement.
-[<a name="#p138" href="p138">page 138</a>] (<a href="#Contents">Contents</a>)
+[<a name="p138" href="#p138">page 138</a>] (<a href="#Contents">Contents</a>)
<a name="6.8.6.4" href="#6.8.6.4"><b> 6.8.6.4 The return statement</b></a>
- Constraints
+<b> Constraints</b>
1 A return statement with an expression shall not appear in a function whose return type
is void. A return statement without an expression shall only appear in a function
whose return type is void.
- Semantics
+<b> Semantics</b>
2 A return statement terminates execution of the current function and returns control to
its caller. A function may have any number of return statements.
3 If a return statement with an expression is executed, the value of the expression is
or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
range and precision.
-[<a name="#p139" href="p139">page 139</a>] (<a href="#Contents">Contents</a>)
+[<a name="p139" href="#p139">page 139</a>] (<a href="#Contents">Contents</a>)
<a name="6.9" href="#6.9"><b> 6.9 External definitions</b></a>
- Syntax
+<b> Syntax</b>
1 translation-unit:
external-declaration
translation-unit external-declaration
external-declaration:
function-definition
declaration
- Constraints
+<b> Constraints</b>
2 The storage-class specifiers auto and register shall not appear in the declaration
specifiers in an external declaration.
3 There shall be no more than one external definition for each identifier declared with
linkage is used in an expression (other than as a part of the operand of a sizeof
operator whose result is an integer constant), there shall be exactly one external definition
for the identifier in the translation unit.
- Semantics
+<b> Semantics</b>
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,
which consists of a sequence of external declarations. These are described as ''external''
because they appear outside any function (and hence have file scope). As discussed in
140) Thus, if an identifier declared with external linkage is not used in an expression, there need be no
external definition for it.
-[<a name="#p140" href="p140">page 140</a>] (<a href="#Contents">Contents</a>)
+[<a name="p140" href="#p140">page 140</a>] (<a href="#Contents">Contents</a>)
<a name="6.9.1" href="#6.9.1"><b> 6.9.1 Function definitions</b></a>
- Syntax
+<b> Syntax</b>
1 function-definition:
declaration-specifiers declarator declaration-listopt compound-statement
declaration-list:
declaration
declaration-list declaration
- Constraints
+<b> Constraints</b>
2 The identifier declared in a function definition (which is the name of the function) shall
have a function type, as specified by the declarator portion of the function definition.141)
3 The return type of a function shall be void or an object type other than array type.
F *Fp; // Fp points to a function that has type F
-[<a name="#p141" href="p141">page 141</a>] (<a href="#Contents">Contents</a>)
+[<a name="p141" href="#p141">page 141</a>] (<a href="#Contents">Contents</a>)
- Semantics
+<b> Semantics</b>
7 The declarator in a function definition specifies the name of the function being defined
and the identifiers of its parameters. If the declarator includes a parameter type list, the
list also specifies the types of all the parameters; such a declarator also serves as a
142) See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
-[<a name="#p142" href="p142">page 142</a>] (<a href="#Contents">Contents</a>)
+[<a name="p142" href="#p142">page 142</a>] (<a href="#Contents">Contents</a>)
extern int max(a, b)
int a, b;
}
<a name="6.9.2" href="#6.9.2"><b> 6.9.2 External object definitions</b></a>
- Semantics
+<b> Semantics</b>
1 If the declaration of an identifier for an object has file scope and an initializer, the
declaration is an external definition for the identifier.
2 A declaration of an identifier for an object that has file scope without an initializer, and
-[<a name="#p143" href="p143">page 143</a>] (<a href="#Contents">Contents</a>)
+[<a name="p143" href="#p143">page 143</a>] (<a href="#Contents">Contents</a>)
4 EXAMPLE 1
int i1 = 1; // definition, external linkage
-[<a name="#p144" href="p144">page 144</a>] (<a href="#Contents">Contents</a>)
+[<a name="p144" href="#p144">page 144</a>] (<a href="#Contents">Contents</a>)
<a name="6.10" href="#6.10"><b> 6.10 Preprocessing directives</b></a>
- Syntax
+<b> Syntax</b>
1 preprocessing-file:
groupopt
group:
-[<a name="#p145" href="p145">page 145</a>] (<a href="#Contents">Contents</a>)
+[<a name="p145" href="#p145">page 145</a>] (<a href="#Contents">Contents</a>)
control-line:
# include pp-tokens new-line
pp-tokens preprocessing-token
new-line:
the new-line character
- Description
+<b> Description</b>
2 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the
following constraints: The first token in the sequence is a # preprocessing token that (at
the start of translation phase 4) is either the first character in the source file (optionally
significance, as all white space is equivalent except in certain situations during preprocessing (see the
# character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
-[<a name="#p146" href="p146">page 146</a>] (<a href="#Contents">Contents</a>)
+[<a name="p146" href="#p146">page 146</a>] (<a href="#Contents">Contents</a>)
invocation of a function-like macro.
3 A text line shall not begin with a # preprocessing token. A non-directive shall not begin
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
sequence of preprocessing tokens to occur between the directive name and the following
new-line character.
- Constraints
+<b> Constraints</b>
5 The only white-space characters that shall appear between preprocessing tokens within a
preprocessing directive (from just after the introducing # preprocessing token through
just before the terminating new-line character) are space and horizontal-tab (including
spaces that have replaced comments or possibly other white-space characters in
translation phase 3).
- Semantics
+<b> Semantics</b>
6 The implementation can process and skip sections of source files conditionally, include
other source files, and replace macros. These capabilities are called preprocessing,
because conceptually they occur before translation of the resulting translation unit.
replaced.
<a name="6.10.1" href="#6.10.1"><b> 6.10.1 Conditional inclusion</b></a>
- Constraints
+<b> Constraints</b>
1 The expression that controls conditional inclusion shall be an integer constant expression
except that: it shall not contain a cast; identifiers (including those lexically identical to
keywords) are interpreted as described below;144) and it may contain unary operator
144) Because the controlling constant expression is evaluated during translation phase 4, all identifiers
either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
-[<a name="#p147" href="p147">page 147</a>] (<a href="#Contents">Contents</a>)
+[<a name="p147" href="#p147">page 147</a>] (<a href="#Contents">Contents</a>)
defined identifier
or
2 Each preprocessing token that remains (in the list of preprocessing tokens that will
become the controlling expression) after all macro replacements have occurred shall be in
the lexical form of a token (<a href="#6.4">6.4</a>).
- Semantics
+<b> Semantics</b>
3 Preprocessing directives of the forms
# if constant-expression new-line groupopt
# elif constant-expression new-line groupopt
0x8000 is signed and positive within a #if expression even though it would be unsigned in
translation phase 7.
-[<a name="#p148" href="p148">page 148</a>] (<a href="#Contents">Contents</a>)
+[<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
# ifdef identifier new-line groupopt
# ifndef identifier new-line groupopt
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
integer types (<a href="#7.18.1.5">7.18.1.5</a>).
<a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
- Constraints
+<b> Constraints</b>
1 A #include directive shall identify a header or source file that can be processed by the
implementation.
- Semantics
+<b> Semantics</b>
2 A preprocessing directive of the form
# include <h-char-sequence> new-line
searches a sequence of implementation-defined places for a header identified uniquely by
before the terminating new-line character. However, comments may appear anywhere in a source file,
including within a preprocessing directive.
-[<a name="#p149" href="p149">page 149</a>] (<a href="#Contents">Contents</a>)
+[<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
# include "q-char-sequence" new-line
causes the replacement of that directive by the entire contents of the source file identified
148) Note that adjacent string literals are not concatenated into a single string literal (see the translation
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.
-[<a name="#p150" href="p150">page 150</a>] (<a href="#Contents">Contents</a>)
+[<a name="p150" href="#p150">page 150</a>] (<a href="#Contents">Contents</a>)
#if VERSION == 1
#define INCFILE "vers1.h"
Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>).
<a name="6.10.3" href="#6.10.3"><b> 6.10.3 Macro replacement</b></a>
- Constraints
+<b> Constraints</b>
1 Two replacement lists are identical if and only if the preprocessing tokens in both have
the same number, ordering, spelling, and white-space separation, where all white-space
separations are considered identical.
macro that uses the ellipsis notation in the parameters.
6 A parameter identifier in a function-like macro shall be uniquely declared within its
scope.
- Semantics
+<b> Semantics</b>
7 The identifier immediately following the define is called the macro name. There is one
name space for macro names. Any white-space characters preceding or following the
replacement list of preprocessing tokens are not considered part of the replacement list
for either form of macro.
-[<a name="#p151" href="p151">page 151</a>] (<a href="#Contents">Contents</a>)
+[<a name="p151" href="#p151">page 151</a>] (<a href="#Contents">Contents</a>)
8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which
a preprocessing directive could begin, the identifier is not subject to macro replacement.
are never scanned for macro names or parameters.
150) Despite the name, a non-directive is a preprocessing directive.
-[<a name="#p152" href="p152">page 152</a>] (<a href="#Contents">Contents</a>)
+[<a name="p152" href="#p152">page 152</a>] (<a href="#Contents">Contents</a>)
merger, the number of arguments is one more than the number of parameters in the macro
definition (excluding the ...).
were a parameter, and the variable arguments shall form the preprocessing tokens used to
replace it.
<a name="6.10.3.2" href="#6.10.3.2"><b> 6.10.3.2 The # operator</b></a>
- Constraints
+<b> Constraints</b>
1 Each # preprocessing token in the replacement list for a function-like macro shall be
followed by a parameter as the next preprocessing token in the replacement list.
- Semantics
+<b> Semantics</b>
2 If, in the replacement list, a parameter is immediately preceded by a # preprocessing
token, both are replaced by a single character string literal preprocessing token that
contains the spelling of the preprocessing token sequence for the corresponding
-[<a name="#p153" href="p153">page 153</a>] (<a href="#Contents">Contents</a>)
+[<a name="p153" href="#p153">page 153</a>] (<a href="#Contents">Contents</a>)
<a name="6.10.3.3" href="#6.10.3.3"><b> 6.10.3.3 The ## operator</b></a>
- Constraints
+<b> Constraints</b>
1 A ## preprocessing token shall not occur at the beginning or at the end of a replacement
list for either form of macro definition.
- Semantics
+<b> Semantics</b>
2 If, in the replacement list of a function-like macro, a parameter is immediately preceded
or followed by a ## preprocessing token, the parameter is replaced by the corresponding
argument's preprocessing token sequence; however, if an argument consists of no
151) Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
exist only within translation phase 4.
-[<a name="#p154" href="p154">page 154</a>] (<a href="#Contents">Contents</a>)
+[<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
<a name="6.10.3.4" href="#6.10.3.4"><b> 6.10.3.4 Rescanning and further replacement</b></a>
1 After all parameters in the replacement list have been substituted and # and ##
-[<a name="#p155" href="p155">page 155</a>] (<a href="#Contents">Contents</a>)
+[<a name="p155" href="#p155">page 155</a>] (<a href="#Contents">Contents</a>)
5 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence
#define x 3
-[<a name="#p156" href="p156">page 156</a>] (<a href="#Contents">Contents</a>)
+[<a name="p156" href="#p156">page 156</a>] (<a href="#Contents">Contents</a>)
printf("x" "1" "= %d, x" "2" "= %s", x1, x2);
fputs(
report(x>y, "x is %d but y is %d", x, y);
-[<a name="#p157" href="p157">page 157</a>] (<a href="#Contents">Contents</a>)
+[<a name="p157" href="#p157">page 157</a>] (<a href="#Contents">Contents</a>)
results in
fprintf(stderr, "Flag" );
printf("x is %d but y is %d", x, y));
<a name="6.10.4" href="#6.10.4"><b> 6.10.4 Line control</b></a>
- Constraints
+<b> Constraints</b>
1 The string literal of a #line directive, if present, shall be a character string literal.
- Semantics
+<b> Semantics</b>
2 The line number of the current source line is one greater than the number of new-line
characters read or introduced in translation phase 1 (<a href="#5.1.1.2">5.1.1.2</a>) while processing the source
file to the current token.
-[<a name="#p158" href="p158">page 158</a>] (<a href="#Contents">Contents</a>)
+[<a name="p158" href="#p158">page 158</a>] (<a href="#Contents">Contents</a>)
<a name="6.10.5" href="#6.10.5"><b> 6.10.5 Error directive</b></a>
- Semantics
+<b> Semantics</b>
1 A preprocessing directive of the form
# error pp-tokensopt new-line
causes the implementation to produce a diagnostic message that includes the specified
sequence of preprocessing tokens.
<a name="6.10.6" href="#6.10.6"><b> 6.10.6 Pragma directive</b></a>
- Semantics
+<b> Semantics</b>
1 A preprocessing directive of the form
# pragma pp-tokensopt new-line
where the preprocessing token STDC does not immediately follow pragma in the
but is not required to.
153) See ''future language directions'' (<a href="#6.11.8">6.11.8</a>).
-[<a name="#p159" href="p159">page 159</a>] (<a href="#Contents">Contents</a>)
+[<a name="p159" href="#p159">page 159</a>] (<a href="#Contents">Contents</a>)
<a name="6.10.7" href="#6.10.7"><b> 6.10.7 Null directive</b></a>
- Semantics
+<b> Semantics</b>
1 A preprocessing directive of the form
# new-line
has no effect.
ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
int that is increased with each revision of this International Standard.
-[<a name="#p160" href="p160">page 160</a>] (<a href="#Contents">Contents</a>)
+[<a name="p160" href="#p160">page 160</a>] (<a href="#Contents">Contents</a>)
2 The following macro names are conditionally defined by the implementation:
__STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
in any standard header.
Forward references: the asctime function (<a href="#7.23.3.1">7.23.3.1</a>), standard headers (<a href="#7.1.2">7.1.2</a>).
<a name="6.10.9" href="#6.10.9"><b> 6.10.9 Pragma operator</b></a>
- Semantics
+<b> Semantics</b>
1 A unary operator expression of the form:
_Pragma ( string-literal )
is processed as follows: The string literal is destringized by deleting the L prefix, if
2 EXAMPLE A directive of the form:
#pragma listing on "..\listing.dir"
can also be expressed as:
-[<a name="#p161" href="p161">page 161</a>] (<a href="#Contents">Contents</a>)
+[<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
_Pragma ( "listing on \"..\\listing.dir\"" )
The latter form is processed in the same way whether it appears literally as shown, or results from macro
-[<a name="#p162" href="p162">page 162</a>] (<a href="#Contents">Contents</a>)
+[<a name="p162" href="#p162">page 162</a>] (<a href="#Contents">Contents</a>)
<a name="6.11" href="#6.11"><b> 6.11 Future language directions</b></a>
<a name="6.11.1" href="#6.11.1"><b> 6.11.1 Floating types</b></a>
-[<a name="#p163" href="p163">page 163</a>] (<a href="#Contents">Contents</a>)
+[<a name="p163" href="#p163">page 163</a>] (<a href="#Contents">Contents</a>)
<a name="7" href="#7"><b> 7. Library</b></a>
sequence of maximum length. Whether these counts provide for more than one shift sequence is the
implementation's choice.
-[<a name="#p164" href="p164">page 164</a>] (<a href="#Contents">Contents</a>)
+[<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
<a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
1 Each library function is declared, with a type that includes a prototype, in a header,159)
159) A header is not necessarily a source file, nor are the < and > delimited sequences in header names
necessarily valid source file names.
-[<a name="#p165" href="p165">page 165</a>] (<a href="#Contents">Contents</a>)
+[<a name="p165" href="#p165">page 165</a>] (<a href="#Contents">Contents</a>)
<a name="7.1.3" href="#7.1.3"><b> 7.1.3 Reserved identifiers</b></a>
1 Each header declares or defines all identifiers listed in its associated subclause, and
160) The list of reserved identifiers with external linkage includes errno, math_errhandling,
setjmp, and va_end.
-[<a name="#p166" href="p166">page 166</a>] (<a href="#Contents">Contents</a>)
+[<a name="p166" href="#p166">page 166</a>] (<a href="#Contents">Contents</a>)
the header, so if a library function is declared explicitly when its header is included, one
of the techniques shown below can be used to ensure the declaration is not affected by
definition, is thereby revealed also.
164) Thus, a signal handler cannot, in general, call standard library functions.
-[<a name="#p167" href="p167">page 167</a>] (<a href="#Contents">Contents</a>)
+[<a name="p167" href="#p167">page 167</a>] (<a href="#Contents">Contents</a>)
5 EXAMPLE The function atoi may be used in any of several ways:
-- by use of its associated header (possibly generating a macro expansion)
-[<a name="#p168" href="p168">page 168</a>] (<a href="#Contents">Contents</a>)
+[<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
<a name="7.2" href="#7.2"><b> 7.2 Diagnostics <assert.h></b></a>
1 The header <a href="#7.2"><assert.h></a> defines the assert macro and refers to another macro,
undefined.
<a name="7.2.1" href="#7.2.1"><b> 7.2.1 Program diagnostics</b></a>
<a name="7.2.1.1" href="#7.2.1.1"><b> 7.2.1.1 The assert macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.2"><assert.h></a>
void assert(scalar expression);
- Description
+<b> Description</b>
2 The assert macro puts diagnostic tests into programs; it expands to a void expression.
When it is executed, if expression (which shall have a scalar type) is false (that is,
compares equal to 0), the assert macro writes information about the particular call that
the preprocessing macros __FILE__ and __LINE__ and of the identifier
__func__) on the standard error stream in an implementation-defined format.165) It
then calls the abort function.
- Returns
+<b> Returns</b>
3 The assert macro returns no value.
Forward references: the abort function (<a href="#7.20.4.1">7.20.4.1</a>).
Assertion failed: expression, function abc, file xyz, line nnn.
-[<a name="#p169" href="p169">page 169</a>] (<a href="#Contents">Contents</a>)
+[<a name="p169" href="#p169">page 169</a>] (<a href="#Contents">Contents</a>)
<a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic <complex.h></b></a>
<a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
167) The imaginary unit is a number i such that i 2 = -1.
168) A specification for imaginary types is in informative <a href="#G">annex G</a>.
-[<a name="#p170" href="p170">page 170</a>] (<a href="#Contents">Contents</a>)
+[<a name="p170" href="#p170">page 170</a>] (<a href="#Contents">Contents</a>)
<a name="7.3.2" href="#7.3.2"><b> 7.3.2 Conventions</b></a>
1 Values are interpreted as radians, not degrees. An implementation may set errno but is
the finite endpoint of the cut along the negative real axis approaches the cut from above,
so the cut maps to the positive imaginary axis.
<a name="7.3.4" href="#7.3.4"><b> 7.3.4 The CX_LIMITED_RANGE pragma</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
#pragma STDC CX_LIMITED_RANGE on-off-switch
- Description
+<b> Description</b>
2 The usual mathematical formulas for complex multiply, divide, and absolute value are
problematic because of their treatment of infinities and because of undue overflow and
underflow. The CX_LIMITED_RANGE pragma can be used to inform the
???????????????
where the programmer can determine they are safe.
-[<a name="#p171" href="p171">page 171</a>] (<a href="#Contents">Contents</a>)
+[<a name="p171" href="#p171">page 171</a>] (<a href="#Contents">Contents</a>)
declarations, the pragma takes effect from its occurrence until another
CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
undefined. The default state for the pragma is ''off''.
<a name="7.3.5" href="#7.3.5"><b> 7.3.5 Trigonometric functions</b></a>
<a name="7.3.5.1" href="#7.3.5.1"><b> 7.3.5.1 The cacos functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex cacos(double complex z);
float complex cacosf(float complex z);
long double complex cacosl(long double complex z);
- Description
+<b> Description</b>
2 The cacos functions compute the complex arc cosine of z, with branch cuts outside the
interval [-1, +1] along the real axis.
- Returns
+<b> Returns</b>
3 The cacos functions return the complex arc cosine value, in the range of a strip
mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the
real axis.
<a name="7.3.5.2" href="#7.3.5.2"><b> 7.3.5.2 The casin functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex casin(double complex z);
float complex casinf(float complex z);
long double complex casinl(long double complex z);
- Description
+<b> Description</b>
2 The casin functions compute the complex arc sine of z, with branch cuts outside the
interval [-1, +1] along the real axis.
- Returns
+<b> Returns</b>
3 The casin functions return the complex arc sine value, in the range of a strip
mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
along the real axis.
-[<a name="#p172" href="p172">page 172</a>] (<a href="#Contents">Contents</a>)
+[<a name="p172" href="#p172">page 172</a>] (<a href="#Contents">Contents</a>)
<a name="7.3.5.3" href="#7.3.5.3"><b> 7.3.5.3 The catan functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex catan(double complex z);
float complex catanf(float complex z);
long double complex catanl(long double complex z);
- Description
+<b> Description</b>
2 The catan functions compute the complex arc tangent of z, with branch cuts outside the
interval [-i, +i] along the imaginary axis.
- Returns
+<b> Returns</b>
3 The catan functions return the complex arc tangent value, in the range of a strip
mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
along the real axis.
<a name="7.3.5.4" href="#7.3.5.4"><b> 7.3.5.4 The ccos functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex ccos(double complex z);
float complex ccosf(float complex z);
long double complex ccosl(long double complex z);
- Description
+<b> Description</b>
2 The ccos functions compute the complex cosine of z.
- Returns
+<b> Returns</b>
3 The ccos functions return the complex cosine value.
<a name="7.3.5.5" href="#7.3.5.5"><b> 7.3.5.5 The csin functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex csin(double complex z);
float complex csinf(float complex z);
long double complex csinl(long double complex z);
- Description
+<b> Description</b>
2 The csin functions compute the complex sine of z.
- Returns
+<b> Returns</b>
3 The csin functions return the complex sine value.
-[<a name="#p173" href="p173">page 173</a>] (<a href="#Contents">Contents</a>)
+[<a name="p173" href="#p173">page 173</a>] (<a href="#Contents">Contents</a>)
<a name="7.3.5.6" href="#7.3.5.6"><b> 7.3.5.6 The ctan functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex ctan(double complex z);
float complex ctanf(float complex z);
long double complex ctanl(long double complex z);
- Description
+<b> Description</b>
2 The ctan functions compute the complex tangent of z.
- Returns
+<b> Returns</b>
3 The ctan functions return the complex tangent value.
<a name="7.3.6" href="#7.3.6"><b> 7.3.6 Hyperbolic functions</b></a>
<a name="7.3.6.1" href="#7.3.6.1"><b> 7.3.6.1 The cacosh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex cacosh(double complex z);
float complex cacoshf(float complex z);
long double complex cacoshl(long double complex z);
- Description
+<b> Description</b>
2 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch
cut at values less than 1 along the real axis.
- Returns
+<b> Returns</b>
3 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a
half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along
the imaginary axis.
<a name="7.3.6.2" href="#7.3.6.2"><b> 7.3.6.2 The casinh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex casinh(double complex z);
float complex casinhf(float complex z);
long double complex casinhl(long double complex z);
- Description
+<b> Description</b>
2 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts
outside the interval [-i, +i] along the imaginary axis.
-[<a name="#p174" href="p174">page 174</a>] (<a href="#Contents">Contents</a>)
+[<a name="p174" href="#p174">page 174</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The casinh functions return the complex arc hyperbolic sine value, in the range of a
strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
along the imaginary axis.
<a name="7.3.6.3" href="#7.3.6.3"><b> 7.3.6.3 The catanh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex catanh(double complex z);
float complex catanhf(float complex z);
long double complex catanhl(long double complex z);
- Description
+<b> Description</b>
2 The catanh functions compute the complex arc hyperbolic tangent of z, with branch
cuts outside the interval [-1, +1] along the real axis.
- Returns
+<b> Returns</b>
3 The catanh functions return the complex arc hyperbolic tangent value, in the range of a
strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2]
along the imaginary axis.
<a name="7.3.6.4" href="#7.3.6.4"><b> 7.3.6.4 The ccosh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex ccosh(double complex z);
float complex ccoshf(float complex z);
long double complex ccoshl(long double complex z);
- Description
+<b> Description</b>
2 The ccosh functions compute the complex hyperbolic cosine of z.
- Returns
+<b> Returns</b>
3 The ccosh functions return the complex hyperbolic cosine value.
<a name="7.3.6.5" href="#7.3.6.5"><b> 7.3.6.5 The csinh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex csinh(double complex z);
float complex csinhf(float complex z);
long double complex csinhl(long double complex z);
-[<a name="#p175" href="p175">page 175</a>] (<a href="#Contents">Contents</a>)
+[<a name="p175" href="#p175">page 175</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The csinh functions compute the complex hyperbolic sine of z.
- Returns
+<b> Returns</b>
3 The csinh functions return the complex hyperbolic sine value.
<a name="7.3.6.6" href="#7.3.6.6"><b> 7.3.6.6 The ctanh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex ctanh(double complex z);
float complex ctanhf(float complex z);
long double complex ctanhl(long double complex z);
- Description
+<b> Description</b>
2 The ctanh functions compute the complex hyperbolic tangent of z.
- Returns
+<b> Returns</b>
3 The ctanh functions return the complex hyperbolic tangent value.
<a name="7.3.7" href="#7.3.7"><b> 7.3.7 Exponential and logarithmic functions</b></a>
<a name="7.3.7.1" href="#7.3.7.1"><b> 7.3.7.1 The cexp functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex cexp(double complex z);
float complex cexpf(float complex z);
long double complex cexpl(long double complex z);
- Description
+<b> Description</b>
2 The cexp functions compute the complex base-e exponential of z.
- Returns
+<b> Returns</b>
3 The cexp functions return the complex base-e exponential value.
<a name="7.3.7.2" href="#7.3.7.2"><b> 7.3.7.2 The clog functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex clog(double complex z);
float complex clogf(float complex z);
-[<a name="#p176" href="p176">page 176</a>] (<a href="#Contents">Contents</a>)
+[<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The clog functions compute the complex natural (base-e) logarithm of z, with a branch
cut along the negative real axis.
- Returns
+<b> Returns</b>
3 The clog functions return the complex natural logarithm value, in the range of a strip
mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the
imaginary axis.
<a name="7.3.8" href="#7.3.8"><b> 7.3.8 Power and absolute-value functions</b></a>
<a name="7.3.8.1" href="#7.3.8.1"><b> 7.3.8.1 The cabs functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double cabs(double complex z);
float cabsf(float complex z);
long double cabsl(long double complex z);
- Description
+<b> Description</b>
2 The cabs functions compute the complex absolute value (also called norm, modulus, or
magnitude) of z.
- Returns
+<b> Returns</b>
3 The cabs functions return the complex absolute value.
<a name="7.3.8.2" href="#7.3.8.2"><b> 7.3.8.2 The cpow functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex cpow(double complex x, double complex y);
float complex cpowf(float complex x, float complex y);
long double complex cpowl(long double complex x,
long double complex y);
- Description
+<b> Description</b>
2 The cpow functions compute the complex power function xy , with a branch cut for the
first parameter along the negative real axis.
- Returns
+<b> Returns</b>
3 The cpow functions return the complex power function value.
-[<a name="#p177" href="p177">page 177</a>] (<a href="#Contents">Contents</a>)
+[<a name="p177" href="#p177">page 177</a>] (<a href="#Contents">Contents</a>)
<a name="7.3.8.3" href="#7.3.8.3"><b> 7.3.8.3 The csqrt functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex csqrt(double complex z);
float complex csqrtf(float complex z);
long double complex csqrtl(long double complex z);
- Description
+<b> Description</b>
2 The csqrt functions compute the complex square root of z, with a branch cut along the
negative real axis.
- Returns
+<b> Returns</b>
3 The csqrt functions return the complex square root value, in the range of the right half-
plane (including the imaginary axis).
<a name="7.3.9" href="#7.3.9"><b> 7.3.9 Manipulation functions</b></a>
<a name="7.3.9.1" href="#7.3.9.1"><b> 7.3.9.1 The carg functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double carg(double complex z);
float cargf(float complex z);
long double cargl(long double complex z);
- Description
+<b> Description</b>
2 The carg functions compute the argument (also called phase angle) of z, with a branch
cut along the negative real axis.
- Returns
+<b> Returns</b>
3 The carg functions return the value of the argument in the interval [-pi , +pi ].
<a name="7.3.9.2" href="#7.3.9.2"><b> 7.3.9.2 The cimag functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double cimag(double complex z);
float cimagf(float complex z);
-[<a name="#p178" href="p178">page 178</a>] (<a href="#Contents">Contents</a>)
+[<a name="p178" href="#p178">page 178</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The cimag functions compute the imaginary part of z.170)
- Returns
+<b> Returns</b>
3 The cimag functions return the imaginary part value (as a real).
<a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The conj functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex conj(double complex z);
float complex conjf(float complex z);
long double complex conjl(long double complex z);
- Description
+<b> Description</b>
2 The conj functions compute the complex conjugate of z, by reversing the sign of its
imaginary part.
- Returns
+<b> Returns</b>
3 The conj functions return the complex conjugate value.
<a name="7.3.9.4" href="#7.3.9.4"><b> 7.3.9.4 The cproj functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double complex cproj(double complex z);
float complex cprojf(float complex z);
long double complex cprojl(long double complex z);
- Description
+<b> Description</b>
2 The cproj functions compute a projection of z onto the Riemann sphere: z projects to
z except that all complex infinities (even those with one infinite part and one NaN part)
project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is
equivalent to
INFINITY + I * copysign(0.0, cimag(z))
- Returns
+<b> Returns</b>
3 The cproj functions return the value of the projection onto the Riemann sphere.
170) For a variable z of complex type, z == creal(z) + cimag(z)*I.
-[<a name="#p179" href="p179">page 179</a>] (<a href="#Contents">Contents</a>)
+[<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
<a name="7.3.9.5" href="#7.3.9.5"><b> 7.3.9.5 The creal functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.3"><complex.h></a>
double creal(double complex z);
float crealf(float complex z);
long double creall(long double complex z);
- Description
+<b> Description</b>
2 The creal functions compute the real part of z.171)
- Returns
+<b> Returns</b>
3 The creal functions return the real part value.
171) For a variable z of complex type, z == creal(z) + cimag(z)*I.
-[<a name="#p180" href="p180">page 180</a>] (<a href="#Contents">Contents</a>)
+[<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
<a name="7.4" href="#7.4"><b> 7.4 Character handling <ctype.h></b></a>
1 The header <a href="#7.4"><ctype.h></a> declares several functions useful for classifying and mapping
1 The functions in this subclause return nonzero (true) if and only if the value of the
argument c conforms to that in the description of the function.
<a name="7.4.1.1" href="#7.4.1.1"><b> 7.4.1.1 The isalnum function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isalnum(int c);
- Description
+<b> Description</b>
2 The isalnum function tests for any character for which isalpha or isdigit is true.
<a name="7.4.1.2" href="#7.4.1.2"><b> 7.4.1.2 The isalpha function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isalpha(int c);
- Description
+<b> Description</b>
2 The isalpha function tests for any character for which isupper or islower is true,
or any character that is one of a locale-specific set of alphabetic characters for which
whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
-[<a name="#p181" href="p181">page 181</a>] (<a href="#Contents">Contents</a>)
+[<a name="p181" href="#p181">page 181</a>] (<a href="#Contents">Contents</a>)
none of iscntrl, isdigit, ispunct, or isspace is true.174) In the "C" locale,
isalpha returns true only for the characters for which isupper or islower is true.
<a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isblank(int c);
- Description
+<b> Description</b>
2 The isblank function tests for any character that is a standard blank character or is one
of a locale-specific set of characters for which isspace is true and that is used to
separate words within a line of text. The standard blank characters are the following:
space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only
for the standard blank characters.
<a name="7.4.1.4" href="#7.4.1.4"><b> 7.4.1.4 The iscntrl function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int iscntrl(int c);
- Description
+<b> Description</b>
2 The iscntrl function tests for any control character.
<a name="7.4.1.5" href="#7.4.1.5"><b> 7.4.1.5 The isdigit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isdigit(int c);
- Description
+<b> Description</b>
2 The isdigit function tests for any decimal-digit character (as defined in <a href="#5.2.1">5.2.1</a>).
<a name="7.4.1.6" href="#7.4.1.6"><b> 7.4.1.6 The isgraph function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isgraph(int c);
174) The functions islower and isupper test true or false separately for each of these additional
characters; all four combinations are possible.
-[<a name="#p182" href="p182">page 182</a>] (<a href="#Contents">Contents</a>)
+[<a name="p182" href="#p182">page 182</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The isgraph function tests for any printing character except space (' ').
<a name="7.4.1.7" href="#7.4.1.7"><b> 7.4.1.7 The islower function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int islower(int c);
- Description
+<b> Description</b>
2 The islower function tests for any character that is a lowercase letter or is one of a
locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
isspace is true. In the "C" locale, islower returns true only for the lowercase
letters (as defined in <a href="#5.2.1">5.2.1</a>).
<a name="7.4.1.8" href="#7.4.1.8"><b> 7.4.1.8 The isprint function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isprint(int c);
- Description
+<b> Description</b>
2 The isprint function tests for any printing character including space (' ').
<a name="7.4.1.9" href="#7.4.1.9"><b> 7.4.1.9 The ispunct function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int ispunct(int c);
- Description
+<b> Description</b>
2 The ispunct function tests for any printing character that is one of a locale-specific set
of punctuation characters for which neither isspace nor isalnum is true. In the "C"
locale, ispunct returns true for every printing character for which neither isspace
nor isalnum is true.
<a name="7.4.1.10" href="#7.4.1.10"><b> 7.4.1.10 The isspace function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isspace(int c);
- Description
+<b> Description</b>
2 The isspace function tests for any character that is a standard white-space character or
is one of a locale-specific set of characters for which isalnum is false. The standard
-[<a name="#p183" href="p183">page 183</a>] (<a href="#Contents">Contents</a>)
+[<a name="p183" href="#p183">page 183</a>] (<a href="#Contents">Contents</a>)
white-space characters are the following: space (' '), form feed ('\f'), new-line
('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the
"C" locale, isspace returns true only for the standard white-space characters.
<a name="7.4.1.11" href="#7.4.1.11"><b> 7.4.1.11 The isupper function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isupper(int c);
- Description
+<b> Description</b>
2 The isupper function tests for any character that is an uppercase letter or is one of a
locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or
isspace is true. In the "C" locale, isupper returns true only for the uppercase
letters (as defined in <a href="#5.2.1">5.2.1</a>).
<a name="7.4.1.12" href="#7.4.1.12"><b> 7.4.1.12 The isxdigit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int isxdigit(int c);
- Description
+<b> Description</b>
2 The isxdigit function tests for any hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
<a name="7.4.2" href="#7.4.2"><b> 7.4.2 Character case mapping functions</b></a>
<a name="7.4.2.1" href="#7.4.2.1"><b> 7.4.2.1 The tolower function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int tolower(int c);
- Description
+<b> Description</b>
2 The tolower function converts an uppercase letter to a corresponding lowercase letter.
- Returns
+<b> Returns</b>
3 If the argument is a character for which isupper is true and there are one or more
corresponding characters, as specified by the current locale, for which islower is true,
the tolower function returns one of the corresponding characters (always the same one
-[<a name="#p184" href="p184">page 184</a>] (<a href="#Contents">Contents</a>)
+[<a name="p184" href="#p184">page 184</a>] (<a href="#Contents">Contents</a>)
<a name="7.4.2.2" href="#7.4.2.2"><b> 7.4.2.2 The toupper function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.4"><ctype.h></a>
int toupper(int c);
- Description
+<b> Description</b>
2 The toupper function converts a lowercase letter to a corresponding uppercase letter.
- Returns
+<b> Returns</b>
3 If the argument is a character for which islower is true and there are one or more
corresponding characters, as specified by the current locale, for which isupper is true,
the toupper function returns one of the corresponding characters (always the same one
-[<a name="#p185" href="p185">page 185</a>] (<a href="#Contents">Contents</a>)
+[<a name="p185" href="#p185">page 185</a>] (<a href="#Contents">Contents</a>)
<a name="7.5" href="#7.5"><b> 7.5 Errors <errno.h></b></a>
1 The header <a href="#7.5"><errno.h></a> defines several macros, all relating to the reporting of error
value is still zero just before the return.
177) See ''future library directions'' (<a href="#7.26.3">7.26.3</a>).
-[<a name="#p186" href="p186">page 186</a>] (<a href="#Contents">Contents</a>)
+[<a name="p186" href="#p186">page 186</a>] (<a href="#Contents">Contents</a>)
<a name="7.6" href="#7.6"><b> 7.6 Floating-point environment <fenv.h></b></a>
1 The header <a href="#7.6"><fenv.h></a> declares two types and several macros and functions to provide
unaware of them). The responsibilities associated with accessing the floating-point environment fall
on the programmer or program that does so explicitly.
-[<a name="#p187" href="p187">page 187</a>] (<a href="#Contents">Contents</a>)
+[<a name="p187" href="#p187">page 187</a>] (<a href="#Contents">Contents</a>)
5 Each of the macros
FE_DIVBYZERO
183) Even though the rounding direction macros may expand to constants corresponding to the values of
FLT_ROUNDS, they are not required to do so.
-[<a name="#p188" href="p188">page 188</a>] (<a href="#Contents">Contents</a>)
+[<a name="p188" href="#p188">page 188</a>] (<a href="#Contents">Contents</a>)
FE_DFL_ENV
represents the default floating-point environment -- the one installed at program startup
FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may
also be specified by the implementation.
<a name="7.6.1" href="#7.6.1"><b> 7.6.1 The FENV_ACCESS pragma</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
#pragma STDC FENV_ACCESS on-off-switch
- Description
+<b> Description</b>
2 The FENV_ACCESS pragma provides a means to inform the implementation when a
program might access the floating-point environment to test floating-point status flags or
run under non-default floating-point control modes.184) The pragma shall occur either
folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
modes are in effect and the flags are not tested.
-[<a name="#p189" href="p189">page 189</a>] (<a href="#Contents">Contents</a>)
+[<a name="p189" href="#p189">page 189</a>] (<a href="#Contents">Contents</a>)
3 EXAMPLE
#include <a href="#7.6"><fenv.h></a>
FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
functions is undefined.
<a name="7.6.2.1" href="#7.6.2.1"><b> 7.6.2.1 The feclearexcept function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int feclearexcept(int excepts);
- Description
+<b> Description</b>
2 The feclearexcept function attempts to clear the supported floating-point exceptions
represented by its argument.
- Returns
+<b> Returns</b>
3 The feclearexcept function returns zero if the excepts argument is zero or if all
the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value.
point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
content of flags.
-[<a name="#p190" href="p190">page 190</a>] (<a href="#Contents">Contents</a>)
+[<a name="p190" href="#p190">page 190</a>] (<a href="#Contents">Contents</a>)
<a name="7.6.2.2" href="#7.6.2.2"><b> 7.6.2.2 The fegetexceptflag function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fegetexceptflag(fexcept_t *flagp,
int excepts);
- Description
+<b> Description</b>
2 The fegetexceptflag function attempts to store an implementation-defined
representation of the states of the floating-point status flags indicated by the argument
excepts in the object pointed to by the argument flagp.
- Returns
+<b> Returns</b>
3 The fegetexceptflag function returns zero if the representation was successfully
stored. Otherwise, it returns a nonzero value.
<a name="7.6.2.3" href="#7.6.2.3"><b> 7.6.2.3 The feraiseexcept function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int feraiseexcept(int excepts);
- Description
+<b> Description</b>
2 The feraiseexcept function attempts to raise the supported floating-point exceptions
represented by its argument.187) The order in which these floating-point exceptions are
raised is unspecified, except as stated in <a href="#F.7.6">F.7.6</a>. Whether the feraiseexcept function
additionally raises the ''inexact'' floating-point exception whenever it raises the
''overflow'' or ''underflow'' floating-point exception is implementation-defined.
- Returns
+<b> Returns</b>
3 The feraiseexcept function returns zero if the excepts argument is zero or if all
the specified exceptions were successfully raised. Otherwise, it returns a nonzero value.
Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
in <a href="#F.7.6">F.7.6</a> is in the same spirit.
-[<a name="#p191" href="p191">page 191</a>] (<a href="#Contents">Contents</a>)
+[<a name="p191" href="#p191">page 191</a>] (<a href="#Contents">Contents</a>)
<a name="7.6.2.4" href="#7.6.2.4"><b> 7.6.2.4 The fesetexceptflag function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fesetexceptflag(const fexcept_t *flagp,
int excepts);
- Description
+<b> Description</b>
2 The fesetexceptflag function attempts to set the floating-point status flags
indicated by the argument excepts to the states stored in the object pointed to by
flagp. The value of *flagp shall have been set by a previous call to
fegetexceptflag whose second argument represented at least those floating-point
exceptions represented by the argument excepts. This function does not raise floating-
point exceptions, but only sets the state of the flags.
- Returns
+<b> Returns</b>
3 The fesetexceptflag function returns zero if the excepts argument is zero or if
all the specified flags were successfully set to the appropriate state. Otherwise, it returns
a nonzero value.
<a name="7.6.2.5" href="#7.6.2.5"><b> 7.6.2.5 The fetestexcept function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fetestexcept(int excepts);
- Description
+<b> Description</b>
2 The fetestexcept function determines which of a specified subset of the floating-
point exception flags are currently set. The excepts argument specifies the floating-
point status flags to be queried.188)
- Returns
+<b> Returns</b>
3 The fetestexcept function returns the value of the bitwise OR of the floating-point
exception macros corresponding to the currently set floating-point exceptions included in
excepts.
188) This mechanism allows testing several floating-point exceptions with just one function call.
-[<a name="#p192" href="p192">page 192</a>] (<a href="#Contents">Contents</a>)
+[<a name="p192" href="#p192">page 192</a>] (<a href="#Contents">Contents</a>)
#include <a href="#7.6"><fenv.h></a>
/* ... */
1 The fegetround and fesetround functions provide control of rounding direction
modes.
<a name="7.6.3.1" href="#7.6.3.1"><b> 7.6.3.1 The fegetround function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fegetround(void);
- Description
+<b> Description</b>
2 The fegetround function gets the current rounding direction.
- Returns
+<b> Returns</b>
3 The fegetround function returns the value of the rounding direction macro
representing the current rounding direction or a negative value if there is no such
rounding direction macro or the current rounding direction is not determinable.
<a name="7.6.3.2" href="#7.6.3.2"><b> 7.6.3.2 The fesetround function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fesetround(int round);
- Description
+<b> Description</b>
2 The fesetround function establishes the rounding direction represented by its
argument round. If the argument is not equal to the value of a rounding direction macro,
the rounding direction is not changed.
- Returns
+<b> Returns</b>
3 The fesetround function returns zero if and only if the requested rounding direction
was established.
-[<a name="#p193" href="p193">page 193</a>] (<a href="#Contents">Contents</a>)
+[<a name="p193" href="#p193">page 193</a>] (<a href="#Contents">Contents</a>)
4 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the
rounding direction fails.
1 The functions in this section manage the floating-point environment -- status flags and
control modes -- as one entity.
<a name="7.6.4.1" href="#7.6.4.1"><b> 7.6.4.1 The fegetenv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fegetenv(fenv_t *envp);
- Description
+<b> Description</b>
2 The fegetenv function attempts to store the current floating-point environment in the
object pointed to by envp.
- Returns
+<b> Returns</b>
3 The fegetenv function returns zero if the environment was successfully stored.
Otherwise, it returns a nonzero value.
<a name="7.6.4.2" href="#7.6.4.2"><b> 7.6.4.2 The feholdexcept function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int feholdexcept(fenv_t *envp);
- Description
+<b> Description</b>
2 The feholdexcept function saves the current floating-point environment in the object
pointed to by envp, clears the floating-point status flags, and then installs a non-stop
(continue on floating-point exceptions) mode, if available, for all floating-point
exceptions.189)
-[<a name="#p194" href="p194">page 194</a>] (<a href="#Contents">Contents</a>)
+[<a name="p194" href="#p194">page 194</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The feholdexcept function returns zero if and only if non-stop floating-point
exception handling was successfully installed.
<a name="7.6.4.3" href="#7.6.4.3"><b> 7.6.4.3 The fesetenv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int fesetenv(const fenv_t *envp);
- Description
+<b> Description</b>
2 The fesetenv function attempts to establish the floating-point environment represented
by the object pointed to by envp. The argument envp shall point to an object set by a
call to fegetenv or feholdexcept, or equal a floating-point environment macro.
Note that fesetenv merely installs the state of the floating-point status flags
represented through its argument, and does not raise these floating-point exceptions.
- Returns
+<b> Returns</b>
3 The fesetenv function returns zero if the environment was successfully established.
Otherwise, it returns a nonzero value.
<a name="7.6.4.4" href="#7.6.4.4"><b> 7.6.4.4 The feupdateenv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.6"><fenv.h></a>
int feupdateenv(const fenv_t *envp);
- Description
+<b> Description</b>
2 The feupdateenv function attempts to save the currently raised floating-point
exceptions in its automatic storage, install the floating-point environment represented by
the object pointed to by envp, and then raise the saved floating-point exceptions. The
argument envp shall point to an object set by a call to feholdexcept or fegetenv,
or equal a floating-point environment macro.
- Returns
+<b> Returns</b>
3 The feupdateenv function returns zero if all the actions were successfully carried out.
Otherwise, it returns a nonzero value.
such systems, the feholdexcept function can be used in conjunction with the feupdateenv
function to write routines that hide spurious floating-point exceptions from their callers.
-[<a name="#p195" href="p195">page 195</a>] (<a href="#Contents">Contents</a>)
+[<a name="p195" href="#p195">page 195</a>] (<a href="#Contents">Contents</a>)
4 EXAMPLE Hide spurious underflow floating-point exceptions:
#include <a href="#7.6"><fenv.h></a>
-[<a name="#p196" href="p196">page 196</a>] (<a href="#Contents">Contents</a>)
+[<a name="p196" href="#p196">page 196</a>] (<a href="#Contents">Contents</a>)
<a name="7.7" href="#7.7"><b> 7.7 Characteristics of floating types <float.h></b></a>
1 The header <a href="#7.7"><float.h></a> defines several macros that expand to various limits and
-[<a name="#p197" href="p197">page 197</a>] (<a href="#Contents">Contents</a>)
+[<a name="p197" href="#p197">page 197</a>] (<a href="#Contents">Contents</a>)
<a name="7.8" href="#7.8"><b> 7.8 Format conversion of integer types <inttypes.h></b></a>
1 The header <a href="#7.8"><inttypes.h></a> includes the header <a href="#7.18"><stdint.h></a> and extends it with
different format specifiers may be required for fprintf and fscanf, even when the type is the
same.
-[<a name="#p198" href="p198">page 198</a>] (<a href="#Contents">Contents</a>)
+[<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
3 The fprintf macros for unsigned integers are:
PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR
<a name="7.8.2" href="#7.8.2"><b> 7.8.2 Functions for greatest-width integer types</b></a>
<a name="7.8.2.1" href="#7.8.2.1"><b> 7.8.2.1 The imaxabs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.8"><inttypes.h></a>
intmax_t imaxabs(intmax_t j);
- Description
+<b> Description</b>
2 The imaxabs function computes the absolute value of an integer j. If the result cannot
be represented, the behavior is undefined.193)
193) The absolute value of the most negative number cannot be represented in two's complement.
-[<a name="#p199" href="p199">page 199</a>] (<a href="#Contents">Contents</a>)
+[<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The imaxabs function returns the absolute value.
<a name="7.8.2.2" href="#7.8.2.2"><b> 7.8.2.2 The imaxdiv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.8"><inttypes.h></a>
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
- Description
+<b> Description</b>
2 The imaxdiv function computes numer / denom and numer % denom in a single
operation.
- Returns
+<b> Returns</b>
3 The imaxdiv function returns a structure of type imaxdiv_t comprising both the
quotient and the remainder. The structure shall contain (in either order) the members
quot (the quotient) and rem (the remainder), each of which has type intmax_t. If
either part of the result cannot be represented, the behavior is undefined.
<a name="7.8.2.3" href="#7.8.2.3"><b> 7.8.2.3 The strtoimax and strtoumax functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.8"><inttypes.h></a>
intmax_t strtoimax(const char * restrict nptr,
char ** restrict endptr, int base);
uintmax_t strtoumax(const char * restrict nptr,
char ** restrict endptr, int base);
- Description
+<b> Description</b>
2 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll,
strtoul, and strtoull functions, except that the initial portion of the string is
converted to intmax_t and uintmax_t representation, respectively.
- Returns
+<b> Returns</b>
3 The strtoimax and strtoumax functions return the converted value, if any. If no
conversion could be performed, zero is returned. If the correct value is outside the range
of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned
-[<a name="#p200" href="p200">page 200</a>] (<a href="#Contents">Contents</a>)
+[<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
<a name="7.8.2.4" href="#7.8.2.4"><b> 7.8.2.4 The wcstoimax and wcstoumax functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.17"><stddef.h></a> // for wchar_t
#include <a href="#7.8"><inttypes.h></a>
intmax_t wcstoimax(const wchar_t * restrict nptr,
wchar_t ** restrict endptr, int base);
uintmax_t wcstoumax(const wchar_t * restrict nptr,
wchar_t ** restrict endptr, int base);
- Description
+<b> Description</b>
2 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll,
wcstoul, and wcstoull functions except that the initial portion of the wide string is
converted to intmax_t and uintmax_t representation, respectively.
- Returns
+<b> Returns</b>
3 The wcstoimax function returns the converted value, if any. If no conversion could be
performed, zero is returned. If the correct value is outside the range of representable
values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the
-[<a name="#p201" href="p201">page 201</a>] (<a href="#Contents">Contents</a>)
+[<a name="p201" href="#p201">page 201</a>] (<a href="#Contents">Contents</a>)
<a name="7.9" href="#7.9"><b> 7.9 Alternative spellings <iso646.h></b></a>
1 The header <a href="#7.9"><iso646.h></a> defines the following eleven macros (on the left) that expand
-[<a name="#p202" href="p202">page 202</a>] (<a href="#Contents">Contents</a>)
+[<a name="p202" href="#p202">page 202</a>] (<a href="#Contents">Contents</a>)
<a name="7.10" href="#7.10"><b> 7.10 Sizes of integer types <limits.h></b></a>
1 The header <a href="#7.10"><limits.h></a> defines several macros that expand to various limits and
-[<a name="#p203" href="p203">page 203</a>] (<a href="#Contents">Contents</a>)
+[<a name="p203" href="#p203">page 203</a>] (<a href="#Contents">Contents</a>)
<a name="7.11" href="#7.11"><b> 7.11 Localization <locale.h></b></a>
1 The header <a href="#7.11"><locale.h></a> declares two functions, one type, and defines several macros.
-[<a name="#p204" href="p204">page 204</a>] (<a href="#Contents">Contents</a>)
+[<a name="p204" href="#p204">page 204</a>] (<a href="#Contents">Contents</a>)
3 The macros defined are NULL (described in <a href="#7.17">7.17</a>); and
LC_ALL
implementation.
<a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
<a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.11"><locale.h></a>
char *setlocale(int category, const char *locale);
- Description
+<b> Description</b>
2 The setlocale function selects the appropriate portion of the program's locale as
specified by the category and locale arguments. The setlocale function may be
used to change or query the program's entire current locale or portions thereof. The value
196) The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
isxdigit.
-[<a name="#p205" href="p205">page 205</a>] (<a href="#Contents">Contents</a>)
+[<a name="p205" href="#p205">page 205</a>] (<a href="#Contents">Contents</a>)
4 At program startup, the equivalent of
setlocale(LC_ALL, "C");
is executed.
5 The implementation shall behave as if no library function calls the setlocale function.
- Returns
+<b> Returns</b>
6 If a pointer to a string is given for locale and the selection can be honored, the
setlocale function returns a pointer to the string associated with the specified
category for the new locale. If the selection cannot be honored, the setlocale
strftime function (<a href="#7.23.3.5">7.23.3.5</a>), the strxfrm function (<a href="#7.21.4.5">7.21.4.5</a>).
<a name="7.11.2" href="#7.11.2"><b> 7.11.2 Numeric formatting convention inquiry</b></a>
<a name="7.11.2.1" href="#7.11.2.1"><b> 7.11.2.1 The localeconv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.11"><locale.h></a>
struct lconv *localeconv(void);
- Description
+<b> Description</b>
2 The localeconv function sets the components of an object with type struct lconv
with values appropriate for the formatting of numeric quantities (monetary and otherwise)
according to the rules of the current locale.
197) The implementation shall arrange to encode in a string the various categories due to a heterogeneous
locale when category has the value LC_ALL.
-[<a name="#p206" href="p206">page 206</a>] (<a href="#Contents">Contents</a>)
+[<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
strings shall start and end in the initial shift state. The members with type char are
nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not
succeeds the value for a negative locally formatted monetary quantity.
-[<a name="#p207" href="p207">page 207</a>] (<a href="#Contents">Contents</a>)
+[<a name="p207" href="#p207">page 207</a>] (<a href="#Contents">Contents</a>)
char p_sep_by_space
Set to a value indicating the separation of the currency_symbol, the
-[<a name="#p208" href="p208">page 208</a>] (<a href="#Contents">Contents</a>)
+[<a name="p208" href="#p208">page 208</a>] (<a href="#Contents">Contents</a>)
char int_n_sep_by_space
Set to a value indicating the separation of the int_curr_symbol, the
4 The sign string immediately succeeds the currency symbol.
-[<a name="#p209" href="p209">page 209</a>] (<a href="#Contents">Contents</a>)
+[<a name="p209" href="#p209">page 209</a>] (<a href="#Contents">Contents</a>)
7 The implementation shall behave as if no library function calls the localeconv
function.
- Returns
+<b> Returns</b>
8 The localeconv function returns a pointer to the filled-in object. The structure
pointed to by the return value shall not be modified by the program, but may be
overwritten by a subsequent call to the localeconv function. In addition, calls to the
-[<a name="#p210" href="p210">page 210</a>] (<a href="#Contents">Contents</a>)
+[<a name="p210" href="#p210">page 210</a>] (<a href="#Contents">Contents</a>)
11 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
affect the formatted value.
-[<a name="#p211" href="p211">page 211</a>] (<a href="#Contents">Contents</a>)
+[<a name="p211" href="#p211">page 211</a>] (<a href="#Contents">Contents</a>)
<a name="7.12" href="#7.12"><b> 7.12 Mathematics <math.h></b></a>
1 The header <a href="#7.12"><math.h></a> declares two types and many mathematical functions and defines
200) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
supports infinities.
-[<a name="#p212" href="p212">page 212</a>] (<a href="#Contents">Contents</a>)
+[<a name="p212" href="#p212">page 212</a>] (<a href="#Contents">Contents</a>)
translation time.201)
5 The macro
directly with a hardware multiply-add instruction. Software implementations are expected to be
substantially slower.
-[<a name="#p213" href="p213">page 213</a>] (<a href="#Contents">Contents</a>)
+[<a name="p213" href="#p213">page 213</a>] (<a href="#Contents">Contents</a>)
9 The macros
MATH_ERRNO
203) In an implementation that supports infinities, this allows an infinity as an argument to be a domain
error if the mathematical domain of the function does not include the infinity.
-[<a name="#p214" href="p214">page 214</a>] (<a href="#Contents">Contents</a>)
+[<a name="p214" href="#p214">page 214</a>] (<a href="#Contents">Contents</a>)
HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the
correct value of the function; if the integer expression math_errhandling &
math_errhandling & MATH_ERREXCEPT is nonzero, whether the ''underflow''
floating-point exception is raised is implementation-defined.
<a name="7.12.2" href="#7.12.2"><b> 7.12.2 The FP_CONTRACT pragma</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
#pragma STDC FP_CONTRACT on-off-switch
- Description
+<b> Description</b>
2 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the
state is ''off'') the implementation to contract expressions (<a href="#6.5">6.5</a>). Each pragma can occur
either outside external declarations or preceding all explicit declarations and statements
204) The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
also ''flush-to-zero'' underflow.
-[<a name="#p215" href="p215">page 215</a>] (<a href="#Contents">Contents</a>)
+[<a name="p215" href="#p215">page 215</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.3" href="#7.12.3"><b> 7.12.3 Classification macros</b></a>
1 In the synopses in this subclause, real-floating indicates that the argument shall be an
expression of real floating type.
<a name="7.12.3.1" href="#7.12.3.1"><b> 7.12.3.1 The fpclassify macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int fpclassify(real-floating x);
- Description
+<b> Description</b>
2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
subnormal, zero, or into another implementation-defined category. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
Then classification is based on the type of the argument.205)
- Returns
+<b> Returns</b>
3 The fpclassify macro returns the value of the number classification macro
appropriate to the value of its argument.
4 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as
__fpclassifyl(x))
<a name="7.12.3.2" href="#7.12.3.2"><b> 7.12.3.2 The isfinite macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isfinite(real-floating x);
- Description
+<b> Description</b>
2 The isfinite macro determines whether its argument has a finite value (zero,
subnormal, or normal, and not infinite or NaN). First, an argument represented in a
format wider than its semantic type is converted to its semantic type. Then determination
know the type that classification is based on. For example, a normal long double value might
become subnormal when converted to double, and zero when converted to float.
-[<a name="#p216" href="p216">page 216</a>] (<a href="#Contents">Contents</a>)
+[<a name="p216" href="#p216">page 216</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The isfinite macro returns a nonzero value if and only if its argument has a finite
value.
<a name="7.12.3.3" href="#7.12.3.3"><b> 7.12.3.3 The isinf macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isinf(real-floating x);
- Description
+<b> Description</b>
2 The isinf macro determines whether its argument value is an infinity (positive or
negative). First, an argument represented in a format wider than its semantic type is
converted to its semantic type. Then determination is based on the type of the argument.
- Returns
+<b> Returns</b>
3 The isinf macro returns a nonzero value if and only if its argument has an infinite
value.
<a name="7.12.3.4" href="#7.12.3.4"><b> 7.12.3.4 The isnan macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isnan(real-floating x);
- Description
+<b> Description</b>
2 The isnan macro determines whether its argument value is a NaN. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
Then determination is based on the type of the argument.206)
- Returns
+<b> Returns</b>
3 The isnan macro returns a nonzero value if and only if its argument has a NaN value.
<a name="7.12.3.5" href="#7.12.3.5"><b> 7.12.3.5 The isnormal macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isnormal(real-floating x);
206) For the isnan macro, the type for determination does not matter unless the implementation supports
NaNs in the evaluation type but not in the semantic type.
-[<a name="#p217" href="p217">page 217</a>] (<a href="#Contents">Contents</a>)
+[<a name="p217" href="#p217">page 217</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The isnormal macro determines whether its argument value is normal (neither zero,
subnormal, infinite, nor NaN). First, an argument represented in a format wider than its
semantic type is converted to its semantic type. Then determination is based on the type
of the argument.
- Returns
+<b> Returns</b>
3 The isnormal macro returns a nonzero value if and only if its argument has a normal
value.
<a name="7.12.3.6" href="#7.12.3.6"><b> 7.12.3.6 The signbit macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int signbit(real-floating x);
- Description
+<b> Description</b>
2 The signbit macro determines whether the sign of its argument value is negative.207)
- Returns
+<b> Returns</b>
3 The signbit macro returns a nonzero value if and only if the sign of its argument value
is negative.
<a name="7.12.4" href="#7.12.4"><b> 7.12.4 Trigonometric functions</b></a>
<a name="7.12.4.1" href="#7.12.4.1"><b> 7.12.4.1 The acos functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double acos(double x);
float acosf(float x);
long double acosl(long double x);
- Description
+<b> Description</b>
2 The acos functions compute the principal value of the arc cosine of x. A domain error
occurs for arguments not in the interval [-1, +1].
- Returns
+<b> Returns</b>
3 The acos functions return arccos x in the interval [0, pi ] radians.
207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
unsigned, it is treated as positive.
-[<a name="#p218" href="p218">page 218</a>] (<a href="#Contents">Contents</a>)
+[<a name="p218" href="#p218">page 218</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.4.2" href="#7.12.4.2"><b> 7.12.4.2 The asin functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double asin(double x);
float asinf(float x);
long double asinl(long double x);
- Description
+<b> Description</b>
2 The asin functions compute the principal value of the arc sine of x. A domain error
occurs for arguments not in the interval [-1, +1].
- Returns
+<b> Returns</b>
3 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians.
<a name="7.12.4.3" href="#7.12.4.3"><b> 7.12.4.3 The atan functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double atan(double x);
float atanf(float x);
long double atanl(long double x);
- Description
+<b> Description</b>
2 The atan functions compute the principal value of the arc tangent of x.
- Returns
+<b> Returns</b>
3 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians.
<a name="7.12.4.4" href="#7.12.4.4"><b> 7.12.4.4 The atan2 functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double atan2(double y, double x);
float atan2f(float y, float x);
long double atan2l(long double y, long double x);
- Description
+<b> Description</b>
2 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both
arguments to determine the quadrant of the return value. A domain error may occur if
both arguments are zero.
- Returns
+<b> Returns</b>
3 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians.
-[<a name="#p219" href="p219">page 219</a>] (<a href="#Contents">Contents</a>)
+[<a name="p219" href="#p219">page 219</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.4.5" href="#7.12.4.5"><b> 7.12.4.5 The cos functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double cos(double x);
float cosf(float x);
long double cosl(long double x);
- Description
+<b> Description</b>
2 The cos functions compute the cosine of x (measured in radians).
- Returns
+<b> Returns</b>
3 The cos functions return cos x.
<a name="7.12.4.6" href="#7.12.4.6"><b> 7.12.4.6 The sin functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double sin(double x);
float sinf(float x);
long double sinl(long double x);
- Description
+<b> Description</b>
2 The sin functions compute the sine of x (measured in radians).
- Returns
+<b> Returns</b>
3 The sin functions return sin x.
<a name="7.12.4.7" href="#7.12.4.7"><b> 7.12.4.7 The tan functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double tan(double x);
float tanf(float x);
long double tanl(long double x);
- Description
+<b> Description</b>
2 The tan functions return the tangent of x (measured in radians).
- Returns
+<b> Returns</b>
3 The tan functions return tan x.
-[<a name="#p220" href="p220">page 220</a>] (<a href="#Contents">Contents</a>)
+[<a name="p220" href="#p220">page 220</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.5" href="#7.12.5"><b> 7.12.5 Hyperbolic functions</b></a>
<a name="7.12.5.1" href="#7.12.5.1"><b> 7.12.5.1 The acosh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double acosh(double x);
float acoshf(float x);
long double acoshl(long double x);
- Description
+<b> Description</b>
2 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain
error occurs for arguments less than 1.
- Returns
+<b> Returns</b>
3 The acosh functions return arcosh x in the interval [0, +(inf)].
<a name="7.12.5.2" href="#7.12.5.2"><b> 7.12.5.2 The asinh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double asinh(double x);
float asinhf(float x);
long double asinhl(long double x);
- Description
+<b> Description</b>
2 The asinh functions compute the arc hyperbolic sine of x.
- Returns
+<b> Returns</b>
3 The asinh functions return arsinh x.
<a name="7.12.5.3" href="#7.12.5.3"><b> 7.12.5.3 The atanh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double atanh(double x);
float atanhf(float x);
long double atanhl(long double x);
- Description
+<b> Description</b>
2 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs
for arguments not in the interval [-1, +1]. A range error may occur if the argument
equals -1 or +1.
-[<a name="#p221" href="p221">page 221</a>] (<a href="#Contents">Contents</a>)
+[<a name="p221" href="#p221">page 221</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The atanh functions return artanh x.
<a name="7.12.5.4" href="#7.12.5.4"><b> 7.12.5.4 The cosh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double cosh(double x);
float coshf(float x);
long double coshl(long double x);
- Description
+<b> Description</b>
2 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the
magnitude of x is too large.
- Returns
+<b> Returns</b>
3 The cosh functions return cosh x.
<a name="7.12.5.5" href="#7.12.5.5"><b> 7.12.5.5 The sinh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double sinh(double x);
float sinhf(float x);
long double sinhl(long double x);
- Description
+<b> Description</b>
2 The sinh functions compute the hyperbolic sine of x. A range error occurs if the
magnitude of x is too large.
- Returns
+<b> Returns</b>
3 The sinh functions return sinh x.
<a name="7.12.5.6" href="#7.12.5.6"><b> 7.12.5.6 The tanh functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double tanh(double x);
float tanhf(float x);
long double tanhl(long double x);
- Description
+<b> Description</b>
2 The tanh functions compute the hyperbolic tangent of x.
-[<a name="#p222" href="p222">page 222</a>] (<a href="#Contents">Contents</a>)
+[<a name="p222" href="#p222">page 222</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The tanh functions return tanh x.
<a name="7.12.6" href="#7.12.6"><b> 7.12.6 Exponential and logarithmic functions</b></a>
<a name="7.12.6.1" href="#7.12.6.1"><b> 7.12.6.1 The exp functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double exp(double x);
float expf(float x);
long double expl(long double x);
- Description
+<b> Description</b>
2 The exp functions compute the base-e exponential of x. A range error occurs if the
magnitude of x is too large.
- Returns
+<b> Returns</b>
3 The exp functions return ex .
<a name="7.12.6.2" href="#7.12.6.2"><b> 7.12.6.2 The exp2 functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double exp2(double x);
float exp2f(float x);
long double exp2l(long double x);
- Description
+<b> Description</b>
2 The exp2 functions compute the base-2 exponential of x. A range error occurs if the
magnitude of x is too large.
- Returns
+<b> Returns</b>
3 The exp2 functions return 2x .
<a name="7.12.6.3" href="#7.12.6.3"><b> 7.12.6.3 The expm1 functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double expm1(double x);
float expm1f(float x);
-[<a name="#p223" href="p223">page 223</a>] (<a href="#Contents">Contents</a>)
+[<a name="p223" href="#p223">page 223</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
error occurs if x is too large.208)
- Returns
+<b> Returns</b>
3 The expm1 functions return ex - 1.
<a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double frexp(double value, int *exp);
float frexpf(float value, int *exp);
long double frexpl(long double value, int *exp);
- Description
+<b> Description</b>
2 The frexp functions break a floating-point number into a normalized fraction and an
integral power of 2. They store the integer in the int object pointed to by exp.
- Returns
+<b> Returns</b>
3 If value is not a floating-point number, the results are unspecified. Otherwise, the
frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or
zero, and value equals x x 2*exp . If value is zero, both parts of the result are zero.
<a name="7.12.6.5" href="#7.12.6.5"><b> 7.12.6.5 The ilogb functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int ilogb(double x);
int ilogbf(float x);
int ilogbl(long double x);
- Description
+<b> Description</b>
2 The ilogb functions extract the exponent of x as a signed int value. If x is zero they
compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is
a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling
208) For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
-[<a name="#p224" href="p224">page 224</a>] (<a href="#Contents">Contents</a>)
+[<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The ilogb functions return the exponent of x as a signed int value.
Forward references: the logb functions (<a href="#7.12.6.11">7.12.6.11</a>).
<a name="7.12.6.6" href="#7.12.6.6"><b> 7.12.6.6 The ldexp functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double ldexp(double x, int exp);
float ldexpf(float x, int exp);
long double ldexpl(long double x, int exp);
- Description
+<b> Description</b>
2 The ldexp functions multiply a floating-point number by an integral power of 2. A
range error may occur.
- Returns
+<b> Returns</b>
3 The ldexp functions return x x 2exp .
<a name="7.12.6.7" href="#7.12.6.7"><b> 7.12.6.7 The log functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double log(double x);
float logf(float x);
long double logl(long double x);
- Description
+<b> Description</b>
2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if
the argument is negative. A range error may occur if the argument is zero.
- Returns
+<b> Returns</b>
3 The log functions return loge x.
<a name="7.12.6.8" href="#7.12.6.8"><b> 7.12.6.8 The log10 functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double log10(double x);
float log10f(float x);
-[<a name="#p225" href="p225">page 225</a>] (<a href="#Contents">Contents</a>)
+[<a name="p225" href="#p225">page 225</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The log10 functions compute the base-10 (common) logarithm of x. A domain error
occurs if the argument is negative. A range error may occur if the argument is zero.
- Returns
+<b> Returns</b>
3 The log10 functions return log10 x.
<a name="7.12.6.9" href="#7.12.6.9"><b> 7.12.6.9 The log1p functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double log1p(double x);
float log1pf(float x);
long double log1pl(long double x);
- Description
+<b> Description</b>
2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.209)
A domain error occurs if the argument is less than -1. A range error may occur if the
argument equals -1.
- Returns
+<b> Returns</b>
3 The log1p functions return loge (1 + x).
<a name="7.12.6.10" href="#7.12.6.10"><b> 7.12.6.10 The log2 functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double log2(double x);
float log2f(float x);
long double log2l(long double x);
- Description
+<b> Description</b>
2 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the
argument is less than zero. A range error may occur if the argument is zero.
- Returns
+<b> Returns</b>
3 The log2 functions return log2 x.
209) For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
-[<a name="#p226" href="p226">page 226</a>] (<a href="#Contents">Contents</a>)
+[<a name="p226" href="#p226">page 226</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.6.11" href="#7.12.6.11"><b> 7.12.6.11 The logb functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double logb(double x);
float logbf(float x);
long double logbl(long double x);
- Description
+<b> Description</b>
2 The logb functions extract the exponent of x, as a signed integer value in floating-point
format. If x is subnormal it is treated as though it were normalized; thus, for positive
finite x,
1 <= x x FLT_RADIX-logb(x) < FLT_RADIX
A domain error or range error may occur if the argument is zero.
- Returns
+<b> Returns</b>
3 The logb functions return the signed exponent of x.
<a name="7.12.6.12" href="#7.12.6.12"><b> 7.12.6.12 The modf functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double modf(double value, double *iptr);
float modff(float value, float *iptr);
long double modfl(long double value, long double *iptr);
- Description
+<b> Description</b>
2 The modf functions break the argument value into integral and fractional parts, each of
which has the same type and sign as the argument. They store the integral part (in
floating-point format) in the object pointed to by iptr.
- Returns
+<b> Returns</b>
3 The modf functions return the signed fractional part of value.
-[<a name="#p227" href="p227">page 227</a>] (<a href="#Contents">Contents</a>)
+[<a name="p227" href="#p227">page 227</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.6.13" href="#7.12.6.13"><b> 7.12.6.13 The scalbn and scalbln functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double scalbn(double x, int n);
float scalbnf(float x, int n);
double scalbln(double x, long int n);
float scalblnf(float x, long int n);
long double scalblnl(long double x, long int n);
- Description
+<b> Description</b>
2 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
normally by computing FLT_RADIXn explicitly. A range error may occur.
- Returns
+<b> Returns</b>
3 The scalbn and scalbln functions return x x FLT_RADIXn .
<a name="7.12.7" href="#7.12.7"><b> 7.12.7 Power and absolute-value functions</b></a>
<a name="7.12.7.1" href="#7.12.7.1"><b> 7.12.7.1 The cbrt functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double cbrt(double x);
float cbrtf(float x);
long double cbrtl(long double x);
- Description
+<b> Description</b>
2 The cbrt functions compute the real cube root of x.
- Returns
+<b> Returns</b>
3 The cbrt functions return x1/3 .
<a name="7.12.7.2" href="#7.12.7.2"><b> 7.12.7.2 The fabs functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fabs(double x);
float fabsf(float x);
long double fabsl(long double x);
- Description
+<b> Description</b>
2 The fabs functions compute the absolute value of a floating-point number x.
-[<a name="#p228" href="p228">page 228</a>] (<a href="#Contents">Contents</a>)
+[<a name="p228" href="#p228">page 228</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The fabs functions return | x |.
<a name="7.12.7.3" href="#7.12.7.3"><b> 7.12.7.3 The hypot functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double hypot(double x, double y);
float hypotf(float x, float y);
long double hypotl(long double x, long double y);
- Description
+<b> Description</b>
2 The hypot functions compute the square root of the sum of the squares of x and y,
without undue overflow or underflow. A range error may occur.
3 Returns
???
???????????????
<a name="7.12.7.4" href="#7.12.7.4"><b> 7.12.7.4 The pow functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double pow(double x, double y);
float powf(float x, float y);
long double powl(long double x, long double y);
- Description
+<b> Description</b>
2 The pow functions compute x raised to the power y. A domain error occurs if x is finite
and negative and y is finite and not an integer value. A range error may occur. A domain
error may occur if x is zero and y is zero. A domain error or range error may occur if x
is zero and y is less than zero.
- Returns
+<b> Returns</b>
3 The pow functions return xy .
<a name="7.12.7.5" href="#7.12.7.5"><b> 7.12.7.5 The sqrt functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double sqrt(double x);
float sqrtf(float x);
-[<a name="#p229" href="p229">page 229</a>] (<a href="#Contents">Contents</a>)
+[<a name="p229" href="#p229">page 229</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The sqrt functions compute the nonnegative square root of x. A domain error occurs if
the argument is less than zero.
- Returns
+<b> Returns</b>
3 The sqrt functions return sqrt:x.
???
???
<a name="7.12.8" href="#7.12.8"><b> 7.12.8 Error and gamma functions</b></a>
<a name="7.12.8.1" href="#7.12.8.1"><b> 7.12.8.1 The erf functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double erf(double x);
float erff(float x);
long double erfl(long double x);
- Description
+<b> Description</b>
2 The erf functions compute the error function of x.
- Returns
+<b> Returns</b>
2 x
(integral)
3
??? 0
<a name="7.12.8.2" href="#7.12.8.2"><b> 7.12.8.2 The erfc functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double erfc(double x);
float erfcf(float x);
long double erfcl(long double x);
- Description
+<b> Description</b>
2 The erfc functions compute the complementary error function of x. A range error
occurs if x is too large.
- Returns
+<b> Returns</b>
2 (inf)
(integral)
3
-[<a name="#p230" href="p230">page 230</a>] (<a href="#Contents">Contents</a>)
+[<a name="p230" href="#p230">page 230</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.8.3" href="#7.12.8.3"><b> 7.12.8.3 The lgamma functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double lgamma(double x);
float lgammaf(float x);
long double lgammal(long double x);
- Description
+<b> Description</b>
2 The lgamma functions compute the natural logarithm of the absolute value of gamma of
x. A range error occurs if x is too large. A range error may occur if x is a negative
integer or zero.
- Returns
+<b> Returns</b>
3 The lgamma functions return loge | (Gamma)(x) |.
<a name="7.12.8.4" href="#7.12.8.4"><b> 7.12.8.4 The tgamma functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double tgamma(double x);
float tgammaf(float x);
long double tgammal(long double x);
- Description
+<b> Description</b>
2 The tgamma functions compute the gamma function of x. A domain error or range error
may occur if x is a negative integer or zero. A range error may occur if the magnitude of
x is too large or too small.
- Returns
+<b> Returns</b>
3 The tgamma functions return (Gamma)(x).
<a name="7.12.9" href="#7.12.9"><b> 7.12.9 Nearest integer functions</b></a>
<a name="7.12.9.1" href="#7.12.9.1"><b> 7.12.9.1 The ceil functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
- Description
+<b> Description</b>
2 The ceil functions compute the smallest integer value not less than x.
-[<a name="#p231" href="p231">page 231</a>] (<a href="#Contents">Contents</a>)
+[<a name="p231" href="#p231">page 231</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The ceil functions return ???x???, expressed as a floating-point number.
<a name="7.12.9.2" href="#7.12.9.2"><b> 7.12.9.2 The floor functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double floor(double x);
float floorf(float x);
long double floorl(long double x);
- Description
+<b> Description</b>
2 The floor functions compute the largest integer value not greater than x.
- Returns
+<b> Returns</b>
3 The floor functions return ???x???, expressed as a floating-point number.
<a name="7.12.9.3" href="#7.12.9.3"><b> 7.12.9.3 The nearbyint functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double nearbyint(double x);
float nearbyintf(float x);
long double nearbyintl(long double x);
- Description
+<b> Description</b>
2 The nearbyint functions round their argument to an integer value in floating-point
format, using the current rounding direction and without raising the ''inexact'' floating-
point exception.
- Returns
+<b> Returns</b>
3 The nearbyint functions return the rounded integer value.
<a name="7.12.9.4" href="#7.12.9.4"><b> 7.12.9.4 The rint functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double rint(double x);
float rintf(float x);
long double rintl(long double x);
- Description
+<b> Description</b>
2 The rint functions differ from the nearbyint functions (<a href="#7.12.9.3">7.12.9.3</a>) only in that the
rint functions may raise the ''inexact'' floating-point exception if the result differs in
value from the argument.
-[<a name="#p232" href="p232">page 232</a>] (<a href="#Contents">Contents</a>)
+[<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The rint functions return the rounded integer value.
<a name="7.12.9.5" href="#7.12.9.5"><b> 7.12.9.5 The lrint and llrint functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
long int lrint(double x);
long int lrintf(float x);
long long int llrint(double x);
long long int llrintf(float x);
long long int llrintl(long double x);
- Description
+<b> Description</b>
2 The lrint and llrint functions round their argument to the nearest integer value,
rounding according to the current rounding direction. If the rounded value is outside the
range of the return type, the numeric result is unspecified and a domain error or range
error may occur. *
- Returns
+<b> Returns</b>
3 The lrint and llrint functions return the rounded integer value.
<a name="7.12.9.6" href="#7.12.9.6"><b> 7.12.9.6 The round functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double round(double x);
float roundf(float x);
long double roundl(long double x);
- Description
+<b> Description</b>
2 The round functions round their argument to the nearest integer value in floating-point
format, rounding halfway cases away from zero, regardless of the current rounding
direction.
- Returns
+<b> Returns</b>
3 The round functions return the rounded integer value.
-[<a name="#p233" href="p233">page 233</a>] (<a href="#Contents">Contents</a>)
+[<a name="p233" href="#p233">page 233</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.9.7" href="#7.12.9.7"><b> 7.12.9.7 The lround and llround functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
long int lround(double x);
long int lroundf(float x);
long long int llround(double x);
long long int llroundf(float x);
long long int llroundl(long double x);
- Description
+<b> Description</b>
2 The lround and llround functions round their argument to the nearest integer value,
rounding halfway cases away from zero, regardless of the current rounding direction. If
the rounded value is outside the range of the return type, the numeric result is unspecified
and a domain error or range error may occur.
- Returns
+<b> Returns</b>
3 The lround and llround functions return the rounded integer value.
<a name="7.12.9.8" href="#7.12.9.8"><b> 7.12.9.8 The trunc functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double trunc(double x);
float truncf(float x);
long double truncl(long double x);
- Description
+<b> Description</b>
2 The trunc functions round their argument to the integer value, in floating format,
nearest to but no larger in magnitude than the argument.
- Returns
+<b> Returns</b>
3 The trunc functions return the truncated integer value.
-[<a name="#p234" href="p234">page 234</a>] (<a href="#Contents">Contents</a>)
+[<a name="p234" href="#p234">page 234</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.10" href="#7.12.10"><b> 7.12.10 Remainder functions</b></a>
<a name="7.12.10.1" href="#7.12.10.1"><b> 7.12.10.1 The fmod functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fmod(double x, double y);
float fmodf(float x, float y);
long double fmodl(long double x, long double y);
- Description
+<b> Description</b>
2 The fmod functions compute the floating-point remainder of x/y.
- Returns
+<b> Returns</b>
3 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero,
the result has the same sign as x and magnitude less than the magnitude of y. If y is zero,
whether a domain error occurs or the fmod functions return zero is implementation-
defined.
<a name="7.12.10.2" href="#7.12.10.2"><b> 7.12.10.2 The remainder functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double remainder(double x, double y);
float remainderf(float x, float y);
long double remainderl(long double x, long double y);
- Description
+<b> Description</b>
2 The remainder functions compute the remainder x REM y required by IEC 60559.210)
- Returns
+<b> Returns</b>
3 The remainder functions return x REM y. If y is zero, whether a domain error occurs
or the functions return zero is implementation defined.
| n - x/y | = 1/2, then n is even. Thus, the remainder is always exact. If r = 0, its sign shall be that of
x.'' This definition is applicable for all implementations.
-[<a name="#p235" href="p235">page 235</a>] (<a href="#Contents">Contents</a>)
+[<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.10.3" href="#7.12.10.3"><b> 7.12.10.3 The remquo functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double remquo(double x, double y, int *quo);
float remquof(float x, float y, int *quo);
long double remquol(long double x, long double y,
int *quo);
- Description
+<b> Description</b>
2 The remquo functions compute the same remainder as the remainder functions. In
the object pointed to by quo they store a value whose sign is the sign of x/y and whose
magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where
n is an implementation-defined integer greater than or equal to 3.
- Returns
+<b> Returns</b>
3 The remquo functions return x REM y. If y is zero, the value stored in the object
pointed to by quo is unspecified and whether a domain error occurs or the functions
return zero is implementation defined.
<a name="7.12.11" href="#7.12.11"><b> 7.12.11 Manipulation functions</b></a>
<a name="7.12.11.1" href="#7.12.11.1"><b> 7.12.11.1 The copysign functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double copysign(double x, double y);
float copysignf(float x, float y);
long double copysignl(long double x, long double y);
- Description
+<b> Description</b>
2 The copysign functions produce a value with the magnitude of x and the sign of y.
They produce a NaN (with the sign of y) if x is a NaN. On implementations that
represent a signed zero but do not treat negative zero consistently in arithmetic
operations, the copysign functions regard the sign of zero as positive.
- Returns
+<b> Returns</b>
3 The copysign functions return a value with the magnitude of x and the sign of y.
-[<a name="#p236" href="p236">page 236</a>] (<a href="#Contents">Contents</a>)
+[<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.11.2" href="#7.12.11.2"><b> 7.12.11.2 The nan functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double nan(const char *tagp);
float nanf(const char *tagp);
long double nanl(const char *tagp);
- Description
+<b> Description</b>
2 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char-
sequence)", (char**) NULL); the call nan("") is equivalent to
strtod("NAN()", (char**) NULL). If tagp does not point to an n-char
sequence or an empty string, the call is equivalent to strtod("NAN", (char**)
NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof
and strtold.
- Returns
+<b> Returns</b>
3 The nan functions return a quiet NaN, if available, with content indicated through tagp.
If the implementation does not support quiet NaNs, the functions return zero.
Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
<a name="7.12.11.3" href="#7.12.11.3"><b> 7.12.11.3 The nextafter functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double nextafter(double x, double y);
float nextafterf(float x, float y);
long double nextafterl(long double x, long double y);
- Description
+<b> Description</b>
2 The nextafter functions determine the next representable value, in the type of the
function, after x in the direction of y, where x and y are first converted to the type of the
function.211) The nextafter functions return y if x equals y. A range error may occur
if the magnitude of x is the largest finite value representable in the type and the result is
infinite or not representable in the type.
- Returns
+<b> Returns</b>
3 The nextafter functions return the next representable value in the specified format
after x in the direction of y.
211) The argument values are converted to the type of the function, even by a macro implementation of the
function.
-[<a name="#p237" href="p237">page 237</a>] (<a href="#Contents">Contents</a>)
+[<a name="p237" href="#p237">page 237</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.11.4" href="#7.12.11.4"><b> 7.12.11.4 The nexttoward functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double nexttoward(double x, long double y);
float nexttowardf(float x, long double y);
long double nexttowardl(long double x, long double y);
- Description
+<b> Description</b>
2 The nexttoward functions are equivalent to the nextafter functions except that the
second parameter has type long double and the functions return y converted to the
type of the function if x equals y.212)
<a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
<a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fdim(double x, double y);
float fdimf(float x, float y);
long double fdiml(long double x, long double y);
- Description
+<b> Description</b>
2 The fdim functions determine the positive difference between their arguments:
???x - y if x > y
???
???+0 if x <= y
A range error may occur.
- Returns
+<b> Returns</b>
3 The fdim functions return the positive difference value.
<a name="7.12.12.2" href="#7.12.12.2"><b> 7.12.12.2 The fmax functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fmax(double x, double y);
float fmaxf(float x, float y);
212) The result of the nexttoward functions is determined in the type of the function, without loss of
range or precision in a floating second argument.
-[<a name="#p238" href="p238">page 238</a>] (<a href="#Contents">Contents</a>)
+[<a name="p238" href="#p238">page 238</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The fmax functions determine the maximum numeric value of their arguments.213)
- Returns
+<b> Returns</b>
3 The fmax functions return the maximum numeric value of their arguments.
<a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fmin(double x, double y);
float fminf(float x, float y);
long double fminl(long double x, long double y);
- Description
+<b> Description</b>
2 The fmin functions determine the minimum numeric value of their arguments.214)
- Returns
+<b> Returns</b>
3 The fmin functions return the minimum numeric value of their arguments.
<a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
<a name="7.12.13.1" href="#7.12.13.1"><b> 7.12.13.1 The fma functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y,
long double z);
- Description
+<b> Description</b>
2 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
the value (as if) to infinite precision and round once to the result format, according to the
current rounding mode. A range error may occur.
- Returns
+<b> Returns</b>
3 The fma functions return (x x y) + z, rounded as one ternary operation.
fmax functions choose the numeric value. See <a href="#F.9.9.2">F.9.9.2</a>.
214) The fmin functions are analogous to the fmax functions in their treatment of NaNs.
-[<a name="#p239" href="p239">page 239</a>] (<a href="#Contents">Contents</a>)
+[<a name="p239" href="#p239">page 239</a>] (<a href="#Contents">Contents</a>)
<a name="7.12.14" href="#7.12.14"><b> 7.12.14 Comparison macros</b></a>
1 The relational and equality operators support the usual mathematical relationships
the synopses in this subclause, real-floating indicates that the argument shall be an
expression of real floating type.
<a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isgreater(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The isgreater macro determines whether its first argument is greater than its second
argument. The value of isgreater(x, y) is always equal to (x) > (y); however,
unlike (x) > (y), isgreater(x, y) does not raise the ''invalid'' floating-point
exception when x and y are unordered.
- Returns
+<b> Returns</b>
3 The isgreater macro returns the value of (x) > (y).
<a name="7.12.14.2" href="#7.12.14.2"><b> 7.12.14.2 The isgreaterequal macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isgreaterequal(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The isgreaterequal macro determines whether its first argument is greater than or
equal to its second argument. The value of isgreaterequal(x, y) is always equal
to (x) >= (y); however, unlike (x) >= (y), isgreaterequal(x, y) does
the operands compare unordered, as an error indicator for programs written without consideration of
NaNs; the result in these cases is false.
-[<a name="#p240" href="p240">page 240</a>] (<a href="#Contents">Contents</a>)
+[<a name="p240" href="#p240">page 240</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The isgreaterequal macro returns the value of (x) >= (y).
<a name="7.12.14.3" href="#7.12.14.3"><b> 7.12.14.3 The isless macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isless(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The isless macro determines whether its first argument is less than its second
argument. The value of isless(x, y) is always equal to (x) < (y); however,
unlike (x) < (y), isless(x, y) does not raise the ''invalid'' floating-point
exception when x and y are unordered.
- Returns
+<b> Returns</b>
3 The isless macro returns the value of (x) < (y).
<a name="7.12.14.4" href="#7.12.14.4"><b> 7.12.14.4 The islessequal macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int islessequal(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The islessequal macro determines whether its first argument is less than or equal to
its second argument. The value of islessequal(x, y) is always equal to
(x) <= (y); however, unlike (x) <= (y), islessequal(x, y) does not raise
the ''invalid'' floating-point exception when x and y are unordered.
- Returns
+<b> Returns</b>
3 The islessequal macro returns the value of (x) <= (y).
<a name="7.12.14.5" href="#7.12.14.5"><b> 7.12.14.5 The islessgreater macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int islessgreater(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The islessgreater macro determines whether its first argument is less than or
greater than its second argument. The islessgreater(x, y) macro is similar to
(x) < (y) || (x) > (y); however, islessgreater(x, y) does not raise
the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x
and y twice).
-[<a name="#p241" href="p241">page 241</a>] (<a href="#Contents">Contents</a>)
+[<a name="p241" href="#p241">page 241</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The islessgreater macro returns the value of (x) < (y) || (x) > (y).
<a name="7.12.14.6" href="#7.12.14.6"><b> 7.12.14.6 The isunordered macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
int isunordered(real-floating x, real-floating y);
- Description
+<b> Description</b>
2 The isunordered macro determines whether its arguments are unordered.
- Returns
+<b> Returns</b>
3 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise.
-[<a name="#p242" href="p242">page 242</a>] (<a href="#Contents">Contents</a>)
+[<a name="p242" href="#p242">page 242</a>] (<a href="#Contents">Contents</a>)
<a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps <setjmp.h></b></a>
1 The header <a href="#7.13"><setjmp.h></a> defines the macro setjmp, and declares one function and
program defines an external identifier with the name setjmp, the behavior is undefined.
<a name="7.13.1" href="#7.13.1"><b> 7.13.1 Save calling environment</b></a>
<a name="7.13.1.1" href="#7.13.1.1"><b> 7.13.1.1 The setjmp macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.13"><setjmp.h></a>
int setjmp(jmp_buf env);
- Description
+<b> Description</b>
2 The setjmp macro saves its calling environment in its jmp_buf argument for later use
by the longjmp function.
- Returns
+<b> Returns</b>
3 If the return is from a direct invocation, the setjmp macro returns the value zero. If the
return is from a call to the longjmp function, the setjmp macro returns a nonzero
value.
216) These functions are useful for dealing with unusual conditions encountered in a low-level function of
a program.
-[<a name="#p243" href="p243">page 243</a>] (<a href="#Contents">Contents</a>)
+[<a name="p243" href="#p243">page 243</a>] (<a href="#Contents">Contents</a>)
expression of a selection or iteration statement;
-- the operand of a unary ! operator with the resulting expression being the entire
5 If the invocation appears in any other context, the behavior is undefined.
<a name="7.13.2" href="#7.13.2"><b> 7.13.2 Restore calling environment</b></a>
<a name="7.13.2.1" href="#7.13.2.1"><b> 7.13.2.1 The longjmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.13"><setjmp.h></a>
void longjmp(jmp_buf env, int val);
- Description
+<b> Description</b>
2 The longjmp function restores the environment saved by the most recent invocation of
the setjmp macro in the same invocation of the program with the corresponding
jmp_buf argument. If there has been no such invocation, or if the function containing
invocation of the corresponding setjmp macro that do not have volatile-qualified type
and have been changed between the setjmp invocation and longjmp call are
indeterminate.
- Returns
+<b> Returns</b>
4 After longjmp is completed, program execution continues as if the corresponding
invocation of the setjmp macro had just returned the value specified by val. The
longjmp function cannot cause the setjmp macro to return the value 0; if val is 0,
transfer to a setjmp invocation in a function earlier in the set of nested calls.
218) This includes, but is not limited to, the floating-point status flags and the state of open files.
-[<a name="#p244" href="p244">page 244</a>] (<a href="#Contents">Contents</a>)
+[<a name="p244" href="#p244">page 244</a>] (<a href="#Contents">Contents</a>)
#include <a href="#7.13"><setjmp.h></a>
jmp_buf buf;
-[<a name="#p245" href="p245">page 245</a>] (<a href="#Contents">Contents</a>)
+[<a name="p245" href="#p245">page 245</a>] (<a href="#Contents">Contents</a>)
<a name="7.14" href="#7.14"><b> 7.14 Signal handling <signal.h></b></a>
1 The header <a href="#7.14"><signal.h></a> declares a type and two functions and defines several macros,
(respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
and termination.
-[<a name="#p246" href="p246">page 246</a>] (<a href="#Contents">Contents</a>)
+[<a name="p246" href="#p246">page 246</a>] (<a href="#Contents">Contents</a>)
<a name="7.14.1" href="#7.14.1"><b> 7.14.1 Specify signal handling</b></a>
<a name="7.14.1.1" href="#7.14.1.1"><b> 7.14.1.1 The signal function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.14"><signal.h></a>
void (*signal(int sig, void (*func)(int)))(int);
- Description
+<b> Description</b>
2 The signal function chooses one of three ways in which receipt of the signal number
sig is to be subsequently handled. If the value of func is SIG_DFL, default handling
for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
220) If any signal is generated by an asynchronous signal handler, the behavior is undefined.
-[<a name="#p247" href="p247">page 247</a>] (<a href="#Contents">Contents</a>)
+[<a name="p247" href="#p247">page 247</a>] (<a href="#Contents">Contents</a>)
may be executed for some signals selected in an implementation-defined manner; the
equivalent of
signal(sig, SIG_DFL);
is executed for all other signals defined by the implementation.
7 The implementation shall behave as if no library function calls the signal function.
- Returns
+<b> Returns</b>
8 If the request can be honored, the signal function returns the value of func for the
most recent successful call to signal for the specified signal sig. Otherwise, a value of
SIG_ERR is returned and a positive value is stored in errno.
_Exit function (<a href="#7.20.4.4">7.20.4.4</a>).
<a name="7.14.2" href="#7.14.2"><b> 7.14.2 Send signal</b></a>
<a name="7.14.2.1" href="#7.14.2.1"><b> 7.14.2.1 The raise function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.14"><signal.h></a>
int raise(int sig);
- Description
+<b> Description</b>
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
signal handler is called, the raise function shall not return until after the signal handler
does.
- Returns
+<b> Returns</b>
3 The raise function returns zero if successful, nonzero if unsuccessful.
-[<a name="#p248" href="p248">page 248</a>] (<a href="#Contents">Contents</a>)
+[<a name="p248" href="#p248">page 248</a>] (<a href="#Contents">Contents</a>)
<a name="7.15" href="#7.15"><b> 7.15 Variable arguments <stdarg.h></b></a>
1 The header <a href="#7.15"><stdarg.h></a> declares a type and defines four macros, for advancing
shall be matched by a corresponding invocation of the va_end macro in the same
function.
<a name="7.15.1.1" href="#7.15.1.1"><b> 7.15.1.1 The va_arg macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
type va_arg(va_list ap, type);
- Description
+<b> Description</b>
2 The va_arg macro expands to an expression that has the specified type and the value of
the next argument in the call. The parameter ap shall have been initialized by the
va_start or va_copy macro (without an intervening invocation of the va_end
221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
case the original function may make further use of the original list after the other function returns.
-[<a name="#p249" href="p249">page 249</a>] (<a href="#Contents">Contents</a>)
+[<a name="p249" href="#p249">page 249</a>] (<a href="#Contents">Contents</a>)
macro for the same ap). Each invocation of the va_arg macro modifies ap so that the
values of successive arguments are returned in turn. The parameter type shall be a type
-- one type is a signed integer type, the other type is the corresponding unsigned integer
type, and the value is representable in both types;
-- one type is pointer to void and the other is a pointer to a character type.
- Returns
+<b> Returns</b>
3 The first invocation of the va_arg macro after that of the va_start macro returns the
value of the argument after that specified by parmN . Successive invocations return the
values of the remaining arguments in succession.
<a name="7.15.1.2" href="#7.15.1.2"><b> 7.15.1.2 The va_copy macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
void va_copy(va_list dest, va_list src);
- Description
+<b> Description</b>
2 The va_copy macro initializes dest as a copy of src, as if the va_start macro had
been applied to dest followed by the same sequence of uses of the va_arg macro as
had previously been used to reach the present state of src. Neither the va_copy nor
va_start macro shall be invoked to reinitialize dest without an intervening
invocation of the va_end macro for the same dest.
- Returns
+<b> Returns</b>
3 The va_copy macro returns no value.
<a name="7.15.1.3" href="#7.15.1.3"><b> 7.15.1.3 The va_end macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
void va_end(va_list ap);
- Description
+<b> Description</b>
2 The va_end macro facilitates a normal return from the function whose variable
argument list was referred to by the expansion of the va_start macro, or the function
containing the expansion of the va_copy macro, that initialized the va_list ap. The
va_end macro may modify ap so that it is no longer usable (without being reinitialized
-[<a name="#p250" href="p250">page 250</a>] (<a href="#Contents">Contents</a>)
+[<a name="p250" href="#p250">page 250</a>] (<a href="#Contents">Contents</a>)
by the va_start or va_copy macro). If there is no corresponding invocation of the
va_start or va_copy macro, or if the va_end macro is not invoked before the
return, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The va_end macro returns no value.
<a name="7.15.1.4" href="#7.15.1.4"><b> 7.15.1.4 The va_start macro</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
void va_start(va_list ap, parmN);
- Description
+<b> Description</b>
2 The va_start macro shall be invoked before any access to the unnamed arguments.
3 The va_start macro initializes ap for subsequent use by the va_arg and va_end
macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap
parmN is declared with the register storage class, with a function or array type, or
with a type that is not compatible with the type that results after application of the default
argument promotions, the behavior is undefined.
- Returns
+<b> Returns</b>
5 The va_start macro returns no value.
6 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not
more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of
-[<a name="#p251" href="p251">page 251</a>] (<a href="#Contents">Contents</a>)
+[<a name="p251" href="#p251">page 251</a>] (<a href="#Contents">Contents</a>)
if (n_ptrs > MAXARGS)
n_ptrs = MAXARGS;
-[<a name="#p252" href="p252">page 252</a>] (<a href="#Contents">Contents</a>)
+[<a name="p252" href="#p252">page 252</a>] (<a href="#Contents">Contents</a>)
<a name="7.16" href="#7.16"><b> 7.16 Boolean type and values <stdbool.h></b></a>
1 The header <a href="#7.16"><stdbool.h></a> defines four macros.
222) See ''future library directions'' (<a href="#7.26.7">7.26.7</a>).
-[<a name="#p253" href="p253">page 253</a>] (<a href="#Contents">Contents</a>)
+[<a name="p253" href="#p253">page 253</a>] (<a href="#Contents">Contents</a>)
<a name="7.17" href="#7.17"><b> 7.17 Common definitions <stddef.h></b></a>
1 The following types and macros are defined in the standard header <a href="#7.17"><stddef.h></a>. Some
-[<a name="#p254" href="p254">page 254</a>] (<a href="#Contents">Contents</a>)
+[<a name="p254" href="#p254">page 254</a>] (<a href="#Contents">Contents</a>)
<a name="7.18" href="#7.18"><b> 7.18 Integer types <stdint.h></b></a>
1 The header <a href="#7.18"><stdint.h></a> declares sets of integer types having specified widths, and
223) See ''future library directions'' (<a href="#7.26.8">7.26.8</a>).
224) Some of these types may denote implementation-defined extended integer types.
-[<a name="#p255" href="p255">page 255</a>] (<a href="#Contents">Contents</a>)
+[<a name="p255" href="#p255">page 255</a>] (<a href="#Contents">Contents</a>)
<a name="7.18.1.1" href="#7.18.1.1"><b> 7.18.1.1 Exact-width integer types</b></a>
1 The typedef name intN_t designates a signed integer type with width N , no padding
grounds for choosing one type over another, it will simply pick some integer type satisfying the
signedness and width requirements.
-[<a name="#p256" href="p256">page 256</a>] (<a href="#Contents">Contents</a>)
+[<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
3 The following types are required:
int_fast8_t uint_fast8_t
<a name="7.18.2" href="#7.18.2"><b> 7.18.2 Limits of specified-width integer types</b></a>
1 The following object-like macros226) specify the minimum and maximum limits of the
types declared in <a href="#7.18"><stdint.h></a>. Each macro name corresponds to a similar type name in
-<a name="7.18.1" href="#7.18.1"><b> 7.18.1.</b></a>
+ <a href="#7.18.1">7.18.1</a>.
2 Each instance of any defined macro shall be replaced by a constant expression suitable
for use in #if preprocessing directives, and this expression shall have the same type as
would an expression that is an object of the corresponding type converted according to
226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
before <a href="#7.18"><stdint.h></a> is included.
-[<a name="#p257" href="p257">page 257</a>] (<a href="#Contents">Contents</a>)
+[<a name="p257" href="#p257">page 257</a>] (<a href="#Contents">Contents</a>)
the integer promotions. Its implementation-defined value shall be equal to or greater in
magnitude (absolute value) than the corresponding value given below, with the same sign,
-[<a name="#p258" href="p258">page 258</a>] (<a href="#Contents">Contents</a>)
+[<a name="p258" href="#p258">page 258</a>] (<a href="#Contents">Contents</a>)
-- maximum value of pointer-holding unsigned integer type
UINTPTR_MAX 216 - 1
before <a href="#7.18"><stdint.h></a> is included.
228) A freestanding implementation need not provide all of these types.
-[<a name="#p259" href="p259">page 259</a>] (<a href="#Contents">Contents</a>)
+[<a name="p259" href="#p259">page 259</a>] (<a href="#Contents">Contents</a>)
WCHAR_MIN see below
WCHAR_MAX see below
1 The following function-like macros230) expand to integer constants suitable for
initializing objects that have integer types corresponding to types defined in
<a href="#7.18"><stdint.h></a>. Each macro name corresponds to a similar type name in <a href="#7.18.1.2">7.18.1.2</a> or
-<a name="7.18.1.5" href="#7.18.1.5"><b> 7.18.1.5.</b></a>
+ <a href="#7.18.1.5">7.18.1.5</a>.
2 The argument in any instance of these macros shall be an unsuffixed integer constant (as
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.
3 Each invocation of one of these macros shall expand to an integer constant expression
230) C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
defined before <a href="#7.18"><stdint.h></a> is included.
-[<a name="#p260" href="p260">page 260</a>] (<a href="#Contents">Contents</a>)
+[<a name="p260" href="#p260">page 260</a>] (<a href="#Contents">Contents</a>)
<a name="7.18.4.1" href="#7.18.4.1"><b> 7.18.4.1 Macros for minimum-width integer constants</b></a>
1 The macro INTN_C(value) shall expand to an integer constant expression
-[<a name="#p261" href="p261">page 261</a>] (<a href="#Contents">Contents</a>)
+[<a name="p261" href="#p261">page 261</a>] (<a href="#Contents">Contents</a>)
<a name="7.19" href="#7.19"><b> 7.19 Input/output <stdio.h></b></a>
<a name="7.19.1" href="#7.19.1"><b> 7.19.1 Introduction</b></a>
-[<a name="#p262" href="p262">page 262</a>] (<a href="#Contents">Contents</a>)
+[<a name="p262" href="#p262">page 262</a>] (<a href="#Contents">Contents</a>)
guarantees can be opened;231)
L_tmpnam
string. Of course, file name string contents are subject to other system-specific constraints; therefore
all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
-[<a name="#p263" href="p263">page 263</a>] (<a href="#Contents">Contents</a>)
+[<a name="p263" href="#p263">page 263</a>] (<a href="#Contents">Contents</a>)
-- The wide character input/output functions -- the union of the ungetwc function, the
wide character input functions, and the wide character output functions.
implementation, there need be no new-line characters in a text stream nor any limit to the length of a
line.
-[<a name="#p264" href="p264">page 264</a>] (<a href="#Contents">Contents</a>)
+[<a name="p264" href="#p264">page 264</a>] (<a href="#Contents">Contents</a>)
stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
been applied to a stream without orientation, the stream becomes a byte-oriented stream.
233) The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
-[<a name="#p265" href="p265">page 265</a>] (<a href="#Contents">Contents</a>)
+[<a name="p265" href="#p265">page 265</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.3" href="#7.19.3"><b> 7.19.3 Files</b></a>
1 A stream is associated with an external file (which may be a physical device) by opening
6 The address of the FILE object used to control a stream may be significant; a copy of a
FILE object need not serve in place of the original.
-[<a name="#p266" href="p266">page 266</a>] (<a href="#Contents">Contents</a>)
+[<a name="p266" href="#p266">page 266</a>] (<a href="#Contents">Contents</a>)
7 At program startup, three text streams are predefined and need not be opened explicitly
-- standard input (for reading conventional input), standard output (for writing
undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
with state-dependent encoding that does not assuredly end in the initial shift state.
-[<a name="#p267" href="p267">page 267</a>] (<a href="#Contents">Contents</a>)
+[<a name="p267" href="#p267">page 267</a>] (<a href="#Contents">Contents</a>)
multibyte character. The wide character input/output functions and the byte input/output
functions store the value of the macro EILSEQ in errno if and only if an encoding error
(<a href="#7.24.6.3.2">7.24.6.3.2</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
<a name="7.19.4" href="#7.19.4"><b> 7.19.4 Operations on files</b></a>
<a name="7.19.4.1" href="#7.19.4.1"><b> 7.19.4.1 The remove function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int remove(const char *filename);
- Description
+<b> Description</b>
2 The remove function causes the file whose name is the string pointed to by filename
to be no longer accessible by that name. A subsequent attempt to open that file using that
name will fail, unless it is created anew. If the file is open, the behavior of the remove
function is implementation-defined.
- Returns
+<b> Returns</b>
3 The remove function returns zero if the operation succeeds, nonzero if it fails.
<a name="7.19.4.2" href="#7.19.4.2"><b> 7.19.4.2 The rename function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int rename(const char *old, const char *new);
- Description
+<b> Description</b>
2 The rename function causes the file whose name is the string pointed to by old to be
henceforth known by the name given by the string pointed to by new. The file named
old is no longer accessible by that name. If a file named by the string pointed to by new
-[<a name="#p268" href="p268">page 268</a>] (<a href="#Contents">Contents</a>)
+[<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The rename function returns zero if the operation succeeds, nonzero if it fails,235) in
which case if the file existed previously it is still known by its original name.
<a name="7.19.4.3" href="#7.19.4.3"><b> 7.19.4.3 The tmpfile function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
FILE *tmpfile(void);
- Description
+<b> Description</b>
2 The tmpfile function creates a temporary binary file that is different from any other
existing file and that will automatically be removed when it is closed or at program
termination. If the program terminates abnormally, whether an open temporary file is
program (this limit may be shared with tmpnam) and there should be no limit on the
number simultaneously open other than this limit and any limit on the number of open
files (FOPEN_MAX).
- Returns
+<b> Returns</b>
4 The tmpfile function returns a pointer to the stream of the file that it created. If the file
cannot be created, the tmpfile function returns a null pointer.
Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
<a name="7.19.4.4" href="#7.19.4.4"><b> 7.19.4.4 The tmpnam function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
char *tmpnam(char *s);
- Description
+<b> Description</b>
2 The tmpnam function generates a string that is a valid file name and that is not the same
as the name of an existing file.236) The function is potentially capable of generating
implementation. It is still necessary to use the remove function to remove such files when their use
is ended, and before program termination.
-[<a name="#p269" href="p269">page 269</a>] (<a href="#Contents">Contents</a>)
+[<a name="p269" href="#p269">page 269</a>] (<a href="#Contents">Contents</a>)
TMP_MAX different strings, but any or all of them may already be in use by existing files
and thus not be suitable return values.
3 The tmpnam function generates a different string each time it is called.
4 The implementation shall behave as if no library function calls the tmpnam function.
- Returns
+<b> Returns</b>
5 If no suitable string can be generated, the tmpnam function returns a null pointer.
Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an
internal static object and returns a pointer to that object (subsequent calls to the tmpnam
6 The value of the macro TMP_MAX shall be at least 25.
<a name="7.19.5" href="#7.19.5"><b> 7.19.5 File access functions</b></a>
<a name="7.19.5.1" href="#7.19.5.1"><b> 7.19.5.1 The fclose function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fclose(FILE *stream);
- Description
+<b> Description</b>
2 A successful call to the fclose function causes the stream pointed to by stream to be
flushed and the associated file to be closed. Any unwritten buffered data for the stream
are delivered to the host environment to be written to the file; any unread buffered data
are discarded. Whether or not the call succeeds, the stream is disassociated from the file
and any buffer set by the setbuf or setvbuf function is disassociated from the stream
(and deallocated if it was automatically allocated).
- Returns
+<b> Returns</b>
3 The fclose function returns zero if the stream was successfully closed, or EOF if any
errors were detected.
<a name="7.19.5.2" href="#7.19.5.2"><b> 7.19.5.2 The fflush function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fflush(FILE *stream);
-[<a name="#p270" href="p270">page 270</a>] (<a href="#Contents">Contents</a>)
+[<a name="p270" href="#p270">page 270</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 If stream points to an output stream or an update stream in which the most recent
operation was not input, the fflush function causes any unwritten data for that stream
to be delivered to the host environment to be written to the file; otherwise, the behavior is
undefined.
3 If stream is a null pointer, the fflush function performs this flushing action on all
streams for which the behavior is defined above.
- Returns
+<b> Returns</b>
4 The fflush function sets the error indicator for the stream and returns EOF if a write
error occurs, otherwise it returns zero.
Forward references: the fopen function (<a href="#7.19.5.3">7.19.5.3</a>).
<a name="7.19.5.3" href="#7.19.5.3"><b> 7.19.5.3 The fopen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
FILE *fopen(const char * restrict filename,
const char * restrict mode);
- Description
+<b> Description</b>
2 The fopen function opens the file whose name is the string pointed to by filename,
and associates a stream with it.
3 The argument mode points to a string. If the string is one of the following, the file is
remaining characters, or it might use them to select different kinds of a file (some of which might not
conform to the properties in <a href="#7.19.2">7.19.2</a>).
-[<a name="#p271" href="p271">page 271</a>] (<a href="#Contents">Contents</a>)
+[<a name="p271" href="#p271">page 271</a>] (<a href="#Contents">Contents</a>)
r+b or rb+ open binary file for update (reading and writing)
w+b or wb+ truncate to zero length or create binary file for update
binary stream in some implementations.
7 When opened, a stream is fully buffered if and only if it can be determined not to refer to
an interactive device. The error and end-of-file indicators for the stream are cleared.
- Returns
+<b> Returns</b>
8 The fopen function returns a pointer to the object controlling the stream. If the open
operation fails, fopen returns a null pointer.
Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
<a name="7.19.5.4" href="#7.19.5.4"><b> 7.19.5.4 The freopen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
FILE *freopen(const char * restrict filename,
const char * restrict mode,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The freopen function opens the file whose name is the string pointed to by filename
and associates the stream pointed to by stream with it. The mode argument is used just
-[<a name="#p272" href="p272">page 272</a>] (<a href="#Contents">Contents</a>)
+[<a name="p272" href="#p272">page 272</a>] (<a href="#Contents">Contents</a>)
as in the fopen function.238)
3 If filename is a null pointer, the freopen function attempts to change the mode of
4 The freopen function first attempts to close any file that is associated with the specified
stream. Failure to close the file is ignored. The error and end-of-file indicators for the
stream are cleared.
- Returns
+<b> Returns</b>
5 The freopen function returns a null pointer if the open operation fails. Otherwise,
freopen returns the value of stream.
<a name="7.19.5.5" href="#7.19.5.5"><b> 7.19.5.5 The setbuf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
void setbuf(FILE * restrict stream,
char * restrict buf);
- Description
+<b> Description</b>
2 Except that it returns no value, the setbuf function is equivalent to the setvbuf
function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf
is a null pointer), with the value _IONBF for mode.
- Returns
+<b> Returns</b>
3 The setbuf function returns no value.
Forward references: the setvbuf function (<a href="#7.19.5.6">7.19.5.6</a>).
<a name="7.19.5.6" href="#7.19.5.6"><b> 7.19.5.6 The setvbuf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int setvbuf(FILE * restrict stream,
char * restrict buf,
(stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
returned by the fopen function may be assigned.
-[<a name="#p273" href="p273">page 273</a>] (<a href="#Contents">Contents</a>)
+[<a name="p273" href="#p273">page 273</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The setvbuf function may be used only after the stream pointed to by stream has
been associated with an open file and before any other operation (other than an
unsuccessful call to setvbuf) is performed on the stream. The argument mode
specifies the size of the array; otherwise, size may determine the size of a buffer
allocated by the setvbuf function. The contents of the array at any time are
indeterminate.
- Returns
+<b> Returns</b>
3 The setvbuf function returns zero on success, or nonzero if an invalid value is given
for mode or if the request cannot be honored.
<a name="7.19.6" href="#7.19.6"><b> 7.19.6 Formatted input/output functions</b></a>
1 The formatted input/output functions shall behave as if there is a sequence point after the
actions associated with each specifier.240)
<a name="7.19.6.1" href="#7.19.6.1"><b> 7.19.6.1 The fprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fprintf(FILE * restrict stream,
const char * restrict format, ...);
- Description
+<b> Description</b>
2 The fprintf function writes output to the stream pointed to by stream, under control
of the string pointed to by format that specifies how subsequent arguments are
converted for output. If there are insufficient arguments for the format, the behavior is
before a buffer that has automatic storage duration is deallocated upon block exit.
240) The fprintf functions perform writes to memory for the %n specifier.
-[<a name="#p274" href="p274">page 274</a>] (<a href="#Contents">Contents</a>)
+[<a name="p274" href="#p274">page 274</a>] (<a href="#Contents">Contents</a>)
specifications, each of which results in fetching zero or more subsequent arguments,
converting them, if applicable, according to the corresponding conversion specifier, and
241) Note that 0 is taken as a flag, not as the beginning of a field width.
-[<a name="#p275" href="p275">page 275</a>] (<a href="#Contents">Contents</a>)
+[<a name="p275" href="#p275">page 275</a>] (<a href="#Contents">Contents</a>)
specified.)242)
space If the first character of a signed conversion is not a sign, or if a signed conversion
242) The results of all floating conversions of a negative zero, and of negative values that round to zero,
include a minus sign.
-[<a name="#p276" href="p276">page 276</a>] (<a href="#Contents">Contents</a>)
+[<a name="p276" href="#p276">page 276</a>] (<a href="#Contents">Contents</a>)
following c conversion specifier applies to a wint_t argument; that a
following s conversion specifier applies to a pointer to a wchar_t
zero value with a precision of zero is no characters.
-[<a name="#p277" href="p277">page 277</a>] (<a href="#Contents">Contents</a>)
+[<a name="p277" href="#p277">page 277</a>] (<a href="#Contents">Contents</a>)
f,F A double argument representing a floating-point number is converted to
decimal notation in the style [-]ddd.ddd, where the number of digits after
243) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
the # and 0 flag characters have no effect.
-[<a name="#p278" href="p278">page 278</a>] (<a href="#Contents">Contents</a>)
+[<a name="p278" href="#p278">page 278</a>] (<a href="#Contents">Contents</a>)
fractional portion of the result and the decimal-point character is removed if
there is no fractional portion remaining.
decimal-point character.
246) No special provisions are made for multibyte characters.
-[<a name="#p279" href="p279">page 279</a>] (<a href="#Contents">Contents</a>)
+[<a name="p279" href="#p279">page 279</a>] (<a href="#Contents">Contents</a>)
written up to (but not including) the terminating null character. If the
precision is specified, no more than that many bytes are written. If the
247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
248) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
-[<a name="#p280" href="p280">page 280</a>] (<a href="#Contents">Contents</a>)
+[<a name="p280" href="#p280">page 280</a>] (<a href="#Contents">Contents</a>)
11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded
to a hexadecimal floating number with the given precision.
adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that
the error should have a correct sign for the current rounding direction.
- Returns
+<b> Returns</b>
14 The fprintf function returns the number of characters transmitted, or a negative value
if an output or encoding error occurred.
Environmental limits
int day, hour, min;
fprintf(stdout, "%s, %s %d, %.2d:%.2d\n",
weekday, month, day, hour, min);
- fprintf(stdout, "pi = %.5f\n", 4 * atan(<a href="#1.0">1.0</a>));
+ fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0));
17 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
members of the extended character set that consist of more than one byte each consist of exactly two bytes,
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
-[<a name="#p281" href="p281">page 281</a>] (<a href="#Contents">Contents</a>)
+[<a name="p281" href="#p281">page 281</a>] (<a href="#Contents">Contents</a>)
18 Given the following wide string with length seven,
static wchar_t wstr[] = L" X Yabc Z W";
Forward references: conversion state (<a href="#7.24.6">7.24.6</a>), the wcrtomb function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
<a name="7.19.6.2" href="#7.19.6.2"><b> 7.19.6.2 The fscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fscanf(FILE * restrict stream,
const char * restrict format, ...);
- Description
+<b> Description</b>
2 The fscanf function reads input from the stream pointed to by stream, under control
of the string pointed to by format that specifies the admissible input sequences and how
they are to be converted for assignment, using subsequent arguments as pointers to the
-- An optional decimal integer greater than zero that specifies the maximum field width
(in characters).
-[<a name="#p282" href="p282">page 282</a>] (<a href="#Contents">Contents</a>)
+[<a name="p282" href="#p282">page 282</a>] (<a href="#Contents">Contents</a>)
-- An optional length modifier that specifies the size of the receiving object.
-- A conversion specifier character that specifies the type of conversion to be applied.
251) fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
-[<a name="#p283" href="p283">page 283</a>] (<a href="#Contents">Contents</a>)
+[<a name="p283" href="#p283">page 283</a>] (<a href="#Contents">Contents</a>)
in the object, the behavior is undefined.
11 The length modifiers and their meanings are:
for the subject sequence of the strtol function with the value 0 for the
base argument. The corresponding argument shall be a pointer to signed
integer.
-[<a name="#p284" href="p284">page 284</a>] (<a href="#Contents">Contents</a>)
+[<a name="p284" href="#p284">page 284</a>] (<a href="#Contents">Contents</a>)
o Matches an optionally signed octal integer, whose format is the same as
expected for the subject sequence of the strtoul function with the value 8
conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
-[<a name="#p285" href="p285">page 285</a>] (<a href="#Contents">Contents</a>)
+[<a name="p285" href="#p285">page 285</a>] (<a href="#Contents">Contents</a>)
characters that begins in the initial shift state. Each multibyte character is
converted to a wide character as if by a call to the mbrtowc function, with
during the same program execution, the pointer that results shall compare
equal to that value; otherwise the behavior of the %p conversion is undefined.
-[<a name="#p286" href="p286">page 286</a>] (<a href="#Contents">Contents</a>)
+[<a name="p286" href="#p286">page 286</a>] (<a href="#Contents">Contents</a>)
n No input is consumed. The corresponding argument shall be a pointer to
signed integer into which is to be written the number of characters read from
15 Trailing white space (including new-line characters) is left unread unless matched by a
directive. The success of literal matches and suppressed assignments is not directly
determinable other than via the %n directive.
- Returns
+<b> Returns</b>
16 The fscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the function returns the number of input items
assigned, which can be fewer than provided for, or even zero, in the event of an early
253) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
-[<a name="#p287" href="p287">page 287</a>] (<a href="#Contents">Contents</a>)
+[<a name="p287" href="#p287">page 287</a>] (<a href="#Contents">Contents</a>)
56789 0123 56a72
will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the
-[<a name="#p288" href="p288">page 288</a>] (<a href="#Contents">Contents</a>)
+[<a name="p288" href="#p288">page 288</a>] (<a href="#Contents">Contents</a>)
#include <a href="#7.19"><stdio.h></a>
/* ... */
-[<a name="#p289" href="p289">page 289</a>] (<a href="#Contents">Contents</a>)
+[<a name="p289" href="#p289">page 289</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.6.3" href="#7.19.6.3"><b> 7.19.6.3 The printf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int printf(const char * restrict format, ...);
- Description
+<b> Description</b>
2 The printf function is equivalent to fprintf with the argument stdout interposed
before the arguments to printf.
- Returns
+<b> Returns</b>
3 The printf function returns the number of characters transmitted, or a negative value if
an output or encoding error occurred.
<a name="7.19.6.4" href="#7.19.6.4"><b> 7.19.6.4 The scanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int scanf(const char * restrict format, ...);
- Description
+<b> Description</b>
2 The scanf function is equivalent to fscanf with the argument stdin interposed
before the arguments to scanf.
- Returns
+<b> Returns</b>
3 The scanf function returns the value of the macro EOF if an input failure occurs before
any conversion. Otherwise, the scanf function returns the number of input items
assigned, which can be fewer than provided for, or even zero, in the event of an early
matching failure.
<a name="7.19.6.5" href="#7.19.6.5"><b> 7.19.6.5 The snprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int snprintf(char * restrict s, size_t n,
const char * restrict format, ...);
- Description
+<b> Description</b>
2 The snprintf function is equivalent to fprintf, except that the output is written into
an array (specified by argument s) rather than to a stream. If n is zero, nothing is written,
and s may be a null pointer. Otherwise, output characters beyond the n-1st are
of the characters actually written into the array. If copying takes place between objects
that overlap, the behavior is undefined.
-[<a name="#p290" href="p290">page 290</a>] (<a href="#Contents">Contents</a>)
+[<a name="p290" href="#p290">page 290</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The snprintf function returns the number of characters that would have been written
had n been sufficiently large, not counting the terminating null character, or a negative
value if an encoding error occurred. Thus, the null-terminated output has been
completely written if and only if the returned value is nonnegative and less than n.
<a name="7.19.6.6" href="#7.19.6.6"><b> 7.19.6.6 The sprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int sprintf(char * restrict s,
const char * restrict format, ...);
- Description
+<b> Description</b>
2 The sprintf function is equivalent to fprintf, except that the output is written into
an array (specified by the argument s) rather than to a stream. A null character is written
at the end of the characters written; it is not counted as part of the returned value. If
copying takes place between objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The sprintf function returns the number of characters written in the array, not
counting the terminating null character, or a negative value if an encoding error occurred.
<a name="7.19.6.7" href="#7.19.6.7"><b> 7.19.6.7 The sscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int sscanf(const char * restrict s,
const char * restrict format, ...);
- Description
+<b> Description</b>
2 The sscanf function is equivalent to fscanf, except that input is obtained from a
string (specified by the argument s) rather than from a stream. Reaching the end of the
string is equivalent to encountering end-of-file for the fscanf function. If copying
takes place between objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The sscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the sscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
-[<a name="#p291" href="p291">page 291</a>] (<a href="#Contents">Contents</a>)
+[<a name="p291" href="#p291">page 291</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.6.8" href="#7.19.6.8"><b> 7.19.6.8 The vfprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vfprintf(FILE * restrict stream,
const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vfprintf function is equivalent to fprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfprintf function does not invoke the
va_end macro.254)
- Returns
+<b> Returns</b>
3 The vfprintf function returns the number of characters transmitted, or a negative
value if an output or encoding error occurred.
4 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine.
254) As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
-[<a name="#p292" href="p292">page 292</a>] (<a href="#Contents">Contents</a>)
+[<a name="p292" href="#p292">page 292</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.6.9" href="#7.19.6.9"><b> 7.19.6.9 The vfscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vfscanf(FILE * restrict stream,
const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vfscanf function is equivalent to fscanf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfscanf function does not invoke the
va_end macro.254)
- Returns
+<b> Returns</b>
3 The vfscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vfscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.19.6.10" href="#7.19.6.10"><b> 7.19.6.10 The vprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vprintf(const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vprintf function is equivalent to printf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vprintf function does not invoke the
va_end macro.254)
- Returns
+<b> Returns</b>
3 The vprintf function returns the number of characters transmitted, or a negative value
if an output or encoding error occurred.
-[<a name="#p293" href="p293">page 293</a>] (<a href="#Contents">Contents</a>)
+[<a name="p293" href="#p293">page 293</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.6.11" href="#7.19.6.11"><b> 7.19.6.11 The vscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vscanf(const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vscanf function is equivalent to scanf, with the variable argument list replaced
by arg, which shall have been initialized by the va_start macro (and possibly
subsequent va_arg calls). The vscanf function does not invoke the va_end
macro.254)
- Returns
+<b> Returns</b>
3 The vscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.19.6.12" href="#7.19.6.12"><b> 7.19.6.12 The vsnprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vsnprintf(char * restrict s, size_t n,
const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vsnprintf function is equivalent to snprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vsnprintf function does not invoke the
va_end macro.254) If copying takes place between objects that overlap, the behavior is
undefined.
- Returns
+<b> Returns</b>
3 The vsnprintf function returns the number of characters that would have been written
had n been sufficiently large, not counting the terminating null character, or a negative
value if an encoding error occurred. Thus, the null-terminated output has been
-[<a name="#p294" href="p294">page 294</a>] (<a href="#Contents">Contents</a>)
+[<a name="p294" href="#p294">page 294</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.6.13" href="#7.19.6.13"><b> 7.19.6.13 The vsprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vsprintf(char * restrict s,
const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vsprintf function is equivalent to sprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vsprintf function does not invoke the
va_end macro.254) If copying takes place between objects that overlap, the behavior is
undefined.
- Returns
+<b> Returns</b>
3 The vsprintf function returns the number of characters written in the array, not
counting the terminating null character, or a negative value if an encoding error occurred.
<a name="7.19.6.14" href="#7.19.6.14"><b> 7.19.6.14 The vsscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
int vsscanf(const char * restrict s,
const char * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vsscanf function is equivalent to sscanf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vsscanf function does not invoke the
va_end macro.254)
- Returns
+<b> Returns</b>
3 The vsscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vsscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
-[<a name="#p295" href="p295">page 295</a>] (<a href="#Contents">Contents</a>)
+[<a name="p295" href="#p295">page 295</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.7" href="#7.19.7"><b> 7.19.7 Character input/output functions</b></a>
<a name="7.19.7.1" href="#7.19.7.1"><b> 7.19.7.1 The fgetc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fgetc(FILE *stream);
- Description
+<b> Description</b>
2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
next character is present, the fgetc function obtains that character as an unsigned
char converted to an int and advances the associated file position indicator for the
stream (if defined).
- Returns
+<b> Returns</b>
3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
fgetc function returns the next character from the input stream pointed to by stream.
If a read error occurs, the error indicator for the stream is set and the fgetc function
returns EOF.255)
<a name="7.19.7.2" href="#7.19.7.2"><b> 7.19.7.2 The fgets function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
char *fgets(char * restrict s, int n,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The fgets function reads at most one less than the number of characters specified by n
from the stream pointed to by stream into the array pointed to by s. No additional
characters are read after a new-line character (which is retained) or after end-of-file. A
null character is written immediately after the last character read into the array.
- Returns
+<b> Returns</b>
3 The fgets function returns s if successful. If end-of-file is encountered and no
characters have been read into the array, the contents of the array remain unchanged and a
null pointer is returned. If a read error occurs during the operation, the array contents are
255) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
-[<a name="#p296" href="p296">page 296</a>] (<a href="#Contents">Contents</a>)
+[<a name="p296" href="#p296">page 296</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.7.3" href="#7.19.7.3"><b> 7.19.7.3 The fputc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fputc(int c, FILE *stream);
- Description
+<b> Description</b>
2 The fputc function writes the character specified by c (converted to an unsigned
char) to the output stream pointed to by stream, at the position indicated by the
associated file position indicator for the stream (if defined), and advances the indicator
appropriately. If the file cannot support positioning requests, or if the stream was opened
with append mode, the character is appended to the output stream.
- Returns
+<b> Returns</b>
3 The fputc function returns the character written. If a write error occurs, the error
indicator for the stream is set and fputc returns EOF.
<a name="7.19.7.4" href="#7.19.7.4"><b> 7.19.7.4 The fputs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fputs(const char * restrict s,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The fputs function writes the string pointed to by s to the stream pointed to by
stream. The terminating null character is not written.
- Returns
+<b> Returns</b>
3 The fputs function returns EOF if a write error occurs; otherwise it returns a
nonnegative value.
<a name="7.19.7.5" href="#7.19.7.5"><b> 7.19.7.5 The getc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int getc(FILE *stream);
- Description
+<b> Description</b>
2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it
may evaluate stream more than once, so the argument should never be an expression
with side effects.
-[<a name="#p297" href="p297">page 297</a>] (<a href="#Contents">Contents</a>)
+[<a name="p297" href="#p297">page 297</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The getc function returns the next character from the input stream pointed to by
stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
getc returns EOF. If a read error occurs, the error indicator for the stream is set and
getc returns EOF.
<a name="7.19.7.6" href="#7.19.7.6"><b> 7.19.7.6 The getchar function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int getchar(void);
- Description
+<b> Description</b>
2 The getchar function is equivalent to getc with the argument stdin.
- Returns
+<b> Returns</b>
3 The getchar function returns the next character from the input stream pointed to by
stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and
getchar returns EOF. If a read error occurs, the error indicator for the stream is set and
getchar returns EOF.
<a name="7.19.7.7" href="#7.19.7.7"><b> 7.19.7.7 The gets function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
char *gets(char *s);
- Description
+<b> Description</b>
2 The gets function reads characters from the input stream pointed to by stdin, into the
array pointed to by s, until end-of-file is encountered or a new-line character is read.
Any new-line character is discarded, and a null character is written immediately after the
last character read into the array.
- Returns
+<b> Returns</b>
3 The gets function returns s if successful. If end-of-file is encountered and no
characters have been read into the array, the contents of the array remain unchanged and a
null pointer is returned. If a read error occurs during the operation, the array contents are
-[<a name="#p298" href="p298">page 298</a>] (<a href="#Contents">Contents</a>)
+[<a name="p298" href="#p298">page 298</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.7.8" href="#7.19.7.8"><b> 7.19.7.8 The putc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int putc(int c, FILE *stream);
- Description
+<b> Description</b>
2 The putc function is equivalent to fputc, except that if it is implemented as a macro, it
may evaluate stream more than once, so that argument should never be an expression
with side effects.
- Returns
+<b> Returns</b>
3 The putc function returns the character written. If a write error occurs, the error
indicator for the stream is set and putc returns EOF.
<a name="7.19.7.9" href="#7.19.7.9"><b> 7.19.7.9 The putchar function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int putchar(int c);
- Description
+<b> Description</b>
2 The putchar function is equivalent to putc with the second argument stdout.
- Returns
+<b> Returns</b>
3 The putchar function returns the character written. If a write error occurs, the error
indicator for the stream is set and putchar returns EOF.
<a name="7.19.7.10" href="#7.19.7.10"><b> 7.19.7.10 The puts function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int puts(const char *s);
- Description
+<b> Description</b>
2 The puts function writes the string pointed to by s to the stream pointed to by stdout,
and appends a new-line character to the output. The terminating null character is not
written.
- Returns
+<b> Returns</b>
3 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative
value.
-[<a name="#p299" href="p299">page 299</a>] (<a href="#Contents">Contents</a>)
+[<a name="p299" href="#p299">page 299</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.7.11" href="#7.19.7.11"><b> 7.19.7.11 The ungetc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int ungetc(int c, FILE *stream);
- Description
+<b> Description</b>
2 The ungetc function pushes the character specified by c (converted to an unsigned
char) back onto the input stream pointed to by stream. Pushed-back characters will be
returned by subsequent reads on that stream in the reverse order of their pushing. A
For a binary stream, its file position indicator is decremented by each successful call to
the ungetc function; if its value was zero before a call, it is indeterminate after the
call.256)
- Returns
+<b> Returns</b>
6 The ungetc function returns the character pushed back after conversion, or EOF if the
operation fails.
Forward references: file positioning functions (<a href="#7.19.9">7.19.9</a>).
256) See ''future library directions'' (<a href="#7.26.9">7.26.9</a>).
-[<a name="#p300" href="p300">page 300</a>] (<a href="#Contents">Contents</a>)
+[<a name="p300" href="#p300">page 300</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.8" href="#7.19.8"><b> 7.19.8 Direct input/output functions</b></a>
<a name="7.19.8.1" href="#7.19.8.1"><b> 7.19.8.1 The fread function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
size_t fread(void * restrict ptr,
size_t size, size_t nmemb,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The fread function reads, into the array pointed to by ptr, up to nmemb elements
whose size is specified by size, from the stream pointed to by stream. For each
object, size calls are made to the fgetc function and the results stored, in the order
indicator for the stream (if defined) is advanced by the number of characters successfully
read. If an error occurs, the resulting value of the file position indicator for the stream is
indeterminate. If a partial element is read, its value is indeterminate.
- Returns
+<b> Returns</b>
3 The fread function returns the number of elements successfully read, which may be
less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero,
fread returns zero and the contents of the array and the state of the stream remain
unchanged.
<a name="7.19.8.2" href="#7.19.8.2"><b> 7.19.8.2 The fwrite function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
size_t fwrite(const void * restrict ptr,
size_t size, size_t nmemb,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements
whose size is specified by size, to the stream pointed to by stream. For each object,
size calls are made to the fputc function, taking the values (in order) from an array of
-[<a name="#p301" href="p301">page 301</a>] (<a href="#Contents">Contents</a>)
+[<a name="p301" href="#p301">page 301</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The fwrite function returns the number of elements successfully written, which will be
less than nmemb only if a write error is encountered. If size or nmemb is zero,
fwrite returns zero and the state of the stream remains unchanged.
<a name="7.19.9" href="#7.19.9"><b> 7.19.9 File positioning functions</b></a>
<a name="7.19.9.1" href="#7.19.9.1"><b> 7.19.9.1 The fgetpos function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fgetpos(FILE * restrict stream,
fpos_t * restrict pos);
- Description
+<b> Description</b>
2 The fgetpos function stores the current values of the parse state (if any) and file
position indicator for the stream pointed to by stream in the object pointed to by pos.
The values stored contain unspecified information usable by the fsetpos function for
repositioning the stream to its position at the time of the call to the fgetpos function.
- Returns
+<b> Returns</b>
3 If successful, the fgetpos function returns zero; on failure, the fgetpos function
returns nonzero and stores an implementation-defined positive value in errno.
Forward references: the fsetpos function (<a href="#7.19.9.3">7.19.9.3</a>).
<a name="7.19.9.2" href="#7.19.9.2"><b> 7.19.9.2 The fseek function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fseek(FILE *stream, long int offset, int whence);
- Description
+<b> Description</b>
2 The fseek function sets the file position indicator for the stream pointed to by stream.
If a read or write error occurs, the error indicator for the stream is set and fseek fails.
3 For a binary stream, the new position, measured in characters from the beginning of the
an earlier successful call to the ftell function on a stream associated with the same file
and whence shall be SEEK_SET.
-[<a name="#p302" href="p302">page 302</a>] (<a href="#Contents">Contents</a>)
+[<a name="p302" href="#p302">page 302</a>] (<a href="#Contents">Contents</a>)
5 After determining the new position, a successful call to the fseek function undoes any
effects of the ungetc function on the stream, clears the end-of-file indicator for the
stream, and then establishes the new position. After a successful fseek call, the next
operation on an update stream may be either input or output.
- Returns
+<b> Returns</b>
6 The fseek function returns nonzero only for a request that cannot be satisfied.
Forward references: the ftell function (<a href="#7.19.9.4">7.19.9.4</a>).
<a name="7.19.9.3" href="#7.19.9.3"><b> 7.19.9.3 The fsetpos function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int fsetpos(FILE *stream, const fpos_t *pos);
- Description
+<b> Description</b>
2 The fsetpos function sets the mbstate_t object (if any) and file position indicator
for the stream pointed to by stream according to the value of the object pointed to by
pos, which shall be a value obtained from an earlier successful call to the fgetpos
on the stream, clears the end-of-file indicator for the stream, and then establishes the new
parse state and position. After a successful fsetpos call, the next operation on an
update stream may be either input or output.
- Returns
+<b> Returns</b>
4 If successful, the fsetpos function returns zero; on failure, the fsetpos function
returns nonzero and stores an implementation-defined positive value in errno.
<a name="7.19.9.4" href="#7.19.9.4"><b> 7.19.9.4 The ftell function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
long int ftell(FILE *stream);
- Description
+<b> Description</b>
2 The ftell function obtains the current value of the file position indicator for the stream
pointed to by stream. For a binary stream, the value is the number of characters from
the beginning of the file. For a text stream, its file position indicator contains unspecified
stream to its position at the time of the ftell call; the difference between two such
return values is not necessarily a meaningful measure of the number of characters written
-[<a name="#p303" href="p303">page 303</a>] (<a href="#Contents">Contents</a>)
+[<a name="p303" href="#p303">page 303</a>] (<a href="#Contents">Contents</a>)
or read.
- Returns
+<b> Returns</b>
3 If successful, the ftell function returns the current value of the file position indicator
for the stream. On failure, the ftell function returns -1L and stores an
implementation-defined positive value in errno.
<a name="7.19.9.5" href="#7.19.9.5"><b> 7.19.9.5 The rewind function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
void rewind(FILE *stream);
- Description
+<b> Description</b>
2 The rewind function sets the file position indicator for the stream pointed to by
stream to the beginning of the file. It is equivalent to
(void)fseek(stream, 0L, SEEK_SET)
except that the error indicator for the stream is also cleared.
- Returns
+<b> Returns</b>
3 The rewind function returns no value.
<a name="7.19.10" href="#7.19.10"><b> 7.19.10 Error-handling functions</b></a>
<a name="7.19.10.1" href="#7.19.10.1"><b> 7.19.10.1 The clearerr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
void clearerr(FILE *stream);
- Description
+<b> Description</b>
2 The clearerr function clears the end-of-file and error indicators for the stream pointed
to by stream.
- Returns
+<b> Returns</b>
3 The clearerr function returns no value.
-[<a name="#p304" href="p304">page 304</a>] (<a href="#Contents">Contents</a>)
+[<a name="p304" href="#p304">page 304</a>] (<a href="#Contents">Contents</a>)
<a name="7.19.10.2" href="#7.19.10.2"><b> 7.19.10.2 The feof function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int feof(FILE *stream);
- Description
+<b> Description</b>
2 The feof function tests the end-of-file indicator for the stream pointed to by stream.
- Returns
+<b> Returns</b>
3 The feof function returns nonzero if and only if the end-of-file indicator is set for
stream.
<a name="7.19.10.3" href="#7.19.10.3"><b> 7.19.10.3 The ferror function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
int ferror(FILE *stream);
- Description
+<b> Description</b>
2 The ferror function tests the error indicator for the stream pointed to by stream.
- Returns
+<b> Returns</b>
3 The ferror function returns nonzero if and only if the error indicator is set for
stream.
<a name="7.19.10.4" href="#7.19.10.4"><b> 7.19.10.4 The perror function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
void perror(const char *s);
- Description
+<b> Description</b>
2 The perror function maps the error number in the integer expression errno to an
error message. It writes a sequence of characters to the standard error stream thus: first
(if s is not a null pointer and the character pointed to by s is not the null character), the
string pointed to by s followed by a colon (:) and a space; then an appropriate error
message string followed by a new-line character. The contents of the error message
strings are the same as those returned by the strerror function with argument errno.
- Returns
+<b> Returns</b>
3 The perror function returns no value.
Forward references: the strerror function (<a href="#7.21.6.2">7.21.6.2</a>).
-[<a name="#p305" href="p305">page 305</a>] (<a href="#Contents">Contents</a>)
+[<a name="p305" href="#p305">page 305</a>] (<a href="#Contents">Contents</a>)
<a name="7.20" href="#7.20"><b> 7.20 General utilities <stdlib.h></b></a>
1 The header <a href="#7.20"><stdlib.h></a> declares five types and several functions of general utility, and
257) See ''future library directions'' (<a href="#7.26.10">7.26.10</a>).
-[<a name="#p306" href="p306">page 306</a>] (<a href="#Contents">Contents</a>)
+[<a name="p306" href="#p306">page 306</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.1" href="#7.20.1"><b> 7.20.1 Numeric conversion functions</b></a>
1 The functions atof, atoi, atol, and atoll need not affect the value of the integer
expression errno on an error. If the value of the result cannot be represented, the
behavior is undefined.
<a name="7.20.1.1" href="#7.20.1.1"><b> 7.20.1.1 The atof function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
double atof(const char *nptr);
- Description
+<b> Description</b>
2 The atof function converts the initial portion of the string pointed to by nptr to
double representation. Except for the behavior on error, it is equivalent to
strtod(nptr, (char **)NULL)
- Returns
+<b> Returns</b>
3 The atof function returns the converted value.
Forward references: the strtod, strtof, and strtold functions (<a href="#7.20.1.3">7.20.1.3</a>).
<a name="7.20.1.2" href="#7.20.1.2"><b> 7.20.1.2 The atoi, atol, and atoll functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int atoi(const char *nptr);
long int atol(const char *nptr);
long long int atoll(const char *nptr);
- Description
+<b> Description</b>
2 The atoi, atol, and atoll functions convert the initial portion of the string pointed
to by nptr to int, long int, and long long int representation, respectively.
Except for the behavior on error, they are equivalent to
atoi: (int)strtol(nptr, (char **)NULL, 10)
atol: strtol(nptr, (char **)NULL, 10)
atoll: strtoll(nptr, (char **)NULL, 10)
- Returns
+<b> Returns</b>
3 The atoi, atol, and atoll functions return the converted value.
Forward references: the strtol, strtoll, strtoul, and strtoull functions
(<a href="#7.20.1.4">7.20.1.4</a>).
-[<a name="#p307" href="p307">page 307</a>] (<a href="#Contents">Contents</a>)
+[<a name="p307" href="#p307">page 307</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 The strtod, strtof, and strtold functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
double strtod(const char * restrict nptr,
char ** restrict endptr);
char ** restrict endptr);
long double strtold(const char * restrict nptr,
char ** restrict endptr);
- Description
+<b> Description</b>
2 The strtod, strtof, and strtold functions convert the initial portion of the string
pointed to by nptr to double, float, and long double representation,
respectively. First, they decompose the input string into three parts: an initial, possibly
4 If the subject sequence has the expected form for a floating-point number, the sequence of
characters starting with the first digit or the decimal-point character (whichever occurs
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
-[<a name="#p308" href="p308">page 308</a>] (<a href="#Contents">Contents</a>)
+[<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
decimal-point character is used in place of a period, and that if neither an exponent part
nor a decimal-point character appears in a decimal floating point number, or if a binary
259) An implementation may use the n-char sequence to determine extra information to be represented in
the NaN's significand.
-[<a name="#p309" href="p309">page 309</a>] (<a href="#Contents">Contents</a>)
+[<a name="p309" href="#p309">page 309</a>] (<a href="#Contents">Contents</a>)
stipulation that the error with respect to D should have a correct sign for the current
rounding direction.260)
- Returns
+<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value is outside the range of representable values, plus or
minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
than the smallest normalized positive number in the return type; whether errno acquires
the value ERANGE is implementation-defined.
<a name="7.20.1.4" href="#7.20.1.4"><b> 7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
long int strtol(
const char * restrict nptr,
const char * restrict nptr,
char ** restrict endptr,
int base);
- Description
+<b> Description</b>
2 The strtol, strtoll, strtoul, and strtoull functions convert the initial
portion of the string pointed to by nptr to long int, long long int, unsigned
long int, and unsigned long long int representation, respectively. First,
260) DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
to the same internal floating value, but if not will round to adjacent values.
-[<a name="#p310" href="p310">page 310</a>] (<a href="#Contents">Contents</a>)
+[<a name="p310" href="#p310">page 310</a>] (<a href="#Contents">Contents</a>)
resembling an integer represented in some radix determined by the value of base, and a
final string of one or more unrecognized characters, including the terminating null
7 If the subject sequence is empty or does not have the expected form, no conversion is
performed; the value of nptr is stored in the object pointed to by endptr, provided
that endptr is not a null pointer.
- Returns
+<b> Returns</b>
8 The strtol, strtoll, strtoul, and strtoull functions return the converted
value, if any. If no conversion could be performed, zero is returned. If the correct value
is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
-[<a name="#p311" href="p311">page 311</a>] (<a href="#Contents">Contents</a>)
+[<a name="p311" href="#p311">page 311</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.2" href="#7.20.2"><b> 7.20.2 Pseudo-random sequence generation functions</b></a>
<a name="7.20.2.1" href="#7.20.2.1"><b> 7.20.2.1 The rand function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int rand(void);
- Description
+<b> Description</b>
2 The rand function computes a sequence of pseudo-random integers in the range 0 to
RAND_MAX.
3 The implementation shall behave as if no library function calls the rand function.
- Returns
+<b> Returns</b>
4 The rand function returns a pseudo-random integer.
Environmental limits
5 The value of the RAND_MAX macro shall be at least 32767.
<a name="7.20.2.2" href="#7.20.2.2"><b> 7.20.2.2 The srand function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void srand(unsigned int seed);
- Description
+<b> Description</b>
2 The srand function uses the argument as a seed for a new sequence of pseudo-random
numbers to be returned by subsequent calls to rand. If srand is then called with the
same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is
called before any calls to srand have been made, the same sequence shall be generated
as when srand is first called with a seed value of 1.
3 The implementation shall behave as if no library function calls the srand function.
- Returns
+<b> Returns</b>
4 The srand function returns no value.
5 EXAMPLE The following functions define a portable implementation of rand and srand.
static unsigned long int next = 1;
-[<a name="#p312" href="p312">page 312</a>] (<a href="#Contents">Contents</a>)
+[<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
void srand(unsigned int seed)
{
defined: either a null pointer is returned, or the behavior is as if the size were some
nonzero value, except that the returned pointer shall not be used to access an object.
<a name="7.20.3.1" href="#7.20.3.1"><b> 7.20.3.1 The calloc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void *calloc(size_t nmemb, size_t size);
- Description
+<b> Description</b>
2 The calloc function allocates space for an array of nmemb objects, each of whose size
is size. The space is initialized to all bits zero.261)
- Returns
+<b> Returns</b>
3 The calloc function returns either a null pointer or a pointer to the allocated space.
<a name="7.20.3.2" href="#7.20.3.2"><b> 7.20.3.2 The free function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void free(void *ptr);
- Description
+<b> Description</b>
2 The free function causes the space pointed to by ptr to be deallocated, that is, made
available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if
the argument does not match a pointer earlier returned by the calloc, malloc, or
261) Note that this need not be the same as the representation of floating-point zero or a null pointer
constant.
-[<a name="#p313" href="p313">page 313</a>] (<a href="#Contents">Contents</a>)
+[<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
realloc function, or if the space has been deallocated by a call to free or realloc,
the behavior is undefined.
- Returns
+<b> Returns</b>
3 The free function returns no value.
<a name="7.20.3.3" href="#7.20.3.3"><b> 7.20.3.3 The malloc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void *malloc(size_t size);
- Description
+<b> Description</b>
2 The malloc function allocates space for an object whose size is specified by size and
whose value is indeterminate.
- Returns
+<b> Returns</b>
3 The malloc function returns either a null pointer or a pointer to the allocated space.
<a name="7.20.3.4" href="#7.20.3.4"><b> 7.20.3.4 The realloc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void *realloc(void *ptr, size_t size);
- Description
+<b> Description</b>
2 The realloc function deallocates the old object pointed to by ptr and returns a
pointer to a new object that has the size specified by size. The contents of the new
object shall be the same as that of the old object prior to deallocation, up to the lesser of
calloc, malloc, or realloc function, or if the space has been deallocated by a call
to the free or realloc function, the behavior is undefined. If memory for the new
object cannot be allocated, the old object is not deallocated and its value is unchanged.
- Returns
+<b> Returns</b>
4 The realloc function returns a pointer to the new object (which may have the same
value as a pointer to the old object), or a null pointer if the new object could not be
allocated.
-[<a name="#p314" href="p314">page 314</a>] (<a href="#Contents">Contents</a>)
+[<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.4" href="#7.20.4"><b> 7.20.4 Communication with the environment</b></a>
<a name="7.20.4.1" href="#7.20.4.1"><b> 7.20.4.1 The abort function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void abort(void);
- Description
+<b> Description</b>
2 The abort function causes abnormal program termination to occur, unless the signal
SIGABRT is being caught and the signal handler does not return. Whether open streams
with unwritten buffered data are flushed, open streams are closed, or temporary files are
removed is implementation-defined. An implementation-defined form of the status
unsuccessful termination is returned to the host environment by means of the function
call raise(SIGABRT).
- Returns
+<b> Returns</b>
3 The abort function does not return to its caller.
<a name="7.20.4.2" href="#7.20.4.2"><b> 7.20.4.2 The atexit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int atexit(void (*func)(void));
- Description
+<b> Description</b>
2 The atexit function registers the function pointed to by func, to be called without
arguments at normal program termination.
Environmental limits
3 The implementation shall support the registration of at least 32 functions.
- Returns
+<b> Returns</b>
4 The atexit function returns zero if the registration succeeds, nonzero if it fails.
Forward references: the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
<a name="7.20.4.3" href="#7.20.4.3"><b> 7.20.4.3 The exit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void exit(int status);
- Description
+<b> Description</b>
2 The exit function causes normal program termination to occur. If more than one call to
the exit function is executed by a program, the behavior is undefined.
-[<a name="#p315" href="p315">page 315</a>] (<a href="#Contents">Contents</a>)
+[<a name="p315" href="#p315">page 315</a>] (<a href="#Contents">Contents</a>)
3 First, all functions registered by the atexit function are called, in the reverse order of
their registration,262) except that a function is called after any previously registered
returned. If the value of status is EXIT_FAILURE, an implementation-defined form
of the status unsuccessful termination is returned. Otherwise the status returned is
implementation-defined.
- Returns
+<b> Returns</b>
6 The exit function cannot return to its caller.
<a name="7.20.4.4" href="#7.20.4.4"><b> 7.20.4.4 The _Exit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void _Exit(int status);
- Description
+<b> Description</b>
2 The _Exit function causes normal program termination to occur and control to be
returned to the host environment. No functions registered by the atexit function or
signal handlers registered by the signal function are called. The status returned to the
host environment is determined in the same way as for the exit function (<a href="#7.20.4.3">7.20.4.3</a>).
Whether open streams with unwritten buffered data are flushed, open streams are closed,
or temporary files are removed is implementation-defined.
- Returns
+<b> Returns</b>
3 The _Exit function cannot return to its caller.
262) Each function is called as many times as it was registered, and in the correct order with respect to
other registered functions.
-[<a name="#p316" href="p316">page 316</a>] (<a href="#Contents">Contents</a>)
+[<a name="p316" href="#p316">page 316</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.4.5" href="#7.20.4.5"><b> 7.20.4.5 The getenv function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
char *getenv(const char *name);
- Description
+<b> Description</b>
2 The getenv function searches an environment list, provided by the host environment,
for a string that matches the string pointed to by name. The set of environment names
and the method for altering the environment list are implementation-defined.
3 The implementation shall behave as if no library function calls the getenv function.
- Returns
+<b> Returns</b>
4 The getenv function returns a pointer to a string associated with the matched list
member. The string pointed to shall not be modified by the program, but may be
overwritten by a subsequent call to the getenv function. If the specified name cannot
be found, a null pointer is returned.
<a name="7.20.4.6" href="#7.20.4.6"><b> 7.20.4.6 The system function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int system(const char *string);
- Description
+<b> Description</b>
2 If string is a null pointer, the system function determines whether the host
environment has a command processor. If string is not a null pointer, the system
function passes the string pointed to by string to that command processor to be
executed in a manner which the implementation shall document; this might then cause the
program calling system to behave in a non-conforming manner or to terminate.
- Returns
+<b> Returns</b>
3 If the argument is a null pointer, the system function returns nonzero only if a
command processor is available. If the argument is not a null pointer, and the system
function does return, it returns an implementation-defined value.
-[<a name="#p317" href="p317">page 317</a>] (<a href="#Contents">Contents</a>)
+[<a name="p317" href="#p317">page 317</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.5" href="#7.20.5"><b> 7.20.5 Searching and sorting utilities</b></a>
1 These utilities make use of a comparison function to search or sort arrays of unspecified
comparison function, and also between any call to the comparison function and any
movement of the objects passed as arguments to that call.
<a name="7.20.5.1" href="#7.20.5.1"><b> 7.20.5.1 The bsearch function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void *bsearch(const void *key, const void *base,
size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
- Description
+<b> Description</b>
2 The bsearch function searches an array of nmemb objects, the initial element of which
is pointed to by base, for an element that matches the object pointed to by key. The
(char *)p < (char *)base + nmemb * size
-[<a name="#p318" href="p318">page 318</a>] (<a href="#Contents">Contents</a>)
+[<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
size of each element of the array is specified by size.
3 The comparison function pointed to by compar is called with two arguments that point
respectively, to be less than, to match, or to be greater than the array element. The array
shall consist of: all the elements that compare less than, all the elements that compare
equal to, and all the elements that compare greater than the key object, in that order.264)
- Returns
+<b> Returns</b>
4 The bsearch function returns a pointer to a matching element of the array, or a null
pointer if no match is found. If two elements compare as equal, which element is
matched is unspecified.
<a name="7.20.5.2" href="#7.20.5.2"><b> 7.20.5.2 The qsort function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
void qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
- Description
+<b> Description</b>
2 The qsort function sorts an array of nmemb objects, the initial element of which is
pointed to by base. The size of each object is specified by size.
3 The contents of the array are sorted into ascending order according to a comparison
greater than zero if the first argument is considered to be respectively less than, equal to,
or greater than the second.
4 If two elements compare as equal, their order in the resulting sorted array is unspecified.
- Returns
+<b> Returns</b>
5 The qsort function returns no value.
264) In practice, the entire array is sorted according to the comparison function.
-[<a name="#p319" href="p319">page 319</a>] (<a href="#Contents">Contents</a>)
+[<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.6" href="#7.20.6"><b> 7.20.6 Integer arithmetic functions</b></a>
<a name="7.20.6.1" href="#7.20.6.1"><b> 7.20.6.1 The abs, labs and llabs functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int abs(int j);
long int labs(long int j);
long long int llabs(long long int j);
- Description
+<b> Description</b>
2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
result cannot be represented, the behavior is undefined.265)
- Returns
+<b> Returns</b>
3 The abs, labs, and llabs, functions return the absolute value.
<a name="7.20.6.2" href="#7.20.6.2"><b> 7.20.6.2 The div, ldiv, and lldiv functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
div_t div(int numer, int denom);
ldiv_t ldiv(long int numer, long int denom);
lldiv_t lldiv(long long int numer, long long int denom);
- Description
+<b> Description</b>
2 The div, ldiv, and lldiv, functions compute numer / denom and numer %
denom in a single operation.
- Returns
+<b> Returns</b>
3 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and
lldiv_t, respectively, comprising both the quotient and the remainder. The structures
shall contain (in either order) the members quot (the quotient) and rem (the remainder),
265) The absolute value of the most negative number cannot be represented in two's complement.
-[<a name="#p320" href="p320">page 320</a>] (<a href="#Contents">Contents</a>)
+[<a name="p320" href="#p320">page 320</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.7" href="#7.20.7"><b> 7.20.7 Multibyte/wide character conversion functions</b></a>
1 The behavior of the multibyte character functions is affected by the LC_CTYPE category
otherwise.266) Changing the LC_CTYPE category causes the conversion state of these
functions to be indeterminate.
<a name="7.20.7.1" href="#7.20.7.1"><b> 7.20.7.1 The mblen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int mblen(const char *s, size_t n);
- Description
+<b> Description</b>
2 If s is not a null pointer, the mblen function determines the number of bytes contained
in the multibyte character pointed to by s. Except that the conversion state of the
mbtowc function is not affected, it is equivalent to
mbtowc((wchar_t *)0, s, n);
3 The implementation shall behave as if no library function calls the mblen function.
- Returns
+<b> Returns</b>
4 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte
character encodings, respectively, do or do not have state-dependent encodings. If s is
not a null pointer, the mblen function either returns 0 (if s points to the null character),
266) If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
character codes, but are grouped with an adjacent multibyte character.
-[<a name="#p321" href="p321">page 321</a>] (<a href="#Contents">Contents</a>)
+[<a name="p321" href="#p321">page 321</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.7.2" href="#7.20.7.2"><b> 7.20.7.2 The mbtowc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int mbtowc(wchar_t * restrict pwc,
const char * restrict s,
size_t n);
- Description
+<b> Description</b>
2 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with
the byte pointed to by s to determine the number of bytes needed to complete the next
multibyte character (including any shift sequences). If the function determines that the
the object pointed to by pwc. If the corresponding wide character is the null wide
character, the function is left in the initial conversion state.
3 The implementation shall behave as if no library function calls the mbtowc function.
- Returns
+<b> Returns</b>
4 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte
character encodings, respectively, do or do not have state-dependent encodings. If s is
not a null pointer, the mbtowc function either returns 0 (if s points to the null character),
5 In no case will the value returned be greater than n or the value of the MB_CUR_MAX
macro.
<a name="7.20.7.3" href="#7.20.7.3"><b> 7.20.7.3 The wctomb function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
int wctomb(char *s, wchar_t wc);
- Description
+<b> Description</b>
2 The wctomb function determines the number of bytes needed to represent the multibyte
character corresponding to the wide character given by wc (including any shift
sequences), and stores the multibyte character representation in the array whose first
sequence needed to restore the initial shift state, and the function is left in the initial
conversion state.
-[<a name="#p322" href="p322">page 322</a>] (<a href="#Contents">Contents</a>)
+[<a name="p322" href="#p322">page 322</a>] (<a href="#Contents">Contents</a>)
3 The implementation shall behave as if no library function calls the wctomb function.
- Returns
+<b> Returns</b>
4 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte
character encodings, respectively, do or do not have state-dependent encodings. If s is
not a null pointer, the wctomb function returns -1 if the value of wc does not correspond
1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of
the current locale.
<a name="7.20.8.1" href="#7.20.8.1"><b> 7.20.8.1 The mbstowcs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
size_t mbstowcs(wchar_t * restrict pwcs,
const char * restrict s,
size_t n);
- Description
+<b> Description</b>
2 The mbstowcs function converts a sequence of multibyte characters that begins in the
initial shift state from the array pointed to by s into a sequence of corresponding wide
characters and stores not more than n wide characters into the array pointed to by pwcs.
not affected.
3 No more than n elements will be modified in the array pointed to by pwcs. If copying
takes place between objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
4 If an invalid multibyte character is encountered, the mbstowcs function returns
(size_t)(-1). Otherwise, the mbstowcs function returns the number of array
elements modified, not including a terminating null wide character, if any.267)
267) The array will not be null-terminated if the value returned is n.
-[<a name="#p323" href="p323">page 323</a>] (<a href="#Contents">Contents</a>)
+[<a name="p323" href="#p323">page 323</a>] (<a href="#Contents">Contents</a>)
<a name="7.20.8.2" href="#7.20.8.2"><b> 7.20.8.2 The wcstombs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.20"><stdlib.h></a>
size_t wcstombs(char * restrict s,
const wchar_t * restrict pwcs,
size_t n);
- Description
+<b> Description</b>
2 The wcstombs function converts a sequence of wide characters from the array pointed
to by pwcs into a sequence of corresponding multibyte characters that begins in the
initial shift state, and stores these multibyte characters into the array pointed to by s,
function, except that the conversion state of the wctomb function is not affected.
3 No more than n bytes will be modified in the array pointed to by s. If copying takes place
between objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
4 If a wide character is encountered that does not correspond to a valid multibyte character,
the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function
returns the number of bytes modified, not including a terminating null character, if
-[<a name="#p324" href="p324">page 324</a>] (<a href="#Contents">Contents</a>)
+[<a name="p324" href="#p324">page 324</a>] (<a href="#Contents">Contents</a>)
<a name="7.21" href="#7.21"><b> 7.21 String handling <string.h></b></a>
<a name="7.21.1" href="#7.21.1"><b> 7.21.1 String function conventions</b></a>
different value).
<a name="7.21.2" href="#7.21.2"><b> 7.21.2 Copying functions</b></a>
<a name="7.21.2.1" href="#7.21.2.1"><b> 7.21.2.1 The memcpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
void *memcpy(void * restrict s1,
const void * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The memcpy function copies n characters from the object pointed to by s2 into the
object pointed to by s1. If copying takes place between objects that overlap, the behavior
is undefined.
- Returns
+<b> Returns</b>
3 The memcpy function returns the value of s1.
268) See ''future library directions'' (<a href="#7.26.11">7.26.11</a>).
-[<a name="#p325" href="p325">page 325</a>] (<a href="#Contents">Contents</a>)
+[<a name="p325" href="#p325">page 325</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.2.2" href="#7.21.2.2"><b> 7.21.2.2 The memmove function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
void *memmove(void *s1, const void *s2, size_t n);
- Description
+<b> Description</b>
2 The memmove function copies n characters from the object pointed to by s2 into the
object pointed to by s1. Copying takes place as if the n characters from the object
pointed to by s2 are first copied into a temporary array of n characters that does not
overlap the objects pointed to by s1 and s2, and then the n characters from the
temporary array are copied into the object pointed to by s1.
- Returns
+<b> Returns</b>
3 The memmove function returns the value of s1.
<a name="7.21.2.3" href="#7.21.2.3"><b> 7.21.2.3 The strcpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strcpy(char * restrict s1,
const char * restrict s2);
- Description
+<b> Description</b>
2 The strcpy function copies the string pointed to by s2 (including the terminating null
character) into the array pointed to by s1. If copying takes place between objects that
overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The strcpy function returns the value of s1.
<a name="7.21.2.4" href="#7.21.2.4"><b> 7.21.2.4 The strncpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strncpy(char * restrict s1,
const char * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The strncpy function copies not more than n characters (characters that follow a null
character are not copied) from the array pointed to by s2 to the array pointed to by
-[<a name="#p326" href="p326">page 326</a>] (<a href="#Contents">Contents</a>)
+[<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
s1.269) If copying takes place between objects that overlap, the behavior is undefined.
3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
are appended to the copy in the array pointed to by s1, until n characters in all have been
written.
- Returns
+<b> Returns</b>
4 The strncpy function returns the value of s1.
<a name="7.21.3" href="#7.21.3"><b> 7.21.3 Concatenation functions</b></a>
<a name="7.21.3.1" href="#7.21.3.1"><b> 7.21.3.1 The strcat function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strcat(char * restrict s1,
const char * restrict s2);
- Description
+<b> Description</b>
2 The strcat function appends a copy of the string pointed to by s2 (including the
terminating null character) to the end of the string pointed to by s1. The initial character
of s2 overwrites the null character at the end of s1. If copying takes place between
objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The strcat function returns the value of s1.
<a name="7.21.3.2" href="#7.21.3.2"><b> 7.21.3.2 The strncat function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strncat(char * restrict s1,
const char * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The strncat function appends not more than n characters (a null character and
characters that follow it are not appended) from the array pointed to by s2 to the end of
the string pointed to by s1. The initial character of s2 overwrites the null character at the
270) Thus, the maximum number of characters that can end up in the array pointed to by s1 is
strlen(s1)+n+1.
-[<a name="#p327" href="p327">page 327</a>] (<a href="#Contents">Contents</a>)
+[<a name="p327" href="#p327">page 327</a>] (<a href="#Contents">Contents</a>)
takes place between objects that overlap, the behavior is undefined.
- Returns
+<b> Returns</b>
3 The strncat function returns the value of s1.
Forward references: the strlen function (<a href="#7.21.6.3">7.21.6.3</a>).
<a name="7.21.4" href="#7.21.4"><b> 7.21.4 Comparison functions</b></a>
pair of characters (both interpreted as unsigned char) that differ in the objects being
compared.
<a name="7.21.4.1" href="#7.21.4.1"><b> 7.21.4.1 The memcmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
int memcmp(const void *s1, const void *s2, size_t n);
- Description
+<b> Description</b>
2 The memcmp function compares the first n characters of the object pointed to by s1 to
the first n characters of the object pointed to by s2.271)
- Returns
+<b> Returns</b>
3 The memcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
pointed to by s2.
<a name="7.21.4.2" href="#7.21.4.2"><b> 7.21.4.2 The strcmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
int strcmp(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strcmp function compares the string pointed to by s1 to the string pointed to by
s2.
- Returns
+<b> Returns</b>
3 The strcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
indeterminate. Strings shorter than their allocated space and unions may also cause problems in
comparison.
-[<a name="#p328" href="p328">page 328</a>] (<a href="#Contents">Contents</a>)
+[<a name="p328" href="#p328">page 328</a>] (<a href="#Contents">Contents</a>)
pointed to by s2.
<a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The strcoll function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
int strcoll(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strcoll function compares the string pointed to by s1 to the string pointed to by
s2, both interpreted as appropriate to the LC_COLLATE category of the current locale.
- Returns
+<b> Returns</b>
3 The strcoll function returns an integer greater than, equal to, or less than zero,
accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
pointed to by s2 when both are interpreted as appropriate to the current locale.
<a name="7.21.4.4" href="#7.21.4.4"><b> 7.21.4.4 The strncmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
int strncmp(const char *s1, const char *s2, size_t n);
- Description
+<b> Description</b>
2 The strncmp function compares not more than n characters (characters that follow a
null character are not compared) from the array pointed to by s1 to the array pointed to
by s2.
- Returns
+<b> Returns</b>
3 The strncmp function returns an integer greater than, equal to, or less than zero,
accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
to, or less than the possibly null-terminated array pointed to by s2.
<a name="7.21.4.5" href="#7.21.4.5"><b> 7.21.4.5 The strxfrm function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
size_t strxfrm(char * restrict s1,
const char * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The strxfrm function transforms the string pointed to by s2 and places the resulting
string into the array pointed to by s1. The transformation is such that if the strcmp
function is applied to two transformed strings, it returns a value greater than, equal to, or
-[<a name="#p329" href="p329">page 329</a>] (<a href="#Contents">Contents</a>)
+[<a name="p329" href="#p329">page 329</a>] (<a href="#Contents">Contents</a>)
less than zero, corresponding to the result of the strcoll function applied to the same
two original strings. No more than n characters are placed into the resulting array
pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to
be a null pointer. If copying takes place between objects that overlap, the behavior is
undefined.
- Returns
+<b> Returns</b>
3 The strxfrm function returns the length of the transformed string (not including the
terminating null character). If the value returned is n or more, the contents of the array
pointed to by s1 are indeterminate.
<a name="7.21.5" href="#7.21.5"><b> 7.21.5 Search functions</b></a>
<a name="7.21.5.1" href="#7.21.5.1"><b> 7.21.5.1 The memchr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
void *memchr(const void *s, int c, size_t n);
- Description
+<b> Description</b>
2 The memchr function locates the first occurrence of c (converted to an unsigned
char) in the initial n characters (each interpreted as unsigned char) of the object
pointed to by s.
- Returns
+<b> Returns</b>
3 The memchr function returns a pointer to the located character, or a null pointer if the
character does not occur in the object.
<a name="7.21.5.2" href="#7.21.5.2"><b> 7.21.5.2 The strchr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strchr(const char *s, int c);
- Description
+<b> Description</b>
2 The strchr function locates the first occurrence of c (converted to a char) in the
string pointed to by s. The terminating null character is considered to be part of the
string.
- Returns
+<b> Returns</b>
3 The strchr function returns a pointer to the located character, or a null pointer if the
character does not occur in the string.
-[<a name="#p330" href="p330">page 330</a>] (<a href="#Contents">Contents</a>)
+[<a name="p330" href="#p330">page 330</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.5.3" href="#7.21.5.3"><b> 7.21.5.3 The strcspn function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
size_t strcspn(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strcspn function computes the length of the maximum initial segment of the string
pointed to by s1 which consists entirely of characters not from the string pointed to by
s2.
- Returns
+<b> Returns</b>
3 The strcspn function returns the length of the segment.
<a name="7.21.5.4" href="#7.21.5.4"><b> 7.21.5.4 The strpbrk function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strpbrk(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strpbrk function locates the first occurrence in the string pointed to by s1 of any
character from the string pointed to by s2.
- Returns
+<b> Returns</b>
3 The strpbrk function returns a pointer to the character, or a null pointer if no character
from s2 occurs in s1.
<a name="7.21.5.5" href="#7.21.5.5"><b> 7.21.5.5 The strrchr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strrchr(const char *s, int c);
- Description
+<b> Description</b>
2 The strrchr function locates the last occurrence of c (converted to a char) in the
string pointed to by s. The terminating null character is considered to be part of the
string.
- Returns
+<b> Returns</b>
3 The strrchr function returns a pointer to the character, or a null pointer if c does not
occur in the string.
-[<a name="#p331" href="p331">page 331</a>] (<a href="#Contents">Contents</a>)
+[<a name="p331" href="#p331">page 331</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.5.6" href="#7.21.5.6"><b> 7.21.5.6 The strspn function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
size_t strspn(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strspn function computes the length of the maximum initial segment of the string
pointed to by s1 which consists entirely of characters from the string pointed to by s2.
- Returns
+<b> Returns</b>
3 The strspn function returns the length of the segment.
<a name="7.21.5.7" href="#7.21.5.7"><b> 7.21.5.7 The strstr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strstr(const char *s1, const char *s2);
- Description
+<b> Description</b>
2 The strstr function locates the first occurrence in the string pointed to by s1 of the
sequence of characters (excluding the terminating null character) in the string pointed to
by s2.
- Returns
+<b> Returns</b>
3 The strstr function returns a pointer to the located string, or a null pointer if the string
is not found. If s2 points to a string with zero length, the function returns s1.
<a name="7.21.5.8" href="#7.21.5.8"><b> 7.21.5.8 The strtok function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strtok(char * restrict s1,
const char * restrict s2);
- Description
+<b> Description</b>
2 A sequence of calls to the strtok function breaks the string pointed to by s1 into a
sequence of tokens, each of which is delimited by a character from the string pointed to
by s2. The first call in the sequence has a non-null first argument; subsequent calls in the
that is not contained in the current separator string pointed to by s2. If no such character
is found, then there are no tokens in the string pointed to by s1 and the strtok function
-[<a name="#p332" href="p332">page 332</a>] (<a href="#Contents">Contents</a>)
+[<a name="p332" href="#p332">page 332</a>] (<a href="#Contents">Contents</a>)
returns a null pointer. If such a character is found, it is the start of the first token.
4 The strtok function then searches from there for a character that is contained in the
5 Each subsequent call, with a null pointer as the value of the first argument, starts
searching from the saved pointer and behaves as described above.
6 The implementation shall behave as if no library function calls the strtok function.
- Returns
+<b> Returns</b>
7 The strtok function returns a pointer to the first character of a token, or a null pointer
if there is no token.
8 EXAMPLE
<a name="7.21.6" href="#7.21.6"><b> 7.21.6 Miscellaneous functions</b></a>
<a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The memset function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
void *memset(void *s, int c, size_t n);
- Description
+<b> Description</b>
2 The memset function copies the value of c (converted to an unsigned char) into
each of the first n characters of the object pointed to by s.
- Returns
+<b> Returns</b>
3 The memset function returns the value of s.
-[<a name="#p333" href="p333">page 333</a>] (<a href="#Contents">Contents</a>)
+[<a name="p333" href="#p333">page 333</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.6.2" href="#7.21.6.2"><b> 7.21.6.2 The strerror function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
char *strerror(int errnum);
- Description
+<b> Description</b>
2 The strerror function maps the number in errnum to a message string. Typically,
the values for errnum come from errno, but strerror shall map any value of type
int to a message.
3 The implementation shall behave as if no library function calls the strerror function.
- Returns
+<b> Returns</b>
4 The strerror function returns a pointer to the string, the contents of which are locale-
specific. The array pointed to shall not be modified by the program, but may be
overwritten by a subsequent call to the strerror function.
<a name="7.21.6.3" href="#7.21.6.3"><b> 7.21.6.3 The strlen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.21"><string.h></a>
size_t strlen(const char *s);
- Description
+<b> Description</b>
2 The strlen function computes the length of the string pointed to by s.
- Returns
+<b> Returns</b>
3 The strlen function returns the number of characters that precede the terminating null
character.
-[<a name="#p334" href="p334">page 334</a>] (<a href="#Contents">Contents</a>)
+[<a name="p334" href="#p334">page 334</a>] (<a href="#Contents">Contents</a>)
<a name="7.22" href="#7.22"><b> 7.22 Type-generic math <tgmath.h></b></a>
1 The header <a href="#7.22"><tgmath.h></a> includes the headers <a href="#7.12"><math.h></a> and <a href="#7.3"><complex.h></a> and
273) If the type of the argument is not compatible with the type of the parameter for the selected function,
the behavior is undefined.
-[<a name="#p335" href="p335">page 335</a>] (<a href="#Contents">Contents</a>)
+[<a name="p335" href="#p335">page 335</a>] (<a href="#Contents">Contents</a>)
<a href="#7.12"><math.h></a> <a href="#7.3"><complex.h></a> type-generic
function function macro
function in <a href="#7.12"><math.h></a>, the corresponding type-generic macro has the same name as the
function. These type-generic macros are:
-[<a name="#p336" href="p336">page 336</a>] (<a href="#Contents">Contents</a>)
+[<a name="p336" href="#p336">page 336</a>] (<a href="#Contents">Contents</a>)
carg conj creal
cimag cproj
-[<a name="#p337" href="p337">page 337</a>] (<a href="#Contents">Contents</a>)
+[<a name="p337" href="#p337">page 337</a>] (<a href="#Contents">Contents</a>)
<a name="7.23" href="#7.23"><b> 7.23 Date and time <time.h></b></a>
<a name="7.23.1" href="#7.23.1"><b> 7.23.1 Components of time</b></a>
274) The range [0, 60] for tm_sec allows for a positive leap second.
-[<a name="#p338" href="p338">page 338</a>] (<a href="#Contents">Contents</a>)
+[<a name="p338" href="#p338">page 338</a>] (<a href="#Contents">Contents</a>)
The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight
Saving Time is not in effect, and negative if the information is not available.
<a name="7.23.2" href="#7.23.2"><b> 7.23.2 Time manipulation functions</b></a>
<a name="7.23.2.1" href="#7.23.2.1"><b> 7.23.2.1 The clock function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
clock_t clock(void);
- Description
+<b> Description</b>
2 The clock function determines the processor time used.
- Returns
+<b> Returns</b>
3 The clock function returns the implementation's best approximation to the processor
time used by the program since the beginning of an implementation-defined era related
only to the program invocation. To determine the time in seconds, the value returned by
the processor time used is not available or its value cannot be represented, the function
returns the value (clock_t)(-1).275)
<a name="7.23.2.2" href="#7.23.2.2"><b> 7.23.2.2 The difftime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
double difftime(time_t time1, time_t time0);
- Description
+<b> Description</b>
2 The difftime function computes the difference between two calendar times: time1 -
time0.
- Returns
+<b> Returns</b>
3 The difftime function returns the difference expressed in seconds as a double.
275) In order to measure the time spent in a program, the clock function should be called at the start of
the program and its return value subtracted from the value returned by subsequent calls.
-[<a name="#p339" href="p339">page 339</a>] (<a href="#Contents">Contents</a>)
+[<a name="p339" href="#p339">page 339</a>] (<a href="#Contents">Contents</a>)
<a name="7.23.2.3" href="#7.23.2.3"><b> 7.23.2.3 The mktime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
time_t mktime(struct tm *timeptr);
- Description
+<b> Description</b>
2 The mktime function converts the broken-down time, expressed as local time, in the
structure pointed to by timeptr into a calendar time value with the same encoding as
that of the values returned by the time function. The original values of the tm_wday
set appropriately, and the other components are set to represent the specified calendar
time, but with their values forced to the ranges indicated above; the final value of
tm_mday is not set until tm_mon and tm_year are determined.
- Returns
+<b> Returns</b>
3 The mktime function returns the specified calendar time encoded as a value of type
time_t. If the calendar time cannot be represented, the function returns the value
(time_t)(-1).
Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
-[<a name="#p340" href="p340">page 340</a>] (<a href="#Contents">Contents</a>)
+[<a name="p340" href="#p340">page 340</a>] (<a href="#Contents">Contents</a>)
time_str.tm_year = 2001 - 1900;
time_str.tm_mon = 7 - 1;
printf("%s\n", wday[time_str.tm_wday]);
<a name="7.23.2.4" href="#7.23.2.4"><b> 7.23.2.4 The time function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
time_t time(time_t *timer);
- Description
+<b> Description</b>
2 The time function determines the current calendar time. The encoding of the value is
unspecified.
- Returns
+<b> Returns</b>
3 The time function returns the implementation's best approximation to the current
calendar time. The value (time_t)(-1) is returned if the calendar time is not
available. If timer is not a null pointer, the return value is also assigned to the object it
previous call to any of them. The implementation shall behave as if no other library
functions call these functions.
<a name="7.23.3.1" href="#7.23.3.1"><b> 7.23.3.1 The asctime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
char *asctime(const struct tm *timeptr);
- Description
+<b> Description</b>
2 The asctime function converts the broken-down time in the structure pointed to by
timeptr into a string in the form
Sun Sep 16 01:03:52 1973\n\0
-[<a name="#p341" href="p341">page 341</a>] (<a href="#Contents">Contents</a>)
+[<a name="p341" href="#p341">page 341</a>] (<a href="#Contents">Contents</a>)
using the equivalent of the following algorithm.
char *asctime(const struct tm *timeptr)
1900 + timeptr->tm_year);
return result;
}
- Returns
+<b> Returns</b>
3 The asctime function returns a pointer to the string.
<a name="7.23.3.2" href="#7.23.3.2"><b> 7.23.3.2 The ctime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
char *ctime(const time_t *timer);
- Description
+<b> Description</b>
2 The ctime function converts the calendar time pointed to by timer to local time in the
form of a string. It is equivalent to
asctime(localtime(timer))
- Returns
+<b> Returns</b>
3 The ctime function returns the pointer returned by the asctime function with that
broken-down time as argument.
Forward references: the localtime function (<a href="#7.23.3.4">7.23.3.4</a>).
-[<a name="#p342" href="p342">page 342</a>] (<a href="#Contents">Contents</a>)
+[<a name="p342" href="#p342">page 342</a>] (<a href="#Contents">Contents</a>)
<a name="7.23.3.3" href="#7.23.3.3"><b> 7.23.3.3 The gmtime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
struct tm *gmtime(const time_t *timer);
- Description
+<b> Description</b>
2 The gmtime function converts the calendar time pointed to by timer into a broken-
down time, expressed as UTC.
- Returns
+<b> Returns</b>
3 The gmtime function returns a pointer to the broken-down time, or a null pointer if the
specified time cannot be converted to UTC.
<a name="7.23.3.4" href="#7.23.3.4"><b> 7.23.3.4 The localtime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
struct tm *localtime(const time_t *timer);
- Description
+<b> Description</b>
2 The localtime function converts the calendar time pointed to by timer into a
broken-down time, expressed as local time.
- Returns
+<b> Returns</b>
3 The localtime function returns a pointer to the broken-down time, or a null pointer if
the specified time cannot be converted to local time.
<a name="7.23.3.5" href="#7.23.3.5"><b> 7.23.3.5 The strftime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
size_t strftime(char * restrict s,
size_t maxsize,
const char * restrict format,
const struct tm * restrict timeptr);
- Description
+<b> Description</b>
2 The strftime function places characters into the array pointed to by s as controlled by
the string pointed to by format. The format shall be a multibyte character sequence,
beginning and ending in its initial shift state. The format string consists of zero or
consists of a % character, possibly followed by an E or O modifier character (described
below), followed by a character that determines the behavior of the conversion specifier.
All ordinary multibyte characters (including the terminating null character) are copied
-[<a name="#p343" href="p343">page 343</a>] (<a href="#Contents">Contents</a>)
+[<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
unchanged into the array. If copying takes place between objects that overlap, the
behavior is undefined. No more than maxsize characters are placed into the array.
%T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
tm_sec]
-[<a name="#p344" href="p344">page 344</a>] (<a href="#Contents">Contents</a>)
+[<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
%u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
is 1. [tm_wday]
symbols.
-[<a name="#p345" href="p345">page 345</a>] (<a href="#Contents">Contents</a>)
+[<a name="p345" href="#p345">page 345</a>] (<a href="#Contents">Contents</a>)
%OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
symbols.
%Z implementation-defined.
-[<a name="#p346" href="p346">page 346</a>] (<a href="#Contents">Contents</a>)
+[<a name="p346" href="#p346">page 346</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
8 If the total number of resulting characters including the terminating null character is not
more than maxsize, the strftime function returns the number of characters placed
into the array pointed to by s not including the terminating null character. Otherwise,
-[<a name="#p347" href="p347">page 347</a>] (<a href="#Contents">Contents</a>)
+[<a name="p347" href="#p347">page 347</a>] (<a href="#Contents">Contents</a>)
<a name="7.24" href="#7.24"><b> 7.24 Extended multibyte and wide character utilities <wchar.h></b></a>
<a name="7.24.1" href="#7.24.1"><b> 7.24.1 Introduction</b></a>
278) wchar_t and wint_t can be the same integer type.
279) The value of the macro WEOF may differ from that of EOF and need not be negative.
-[<a name="#p348" href="p348">page 348</a>] (<a href="#Contents">Contents</a>)
+[<a name="p348" href="#p348">page 348</a>] (<a href="#Contents">Contents</a>)
-- Functions for wide string date and time conversion; and
-- Functions that provide extended capabilities for conversion between multibyte and
1 The formatted wide character input/output functions shall behave as if there is a sequence
point after the actions associated with each specifier.280)
<a name="7.24.2.1" href="#7.24.2.1"><b> 7.24.2.1 The fwprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int fwprintf(FILE * restrict stream,
const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The fwprintf function writes output to the stream pointed to by stream, under
control of the wide string pointed to by format that specifies how subsequent arguments
are converted for output. If there are insufficient arguments for the format, the behavior
280) The fwprintf functions perform writes to memory for the %n specifier.
-[<a name="#p349" href="p349">page 349</a>] (<a href="#Contents">Contents</a>)
+[<a name="p349" href="#p349">page 349</a>] (<a href="#Contents">Contents</a>)
left adjustment flag, described later, has been given) to the field width. The field
width takes the form of an asterisk * (described later) or a nonnegative decimal
282) The results of all floating conversions of a negative zero, and of negative values that round to zero,
include a minus sign.
-[<a name="#p350" href="p350">page 350</a>] (<a href="#Contents">Contents</a>)
+[<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
and G conversions, the result of converting a floating-point number always
contains a decimal-point wide character, even if no digits follow it. (Normally, a
an intmax_t or uintmax_t argument; or that a following n conversion
specifier applies to a pointer to an intmax_t argument.
-[<a name="#p351" href="p351">page 351</a>] (<a href="#Contents">Contents</a>)
+[<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
size_t or the corresponding signed integer type argument; or that a
[-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of
any n-wchar-sequence, is implementation-defined. The F conversion
specifier produces INF, INFINITY, or NAN instead of inf, infinity, or
-[<a name="#p352" href="p352">page 352</a>] (<a href="#Contents">Contents</a>)
+[<a name="p352" href="#p352">page 352</a>] (<a href="#Contents">Contents</a>)
nan, respectively.283)
e,E A double argument representing a floating-point number is converted in the
284) Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide
character so that subsequent digits align to nibble (4-bit) boundaries.
-[<a name="#p353" href="p353">page 353</a>] (<a href="#Contents">Contents</a>)
+[<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
for an exact representation of the value; if the precision is missing and
FLT_RADIX is not a power of 2, then the precision is sufficient to
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point wide character.
-[<a name="#p354" href="p354">page 354</a>] (<a href="#Contents">Contents</a>)
+[<a name="p354" href="#p354">page 354</a>] (<a href="#Contents">Contents</a>)
defined manner.
n The argument shall be a pointer to signed integer into which is written the
adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that
the error should have a correct sign for the current rounding direction.
- Returns
+<b> Returns</b>
14 The fwprintf function returns the number of wide characters transmitted, or a negative
value if an output or encoding error occurred.
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
-[<a name="#p355" href="p355">page 355</a>] (<a href="#Contents">Contents</a>)
+[<a name="p355" href="#p355">page 355</a>] (<a href="#Contents">Contents</a>)
Environmental limits
15 The number of wide characters that can be produced by any single conversion shall be at
int day, hour, min;
fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n",
weekday, month, day, hour, min);
- fwprintf(stdout, L"pi = %.5f\n", 4 * atan(<a href="#1.0">1.0</a>));
+ fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0));
Forward references: the btowc function (<a href="#7.24.6.1.1">7.24.6.1.1</a>), the mbrtowc function
(<a href="#7.24.6.3.2">7.24.6.3.2</a>).
<a name="7.24.2.2" href="#7.24.2.2"><b> 7.24.2.2 The fwscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int fwscanf(FILE * restrict stream,
const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The fwscanf function reads input from the stream pointed to by stream, under
control of the wide string pointed to by format that specifies the admissible input
sequences and how they are to be converted for assignment, using subsequent arguments
-[<a name="#p356" href="p356">page 356</a>] (<a href="#Contents">Contents</a>)
+[<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
-- An optional length modifier that specifies the size of the receiving object.
-- A conversion specifier wide character that specifies the type of conversion to be
289) fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
-[<a name="#p357" href="p357">page 357</a>] (<a href="#Contents">Contents</a>)
+[<a name="p357" href="#p357">page 357</a>] (<a href="#Contents">Contents</a>)
object does not have an appropriate type, or if the result of the conversion cannot be
represented in the object, the behavior is undefined.
i Matches an optionally signed integer, whose format is the same as expected
for the subject sequence of the wcstol function with the value 0 for the
base argument. The corresponding argument shall be a pointer to signed
-[<a name="#p358" href="p358">page 358</a>] (<a href="#Contents">Contents</a>)
+[<a name="p358" href="#p358">page 358</a>] (<a href="#Contents">Contents</a>)
integer.
o Matches an optionally signed octal integer, whose format is the same as
If an l length modifier is present, the corresponding argument shall be a
pointer to the initial element of an array of wchar_t large enough to accept
-[<a name="#p359" href="p359">page 359</a>] (<a href="#Contents">Contents</a>)
+[<a name="p359" href="#p359">page 359</a>] (<a href="#Contents">Contents</a>)
the sequence and the terminating null wide character, which will be added
automatically.
from the input stream so far by this call to the fwscanf function. Execution
of a %n directive does not increment the assignment count returned at the
completion of execution of the fwscanf function. No argument is
-[<a name="#p360" href="p360">page 360</a>] (<a href="#Contents">Contents</a>)
+[<a name="p360" href="#p360">page 360</a>] (<a href="#Contents">Contents</a>)
converted, but one is consumed. If the conversion specification includes an
assignment-suppressing wide character or a field width, the behavior is
15 Trailing white space (including new-line wide characters) is left unread unless matched
by a directive. The success of literal matches and suppressed assignments is not directly
determinable other than via the %n directive.
- Returns
+<b> Returns</b>
16 The fwscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the function returns the number of input items
assigned, which can be fewer than provided for, or even zero, in the event of an early
290) See ''future library directions'' (<a href="#7.26.12">7.26.12</a>).
-[<a name="#p361" href="p361">page 361</a>] (<a href="#Contents">Contents</a>)
+[<a name="p361" href="#p361">page 361</a>] (<a href="#Contents">Contents</a>)
Forward references: the wcstod, wcstof, and wcstold functions (<a href="#7.24.4.1.1">7.24.4.1.1</a>), the
wcstol, wcstoll, wcstoul, and wcstoull functions (<a href="#7.24.4.1.2">7.24.4.1.2</a>), the wcrtomb
function (<a href="#7.24.6.3.3">7.24.6.3.3</a>).
<a name="7.24.2.3" href="#7.24.2.3"><b> 7.24.2.3 The swprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int swprintf(wchar_t * restrict s,
size_t n,
const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The swprintf function is equivalent to fwprintf, except that the argument s
specifies an array of wide characters into which the generated output is to be written,
rather than written to a stream. No more than n wide characters are written, including a
terminating null wide character, which is always added (unless n is zero).
- Returns
+<b> Returns</b>
3 The swprintf function returns the number of wide characters written in the array, not
counting the terminating null wide character, or a negative value if an encoding error
occurred or if n or more wide characters were requested to be written.
<a name="7.24.2.4" href="#7.24.2.4"><b> 7.24.2.4 The swscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int swscanf(const wchar_t * restrict s,
const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The swscanf function is equivalent to fwscanf, except that the argument s specifies a
wide string from which the input is to be obtained, rather than from a stream. Reaching
the end of the wide string is equivalent to encountering end-of-file for the fwscanf
function.
- Returns
+<b> Returns</b>
3 The swscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the swscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
-[<a name="#p362" href="p362">page 362</a>] (<a href="#Contents">Contents</a>)
+[<a name="p362" href="#p362">page 362</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.2.5" href="#7.24.2.5"><b> 7.24.2.5 The vfwprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int vfwprintf(FILE * restrict stream,
const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwprintf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vfwprintf function returns the number of wide characters transmitted, or a
negative value if an output or encoding error occurred.
4 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting
291) As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
invoke the va_arg macro, the value of arg after the return is indeterminate.
-[<a name="#p363" href="p363">page 363</a>] (<a href="#Contents">Contents</a>)
+[<a name="p363" href="#p363">page 363</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.2.6" href="#7.24.2.6"><b> 7.24.2.6 The vfwscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int vfwscanf(FILE * restrict stream,
const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vfwscanf function is equivalent to fwscanf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwscanf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vfwscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vfwscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.24.2.7" href="#7.24.2.7"><b> 7.24.2.7 The vswprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.24"><wchar.h></a>
int vswprintf(wchar_t * restrict s,
size_t n,
const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vswprintf function is equivalent to swprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vswprintf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vswprintf function returns the number of wide characters written in the array, not
counting the terminating null wide character, or a negative value if an encoding error
occurred or if n or more wide characters were requested to be generated.
-[<a name="#p364" href="p364">page 364</a>] (<a href="#Contents">Contents</a>)
+[<a name="p364" href="#p364">page 364</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.2.8" href="#7.24.2.8"><b> 7.24.2.8 The vswscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.24"><wchar.h></a>
int vswscanf(const wchar_t * restrict s,
const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vswscanf function is equivalent to swscanf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vswscanf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vswscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vswscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.24.2.9" href="#7.24.2.9"><b> 7.24.2.9 The vwprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.24"><wchar.h></a>
int vwprintf(const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vwprintf function is equivalent to wprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vwprintf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vwprintf function returns the number of wide characters transmitted, or a negative
value if an output or encoding error occurred.
-[<a name="#p365" href="p365">page 365</a>] (<a href="#Contents">Contents</a>)
+[<a name="p365" href="#p365">page 365</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.2.10" href="#7.24.2.10"><b> 7.24.2.10 The vwscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.15"><stdarg.h></a>
#include <a href="#7.24"><wchar.h></a>
int vwscanf(const wchar_t * restrict format,
va_list arg);
- Description
+<b> Description</b>
2 The vwscanf function is equivalent to wscanf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vwscanf function does not invoke the
va_end macro.291)
- Returns
+<b> Returns</b>
3 The vwscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the vwscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.24.2.11" href="#7.24.2.11"><b> 7.24.2.11 The wprintf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wprintf(const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The wprintf function is equivalent to fwprintf with the argument stdout
interposed before the arguments to wprintf.
- Returns
+<b> Returns</b>
3 The wprintf function returns the number of wide characters transmitted, or a negative
value if an output or encoding error occurred.
<a name="7.24.2.12" href="#7.24.2.12"><b> 7.24.2.12 The wscanf function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wscanf(const wchar_t * restrict format, ...);
- Description
+<b> Description</b>
2 The wscanf function is equivalent to fwscanf with the argument stdin interposed
before the arguments to wscanf.
-[<a name="#p366" href="p366">page 366</a>] (<a href="#Contents">Contents</a>)
+[<a name="p366" href="#p366">page 366</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The wscanf function returns the value of the macro EOF if an input failure occurs
before any conversion. Otherwise, the wscanf function returns the number of input
items assigned, which can be fewer than provided for, or even zero, in the event of an
early matching failure.
<a name="7.24.3" href="#7.24.3"><b> 7.24.3 Wide character input/output functions</b></a>
<a name="7.24.3.1" href="#7.24.3.1"><b> 7.24.3.1 The fgetwc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t fgetwc(FILE *stream);
- Description
+<b> Description</b>
2 If the end-of-file indicator for the input stream pointed to by stream is not set and a
next wide character is present, the fgetwc function obtains that wide character as a
wchar_t converted to a wint_t and advances the associated file position indicator for
the stream (if defined).
- Returns
+<b> Returns</b>
3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end-
of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise,
the fgetwc function returns the next wide character from the input stream pointed to by
function returns WEOF. If an encoding error occurs (including too few bytes), the value of
the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.292)
<a name="7.24.3.2" href="#7.24.3.2"><b> 7.24.3.2 The fgetws function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wchar_t *fgetws(wchar_t * restrict s,
int n, FILE * restrict stream);
- Description
+<b> Description</b>
2 The fgetws function reads at most one less than the number of wide characters
specified by n from the stream pointed to by stream into the array pointed to by s. No
292) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
-[<a name="#p367" href="p367">page 367</a>] (<a href="#Contents">Contents</a>)
+[<a name="p367" href="#p367">page 367</a>] (<a href="#Contents">Contents</a>)
additional wide characters are read after a new-line wide character (which is retained) or
after end-of-file. A null wide character is written immediately after the last wide
character read into the array.
- Returns
+<b> Returns</b>
3 The fgetws function returns s if successful. If end-of-file is encountered and no
characters have been read into the array, the contents of the array remain unchanged and a
null pointer is returned. If a read or encoding error occurs during the operation, the array
contents are indeterminate and a null pointer is returned.
<a name="7.24.3.3" href="#7.24.3.3"><b> 7.24.3.3 The fputwc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t fputwc(wchar_t c, FILE *stream);
- Description
+<b> Description</b>
2 The fputwc function writes the wide character specified by c to the output stream
pointed to by stream, at the position indicated by the associated file position indicator
for the stream (if defined), and advances the indicator appropriately. If the file cannot
support positioning requests, or if the stream was opened with append mode, the
character is appended to the output stream.
- Returns
+<b> Returns</b>
3 The fputwc function returns the wide character written. If a write error occurs, the
error indicator for the stream is set and fputwc returns WEOF. If an encoding error
occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF.
<a name="7.24.3.4" href="#7.24.3.4"><b> 7.24.3.4 The fputws function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int fputws(const wchar_t * restrict s,
FILE * restrict stream);
- Description
+<b> Description</b>
2 The fputws function writes the wide string pointed to by s to the stream pointed to by
stream. The terminating null wide character is not written.
- Returns
+<b> Returns</b>
3 The fputws function returns EOF if a write or encoding error occurs; otherwise, it
returns a nonnegative value.
-[<a name="#p368" href="p368">page 368</a>] (<a href="#Contents">Contents</a>)
+[<a name="p368" href="#p368">page 368</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.3.5" href="#7.24.3.5"><b> 7.24.3.5 The fwide function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int fwide(FILE *stream, int mode);
- Description
+<b> Description</b>
2 The fwide function determines the orientation of the stream pointed to by stream. If
mode is greater than zero, the function first attempts to make the stream wide oriented. If
mode is less than zero, the function first attempts to make the stream byte oriented.293)
Otherwise, mode is zero and the function does not alter the orientation of the stream.
- Returns
+<b> Returns</b>
3 The fwide function returns a value greater than zero if, after the call, the stream has
wide orientation, a value less than zero if the stream has byte orientation, or zero if the
stream has no orientation.
<a name="7.24.3.6" href="#7.24.3.6"><b> 7.24.3.6 The getwc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t getwc(FILE *stream);
- Description
+<b> Description</b>
2 The getwc function is equivalent to fgetwc, except that if it is implemented as a
macro, it may evaluate stream more than once, so the argument should never be an
expression with side effects.
- Returns
+<b> Returns</b>
3 The getwc function returns the next wide character from the input stream pointed to by
stream, or WEOF.
<a name="7.24.3.7" href="#7.24.3.7"><b> 7.24.3.7 The getwchar function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wint_t getwchar(void);
293) If the orientation of the stream has already been determined, fwide does not change it.
-[<a name="#p369" href="p369">page 369</a>] (<a href="#Contents">Contents</a>)
+[<a name="p369" href="#p369">page 369</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The getwchar function is equivalent to getwc with the argument stdin.
- Returns
+<b> Returns</b>
3 The getwchar function returns the next wide character from the input stream pointed to
by stdin, or WEOF.
<a name="7.24.3.8" href="#7.24.3.8"><b> 7.24.3.8 The putwc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t putwc(wchar_t c, FILE *stream);
- Description
+<b> Description</b>
2 The putwc function is equivalent to fputwc, except that if it is implemented as a
macro, it may evaluate stream more than once, so that argument should never be an
expression with side effects.
- Returns
+<b> Returns</b>
3 The putwc function returns the wide character written, or WEOF.
<a name="7.24.3.9" href="#7.24.3.9"><b> 7.24.3.9 The putwchar function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wint_t putwchar(wchar_t c);
- Description
+<b> Description</b>
2 The putwchar function is equivalent to putwc with the second argument stdout.
- Returns
+<b> Returns</b>
3 The putwchar function returns the character written, or WEOF.
<a name="7.24.3.10" href="#7.24.3.10"><b> 7.24.3.10 The ungetwc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t ungetwc(wint_t c, FILE *stream);
- Description
+<b> Description</b>
2 The ungetwc function pushes the wide character specified by c back onto the input
stream pointed to by stream. Pushed-back wide characters will be returned by
subsequent reads on that stream in the reverse order of their pushing. A successful
-[<a name="#p370" href="p370">page 370</a>] (<a href="#Contents">Contents</a>)
+[<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
intervening call (with the stream pointed to by stream) to a file positioning function
(fseek, fsetpos, or rewind) discards any pushed-back wide characters for the
back. For a text or binary stream, the value of its file position indicator after a successful
call to the ungetwc function is unspecified until all pushed-back wide characters are
read or discarded.
- Returns
+<b> Returns</b>
6 The ungetwc function returns the wide character pushed back, or WEOF if the operation
fails.
<a name="7.24.4" href="#7.24.4"><b> 7.24.4 General wide string utilities</b></a>
-[<a name="#p371" href="p371">page 371</a>] (<a href="#Contents">Contents</a>)
+[<a name="p371" href="#p371">page 371</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.1" href="#7.24.4.1"><b> 7.24.4.1 Wide string numeric conversion functions</b></a>
<a name="7.24.4.1.1" href="#7.24.4.1.1"><b> 7.24.4.1.1 The wcstod, wcstof, and wcstold functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
double wcstod(const wchar_t * restrict nptr,
wchar_t ** restrict endptr);
wchar_t ** restrict endptr);
long double wcstold(const wchar_t * restrict nptr,
wchar_t ** restrict endptr);
- Description
+<b> Description</b>
2 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide
string pointed to by nptr to double, float, and long double representation,
respectively. First, they decompose the input string into three parts: an initial, possibly
n-wchar-sequence nondigit
The subject sequence is defined as the longest initial subsequence of the input wide
string, starting with the first non-white-space wide character, that is of the expected form.
-[<a name="#p372" href="p372">page 372</a>] (<a href="#Contents">Contents</a>)
+[<a name="p372" href="#p372">page 372</a>] (<a href="#Contents">Contents</a>)
The subject sequence contains no wide characters if the input wide string is not of the
expected form.
295) An implementation may use the n-wchar sequence to determine extra information to be represented in
the NaN's significand.
-[<a name="#p373" href="p373">page 373</a>] (<a href="#Contents">Contents</a>)
+[<a name="p373" href="#p373">page 373</a>] (<a href="#Contents">Contents</a>)
9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in
<a href="#7.7"><float.h></a>) significant digits, the result should be correctly rounded. If the subject
correctly rounding L and U according to the current rounding direction, with the extra
stipulation that the error with respect to D should have a correct sign for the current
rounding direction.296)
- Returns
+<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value is outside the range of representable values, plus or
minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return
296) DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
to the same internal floating value, but if not will round to adjacent values.
-[<a name="#p374" href="p374">page 374</a>] (<a href="#Contents">Contents</a>)
+[<a name="p374" href="#p374">page 374</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.1.2" href="#7.24.4.1.2"><b> 7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
long int wcstol(
const wchar_t * restrict nptr,
const wchar_t * restrict nptr,
wchar_t ** restrict endptr,
int base);
- Description
+<b> Description</b>
2 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial
portion of the wide string pointed to by nptr to long int, long long int,
unsigned long int, and unsigned long long int representation,
value of base is 16, the wide characters 0x or 0X may optionally precede the sequence
of letters and digits, following the sign if present.
-[<a name="#p375" href="p375">page 375</a>] (<a href="#Contents">Contents</a>)
+[<a name="p375" href="#p375">page 375</a>] (<a href="#Contents">Contents</a>)
4 The subject sequence is defined as the longest initial subsequence of the input wide
string, starting with the first non-white-space wide character, that is of the expected form.
7 If the subject sequence is empty or does not have the expected form, no conversion is
performed; the value of nptr is stored in the object pointed to by endptr, provided
that endptr is not a null pointer.
- Returns
+<b> Returns</b>
8 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted
value, if any. If no conversion could be performed, zero is returned. If the correct value
is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN,
sign of the value, if any), and the value of the macro ERANGE is stored in errno.
<a name="7.24.4.2" href="#7.24.4.2"><b> 7.24.4.2 Wide string copying functions</b></a>
<a name="7.24.4.2.1" href="#7.24.4.2.1"><b> 7.24.4.2.1 The wcscpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcscpy(wchar_t * restrict s1,
const wchar_t * restrict s2);
- Description
+<b> Description</b>
2 The wcscpy function copies the wide string pointed to by s2 (including the terminating
null wide character) into the array pointed to by s1.
- Returns
+<b> Returns</b>
3 The wcscpy function returns the value of s1.
-[<a name="#p376" href="p376">page 376</a>] (<a href="#Contents">Contents</a>)
+[<a name="p376" href="#p376">page 376</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.2.2" href="#7.24.4.2.2"><b> 7.24.4.2.2 The wcsncpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcsncpy(wchar_t * restrict s1,
const wchar_t * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The wcsncpy function copies not more than n wide characters (those that follow a null
wide character are not copied) from the array pointed to by s2 to the array pointed to by
s1.297)
3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
wide characters are appended to the copy in the array pointed to by s1, until n wide
characters in all have been written.
- Returns
+<b> Returns</b>
4 The wcsncpy function returns the value of s1.
<a name="7.24.4.2.3" href="#7.24.4.2.3"><b> 7.24.4.2.3 The wmemcpy function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wmemcpy(wchar_t * restrict s1,
const wchar_t * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The wmemcpy function copies n wide characters from the object pointed to by s2 to the
object pointed to by s1.
- Returns
+<b> Returns</b>
3 The wmemcpy function returns the value of s1.
297) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
result will not be null-terminated.
-[<a name="#p377" href="p377">page 377</a>] (<a href="#Contents">Contents</a>)
+[<a name="p377" href="#p377">page 377</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.2.4" href="#7.24.4.2.4"><b> 7.24.4.2.4 The wmemmove function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2,
size_t n);
- Description
+<b> Description</b>
2 The wmemmove function copies n wide characters from the object pointed to by s2 to
the object pointed to by s1. Copying takes place as if the n wide characters from the
object pointed to by s2 are first copied into a temporary array of n wide characters that
does not overlap the objects pointed to by s1 or s2, and then the n wide characters from
the temporary array are copied into the object pointed to by s1.
- Returns
+<b> Returns</b>
3 The wmemmove function returns the value of s1.
<a name="7.24.4.3" href="#7.24.4.3"><b> 7.24.4.3 Wide string concatenation functions</b></a>
<a name="7.24.4.3.1" href="#7.24.4.3.1"><b> 7.24.4.3.1 The wcscat function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcscat(wchar_t * restrict s1,
const wchar_t * restrict s2);
- Description
+<b> Description</b>
2 The wcscat function appends a copy of the wide string pointed to by s2 (including the
terminating null wide character) to the end of the wide string pointed to by s1. The initial
wide character of s2 overwrites the null wide character at the end of s1.
- Returns
+<b> Returns</b>
3 The wcscat function returns the value of s1.
<a name="7.24.4.3.2" href="#7.24.4.3.2"><b> 7.24.4.3.2 The wcsncat function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcsncat(wchar_t * restrict s1,
const wchar_t * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The wcsncat function appends not more than n wide characters (a null wide character
and those that follow it are not appended) from the array pointed to by s2 to the end of
-[<a name="#p378" href="p378">page 378</a>] (<a href="#Contents">Contents</a>)
+[<a name="p378" href="#p378">page 378</a>] (<a href="#Contents">Contents</a>)
the wide string pointed to by s1. The initial wide character of s2 overwrites the null
wide character at the end of s1. A terminating null wide character is always appended to
the result.298)
- Returns
+<b> Returns</b>
3 The wcsncat function returns the value of s1.
<a name="7.24.4.4" href="#7.24.4.4"><b> 7.24.4.4 Wide string comparison functions</b></a>
1 Unless explicitly stated otherwise, the functions described in this subclause order two
wide characters the same way as two integers of the underlying integer type designated
by wchar_t.
<a name="7.24.4.4.1" href="#7.24.4.4.1"><b> 7.24.4.4.1 The wcscmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wcscmp(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcscmp function compares the wide string pointed to by s1 to the wide string
pointed to by s2.
- Returns
+<b> Returns</b>
3 The wcscmp function returns an integer greater than, equal to, or less than zero,
accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
wide string pointed to by s2.
<a name="7.24.4.4.2" href="#7.24.4.4.2"><b> 7.24.4.4.2 The wcscoll function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wcscoll(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcscoll function compares the wide string pointed to by s1 to the wide string
pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the
current locale.
- Returns
+<b> Returns</b>
3 The wcscoll function returns an integer greater than, equal to, or less than zero,
accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the
298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
wcslen(s1)+n+1.
-[<a name="#p379" href="p379">page 379</a>] (<a href="#Contents">Contents</a>)
+[<a name="p379" href="#p379">page 379</a>] (<a href="#Contents">Contents</a>)
wide string pointed to by s2 when both are interpreted as appropriate to the current
locale.
<a name="7.24.4.4.3" href="#7.24.4.4.3"><b> 7.24.4.4.3 The wcsncmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wcsncmp(const wchar_t *s1, const wchar_t *s2,
size_t n);
- Description
+<b> Description</b>
2 The wcsncmp function compares not more than n wide characters (those that follow a
null wide character are not compared) from the array pointed to by s1 to the array
pointed to by s2.
- Returns
+<b> Returns</b>
3 The wcsncmp function returns an integer greater than, equal to, or less than zero,
accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal
to, or less than the possibly null-terminated array pointed to by s2.
<a name="7.24.4.4.4" href="#7.24.4.4.4"><b> 7.24.4.4.4 The wcsxfrm function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcsxfrm(wchar_t * restrict s1,
const wchar_t * restrict s2,
size_t n);
- Description
+<b> Description</b>
2 The wcsxfrm function transforms the wide string pointed to by s2 and places the
resulting wide string into the array pointed to by s1. The transformation is such that if
the wcscmp function is applied to two transformed wide strings, it returns a value greater
applied to the same two original wide strings. No more than n wide characters are placed
into the resulting array pointed to by s1, including the terminating null wide character. If
n is zero, s1 is permitted to be a null pointer.
- Returns
+<b> Returns</b>
3 The wcsxfrm function returns the length of the transformed wide string (not including
the terminating null wide character). If the value returned is n or greater, the contents of
the array pointed to by s1 are indeterminate.
transformation of the wide string pointed to by s:
-[<a name="#p380" href="p380">page 380</a>] (<a href="#Contents">Contents</a>)
+[<a name="p380" href="#p380">page 380</a>] (<a href="#Contents">Contents</a>)
1 + wcsxfrm(NULL, s, 0)
<a name="7.24.4.4.5" href="#7.24.4.4.5"><b> 7.24.4.4.5 The wmemcmp function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int wmemcmp(const wchar_t *s1, const wchar_t *s2,
size_t n);
- Description
+<b> Description</b>
2 The wmemcmp function compares the first n wide characters of the object pointed to by
s1 to the first n wide characters of the object pointed to by s2.
- Returns
+<b> Returns</b>
3 The wmemcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
pointed to by s2.
<a name="7.24.4.5" href="#7.24.4.5"><b> 7.24.4.5 Wide string search functions</b></a>
<a name="7.24.4.5.1" href="#7.24.4.5.1"><b> 7.24.4.5.1 The wcschr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcschr(const wchar_t *s, wchar_t c);
- Description
+<b> Description</b>
2 The wcschr function locates the first occurrence of c in the wide string pointed to by s.
The terminating null wide character is considered to be part of the wide string.
- Returns
+<b> Returns</b>
3 The wcschr function returns a pointer to the located wide character, or a null pointer if
the wide character does not occur in the wide string.
<a name="7.24.4.5.2" href="#7.24.4.5.2"><b> 7.24.4.5.2 The wcscspn function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcscspn(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcscspn function computes the length of the maximum initial segment of the wide
string pointed to by s1 which consists entirely of wide characters not from the wide
string pointed to by s2.
-[<a name="#p381" href="p381">page 381</a>] (<a href="#Contents">Contents</a>)
+[<a name="p381" href="#p381">page 381</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The wcscspn function returns the length of the segment.
<a name="7.24.4.5.3" href="#7.24.4.5.3"><b> 7.24.4.5.3 The wcspbrk function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of
any wide character from the wide string pointed to by s2.
- Returns
+<b> Returns</b>
3 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if
no wide character from s2 occurs in s1.
<a name="7.24.4.5.4" href="#7.24.4.5.4"><b> 7.24.4.5.4 The wcsrchr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcsrchr(const wchar_t *s, wchar_t c);
- Description
+<b> Description</b>
2 The wcsrchr function locates the last occurrence of c in the wide string pointed to by
s. The terminating null wide character is considered to be part of the wide string.
- Returns
+<b> Returns</b>
3 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does
not occur in the wide string.
<a name="7.24.4.5.5" href="#7.24.4.5.5"><b> 7.24.4.5.5 The wcsspn function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcsspn function computes the length of the maximum initial segment of the wide
string pointed to by s1 which consists entirely of wide characters from the wide string
pointed to by s2.
- Returns
+<b> Returns</b>
3 The wcsspn function returns the length of the segment.
-[<a name="#p382" href="p382">page 382</a>] (<a href="#Contents">Contents</a>)
+[<a name="p382" href="#p382">page 382</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.5.6" href="#7.24.4.5.6"><b> 7.24.4.5.6 The wcsstr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
- Description
+<b> Description</b>
2 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of
the sequence of wide characters (excluding the terminating null wide character) in the
wide string pointed to by s2.
- Returns
+<b> Returns</b>
3 The wcsstr function returns a pointer to the located wide string, or a null pointer if the
wide string is not found. If s2 points to a wide string with zero length, the function
returns s1.
<a name="7.24.4.5.7" href="#7.24.4.5.7"><b> 7.24.4.5.7 The wcstok function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wcstok(wchar_t * restrict s1,
const wchar_t * restrict s2,
wchar_t ** restrict ptr);
- Description
+<b> Description</b>
2 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into
a sequence of tokens, each of which is delimited by a wide character from the wide string
pointed to by s2. The third argument points to a caller-provided wchar_t pointer into
the start of the first token.
5 The wcstok function then searches from there for a wide character that is contained in
the current separator wide string. If no such wide character is found, the current token
-[<a name="#p383" href="p383">page 383</a>] (<a href="#Contents">Contents</a>)
+[<a name="p383" href="#p383">page 383</a>] (<a href="#Contents">Contents</a>)
extends to the end of the wide string pointed to by s1, and subsequent searches in the
same wide string for a token return a null pointer. If such a wide character is found, it is
by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer
value for ptr, shall start searching just past the element overwritten by a null wide
character (if any).
- Returns
+<b> Returns</b>
7 The wcstok function returns a pointer to the first wide character of a token, or a null
pointer if there is no token.
8 EXAMPLE
t = wcstok(NULL, L"?", &ptr1); // t is a null pointer
<a name="7.24.4.5.8" href="#7.24.4.5.8"><b> 7.24.4.5.8 The wmemchr function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wmemchr(const wchar_t *s, wchar_t c,
size_t n);
- Description
+<b> Description</b>
2 The wmemchr function locates the first occurrence of c in the initial n wide characters of
the object pointed to by s.
- Returns
+<b> Returns</b>
3 The wmemchr function returns a pointer to the located wide character, or a null pointer if
the wide character does not occur in the object.
-[<a name="#p384" href="p384">page 384</a>] (<a href="#Contents">Contents</a>)
+[<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.4.6" href="#7.24.4.6"><b> 7.24.4.6 Miscellaneous functions</b></a>
<a name="7.24.4.6.1" href="#7.24.4.6.1"><b> 7.24.4.6.1 The wcslen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcslen(const wchar_t *s);
- Description
+<b> Description</b>
2 The wcslen function computes the length of the wide string pointed to by s.
- Returns
+<b> Returns</b>
3 The wcslen function returns the number of wide characters that precede the terminating
null wide character.
<a name="7.24.4.6.2" href="#7.24.4.6.2"><b> 7.24.4.6.2 The wmemset function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
- Description
+<b> Description</b>
2 The wmemset function copies the value of c into each of the first n wide characters of
the object pointed to by s.
- Returns
+<b> Returns</b>
3 The wmemset function returns the value of s.
<a name="7.24.5" href="#7.24.5"><b> 7.24.5 Wide character time conversion functions</b></a>
<a name="7.24.5.1" href="#7.24.5.1"><b> 7.24.5.1 The wcsftime function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.23"><time.h></a>
#include <a href="#7.24"><wchar.h></a>
size_t wcsftime(wchar_t * restrict s,
size_t maxsize,
const wchar_t * restrict format,
const struct tm * restrict timeptr);
- Description
+<b> Description</b>
2 The wcsftime function is equivalent to the strftime function, except that:
-- The argument s points to the initial element of an array of wide characters into which
the generated output is to be placed.
-[<a name="#p385" href="p385">page 385</a>] (<a href="#Contents">Contents</a>)
+[<a name="p385" href="#p385">page 385</a>] (<a href="#Contents">Contents</a>)
-- The argument maxsize indicates the limiting number of wide characters.
-- The argument format is a wide string and the conversion specifiers are replaced by
corresponding sequences of wide characters.
-- The return value indicates the number of wide characters.
- Returns
+<b> Returns</b>
3 If the total number of resulting wide characters including the terminating null wide
character is not more than maxsize, the wcsftime function returns the number of
wide characters placed into the array pointed to by s not including the terminating null
mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
character string.
-[<a name="#p386" href="p386">page 386</a>] (<a href="#Contents">Contents</a>)
+[<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.6.1" href="#7.24.6.1"><b> 7.24.6.1 Single-byte/wide character conversion functions</b></a>
<a name="7.24.6.1.1" href="#7.24.6.1.1"><b> 7.24.6.1.1 The btowc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
wint_t btowc(int c);
- Description
+<b> Description</b>
2 The btowc function determines whether c constitutes a valid single-byte character in the
initial shift state.
- Returns
+<b> Returns</b>
3 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c
does not constitute a valid single-byte character in the initial shift state. Otherwise, it
returns the wide character representation of that character.
<a name="7.24.6.1.2" href="#7.24.6.1.2"><b> 7.24.6.1.2 The wctob function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.19"><stdio.h></a>
#include <a href="#7.24"><wchar.h></a>
int wctob(wint_t c);
- Description
+<b> Description</b>
2 The wctob function determines whether c corresponds to a member of the extended
character set whose multibyte character representation is a single byte when in the initial
shift state.
- Returns
+<b> Returns</b>
3 The wctob function returns EOF if c does not correspond to a multibyte character with
length one in the initial shift state. Otherwise, it returns the single-byte representation of
that character as an unsigned char converted to an int.
<a name="7.24.6.2" href="#7.24.6.2"><b> 7.24.6.2 Conversion state functions</b></a>
<a name="7.24.6.2.1" href="#7.24.6.2.1"><b> 7.24.6.2.1 The mbsinit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
int mbsinit(const mbstate_t *ps);
- Description
+<b> Description</b>
2 If ps is not a null pointer, the mbsinit function determines whether the pointed-to
mbstate_t object describes an initial conversion state.
-[<a name="#p387" href="p387">page 387</a>] (<a href="#Contents">Contents</a>)
+[<a name="p387" href="#p387">page 387</a>] (<a href="#Contents">Contents</a>)
- Returns
+<b> Returns</b>
3 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object
describes an initial conversion state; otherwise, it returns zero.
<a name="7.24.6.3" href="#7.24.6.3"><b> 7.24.6.3 Restartable multibyte/wide character conversion functions</b></a>
2 Also unlike their corresponding functions, the return value does not represent whether the
encoding is state-dependent.
<a name="7.24.6.3.1" href="#7.24.6.3.1"><b> 7.24.6.3.1 The mbrlen function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t mbrlen(const char * restrict s,
size_t n,
mbstate_t * restrict ps);
- Description
+<b> Description</b>
2 The mbrlen function is equivalent to the call:
mbrtowc(NULL, s, n, ps != NULL ? ps : &internal)
where internal is the mbstate_t object for the mbrlen function, except that the
expression designated by ps is evaluated only once.
- Returns
+<b> Returns</b>
3 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2),
or (size_t)(-1).
Forward references: the mbrtowc function (<a href="#7.24.6.3.2">7.24.6.3.2</a>).
-[<a name="#p388" href="p388">page 388</a>] (<a href="#Contents">Contents</a>)
+[<a name="p388" href="#p388">page 388</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.6.3.2" href="#7.24.6.3.2"><b> 7.24.6.3.2 The mbrtowc function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t mbrtowc(wchar_t * restrict pwc,
const char * restrict s,
size_t n,
mbstate_t * restrict ps);
- Description
+<b> Description</b>
2 If s is a null pointer, the mbrtowc function is equivalent to the call:
mbrtowc(NULL, "", 1, ps)
In this case, the values of the parameters pwc and n are ignored.
corresponding wide character and then, if pwc is not a null pointer, stores that value in
the object pointed to by pwc. If the corresponding wide character is the null wide
character, the resulting state described is the initial conversion state.
- Returns
+<b> Returns</b>
4 The mbrtowc function returns the first of the following that applies (given the current
conversion state):
0 if the next n or fewer bytes complete the multibyte character that
300) When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
sequence of redundant shift sequences (for implementations with state-dependent encodings).
-[<a name="#p389" href="p389">page 389</a>] (<a href="#Contents">Contents</a>)
+[<a name="p389" href="#p389">page 389</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.6.3.3" href="#7.24.6.3.3"><b> 7.24.6.3.3 The wcrtomb function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcrtomb(char * restrict s,
wchar_t wc,
mbstate_t * restrict ps);
- Description
+<b> Description</b>
2 If s is a null pointer, the wcrtomb function is equivalent to the call
wcrtomb(buf, L'\0', ps)
where buf is an internal buffer.
array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If
wc is a null wide character, a null byte is stored, preceded by any shift sequence needed
to restore the initial shift state; the resulting state described is the initial conversion state.
- Returns
+<b> Returns</b>
4 The wcrtomb function returns the number of bytes stored in the array object (including
any shift sequences). When wc is not a valid wide character, an encoding error occurs:
the function stores the value of the macro EILSEQ in errno and returns
-[<a name="#p390" href="p390">page 390</a>] (<a href="#Contents">Contents</a>)
+[<a name="p390" href="#p390">page 390</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.6.4.1" href="#7.24.6.4.1"><b> 7.24.6.4.1 The mbsrtowcs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t mbsrtowcs(wchar_t * restrict dst,
const char ** restrict src,
size_t len,
mbstate_t * restrict ps);
- Description
+<b> Description</b>
2 The mbsrtowcs function converts a sequence of multibyte characters that begins in the
conversion state described by the object pointed to by ps, from the array indirectly
pointed to by src into a sequence of corresponding wide characters. If dst is not a null
just past the last multibyte character converted (if any). If conversion stopped due to
reaching a terminating null character and if dst is not a null pointer, the resulting state
described is the initial conversion state.
- Returns
+<b> Returns</b>
4 If the input conversion encounters a sequence of bytes that do not form a valid multibyte
character, an encoding error occurs: the mbsrtowcs function stores the value of the
macro EILSEQ in errno and returns (size_t)(-1); the conversion state is
301) Thus, the value of len is ignored if dst is a null pointer.
-[<a name="#p391" href="p391">page 391</a>] (<a href="#Contents">Contents</a>)
+[<a name="p391" href="#p391">page 391</a>] (<a href="#Contents">Contents</a>)
<a name="7.24.6.4.2" href="#7.24.6.4.2"><b> 7.24.6.4.2 The wcsrtombs function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.24"><wchar.h></a>
size_t wcsrtombs(char * restrict dst,
const wchar_t ** restrict src,
size_t len,
mbstate_t * restrict ps);
- Description
+<b> Description</b>
2 The wcsrtombs function converts a sequence of wide characters from the array
indirectly pointed to by src into a sequence of corresponding multibyte characters that
begins in the conversion state described by the object pointed to by ps. If dst is not a
address just past the last wide character converted (if any). If conversion stopped due to
reaching a terminating null wide character, the resulting state described is the initial
conversion state.
- Returns
+<b> Returns</b>
4 If conversion stops because a wide character is reached that does not correspond to a
valid multibyte character, an encoding error occurs: the wcsrtombs function stores the
value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion
302) If conversion stops because a terminating null wide character has been reached, the bytes stored
include those necessary to reach the initial shift state immediately before the null byte.
-[<a name="#p392" href="p392">page 392</a>] (<a href="#Contents">Contents</a>)
+[<a name="p392" href="#p392">page 392</a>] (<a href="#Contents">Contents</a>)
<a name="7.25" href="#7.25"><b> 7.25 Wide character classification and mapping utilities <wctype.h></b></a>
<a name="7.25.1" href="#7.25.1"><b> 7.25.1 Introduction</b></a>
303) See ''future library directions'' (<a href="#7.26.13">7.26.13</a>).
-[<a name="#p393" href="p393">page 393</a>] (<a href="#Contents">Contents</a>)
+[<a name="p393" href="#p393">page 393</a>] (<a href="#Contents">Contents</a>)
<a name="7.25.2" href="#7.25.2"><b> 7.25.2 Wide character classification utilities</b></a>
1 The header <a href="#7.25"><wctype.h></a> declares several functions useful for classifying wide
both printing and white-space wide characters.304)
Forward references: the wctob function (<a href="#7.24.6.1.2">7.24.6.1.2</a>).
<a name="7.25.2.1.1" href="#7.25.2.1.1"><b> 7.25.2.1.1 The iswalnum function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswalnum(wint_t wc);
- Description
+<b> Description</b>
2 The iswalnum function tests for any wide character for which iswalpha or
iswdigit is true.
<a name="7.25.2.1.2" href="#7.25.2.1.2"><b> 7.25.2.1.2 The iswalpha function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswalpha(wint_t wc);
- Description
+<b> Description</b>
2 The iswalpha function tests for any wide character for which iswupper or
iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
(which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
&& iswspace(wc) is true, but not both.
-[<a name="#p394" href="p394">page 394</a>] (<a href="#Contents">Contents</a>)
+[<a name="p394" href="#p394">page 394</a>] (<a href="#Contents">Contents</a>)
wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
is true.305)
<a name="7.25.2.1.3" href="#7.25.2.1.3"><b> 7.25.2.1.3 The iswblank function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswblank(wint_t wc);
- Description
+<b> Description</b>
2 The iswblank function tests for any wide character that is a standard blank wide
character or is one of a locale-specific set of wide characters for which iswspace is true
and that is used to separate words within a line of text. The standard blank wide
characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C"
locale, iswblank returns true only for the standard blank characters.
<a name="7.25.2.1.4" href="#7.25.2.1.4"><b> 7.25.2.1.4 The iswcntrl function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswcntrl(wint_t wc);
- Description
+<b> Description</b>
2 The iswcntrl function tests for any control wide character.
<a name="7.25.2.1.5" href="#7.25.2.1.5"><b> 7.25.2.1.5 The iswdigit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswdigit(wint_t wc);
- Description
+<b> Description</b>
2 The iswdigit function tests for any wide character that corresponds to a decimal-digit
character (as defined in <a href="#5.2.1">5.2.1</a>).
<a name="7.25.2.1.6" href="#7.25.2.1.6"><b> 7.25.2.1.6 The iswgraph function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswgraph(wint_t wc);
305) The functions iswlower and iswupper test true or false separately for each of these additional
wide characters; all four combinations are possible.
-[<a name="#p395" href="p395">page 395</a>] (<a href="#Contents">Contents</a>)
+[<a name="p395" href="#p395">page 395</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The iswgraph function tests for any wide character for which iswprint is true and
iswspace is false.306)
<a name="7.25.2.1.7" href="#7.25.2.1.7"><b> 7.25.2.1.7 The iswlower function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswlower(wint_t wc);
- Description
+<b> Description</b>
2 The iswlower function tests for any wide character that corresponds to a lowercase
letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
iswdigit, iswpunct, or iswspace is true.
<a name="7.25.2.1.8" href="#7.25.2.1.8"><b> 7.25.2.1.8 The iswprint function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswprint(wint_t wc);
- Description
+<b> Description</b>
2 The iswprint function tests for any printing wide character.
<a name="7.25.2.1.9" href="#7.25.2.1.9"><b> 7.25.2.1.9 The iswpunct function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswpunct(wint_t wc);
- Description
+<b> Description</b>
2 The iswpunct function tests for any printing wide character that is one of a locale-
specific set of punctuation wide characters for which neither iswspace nor iswalnum
is true.306)
<a name="7.25.2.1.10" href="#7.25.2.1.10"><b> 7.25.2.1.10 The iswspace function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswspace(wint_t wc);
corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
characters other than ' '.
-[<a name="#p396" href="p396">page 396</a>] (<a href="#Contents">Contents</a>)
+[<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
- Description
+<b> Description</b>
2 The iswspace function tests for any wide character that corresponds to a locale-specific
set of white-space wide characters for which none of iswalnum, iswgraph, or
iswpunct is true.
<a name="7.25.2.1.11" href="#7.25.2.1.11"><b> 7.25.2.1.11 The iswupper function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswupper(wint_t wc);
- Description
+<b> Description</b>
2 The iswupper function tests for any wide character that corresponds to an uppercase
letter or is one of a locale-specific set of wide characters for which none of iswcntrl,
iswdigit, iswpunct, or iswspace is true.
<a name="7.25.2.1.12" href="#7.25.2.1.12"><b> 7.25.2.1.12 The iswxdigit function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswxdigit(wint_t wc);
- Description
+<b> Description</b>
2 The iswxdigit function tests for any wide character that corresponds to a
hexadecimal-digit character (as defined in <a href="#6.4.4.1">6.4.4.1</a>).
<a name="7.25.2.2" href="#7.25.2.2"><b> 7.25.2.2 Extensible wide character classification functions</b></a>
as well as testing equivalent to that performed by the functions described in the previous
subclause (<a href="#7.25.2.1">7.25.2.1</a>).
<a name="7.25.2.2.1" href="#7.25.2.2.1"><b> 7.25.2.2.1 The iswctype function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
int iswctype(wint_t wc, wctype_t desc);
- Description
+<b> Description</b>
2 The iswctype function determines whether the wide character wc has the property
described by desc. The current setting of the LC_CTYPE category shall be the same as
during the call to wctype that returned the value desc.
character classification function (<a href="#7.25.2.1">7.25.2.1</a>) in the comment that follows the expression:
-[<a name="#p397" href="p397">page 397</a>] (<a href="#Contents">Contents</a>)
+[<a name="p397" href="#p397">page 397</a>] (<a href="#Contents">Contents</a>)
iswctype(wc, wctype("alnum")) // iswalnum(wc)
iswctype(wc, wctype("alpha")) // iswalpha(wc)
iswctype(wc, wctype("space")) // iswspace(wc)
iswctype(wc, wctype("upper")) // iswupper(wc)
iswctype(wc, wctype("xdigit")) // iswxdigit(wc)
- Returns
+<b> Returns</b>
4 The iswctype function returns nonzero (true) if and only if the value of the wide
character wc has the property described by desc.
Forward references: the wctype function (<a href="#7.25.2.2.2">7.25.2.2.2</a>).
<a name="7.25.2.2.2" href="#7.25.2.2.2"><b> 7.25.2.2.2 The wctype function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
wctype_t wctype(const char *property);
- Description
+<b> Description</b>
2 The wctype function constructs a value with type wctype_t that describes a class of
wide characters identified by the string argument property.
3 The strings listed in the description of the iswctype function shall be valid in all
locales as property arguments to the wctype function.
- Returns
+<b> Returns</b>
4 If property identifies a valid class of wide characters according to the LC_CTYPE
category of the current locale, the wctype function returns a nonzero value that is valid
as the second argument to the iswctype function; otherwise, it returns zero. *
-[<a name="#p398" href="p398">page 398</a>] (<a href="#Contents">Contents</a>)
+[<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
<a name="7.25.3" href="#7.25.3"><b> 7.25.3 Wide character case mapping utilities</b></a>
1 The header <a href="#7.25"><wctype.h></a> declares several functions useful for mapping wide characters.
<a name="7.25.3.1" href="#7.25.3.1"><b> 7.25.3.1 Wide character case mapping functions</b></a>
<a name="7.25.3.1.1" href="#7.25.3.1.1"><b> 7.25.3.1.1 The towlower function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
wint_t towlower(wint_t wc);
- Description
+<b> Description</b>
2 The towlower function converts an uppercase letter to a corresponding lowercase letter.
- Returns
+<b> Returns</b>
3 If the argument is a wide character for which iswupper is true and there are one or
more corresponding wide characters, as specified by the current locale, for which
iswlower is true, the towlower function returns one of the corresponding wide
characters (always the same one for any given locale); otherwise, the argument is
returned unchanged.
<a name="7.25.3.1.2" href="#7.25.3.1.2"><b> 7.25.3.1.2 The towupper function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
wint_t towupper(wint_t wc);
- Description
+<b> Description</b>
2 The towupper function converts a lowercase letter to a corresponding uppercase letter.
- Returns
+<b> Returns</b>
3 If the argument is a wide character for which iswlower is true and there are one or
more corresponding wide characters, as specified by the current locale, for which
iswupper is true, the towupper function returns one of the corresponding wide
-[<a name="#p399" href="p399">page 399</a>] (<a href="#Contents">Contents</a>)
+[<a name="p399" href="#p399">page 399</a>] (<a href="#Contents">Contents</a>)
<a name="7.25.3.2.1" href="#7.25.3.2.1"><b> 7.25.3.2.1 The towctrans function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
wint_t towctrans(wint_t wc, wctrans_t desc);
- Description
+<b> Description</b>
2 The towctrans function maps the wide character wc using the mapping described by
desc. The current setting of the LC_CTYPE category shall be the same as during the call
to wctrans that returned the value desc.
mapping function (<a href="#7.25.3.1">7.25.3.1</a>) in the comment that follows the expression:
towctrans(wc, wctrans("tolower")) // towlower(wc)
towctrans(wc, wctrans("toupper")) // towupper(wc)
- Returns
+<b> Returns</b>
4 The towctrans function returns the mapped value of wc using the mapping described
by desc.
<a name="7.25.3.2.2" href="#7.25.3.2.2"><b> 7.25.3.2.2 The wctrans function</b></a>
- Synopsis
+<b> Synopsis</b>
1 #include <a href="#7.25"><wctype.h></a>
wctrans_t wctrans(const char *property);
- Description
+<b> Description</b>
2 The wctrans function constructs a value with type wctrans_t that describes a
mapping between wide characters identified by the string argument property.
3 The strings listed in the description of the towctrans function shall be valid in all
locales as property arguments to the wctrans function.
- Returns
+<b> Returns</b>
4 If property identifies a valid mapping of wide characters according to the LC_CTYPE
category of the current locale, the wctrans function returns a nonzero value that is valid
as the second argument to the towctrans function; otherwise, it returns zero.
-[<a name="#p400" href="p400">page 400</a>] (<a href="#Contents">Contents</a>)
+[<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
<a name="7.26" href="#7.26"><b> 7.26 Future library directions</b></a>
1 The following names are grouped under individual headers for convenience. All external
types defined in the <a href="#7.18"><stdint.h></a> header. Macro names beginning with INT or UINT
and ending with _MAX, _MIN, or _C may be added to the macros defined in the
<a href="#7.18"><stdint.h></a> header.
-[<a name="#p401" href="p401">page 401</a>] (<a href="#Contents">Contents</a>)
+[<a name="p401" href="#p401">page 401</a>] (<a href="#Contents">Contents</a>)
<a name="7.26.9" href="#7.26.9"><b> 7.26.9 Input/output <stdio.h></b></a>
1 Lowercase letters may be added to the conversion specifiers and length modifiers in
-[<a name="#p402" href="p402">page 402</a>] (<a href="#Contents">Contents</a>)
+[<a name="p402" href="#p402">page 402</a>] (<a href="#Contents">Contents</a>)
<a name="A" href="#A"><b> Annex A</b></a>
(informative)
-[<a name="#p403" href="p403">page 403</a>] (<a href="#Contents">Contents</a>)
+[<a name="p403" href="#p403">page 403</a>] (<a href="#Contents">Contents</a>)
<a name="A.1.3" href="#A.1.3"><b>A.1.3 Identifiers</b></a>
(<a href="#6.4.2.1">6.4.2.1</a>) identifier:
(<a href="#6.4.4.1">6.4.4.1</a>) decimal-constant:
nonzero-digit
decimal-constant digit
-[<a name="#p404" href="p404">page 404</a>] (<a href="#Contents">Contents</a>)
+[<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.4.4.1">6.4.4.1</a>) octal-constant:
0
-[<a name="#p405" href="p405">page 405</a>] (<a href="#Contents">Contents</a>)
+[<a name="p405" href="#p405">page 405</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.4.4.2">6.4.4.2</a>) hexadecimal-floating-constant:
hexadecimal-prefix hexadecimal-fractional-constant
-[<a name="#p406" href="p406">page 406</a>] (<a href="#Contents">Contents</a>)
+[<a name="p406" href="#p406">page 406</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.4.4.4">6.4.4.4</a>) c-char-sequence:
c-char
-[<a name="#p407" href="p407">page 407</a>] (<a href="#Contents">Contents</a>)
+[<a name="p407" href="#p407">page 407</a>] (<a href="#Contents">Contents</a>)
<a name="A.1.7" href="#A.1.7"><b>A.1.7 Punctuators</b></a>
(<a href="#6.4.6">6.4.6</a>) punctuator: one of
pp-number .
-[<a name="#p408" href="p408">page 408</a>] (<a href="#Contents">Contents</a>)
+[<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
<a name="A.2" href="#A.2"><b>A.2 Phrase structure grammar</b></a>
<a name="A.2.1" href="#A.2.1"><b>A.2.1 Expressions</b></a>
multiplicative-expression / cast-expression
multiplicative-expression % cast-expression
-[<a name="#p409" href="p409">page 409</a>] (<a href="#Contents">Contents</a>)
+[<a name="p409" href="#p409">page 409</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.5.6">6.5.6</a>) additive-expression:
multiplicative-expression
logical-OR-expression
logical-OR-expression ? expression : conditional-expression
-[<a name="#p410" href="p410">page 410</a>] (<a href="#Contents">Contents</a>)
+[<a name="p410" href="#p410">page 410</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.5.16">6.5.16</a>) assignment-expression:
conditional-expression
-[<a name="#p411" href="p411">page 411</a>] (<a href="#Contents">Contents</a>)
+[<a name="p411" href="#p411">page 411</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.7.2">6.7.2</a>) type-specifier:
void
-[<a name="#p412" href="p412">page 412</a>] (<a href="#Contents">Contents</a>)
+[<a name="p412" href="#p412">page 412</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.7.2.2">6.7.2.2</a>) enum-specifier:
enum identifieropt { enumerator-list }
parameter-list
parameter-list , ...
-[<a name="#p413" href="p413">page 413</a>] (<a href="#Contents">Contents</a>)
+[<a name="p413" href="#p413">page 413</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.7.5">6.7.5</a>) parameter-list:
parameter-declaration
-[<a name="#p414" href="p414">page 414</a>] (<a href="#Contents">Contents</a>)
+[<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.7.8">6.7.8</a>) designator-list:
designator
-[<a name="#p415" href="p415">page 415</a>] (<a href="#Contents">Contents</a>)
+[<a name="p415" href="#p415">page 415</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.8.5">6.8.5</a>) iteration-statement:
while ( expression ) statement
if-group elif-groupsopt else-groupopt endif-line
-[<a name="#p416" href="p416">page 416</a>] (<a href="#Contents">Contents</a>)
+[<a name="p416" href="#p416">page 416</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.10">6.10</a>) if-group:
# if constant-expression new-line groupopt
-[<a name="#p417" href="p417">page 417</a>] (<a href="#Contents">Contents</a>)
+[<a name="p417" href="#p417">page 417</a>] (<a href="#Contents">Contents</a>)
(<a href="#6.10">6.10</a>) pp-tokens:
preprocessing-token
-[<a name="#p418" href="p418">page 418</a>] (<a href="#Contents">Contents</a>)
+[<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
<a name="B" href="#B"><b> Annex B</b></a>
(informative)
double complex catanh(double complex z);
float complex catanhf(float complex z);
long double complex catanhl(long double complex z);
-[<a name="#p419" href="p419">page 419</a>] (<a href="#Contents">Contents</a>)
+[<a name="p419" href="#p419">page 419</a>] (<a href="#Contents">Contents</a>)
double complex ccosh(double complex z);
float complex ccoshf(float complex z);
long double creall(long double complex z);
-[<a name="#p420" href="p420">page 420</a>] (<a href="#Contents">Contents</a>)
+[<a name="p420" href="#p420">page 420</a>] (<a href="#Contents">Contents</a>)
<a name="B.3" href="#B.3"><b>B.3 Character handling <ctype.h></b></a>
int isalnum(int c);
-[<a name="#p421" href="p421">page 421</a>] (<a href="#Contents">Contents</a>)
+[<a name="p421" href="#p421">page 421</a>] (<a href="#Contents">Contents</a>)
<a name="B.6" href="#B.6"><b>B.6 Characteristics of floating types <float.h></b></a>
FLT_ROUNDS DBL_MIN_EXP FLT_MAX
-[<a name="#p422" href="p422">page 422</a>] (<a href="#Contents">Contents</a>)
+[<a name="p422" href="#p422">page 422</a>] (<a href="#Contents">Contents</a>)
<a name="B.8" href="#B.8"><b>B.8 Alternative spellings <iso646.h></b></a>
and bitor not_eq xor
float asinf(float x);
long double asinl(long double x);
double atan(double x);
-[<a name="#p423" href="p423">page 423</a>] (<a href="#Contents">Contents</a>)
+[<a name="p423" href="#p423">page 423</a>] (<a href="#Contents">Contents</a>)
float atanf(float x);
long double atanl(long double x);
float expm1f(float x);
long double expm1l(long double x);
-[<a name="#p424" href="p424">page 424</a>] (<a href="#Contents">Contents</a>)
+[<a name="p424" href="#p424">page 424</a>] (<a href="#Contents">Contents</a>)
double frexp(double value, int *exp);
float frexpf(float value, int *exp);
double hypot(double x, double y);
float hypotf(float x, float y);
-[<a name="#p425" href="p425">page 425</a>] (<a href="#Contents">Contents</a>)
+[<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
long double hypotl(long double x, long double y);
double pow(double x, double y);
long double roundl(long double x);
long int lround(double x);
-[<a name="#p426" href="p426">page 426</a>] (<a href="#Contents">Contents</a>)
+[<a name="p426" href="#p426">page 426</a>] (<a href="#Contents">Contents</a>)
long int lroundf(float x);
long int lroundl(long double x);
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
-[<a name="#p427" href="p427">page 427</a>] (<a href="#Contents">Contents</a>)
+[<a name="p427" href="#p427">page 427</a>] (<a href="#Contents">Contents</a>)
long double fmal(long double x, long double y,
long double z);
-[<a name="#p428" href="p428">page 428</a>] (<a href="#Contents">Contents</a>)
+[<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
<a name="B.16" href="#B.16"><b>B.16 Common definitions <stddef.h></b></a>
ptrdiff_t size_t wchar_t NULL
char * restrict buf);
-[<a name="#p429" href="p429">page 429</a>] (<a href="#Contents">Contents</a>)
+[<a name="p429" href="#p429">page 429</a>] (<a href="#Contents">Contents</a>)
int setvbuf(FILE * restrict stream,
char * restrict buf,
int ungetc(int c, FILE *stream);
-[<a name="#p430" href="p430">page 430</a>] (<a href="#Contents">Contents</a>)
+[<a name="p430" href="#p430">page 430</a>] (<a href="#Contents">Contents</a>)
size_t fread(void * restrict ptr,
size_t size, size_t nmemb,
-[<a name="#p431" href="p431">page 431</a>] (<a href="#Contents">Contents</a>)
+[<a name="p431" href="#p431">page 431</a>] (<a href="#Contents">Contents</a>)
unsigned long long int strtoull(
const char * restrict nptr,
-[<a name="#p432" href="p432">page 432</a>] (<a href="#Contents">Contents</a>)
+[<a name="p432" href="#p432">page 432</a>] (<a href="#Contents">Contents</a>)
<a name="B.20" href="#B.20"><b>B.20 String handling <string.h></b></a>
size_t
-[<a name="#p433" href="p433">page 433</a>] (<a href="#Contents">Contents</a>)
+[<a name="p433" href="#p433">page 433</a>] (<a href="#Contents">Contents</a>)
<a name="B.21" href="#B.21"><b>B.21 Type-generic math <tgmath.h></b></a>
acos sqrt fmod nextafter
-[<a name="#p434" href="p434">page 434</a>] (<a href="#Contents">Contents</a>)
+[<a name="p434" href="#p434">page 434</a>] (<a href="#Contents">Contents</a>)
<a name="B.23" href="#B.23"><b>B.23 Extended multibyte/wide character utilities <wchar.h></b></a>
wchar_t wint_t WCHAR_MAX
-[<a name="#p435" href="p435">page 435</a>] (<a href="#Contents">Contents</a>)
+[<a name="p435" href="#p435">page 435</a>] (<a href="#Contents">Contents</a>)
double wcstod(const wchar_t * restrict nptr,
wchar_t ** restrict endptr);
size_t wcsspn(const wchar_t *s1, const wchar_t *s2);
wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2);
-[<a name="#p436" href="p436">page 436</a>] (<a href="#Contents">Contents</a>)
+[<a name="p436" href="#p436">page 436</a>] (<a href="#Contents">Contents</a>)
wchar_t *wcstok(wchar_t * restrict s1,
const wchar_t * restrict s2,
int iswupper(wint_t wc);
int iswxdigit(wint_t wc);
int iswctype(wint_t wc, wctype_t desc);
-[<a name="#p437" href="p437">page 437</a>] (<a href="#Contents">Contents</a>)
+[<a name="p437" href="#p437">page 437</a>] (<a href="#Contents">Contents</a>)
wctype_t wctype(const char *property);
wint_t towlower(wint_t wc);
-[<a name="#p438" href="p438">page 438</a>] (<a href="#Contents">Contents</a>)
+[<a name="p438" href="#p438">page 438</a>] (<a href="#Contents">Contents</a>)
<a name="C" href="#C"><b> Annex C</b></a>
(informative)
-[<a name="#p439" href="p439">page 439</a>] (<a href="#Contents">Contents</a>)
+[<a name="p439" href="#p439">page 439</a>] (<a href="#Contents">Contents</a>)
<a name="D" href="#D"><b> Annex D</b></a>
(normative)
0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0
Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30,
0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D,
-[<a name="#p440" href="p440">page 440</a>] (<a href="#Contents">Contents</a>)
+[<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
0B5C-0B5D, 0B5F-0B61
Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A,
-[<a name="#p441" href="p441">page 441</a>] (<a href="#Contents">Contents</a>)
+[<a name="p441" href="#p441">page 441</a>] (<a href="#Contents">Contents</a>)
<a name="E" href="#E"><b> Annex E</b></a>
(informative)
4 The values given in the following list shall be replaced by implementation-defined
constant expressions that are greater or equal in magnitude (absolute value) to those
shown, with the same sign:
-[<a name="#p442" href="p442">page 442</a>] (<a href="#Contents">Contents</a>)
+[<a name="p442" href="#p442">page 442</a>] (<a href="#Contents">Contents</a>)
#define DBL_DIG 10
#define DBL_MANT_DIG
-[<a name="#p443" href="p443">page 443</a>] (<a href="#Contents">Contents</a>)
+[<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
<a name="F" href="#F"><b> Annex F</b></a>
(normative)
308) A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
all double values.
-[<a name="#p444" href="p444">page 444</a>] (<a href="#Contents">Contents</a>)
+[<a name="p444" href="#p444">page 444</a>] (<a href="#Contents">Contents</a>)
<a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
1 This specification does not define the behavior of signaling NaNs.309) It generally uses
309) Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
sufficient for closure of the arithmetic.
-[<a name="#p445" href="p445">page 445</a>] (<a href="#Contents">Contents</a>)
+[<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
-- The relational and equality operators provide IEC 60559 comparisons. IEC 60559
identifies a need for additional comparison predicates to facilitate writing code that
-- The isnan macro in <a href="#7.12"><math.h></a> provides the isnan function recommended in the
Appendix to IEC 60559.
-[<a name="#p446" href="p446">page 446</a>] (<a href="#Contents">Contents</a>)
+[<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
-- The signbit macro and the fpclassify macro in <a href="#7.12"><math.h></a>, used in
conjunction with the number classification macros (FP_NAN, FP_INFINITE,
IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
DBL_DIG are 18 and 15, respectively, for these formats.)
-[<a name="#p447" href="p447">page 447</a>] (<a href="#Contents">Contents</a>)
+[<a name="p447" href="#p447">page 447</a>] (<a href="#Contents">Contents</a>)
<a name="F.6" href="#F.6"><b> F.6 Contracted expressions</b></a>
1 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
point control modes will be the default ones and the floating-point status flags will not be tested,
which allows certain optimizations (see <a href="#F.8">F.8</a>).
-[<a name="#p448" href="p448">page 448</a>] (<a href="#Contents">Contents</a>)
+[<a name="p448" href="#p448">page 448</a>] (<a href="#Contents">Contents</a>)
floating-point exception, other than ''inexact'';314) the implementation should then
proceed with the translation of the program.
conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
(even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
strtod, provide execution-time conversion of numeric strings.
- 315) Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like <a href="#1.0">1.0</a>/3.0
+ 315) Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
- <a href="#1.0">1.0</a>/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
+ 1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
efficiency of translation-time evaluation through static initialization, such as
- const static double one_third = <a href="#1.0">1.0</a>/3.0;
+ const static double one_third = 1.0/3.0;
-[<a name="#p449" href="p449">page 449</a>] (<a href="#Contents">Contents</a>)
+[<a name="p449" href="#p449">page 449</a>] (<a href="#Contents">Contents</a>)
execution time.
double_t x = 1.1e75;
could be done at translation time, regardless of the expression evaluation method.
-[<a name="#p450" href="p450">page 450</a>] (<a href="#Contents">Contents</a>)
+[<a name="p450" href="#p450">page 450</a>] (<a href="#Contents">Contents</a>)
<a name="F.7.6" href="#F.7.6"><b> F.7.6 Changing the environment</b></a>
1 Operations defined in <a href="#6.5">6.5</a> and functions and macros defined for the standard libraries
floating-point exceptions need not be precise: the actual order and number of occurrences
of floating-point exceptions (> 1) may vary from what the source code expresses. Thus,
the preceding loop could be treated as
-[<a name="#p451" href="p451">page 451</a>] (<a href="#Contents">Contents</a>)
+[<a name="p451" href="#p451">page 451</a>] (<a href="#Contents">Contents</a>)
if (0 < n) x + 1;
<a name="F.8.2" href="#F.8.2"><b> F.8.2 Expression transformations</b></a>
and others that round perfectly.
1 * x and x / 1 (->) x The expressions 1 * x, x / 1, and x are equivalent
(on IEC 60559 machines, among others).317)
- x / x (->) <a href="#1.0">1.0</a> The expressions x / x and <a href="#1.0">1.0</a> are not equivalent if x
+ x / x (->) 1.0 The expressions x / x and 1.0 are not equivalent if x
can be zero, infinite, or NaN.
x - y (<->) x + (-y) The expressions x - y, x + (-y), and (-y) + x
are equivalent (on IEC 60559 machines, among others).
conj(csqrt(z)) is csqrt(conj(z)),
for complex z.
-[<a name="#p452" href="p452">page 452</a>] (<a href="#Contents">Contents</a>)
+[<a name="p452" href="#p452">page 452</a>] (<a href="#Contents">Contents</a>)
might be zero.
-x (<->) 0 - x The expressions -x and 0 - x are not equivalent if x
-[<a name="#p453" href="p453">page 453</a>] (<a href="#Contents">Contents</a>)
+[<a name="p453" href="#p453">page 453</a>] (<a href="#Contents">Contents</a>)
// calls g without raising ''invalid'' if a and b are unordered
if (isless(a,b))
319) 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
-[<a name="#p454" href="p454">page 454</a>] (<a href="#Contents">Contents</a>)
+[<a name="p454" href="#p454">page 454</a>] (<a href="#Contents">Contents</a>)
whose magnitude is too large.
7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
321) It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
avoiding them would be too costly.
-[<a name="#p455" href="p455">page 455</a>] (<a href="#Contents">Contents</a>)
+[<a name="p455" href="#p455">page 455</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.1.2" href="#F.9.1.2"><b> F.9.1.2 The asin functions</b></a>
1 -- asin((+-)0) returns (+-)0.
322) atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
the ''divide-by-zero'' floating-point exception.
-[<a name="#p456" href="p456">page 456</a>] (<a href="#Contents">Contents</a>)
+[<a name="p456" href="#p456">page 456</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.1.7" href="#F.9.1.7"><b> F.9.1.7 The tan functions</b></a>
1 -- tan((+-)0) returns (+-)0.
-[<a name="#p457" href="p457">page 457</a>] (<a href="#Contents">Contents</a>)
+[<a name="p457" href="#p457">page 457</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.3" href="#F.9.3"><b> F.9.3 Exponential and logarithmic functions</b></a>
<a name="F.9.3.1" href="#F.9.3.1"><b> F.9.3.1 The exp functions</b></a>
-[<a name="#p458" href="p458">page 458</a>] (<a href="#Contents">Contents</a>)
+[<a name="p458" href="#p458">page 458</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.3.6" href="#F.9.3.6"><b> F.9.3.6 The ldexp functions</b></a>
1 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp).
-[<a name="#p459" href="p459">page 459</a>] (<a href="#Contents">Contents</a>)
+[<a name="p459" href="#p459">page 459</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.3.12" href="#F.9.3.12"><b> F.9.3.12 The modf functions</b></a>
1 -- modf((+-)x, iptr) returns a result with the same sign as x.
-[<a name="#p460" href="p460">page 460</a>] (<a href="#Contents">Contents</a>)
+[<a name="p460" href="#p460">page 460</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.4.3" href="#F.9.4.3"><b> F.9.4.3 The hypot functions</b></a>
1 -- hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent.
-[<a name="#p461" href="p461">page 461</a>] (<a href="#Contents">Contents</a>)
+[<a name="p461" href="#p461">page 461</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.4.5" href="#F.9.4.5"><b> F.9.4.5 The sqrt functions</b></a>
1 sqrt is fully specified as a basic arithmetic operation in IEC 60559.
-[<a name="#p462" href="p462">page 462</a>] (<a href="#Contents">Contents</a>)
+[<a name="p462" href="#p462">page 462</a>] (<a href="#Contents">Contents</a>)
#include <a href="#7.12"><math.h></a>
#include <a href="#7.6"><fenv.h></a>
-[<a name="#p463" href="p463">page 463</a>] (<a href="#Contents">Contents</a>)
+[<a name="p463" href="#p463">page 463</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.6.6" href="#F.9.6.6"><b> F.9.6.6 The round functions</b></a>
1 -- round((+-)0) returns (+-)0.
-[<a name="#p464" href="p464">page 464</a>] (<a href="#Contents">Contents</a>)
+[<a name="p464" href="#p464">page 464</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.7" href="#F.9.7"><b> F.9.7 Remainder functions</b></a>
<a name="F.9.7.1" href="#F.9.7.1"><b> F.9.7.1 The fmod functions</b></a>
-[<a name="#p465" href="p465">page 465</a>] (<a href="#Contents">Contents</a>)
+[<a name="p465" href="#p465">page 465</a>] (<a href="#Contents">Contents</a>)
<a name="F.9.8.3" href="#F.9.8.3"><b> F.9.8.3 The nextafter functions</b></a>
1 -- nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions
323) Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
return +0; however, implementation in software might be impractical.
-[<a name="#p466" href="p466">page 466</a>] (<a href="#Contents">Contents</a>)
+[<a name="p466" href="#p466">page 466</a>] (<a href="#Contents">Contents</a>)
<a name="G" href="#G"><b> Annex G</b></a>
(informative)
-[<a name="#p467" href="p467">page 467</a>] (<a href="#Contents">Contents</a>)
+[<a name="p467" href="#p467">page 467</a>] (<a href="#Contents">Contents</a>)
<a name="G.4" href="#G.4"><b> G.4 Conversions</b></a>
<a name="G.4.1" href="#G.4.1"><b> G.4.1 Imaginary types</b></a>
324) See <a href="#6.3.1.2">6.3.1.2</a>.
-[<a name="#p468" href="p468">page 468</a>] (<a href="#Contents">Contents</a>)
+[<a name="p468" href="#p468">page 468</a>] (<a href="#Contents">Contents</a>)
<a name="G.5.1" href="#G.5.1"><b> G.5.1 Multiplicative operators</b></a>
- Semantics
+<b> Semantics</b>
1 If one operand has real type and the other operand has imaginary type, then the result has
imaginary type. If both operands have imaginary type, then the result has real type. (If
either operand has complex type, then the result has complex type.)
325) These properties are already implied for those cases covered in the tables, but are required for all cases
(at least where the state for CX_LIMITED_RANGE is ''off'').
-[<a name="#p469" href="p469">page 469</a>] (<a href="#Contents">Contents</a>)
+[<a name="p469" href="#p469">page 469</a>] (<a href="#Contents">Contents</a>)
-- if the first operand is a nonzero finite number or an infinity and the second operand is
a zero, then the result of the / operator is an infinity.
int recalc = 0;
if ( isinf(a) || isinf(b) ) { // z is infinite
/* "Box" the infinity and change NaNs in the other factor to 0 */
- a = copysign(isinf(a) ? <a href="#1.0">1.0</a> : 0.0, a);
- b = copysign(isinf(b) ? <a href="#1.0">1.0</a> : 0.0, b);
+ a = copysign(isinf(a) ? 1.0 : 0.0, a);
+ b = copysign(isinf(b) ? 1.0 : 0.0, b);
if (isnan(c)) c = copysign(0.0, c);
if (isnan(d)) d = copysign(0.0, d);
recalc = 1;
}
if ( isinf(c) || isinf(d) ) { // w is infinite
/* "Box" the infinity and change NaNs in the other factor to 0 */
- c = copysign(isinf(c) ? <a href="#1.0">1.0</a> : 0.0, c);
- d = copysign(isinf(d) ? <a href="#1.0">1.0</a> : 0.0, d);
+ c = copysign(isinf(c) ? 1.0 : 0.0, c);
+ d = copysign(isinf(d) ? 1.0 : 0.0, d);
if (isnan(a)) a = copysign(0.0, a);
if (isnan(b)) b = copysign(0.0, b);
recalc = 1;
}
if (recalc) {
-[<a name="#p470" href="p470">page 470</a>] (<a href="#Contents">Contents</a>)
+[<a name="p470" href="#p470">page 470</a>] (<a href="#Contents">Contents</a>)
x = INFINITY * ( a * c - b * d );
y = INFINITY * ( a * d + b * c );
}
else if ((isinf(a) || isinf(b)) &&
isfinite(c) && isfinite(d)) {
- a = copysign(isinf(a) ? <a href="#1.0">1.0</a> : 0.0, a);
- b = copysign(isinf(b) ? <a href="#1.0">1.0</a> : 0.0, b);
+ a = copysign(isinf(a) ? 1.0 : 0.0, a);
+ b = copysign(isinf(b) ? 1.0 : 0.0, b);
x = INFINITY * ( a * c + b * d );
y = INFINITY * ( b * c - a * d );
}
else if (isinf(logbw) &&
isfinite(a) && isfinite(b)) {
- c = copysign(isinf(c) ? <a href="#1.0">1.0</a> : 0.0, c);
- d = copysign(isinf(d) ? <a href="#1.0">1.0</a> : 0.0, d);
+ c = copysign(isinf(c) ? 1.0 : 0.0, c);
+ d = copysign(isinf(d) ? 1.0 : 0.0, d);
x = 0.0 * ( a * c + b * d );
y = 0.0 * ( b * c - a * d );
-[<a name="#p471" href="p471">page 471</a>] (<a href="#Contents">Contents</a>)
+[<a name="p471" href="#p471">page 471</a>] (<a href="#Contents">Contents</a>)
}
}
with division, provides better roundoff characteristics.
<a name="G.5.2" href="#G.5.2"><b> G.5.2 Additive operators</b></a>
- Semantics
+<b> Semantics</b>
1 If both operands have imaginary type, then the result has imaginary type. (If one operand
has real type and the other operand has imaginary type, or if either operand has complex
type, then the result has complex type.)
particularly suited to IEC 60559 implementations. For families of functions, the
specifications apply to all of the functions even though only the principal function is
-[<a name="#p472" href="p472">page 472</a>] (<a href="#Contents">Contents</a>)
+[<a name="p472" href="#p472">page 472</a>] (<a href="#Contents">Contents</a>)
shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument
and the result, the result has the same sign as the argument.
326) As noted in <a href="#G.3">G.3</a>, a complex value with at least one infinite part is regarded as an infinity even if its
other part is a NaN.
-[<a name="#p473" href="p473">page 473</a>] (<a href="#Contents">Contents</a>)
+[<a name="p473" href="#p473">page 473</a>] (<a href="#Contents">Contents</a>)
<a name="G.6.1" href="#G.6.1"><b> G.6.1 Trigonometric functions</b></a>
<a name="G.6.1.1" href="#G.6.1.1"><b> G.6.1.1 The cacos functions</b></a>
-- cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN.
-[<a name="#p474" href="p474">page 474</a>] (<a href="#Contents">Contents</a>)
+[<a name="p474" href="#p474">page 474</a>] (<a href="#Contents">Contents</a>)
-- cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
floating-point exception, for finite y.
-- catanh(+(inf) + i (inf)) returns +0 + ipi /2.
-- catanh(+(inf) + iNaN) returns +0 + iNaN.
-[<a name="#p475" href="p475">page 475</a>] (<a href="#Contents">Contents</a>)
+[<a name="p475" href="#p475">page 475</a>] (<a href="#Contents">Contents</a>)
-- catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid''
floating-point exception, for finite y.
unspecified) and raises the ''invalid'' floating-point exception.
-- csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is
unspecified).
-[<a name="#p476" href="p476">page 476</a>] (<a href="#Contents">Contents</a>)
+[<a name="p476" href="#p476">page 476</a>] (<a href="#Contents">Contents</a>)
-- csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point
exception, for positive finite x.
-[<a name="#p477" href="p477">page 477</a>] (<a href="#Contents">Contents</a>)
+[<a name="p477" href="#p477">page 477</a>] (<a href="#Contents">Contents</a>)
<a name="G.6.3" href="#G.6.3"><b> G.6.3 Exponential and logarithmic functions</b></a>
<a name="G.6.3.1" href="#G.6.3.1"><b> G.6.3.1 The cexp functions</b></a>
-- clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating-
point exception, for finite x.
-[<a name="#p478" href="p478">page 478</a>] (<a href="#Contents">Contents</a>)
+[<a name="p478" href="#p478">page 478</a>] (<a href="#Contents">Contents</a>)
-- clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y.
-- clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y.
327) This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
implementations that treat special cases more carefully.
-[<a name="#p479" href="p479">page 479</a>] (<a href="#Contents">Contents</a>)
+[<a name="p479" href="#p479">page 479</a>] (<a href="#Contents">Contents</a>)
<a name="G.7" href="#G.7"><b> G.7 Type-generic math <tgmath.h></b></a>
1 Type-generic macros that accept complex arguments also accept imaginary arguments. If
-[<a name="#p480" href="p480">page 480</a>] (<a href="#Contents">Contents</a>)
+[<a name="p480" href="#p480">page 480</a>] (<a href="#Contents">Contents</a>)
<a name="H" href="#H"><b> Annex H</b></a>
(informative)
-[<a name="#p481" href="p481">page 481</a>] (<a href="#Contents">Contents</a>)
+[<a name="p481" href="#p481">page 481</a>] (<a href="#Contents">Contents</a>)
<a name="H.2.2.1" href="#H.2.2.1"><b> H.2.2.1 Integer operations</b></a>
1 The integer operations on integer types are the following:
2 The derived constants for the floating point types are accessed by the following:
-[<a name="#p482" href="p482">page 482</a>] (<a href="#Contents">Contents</a>)
+[<a name="p482" href="#p482">page 482</a>] (<a href="#Contents">Contents</a>)
fmax FLT_MAX, DBL_MAX, LDBL_MAX
fminN FLT_MIN, DBL_MIN, LDBL_MIN
divF x / y
negF -x
absF fabsf(x), fabs(x), fabsl(x)
- exponentF 1.f+logbf(x), <a href="#1.0">1.0</a>+logb(x), 1.L+logbl(x)
+ exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
intpartF modff(x, &y), modf(x, &y), modfl(x, &y)
2 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
truncate FLT_ROUNDS == 0
-[<a name="#p483" href="p483">page 483</a>] (<a href="#Contents">Contents</a>)
+[<a name="p483" href="#p483">page 483</a>] (<a href="#Contents">Contents</a>)
nearest FLT_ROUNDS == 1
other FLT_ROUNDS != 0 && FLT_ROUNDS != 1
-[<a name="#p484" href="p484">page 484</a>] (<a href="#Contents">Contents</a>)
+[<a name="p484" href="#p484">page 484</a>] (<a href="#Contents">Contents</a>)
<a name="H.3" href="#H.3"><b> H.3 Notification</b></a>
1 Notification is the process by which a user or program is informed that an exceptional
where i is an expression of type int representing a subset of the LIA-1 indicators.
4 C allows an implementation to provide the following LIA-1 required behavior: at
program termination if any indicator is set the implementation shall send an unambiguous
-[<a name="#p485" href="p485">page 485</a>] (<a href="#Contents">Contents</a>)
+[<a name="p485" href="#p485">page 485</a>] (<a href="#Contents">Contents</a>)
and ''hard to ignore'' message (see LIA-1 subclause <a href="#6.1.2">6.1.2</a>)
5 LIA-1 does not make the distinction between floating-point and integer for ''undefined''.
-[<a name="#p486" href="p486">page 486</a>] (<a href="#Contents">Contents</a>)
+[<a name="p486" href="#p486">page 486</a>] (<a href="#Contents">Contents</a>)
<a name="I" href="#I"><b> Annex I</b></a>
(informative)
-- A statement with no apparent effect is encountered (<a href="#6.8">6.8</a>).
-- A constant expression is used as the controlling expression of a selection statement
(<a href="#6.8.4">6.8.4</a>).
-[<a name="#p487" href="p487">page 487</a>] (<a href="#Contents">Contents</a>)
+[<a name="p487" href="#p487">page 487</a>] (<a href="#Contents">Contents</a>)
-- An incorrectly formed preprocessing group is encountered while skipping a
preprocessing group (<a href="#6.10.1">6.10.1</a>).
-[<a name="#p488" href="p488">page 488</a>] (<a href="#Contents">Contents</a>)
+[<a name="p488" href="#p488">page 488</a>] (<a href="#Contents">Contents</a>)
<a name="J" href="#J"><b> Annex J</b></a>
(informative)
-- The order in which subexpressions are evaluated and the order in which side effects
take place, except as specified for the function-call (), &&, ||, ?:, and comma
operators (<a href="#6.5">6.5</a>).
-[<a name="#p489" href="p489">page 489</a>] (<a href="#Contents">Contents</a>)
+[<a name="p489" href="#p489">page 489</a>] (<a href="#Contents">Contents</a>)
-- The order in which the function designator, arguments, and subexpressions within the
arguments are evaluated in a function call (<a href="#6.5.2.2">6.5.2.2</a>).
range of the return type (<a href="#7.12.6.5">7.12.6.5</a>, <a href="#F.9.3.5">F.9.3.5</a>).
-- The result of rounding when the value is out of range (<a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#F.9.6.5">F.9.6.5</a>).
-[<a name="#p490" href="p490">page 490</a>] (<a href="#Contents">Contents</a>)
+[<a name="p490" href="#p490">page 490</a>] (<a href="#Contents">Contents</a>)
-- The value stored by the remquo functions in the object pointed to by quo when y is
zero (<a href="#7.12.10.3">7.12.10.3</a>).
-[<a name="#p491" href="p491">page 491</a>] (<a href="#Contents">Contents</a>)
+[<a name="p491" href="#p491">page 491</a>] (<a href="#Contents">Contents</a>)
-- Whether or when library functions in <a href="#7.12"><math.h></a> raise the ''inexact'' floating-point
exception in an IEC 60559 conformant implementation (<a href="#F.9">F.9</a>).
-- A trap representation is read by an lvalue expression that does not have character type
(<a href="#6.2.6.1">6.2.6.1</a>).
-[<a name="#p492" href="p492">page 492</a>] (<a href="#Contents">Contents</a>)
+[<a name="p492" href="#p492">page 492</a>] (<a href="#Contents">Contents</a>)
-- A trap representation is produced by a side effect that modifies any part of the object
using an lvalue expression that does not have character type (<a href="#6.2.6.1">6.2.6.1</a>).
-- The identifier __func__ is explicitly declared (<a href="#6.4.2.2">6.4.2.2</a>).
-[<a name="#p493" href="p493">page 493</a>] (<a href="#Contents">Contents</a>)
+[<a name="p493" href="#p493">page 493</a>] (<a href="#Contents">Contents</a>)
-- The program attempts to modify a string literal (<a href="#6.4.5">6.4.5</a>).
-- The characters ', \, ", //, or /* occur in the sequence between the < and >
-- Pointers that do not point into, or just beyond, the same array object are subtracted
(<a href="#6.5.6">6.5.6</a>).
-[<a name="#p494" href="p494">page 494</a>] (<a href="#Contents">Contents</a>)
+[<a name="p494" href="#p494">page 494</a>] (<a href="#Contents">Contents</a>)
-- An array subscript is out of range, even if an object is apparently accessible with the
given subscript (as in the lvalue expression a[1][7] given the declaration int
-- A structure or union is defined as containing no named members (<a href="#6.7.2.1">6.7.2.1</a>).
-[<a name="#p495" href="p495">page 495</a>] (<a href="#Contents">Contents</a>)
+[<a name="p495" href="#p495">page 495</a>] (<a href="#Contents">Contents</a>)
-- An attempt is made to access, or generate a pointer to just past, a flexible array
member of a structure when the referenced object provides no elements for that array
compatible return types, or their parameters disagree in use of the ellipsis terminator
or the number and type of parameters (after default argument promotion, when there
is no parameter type list or when one type is specified by a function definition with an
-[<a name="#p496" href="p496">page 496</a>] (<a href="#Contents">Contents</a>)
+[<a name="p496" href="#p496">page 496</a>] (<a href="#Contents">Contents</a>)
identifier list) (<a href="#6.7.5.3">6.7.5.3</a>).
-- The value of an unnamed member of a structure or union is used (<a href="#6.7.8">6.7.8</a>).
-- The result of the preprocessing operator ## is not a valid preprocessing token
(<a href="#6.10.3.3">6.10.3.3</a>).
-[<a name="#p497" href="p497">page 497</a>] (<a href="#Contents">Contents</a>)
+[<a name="p497" href="#p497">page 497</a>] (<a href="#Contents">Contents</a>)
-- The #line preprocessing directive that results after expansion does not match one of
the two well-defined forms, or its digit sequence specifies zero or a number greater
-- The argument to the assert macro does not have a scalar type (<a href="#7.2">7.2</a>).
-- The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in
any context other than outside all external declarations or preceding all explicit
-[<a name="#p498" href="p498">page 498</a>] (<a href="#Contents">Contents</a>)
+[<a name="p498" href="#p498">page 498</a>] (<a href="#Contents">Contents</a>)
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>).
-- The value of an argument to a character handling function is neither equal to the value
invocation of the corresponding setjmp macro, that was changed between the
setjmp invocation and longjmp call (<a href="#7.13.2.1">7.13.2.1</a>).
-[<a name="#p499" href="p499">page 499</a>] (<a href="#Contents">Contents</a>)
+[<a name="p499" href="#p499">page 499</a>] (<a href="#Contents">Contents</a>)
-- The program specifies an invalid pointer to a signal handler function (<a href="#7.14.1.1">7.14.1.1</a>).
-- A signal handler returns when the signal corresponded to a computational exception
-- The parameter parmN of a va_start macro is declared with the register
storage class, with a function or array type, or with a type that is not compatible with
the type that results after application of the default argument promotions (<a href="#7.15.1.4">7.15.1.4</a>).
-[<a name="#p500" href="p500">page 500</a>] (<a href="#Contents">Contents</a>)
+[<a name="p500" href="#p500">page 500</a>] (<a href="#Contents">Contents</a>)
-- The member designator parameter of an offsetof macro is an invalid right
operand of the . operator for the type parameter, or designates a bit-field (<a href="#7.17">7.17</a>).
conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.24.2.1">7.24.2.1</a>).
-[<a name="#p501" href="p501">page 501</a>] (<a href="#Contents">Contents</a>)
+[<a name="p501" href="#p501">page 501</a>] (<a href="#Contents">Contents</a>)
-- A conversion specification for one of the formatted input/output functions uses a
length modifier with a conversion specifier other than those described (<a href="#7.19.6.1">7.19.6.1</a>,
<a href="#7.24.2.5">7.24.2.5</a>, <a href="#7.24.2.6">7.24.2.6</a>, <a href="#7.24.2.7">7.24.2.7</a>, <a href="#7.24.2.8">7.24.2.8</a>, <a href="#7.24.2.9">7.24.2.9</a>, <a href="#7.24.2.10">7.24.2.10</a>).
-- The contents of the array supplied in a call to the fgets, gets, or fgetws function
are used after a read error occurred (<a href="#7.19.7.2">7.19.7.2</a>, <a href="#7.19.7.7">7.19.7.7</a>, <a href="#7.24.3.2">7.24.3.2</a>).
-[<a name="#p502" href="p502">page 502</a>] (<a href="#Contents">Contents</a>)
+[<a name="p502" href="#p502">page 502</a>] (<a href="#Contents">Contents</a>)
-- The file position indicator for a binary stream is used after a call to the ungetc
function where its value was zero before the call (<a href="#7.19.7.11">7.19.7.11</a>).
inconsistently (<a href="#7.20.5">7.20.5</a>).
-[<a name="#p503" href="p503">page 503</a>] (<a href="#Contents">Contents</a>)
+[<a name="p503" href="#p503">page 503</a>] (<a href="#Contents">Contents</a>)
-- The array being searched by the bsearch function does not have its elements in
proper order (<a href="#7.20.5.1">7.20.5.1</a>).
-[<a name="#p504" href="p504">page 504</a>] (<a href="#Contents">Contents</a>)
+[<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
<a name="J.3" href="#J.3"><b> J.3 Implementation-defined behavior</b></a>
1 A conforming implementation is required to document its choice of behavior in each of
-[<a name="#p505" href="p505">page 505</a>] (<a href="#Contents">Contents</a>)
+[<a name="p505" href="#p505">page 505</a>] (<a href="#Contents">Contents</a>)
<a name="J.3.4" href="#J.3.4"><b> J.3.4 Characters</b></a>
1 -- The number of bits in a byte (<a href="#3.6">3.6</a>).
-[<a name="#p506" href="p506">page 506</a>] (<a href="#Contents">Contents</a>)
+[<a name="p506" href="#p506">page 506</a>] (<a href="#Contents">Contents</a>)
-- The results of some bitwise operations on signed integers (<a href="#6.5">6.5</a>).
<a name="J.3.6" href="#J.3.6"><b> J.3.6 Floating point</b></a>
-[<a name="#p507" href="p507">page 507</a>] (<a href="#Contents">Contents</a>)
+[<a name="p507" href="#p507">page 507</a>] (<a href="#Contents">Contents</a>)
<a name="J.3.8" href="#J.3.8"><b> J.3.8 Hints</b></a>
1 -- The extent to which suggestions made by using the register storage-class
-- The method by which preprocessing tokens (possibly resulting from macro
expansion) in a #include directive are combined into a header name (<a href="#6.10.2">6.10.2</a>).
-[<a name="#p508" href="p508">page 508</a>] (<a href="#Contents">Contents</a>)
+[<a name="p508" href="#p508">page 508</a>] (<a href="#Contents">Contents</a>)
-- The nesting limit for #include processing (<a href="#6.10.2">6.10.2</a>).
-- Whether the # operator inserts a \ character before the \ character that begins a
-[<a name="#p509" href="p509">page 509</a>] (<a href="#Contents">Contents</a>)
+[<a name="p509" href="#p509">page 509</a>] (<a href="#Contents">Contents</a>)
-- Whether a domain error occurs or zero is returned when a remquo function has a
second argument of zero (<a href="#7.12.10.3">7.12.10.3</a>).
-- The interpretation of a - character that is neither the first nor the last character, nor
the second where a ^ character is the first, in the scanlist for %[ conversion in the
fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>).
-[<a name="#p510" href="p510">page 510</a>] (<a href="#Contents">Contents</a>)
+[<a name="p510" href="#p510">page 510</a>] (<a href="#Contents">Contents</a>)
-- The set of sequences matched by a %p conversion and the interpretation of the
corresponding input item in the fscanf or fwscanf function (<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.2">7.24.2.2</a>).
-[<a name="#p511" href="p511">page 511</a>] (<a href="#Contents">Contents</a>)
+[<a name="p511" href="#p511">page 511</a>] (<a href="#Contents">Contents</a>)
<a name="J.4" href="#J.4"><b> J.4 Locale-specific behavior</b></a>
1 The following characteristics of a hosted environment are locale-specific and are required
-[<a name="#p512" href="p512">page 512</a>] (<a href="#Contents">Contents</a>)
+[<a name="p512" href="#p512">page 512</a>] (<a href="#Contents">Contents</a>)
<a name="J.5" href="#J.5"><b> J.5 Common extensions</b></a>
1 The following extensions are widely used in many systems, but are not portable to all
-[<a name="#p513" href="p513">page 513</a>] (<a href="#Contents">Contents</a>)
+[<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
<a name="J.5.7" href="#J.5.7"><b> J.5.7 Function pointer casts</b></a>
1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to
-[<a name="#p514" href="p514">page 514</a>] (<a href="#Contents">Contents</a>)
+[<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
<a name="J.5.14" href="#J.5.14"><b> J.5.14 Extra arguments for signal handlers</b></a>
1 Handlers for specific signals are called with extra arguments in addition to the signal
-[<a name="#p515" href="p515">page 515</a>] (<a href="#Contents">Contents</a>)
+[<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
<a name="Bibliography" href="#Bibliography"><b> Bibliography</b></a>
18. ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet
Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane.
-[<a name="#p516" href="p516">page 516</a>] (<a href="#Contents">Contents</a>)
+[<a name="p516" href="#p516">page 516</a>] (<a href="#Contents">Contents</a>)
19. ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to
ISO/IEC 10646-1:1993.
-[<a name="#p517" href="p517">page 517</a>] (<a href="#Contents">Contents</a>)
+[<a name="p517" href="#p517">page 517</a>] (<a href="#Contents">Contents</a>)
-[<a name="#p518" href="p518">page 518</a>] (<a href="#Contents">Contents</a>)
+[<a name="p518" href="#p518">page 518</a>] (<a href="#Contents">Contents</a>)
<a name="Index" href="#Index"><b>Index</b></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> <a href="#7.18"><stdint.h></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>,
+= (addition assignment operator), <a href="#6.5.16.2">6.5.16.2</a> <a href="#7.18">7.18</a>, <a href="#7.26.8">7.26.8</a>
, (comma operator), <a href="#6.5.17">6.5.17</a>
-[<a name="#p519" href="p519">page 519</a>] (<a href="#Contents">Contents</a>)
+[<a name="p519" href="#p519">page 519</a>] (<a href="#Contents">Contents</a>)
<a href="#7.19"><stdio.h></a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.19">7.19</a>, <a href="#7.26.9">7.26.9</a>, <a href="#F">F</a> __cplusplus macro, <a href="#6.10.8">6.10.8</a>
<a href="#7.20"><stdlib.h></a> header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.20">7.20</a>, <a href="#7.26.10">7.26.10</a>, <a href="#F">F</a> __DATE__ macro, <a href="#6.10.8">6.10.8</a>
__bool_true_false_are_defined abstract declarator, <a href="#6.7.6">6.7.6</a>
macro, <a href="#7.16">7.16</a> abstract machine, <a href="#5.1.2.3">5.1.2.3</a>
-[<a name="#p520" href="p520">page 520</a>] (<a href="#Contents">Contents</a>)
+[<a name="p520" href="#p520">page 520</a>] (<a href="#Contents">Contents</a>)
access, <a href="#3.1">3.1</a>, <a href="#6.7.3">6.7.3</a> array
accuracy, see floating-point accuracy argument, <a href="#6.9.1">6.9.1</a>
arithmetic types, <a href="#6.2.5">6.2.5</a> basic character set, <a href="#3.6">3.6</a>, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>
arithmetic, pointer, <a href="#6.5.6">6.5.6</a> basic types, <a href="#6.2.5">6.2.5</a>
-[<a name="#p521" href="p521">page 521</a>] (<a href="#Contents">Contents</a>)
+[<a name="p521" href="#p521">page 521</a>] (<a href="#Contents">Contents</a>)
behavior, <a href="#3.4">3.4</a> call by value, <a href="#6.5.2.2">6.5.2.2</a>
binary streams, <a href="#7.19.2">7.19.2</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>, calloc function, <a href="#7.20.3">7.20.3</a>, <a href="#7.20.3.1">7.20.3.1</a>, <a href="#7.20.3.2">7.20.3.2</a>,
calendar time, <a href="#7.23.1">7.23.1</a>, <a href="#7.23.2.2">7.23.2.2</a>, <a href="#7.23.2.3">7.23.2.3</a>, <a href="#7.23.2.4">7.23.2.4</a>, extensible, <a href="#7.25.2.2">7.25.2.2</a>
<a href="#7.23.3.2">7.23.3.2</a>, <a href="#7.23.3.3">7.23.3.3</a>, <a href="#7.23.3.4">7.23.3.4</a> character constant, <a href="#5.1.1.2">5.1.1.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#6.4.4.4">6.4.4.4</a>
-[<a name="#p522" href="p522">page 522</a>] (<a href="#Contents">Contents</a>)
+[<a name="p522" href="#p522">page 522</a>] (<a href="#Contents">Contents</a>)
character display semantics, <a href="#5.2.2">5.2.2</a> complex.h header, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#7.3">7.3</a>, <a href="#7.22">7.22</a>, <a href="#7.26.1">7.26.1</a>,
character handling header, <a href="#7.4">7.4</a>, <a href="#7.11.1.1">7.11.1.1</a> <a href="#G.6">G.6</a>, <a href="#J.5.17">J.5.17</a>
complex type domain, <a href="#6.2.5">6.2.5</a> function, <a href="#6.3.2.1">6.3.2.1</a>
complex types, <a href="#6.2.5">6.2.5</a>, <a href="#6.7.2">6.7.2</a>, <a href="#G">G</a> function argument, <a href="#6.5.2.2">6.5.2.2</a>, <a href="#6.9.1">6.9.1</a>
-[<a name="#p523" href="p523">page 523</a>] (<a href="#Contents">Contents</a>)
+[<a name="p523" href="#p523">page 523</a>] (<a href="#Contents">Contents</a>)
function designators, <a href="#6.3.2.1">6.3.2.1</a> type-generic macro for, <a href="#7.22">7.22</a>
function parameter, <a href="#6.9.1">6.9.1</a> csinh functions, <a href="#7.3.6.5">7.3.6.5</a>, <a href="#G.6.2.5">G.6.2.5</a>
creal type-generic macro, <a href="#7.22">7.22</a>, <a href="#G.7">G.7</a> function, <a href="#6.9.1">6.9.1</a>
csin functions, <a href="#7.3.5.5">7.3.5.5</a>, <a href="#G.6">G.6</a> derived declarator types, <a href="#6.2.5">6.2.5</a>
-[<a name="#p524" href="p524">page 524</a>] (<a href="#Contents">Contents</a>)
+[<a name="p524" href="#p524">page 524</a>] (<a href="#Contents">Contents</a>)
derived types, <a href="#6.2.5">6.2.5</a> end-of-file indicator, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.5.3">7.19.5.3</a>, <a href="#7.19.7.1">7.19.7.1</a>,
designated initializer, <a href="#6.7.8">6.7.8</a> <a href="#7.19.7.5">7.19.7.5</a>, <a href="#7.19.7.6">7.19.7.6</a>, <a href="#7.19.7.11">7.19.7.11</a>, <a href="#7.19.9.2">7.19.9.2</a>,
<a href="#7.24.6.3.2">7.24.6.3.2</a>, <a href="#7.24.6.3.3">7.24.6.3.3</a>, <a href="#7.24.6.4.1">7.24.6.4.1</a>, <a href="#7.24.6.4.2">7.24.6.4.2</a> encoding, see encoding error
end-of-file, <a href="#7.24.1">7.24.1</a> range, see range error
-[<a name="#p525" href="p525">page 525</a>] (<a href="#Contents">Contents</a>)
+[<a name="p525" href="#p525">page 525</a>] (<a href="#Contents">Contents</a>)
error conditions, <a href="#7.12.1">7.12.1</a> extended characters, <a href="#5.2.1">5.2.1</a>
error functions, <a href="#7.12.8">7.12.8</a>, <a href="#F.9.5">F.9.5</a> extended integer types, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.4.4.1">6.4.4.1</a>,
expression statement, <a href="#6.8.3">6.8.3</a> fetestexcept function, <a href="#7.6.2">7.6.2</a>, <a href="#7.6.2.5">7.6.2.5</a>, <a href="#F.3">F.3</a>
extended character set, <a href="#3.7.2">3.7.2</a>, <a href="#5.2.1">5.2.1</a>, <a href="#5.2.1.2">5.2.1.2</a> feupdateenv function, <a href="#7.6.4.2">7.6.4.2</a>, <a href="#7.6.4.4">7.6.4.4</a>, <a href="#F.3">F.3</a>
-[<a name="#p526" href="p526">page 526</a>] (<a href="#Contents">Contents</a>)
+[<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
fexcept_t type, <a href="#7.6">7.6</a>, <a href="#F.3">F.3</a> floating-point status flag, <a href="#7.6">7.6</a>, <a href="#F.7.6">F.7.6</a>
fflush function, <a href="#7.19.5.2">7.19.5.2</a>, <a href="#7.19.5.3">7.19.5.3</a> floor functions, <a href="#7.12.9.2">7.12.9.2</a>, <a href="#F.9.6.2">F.9.6.2</a>
floating-point number, <a href="#5.2.4.2.2">5.2.4.2.2</a>, <a href="#6.2.5">6.2.5</a> fpclassify macro, <a href="#7.12.3.1">7.12.3.1</a>, <a href="#F.3">F.3</a>
floating-point rounding mode, <a href="#5.2.4.2.2">5.2.4.2.2</a> fpos_t type, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.2">7.19.2</a>
-[<a name="#p527" href="p527">page 527</a>] (<a href="#Contents">Contents</a>)
+[<a name="p527" href="#p527">page 527</a>] (<a href="#Contents">Contents</a>)
fprintf function, <a href="#7.8.1">7.8.1</a>, <a href="#7.19.1">7.19.1</a>, <a href="#7.19.6.1">7.19.6.1</a>, language, <a href="#6.11">6.11</a>
<a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.19.6.3">7.19.6.3</a>, <a href="#7.19.6.5">7.19.6.5</a>, <a href="#7.19.6.6">7.19.6.6</a>, library, <a href="#7.26">7.26</a>
function-like macro, <a href="#6.10.3">6.10.3</a> hypot functions, <a href="#7.12.7.3">7.12.7.3</a>, <a href="#F.9.4.3">F.9.4.3</a>
future directions hypot type-generic macro, <a href="#7.22">7.22</a>
-[<a name="#p528" href="p528">page 528</a>] (<a href="#Contents">Contents</a>)
+[<a name="p528" href="#p528">page 528</a>] (<a href="#Contents">Contents</a>)
I macro, <a href="#7.3.1">7.3.1</a>, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#G.6">G.6</a> initial position, <a href="#5.2.2">5.2.2</a>
identifier, <a href="#6.4.2.1">6.4.2.1</a>, <a href="#6.5.1">6.5.1</a> initial shift state, <a href="#5.2.1.2">5.2.1.2</a>
inequality operator (!=), <a href="#6.5.9">6.5.9</a> INTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
INFINITY macro, <a href="#7.3.9.4">7.3.9.4</a>, <a href="#7.12">7.12</a>, <a href="#F.2.1">F.2.1</a> INTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
-[<a name="#p529" href="p529">page 529</a>] (<a href="#Contents">Contents</a>)
+[<a name="p529" href="#p529">page 529</a>] (<a href="#Contents">Contents</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.18.2.5">7.18.2.5</a> iswalpha function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.2">7.25.2.1.2</a>,
intmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a>
iswalnum function, <a href="#7.25.2.1.1">7.25.2.1.1</a>, <a href="#7.25.2.1.9">7.25.2.1.9</a>, LC_NUMERIC macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.11.2.1">7.11.2.1</a>
<a href="#7.25.2.1.10">7.25.2.1.10</a>, <a href="#7.25.2.2.1">7.25.2.2.1</a> LC_TIME macro, <a href="#7.11">7.11</a>, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3.5">7.23.3.5</a>
-[<a name="#p530" href="p530">page 530</a>] (<a href="#Contents">Contents</a>)
+[<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
lconv structure type, <a href="#7.11">7.11</a> llabs function, <a href="#7.20.6.1">7.20.6.1</a>
LDBL_DIG macro, <a href="#5.2.4.2.2">5.2.4.2.2</a> lldiv function, <a href="#7.20.6.2">7.20.6.2</a>
linkage, <a href="#6.2.2">6.2.2</a>, <a href="#6.7">6.7</a>, <a href="#6.7.4">6.7.4</a>, <a href="#6.7.5.2">6.7.5.2</a>, <a href="#6.9">6.9</a>, <a href="#6.9.2">6.9.2</a>, long integer suffix, l or <a href="#L">L</a>, <a href="#6.4.4.1">6.4.4.1</a>
<a href="#6.11.2">6.11.2</a> long long int type, <a href="#6.2.5">6.2.5</a>, <a href="#6.3.1.1">6.3.1.1</a>, <a href="#6.7.2">6.7.2</a>,
-[<a name="#p531" href="p531">page 531</a>] (<a href="#Contents">Contents</a>)
+[<a name="p531" href="#p531">page 531</a>] (<a href="#Contents">Contents</a>)
<a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, <a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> mbsinit function, <a href="#7.24.6.2.1">7.24.6.2.1</a>
long long int type conversion, <a href="#6.3.1.1">6.3.1.1</a>, mbsrtowcs function, <a href="#7.24.6.4.1">7.24.6.4.1</a>
<a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a>, <a href="#7.24.6.3.1">7.24.6.3.1</a>, <a href="#7.24.6.3.2">7.24.6.3.2</a>, file, <a href="#7.19.3">7.19.3</a>
<a href="#7.24.6.4.1">7.24.6.4.1</a> internal, <a href="#5.2.4.1">5.2.4.1</a>, <a href="#6.4.2.1">6.4.2.1</a>
-[<a name="#p532" href="p532">page 532</a>] (<a href="#Contents">Contents</a>)
+[<a name="p532" href="#p532">page 532</a>] (<a href="#Contents">Contents</a>)
label, <a href="#6.2.3">6.2.3</a> octal-character escape sequence (\octal digits),
structure/union member, <a href="#6.2.3">6.2.3</a> <a href="#6.4.4.4">6.4.4.4</a>
octal constant, <a href="#6.4.4.1">6.4.4.1</a> parse state, <a href="#7.19.2">7.19.2</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> permitted form of initializer, <a href="#6.6">6.6</a>
-[<a name="#p533" href="p533">page 533</a>] (<a href="#Contents">Contents</a>)
+[<a name="p533" href="#p533">page 533</a>] (<a href="#Contents">Contents</a>)
perror function, <a href="#7.19.10.4">7.19.10.4</a> PRIcPTR macros, <a href="#7.8.1">7.8.1</a>
phase angle, complex, <a href="#7.3.9.1">7.3.9.1</a> primary expression, <a href="#6.5.1">6.5.1</a>
PRIcMAX macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.9.5">7.12.9.5</a>, <a href="#7.12.9.7">7.12.9.7</a>, <a href="#7.12.11.3">7.12.11.3</a>, <a href="#7.12.12.1">7.12.12.1</a>,
PRIcN macros, <a href="#7.8.1">7.8.1</a> <a href="#7.12.13.1">7.12.13.1</a>
-[<a name="#p534" href="p534">page 534</a>] (<a href="#Contents">Contents</a>)
+[<a name="p534" href="#p534">page 534</a>] (<a href="#Contents">Contents</a>)
rank, see integer conversion rank same scope, <a href="#6.2.1">6.2.1</a>
real floating type conversion, <a href="#6.3.1.4">6.3.1.4</a>, <a href="#6.3.1.5">6.3.1.5</a>, save calling environment function, <a href="#7.13.1">7.13.1</a>
rvalue, <a href="#6.3.2.1">6.3.2.1</a> SHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
SHRT_MIN macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
-[<a name="#p535" href="p535">page 535</a>] (<a href="#Contents">Contents</a>)
+[<a name="p535" href="#p535">page 535</a>] (<a href="#Contents">Contents</a>)
side effects, <a href="#5.1.2.3">5.1.2.3</a>, <a href="#6.5">6.5</a> source lines, <a href="#5.1.1.2">5.1.1.2</a>
SIG_ATOMIC_MAX macro, <a href="#7.18.3">7.18.3</a> source text, <a href="#5.1.1.2">5.1.1.2</a>
name, <a href="#6.10.4">6.10.4</a>, <a href="#6.10.8">6.10.8</a> continue, <a href="#6.8.6.2">6.8.6.2</a>
source file inclusion, <a href="#6.10.2">6.10.2</a> do, <a href="#6.8.5.2">6.8.5.2</a>
-[<a name="#p536" href="p536">page 536</a>] (<a href="#Contents">Contents</a>)
+[<a name="p536" href="#p536">page 536</a>] (<a href="#Contents">Contents</a>)
else, <a href="#6.8.4.1">6.8.4.1</a> strictly conforming program, <a href="#4">4</a>
expression, <a href="#6.8.3">6.8.3</a> string, <a href="#7.1.1">7.1.1</a>
strftime function, <a href="#7.11.1.1">7.11.1.1</a>, <a href="#7.23.3">7.23.3</a>, <a href="#7.23.3.5">7.23.3.5</a>, subscripting, <a href="#6.5.2.1">6.5.2.1</a>
<a href="#7.24.5.1">7.24.5.1</a> subtraction assignment operator (-=), <a href="#6.5.16.2">6.5.16.2</a>
-[<a name="#p537" href="p537">page 537</a>] (<a href="#Contents">Contents</a>)
+[<a name="p537" href="#p537">page 537</a>] (<a href="#Contents">Contents</a>)
subtraction operator (-), <a href="#6.5.6">6.5.6</a>, <a href="#F.3">F.3</a>, <a href="#G.5.2">G.5.2</a> tolower function, <a href="#7.4.2.1">7.4.2.1</a>
suffix toupper function, <a href="#7.4.2.2">7.4.2.2</a>
token concatenation, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_C macro, <a href="#7.18.4.2">7.18.4.2</a>
token pasting, <a href="#6.10.3.3">6.10.3.3</a> UINTMAX_MAX macro, <a href="#7.8.2.3">7.8.2.3</a>, <a href="#7.8.2.4">7.8.2.4</a>, <a href="#7.18.2.5">7.18.2.5</a>
-[<a name="#p538" href="p538">page 538</a>] (<a href="#Contents">Contents</a>)
+[<a name="p538" href="#p538">page 538</a>] (<a href="#Contents">Contents</a>)
uintmax_t type, <a href="#7.18.1.5">7.18.1.5</a>, <a href="#7.19.6.1">7.19.6.1</a>, <a href="#7.19.6.2">7.19.6.2</a>, USHRT_MAX macro, <a href="#5.2.4.2.1">5.2.4.2.1</a>
<a href="#7.24.2.1">7.24.2.1</a>, <a href="#7.24.2.2">7.24.2.2</a> usual arithmetic conversions, <a href="#6.3.1.8">6.3.1.8</a>, <a href="#6.5.5">6.5.5</a>, <a href="#6.5.6">6.5.6</a>,
uppercase letter, <a href="#5.2.1">5.2.1</a> vsprintf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.13">7.19.6.13</a>
use of library functions, <a href="#7.1.4">7.1.4</a> vsscanf function, <a href="#7.19.6.8">7.19.6.8</a>, <a href="#7.19.6.14">7.19.6.14</a>
-[<a name="#p539" href="p539">page 539</a>] (<a href="#Contents">Contents</a>)
+[<a name="p539" href="#p539">page 539</a>] (<a href="#Contents">Contents</a>)
vswprintf function, <a href="#7.24.2.7">7.24.2.7</a> wctype.h header, <a href="#7.25">7.25</a>, <a href="#7.26.13">7.26.13</a>
vswscanf function, <a href="#7.24.2.8">7.24.2.8</a> wctype_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
wctrans_t type, <a href="#7.25.1">7.25.1</a>, <a href="#7.25.3.2.2">7.25.3.2.2</a>
wctype function, <a href="#7.25.2.2.1">7.25.2.2.1</a>, <a href="#7.25.2.2.2">7.25.2.2.2</a>
-[<a name="#p540" href="p540">page 540</a>] (<a href="#Contents">Contents</a>)
+[<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
</pre></body></html>