<h3><a name="3.1" href="#3.1">3.1</a></h3>
<p><!--para 1 -->
- access
+<b> access</b><br>
<execution-time action> to read or modify the value of an object
<p><!--para 2 -->
NOTE 1 Where only one of these two actions is meant, ''read'' or ''modify'' is used.
<h3><a name="3.2" href="#3.2">3.2</a></h3>
<p><!--para 1 -->
- alignment
+<b> alignment</b><br>
requirement that objects of a particular type be located on storage boundaries with
addresses that are particular multiples of a byte address
<h3><a name="3.3" href="#3.3">3.3</a></h3>
<p><!--para 1 -->
- argument
- actual argument
- actual parameter (deprecated)
+<b> argument</b><br>
+ actual argument<br>
+ actual parameter (deprecated)<br>
expression in the comma-separated list bounded by the parentheses in a function call
expression, or a sequence of preprocessing tokens in the comma-separated list bounded
by the parentheses in a function-like macro invocation
<h3><a name="3.4" href="#3.4">3.4</a></h3>
<p><!--para 1 -->
- behavior
+<b> behavior</b><br>
external appearance or action
<h4><a name="3.4.1" href="#3.4.1">3.4.1</a></h4>
<p><!--para 1 -->
- implementation-defined behavior
+<b> implementation-defined behavior</b><br>
unspecified behavior where each implementation documents how the choice is made
<p><!--para 2 -->
EXAMPLE An example of implementation-defined behavior is the propagation of the high-order bit
<h4><a name="3.4.2" href="#3.4.2">3.4.2</a></h4>
<p><!--para 1 -->
- locale-specific behavior
+<b> locale-specific behavior</b><br>
behavior that depends on local conventions of nationality, culture, and language that each
implementation documents
<!--page 16 -->
<h4><a name="3.4.3" href="#3.4.3">3.4.3</a></h4>
<p><!--para 1 -->
- undefined behavior
+<b> undefined behavior</b><br>
behavior, upon use of a nonportable or erroneous program construct or of erroneous data,
for which this International Standard imposes no requirements
<p><!--para 2 -->
<h4><a name="3.4.4" href="#3.4.4">3.4.4</a></h4>
<p><!--para 1 -->
- unspecified behavior
+<b> unspecified behavior</b><br>
use of an unspecified value, or other behavior where this International Standard provides
two or more possibilities and imposes no further requirements on which is chosen in any
instance
<h3><a name="3.5" href="#3.5">3.5</a></h3>
<p><!--para 1 -->
- bit
+<b> bit</b><br>
unit of data storage in the execution environment large enough to hold an object that may
have one of two values
<p><!--para 2 -->
<h3><a name="3.6" href="#3.6">3.6</a></h3>
<p><!--para 1 -->
- byte
+<b> byte</b><br>
addressable unit of data storage large enough to hold any member of the basic character
set of the execution environment
<p><!--para 2 -->
<h3><a name="3.7" href="#3.7">3.7</a></h3>
<p><!--para 1 -->
- character
+<b> character</b><br>
<abstract> member of a set of elements used for the organization, control, or
representation of data
<h4><a name="3.7.1" href="#3.7.1">3.7.1</a></h4>
<p><!--para 1 -->
- character
+<b> character</b><br>
single-byte character
<C> bit representation that fits in a byte
<!--page 17 -->
<h4><a name="3.7.2" href="#3.7.2">3.7.2</a></h4>
<p><!--para 1 -->
- multibyte character
+<b> multibyte character</b><br>
sequence of one or more bytes representing a member of the extended character set of
either the source or the execution environment
<p><!--para 2 -->
<h4><a name="3.7.3" href="#3.7.3">3.7.3</a></h4>
<p><!--para 1 -->
- wide character
+<b> wide character</b><br>
bit representation that fits in an object of type wchar_t, capable of representing any
character in the current locale
<h3><a name="3.8" href="#3.8">3.8</a></h3>
<p><!--para 1 -->
- constraint
+<b> constraint</b><br>
restriction, either syntactic or semantic, by which the exposition of language elements is
to be interpreted
<h3><a name="3.9" href="#3.9">3.9</a></h3>
<p><!--para 1 -->
- correctly rounded result
+<b> correctly rounded result</b><br>
representation in the result format that is nearest in value, subject to the current rounding
mode, to what the result would be given unlimited range and precision
<h3><a name="3.10" href="#3.10">3.10</a></h3>
<p><!--para 1 -->
- diagnostic message
+<b> diagnostic message</b><br>
message belonging to an implementation-defined subset of the implementation's message
output
<h3><a name="3.11" href="#3.11">3.11</a></h3>
<p><!--para 1 -->
- forward reference
+<b> forward reference</b><br>
reference to a later subclause of this International Standard that contains additional
information relevant to this subclause
<h3><a name="3.12" href="#3.12">3.12</a></h3>
<p><!--para 1 -->
- implementation
+<b> implementation</b><br>
particular set of software, running in a particular translation environment under particular
control options, that performs translation of programs for, and supports execution of
functions in, a particular execution environment
<h3><a name="3.13" href="#3.13">3.13</a></h3>
<p><!--para 1 -->
- implementation limit
+<b> implementation limit</b><br>
restriction imposed upon programs by the implementation
<h3><a name="3.14" href="#3.14">3.14</a></h3>
<p><!--para 1 -->
- object
+<b> object</b><br>
region of data storage in the execution environment, the contents of which can represent
values
<!--page 18 -->
<h3><a name="3.15" href="#3.15">3.15</a></h3>
<p><!--para 1 -->
- parameter
+<b> parameter</b><br>
formal parameter
formal argument (deprecated)
object declared as part of a function declaration or definition that acquires a value on
<h3><a name="3.16" href="#3.16">3.16</a></h3>
<p><!--para 1 -->
- recommended practice
+<b> recommended practice</b><br>
specification that is strongly recommended as being in keeping with the intent of the
standard, but that may be impractical for some implementations
<h3><a name="3.17" href="#3.17">3.17</a></h3>
<p><!--para 1 -->
- value
+<b> value</b><br>
precise meaning of the contents of an object when interpreted as having a specific type
<h4><a name="3.17.1" href="#3.17.1">3.17.1</a></h4>
<p><!--para 1 -->
- implementation-defined value
+<b> implementation-defined value</b><br>
unspecified value where each implementation documents how the choice is made
<h4><a name="3.17.2" href="#3.17.2">3.17.2</a></h4>
<p><!--para 1 -->
- indeterminate value
+<b> indeterminate value</b><br>
either an unspecified value or a trap representation
<h4><a name="3.17.3" href="#3.17.3">3.17.3</a></h4>
<p><!--para 1 -->
- unspecified value
+<b> unspecified value</b><br>
valid value of the relevant type where this International Standard imposes no
requirements on which value is chosen in any instance
<p><!--para 2 -->
<h3><a name="3.18" href="#3.18">3.18</a></h3>
<p><!--para 1 -->
- ??? x???
+<b> [^ x ^]</b><br>
ceiling of x: the least integer greater than or equal to x
<p><!--para 2 -->
- EXAMPLE ???2.4??? is 3, ???-2.4??? is -2.
+ EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
<h3><a name="3.19" href="#3.19">3.19</a></h3>
<p><!--para 1 -->
- ??? x???
+<b> [_ x _]</b><br>
floor of x: the greatest integer less than or equal to x
<p><!--para 2 -->
- EXAMPLE ???2.4??? is 2, ???-2.4??? is -3.
+ EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
<!--page 19 -->
<h2><a name="4" href="#4">4. Conformance</a></h2>
<p><!--para 2 -->
Alphabetic escape sequences representing nongraphic characters in the execution
character set are intended to produce actions on display devices as follows:
- \a (alert) Produces an audible or visible alert without changing the active position.
- \b (backspace) Moves the active position to the previous position on the current line. If
-<pre>
+<dl>
+<dt> \a <dd>(alert) Produces an audible or visible alert without changing the active position.
+<dt> \b <dd>(backspace) Moves the active position to the previous position on the current line. If
the active position is at the initial position of a line, the behavior of the display
- device is unspecified.</pre>
- \f ( form feed) Moves the active position to the initial position at the start of the next
-<pre>
- logical page.</pre>
- \n (new line) Moves the active position to the initial position of the next line.
- \r (carriage return) Moves the active position to the initial position of the current line.
- \t (horizontal tab) Moves the active position to the next horizontal tabulation position
-<pre>
+ device is unspecified.
+<dt> \f <dd>( form feed) Moves the active position to the initial position at the start of the next
+ logical page.
+<dt> \n <dd>(new line) Moves the active position to the initial position of the next line.
+<dt> \r <dd>(carriage return) Moves the active position to the initial position of the current line.
+<dt> \t <dd>(horizontal tab) Moves the active position to the next horizontal tabulation position
on the current line. If the active position is at or past the last defined horizontal
- tabulation position, the behavior of the display device is unspecified.</pre>
- \v (vertical tab) Moves the active position to the initial position of the next vertical
+ tabulation position, the behavior of the display device is unspecified.
+<dt> \v <dd>(vertical tab) Moves the active position to the initial position of the next vertical
<!--page 32 -->
-<p><!--para 3 -->
-<pre>
tabulation position. If the active position is at or past the last defined vertical
- tabulation position, the behavior of the display device is unspecified.</pre>
+ tabulation position, the behavior of the display device is unspecified.
+</dl>
+<p><!--para 3 -->
Each of these escape sequences shall produce a unique implementation-defined value
which can be stored in a single char object. The external representations in a text file
need not be identical to the internal representations, and are outside the scope of this
(absolute value) to those shown, with the same sign.
<ul>
<li> number of bits for smallest object that is not a bit-field (byte)
- CHAR_BIT 8
+<pre> CHAR_BIT 8</pre>
<li> minimum value for an object of type signed char
- SCHAR_MIN -127 // -(27 - 1)
+<pre> SCHAR_MIN -127 // -(2<sup>7</sup> - 1)</pre>
<li> maximum value for an object of type signed char
- SCHAR_MAX +127 // 27 - 1
+<pre> SCHAR_MAX +127 // 2<sup>7</sup> - 1</pre>
<li> maximum value for an object of type unsigned char
- UCHAR_MAX 255 // 28 - 1
+<pre> UCHAR_MAX 255 // 2<sup>8</sup> - 1</pre>
<li> minimum value for an object of type char
- CHAR_MIN see below
+<pre> CHAR_MIN see below</pre>
<li> maximum value for an object of type char
- CHAR_MAX see below
+<pre> CHAR_MAX see below</pre>
<li> maximum number of bytes in a multibyte character, for any supported locale
- MB_LEN_MAX 1
+<pre> MB_LEN_MAX 1</pre>
<li> minimum value for an object of type short int
- SHRT_MIN -32767 // -(215 - 1)
+<pre> SHRT_MIN -32767 // -(2<sup>15</sup> - 1)</pre>
<li> maximum value for an object of type short int
- SHRT_MAX +32767 // 215 - 1
+<pre> SHRT_MAX +32767 // 2<sup>15</sup> - 1</pre>
<li> maximum value for an object of type unsigned short int
- USHRT_MAX 65535 // 216 - 1
+<pre> USHRT_MAX 65535 // 2<sup>16</sup> - 1</pre>
<li> minimum value for an object of type int
- INT_MIN -32767 // -(215 - 1)
+<pre> INT_MIN -32767 // -(2<sup>15</sup> - 1)</pre>
<li> maximum value for an object of type int
- INT_MAX +32767 // 215 - 1
+<pre> INT_MAX +32767 // 2<sup>15</sup> - 1</pre>
<li> maximum value for an object of type unsigned int
- UINT_MAX 65535 // 216 - 1
+<pre> UINT_MAX 65535 // 2<sup>16</sup> - 1</pre>
<li> minimum value for an object of type long int
- LONG_MIN -2147483647 // -(231 - 1)
+<pre> LONG_MIN -2147483647 // -(2<sup>31</sup> - 1)</pre>
<li> maximum value for an object of type long int
- LONG_MAX +2147483647 // 231 - 1
+<pre> LONG_MAX +2147483647 // 2<sup>31</sup> - 1</pre>
<li> maximum value for an object of type unsigned long int
- ULONG_MAX 4294967295 // 232 - 1
+<pre> ULONG_MAX 4294967295 // 2<sup>32</sup> - 1</pre>
<!--page 35 -->
<li> minimum value for an object of type long long int
- LLONG_MIN -9223372036854775807 // -(263 - 1)
+<pre> LLONG_MIN -9223372036854775807 // -(2<sup>63</sup> - 1)</pre>
<li> maximum value for an object of type long long int
- LLONG_MAX +9223372036854775807 // 263 - 1
+<pre> LLONG_MAX +9223372036854775807 // 2<sup>63</sup> - 1</pre>
<li> maximum value for an object of type unsigned long long int
- ULLONG_MAX 18446744073709551615 // 264 - 1
+<pre> ULLONG_MAX 18446744073709551615 // 2<sup>64</sup> - 1</pre>
</ul>
<p><!--para 2 -->
If the value of an object of type char is treated as a signed integer when used in an
expression, the value of CHAR_MIN shall be the same as that of SCHAR_MIN and the
value of CHAR_MAX shall be the same as that of SCHAR_MAX. Otherwise, the value of
CHAR_MIN shall be 0 and the value of CHAR_MAX shall be the same as that of
- UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
+ UCHAR_MAX.<sup><a href="#note15"><b>15)</b></a></sup> The value UCHAR_MAX shall equal 2<sup>CHAR_BIT</sup> - 1.
<p><b> Forward references</b>: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
<h6>footnotes</h6>
b base or radix of exponent representation (an integer > 1)
e exponent (an integer between a minimum emin and a maximum emax )
p precision (the number of base-b digits in the significand)
- fk nonnegative integers less than b (the significand digits)</pre>
+ f<sub>k</sub> nonnegative integers less than b (the significand digits)</pre>
A floating-point number (x) is defined by the following model:
<pre>
p
- x = sb e (Sum) f k b-k ,
- k=1
- emin <= e <= emax</pre>
+ x = s b<sup>e</sup> (Sum) f<sub>k</sub> b<sup>-k</sup> , emin <= e <= emax
+ k=1</pre>
<p><!--para 3 -->
- In addition to normalized floating-point numbers ( f 1 > 0 if x != 0), floating types may be
+ In addition to normalized floating-point numbers ( f<sub>1</sub> > 0 if x != 0), floating types may be
able to contain other kinds of floating-point numbers, such as subnormal floating-point
- numbers (x != 0, e = emin , f 1 = 0) and unnormalized floating-point numbers (x != 0,
- e > emin , f 1 = 0), and values that are not floating-point numbers, such as infinities and
+ numbers (x != 0, e = emin , f<sub>1</sub> = 0) and unnormalized floating-point numbers (x != 0,
+ e > emin , f<sub>1</sub> = 0), and values that are not floating-point numbers, such as infinities and
NaNs. A NaN is an encoding signifying Not-a-Number. A quiet NaN propagates
through almost every arithmetic operation without raising a floating-point exception; a
signaling NaN generally raises a floating-point exception when occurring as an
All integer values in the <a href="#7.7"><float.h></a> header, except FLT_ROUNDS, shall be constant
expressions suitable for use in #if preprocessing directives; all floating values shall be
constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD, FLT_RADIX,
- and FLT_ROUNDS have separate names for all three floating-point types. The floating-
- point model representation is provided for all values except FLT_EVAL_METHOD and
+ and FLT_ROUNDS have separate names for all three floating-point types. The floating-point
+ model representation is provided for all values except FLT_EVAL_METHOD and
FLT_ROUNDS.
<p><!--para 7 -->
The rounding mode for floating-point addition is characterized by the implementation-
those shown, with the same sign:
<ul>
<li> radix of exponent representation, b
- FLT_RADIX 2
+<pre> FLT_RADIX 2</pre>
<li> number of base-FLT_RADIX digits in the floating-point significand, p
- FLT_MANT_DIG
+<pre> FLT_MANT_DIG
DBL_MANT_DIG
- LDBL_MANT_DIG
+ LDBL_MANT_DIG</pre>
<li> number of decimal digits, n, such that any floating-point number in the widest
supported floating type with pmax radix b digits can be rounded to a floating-point
number with n decimal digits and back again without change to the value,
<pre>
- ??? pmax log10 b if b is a power of 10
- ???
- ??? ???1 + pmax log10 b??? otherwise</pre>
- DECIMAL_DIG 10
+ { pmax log10 b if b is a power of 10
+ {
+ { [^1 + pmax log10 b^] otherwise</pre>
+<pre> DECIMAL_DIG 10</pre>
<li> number of decimal digits, q, such that any floating-point number with q decimal digits
can be rounded into a floating-point number with p radix b digits and back again
without change to the q decimal digits,
<!--page 38 -->
<pre>
- ??? p log10 b if b is a power of 10
- ???
- ??? ???( p - 1) log10 b??? otherwise</pre>
- FLT_DIG 6
+ { p log10 b if b is a power of 10
+ {
+ { [_( p - 1) log10 b_] otherwise</pre>
+<pre> FLT_DIG 6
DBL_DIG 10
- LDBL_DIG 10
+ LDBL_DIG 10</pre>
<li> minimum negative integer such that FLT_RADIX raised to one less than that power is
a normalized floating-point number, emin
- FLT_MIN_EXP
+<pre> FLT_MIN_EXP
DBL_MIN_EXP
- LDBL_MIN_EXP
+ LDBL_MIN_EXP</pre>
<li> minimum negative integer such that 10 raised to that power is in the range of
- normalized floating-point numbers, ???log10 b emin -1 ???
-<pre>
- ??? ???</pre>
- FLT_MIN_10_EXP -37
+ normalized floating-point numbers, [^log10 b<sup>emin -1</sup>^]
+<pre> FLT_MIN_10_EXP -37
DBL_MIN_10_EXP -37
- LDBL_MIN_10_EXP -37
+ LDBL_MIN_10_EXP -37</pre>
<li> maximum integer such that FLT_RADIX raised to one less than that power is a
representable finite floating-point number, emax
- FLT_MAX_EXP
+<pre> FLT_MAX_EXP
DBL_MAX_EXP
- LDBL_MAX_EXP
+ LDBL_MAX_EXP</pre>
<li> maximum integer such that 10 raised to that power is in the range of representable
- finite floating-point numbers, ???log10 ((1 - b- p )b emax )???
- FLT_MAX_10_EXP +37
+ finite floating-point numbers, [_log10 ((1 - b<sup>-p</sup>)b<sup>emax</sup>)_]
+<pre> FLT_MAX_10_EXP +37
DBL_MAX_10_EXP +37
- LDBL_MAX_10_EXP +37
+ LDBL_MAX_10_EXP +37</pre>
</ul>
<p><!--para 10 -->
The values given in the following list shall be replaced by constant expressions with
implementation-defined values that are greater than or equal to those shown:
<ul>
-<li> maximum representable finite floating-point number, (1 - b- p )b emax
- FLT_MAX 1E+37
+<li> maximum representable finite floating-point number, (1 - b<sup>-p</sup>)b<sup>emax</sup>
+<pre> FLT_MAX 1E+37
DBL_MAX 1E+37
- LDBL_MAX 1E+37
+ LDBL_MAX 1E+37</pre>
</ul>
<p><!--para 11 -->
The values given in the following list shall be replaced by constant expressions with
implementation-defined (positive) values that are less than or equal to those shown:
<ul>
<li> the difference between 1 and the least value greater than 1 that is representable in the
- given floating point type, b1- p
+ given floating point type, b<sup>1-p</sup>
<!--page 39 -->
- FLT_EPSILON 1E-5
+<pre> FLT_EPSILON 1E-5
DBL_EPSILON 1E-9
- LDBL_EPSILON 1E-9
-<li> minimum normalized positive floating-point number, b emin -1
- FLT_MIN 1E-37
+ LDBL_EPSILON 1E-9</pre>
+<li> minimum normalized positive floating-point number, b<sup>emin -1</sup>
+<pre> FLT_MIN 1E-37
DBL_MIN 1E-37
- LDBL_MIN 1E-37
+ LDBL_MIN 1E-37</pre>
</ul>
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 12 -->
Conversion from (at least) double to decimal with DECIMAL_DIG digits and back
should be the identity function.
float:
<pre>
6
- x = s16e (Sum) f k 16-k ,
- k=1
- -31 <= e <= +32</pre>
+ x = s 16<sup>e</sup> (Sum) f<sub>k</sub> 16<sup>-k</sup> , -31 <= e <= +32
+ k=1</pre>
<pre>
FLT_RADIX 16
<a href="#7.7"><float.h></a> header for types float and double:
<pre>
24
- x f = s2e (Sum) f k 2-k ,
- k=1
- -125 <= e <= +128</pre>
+ xf = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -125 <= e <= +128
+ k=1</pre>
<pre>
53
- x d = s2e (Sum) f k 2-k ,
- k=1
- -1021 <= e <= +1024</pre>
+ xd = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -1021 <= e <= +1024
+ k=1</pre>
+
<pre>
FLT_RADIX 2
definitions are listed on separate lines, except when prefaced by the words ''one of''. An
optional symbol is indicated by the subscript ''opt'', so that
<pre>
- { expressionopt }</pre>
+ { expression<sub>opt</sub> }</pre>
indicates an optional expression enclosed in braces.
<p><!--para 2 -->
When syntactic categories are referred to in the main text, they are not italicized and
represented by successive bits are additive, begin with 1, and are multiplied by successive integral
powers of 2, except perhaps the bit with the highest position. (Adapted from the American National
Dictionary for Information Processing Systems.) A byte contains CHAR_BIT bits, and the values of
- type unsigned char range from 0 to 2
-
-<pre>
- CHAR_BIT
- - 1.</pre>
+ type unsigned char range from 0 to 2<sup>CHAR_BIT</sup>- 1.
</small>
<p><small><a name="note41" href="#note41">41)</a> Thus, an automatic variable can be initialized to a trap representation without causing undefined
behavior, but the value of the variable cannot be used until a proper value is stored in it.
For unsigned integer types other than unsigned char, the bits of the object
representation shall be divided into two groups: value bits and padding bits (there need
not be any of the latter). If there are N value bits, each bit shall represent a different
- power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of
- representing values from 0 to 2 N - 1 using a pure binary representation; this shall be
+ power of 2 between 1 and 2<sup>N-1</sup> , so that objects of that type shall be capable of
+ representing values from 0 to 2<sup>N</sup> - 1 using a pure binary representation; this shall be
known as the value representation. The values of any padding bits are unspecified.<sup><a href="#note44"><b>44)</b></a></sup>
<p><!--para 2 -->
For signed integer types, the bits of the object representation shall be divided into three
modified in one of the following ways:
<ul>
<li> the corresponding value with sign bit 0 is negated (sign and magnitude);
-<li> the sign bit has the value -(2 N ) (two's complement);
-<li> the sign bit has the value -(2 N - 1) (ones' complement ).
+<li> the sign bit has the value -(2<sup>N</sup> ) (two's complement);
+<li> the sign bit has the value -(2<sup>N</sup> - 1) (ones' complement ).
</ul>
Which of these applies is implementation-defined, as is whether the value with sign bit 1
and all value bits zero (for the first two), or with sign bit and all value bits 1 (for ones'
and complex otherwise. This pattern is called the usual arithmetic conversions:
<!--page 57 -->
<p><!--para 2 -->
-<pre>
- First, if the corresponding real type of either operand is long double, the other
+<ul>
+<li> First, if the corresponding real type of either operand is long double, the other
operand is converted, without change of type domain, to a type whose
corresponding real type is long double.
- Otherwise, if the corresponding real type of either operand is double, the other
+<li> 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
corresponding real type is double.
- Otherwise, if the corresponding real type of either operand is float, the other
+<li> Otherwise, if the corresponding real type of either operand is float, the other
operand is converted, without change of type domain, to a type whose
corresponding real type is float.<sup><a href="#note51"><b>51)</b></a></sup>
- Otherwise, the integer promotions are performed on both operands. Then the
+<li> Otherwise, the integer promotions are performed on both operands. Then the
following rules are applied to the promoted operands:
- If both operands have the same type, then no further conversion is needed.
- Otherwise, if both operands have signed integer types or both have unsigned
+<ul>
+<li> If both operands have the same type, then no further conversion is needed.
+<li> Otherwise, if both operands have signed integer types or both have unsigned
integer types, the operand with the type of lesser integer conversion rank is
converted to the type of the operand with greater rank.
- Otherwise, if the operand that has unsigned integer type has rank greater or
+<li> Otherwise, if the operand that has unsigned integer type has rank greater or
equal to the rank of the type of the other operand, then the operand with
signed integer type is converted to the type of the operand with unsigned
integer type.
- Otherwise, if the type of the operand with signed integer type can represent
+<li> Otherwise, if the type of the operand with signed integer type can represent
all of the values of the type of the operand with unsigned integer type, then
the operand with unsigned integer type is converted to the type of the
operand with signed integer type.
- Otherwise, both operands are converted to the unsigned integer type
- corresponding to the type of the operand with signed integer type.</pre>
+<li> Otherwise, both operands are converted to the unsigned integer type
+ corresponding to the type of the operand with signed integer type.
+</ul>
+</ul>
The values of floating operands and of the results of floating expressions may be
represented in greater precision and range than that required by the type; the types are not
changed thereby.<sup><a href="#note52"><b>52)</b></a></sup>
<!--page 64 -->
- Implementation limits
+<h6> Implementation limits</h6>
<p><!--para 5 -->
As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of significant initial
characters in an identifier; the limit for an external name (an identifier that has external
<!--page 67 -->
<pre>
integer-constant:
- decimal-constant integer-suffixopt
- octal-constant integer-suffixopt
- hexadecimal-constant integer-suffixopt
+ decimal-constant integer-suffix<sub>opt</sub>
+ octal-constant integer-suffix<sub>opt</sub>
+ hexadecimal-constant integer-suffix<sub>opt</sub>
decimal-constant:
nonzero-digit
decimal-constant digit
a b c d e f
A B C D E F
integer-suffix:
- unsigned-suffix long-suffixopt
+ unsigned-suffix long-suffix<sub>opt</sub>
unsigned-suffix long-long-suffix
- long-suffix unsigned-suffixopt
- long-long-suffix unsigned-suffixopt
+ long-suffix unsigned-suffix<sub>opt</sub>
+ long-long-suffix unsigned-suffix<sub>opt</sub>
unsigned-suffix: one of
u U
long-suffix: one of
The type of an integer constant is the first of the corresponding list in which its value can
be represented.
<!--page 68 -->
-<pre>
- Octal or Hexadecimal</pre>
- Suffix Decimal Constant Constant
-
- none int int
-<pre>
- long int unsigned int
- long long int long int
- unsigned long int
- long long int
- unsigned long long int</pre>
-
- u or U unsigned int unsigned int
-<pre>
- unsigned long int unsigned long int
- unsigned long long int unsigned long long int</pre>
-
- l or L long int long int
-<pre>
- long long int unsigned long int
- long long int
- unsigned long long int</pre>
-
- Both u or U unsigned long int unsigned long int
- and l or L unsigned long long int unsigned long long int
-
- ll or LL long long int long long int
-<pre>
- unsigned long long int</pre>
-
- Both u or U unsigned long long int unsigned long long int
- and ll or LL
+<table border=1>
+<tr><th> Suffix <th>Decimal Constant <th>Octal or Hexadecimal Constant
+<tr><td> none
+<td><pre>int
+long int
+long long int</pre>
+<td><pre>int
+unsigned int
+long int
+unsigned long int
+long long int
+unsigned long long int</pre>
+<tr><td> u or U
+<td><pre>unsigned int
+unsigned long int
+unsigned long long int</pre>
+<td><pre>unsigned int
+unsigned long int
+unsigned long long int</pre>
+<tr><td> l or L
+<td><pre>long int
+long long int</pre>
+<td><pre>long int
+unsigned long int
+long long int
+unsigned long long int</pre>
+<tr><td> Both u or U and l or L
+<td><pre>unsigned long int
+unsigned long long int</pre>
+<td><pre>unsigned long int
+unsigned long long int</pre>
+<tr><td> ll or LL
+<td><pre>long long int</pre>
+<td><pre>long long int
+unsigned long long int</pre>
+<tr><td> Both u or U and ll or LL
+<td><pre>unsigned long long int</pre>
+<td><pre>unsigned long long int</pre>
+</table>
<p><!--para 6 -->
If an integer constant cannot be represented by any type in its list, it may have an
extended integer type, if the extended integer type can represent its value. If all of the
decimal-floating-constant
hexadecimal-floating-constant
decimal-floating-constant:
- fractional-constant exponent-partopt floating-suffixopt
- digit-sequence exponent-part floating-suffixopt
+ fractional-constant exponent-part<sub>opt</sub> floating-suffix<sub>opt</sub>
+ digit-sequence exponent-part floating-suffix<sub>opt</sub>
hexadecimal-floating-constant:
hexadecimal-prefix hexadecimal-fractional-constant
- binary-exponent-part floating-suffixopt
+ binary-exponent-part floating-suffix<sub>opt</sub>
hexadecimal-prefix hexadecimal-digit-sequence
- binary-exponent-part floating-suffixopt
+ binary-exponent-part floating-suffix<sub>opt</sub>
fractional-constant:
- digit-sequenceopt . digit-sequence
+ digit-sequence<sub>opt</sub> . digit-sequence
digit-sequence .
exponent-part:
- e signopt digit-sequence
- E signopt digit-sequence
+ e sign<sub>opt</sub> digit-sequence
+ E sign<sub>opt</sub> digit-sequence
sign: one of
+ -
digit-sequence:
digit
digit-sequence digit
hexadecimal-fractional-constant:
- hexadecimal-digit-sequenceopt .
+ hexadecimal-digit-sequence<sub>opt</sub> .
hexadecimal-digit-sequence
hexadecimal-digit-sequence .
binary-exponent-part:
- p signopt digit-sequence
- P signopt digit-sequence
+ p sign<sub>opt</sub> digit-sequence
+ P sign<sub>opt</sub> digit-sequence
hexadecimal-digit-sequence:
hexadecimal-digit
hexadecimal-digit-sequence hexadecimal-digit
Floating constants are converted to internal format as if at translation-time. The
conversion of a floating constant shall not raise an exceptional condition or a floating-
point exception at execution time.
- Recommended practice
+<h6>Recommended practice</h6>
<p><!--para 6 -->
The implementation should produce a diagnostic message if a hexadecimal constant
cannot be represented exactly in its evaluation format; the implementation should then
<p><!--para 1 -->
<pre>
string-literal:
- " s-char-sequenceopt "
- L" s-char-sequenceopt "
+ " s-char-sequence<sub>opt</sub> "
+ L" s-char-sequence<sub>opt</sub> "
s-char-sequence:
s-char
s-char-sequence s-char
<pre>
i = ++i + 1;
- a[i++] = i;
+ a[i++] = i;</pre>
while allowing
+<pre>
i = i + 1;
a[i] = i;</pre>
parentheses () (<a href="#6.5.1">6.5.1</a>), subscripting brackets [] (<a href="#6.5.2.1">6.5.2.1</a>), function-call parentheses () (<a href="#6.5.2.2">6.5.2.2</a>), and
the conditional operator ?: (<a href="#6.5.15">6.5.15</a>).
-<pre>
- Within each major subclause, the operators have the same precedence. Left- or right-associativity is
- indicated in each subclause by the syntax for the expressions discussed therein.</pre>
+ Within each major subclause, the operators have the same precedence. Left- or right-associativity is
+ indicated in each subclause by the syntax for the expressions discussed therein.
</small>
<p><small><a name="note75" href="#note75">75)</a> Allocated objects have no declared type.
</small>
<p><!--para 1 -->
<pre>
declaration:
- declaration-specifiers init-declarator-listopt ;
+ declaration-specifiers init-declarator-list<sub>opt</sub> ;
declaration-specifiers:
- storage-class-specifier declaration-specifiersopt
- type-specifier declaration-specifiersopt
- type-qualifier declaration-specifiersopt
- function-specifier declaration-specifiersopt
+ storage-class-specifier declaration-specifiers<sub>opt</sub>
+ type-specifier declaration-specifiers<sub>opt</sub>
+ type-qualifier declaration-specifiers<sub>opt</sub>
+ function-specifier declaration-specifiers<sub>opt</sub>
init-declarator-list:
init-declarator
init-declarator-list , init-declarator
<p><!--para 1 -->
<pre>
struct-or-union-specifier:
- struct-or-union identifieropt { struct-declaration-list }
+ struct-or-union identifier<sub>opt</sub> { struct-declaration-list }
struct-or-union identifier
struct-or-union:
struct
struct-declaration:
specifier-qualifier-list struct-declarator-list ;
specifier-qualifier-list:
- type-specifier specifier-qualifier-listopt
- type-qualifier specifier-qualifier-listopt
+ type-specifier specifier-qualifier-list<sub>opt</sub>
+ type-qualifier specifier-qualifier-list<sub>opt</sub>
struct-declarator-list:
struct-declarator
struct-declarator-list , struct-declarator
struct-declarator:
declarator
- declaratoropt : constant-expression</pre>
+ declarator<sub>opt</sub> : constant-expression</pre>
<h6>Constraints</h6>
<p><!--para 2 -->
A structure or union shall not contain a member with incomplete or function type (hence,
<p><!--para 1 -->
<pre>
enum-specifier:
- enum identifieropt { enumerator-list }
- enum identifieropt { enumerator-list , }
+ enum identifier<sub>opt</sub> { enumerator-list }
+ enum identifier<sub>opt</sub> { enumerator-list , }
enum identifier
enumerator-list:
enumerator
<p><!--para 6 -->
A type specifier of the form
<pre>
- struct-or-union identifieropt { struct-declaration-list }</pre>
+ struct-or-union identifier<sub>opt</sub> { struct-declaration-list }</pre>
or
<pre>
enum identifier { enumerator-list }</pre>
<p><!--para 1 -->
<pre>
declarator:
- pointeropt direct-declarator
+ pointer<sub>opt</sub> direct-declarator
direct-declarator:
identifier
( declarator )
- direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
- direct-declarator [ static type-qualifier-listopt assignment-expression ]
+ direct-declarator [ type-qualifier-list<sub>opt</sub> assignment-expression<sub>opt</sub> ]
+ direct-declarator [ static type-qualifier-list<sub>opt</sub> assignment-expression ]
direct-declarator [ type-qualifier-list static assignment-expression ]
- direct-declarator [ type-qualifier-listopt * ]
+ direct-declarator [ type-qualifier-list<sub>opt</sub> * ]
direct-declarator ( parameter-type-list )
- direct-declarator ( identifier-listopt )
+ direct-declarator ( identifier-list<sub>opt</sub> )
pointer:
- * type-qualifier-listopt
- * type-qualifier-listopt pointer
+ * type-qualifier-list<sub>opt</sub>
+ * type-qualifier-list<sub>opt</sub> pointer
type-qualifier-list:
type-qualifier
type-qualifier-list type-qualifier
parameter-list , parameter-declaration
parameter-declaration:
declaration-specifiers declarator
- declaration-specifiers abstract-declaratoropt
+ declaration-specifiers abstract-declarator<sub>opt</sub>
identifier-list:
identifier
identifier-list , identifier</pre>
then ident has the type specified by the declaration ''T D''. Thus, a declarator in
parentheses is identical to the unparenthesized declarator, but the binding of complicated
declarators may be altered by parentheses.
- Implementation limits
+<h6> Implementation limits</h6>
<p><!--para 7 -->
As discussed in <a href="#5.2.4.1">5.2.4.1</a>, an implementation may limit the number of pointer, array, and
function declarators that modify an arithmetic, structure, union, or incomplete type, either
<p><!--para 1 -->
If, in the declaration ''T D1'', D1 has the form
<pre>
- * type-qualifier-listopt D</pre>
+ * type-qualifier-list<sub>opt</sub> D</pre>
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 type-qualifier-list
pointer to T ''. For each type qualifier in the list, ident is a so-qualified pointer.
<p><!--para 3 -->
If, in the declaration ''T D1'', D1 has one of the forms:
<pre>
- D[ type-qualifier-listopt assignment-expressionopt ]
- D[ static type-qualifier-listopt assignment-expression ]
+ D[ type-qualifier-list<sub>opt</sub> assignment-expressionopt ]
+ D[ static type-qualifier-list<sub>opt</sub> assignment-expression ]
D[ type-qualifier-list static assignment-expression ]
- D[ type-qualifier-listopt * ]</pre>
+ D[ type-qualifier-list<sub>opt</sub> * ]</pre>
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 array of T ''.<sup><a href="#note123"><b>123)</b></a></sup>
(See <a href="#6.7.5.3">6.7.5.3</a> for the meaning of the optional type qualifiers and the keyword static.)
or
<!--page 131 -->
<pre>
- D( identifier-listopt )</pre>
+ D( identifier-list<sub>opt</sub> )</pre>
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
T ''.
<p><!--para 1 -->
<pre>
type-name:
- specifier-qualifier-list abstract-declaratoropt
+ specifier-qualifier-list abstract-declarator<sub>opt</sub>
abstract-declarator:
pointer
- pointeropt direct-abstract-declarator
+ pointer<sub>opt</sub> direct-abstract-declarator
direct-abstract-declarator:
( abstract-declarator )
- direct-abstract-declaratoropt [ type-qualifier-listopt
- assignment-expressionopt ]
- direct-abstract-declaratoropt [ static type-qualifier-listopt
+ direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list<sub>opt</sub>
+ assignment-expression<sub>opt</sub> ]
+ direct-abstract-declarator<sub>opt</sub> [ static type-qualifier-list<sub>opt</sub>
assignment-expression ]
- direct-abstract-declaratoropt [ type-qualifier-list static
+ direct-abstract-declarator<sub>opt</sub> [ type-qualifier-list static
assignment-expression ]
- direct-abstract-declaratoropt [ * ]
- direct-abstract-declaratoropt ( parameter-type-listopt )</pre>
+ direct-abstract-declarator<sub>opt</sub> [ * ]
+ direct-abstract-declarator<sub>opt</sub> ( parameter-type-list<sub>opt</sub> )</pre>
<h6>Semantics</h6>
<p><!--para 2 -->
In several contexts, it is necessary to specify a type. This is accomplished using a type
{ initializer-list , }
initializer-list:
designationopt initializer
- initializer-list , designationopt initializer
+ initializer-list , designation<sub>opt</sub> initializer
designation:
designator-list =
designator-list:
<p><!--para 1 -->
<pre>
compound-statement:
- { block-item-listopt }
+ { block-item-list<sub>opt</sub> }
block-item-list:
block-item
block-item-list block-item
<p><!--para 1 -->
<pre>
expression-statement:
- expressionopt ;</pre>
+ expression<sub>opt</sub> ;</pre>
<h6>Semantics</h6>
<p><!--para 2 -->
The expression in an expression statement is evaluated as a void expression for its side
a default label, control jumps to the labeled statement. If no converted case constant
expression matches and there is no default label, no part of the switch body is
executed.
- Implementation limits
+<h6> Implementation limits</h6>
<p><!--para 6 -->
As discussed in <a href="#5.2.4.1">5.2.4.1</a>, the implementation may limit the number of case values in a
switch statement.
iteration-statement:
while ( expression ) statement
do statement while ( expression ) ;
- for ( expressionopt ; expressionopt ; expressionopt ) statement
- for ( declaration expressionopt ; expressionopt ) statement</pre>
+ for ( expression<sub>opt</sub> ; expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement
+ for ( declaration expression<sub>opt</sub> ; expression<sub>opt</sub> ) statement</pre>
<h6>Constraints</h6>
<p><!--para 2 -->
The controlling expression of an iteration statement shall have scalar type.
goto identifier ;
continue ;
break ;
- return expressionopt ;</pre>
+ return expression<sub>opt</sub> ;</pre>
<h6>Semantics</h6>
<p><!--para 2 -->
A jump statement causes an unconditional jump to another place.
<li> The general initialization code is too large to warrant duplication.
<li> The code to determine the next operation is at the head of the loop. (To allow it to be reached by
continue statements, for example.)
+<pre>
/* ... */
goto first_time;
for (;;) {
-<pre>
// determine next operation
/* ... */
if (need to reinitialize) {
continue;
}
// handle other operations
- /* ... */</pre>
- }
+ /* ... */
+ }</pre>
<!--page 150 -->
</ol>
<p><!--para 4 -->
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
- while (/* ... */) { do { for (/* ... */) {
<pre>
+ while (/* ... */) { do { for (/* ... */) {
/* ... */ /* ... */ /* ... */
continue; continue; continue;
- /* ... */ /* ... */ /* ... */</pre>
+ /* ... */ /* ... */ /* ... */
contin: ; contin: ; contin: ;
- } } while (/* ... */); }
+ } } while (/* ... */); }</pre>
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;.<sup><a href="#note138"><b>138)</b></a></sup>
<p><!--para 1 -->
<pre>
function-definition:
- declaration-specifiers declarator declaration-listopt compound-statement
+ declaration-specifiers declarator declaration-list<sub>opt</sub> compound-statement
declaration-list:
declaration
declaration-list declaration</pre>
<!--page 158 -->
<pre>
preprocessing-file:
- groupopt
+ group<sub>opt</sub>
group:
group-part
group group-part
text-line
# non-directive
if-section:
- if-group elif-groupsopt else-groupopt endif-line
+ if-group elif-groups<sub>opt</sub> else-group<sub>opt</sub> endif-line
if-group:
- # if constant-expression new-line groupopt
- # ifdef identifier new-line groupopt
- # ifndef identifier new-line groupopt
+ # if constant-expression new-line group<sub>opt</sub>
+ # ifdef identifier new-line group<sub>opt</sub>
+ # ifndef identifier new-line group<sub>opt</sub>
elif-groups:
elif-group
elif-groups elif-group
elif-group:
- # elif constant-expression new-line groupopt
+ # elif constant-expression new-line group<sub>opt</sub>
else-group:
- # else new-line groupopt
+ # else new-line group<sub>opt</sub>
endif-line:
# endif new-line
control-line:
# include pp-tokens new-line
# define identifier replacement-list new-line
- # define identifier lparen identifier-listopt )
+ # define identifier lparen identifier-list<sub>opt</sub> )
replacement-list new-line
# define identifier lparen ... ) replacement-list new-line
# define identifier lparen identifier-list , ... )
replacement-list new-line
# undef identifier new-line
# line pp-tokens new-line
- # error pp-tokensopt new-line
- # pragma pp-tokensopt new-line
+ # error pp-tokens<sub>opt</sub> new-line
+ # pragma pp-tokens<sub>opt</sub> new-line
# new-line
text-line:
- pp-tokensopt new-line
+ pp-tokens<sub>opt</sub> new-line
non-directive:
pp-tokens new-line
lparen:
a ( character not immediately preceded by white-space
replacement-list:
- pp-tokensopt
+ pp-tokens<sub>opt</sub>
pp-tokens:
preprocessing-token
pp-tokens preprocessing-token
<p><!--para 3 -->
Preprocessing directives of the forms
<pre>
- # if constant-expression new-line groupopt
- # elif constant-expression new-line groupopt</pre>
+ # if constant-expression new-line group<sub>opt</sub>
+ # elif constant-expression new-line group<sub>opt</sub></pre>
check whether the controlling constant expression evaluates to nonzero.
<p><!--para 4 -->
Prior to evaluation, macro invocations in the list of preprocessing tokens that will become
<!--page 161 -->
<pre>
- # ifdef identifier new-line groupopt
- # ifndef identifier new-line groupopt</pre>
+ # ifdef identifier new-line group<sub>opt</sub>
+ # ifndef identifier new-line group<sub>opt</sub></pre>
check whether the identifier is or is not currently defined as a macro name. Their
conditions are equivalent to #if defined identifier and #if !defined identifier
respectively.
</small>
<p><small><a name="note146" href="#note146">146)</a> Thus, the constant expression in the following #if directive and if statement is not guaranteed to
evaluate to the same value in these two contexts.
+<pre>
#if 'z' - 'a' == 25
- if ('z' - 'a' == 25)
+ if ('z' - 'a' == 25)</pre>
</small>
<p><small><a name="note147" href="#note147">147)</a> As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
<p><!--para 10 -->
A preprocessing directive of the form
<pre>
- # define identifier lparen identifier-listopt ) replacement-list new-line
+ # define identifier lparen identifier-list<sub>opt</sub> ) replacement-list new-line
# define identifier lparen ... ) replacement-list new-line
# define identifier lparen identifier-list , ... ) replacement-list new-line</pre>
defines a function-like macro with parameters, whose use is similar syntactically to a
<p><!--para 4 -->
A preprocessing directive of the form
<pre>
- # line digit-sequence "s-char-sequenceopt" new-line</pre>
+ # line digit-sequence "s-char-sequence<sub>opt</sub>" new-line</pre>
sets the presumed line number similarly and changes the presumed name of the source
file to be the contents of the character string literal.
<p><!--para 5 -->
<p><!--para 1 -->
A preprocessing directive of the form
<pre>
- # error pp-tokensopt new-line</pre>
+ # error pp-tokens<sub>opt</sub> new-line</pre>
causes the implementation to produce a diagnostic message that includes the specified
sequence of preprocessing tokens.
<p><!--para 1 -->
A preprocessing directive of the form
<pre>
- # pragma pp-tokensopt new-line</pre>
+ # pragma pp-tokens<sub>opt</sub> new-line</pre>
where the preprocessing token STDC does not immediately follow pragma in the
directive (prior to any macro replacement)<sup><a href="#note152"><b>152)</b></a></sup> causes the implementation to behave in an
implementation-defined manner. The behavior might cause translation to fail or cause the
<h4><a name="6.10.8" href="#6.10.8">6.10.8 Predefined macro names</a></h4>
<p><!--para 1 -->
The following macro names<sup><a href="#note154"><b>154)</b></a></sup> shall be defined by the implementation:
- __DATE__ The date of translation of the preprocessing translation unit: a character
-<pre>
+<dl>
+<dt> __DATE__ <dd>The date of translation of the preprocessing translation unit: a character
string literal of the form "Mmm dd yyyy", where the names of the
months are the same as those generated by the asctime function, and the
first character of dd is a space character if the value is less than 10. If the
date of translation is not available, an implementation-defined valid date
- shall be supplied.</pre>
- __FILE__ The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
- __LINE__ The presumed line number (within the current source file) of the current
-<pre>
- source line (an integer constant).155)</pre>
- __STDC__ The integer constant 1, intended to indicate a conforming implementation.
- __STDC_HOSTED__ The integer constant 1 if the implementation is a hosted
-<pre>
- implementation or the integer constant 0 if it is not.</pre>
- __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
-<pre>
+ shall be supplied.
+<dt> __FILE__ <dd>The presumed name of the current source file (a character string literal).<sup><a href="#note155"><b>155)</b></a></sup>
+<dt> __LINE__ <dd>The presumed line number (within the current source file) of the current
+ source line (an integer constant).<sup><a href="#note155"><b>155)</b></a></sup>
+<dt> __STDC__ <dd>The integer constant 1, intended to indicate a conforming implementation.
+<dt> __STDC_HOSTED__ <dd>The integer constant 1 if the implementation is a hosted
+ implementation or the integer constant 0 if it is not.
+<dt> __STDC_MB_MIGHT_NEQ_WC__ <dd>The integer constant 1, intended to indicate that, in
the encoding for wchar_t, a member of the basic character set need not
have a code value equal to its value when used as the lone character in an
- integer character constant.</pre>
- __STDC_VERSION__ The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
- __TIME__ The time of translation of the preprocessing translation unit: a character
-<pre>
+ integer character constant.
+<dt> __STDC_VERSION__ <dd>The integer constant 199901L.<sup><a href="#note156"><b>156)</b></a></sup>
+<dt> __TIME__ <dd>The time of translation of the preprocessing translation unit: a character
string literal of the form "hh:mm:ss" as in the time generated by the
asctime function. If the time of translation is not available, an
- implementation-defined valid time shall be supplied.</pre>
-
+ implementation-defined valid time shall be supplied.
+</dl>
<!--page 173 -->
<p><!--para 2 -->
The following macro names are conditionally defined by the implementation:
- __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
-<pre>
- specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).</pre>
- __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
-<pre>
+<dl>
+<dt> __STDC_IEC_559__ <dd>The integer constant 1, intended to indicate conformance to the
+ specifications in <a href="#F">annex F</a> (IEC 60559 floating-point arithmetic).
+<dt> __STDC_IEC_559_COMPLEX__ <dd>The integer constant 1, intended to indicate
adherence to the specifications in informative <a href="#G">annex G</a> (IEC 60559
- compatible complex arithmetic).</pre>
- __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
-<p><!--para 3 -->
-<pre>
+ compatible complex arithmetic).
+<dt> __STDC_ISO_10646__ <dd>An integer constant of the form yyyymmL (for example,
199712L). If this symbol is defined, then every character in the Unicode
required set, when stored in an object of type wchar_t, has the same
value as the short identifier of that character. The Unicode required set
consists of all the characters that are defined by ISO/IEC 10646, along with
all amendments and technical corrigenda, as of the specified year and
- month.</pre>
+ month.
+</dl>
+<p><!--para 3 -->
The values of the predefined macros (except for __FILE__ and __LINE__) remain
constant throughout the translation unit.
<p><!--para 4 -->
<h6>footnotes</h6>
<p><small><a name="note166" href="#note166">166)</a> See ''future library directions'' (<a href="#7.26.1">7.26.1</a>).
</small>
-<p><small><a name="note167" href="#note167">167)</a> The imaginary unit is a number i such that i 2 = -1.
+<p><small><a name="note167" href="#note167">167)</a> The imaginary unit is a number i such that i<sup>2</sup> = -1.
</small>
<p><small><a name="note168" href="#note168">168)</a> A specification for imaginary types is in informative <a href="#G">annex G</a>.
</small>
<pre>
(x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
- (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 )
- | x + iy | = (sqrt) x 2 + y 2
- ???????????????</pre>
+ (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u<sup>2</sup> + v<sup>2</sup>)
+ | x + iy | = (sqrt)(x<sup>2</sup> + y<sup>2</sup>)
+</pre>
where the programmer can determine they are safe.
</small>
<pre>
FE_DFL_ENV</pre>
represents the default floating-point environment -- the one installed at program startup
-<ul>
-<li> and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
-</ul>
+ -- and has type ''pointer to const-qualified fenv_t''. It can be used as an argument to
<a href="#7.6"><fenv.h></a> functions that manage the floating-point environment.
<p><!--para 9 -->
Additional implementation-defined environments, with macro definitions beginning with
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
available in the current locale. The members include the following:
- char *decimal_point
-<pre>
- The decimal-point character used to format nonmonetary quantities.</pre>
- char *thousands_sep
-<pre>
+<dl>
+<dt> char *decimal_point
+<dd>
+ The decimal-point character used to format nonmonetary quantities.
+<dt> char *thousands_sep
+<dd>
The character used to separate groups of digits before the decimal-point
- character in formatted nonmonetary quantities.</pre>
- char *grouping
-<pre>
+ character in formatted nonmonetary quantities.
+<dt> char *grouping
+<dd>
A string whose elements indicate the size of each group of digits in
- formatted nonmonetary quantities.</pre>
- char *mon_decimal_point
-<pre>
- The decimal-point used to format monetary quantities.</pre>
- char *mon_thousands_sep
-<pre>
+ formatted nonmonetary quantities.
+<dt> char *mon_decimal_point
+<dd>
+ The decimal-point used to format monetary quantities.
+<dt> char *mon_thousands_sep
+<dd>
The separator for groups of digits before the decimal-point in formatted
- monetary quantities.</pre>
- char *mon_grouping
-<pre>
+ monetary quantities.
+<dt> char *mon_grouping
+<dd>
A string whose elements indicate the size of each group of digits in
- formatted monetary quantities.</pre>
- char *positive_sign
-<pre>
+ formatted monetary quantities.
+<dt> char *positive_sign
+<dd>
The string used to indicate a nonnegative-valued formatted monetary
- quantity.</pre>
- char *negative_sign
-<pre>
- The string used to indicate a negative-valued formatted monetary quantity.</pre>
- char *currency_symbol
-<pre>
- The local currency symbol applicable to the current locale.</pre>
- char frac_digits
-<pre>
+ quantity.
+<dt> char *negative_sign
+<dd>
+ The string used to indicate a negative-valued formatted monetary quantity.
+<dt> char *currency_symbol
+<dd>
+ The local currency symbol applicable to the current locale.
+<dt> char frac_digits
+<dd>
The number of fractional digits (those after the decimal-point) to be
- displayed in a locally formatted monetary quantity.</pre>
- char p_cs_precedes
-<pre>
+ displayed in a locally formatted monetary quantity.
+<dt> char p_cs_precedes
+<dd>
Set to 1 or 0 if the currency_symbol respectively precedes or
- succeeds the value for a nonnegative locally formatted monetary quantity.</pre>
- char n_cs_precedes
+ succeeds the value for a nonnegative locally formatted monetary quantity.
+<dt> char n_cs_precedes
<!--page 220 -->
-<pre>
+<dd>
Set to 1 or 0 if the currency_symbol respectively precedes or
- succeeds the value for a negative locally formatted monetary quantity.</pre>
- char p_sep_by_space
-<pre>
+ succeeds the value for a negative locally formatted monetary quantity.
+<dt> char p_sep_by_space
+<dd>
Set to a value indicating the separation of the currency_symbol, the
sign string, and the value for a nonnegative locally formatted monetary
- quantity.</pre>
- char n_sep_by_space
-<pre>
+ quantity.
+<dt> char n_sep_by_space
+<dd>
Set to a value indicating the separation of the currency_symbol, the
sign string, and the value for a negative locally formatted monetary
- quantity.</pre>
- char p_sign_posn
-<pre>
+ quantity.
+<dt> char p_sign_posn
+<dd>
Set to a value indicating the positioning of the positive_sign for a
- nonnegative locally formatted monetary quantity.</pre>
- char n_sign_posn
-<pre>
+ nonnegative locally formatted monetary quantity.
+<dt> char n_sign_posn
+<dd>
Set to a value indicating the positioning of the negative_sign for a
- negative locally formatted monetary quantity.</pre>
- char *int_curr_symbol
-<pre>
+ negative locally formatted monetary quantity.
+<dt> char *int_curr_symbol
+<dd>
The international currency symbol applicable to the current locale. The
first three characters contain the alphabetic international currency symbol
in accordance with those specified in ISO 4217. The fourth character
(immediately preceding the null character) is the character used to separate
- the international currency symbol from the monetary quantity.</pre>
- char int_frac_digits
-<pre>
+ the international currency symbol from the monetary quantity.
+<dt> char int_frac_digits
+<dd>
The number of fractional digits (those after the decimal-point) to be
- displayed in an internationally formatted monetary quantity.</pre>
- char int_p_cs_precedes
-<pre>
+ displayed in an internationally formatted monetary quantity.
+<dt> char int_p_cs_precedes
+<dd>
Set to 1 or 0 if the int_curr_symbol respectively precedes or
succeeds the value for a nonnegative internationally formatted monetary
- quantity.</pre>
- char int_n_cs_precedes
-<pre>
+ quantity.
+<dt> char int_n_cs_precedes
+<dd>
Set to 1 or 0 if the int_curr_symbol respectively precedes or
succeeds the value for a negative internationally formatted monetary
- quantity.</pre>
- char int_p_sep_by_space
+ quantity.
+<dt> char int_p_sep_by_space
<!--page 221 -->
-<pre>
+<dd>
Set to a value indicating the separation of the int_curr_symbol, the
sign string, and the value for a nonnegative internationally formatted
- monetary quantity.</pre>
- char int_n_sep_by_space
-<pre>
+ monetary quantity.
+<dt> char int_n_sep_by_space
+<dd>
Set to a value indicating the separation of the int_curr_symbol, the
sign string, and the value for a negative internationally formatted monetary
- quantity.</pre>
- char int_p_sign_posn
-<pre>
+ quantity.
+<dt> char int_p_sign_posn
+<dd>
Set to a value indicating the positioning of the positive_sign for a
- nonnegative internationally formatted monetary quantity.</pre>
- char int_n_sign_posn
-<p><!--para 4 -->
-<pre>
+ nonnegative internationally formatted monetary quantity.
+<dt> char int_n_sign_posn
+<dd>
Set to a value indicating the positioning of the negative_sign for a
- negative internationally formatted monetary quantity.</pre>
+ negative internationally formatted monetary quantity.
+</dl>
+<p><!--para 4 -->
The elements of grouping and mon_grouping are interpreted according to the
following:
- CHAR_MAX No further grouping is to be performed.
- 0 The previous element is to be repeatedly used for the remainder of the
-<pre>
- digits.</pre>
- other The integer value is the number of digits that compose the current group.
-<p><!--para 5 -->
-<pre>
+<dl>
+<dt> CHAR_MAX <dd>No further grouping is to be performed.
+<dt> 0 <dd>The previous element is to be repeatedly used for the remainder of the
+ digits.
+<dt> other <dd>The integer value is the number of digits that compose the current group.
The next element is examined to determine the size of the next group of
- digits before the current group.</pre>
+ digits before the current group.
+</dl>
+<p><!--para 5 -->
The values of p_sep_by_space, n_sep_by_space, int_p_sep_by_space,
and int_n_sep_by_space are interpreted according to the following:
- 0 No space separates the currency symbol and value.
- 1 If the currency symbol and sign string are adjacent, a space separates them from the
-<pre>
- value; otherwise, a space separates the currency symbol from the value.</pre>
- 2 If the currency symbol and sign string are adjacent, a space separates them;
-<pre>
- otherwise, a space separates the sign string from the value.</pre>
+<dl>
+<dt> 0 <dd>No space separates the currency symbol and value.
+<dt> 1 <dd>If the currency symbol and sign string are adjacent, a space separates them from the
+ value; otherwise, a space separates the currency symbol from the value.
+<dt> 2 <dd>If the currency symbol and sign string are adjacent, a space separates them;
+ otherwise, a space separates the sign string from the value.
+</dl>
For int_p_sep_by_space and int_n_sep_by_space, the fourth character of
int_curr_symbol is used instead of a space.
<p><!--para 6 -->
The values of p_sign_posn, n_sign_posn, int_p_sign_posn, and
int_n_sign_posn are interpreted according to the following:
- 0 Parentheses surround the quantity and currency symbol.
- 1 The sign string precedes the quantity and currency symbol.
- 2 The sign string succeeds the quantity and currency symbol.
- 3 The sign string immediately precedes the currency symbol.
- 4 The sign string immediately succeeds the currency symbol.
+<dl>
+<dt> 0 <dd>Parentheses surround the quantity and currency symbol.
+<dt> 1 <dd>The sign string precedes the quantity and currency symbol.
+<dt> 2 <dd>The sign string succeeds the quantity and currency symbol.
+<dt> 3 <dd>The sign string immediately precedes the currency symbol.
+<dt> 4 <dd>The sign string immediately succeeds the currency symbol.
+</dl>
<!--page 222 -->
<p><!--para 7 -->
The implementation shall behave as if no library function calls the localeconv
EXAMPLE 1 The following table illustrates rules which may well be used by four countries to format
monetary quantities.
<pre>
- Local format International format</pre>
+ Local format International format
- Country Positive Negative Positive Negative
+ Country Positive Negative Positive Negative
Country1 1.234,56 mk -1.234,56 mk FIM 1.234,56 FIM -1.234,56
Country2 L.1.234 -L.1.234 ITL 1.234 -ITL 1.234
- Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
+ Country3 fl. 1.234,56 fl. -1.234,56 NLG 1.234,56 NLG -1.234,56
Country4 SFrs.1,234.56 SFrs.1,234.56C CHF 1,234.56 CHF 1,234.56C
+</pre>
<p><!--para 10 -->
For these four countries, the respective values for the monetary members of the structure returned by
localeconv could be:
<pre>
- Country1 Country2 Country3 Country4</pre>
+ Country1 Country2 Country3 Country4
mon_decimal_point "," "" "," "."
mon_thousands_sep "." "." "." ","
int_n_sep_by_space 2 1 2 1
int_p_sign_posn 1 1 1 1
int_n_sign_posn 4 1 4 2
+</pre>
<!--page 223 -->
<p><!--para 11 -->
EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members
affect the formatted value.
<pre>
- p_sep_by_space</pre>
-
- p_cs_precedes p_sign_posn 0 1 2
-
-<pre>
- 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
- 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
- 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
- 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
- 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +</pre>
-
-<!--page 224 -->
-<pre>
- 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
- 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
- 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
- 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
- 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25</pre>
+ p_sep_by_space
+ p_cs_precedes p_sign_posn 0 1 2
+
+ 0 0 (<a href="#1.25">1.25</a>$) (<a href="#1.25">1.25</a> $) (<a href="#1.25">1.25</a>$)
+ 1 +1.25$ +1.25 $ + <a href="#1.25">1.25</a>$
+ 2 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
+ 3 <a href="#1.25">1.25</a>+$ <a href="#1.25">1.25</a> +$ <a href="#1.25">1.25</a>+ $
+ 4 <a href="#1.25">1.25</a>$+ <a href="#1.25">1.25</a> $+ <a href="#1.25">1.25</a>$ +
+ 1 0 ($1.25) ($ <a href="#1.25">1.25</a>) ($1.25)
+ 1 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
+ 2 $1.25+ $ <a href="#1.25">1.25</a>+ $1.25 +
+ 3 +$1.25 +$ <a href="#1.25">1.25</a> + $1.25
+ 4 $+1.25 $+ <a href="#1.25">1.25</a> $ +1.25</pre>
+
+<!--page 224 -->
<h3><a name="7.12" href="#7.12">7.12 Mathematics <math.h></a></h3>
<p><!--para 1 -->
The header <a href="#7.12"><math.h></a> declares two types and many mathematical functions and defines
magnitude of x is too large.
<h6>Returns</h6>
<p><!--para 3 -->
- The exp functions return ex .
+ The exp functions return e<sup>x</sup>.
<h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
<h6>Synopsis</h6>
magnitude of x is too large.
<h6>Returns</h6>
<p><!--para 3 -->
- The exp2 functions return 2x .
+ The exp2 functions return 2<sup>x</sup>.
<h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 functions</a></h5>
<h6>Synopsis</h6>
error occurs if x is too large.<sup><a href="#note208"><b>208)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
- The expm1 functions return ex - 1.
+ The expm1 functions return e<sup>x</sup> - 1.
<h6>footnotes</h6>
<p><small><a name="note208" href="#note208">208)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
<p><!--para 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.
+ zero, and value equals x 2<sup>*exp</sup> . If value is zero, both parts of the result are zero.
<h5><a name="7.12.6.5" href="#7.12.6.5">7.12.6.5 The ilogb functions</a></h5>
<h6>Synopsis</h6>
range error may occur.
<h6>Returns</h6>
<p><!--para 3 -->
- The ldexp functions return x x 2exp .
+ The ldexp functions return x 2<sup>exp</sup> .
<h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
<h6>Synopsis</h6>
format. If x is subnormal it is treated as though it were normalized; thus, for positive
finite x,
<pre>
- 1 <= x x FLT_RADIX-logb(x) < FLT_RADIX</pre>
+ 1 <= x FLT_RADIX<sup>-logb(x)</sup> < FLT_RADIX</pre>
A domain error or range error may occur if the argument is zero.
<h6>Returns</h6>
<p><!--para 3 -->
long double scalblnl(long double x, long int n);</pre>
<h6>Description</h6>
<p><!--para 2 -->
- The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not
- normally by computing FLT_RADIXn explicitly. A range error may occur.
+ The scalbn and scalbln functions compute x FLT_RADIX<sup>n</sup> efficiently, not
+ normally by computing FLT_RADIX<sup>n</sup> explicitly. A range error may occur.
<h6>Returns</h6>
<p><!--para 3 -->
- The scalbn and scalbln functions return x x FLT_RADIXn .
+ The scalbn and scalbln functions return x FLT_RADIX<sup>n</sup> .
<h4><a name="7.12.7" href="#7.12.7">7.12.7 Power and absolute-value functions</a></h4>
The cbrt functions compute the real cube root of x.
<h6>Returns</h6>
<p><!--para 3 -->
- The cbrt functions return x1/3 .
+ The cbrt functions return x<sup>1/3</sup>.
<h5><a name="7.12.7.2" href="#7.12.7.2">7.12.7.2 The fabs functions</a></h5>
<h6>Synopsis</h6>
<p><!--para 3 -->
<h6>Returns</h6>
<p><!--para 4 -->
- The hypot functions return (sqrt)x2 + y2 .
-<pre>
- ???
- ???????????????</pre>
+ The hypot functions return (sqrt)(x<sup>2</sup> + y<sup>2</sup>).
<h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
<h6>Synopsis</h6>
is zero and y is less than zero.
<h6>Returns</h6>
<p><!--para 3 -->
- The pow functions return xy .
+ The pow functions return x<sup>y</sup>.
<h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
<h6>Synopsis</h6>
the argument is less than zero.
<h6>Returns</h6>
<p><!--para 3 -->
- The sqrt functions return (sqrt)x.
-<pre>
- ???
- ???</pre>
+ The sqrt functions return (sqrt)(x).
<h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
<p><!--para 2 -->
The erf functions compute the error function of x.
<h6>Returns</h6>
+<p><!--para 3 -->
+ The erf functions return
<pre>
- 2 x
- (integral)</pre>
-
- The erf functions return erf x = e-t dt.
-<pre>
- 2</pre>
-
-
-<pre>
- (sqrt)pi
- ???
- ??? 0</pre>
-
+ 2 x
+ erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
+ (sqrt)(pi) 0 </pre>
<h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
<h6>Synopsis</h6>
The erfc functions compute the complementary error function of x. A range error
occurs if x is too large.
<h6>Returns</h6>
+<p><!--para 3 -->
+ The erfc functions return
<pre>
- 2 (inf)
- (integral)</pre>
-
- The erfc functions return erfc x = 1 - erf x = e-t dt.
-<pre>
- 2</pre>
-
+ 2 (inf)
+ erfc x = 1 - erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
+ (sqrt)(pi) x </pre>
<!--page 243 -->
-<pre>
- (sqrt)pi
- ???
- ??? x</pre>
-
<h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
<h6>Synopsis</h6>
<p><!--para 1 -->
<!--page 244 -->
<h6>Returns</h6>
<p><!--para 3 -->
- The ceil functions return ???x???, expressed as a floating-point number.
+ The ceil functions return [^x^], expressed as a floating-point number.
<h5><a name="7.12.9.2" href="#7.12.9.2">7.12.9.2 The floor functions</a></h5>
<h6>Synopsis</h6>
The floor functions compute the largest integer value not greater than x.
<h6>Returns</h6>
<p><!--para 3 -->
- The floor functions return ???x???, expressed as a floating-point number.
+ The floor functions return [_x_], expressed as a floating-point number.
<h5><a name="7.12.9.3" href="#7.12.9.3">7.12.9.3 The nearbyint functions</a></h5>
<h6>Synopsis</h6>
<p><!--para 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
+ magnitude is congruent modulo 2<sup>n</sup> to the magnitude of the integral quotient of x/y, where
n is an implementation-defined integer greater than or equal to 3.
<h6>Returns</h6>
<p><!--para 3 -->
<p><!--para 2 -->
The fdim functions determine the positive difference between their arguments:
<pre>
- ???x - y if x > y
- ???
- ???+0 if x <= y</pre>
+ {x - y if x > y
+ {
+ {+0 if x <= y</pre>
A range error may occur.
<h6>Returns</h6>
<p><!--para 3 -->
long double z);</pre>
<h6>Description</h6>
<p><!--para 2 -->
- The fma functions compute (x x y) + z, rounded as one ternary operation: they compute
+ The fma functions compute (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.
<h6>Returns</h6>
<p><!--para 3 -->
- The fma functions return (x x y) + z, rounded as one ternary operation.
+ The fma functions return (x y) + z, rounded as one ternary operation.
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.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 4 -->
An invocation of the setjmp macro shall appear only in one of the following contexts:
<ul>
va_list ap;
char *array[MAXARGS];
int ptr_no = 0;
- if (n_ptrs > MAXARGS)
- n_ptrs = MAXARGS;
- va_start(ap, n_ptrs);
- while (ptr_no < n_ptrs)
- array[ptr_no++] = va_arg(ap, char *);
- va_end(ap);
- f2(n_ptrs, array);
+ if (n_ptrs > MAXARGS)
+ n_ptrs = MAXARGS;
+ va_start(ap, n_ptrs);
+ while (ptr_no < n_ptrs)
+ array[ptr_no++] = va_arg(ap, char *);
+ va_end(ap);
+ f2(n_ptrs, array);
}</pre>
Each call to f1 is required to have visible the definition of the function or a declaration such as
<pre>
static type t;</pre>
then the expression &(t.member-designator) evaluates to an address constant. (If the
specified member is a bit-field, the behavior is undefined.)
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 4 -->
The types used for size_t and ptrdiff_t should not have an integer conversion rank
greater than that of signed long int unless the implementation supports objects
<p><!--para 1 -->
<ul>
<li> minimum values of exact-width signed integer types
- INTN_MIN exactly -(2 N -1 )
+<pre>
+ INTN_MIN exactly -(2<sup>N-1</sup>)</pre>
<li> maximum values of exact-width signed integer types
- INTN_MAX exactly 2 N -1 - 1
+<pre>
+ INTN_MAX exactly 2<sup>N-1</sup> - 1</pre>
<li> maximum values of exact-width unsigned integer types
- UINTN_MAX exactly 2 N - 1
+<pre>
+ UINTN_MAX exactly 2<sup>N</sup> - 1</pre>
</ul>
<h5><a name="7.18.2.2" href="#7.18.2.2">7.18.2.2 Limits of minimum-width integer types</a></h5>
<p><!--para 1 -->
<ul>
<li> minimum values of minimum-width signed integer types
- INT_LEASTN_MIN -(2 N -1 - 1)
+<pre>
+ INT_LEASTN_MIN -(2<sup>N-1</sup> - 1)</pre>
<li> maximum values of minimum-width signed integer types
- INT_LEASTN_MAX 2 N -1 - 1
+<pre>
+ INT_LEASTN_MAX 2<sup>N-1</sup> - 1</pre>
<li> maximum values of minimum-width unsigned integer types
- UINT_LEASTN_MAX 2N - 1
+<pre>
+ UINT_LEASTN_MAX 2<sup>N</sup> - 1</pre>
</ul>
<h5><a name="7.18.2.3" href="#7.18.2.3">7.18.2.3 Limits of fastest minimum-width integer types</a></h5>
<p><!--para 1 -->
<ul>
<li> minimum values of fastest minimum-width signed integer types
- INT_FASTN_MIN -(2 N -1 - 1)
+<pre>
+ INT_FASTN_MIN -(2<sup>N-1</sup> - 1)</pre>
<li> maximum values of fastest minimum-width signed integer types
- INT_FASTN_MAX 2 N -1 - 1
+<pre>
+ INT_FASTN_MAX 2<sup>N-1</sup> - 1</pre>
<li> maximum values of fastest minimum-width unsigned integer types
- UINT_FASTN_MAX 2N - 1
+<pre>
+ UINT_FASTN_MAX 2<sup>N</sup> - 1</pre>
</ul>
<h5><a name="7.18.2.4" href="#7.18.2.4">7.18.2.4 Limits of integer types capable of holding object pointers</a></h5>
<ul>
<li> minimum value of pointer-holding signed integer type
<pre>
- INTPTR_MIN -(215 - 1)</pre>
+ INTPTR_MIN -(2<sup>15</sup> - 1)</pre>
<li> maximum value of pointer-holding signed integer type
<!--page 271 -->
<pre>
- INTPTR_MAX 215 - 1</pre>
+ INTPTR_MAX 2<sup>15</sup> - 1</pre>
<li> maximum value of pointer-holding unsigned integer type
- UINTPTR_MAX 216 - 1
+<pre>
+ UINTPTR_MAX 2<sup>16</sup> - 1</pre>
</ul>
<h5><a name="7.18.2.5" href="#7.18.2.5">7.18.2.5 Limits of greatest-width integer types</a></h5>
<p><!--para 1 -->
<ul>
<li> minimum value of greatest-width signed integer type
- INTMAX_MIN -(263 - 1)
+<pre>
+ INTMAX_MIN -(2<sup>63</sup> - 1)</pre>
<li> maximum value of greatest-width signed integer type
- INTMAX_MAX 263 - 1
+<pre>
+ INTMAX_MAX 2<sup>63</sup> - 1</pre>
<li> maximum value of greatest-width unsigned integer type
- UINTMAX_MAX 264 - 1
+<pre>
+ UINTMAX_MAX 2<sup>64</sup> - 1</pre>
</ul>
<h4><a name="7.18.3" href="#7.18.3">7.18.3 Limits of other integer types</a></h4>
actually provides.<sup><a href="#note228"><b>228)</b></a></sup>
<ul>
<li> limits of ptrdiff_t
- PTRDIFF_MIN -65535
- PTRDIFF_MAX +65535
+<pre>
+ PTRDIFF_MIN -65535
+ PTRDIFF_MAX +65535
+</pre>
<li> limits of sig_atomic_t
- SIG_ATOMIC_MIN see below
- SIG_ATOMIC_MAX see below
+<pre>
+ SIG_ATOMIC_MIN see below
+ SIG_ATOMIC_MAX see below
+</pre>
<li> limit of size_t
- SIZE_MAX 65535
+<pre>
+ SIZE_MAX 65535
+</pre>
<li> limits of wchar_t
-
-
<!--page 272 -->
- WCHAR_MIN see below
- WCHAR_MAX see below
+<pre>
+ WCHAR_MIN see below
+ WCHAR_MAX see below
+</pre>
<li> limits of wint_t
- WINT_MIN see below
- WINT_MAX see below
+<pre>
+ WINT_MIN see below
+ WINT_MAX see below
+</pre>
</ul>
<p><!--para 3 -->
If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
value of this mbstate_t object as part of the value of the fpos_t object. A later
successful call to fsetpos using the same stored fpos_t value restores the value of
the associated mbstate_t object as well as the position within the controlled stream.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 7 -->
An implementation shall support text files with lines containing at least 254 characters,
including the terminating new-line character. The value of the macro BUFSIZ shall be at
<!--page 279 -->
<p><!--para 7 -->
At program startup, three text streams are predefined and need not be opened explicitly
-<ul>
-<li> standard input (for reading conventional input), standard output (for writing
-</ul>
+ -- standard input (for reading conventional input), standard output (for writing
conventional output), and standard error (for writing diagnostic output). As initially
opened, the standard error stream is not fully buffered; the standard input and standard
output streams are fully buffered if and only if the stream can be determined not to refer
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
occurs.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 15 -->
The value of FOPEN_MAX shall be at least eight, including the three standard text
streams.
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
removed is implementation-defined. The file is opened for update with "wb+" mode.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 3 -->
It should be possible to open at least TMP_MAX temporary files during the lifetime of the
program (this limit may be shared with tmpnam) and there should be no limit on the
function may modify the same object). If the argument is not a null pointer, it is assumed
to point to an array of at least L_tmpnam chars; the tmpnam function writes its result
in that array and returns the argument as its value.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 6 -->
The value of the macro TMP_MAX shall be at least 25.
<p><!--para 3 -->
The argument mode points to a string. If the string is one of the following, the file is
open in the indicated mode. Otherwise, the behavior is undefined.<sup><a href="#note237"><b>237)</b></a></sup>
- r open text file for reading
- w truncate to zero length or create text file for writing
- a append; open or create text file for writing at end-of-file
- rb open binary file for reading
- wb truncate to zero length or create binary file for writing
- ab append; open or create binary file for writing at end-of-file
- r+ open text file for update (reading and writing)
- w+ truncate to zero length or create text file for update
- a+ append; open or create text file for update, writing at end-of-file
-
-
-
+<dl>
+<dt> r <dd>open text file for reading
+<dt> w <dd>truncate to zero length or create text file for writing
+<dt> a <dd>append; open or create text file for writing at end-of-file
+<dt> rb <dd>open binary file for reading
+<dt> wb <dd>truncate to zero length or create binary file for writing
+<dt> ab <dd><dd>append; open or create binary file for writing at end-of-file
+<dt> r+ <dd>open text file for update (reading and writing)
+<dt> w+ <dd>truncate to zero length or create text file for update
+<dt> a+ <dd>append; open or create text file for update, writing at end-of-file
<!--page 284 -->
- 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
- a+b or ab+ append; open or create binary file for update, writing at end-of-file
+<dt> r+b or rb+ <dd>open binary file for update (reading and writing)
+<dt> w+b or wb+ <dd>truncate to zero length or create binary file for update
+<dt> a+b or ab+ <dd>append; open or create binary file for update, writing at end-of-file
+</dl>
<p><!--para 4 -->
Opening a file with read mode ('r' as the first character in the mode argument) fails if
the file does not exist or cannot be read.
precision were omitted.
<p><!--para 6 -->
The flag characters and their meanings are:
- - The result of the conversion is left-justified within the field. (It is right-justified if
-<pre>
- this flag is not specified.)</pre>
- + The result of a signed conversion always begins with a plus or minus sign. (It
-<pre>
- begins with a sign only when a negative value is converted if this flag is not</pre>
-
-
-
+<dl>
+<dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
+ this flag is not specified.)
+<dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
+ begins with a sign only when a negative value is converted if this flag is not
<!--page 288 -->
-<pre>
- specified.)<sup><a href="#note242"><b>242)</b></a></sup></pre>
- space If the first character of a signed conversion is not a sign, or if a signed conversion
-<pre>
+ specified.)<sup><a href="#note242"><b>242)</b></a></sup>
+<dt> space<dd> If the first character of a signed conversion is not a sign, or if a signed conversion
results in no characters, a space is prefixed to the result. If the space and + flags
- both appear, the space flag is ignored.</pre>
- # The result is converted to an ''alternative form''. For o conversion, it increases
-<pre>
+ both appear, the space flag is ignored.
+<dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
the precision, if and only if necessary, to force the first digit of the result to be a
zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
contains a decimal-point character, even if no digits follow it. (Normally, a
decimal-point character appears in the result of these conversions only if a digit
follows it.) For g and G conversions, trailing zeros are not removed from the
- result. For other conversions, the behavior is undefined.</pre>
- 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
-<p><!--para 7 -->
-<pre>
+ result. For other conversions, the behavior is undefined.
+<dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
(following any indication of sign or base) are used to pad to the field width rather
than performing space padding, except when converting an infinity or NaN. If the
0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
conversions, if a precision is specified, the 0 flag is ignored. For other
- conversions, the behavior is undefined.</pre>
+ conversions, the behavior is undefined.
+</dl>
+<p><!--para 7 -->
The length modifiers and their meanings are:
- hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+<dl>
+<dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
signed char or unsigned char argument (the argument will have
been promoted according to the integer promotions, but its value shall be
converted to signed char or unsigned char before printing); or that
a following n conversion specifier applies to a pointer to a signed char
- argument.</pre>
- h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ argument.
+<dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
short int or unsigned short int argument (the argument will
have been promoted according to the integer promotions, but its value shall
be converted to short int or unsigned short int before printing);
or that a following n conversion specifier applies to a pointer to a short
- int argument.</pre>
- l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ int argument.
+<dt> l (ell) <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
long int or unsigned long int argument; that a following n
- conversion specifier applies to a pointer to a long int argument; that a</pre>
-
+ conversion specifier applies to a pointer to a long int argument; that a
<!--page 289 -->
-<pre>
following c conversion specifier applies to a wint_t argument; that a
following s conversion specifier applies to a pointer to a wchar_t
argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
- specifier.</pre>
- ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ specifier.
+<dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
long long int or unsigned long long int argument; or that a
following n conversion specifier applies to a pointer to a long long int
- argument.</pre>
- j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
-<pre>
+ argument.
+<dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
an intmax_t or uintmax_t argument; or that a following n conversion
- specifier applies to a pointer to an intmax_t argument.</pre>
- z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ specifier applies to a pointer to an intmax_t argument.
+<dt> z <dd> 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
following n conversion specifier applies to a pointer to a signed integer type
- corresponding to size_t argument.</pre>
- t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ corresponding to size_t argument.
+<dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
ptrdiff_t or the corresponding unsigned integer type argument; or that a
following n conversion specifier applies to a pointer to a ptrdiff_t
- argument.</pre>
- L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
-<pre>
- applies to a long double argument.</pre>
- If a length modifier appears with any conversion specifier other than as specified above,
+ argument.
+<dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
+ applies to a long double argument.
+</dl>
+If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><!--para 8 -->
The conversion specifiers and their meanings are:
- d,i The int argument is converted to signed decimal in the style [-]dddd. The
-<pre>
+<dl>
+<dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
precision specifies the minimum number of digits to appear; if the value
being converted can be represented in fewer digits, it is expanded with
leading zeros. The default precision is 1. The result of converting a zero
- value with a precision of zero is no characters.</pre>
- o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
+ value with a precision of zero is no characters.
+<dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
<!--page 290 -->
-<pre>
decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
letters abcdef are used for x conversion and the letters ABCDEF for X
conversion. The precision specifies the minimum number of digits to appear;
if the value being converted can be represented in fewer digits, it is expanded
with leading zeros. The default precision is 1. The result of converting a
- zero value with a precision of zero is no characters.</pre>
- f,F A double argument representing a floating-point number is converted to
-<pre>
+ zero value with a precision of zero is no characters.
+<dt> f,F <dd> A double argument representing a floating-point number is converted to
decimal notation in the style [-]ddd.ddd, where the number of digits after
the decimal-point character is equal to the precision specification. If the
precision is missing, it is taken as 6; if the precision is zero and the # flag is
[-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
any n-char-sequence, is implementation-defined. The F conversion specifier
produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
- respectively.<sup><a href="#note243"><b>243)</b></a></sup></pre>
- e,E A double argument representing a floating-point number is converted in the
-<pre>
+ respectively.<sup><a href="#note243"><b>243)</b></a></sup>
+<dt> e,E <dd> A double argument representing a floating-point number is converted in the
style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
argument is nonzero) before the decimal-point character and the number of
digits after it is equal to the precision; if the precision is missing, it is taken as
and only as many more digits as necessary to represent the exponent. If the
value is zero, the exponent is zero.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- g,G A double argument representing a floating-point number is converted in
-<pre>
+ of an f or F conversion specifier.
+<dt> g,G <dd> A double argument representing a floating-point number is converted in
style f or e (or in style F or E in the case of a G conversion specifier),
depending on the value converted and the precision. Let P equal the
precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
Then, if a conversion with style E would have an exponent of X :
- -- if P > X >= -4, the conversion is with style f (or F) and precision
+ <ul>
+ <li> if P > X >= -4, the conversion is with style f (or F) and precision
P - (X + 1).
- -- otherwise, the conversion is with style e (or E) and precision P - 1.
- Finally, unless the # flag is used, any trailing zeros are removed from the</pre>
-
+ <li> otherwise, the conversion is with style e (or E) and precision P - 1.
+ </ul>
+ Finally, unless the # flag is used, any trailing zeros are removed from the
<!--page 291 -->
-<pre>
fractional portion of the result and the decimal-point character is removed if
there is no fractional portion remaining.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- a,A A double argument representing a floating-point number is converted in the
-<pre>
+ of an f or F conversion specifier.
+<dt> a,A <dd> A double argument representing a floating-point number is converted in the
style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
nonzero if the argument is a normalized floating-point number and is
otherwise unspecified) before the decimal-point character<sup><a href="#note244"><b>244)</b></a></sup> and the number
least one digit, and only as many more digits as necessary to represent the
decimal exponent of 2. If the value is zero, the exponent is zero.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- c If no l length modifier is present, the int argument is converted to an
-<pre>
+ of an f or F conversion specifier.
+<dt> c <dd> If no l length modifier is present, the int argument is converted to an
unsigned char, and the resulting character is written.
If an l length modifier is present, the wint_t argument is converted as if by
an ls conversion specification with no precision and an argument that points
to the initial element of a two-element array of wchar_t, the first element
containing the wint_t argument to the lc conversion specification and the
- second a null wide character.</pre>
- s If no l length modifier is present, the argument shall be a pointer to the initial
-<pre>
- element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are</pre>
-
-
+ second a null wide character.
+<dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
+ element of an array of character type.<sup><a href="#note246"><b>246)</b></a></sup> Characters from the array are
<!--page 292 -->
-<pre>
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
precision is not specified or is greater than the size of the array, the array shall
written (including shift sequences, if any), and the array shall contain a null
wide character if, to equal the multibyte character sequence length given by
the precision, the function would need to access a wide character one past the
- end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup></pre>
- p The argument shall be a pointer to void. The value of the pointer is
-<pre>
+ end of the array. In no case is a partial multibyte character written.<sup><a href="#note247"><b>247)</b></a></sup>
+<dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
converted to a sequence of printing characters, in an implementation-defined
- manner.</pre>
- n The argument shall be a pointer to signed integer into which is written the
-<pre>
+ manner.
+<dt> n <dd> The argument shall be a pointer to signed integer into which is written the
number of characters written to the output stream so far by this call to
fprintf. No argument is converted, but one is consumed. If the conversion
specification includes any flags, a field width, or a precision, the behavior is
- undefined.</pre>
- % A % character is written. No argument is converted. The complete
+ undefined.
+<dt> % <dd> A % character is written. No argument is converted. The complete
+ conversion specification shall be %%.
+</dl>
<p><!--para 9 -->
-<pre>
- conversion specification shall be %%.</pre>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note248"><b>248)</b></a></sup> If any argument is
not the correct type for the corresponding conversion specification, the behavior is
undefined.
<p><!--para 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.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 12 -->
For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
representable in the given precision, the result should be one of the two adjacent numbers
<p><!--para 14 -->
The fprintf function returns the number of characters transmitted, or a negative value
if an output or encoding error occurred.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 15 -->
The number of characters that can be produced by any single conversion shall be at least
4095.
<p><small><a name="note244" href="#note244">244)</a> Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so
that subsequent digits align to nibble (4-bit) boundaries.
</small>
-<p><small><a name="note245" href="#note245">245)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is
+<p><small><a name="note245" href="#note245">245)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> > b n where b is
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point character.
in the object, the behavior is undefined.
<p><!--para 11 -->
The length modifiers and their meanings are:
- hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
- to an argument with type pointer to signed char or unsigned char.</pre>
- h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<dl>
+<dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
+ to an argument with type pointer to signed char or unsigned char.
+<dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to short int or unsigned short
- int.</pre>
- l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ int.
+<dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to long int or unsigned long
int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
an argument with type pointer to double; or that a following c, s, or [
- conversion specifier applies to an argument with type pointer to wchar_t.</pre>
- ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ conversion specifier applies to an argument with type pointer to wchar_t.
+<dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to long long int or unsigned
- long long int.</pre>
- j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
- to an argument with type pointer to intmax_t or uintmax_t.</pre>
- z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ long long int.
+<dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
+ to an argument with type pointer to intmax_t or uintmax_t.
+<dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to size_t or the corresponding signed
- integer type.</pre>
- t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ integer type.
+<dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to ptrdiff_t or the corresponding
- unsigned integer type.</pre>
- L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
-<pre>
- applies to an argument with type pointer to long double.</pre>
+ unsigned integer type.
+<dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
+ applies to an argument with type pointer to long double.
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><!--para 12 -->
The conversion specifiers and their meanings are:
- d Matches an optionally signed decimal integer, whose format is the same as
-<pre>
+<dl>
+<dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
expected for the subject sequence of the strtol function with the value 10
for the base argument. The corresponding argument shall be a pointer to
- signed integer.</pre>
- i Matches an optionally signed integer, whose format is the same as expected
+ signed integer.
+<dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
<!--page 297 -->
-<pre>
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.</pre>
- o Matches an optionally signed octal integer, whose format is the same as
-<pre>
+ integer.
+<dt> o <dd> 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
for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- u Matches an optionally signed decimal integer, whose format is the same as
-<pre>
+ unsigned integer.
+<dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
expected for the subject sequence of the strtoul function with the value 10
for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- x Matches an optionally signed hexadecimal integer, whose format is the same
-<pre>
+ unsigned integer.
+<dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
as expected for the subject sequence of the strtoul function with the value
16 for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
-<pre>
+ unsigned integer.
+<dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
format is the same as expected for the subject sequence of the strtod
- function. The corresponding argument shall be a pointer to floating.</pre>
- c Matches a sequence of characters of exactly the number specified by the field
-<pre>
+ function. The corresponding argument shall be a pointer to floating.
+<dt> c <dd> Matches a sequence of characters of exactly the number specified by the field
width (1 if no field width is present in the directive).<sup><a href="#note252"><b>252)</b></a></sup>
If no l length modifier is present, the corresponding argument shall be a
pointer to the initial element of a character array large enough to accept the
initialized to zero before the first multibyte character is converted. The
corresponding argument shall be a pointer to the initial element of an array of
wchar_t large enough to accept the resulting sequence of wide characters.
- No null wide character is added.</pre>
- s Matches a sequence of non-white-space characters.252)
-<pre>
+ No null wide character is added.
+<dt> s <dd> Matches a sequence of non-white-space characters.<sup><a href="#note252"><b>252)</b></a></sup>
If no l length modifier is present, the corresponding argument shall be a
pointer to the initial element of a character array large enough to accept the
sequence and a terminating null character, which will be added automatically.
- If an l length modifier is present, the input shall be a sequence of multibyte</pre>
-
-
+ If an l length modifier is present, the input shall be a sequence of multibyte
<!--page 298 -->
-<pre>
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
the conversion state described by an mbstate_t object initialized to zero
before the first multibyte character is converted. The corresponding argument
shall be a pointer to the initial element of an array of wchar_t large enough
to accept the sequence and the terminating null wide character, which will be
- added automatically.</pre>
- [ Matches a nonempty sequence of characters from a set of expected characters
-<pre>
- (the scanset).252)
+ added automatically.
+<dt> [ <dd> Matches a nonempty sequence of characters from a set of expected characters
+ (the scanset).<sup><a href="#note252"><b>252)</b></a></sup>
If no l length modifier is present, the corresponding argument shall be a
pointer to the initial element of a character array large enough to accept the
sequence and a terminating null character, which will be added automatically.
the first following right bracket character is the one that ends the
specification. If a - character is in the scanlist and is not the first, nor the
second where the first character is a ^, nor the last character, the behavior is
- implementation-defined.</pre>
- p Matches an implementation-defined set of sequences, which should be the
+ implementation-defined.
+<dt> p <dd> Matches an implementation-defined set of sequences, which should be the
<!--page 299 -->
-<pre>
same as the set of sequences that may be produced by the %p conversion of
the fprintf function. The corresponding argument shall be a pointer to a
pointer to void. The input item is converted to a pointer value in an
implementation-defined manner. If the input item is a value converted earlier
during the same program execution, the pointer that results shall compare
- equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
- n No input is consumed. The corresponding argument shall be a pointer to
-<pre>
+ equal to that value; otherwise the behavior of the %p conversion is undefined.
+<dt> n <dd> 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
the input stream so far by this call to the fscanf function. Execution of a
%n directive does not increment the assignment count returned at the
completion of execution of the fscanf function. No argument is converted,
but one is consumed. If the conversion specification includes an assignment-
- suppressing character or a field width, the behavior is undefined.</pre>
- % Matches a single % character; no conversion or assignment occurs. The
+ suppressing character or a field width, the behavior is undefined.
+<dt> % <dd> Matches a single % character; no conversion or assignment occurs. The
+ complete conversion specification shall be %%.
+</dl>
<p><!--para 13 -->
-<pre>
- complete conversion specification shall be %%.</pre>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note253"><b>253)</b></a></sup>
<p><!--para 14 -->
The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
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)
+ va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vfscanf function returns the value of the macro EOF if an input failure occurs
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)
+ va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vprintf function returns the number of characters transmitted, or a negative value
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)
+ macro.<sup><a href="#note254"><b>254)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vscanf function returns the value of the macro EOF if an input failure occurs
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
+ va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
undefined.
<h6>Returns</h6>
<p><!--para 3 -->
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
+ va_end macro.<sup><a href="#note254"><b>254)</b></a></sup> If copying takes place between objects that overlap, the behavior is
undefined.
<h6>Returns</h6>
<p><!--para 3 -->
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)
+ va_end macro.<sup><a href="#note254"><b>254)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vsscanf function returns the value of the macro EOF if an input failure occurs
<li> a 0x or 0X, then a nonempty sequence of hexadecimal digits optionally containing a
decimal-point character, then an optional binary exponent part as defined in <a href="#6.4.4.2">6.4.4.2</a>;
<li> INF or INFINITY, ignoring case
-<li> NAN or NAN(n-char-sequenceopt), ignoring case in the NAN part, where:
+<li> NAN or NAN(n-char-sequence<sub>opt</sub>), ignoring case in the NAN part, where:
<pre>
n-char-sequence:
digit
the subject sequence begins with a minus sign, the sequence is interpreted as negated.<sup><a href="#note258"><b>258)</b></a></sup>
A character sequence INF or INFINITY is interpreted as an infinity, if representable in
the return type, else like a floating constant that is too large for the range of the return
- type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
+ type. A character sequence NAN or NAN(n-char-sequence<sub>opt</sub>), is interpreted as a quiet
NaN, if supported in the return type, else like a subject sequence part that does not have
the expected form; the meaning of the n-char sequences is implementation-defined.<sup><a href="#note259"><b>259)</b></a></sup> A
pointer to the final string is stored in the object pointed to by endptr, provided that
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.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 8 -->
If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
the result is not exactly representable, the result should be one of the two numbers in the
<h6>Returns</h6>
<p><!--para 4 -->
The rand function returns a pseudo-random integer.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 5 -->
The value of the RAND_MAX macro shall be at least 32767.
<p><!--para 2 -->
The atexit function registers the function pointed to by func, to be called without
arguments at normal program termination.
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 3 -->
The implementation shall support the registration of at least 32 functions.
<h6>Returns</h6>
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
- any.267)
+ any.<sup><a href="#note267"><b>267)</b></a></sup>
<!--page 337 -->
<h3><a name="7.21" href="#7.21">7.21 String handling <string.h></a></h3>
<pre>
<a href="#7.12"><math.h></a> <a href="#7.3"><complex.h></a> type-generic
function function macro
+
acos cacos acos
asin casin asin
atan catan atan
functions invoked by use of type-generic macros are shown in the following table:
<!--page 350 -->
<pre>
- macro use invokes
+ macro use invokes
+
exp(n) exp(n), the function
acosh(f) acoshf(f)
sin(d) sin(d), the function
<pre>
Sun Sep 16 01:03:52 1973\n\0</pre>
using the equivalent of the following algorithm.
+<pre>
char *asctime(const struct tm *timeptr)
{
-<pre>
static const char wday_name[7][3] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
timeptr->tm_mday, timeptr->tm_hour,
timeptr->tm_min, timeptr->tm_sec,
1900 + timeptr->tm_year);
- return result;</pre>
+ return result;
}
+</pre>
<h6>Returns</h6>
<p><!--para 3 -->
The asctime function returns a pointer to the string.
of the current locale and by the values of zero or more members of the broken-down time
structure pointed to by timeptr, as specified in brackets in the description. If any of
the specified values is outside the normal range, the characters stored are unspecified.
- %a is replaced by the locale's abbreviated weekday name. [tm_wday]
- %A is replaced by the locale's full weekday name. [tm_wday]
- %b is replaced by the locale's abbreviated month name. [tm_mon]
- %B is replaced by the locale's full month name. [tm_mon]
- %c is replaced by the locale's appropriate date and time representation. [all specified
-<pre>
- in <a href="#7.23.1">7.23.1</a>]</pre>
- %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
-<pre>
- number (00-99). [tm_year]</pre>
- %d is replaced by the day of the month as a decimal number (01-31). [tm_mday]
- %D is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
- %e is replaced by the day of the month as a decimal number (1-31); a single digit is
-<pre>
- preceded by a space. [tm_mday]</pre>
- %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
-<pre>
- tm_mday]</pre>
- %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
-<pre>
- number (00-99). [tm_year, tm_wday, tm_yday]</pre>
- %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
-<pre>
- [tm_year, tm_wday, tm_yday]</pre>
- %h is equivalent to ''%b''. [tm_mon]
- %H is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
- %I is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
- %j is replaced by the day of the year as a decimal number (001-366). [tm_yday]
- %m is replaced by the month as a decimal number (01-12). [tm_mon]
- %M is replaced by the minute as a decimal number (00-59). [tm_min]
- %n is replaced by a new-line character.
- %p is replaced by the locale's equivalent of the AM/PM designations associated with a
-<pre>
- 12-hour clock. [tm_hour]</pre>
- %r is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
- %R is equivalent to ''%H:%M''. [tm_hour, tm_min]
- %S is replaced by the second as a decimal number (00-60). [tm_sec]
- %t is replaced by a horizontal-tab character.
- %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
+<dl>
+<dt> %a <dd> is replaced by the locale's abbreviated weekday name. [tm_wday]
+<dt> %A <dd> is replaced by the locale's full weekday name. [tm_wday]
+<dt> %b <dd> is replaced by the locale's abbreviated month name. [tm_mon]
+<dt> %B <dd> is replaced by the locale's full month name. [tm_mon]
+<dt> %c <dd> is replaced by the locale's appropriate date and time representation. [all specified
+ in <a href="#7.23.1">7.23.1</a>]
+<dt> %C <dd> is replaced by the year divided by 100 and truncated to an integer, as a decimal
+ number (00-99). [tm_year]
+<dt> %d <dd> is replaced by the day of the month as a decimal number (01-31). [tm_mday]
+<dt> %D <dd> is equivalent to ''%m/%d/%y''. [tm_mon, tm_mday, tm_year]
+<dt> %e <dd> is replaced by the day of the month as a decimal number (1-31); a single digit is
+ preceded by a space. [tm_mday]
+<dt> %F <dd> is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
+ tm_mday]
+<dt> %g <dd> is replaced by the last 2 digits of the week-based year (see below) as a decimal
+ number (00-99). [tm_year, tm_wday, tm_yday]
+<dt> %G <dd> is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
+ [tm_year, tm_wday, tm_yday]
+<dt> %h <dd> is equivalent to ''%b''. [tm_mon]
+<dt> %H <dd> is replaced by the hour (24-hour clock) as a decimal number (00-23). [tm_hour]
+<dt> %I <dd> is replaced by the hour (12-hour clock) as a decimal number (01-12). [tm_hour]
+<dt> %j <dd> is replaced by the day of the year as a decimal number (001-366). [tm_yday]
+<dt> %m <dd> is replaced by the month as a decimal number (01-12). [tm_mon]
+<dt> %M <dd> is replaced by the minute as a decimal number (00-59). [tm_min]
+<dt> %n <dd> is replaced by a new-line character.
+<dt> %p <dd> is replaced by the locale's equivalent of the AM/PM designations associated with a
+ 12-hour clock. [tm_hour]
+<dt> %r <dd> is replaced by the locale's 12-hour clock time. [tm_hour, tm_min, tm_sec]
+<dt> %R <dd> is equivalent to ''%H:%M''. [tm_hour, tm_min]
+<dt> %S <dd> is replaced by the second as a decimal number (00-60). [tm_sec]
+<dt> %t <dd> is replaced by a horizontal-tab character.
+<dt> %T <dd> is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min,
<!--page 357 -->
-<pre>
- tm_sec]</pre>
- %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
-<pre>
- is 1. [tm_wday]</pre>
- %U is replaced by the week number of the year (the first Sunday as the first day of week
-<pre>
- 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
- %V is replaced by the ISO 8601 week number (see below) as a decimal number
-<pre>
- (01-53). [tm_year, tm_wday, tm_yday]</pre>
- %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
-<pre>
- [tm_wday]</pre>
- %W is replaced by the week number of the year (the first Monday as the first day of
-<pre>
- week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]</pre>
- %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
- %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
- %y is replaced by the last 2 digits of the year as a decimal number (00-99).
-<pre>
- [tm_year]</pre>
- %Y is replaced by the year as a decimal number (e.g., 1997). [tm_year]
- %z is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
-<pre>
+ tm_sec]
+<dt> %u <dd>is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
+ is 1. [tm_wday]
+<dt> %U <dd> is replaced by the week number of the year (the first Sunday as the first day of week
+ 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
+<dt> %V <dd> is replaced by the ISO 8601 week number (see below) as a decimal number
+ (01-53). [tm_year, tm_wday, tm_yday]
+<dt> %w <dd> is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
+ [tm_wday]
+<dt> %W <dd> is replaced by the week number of the year (the first Monday as the first day of
+ week 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday]
+<dt> %x <dd> is replaced by the locale's appropriate date representation. [all specified in <a href="#7.23.1">7.23.1</a>]
+<dt> %X <dd> is replaced by the locale's appropriate time representation. [all specified in <a href="#7.23.1">7.23.1</a>]
+<dt> %y <dd> is replaced by the last 2 digits of the year as a decimal number (00-99).
+ [tm_year]
+<dt> %Y <dd> is replaced by the year as a decimal number (e.g., 1997). [tm_year]
+<dt> %z <dd> is replaced by the offset from UTC in the ISO 8601 format ''-0430'' (meaning 4
hours 30 minutes behind UTC, west of Greenwich), or by no characters if no time
- zone is determinable. [tm_isdst]</pre>
- %Z is replaced by the locale's time zone name or abbreviation, or by no characters if no
-<pre>
- time zone is determinable. [tm_isdst]</pre>
- %% is replaced by %.
+ zone is determinable. [tm_isdst]
+<dt> %Z <dd> is replaced by the locale's time zone name or abbreviation, or by no characters if no
+ time zone is determinable. [tm_isdst]
+<dt> %% <dd> is replaced by %.
+</dl>
<p><!--para 4 -->
Some conversion specifiers can be modified by the inclusion of an E or O modifier
character to indicate an alternative format or specification. If the alternative format or
specification does not exist for the current locale, the modifier is ignored.
- %Ec is replaced by the locale's alternative date and time representation.
- %EC is replaced by the name of the base year (period) in the locale's alternative
-<pre>
- representation.</pre>
- %Ex is replaced by the locale's alternative date representation.
- %EX is replaced by the locale's alternative time representation.
- %Ey is replaced by the offset from %EC (year only) in the locale's alternative
-<pre>
- representation.</pre>
- %EY is replaced by the locale's full alternative year representation.
- %Od is replaced by the day of the month, using the locale's alternative numeric symbols
-<pre>
+<dl>
+<dt> %Ec <dd> is replaced by the locale's alternative date and time representation.
+<dt> %EC <dd>is replaced by the name of the base year (period) in the locale's alternative
+ representation.
+<dt> %Ex <dd>is replaced by the locale's alternative date representation.
+<dt> %EX <dd>is replaced by the locale's alternative time representation.
+<dt> %Ey <dd>is replaced by the offset from %EC (year only) in the locale's alternative
+ representation.
+<dt> %EY <dd>is replaced by the locale's full alternative year representation.
+<dt> %Od <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
(filled as needed with leading zeros, or with leading spaces if there is no alternative
- symbol for zero).</pre>
- %Oe is replaced by the day of the month, using the locale's alternative numeric symbols
-<pre>
- (filled as needed with leading spaces).</pre>
- %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
+ symbol for zero).
+<dt> %Oe <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
+ (filled as needed with leading spaces).
+<dt> %OH <dd>is replaced by the hour (24-hour clock), using the locale's alternative numeric
<!--page 358 -->
-<pre>
- symbols.</pre>
- %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
-<pre>
- symbols.</pre>
- %Om is replaced by the month, using the locale's alternative numeric symbols.
- %OM is replaced by the minutes, using the locale's alternative numeric symbols.
- %OS is replaced by the seconds, using the locale's alternative numeric symbols.
- %Ou is replaced by the ISO 8601 weekday as a number in the locale's alternative
-<pre>
- representation, where Monday is 1.</pre>
- %OU is replaced by the week number, using the locale's alternative numeric symbols.
- %OV is replaced by the ISO 8601 week number, using the locale's alternative numeric
-<pre>
- symbols.</pre>
- %Ow is replaced by the weekday as a number, using the locale's alternative numeric
-<pre>
- symbols.</pre>
- %OW is replaced by the week number of the year, using the locale's alternative numeric
-<pre>
- symbols.</pre>
- %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
+ symbols.
+<dt> %OI <dd>is replaced by the hour (12-hour clock), using the locale's alternative numeric
+ symbols.
+<dt> %Om <dd>is replaced by the month, using the locale's alternative numeric symbols.
+<dt> %OM <dd>is replaced by the minutes, using the locale's alternative numeric symbols.
+<dt> %OS <dd>is replaced by the seconds, using the locale's alternative numeric symbols.
+<dt> %Ou <dd>is replaced by the ISO 8601 weekday as a number in the locale's alternative
+ representation, where Monday is 1.
+<dt> %OU <dd>is replaced by the week number, using the locale's alternative numeric symbols.
+<dt> %OV <dd>is replaced by the ISO 8601 week number, using the locale's alternative numeric
+ symbols.
+<dt> %Ow <dd>is replaced by the weekday as a number, using the locale's alternative numeric
+ symbols.
+<dt> %OW <dd>is replaced by the week number of the year, using the locale's alternative numeric
+ symbols.
+<dt> %Oy <dd>is replaced by the last 2 digits of the year, using the locale's alternative numeric
+ symbols.
+</dl>
<p><!--para 5 -->
-<pre>
- symbols.</pre>
%g, %G, and %V give values according to the ISO 8601 week-based year. In this system,
weeks begin on a Monday and week 1 of the year is the week that includes January 4th,
which is also the week that includes the first Thursday of the year, and is also the first
<p><!--para 7 -->
In the "C" locale, the E and O modifiers are ignored and the replacement strings for the
following specifiers are:
- %a the first three characters of %A.
- %A one of ''Sunday'', ''Monday'', ... , ''Saturday''.
- %b the first three characters of %B.
- %B one of ''January'', ''February'', ... , ''December''.
- %c equivalent to ''%a %b %e %T %Y''.
- %p one of ''AM'' or ''PM''.
- %r equivalent to ''%I:%M:%S %p''.
- %x equivalent to ''%m/%d/%y''.
- %X equivalent to %T.
- %Z implementation-defined.
+<dl>
+<dt> %a <dd> the first three characters of %A.
+<dt> %A <dd> one of ''Sunday'', ''Monday'', ... , ''Saturday''.
+<dt> %b <dd> the first three characters of %B.
+<dt> %B <dd> one of ''January'', ''February'', ... , ''December''.
+<dt> %c <dd> equivalent to ''%a %b %e %T %Y''.
+<dt> %p <dd> one of ''AM'' or ''PM''.
+<dt> %r <dd> equivalent to ''%I:%M:%S %p''.
+<dt> %x <dd> equivalent to ''%m/%d/%y''.
+<dt> %X <dd> equivalent to %T.
+<dt> %Z <dd> implementation-defined.
+</dl>
<!--page 359 -->
<h6>Returns</h6>
<p><!--para 8 -->
precision were omitted.
<p><!--para 6 -->
The flag wide characters and their meanings are:
- - The result of the conversion is left-justified within the field. (It is right-justified if
-<pre>
- this flag is not specified.)</pre>
- + The result of a signed conversion always begins with a plus or minus sign. (It
-<pre>
+<dl>
+<dt> - <dd> The result of the conversion is left-justified within the field. (It is right-justified if
+ this flag is not specified.)
+<dt> + <dd> The result of a signed conversion always begins with a plus or minus sign. (It
begins with a sign only when a negative value is converted if this flag is not
- specified.)<sup><a href="#note282"><b>282)</b></a></sup></pre>
- space If the first wide character of a signed conversion is not a sign, or if a signed
-<pre>
+ specified.)<sup><a href="#note282"><b>282)</b></a></sup>
+<dt> space<dd> If the first wide character of a signed conversion is not a sign, or if a signed
conversion results in no wide characters, a space is prefixed to the result. If the
- space and + flags both appear, the space flag is ignored.</pre>
- # The result is converted to an ''alternative form''. For o conversion, it increases
-<pre>
+ space and + flags both appear, the space flag is ignored.
+<dt> # <dd> The result is converted to an ''alternative form''. For o conversion, it increases
the precision, if and only if necessary, to force the first digit of the result to be a
zero (if the value and precision are both 0, a single 0 is printed). For x (or X)
- conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,</pre>
+ conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
<!--page 363 -->
-<pre>
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
decimal-point wide character appears in the result of these conversions only if a
digit follows it.) For g and G conversions, trailing zeros are not removed from the
- result. For other conversions, the behavior is undefined.</pre>
- 0 For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
-<p><!--para 7 -->
-<pre>
+ result. For other conversions, the behavior is undefined.
+<dt> 0 <dd> For d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions, leading zeros
(following any indication of sign or base) are used to pad to the field width rather
than performing space padding, except when converting an infinity or NaN. If the
0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
conversions, if a precision is specified, the 0 flag is ignored. For other
- conversions, the behavior is undefined.</pre>
+ conversions, the behavior is undefined.
+</dl>
+<p><!--para 7 -->
The length modifiers and their meanings are:
- hh Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+<dl>
+<dt> hh <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
signed char or unsigned char argument (the argument will have
been promoted according to the integer promotions, but its value shall be
converted to signed char or unsigned char before printing); or that
a following n conversion specifier applies to a pointer to a signed char
- argument.</pre>
- h Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ argument.
+<dt> h <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
short int or unsigned short int argument (the argument will
have been promoted according to the integer promotions, but its value shall
be converted to short int or unsigned short int before printing);
or that a following n conversion specifier applies to a pointer to a short
- int argument.</pre>
- l (ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ int argument.
+<dt> l (ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
long int or unsigned long int argument; that a following n
conversion specifier applies to a pointer to a long int argument; that 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
argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion
- specifier.</pre>
- ll (ell-ell) Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ specifier.
+<dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
long long int or unsigned long long int argument; or that a
following n conversion specifier applies to a pointer to a long long int
- argument.</pre>
- j Specifies that a following d, i, o, u, x, or X conversion specifier applies to
+ argument.
+<dt> j <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to
<!--page 364 -->
-<pre>
an intmax_t or uintmax_t argument; or that a following n conversion
- specifier applies to a pointer to an intmax_t argument.</pre>
- z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ specifier applies to a pointer to an intmax_t argument.
+<dt> z <dd> 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
following n conversion specifier applies to a pointer to a signed integer type
- corresponding to size_t argument.</pre>
- t Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
-<pre>
+ corresponding to size_t argument.
+<dt> t <dd> Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
ptrdiff_t or the corresponding unsigned integer type argument; or that a
following n conversion specifier applies to a pointer to a ptrdiff_t
- argument.</pre>
- L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
-<pre>
- applies to a long double argument.</pre>
+ argument.
+<dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
+ applies to a long double argument.
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><!--para 8 -->
The conversion specifiers and their meanings are:
- d,i The int argument is converted to signed decimal in the style [-]dddd. The
-<pre>
+<dl>
+<dt> d,i <dd> The int argument is converted to signed decimal in the style [-]dddd. The
precision specifies the minimum number of digits to appear; if the value
being converted can be represented in fewer digits, it is expanded with
leading zeros. The default precision is 1. The result of converting a zero
- value with a precision of zero is no wide characters.</pre>
- o,u,x,X The unsigned int argument is converted to unsigned octal (o), unsigned
-<pre>
+ value with a precision of zero is no wide characters.
+<dt> o,u,x,X<dd> The unsigned int argument is converted to unsigned octal (o), unsigned
decimal (u), or unsigned hexadecimal notation (x or X) in the style dddd; the
letters abcdef are used for x conversion and the letters ABCDEF for X
conversion. The precision specifies the minimum number of digits to appear;
if the value being converted can be represented in fewer digits, it is expanded
with leading zeros. The default precision is 1. The result of converting a
- zero value with a precision of zero is no wide characters.</pre>
- f,F A double argument representing a floating-point number is converted to
+ zero value with a precision of zero is no wide characters.
+<dt> f,F <dd> A double argument representing a floating-point number is converted to
<!--page 365 -->
-<pre>
decimal notation in the style [-]ddd.ddd, where the number of digits after
the decimal-point wide character is equal to the precision specification. If the
precision is missing, it is taken as 6; if the precision is zero and the # flag is
[-]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
- nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup></pre>
- e,E A double argument representing a floating-point number is converted in the
-<pre>
+ nan, respectively.<sup><a href="#note283"><b>283)</b></a></sup>
+<dt> e,E <dd> A double argument representing a floating-point number is converted in the
style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the
argument is nonzero) before the decimal-point wide character and the number
of digits after it is equal to the precision; if the precision is missing, it is taken
and only as many more digits as necessary to represent the exponent. If the
value is zero, the exponent is zero.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- g,G A double argument representing a floating-point number is converted in
-<pre>
+ of an f or F conversion specifier.
+<dt> g,G <dd> A double argument representing a floating-point number is converted in
style f or e (or in style F or E in the case of a G conversion specifier),
depending on the value converted and the precision. Let P equal the
precision if nonzero, 6 if the precision is omitted, or 1 if the precision is zero.
Then, if a conversion with style E would have an exponent of X :
- -- if P > X >= -4, the conversion is with style f (or F) and precision
+ <ul>
+ <li> if P > X >= -4, the conversion is with style f (or F) and precision
P - (X + 1).
- -- otherwise, the conversion is with style e (or E) and precision P - 1.
+ <li> otherwise, the conversion is with style e (or E) and precision P - 1.
+ </ul>
Finally, unless the # flag is used, any trailing zeros are removed from the
fractional portion of the result and the decimal-point wide character is
removed if there is no fractional portion remaining.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- a,A A double argument representing a floating-point number is converted in the
-<pre>
+ of an f or F conversion specifier.
+<dt> a,A <dd> A double argument representing a floating-point number is converted in the
style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is
nonzero if the argument is a normalized floating-point number and is
otherwise unspecified) before the decimal-point wide character<sup><a href="#note284"><b>284)</b></a></sup> and the
number of hexadecimal digits after it is equal to the precision; if the precision
- is missing and FLT_RADIX is a power of 2, then the precision is sufficient</pre>
-
-
+ is missing and FLT_RADIX is a power of 2, then the precision is sufficient
<!--page 366 -->
-<pre>
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
distinguish<sup><a href="#note285"><b>285)</b></a></sup> values of type double, except that trailing zeros may be
represent the decimal exponent of 2. If the value is zero, the exponent is
zero.
A double argument representing an infinity or NaN is converted in the style
- of an f or F conversion specifier.</pre>
- c If no l length modifier is present, the int argument is converted to a wide
-<pre>
+ of an f or F conversion specifier.
+<dt> c <dd> If no l length modifier is present, the int argument is converted to a wide
character as if by calling btowc and the resulting wide character is written.
If an l length modifier is present, the wint_t argument is converted to
- wchar_t and written.</pre>
- s If no l length modifier is present, the argument shall be a pointer to the initial
-<pre>
+ wchar_t and written.
+<dt> s <dd> If no l length modifier is present, the argument shall be a pointer to the initial
element of a character array containing a multibyte character sequence
beginning in the initial shift state. Characters from the array are converted as
if by repeated calls to the mbrtowc function, with the conversion state
written up to (but not including) a terminating null wide character. If the
precision is specified, no more than that many wide characters are written. If
the precision is not specified or is greater than the size of the array, the array
- shall contain a null wide character.</pre>
- p The argument shall be a pointer to void. The value of the pointer is
-<pre>
- converted to a sequence of printing wide characters, in an implementation-</pre>
-
+ shall contain a null wide character.
+<dt> p <dd> The argument shall be a pointer to void. The value of the pointer is
+ converted to a sequence of printing wide characters, in an implementation-
<!--page 367 -->
-<pre>
- defined manner.</pre>
- n The argument shall be a pointer to signed integer into which is written the
-<pre>
+ defined manner.
+<dt> n <dd> The argument shall be a pointer to signed integer into which is written the
number of wide characters written to the output stream so far by this call to
fwprintf. No argument is converted, but one is consumed. If the
conversion specification includes any flags, a field width, or a precision, the
- behavior is undefined.</pre>
- % A % wide character is written. No argument is converted. The complete
+ behavior is undefined.
+<dt> % <dd> A % wide character is written. No argument is converted. The complete
+ conversion specification shall be %%.
+</dl>
<p><!--para 9 -->
-<pre>
- conversion specification shall be %%.</pre>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note286"><b>286)</b></a></sup> If any argument is
not the correct type for the corresponding conversion specification, the behavior is
undefined.
<p><!--para 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.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 12 -->
For a and A conversions, if FLT_RADIX is not a power of 2 and the result is not exactly
representable in the given precision, the result should be one of the two adjacent numbers
value if an output or encoding error occurred.
<!--page 368 -->
- Environmental limits
+<h6> Environmental limits</h6>
<p><!--para 15 -->
The number of wide characters that can be produced by any single conversion shall be at
least 4095.
<p><small><a name="note284" href="#note284">284)</a> 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.
</small>
-<p><small><a name="note285" href="#note285">285)</a> The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is
+<p><small><a name="note285" href="#note285">285)</a> The precision p is sufficient to distinguish values of the source type if 16<sup>p-1</sup> > b n where b is
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point wide character.
represented in the object, the behavior is undefined.
<p><!--para 11 -->
The length modifiers and their meanings are:
- hh Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
- to an argument with type pointer to signed char or unsigned char.</pre>
- h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<dl>
+<dt> hh <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
+ to an argument with type pointer to signed char or unsigned char.
+<dt> h <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to short int or unsigned short
- int.</pre>
- l (ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ int.
+<dt> l (ell) <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to long int or unsigned long
int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to
an argument with type pointer to double; or that a following c, s, or [
- conversion specifier applies to an argument with type pointer to wchar_t.</pre>
- ll (ell-ell) Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ conversion specifier applies to an argument with type pointer to wchar_t.
+<dt> ll (ell-ell)<dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to long long int or unsigned
- long long int.</pre>
- j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
- to an argument with type pointer to intmax_t or uintmax_t.</pre>
- z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ long long int.
+<dt> j <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
+ to an argument with type pointer to intmax_t or uintmax_t.
+<dt> z <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to size_t or the corresponding signed
- integer type.</pre>
- t Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+ integer type.
+<dt> t <dd> Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
to an argument with type pointer to ptrdiff_t or the corresponding
- unsigned integer type.</pre>
- L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
-<pre>
- applies to an argument with type pointer to long double.</pre>
+ unsigned integer type.
+<dt> L <dd> Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
+ applies to an argument with type pointer to long double.
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><!--para 12 -->
The conversion specifiers and their meanings are:
- d Matches an optionally signed decimal integer, whose format is the same as
-<pre>
+<dl>
+<dt> d <dd> Matches an optionally signed decimal integer, whose format is the same as
expected for the subject sequence of the wcstol function with the value 10
for the base argument. The corresponding argument shall be a pointer to
- signed integer.</pre>
- i Matches an optionally signed integer, whose format is the same as expected
+ signed integer.
+<dt> i <dd> Matches an optionally signed integer, whose format is the same as expected
<!--page 371 -->
-<pre>
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
- integer.</pre>
- o Matches an optionally signed octal integer, whose format is the same as
-<pre>
+ integer.
+<dt> o <dd> Matches an optionally signed octal integer, whose format is the same as
expected for the subject sequence of the wcstoul function with the value 8
for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- u Matches an optionally signed decimal integer, whose format is the same as
-<pre>
+ unsigned integer.
+<dt> u <dd> Matches an optionally signed decimal integer, whose format is the same as
expected for the subject sequence of the wcstoul function with the value 10
for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- x Matches an optionally signed hexadecimal integer, whose format is the same
-<pre>
+ unsigned integer.
+<dt> x <dd> Matches an optionally signed hexadecimal integer, whose format is the same
as expected for the subject sequence of the wcstoul function with the value
16 for the base argument. The corresponding argument shall be a pointer to
- unsigned integer.</pre>
- a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, whose
-<pre>
+ unsigned integer.
+<dt> a,e,f,g<dd> Matches an optionally signed floating-point number, infinity, or NaN, whose
format is the same as expected for the subject sequence of the wcstod
- function. The corresponding argument shall be a pointer to floating.</pre>
- c Matches a sequence of wide characters of exactly the number specified by the
-<pre>
+ function. The corresponding argument shall be a pointer to floating.
+<dt> c <dd> Matches a sequence of wide characters of exactly the number specified by the
field width (1 if no field width is present in the directive).
If no l length modifier is present, characters from the input field are
converted as if by repeated calls to the wcrtomb function, with the
accept the sequence. No null character is added.
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
- the sequence. No null wide character is added.</pre>
- s Matches a sequence of non-white-space wide characters.
+ the sequence. No null wide character is added.
+<dt> s <dd> Matches a sequence of non-white-space wide characters.
<!--page 372 -->
-<pre>
If no l length modifier is present, characters from the input field are
converted as if by repeated calls to the wcrtomb function, with the
conversion state described by an mbstate_t object initialized to zero
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
the sequence and the terminating null wide character, which will be added
- automatically.</pre>
- [ Matches a nonempty sequence of wide characters from a set of expected
-<pre>
+ automatically.
+<dt> [ <dd> Matches a nonempty sequence of wide characters from a set of expected
characters (the scanset).
If no l length modifier is present, characters from the input field are
converted as if by repeated calls to the wcrtomb function, with the
the specification; otherwise the first following right bracket wide character is
the one that ends the specification. If a - wide character is in the scanlist and
is not the first, nor the second where the first wide character is a ^, nor the
- last character, the behavior is implementation-defined.</pre>
- p Matches an implementation-defined set of sequences, which should be the
-<pre>
+ last character, the behavior is implementation-defined.
+<dt> p <dd> Matches an implementation-defined set of sequences, which should be the
same as the set of sequences that may be produced by the %p conversion of
the fwprintf function. The corresponding argument shall be a pointer to a
pointer to void. The input item is converted to a pointer value in an
implementation-defined manner. If the input item is a value converted earlier
during the same program execution, the pointer that results shall compare
- equal to that value; otherwise the behavior of the %p conversion is undefined.</pre>
- n No input is consumed. The corresponding argument shall be a pointer to
+ equal to that value; otherwise the behavior of the %p conversion is undefined.
+<dt> n <dd> No input is consumed. The corresponding argument shall be a pointer to
<!--page 373 -->
-<pre>
signed integer into which is to be written the number of wide characters read
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
converted, but one is consumed. If the conversion specification includes an
assignment-suppressing wide character or a field width, the behavior is
- undefined.</pre>
- % Matches a single % wide character; no conversion or assignment occurs. The
+ undefined.
+<dt> % <dd> Matches a single % wide character; no conversion or assignment occurs. The
+ complete conversion specification shall be %%.
+</dl>
<p><!--para 13 -->
-<pre>
- complete conversion specification shall be %%.</pre>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note290"><b>290)</b></a></sup>
<p><!--para 14 -->
The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
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)
+ va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vfwscanf function returns the value of the macro EOF if an input failure occurs
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)
+ va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vswprintf function returns the number of wide characters written in the array, not
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)
+ va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vswscanf function returns the value of the macro EOF if an input failure occurs
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)
+ va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vwprintf function returns the number of wide characters transmitted, or a negative
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)
+ va_end macro.<sup><a href="#note291"><b>291)</b></a></sup>
<h6>Returns</h6>
<p><!--para 3 -->
The vwscanf function returns the value of the macro EOF if an input failure occurs
decimal-point wide character, then an optional binary exponent part as defined in
<a href="#6.4.4.2">6.4.4.2</a>;
<li> INF or INFINITY, or any other wide string equivalent except for case
-<li> NAN or NAN(n-wchar-sequenceopt), or any other wide string equivalent except for
+<li> NAN or NAN(n-wchar-sequence<sub>opt</sub>), or any other wide string equivalent except for
case in the NAN part, where:
<pre>
n-wchar-sequence:
sign, the sequence is interpreted as negated.<sup><a href="#note294"><b>294)</b></a></sup> A wide character sequence INF or
INFINITY is interpreted as an infinity, if representable in the return type, else like a
floating constant that is too large for the range of the return type. A wide character
- sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
+ sequence NAN or NAN(n-wchar-sequence<sub>opt</sub>) is interpreted as a quiet NaN, if supported
in the return type, else like a subject sequence part that does not have the expected form;
the meaning of the n-wchar sequences is implementation-defined.<sup><a href="#note295"><b>295)</b></a></sup> A pointer to the
final wide string is stored in the object pointed to by endptr, provided that endptr is
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.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 8 -->
If the subject sequence has the hexadecimal form, FLT_RADIX is not a power of 2, and
the result is not exactly representable, the result should be one of the two numbers in the
<p><!--para 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
-<pre>
- corresponds to the null wide character (which is the value stored).</pre>
- between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
-<pre>
+<dl>
+<dt> 0 <dd> if the next n or fewer bytes complete the multibyte character that
+ corresponds to the null wide character (which is the value stored).
+<dt> between 1 and n inclusive<dd> if the next n or fewer bytes complete a valid multibyte
character (which is the value stored); the value returned is the number
- of bytes that complete the multibyte character.</pre>
- (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
-<pre>
+ of bytes that complete the multibyte character.
+<dt> (size_t)(-2)<dd> if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
- stored).<sup><a href="#note300"><b>300)</b></a></sup></pre>
- (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
-<pre>
+ stored).<sup><a href="#note300"><b>300)</b></a></sup>
+<dt> (size_t)(-1)<dd> if an encoding error occurs, in which case the next n or fewer bytes
do not contribute to a complete and valid multibyte character (no
value is stored); the value of the macro EILSEQ is stored in errno,
- and the conversion state is unspecified.</pre>
-
+ and the conversion state is unspecified.
+</dl>
<!--page 402 -->
<h6>footnotes</h6>
<p><!--para 1 -->
<pre>
(informative)
- Implementation limits</pre>
+<h6> Implementation limits</h6></pre>
The contents of the header <a href="#7.10"><limits.h></a> are given below, in alphabetical order. The
minimum magnitudes shown shall be replaced by implementation-defined magnitudes
with the same sign. The values shall all be constant expressions suitable for use in #if
</ul>
Any non-IEC 60559 extended format used for the long double type shall have more
precision than IEC 60559 double and at least the range of IEC 60559 double.<sup><a href="#note308"><b>308)</b></a></sup>
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 2 -->
The long double type should match an IEC 60559 extended format.
A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the
rounding directions in a manner consistent with the basic arithmetic operations covered
by IEC 60559.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 2 -->
A contracted expression should raise floating-point exceptions in a manner generally
consistent with the basic arithmetic operations. A contracted expression should deliver
<li> The rounding precision mode (if supported) is set so that results are not shortened.
<li> Trapping or stopping (if supported) is disabled on all floating-point exceptions.
</ul>
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 2 -->
The implementation should produce a diagnostic message for each translation-time
For families of functions, the specifications apply to all of the functions even though only
the principal function is shown. Unless otherwise specified, where the symbol ''(+-)''
occurs in both an argument and the result, the result has the same sign as the argument.
- Recommended practice
+<h6> Recommended practice</h6>
<p><!--para 13 -->
If a function with one or more NaN arguments returns a NaN result, the result should be
the same as one of the NaN arguments (after possible type conversion), except perhaps