<h3><a name="3.3" href="#3.3">3.3</a></h3>
<p><a name="3.3p1" href="#3.3p1"><small>1</small></a>
<b> argument</b><br>
- actual argument
- actual parameter (deprecated)
+ 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
<p><small><a href="#Contents">Contents</a></small>
<h3><a name="3.20" href="#3.20">3.20</a></h3>
<p><a name="3.20p1" href="#3.20p1"><small>1</small></a>
-<b> [^ x^]</b><br>
+<b> [^ x ^]</b><br>
ceiling of x: the least integer greater than or equal to x
<p><a name="3.20p2" href="#3.20p2"><small>2</small></a>
EXAMPLE [^2.4^] is 3, [^-2.4^] is -2.
<p><small><a href="#Contents">Contents</a></small>
<h3><a name="3.21" href="#3.21">3.21</a></h3>
<p><a name="3.21p1" href="#3.21p1"><small>1</small></a>
-<b> [_ x_]</b><br>
+<b> [_ x _]</b><br>
floor of x: the greatest integer less than or equal to x
<p><a name="3.21p2" href="#3.21p2"><small>2</small></a>
EXAMPLE [_2.4_] is 2, [_-2.4_] is -3.
<p><a name="4p6" href="#4p6"><small>6</small></a>
The two forms of conforming implementation are hosted and freestanding. A conforming
hosted implementation shall accept any strictly conforming program. A conforming
- freestanding implementation shall accept any strictly conforming program in which the *
+ freestanding implementation shall accept any strictly conforming program in which the
use of the features specified in the library clause (clause 7) is confined to the contents of
the standard headers <a href="#7.7"><float.h></a>, <a href="#7.9"><iso646.h></a>, <a href="#7.10"><limits.h></a>, <a href="#7.15"><stdalign.h></a>,
<a href="#7.16"><stdarg.h></a>, <a href="#7.18"><stdbool.h></a>, <a href="#7.19"><stddef.h></a>, <a href="#7.20"><stdint.h></a>, and
Both the basic source and basic execution character sets shall have the following
members: the 26 uppercase letters of the Latin alphabet
<pre>
- A B C D E F G H I J K L M
- N O P Q R S T U V W X Y Z
+ A B C D E F G H I J K L M
+ N O P Q R S T U V W X Y Z
</pre>
the 26 lowercase letters of the Latin alphabet
<pre>
- a b c d e f g h i j k l m
- n o p q r s t u v w x y z
+ a b c d e f g h i j k l m
+ n o p q r s t u v w x y z
</pre>
the 10 decimal digits
<pre>
- 0 1 2 3 4 5 6 7 8 9
+ 0 1 2 3 4 5 6 7 8 9
</pre>
the following 29 graphic characters
<pre>
- ! " # % & ' ( ) * + , - . / :
- ; < = > ? [ \ ] ^ _ { | } ~
+ ! " # % & ' ( ) * + , - . / :
+ ; < = > ? [ \ ] ^ _ { | } ~
</pre>
the space character, and control characters representing horizontal tab, vertical tab, and
form feed. The representation of each member of the source and execution basic
<p><a name="5.2.2p2" href="#5.2.2p2"><small>2</small></a>
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>
+<dt> \f <dd>(form feed) Moves the active position to the initial position at the start of the next
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>
+<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
+<dt> \v <dd>(vertical tab) Moves the active position to the initial position of the next vertical
<!--page 43 -->
-<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>
+</dl>
<p><a name="5.2.2p3" href="#5.2.2p3"><small>3</small></a>
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
character)
<li> 31 significant initial characters in an external identifier (each universal character name
specifying a short identifier of 0000FFFF or less is considered 6 characters, each
-
-
<!--page 44 -->
-<pre>
universal character name specifying a short identifier of 00010000 or more is
considered 10 characters, and each extended source character is considered the same
number of characters as the corresponding universal character name, if any)<sup><a href="#note19"><b>19)</b></a></sup>
-</pre>
<li> 4095 external identifiers in one translation unit
<li> 511 identifiers with block scope declared in one block
<li> 4095 macro identifiers simultaneously defined in one preprocessing translation unit
(absolute value) to those shown, with the same sign.
<ul>
<li> number of bits for smallest object that is not a bit-field (byte)
+<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
+<pre>
CHAR_MAX see below
+</pre>
<li> maximum number of bytes in a multibyte character, for any supported locale
+<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 46 -->
<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><a name="5.2.4.2.1p2" href="#5.2.4.2.1p2"><small>2</small></a>
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="#note20"><b>20)</b></a></sup> The value UCHAR_MAX shall equal 2CHAR_BIT - 1.
+ UCHAR_MAX.<sup><a href="#note20"><b>20)</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>).
<p><b>Footnotes</b>
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)
+ f<sub>k</sub> nonnegative integers less than b (the significand digits)
</pre>
<p><a name="5.2.4.2.2p2" href="#5.2.4.2.2p2"><small>2</small></a>
A floating-point number (x) is defined by the following model:
<pre>
p
- x = sb e (Sum) f k b-k ,
+ x = s b<sup>e</sup> (Sum) f<sub>k</sub> b<sup>-k</sup> , emin <= e <= emax
k=1
- emin <= e <= emax
</pre>
<p><a name="5.2.4.2.2p3" href="#5.2.4.2.2p3"><small>3</small></a>
- 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><a name="5.2.4.2.2p8" href="#5.2.4.2.2p8"><small>8</small></a>
The rounding mode for floating-point addition is characterized by the implementation-
may be greater than required by the type. The use of evaluation formats is characterized
by the implementation-defined value of FLT_EVAL_METHOD:<sup><a href="#note24"><b>24)</b></a></sup>
<pre>
- -1 indeterminable;
- 0 evaluate all operations and constants just to the range and precision of the
+ -1 indeterminable;
+ 0 evaluate all operations and constants just to the range and precision of the
type;
- 1 evaluate operations and constants of type float and double to the
+ 1 evaluate operations and constants of type float and double to the
range and precision of the double type, evaluate long double
operations and constants to the range and precision of the long double
type;
- 2 evaluate all operations and constants to the range and precision of the
+ 2 evaluate all operations and constants to the range and precision of the
long double type.
</pre>
All other negative values for FLT_EVAL_METHOD characterize implementation-defined
those shown, with the same sign:
<ul>
<li> radix of exponent representation, b
- FLT_RADIX 2
-
-
-
-
+<pre>
+ FLT_RADIX 2
+</pre>
<!--page 49 -->
<li> number of base-FLT_RADIX digits in the floating-point significand, p
+<pre>
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
+</pre>
<li> number of decimal digits, n, such that any floating-point number with p radix b digits
can be rounded to a floating-point number with n decimal digits and back again
without change to the value,
{
{ [^1 + p log10 b^] otherwise
</pre>
+<pre>
FLT_DECIMAL_DIG 6
DBL_DECIMAL_DIG 10
LDBL_DECIMAL_DIG 10
+</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,
{
{ [^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,
{ p log10 b if b is a power of 10
{
{ [_( p - 1) log10 b_] otherwise
-</pre>
+
FLT_DIG 6
DBL_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
+<pre>
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
+</pre>
<!--page 50 -->
<li> minimum negative integer such that 10 raised to that power is in the range of
- normalized floating-point numbers, [^log10 b emin -1 ^]
+ normalized floating-point numbers, [^log10 b<sup>emin-1</sup>^]
<pre>
- [ ]
-</pre>
FLT_MIN_10_EXP -37
DBL_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
<pre>
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 )_]
+ 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
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
+<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
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>
<pre>
FLT_EPSILON 1E-5
DBL_EPSILON 1E-9
LDBL_EPSILON 1E-9
</pre>
-<li> minimum normalized positive floating-point number, b emin -1
+<li> minimum normalized positive floating-point number, b<sup>emin-1</sup>
<!--page 51 -->
<pre>
FLT_MIN 1E-37
float:
<pre>
6
- x = s16e (Sum) f k 16-k ,
+ x = s 16<sup>e</sup> (Sum) f<sub>k</sub> 16<sup>-k</sup> , -31 <= e <= +32
k=1
- -31 <= e <= +32
</pre>
-
<pre>
FLT_RADIX 16
FLT_MANT_DIG 6
<a href="#7.7"><float.h></a> header for types float and double:
<pre>
24
- x f = s2e (Sum) f k 2-k ,
+ xf = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -125 <= e <= +128
k=1
- -125 <= e <= +128
</pre>
-
<pre>
53
- x d = s2e (Sum) f k 2-k ,
+ xd = s 2<sup>e</sup> (Sum) f<sub>k</sub> 2<sup>-k</sup> , -1021 <= e <= +1024
k=1
- -1021 <= e <= +1024
</pre>
-
<pre>
FLT_RADIX 2
DECIMAL_DIG 17
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="note50" href="#note50">50)</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="#note53"><b>53)</b></a></sup>
<p><a name="6.2.6.2p2" href="#6.2.6.2p2"><small>2</small></a>
For signed integer types, the bits of the object representation shall be divided into three
following ways:
<ul>
<li> the corresponding value with sign bit 0 is negated (sign and magnitude);
-<li> the sign bit has the value -(2 M ) (two's complement);
-<li> the sign bit has the value -(2 M - 1) (ones' complement).
+<li> the sign bit has the value -(2<sup>M</sup>) (two's complement);
+<li> the sign bit has the value -(2<sup>M</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'
the result, whose type domain is the type domain of the operands if they are the same,
and complex otherwise. This pattern is called the usual arithmetic conversions:
<!--page 71 -->
-<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="#note62"><b>62)</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
+<li> Otherwise, both operands are converted to the unsigned integer type
corresponding to the type of the operand with signed integer type.
-</pre>
+</ul>
+</ul>
<p><a name="6.3.1.8p2" href="#6.3.1.8p2"><small>2</small></a>
The values of floating operands and of the results of floating expressions may be
represented in greater range and precision than that required by the type; the types are not
<p><a name="6.4.1p1" href="#6.4.1p1"><small>1</small></a>
<pre>
keyword: one of
- auto * if unsigned
+ auto if unsigned
break inline void
case int volatile
char long while
universal-character-name
other implementation-defined characters
nondigit: one of
- _ a b c d e f g h i j k l m
- n o p q r s t u v w x y z
- A B C D E F G H I J K L M
- N O P Q R S T U V W X Y Z
+ _ a b c d e f g h i j k l m
+ n o p q r s t u v w x y z
+ A B C D E F G H I J K L M
+ N O P Q R S T U V W X Y Z
digit: one of
- 0 1 2 3 4 5 6 7 8 9
+ 0 1 2 3 4 5 6 7 8 9
</pre>
<p><b>Semantics</b>
<p><a name="6.4.2.1p2" href="#6.4.2.1p2"><small>2</small></a>
<!--page 81 -->
<pre>
integer-constant:
- decimal-constant integer-suffix<sub>opt</sub>
- octal-constant integer-suffix<sub>opt</sub>
- hexadecimal-constant integer-suffix<sub>opt</sub>
+ 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
octal-constant:
- 0
- octal-constant octal-digit
+ 0
+ octal-constant octal-digit
hexadecimal-constant:
hexadecimal-prefix hexadecimal-digit
hexadecimal-constant hexadecimal-digit
hexadecimal-prefix: one of
- 0x 0X
+ 0x 0X
nonzero-digit: one of
- 1 2 3 4 5 6 7 8 9
+ 1 2 3 4 5 6 7 8 9
octal-digit: one of
- 0 1 2 3 4 5 6 7
- hexadecimal-digit: one of
- 0 1 2 3 4 5 6 7 8 9
- a b c d e f
- A B C D E F
- integer-suffix:
- unsigned-suffix long-suffix<sub>opt</sub>
- unsigned-suffix long-long-suffix
- 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
- l L
- long-long-suffix: one of
- ll LL
+ 0 1 2 3 4 5 6 7
+ hexadecimal-digit: one of
+ 0 1 2 3 4 5 6 7 8 9
+ a b c d e f
+ A B C D E F
+ integer-suffix:
+ unsigned-suffix long-suffix<sub>opt</sub>
+ unsigned-suffix long-long-suffix
+ 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
+ l L
+ long-long-suffix: one of
+ ll LL
</pre>
<p><b>Description</b>
<p><a name="6.4.4.1p2" href="#6.4.4.1p2"><small>2</small></a>
The type of an integer constant is the first of the corresponding list in which its value can
be represented.
<!--page 82 -->
-<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><a name="6.4.4.1p6" href="#6.4.4.1p6"><small>6</small></a>
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
c-char
c-char-sequence c-char
c-char:
- any member of the source character set except
- the single-quote ', backslash \, or new-line character
- escape-sequence
+ any member of the source character set except
+ the single-quote ', backslash \, or new-line character
+ escape-sequence
escape-sequence:
simple-escape-sequence
octal-escape-sequence
hexadecimal-escape-sequence
universal-character-name
simple-escape-sequence: one of
- \' \" \? \\
- \a \b \f \n \r \t \v
+ \' \" \? \\
+ \a \b \f \n \r \t \v
octal-escape-sequence:
- \ octal-digit
- \ octal-digit octal-digit
- \ octal-digit octal-digit octal-digit
- hexadecimal-escape-sequence:
- \x hexadecimal-digit
- hexadecimal-escape-sequence hexadecimal-digit
+ \ octal-digit
+ \ octal-digit octal-digit
+ \ octal-digit octal-digit octal-digit
+ hexadecimal-escape-sequence:
+ \x hexadecimal-digit
+ hexadecimal-escape-sequence hexadecimal-digit
</pre>
<p><b>Description</b>
<p><a name="6.4.4.4p2" href="#6.4.4.4p2"><small>2</small></a>
<p><a name="6.4.4.4p9" href="#6.4.4.4p9"><small>9</small></a>
The value of an octal or hexadecimal escape sequence shall be in the range of
representable values for the corresponding type:
-<pre>
- Prefix Corresponding Type
- none unsigned char
- L the unsigned type corresponding to wchar_t
- u char16_t
- U char32_t
-</pre>
+<table border=1>
+<tr><th>Prefix <th>Corresponding Type
+<tr><td>none<td><code>unsigned char</code>
+<tr><td><code>L</code><td>the unsigned type corresponding to <code>wchar_t</code>
+<tr><td><code>u</code><td><code>char16_t</code>
+<tr><td><code>U</code><td><code>char32_t</code>
+</table>
<p><b>Semantics</b>
<p><a name="6.4.4.4p10" href="#6.4.4.4p10"><small>10</small></a>
An integer character constant has type int. The value of an integer character constant
<p><a name="6.4.5p1" href="#6.4.5p1"><small>1</small></a>
<pre>
string-literal:
- encoding-prefix<sub>opt</sub> " s-char-sequence<sub>opt</sub> "
+ encoding-prefix<sub>opt</sub> " s-char-sequence<sub>opt</sub> "
encoding-prefix:
u8
u
s-char
s-char-sequence s-char
s-char:
- any member of the source character set except
- the double-quote ", backslash \, or new-line character
- escape-sequence
+ any member of the source character set except
+ the double-quote ", backslash \, or new-line character
+ escape-sequence
</pre>
<p><b>Constraints</b>
<p><a name="6.4.5p2" href="#6.4.5p2"><small>2</small></a>
<p><a name="6.4.6p1" href="#6.4.6p1"><small>1</small></a>
<pre>
punctuator: one of
- [ ] ( ) { } . ->
- ++ -- & * + - ~ !
- / % << >> < > <= >= == != ^ | && ||
- ? : ; ...
- = *= /= %= += -= <<= >>= &= ^= |=
- , # ##
- <: :> <% %> %: %:%:
+ [ ] ( ) { } . ->
+ ++ -- & * + - ~ !
+ / % << >> < > <= >= == != ^ | && ||
+ ? : ; ...
+ = *= /= %= += -= <<= >>= &= ^= |=
+ , # ##
+ <: :> <% %> %: %:%:
</pre>
<p><b>Semantics</b>
<p><a name="6.4.6p2" href="#6.4.6p2"><small>2</small></a>
greater than or equal to the width of the promoted left operand, the behavior is undefined.
<p><a name="6.5.7p4" href="#6.5.7p4"><small>4</small></a>
The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with
- zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo
+ zeros. If E1 has an unsigned type, the value of the result is E1 x 2<sup>E2</sup> , reduced modulo
one more than the maximum value representable in the result type. If E1 has a signed
- type and nonnegative value, and E1 x 2E2 is representable in the result type, then that is
+ type and nonnegative value, and E1 x 2<sup>E2</sup> is representable in the result type, then that is
the resulting value; otherwise, the behavior is undefined.
<p><a name="6.5.7p5" href="#6.5.7p5"><small>5</small></a>
The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type
or if E1 has a signed type and a nonnegative value, the value of the result is the integral
- part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the
+ part of the quotient of E1 / 2<sup>E2</sup> . If E1 has a signed type and a negative value, the
resulting value is implementation-defined.
<p><small><a href="#Contents">Contents</a></small>
conditional-expression
unary-expression assignment-operator assignment-expression
assignment-operator: one of
- = *= /= %= += -= <<= >>= &= ^= |=
+ = *= /= %= += -= <<= >>= &= ^= |=
</pre>
<p><b>Constraints</b>
<p><a name="6.5.16p2" href="#6.5.16p2"><small>2</small></a>
<p><a name="6.7.2.1p21" href="#6.7.2.1p21"><small>21</small></a>
Following the above declaration:
<pre>
- struct s t1 = { 0 }; // valid
- struct s t2 = { 1, { <a href="#4.2">4.2</a> }}; // invalid
- t1.n = 4; // valid
- t1.d[0] = <a href="#4.2">4.2</a>; // might be undefined behavior
+ struct s t1 = { 0 }; // valid
+ struct s t2 = { 1, { 4.2 }}; // invalid
+ t1.n = 4; // valid
+ t1.d[0] = 4.2; // might be undefined behavior
</pre>
The initialization of t2 is invalid (and violates a constraint) because struct s is treated as if it did not
contain member d. The assignment to t1.d[0] is probably undefined behavior, but it is possible that
<pre>
void copyt(int n)
{
- typedef int B[n]; // B is n ints, n evaluated now
+ typedef int B[n]; // B is n ints, n evaluated now
n += 1;
- B a; // a is n ints, n without += 1
- int b[n]; // a and b are different sizes
- for (int i = 1; i < n; i++)
+ B a; // a is n ints, n without += 1
+ int b[n]; // a and b are different sizes
+ for (int i = 1; i < n; i++)
a[i-1] = b[i];
}
</pre>
<p><a name="6.7.9p26" href="#6.7.9p26"><small>26</small></a>
EXAMPLE 3 The declaration
<pre>
- int y[4][3] = {
- { 1, 3, 5 },
- { 2, 4, 6 },
- { 3, 5, 7 },
+ int y[4][3] = {
+ { 1, 3, 5 },
+ { 2, 4, 6 },
+ { 3, 5, 7 },
};
</pre>
is a definition with a fully bracketed initialization: 1, 3, and 5 initialize the first row of y (the array object
EXAMPLE 9 Arrays can be initialized to correspond to the elements of an enumeration by using
designators:
<pre>
- enum { member_one, member_two };
- const char *nm[] = {
- [member_two] = "member two",
- [member_one] = "member one",
+ enum { member_one, member_two };
+ const char *nm[] = {
+ [member_two] = "member two",
+ [member_one] = "member one",
};
</pre>
goto lab3; // invalid: going INTO scope of VLA.
{
double a[n];
- a[j] = <a href="#4.4">4.4</a>;
+ a[j] = 4.4;
lab3:
- a[j] = <a href="#3.3">3.3</a>;
+ a[j] = 3.3;
goto lab4; // valid: going WITHIN scope of VLA.
- a[j] = <a href="#5.5">5.5</a>;
+ a[j] = 5.5;
lab4:
- a[j] = <a href="#6.6">6.6</a>;
+ a[j] = 6.6;
}
goto lab4; // invalid: going INTO scope of VLA.
</pre>
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 (/* ... */); }
+</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="#note159"><b>159)</b></a></sup>
<h5><a name="6.10.8.1" href="#6.10.8.1">6.10.8.1 Mandatory macros</a></h5>
<p><a name="6.10.8.1p1" href="#6.10.8.1p1"><small>1</small></a>
The following macro names 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="#note177"><b>177)</b></a></sup>
- __LINE__ The presumed line number (within the current source file) of the current
-<pre>
+<dt> __FILE__ <dd>The presumed name of the current source file (a character string literal).<sup><a href="#note177"><b>177)</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="#note177"><b>177)</b></a></sup>
-</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>
+<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.
-</pre>
-
-
-
-
<!--page 194 -->
- __STDC_VERSION__ The integer constant 201ymmL.<sup><a href="#note178"><b>178)</b></a></sup>
- __TIME__ The time of translation of the preprocessing translation unit: a character
-<pre>
+<dt> __STDC_VERSION__ <dd>The integer constant 201ymmL.<sup><a href="#note178"><b>178)</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>
+</dl>
<p><b> Forward references</b>: the asctime function (<a href="#7.27.3.1">7.27.3.1</a>).
<p><b>Footnotes</b>
<h5><a name="6.10.8.2" href="#6.10.8.2">6.10.8.2 Environment macros</a></h5>
<p><a name="6.10.8.2p1" href="#6.10.8.2p1"><small>1</small></a>
The following macro names are conditionally defined by the implementation:
- __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example,
-<pre>
+<dl>
+<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
all amendments and technical corrigenda, as of the specified year and
month. If some other encoding is used, the macro shall not be defined and
the actual encoding used is implementation-defined.
-</pre>
- __STDC_MB_MIGHT_NEQ_WC__ The integer constant 1, intended to indicate that, in
-<pre>
+<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_UTF_16__ The integer constant 1, intended to indicate that values of type
-<pre>
+<dt> __STDC_UTF_16__ <dd>The integer constant 1, intended to indicate that values of type
char16_t are UTF-16 encoded. If some other encoding is used, the
macro shall not be defined and the actual encoding used is implementation-
defined.
-</pre>
- __STDC_UTF_32__ The integer constant 1, intended to indicate that values of type
-<pre>
+<dt> __STDC_UTF_32__ <dd>The integer constant 1, intended to indicate that values of type
char32_t are UTF-32 encoded. If some other encoding is used, the
macro shall not be defined and the actual encoding used is implementation-
defined.
-</pre>
+</dl>
<p><b> Forward references</b>: common definitions (<a href="#7.19">7.19</a>), unicode utilities (<a href="#7.28">7.28</a>).
<h5><a name="6.10.8.3" href="#6.10.8.3">6.10.8.3 Conditional feature macros</a></h5>
<p><a name="6.10.8.3p1" href="#6.10.8.3p1"><small>1</small></a>
The following macro names are conditionally defined by the implementation:
- __STDC_ANALYZABLE__ The integer constant 1, intended to indicate conformance to
-<pre>
+<dl>
+<dt> __STDC_ANALYZABLE__ <dd>The integer constant 1, intended to indicate conformance to
the specifications in <a href="#L">annex L</a> (Analyzability).
-</pre>
- __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the
-<pre>
+<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).
-</pre>
- __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate
-<pre>
+<dt> __STDC_IEC_559_COMPLEX__ <dd>The integer constant 1, intended to indicate
adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
arithmetic).
-</pre>
- __STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
-<pre>
+<dt> __STDC_LIB_EXT1__ <dd>The integer constant 201ymmL, intended to indicate support
for the extensions defined in <a href="#K">annex K</a> (Bounds-checking interfaces).<sup><a href="#note179"><b>179)</b></a></sup>
-</pre>
- __STDC_NO_ATOMICS__ The integer constant 1, intended to indicate that the
-<pre>
+<dt> __STDC_NO_ATOMICS__ <dd>The integer constant 1, intended to indicate that the
implementation does not support atomic types (including the _Atomic
type qualifier) and the <a href="#7.17"><stdatomic.h></a> header.
-</pre>
- __STDC_NO_COMPLEX__ The integer constant 1, intended to indicate that the
-<pre>
+<dt> __STDC_NO_COMPLEX__ <dd>The integer constant 1, intended to indicate that the
implementation does not support complex types or the <a href="#7.3"><complex.h></a>
header.
-</pre>
- __STDC_NO_THREADS__ The integer constant 1, intended to indicate that the
-<pre>
+<dt> __STDC_NO_THREADS__ <dd>The integer constant 1, intended to indicate that the
implementation does not support the <a href="#7.26"><threads.h></a> header.
-</pre>
- __STDC_NO_VLA__ The integer constant 1, intended to indicate that the
-<pre>
+<dt> __STDC_NO_VLA__ <dd>The integer constant 1, intended to indicate that the
implementation does not support variable length arrays or variably
modified types.
-</pre>
+</dl>
<p><a name="6.10.8.3p2" href="#6.10.8.3p2"><small>2</small></a>
An implementation that defines __STDC_NO_COMPLEX__ shall not define
__STDC_IEC_559_COMPLEX__.
<p><b>Footnotes</b>
<p><small><a name="note191" href="#note191">191)</a> The message written might be of the form:
+<pre>
Assertion failed: expression, function abc, file xyz, line nnn.
+</pre>
</small>
<p><small><a href="#Contents">Contents</a></small>
<p><b>Footnotes</b>
<p><small><a name="note192" href="#note192">192)</a> See ''future library directions'' (<a href="#7.31.1">7.31.1</a>).
</small>
-<p><small><a name="note193" href="#note193">193)</a> The imaginary unit is a number i such that i 2 = -1.
+<p><small><a name="note193" href="#note193">193)</a> The imaginary unit is a number i such that i<sup>2</sup> = -1.
</small>
<p><small><a name="note194" href="#note194">194)</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
+ (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.
</pre>
<p><b>Description</b>
<p><a name="7.3.8.2p2" href="#7.3.8.2p2"><small>2</small></a>
- The cpow functions compute the complex power function xy , with a branch cut for the
+ The cpow functions compute the complex power function x<sup>y</sup> , with a branch cut for the
first parameter along the negative real axis.
<p><b>Returns</b>
<p><a name="7.3.8.2p3" href="#7.3.8.2p3"><small>3</small></a>
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><a name="7.6p10" href="#7.6p10"><small>10</small></a>
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>
+<dl>
+<dt> char *decimal_point
+<dd>
The decimal-point character used to format nonmonetary quantities.
-</pre>
- char *thousands_sep
-<pre>
+<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>
+<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>
+<dt> char *mon_decimal_point
+<dd>
The decimal-point used to format monetary quantities.
-</pre>
- char *mon_thousands_sep
-<pre>
+<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>
+<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>
+<dt> char *positive_sign
+<dd>
The string used to indicate a nonnegative-valued formatted monetary
quantity.
-</pre>
- char *negative_sign
-<pre>
+<dt> char *negative_sign
+<dd>
The string used to indicate a negative-valued formatted monetary quantity.
-</pre>
- char *currency_symbol
-<pre>
+<dt> char *currency_symbol
+<dd>
The local currency symbol applicable to the current locale.
-</pre>
- char frac_digits
-<pre>
+<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
-<!--page 245 -->
-<pre>
+<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
-<pre>
+<!--page 245 -->
+<dt> char n_cs_precedes
+<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>
+<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>
+<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>
+<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>
+<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>
+<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>
+<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>
+<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>
+<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
-<!--page 246 -->
-<pre>
+<dt> char int_p_sep_by_space
+<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>
+<!--page 246 -->
+<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>
+<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
-<pre>
+<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>
+</dl>
<p><a name="7.11.2.1p4" href="#7.11.2.1p4"><small>4</small></a>
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.
-<pre>
- The next element is examined to determine the size of the next group of
- digits before the current group.
-</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.
+</dl>
<p><a name="7.11.2.1p5" href="#7.11.2.1p5"><small>5</small></a>
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>
+<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.
-</pre>
+</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><a name="7.11.2.1p6" href="#7.11.2.1p6"><small>6</small></a>
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 247 -->
<p><a name="7.11.2.1p7" href="#7.11.2.1p7"><small>7</small></a>
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><a name="7.11.2.1p10" href="#7.11.2.1p10"><small>10</small></a>
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 248 -->
<p><a name="7.11.2.1p11" href="#7.11.2.1p11"><small>11</small></a>
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>
+ p_cs_precedes p_sign_posn 0 1 2
+ 0 0 (1.25$) (1.25 $) (1.25$)
+ 1 +1.25$ +1.25 $ + 1.25$
+ 2 1.25$+ 1.25 $+ 1.25$ +
+ 3 1.25+$ 1.25 +$ 1.25+ $
+ 4 1.25$+ 1.25 $+ 1.25$ +
<!--page 249 -->
-<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
+ 1 0 ($1.25) ($ 1.25) ($1.25)
+ 1 +$1.25 +$ 1.25 + $1.25
+ 2 $1.25+ $ 1.25+ $1.25 +
+ 3 +$1.25 +$ 1.25 + $1.25
+ 4 $+1.25 $+ 1.25 $ +1.25
</pre>
<p><small><a href="#Contents">Contents</a></small>
magnitude of x is too large.
<p><b>Returns</b>
<p><a name="7.12.6.1p3" href="#7.12.6.1p3"><small>3</small></a>
- The exp functions return ex .
+ The exp functions return e<sup>x</sup>.
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.6.2" href="#7.12.6.2">7.12.6.2 The exp2 functions</a></h5>
<!--page 261 -->
<p><b>Returns</b>
<p><a name="7.12.6.2p3" href="#7.12.6.2p3"><small>3</small></a>
- The exp2 functions return 2x .
+ The exp2 functions return 2<sup>x</sup>.
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.6.3" href="#7.12.6.3">7.12.6.3 The expm1 functions</a></h5>
error occurs if x is too large.<sup><a href="#note237"><b>237)</b></a></sup>
<p><b>Returns</b>
<p><a name="7.12.6.3p3" href="#7.12.6.3p3"><small>3</small></a>
- The expm1 functions return ex - 1.
+ The expm1 functions return e<sup>x</sup> - 1.
<p><b>Footnotes</b>
<p><small><a name="note237" href="#note237">237)</a> For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
<p><a name="7.12.6.4p3" href="#7.12.6.4p3"><small>3</small></a>
If value is not a floating-point number or if the integral power of 2 is outside the range
of int, 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 .
+ such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x 2<sup>*exp</sup>.
If value is zero, both parts of the result are zero.
range error may occur.
<p><b>Returns</b>
<p><a name="7.12.6.6p3" href="#7.12.6.6p3"><small>3</small></a>
- The ldexp functions return x x 2exp .
+ The ldexp functions return x 2<sup>exp</sup>.
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.6.7" href="#7.12.6.7">7.12.6.7 The log functions</a></h5>
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
+ 1 <= x x FLT_RADIX<sup>-logb(x)</sup> < FLT_RADIX
</pre>
A domain error or pole error may occur if the argument is zero.
<p><b>Returns</b>
</pre>
<p><b>Description</b>
<p><a name="7.12.6.13p2" href="#7.12.6.13p2"><small>2</small></a>
- 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.
<p><b>Returns</b>
<p><a name="7.12.6.13p3" href="#7.12.6.13p3"><small>3</small></a>
- The scalbn and scalbln functions return x x FLT_RADIXn .
+ The scalbn and scalbln functions return x FLT_RADIX<sup>n</sup>.
<p><small><a href="#Contents">Contents</a></small>
<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.
<p><b>Returns</b>
<p><a name="7.12.7.1p3" href="#7.12.7.1p3"><small>3</small></a>
- The cbrt functions return x1/3 .
+ The cbrt functions return x<sup>1/3</sup>.
<!--page 266 -->
<p><small><a href="#Contents">Contents</a></small>
<p><a name="7.12.7.3p3" href="#7.12.7.3p3"><small>3</small></a>
<p><b>Returns</b>
<p><a name="7.12.7.3p4" href="#7.12.7.3p4"><small>4</small></a>
- The hypot functions return (sqrt)x2 + y2 .
-<pre>
- -
- -----
-</pre>
+ The hypot functions return (sqrt)(x<sup>2</sup> + y<sup>2</sup>).
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.7.4" href="#7.12.7.4">7.12.7.4 The pow functions</a></h5>
<!--page 267 -->
<p><b>Returns</b>
<p><a name="7.12.7.4p3" href="#7.12.7.4p3"><small>3</small></a>
- The pow functions return xy .
+ The pow functions return x<sup>y</sup>.
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.7.5" href="#7.12.7.5">7.12.7.5 The sqrt functions</a></h5>
the argument is less than zero.
<p><b>Returns</b>
<p><a name="7.12.7.5p3" href="#7.12.7.5p3"><small>3</small></a>
- The sqrt functions return (sqrt)x.
-<pre>
- -
- -
-</pre>
+ The sqrt functions return (sqrt)(x).
<p><small><a href="#Contents">Contents</a></small>
<h4><a name="7.12.8" href="#7.12.8">7.12.8 Error and gamma functions</a></h4>
The erf functions compute the error function of x.
<p><b>Returns</b>
<p><a name="7.12.8.1p3" href="#7.12.8.1p3"><small>3</small></a>
+ The erf functions return
<pre>
- 2 x
- (integral) e-t dt.
- 2
-</pre>
- The erf functions return erf x =
-<pre>
- (sqrt)pi
- -
- - 0
+ 2 x
+ erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
+ (sqrt)(pi) 0
</pre>
-
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.8.2" href="#7.12.8.2">7.12.8.2 The erfc functions</a></h5>
<!--page 268 -->
<p><b>Returns</b>
<p><a name="7.12.8.2p3" href="#7.12.8.2p3"><small>3</small></a>
+ The erfc functions return
<pre>
- 2 (inf)
- (integral) e-t dt.
- 2
+ 2 (inf)
+ erfc x = 1 - erf x = --- (integral) e<sup>-t<sup>2</sup></sup> dt .
+ (sqrt)(pi) x
</pre>
- The erfc functions return erfc x = 1 - erf x =
-<pre>
- (sqrt)pi
- -
- - x
-</pre>
-
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.12.8.3" href="#7.12.8.3">7.12.8.3 The lgamma functions</a></h5>
<p><a name="7.12.10.3p2" href="#7.12.10.3p2"><small>2</small></a>
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.
<p><b>Returns</b>
<p><a name="7.12.10.3p3" href="#7.12.10.3p3"><small>3</small></a>
<p><a name="7.12.12.1p2" href="#7.12.12.1p2"><small>2</small></a>
The fdim functions determine the positive difference between their arguments:
<pre>
- {x - y if x > y
+ {x - y if x > y
{
{+0 if x <= y
</pre>
</pre>
<p><b>Description</b>
<p><a name="7.12.13.1p2" href="#7.12.13.1p2"><small>2</small></a>
- 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.
<p><b>Returns</b>
<p><a name="7.12.13.1p3" href="#7.12.13.1p3"><small>3</small></a>
- 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.
expand to positive integer constant expressions with type int and distinct values that are
the signal numbers, each corresponding to the specified condition:
<pre>
- SIGABRT abnormal termination, such as is initiated by the abort function
- SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
- resulting in overflow
- SIGILL detection of an invalid function image, such as an invalid instruction
- SIGINT receipt of an interactive attention signal
- SIGSEGV an invalid access to storage
- SIGTERM a termination request sent to the program
+ SIGABRT abnormal termination, such as is initiated by the abort function
+ SIGFPE an erroneous arithmetic operation, such as zero divide or an operation
+ resulting in overflow
+ SIGILL detection of an invalid function image, such as an invalid instruction
+ SIGINT receipt of an interactive attention signal
+ SIGSEGV an invalid access to storage
+ SIGTERM a termination request sent to the program
</pre>
<p><a name="7.14p4" href="#7.14p4"><small>4</small></a>
An implementation need not generate any of these signals, except as a result of explicit
<pre>
atomic_flag
</pre>
- which is a structure type representing a lock-free, primitive atomic flag; and several *
+ which is a structure type representing a lock-free, primitive atomic flag; and several
atomic analogs of integer types.
<p><a name="7.17.1p5" href="#7.17.1p5"><small>5</small></a>
In the following synopses:
<ul>
<li> An A refers to one of the atomic types.
-<li> A C refers to its corresponding non-atomic type. *
+<li> A C refers to its corresponding non-atomic type.
<li> An M refers to the type of the other argument for arithmetic operations. For atomic
integer types, M is C. For atomic pointer types, M is ptrdiff_t.
// Thread 1:
r1 = atomic_load_explicit(&y, memory_order_relaxed);
atomic_store_explicit(&x, r1, memory_order_relaxed);
-</pre>
-
-<pre>
+
// Thread 2:
r2 = atomic_load_explicit(&x, memory_order_relaxed);
atomic_store_explicit(&y, 42, memory_order_relaxed);
</pre>
is allowed to produce r1 == 42 && r2 == 42. The sequence of evaluations justifying this consists of:
<pre>
- atomic_store_explicit(&y, 42, memory_order_relaxed);
- r1 = atomic_load_explicit(&y, memory_order_relaxed);
- atomic_store_explicit(&x, r1, memory_order_relaxed);
- r2 = atomic_load_explicit(&x, memory_order_relaxed);
+ atomic_store_explicit(&y, 42, memory_order_relaxed);
+ r1 = atomic_load_explicit(&y, memory_order_relaxed);
+ atomic_store_explicit(&x, r1, memory_order_relaxed);
+ r2 = atomic_load_explicit(&x, memory_order_relaxed);
</pre>
On the other hand,
<pre>
// Thread 1:
r1 = atomic_load_explicit(&y, memory_order_relaxed);
atomic_store_explicit(&x, r1, memory_order_relaxed);
-</pre>
-
-<pre>
+
// Thread 2:
r2 = atomic_load_explicit(&x, memory_order_relaxed);
atomic_store_explicit(&y, r2, memory_order_relaxed);
r1 = atomic_load_explicit(&x, memory_order_relaxed);
if (r1 == 42)
atomic_store_explicit(&y, r1, memory_order_relaxed);
-</pre>
-
-<pre>
+
// Thread 2:
r2 = atomic_load_explicit(&y, memory_order_relaxed);
if (r2 == 42)
<p><b>Description</b>
<p><a name="7.17.5.1p2" href="#7.17.5.1p2"><small>2</small></a>
The atomic_is_lock_free generic function indicates whether or not the object
- pointed to by obj is lock-free. *
+ pointed to by obj is lock-free.
<p><b>Returns</b>
<p><a name="7.17.5.1p3" href="#7.17.5.1p3"><small>3</small></a>
The atomic_is_lock_free generic function returns nonzero (true) if and only if the
<!--page 299 -->
<pre>
- Atomic type name Direct type
- atomic_bool _Atomic _Bool
- atomic_char _Atomic char
- atomic_schar _Atomic signed char
- atomic_uchar _Atomic unsigned char
- atomic_short _Atomic short
- atomic_ushort _Atomic unsigned short
- atomic_int _Atomic int
- atomic_uint _Atomic unsigned int
- atomic_long _Atomic long
- atomic_ulong _Atomic unsigned long
- atomic_llong _Atomic long long
- atomic_ullong _Atomic unsigned long long
- atomic_char16_t _Atomic char16_t
- atomic_char32_t _Atomic char32_t
- atomic_wchar_t _Atomic wchar_t
- atomic_int_least8_t _Atomic int_least8_t
- atomic_uint_least8_t _Atomic uint_least8_t
- atomic_int_least16_t _Atomic int_least16_t
- atomic_uint_least16_t _Atomic uint_least16_t
- atomic_int_least32_t _Atomic int_least32_t
- atomic_uint_least32_t _Atomic uint_least32_t
- atomic_int_least64_t _Atomic int_least64_t
- atomic_uint_least64_t _Atomic uint_least64_t
- atomic_int_fast8_t _Atomic int_fast8_t
- atomic_uint_fast8_t _Atomic uint_fast8_t
- atomic_int_fast16_t _Atomic int_fast16_t
- atomic_uint_fast16_t _Atomic uint_fast16_t
- atomic_int_fast32_t _Atomic int_fast32_t
- atomic_uint_fast32_t _Atomic uint_fast32_t
- atomic_int_fast64_t _Atomic int_fast64_t
- atomic_uint_fast64_t _Atomic uint_fast64_t
- atomic_intptr_t _Atomic intptr_t
- atomic_uintptr_t _Atomic uintptr_t
- atomic_size_t _Atomic size_t
- atomic_ptrdiff_t _Atomic ptrdiff_t
- atomic_intmax_t _Atomic intmax_t
- atomic_uintmax_t _Atomic uintmax_t
+ Atomic type name Direct type
+
+ atomic_bool _Atomic _Bool
+ atomic_char _Atomic char
+ atomic_schar _Atomic signed char
+ atomic_uchar _Atomic unsigned char
+ atomic_short _Atomic short
+ atomic_ushort _Atomic unsigned short
+ atomic_int _Atomic int
+ atomic_uint _Atomic unsigned int
+ atomic_long _Atomic long
+ atomic_ulong _Atomic unsigned long
+ atomic_llong _Atomic long long
+ atomic_ullong _Atomic unsigned long long
+ atomic_char16_t _Atomic char16_t
+ atomic_char32_t _Atomic char32_t
+ atomic_wchar_t _Atomic wchar_t
+ atomic_int_least8_t _Atomic int_least8_t
+ atomic_uint_least8_t _Atomic uint_least8_t
+ atomic_int_least16_t _Atomic int_least16_t
+ atomic_uint_least16_t _Atomic uint_least16_t
+ atomic_int_least32_t _Atomic int_least32_t
+ atomic_uint_least32_t _Atomic uint_least32_t
+ atomic_int_least64_t _Atomic int_least64_t
+ atomic_uint_least64_t _Atomic uint_least64_t
+ atomic_int_fast8_t _Atomic int_fast8_t
+ atomic_uint_fast8_t _Atomic uint_fast8_t
+ atomic_int_fast16_t _Atomic int_fast16_t
+ atomic_uint_fast16_t _Atomic uint_fast16_t
+ atomic_int_fast32_t _Atomic int_fast32_t
+ atomic_uint_fast32_t _Atomic uint_fast32_t
+ atomic_int_fast64_t _Atomic int_fast64_t
+ atomic_uint_fast64_t _Atomic uint_fast64_t
+ atomic_intptr_t _Atomic intptr_t
+ atomic_uintptr_t _Atomic uintptr_t
+ atomic_size_t _Atomic size_t
+ atomic_ptrdiff_t _Atomic ptrdiff_t
+ atomic_intmax_t _Atomic intmax_t
+ atomic_uintmax_t _Atomic uintmax_t
</pre>
<p><a name="7.17.6p2" href="#7.17.6p2"><small>2</small></a>
- The semantics of the operations on these types are defined in <a href="#7.17.7">7.17.7</a>. *
+ The semantics of the operations on these types are defined in <a href="#7.17.7">7.17.7</a>.
<!--page 300 -->
<p><a name="7.17.6p3" href="#7.17.6p3"><small>3</small></a>
NOTE The representation of atomic integer types need not have the same size as their corresponding
<h5><a name="7.17.7.5" href="#7.17.7.5">7.17.7.5 The atomic_fetch and modify generic functions</a></h5>
<p><a name="7.17.7.5p1" href="#7.17.7.5p1"><small>1</small></a>
The following operations perform arithmetic and bitwise computations. All of these
- operations are applicable to an object of any atomic integer type. None of these *
+ operations are applicable to an object of any atomic integer type. None of these
operations is applicable to atomic_bool. The key, operator, and computation
correspondence is:
- key op computation
- add + addition
- sub - subtraction
- or | bitwise inclusive or
- xor ^ bitwise exclusive or
- and & bitwise and
+<table border=1>
+<tr><th> key <th>op <th>computation
+<tr><td> add <td>+ <td>addition
+<tr><td> sub <td>- <td>subtraction
+<tr><td> or <td>| <td>bitwise inclusive or
+<tr><td> xor <td>^ <td>bitwise exclusive or
+<tr><td> and <td>& <td>bitwise and
+</table>
<p><b>Synopsis</b>
<p><a name="7.17.7.5p2" href="#7.17.7.5p2"><small>2</small></a>
<pre>
#include <a href="#7.17"><stdatomic.h></a>
- C atomic_fetch_key(volatile A *object, M operand);
- C atomic_fetch_key_explicit(volatile A *object,
+ C atomic_fetch_<i>key</i>(volatile A *object, M operand);
+ C atomic_fetch_<i>key</i>_explicit(volatile A *object,
M operand, memory_order order);
</pre>
<p><b>Description</b>
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.20.1.1" href="#7.20.1.1">7.20.1.1 Exact-width integer types</a></h5>
<p><a name="7.20.1.1p1" href="#7.20.1.1p1"><small>1</small></a>
- The typedef name intN_t designates a signed integer type with width N , no padding
+ The typedef name int<i>N</i>_t designates a signed integer type with width N , no padding
bits, and a two's complement representation. Thus, int8_t denotes such a signed
integer type with a width of exactly 8 bits.
<p><a name="7.20.1.1p2" href="#7.20.1.1p2"><small>2</small></a>
- The typedef name uintN_t designates an unsigned integer type with width N and no
+ The typedef name uint<i>N</i>_t designates an unsigned integer type with width N and no
padding bits. Thus, uint24_t denotes such an unsigned integer type with a width of
exactly 24 bits.
<p><a name="7.20.1.1p3" href="#7.20.1.1p3"><small>3</small></a>
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.20.1.2" href="#7.20.1.2">7.20.1.2 Minimum-width integer types</a></h5>
<p><a name="7.20.1.2p1" href="#7.20.1.2p1"><small>1</small></a>
- The typedef name int_leastN_t designates a signed integer type with a width of at
+ The typedef name int_least<i>N</i>_t designates a signed integer type with a width of at
least N , such that no signed integer type with lesser size has at least the specified width.
Thus, int_least32_t denotes a signed integer type with a width of at least 32 bits.
<p><a name="7.20.1.2p2" href="#7.20.1.2p2"><small>2</small></a>
- The typedef name uint_leastN_t designates an unsigned integer type with a width
+ The typedef name uint_least<i>N</i>_t designates an unsigned integer type with a width
of at least N , such that no unsigned integer type with lesser size has at least the specified
width. Thus, uint_least16_t denotes an unsigned integer type with a width of at
least 16 bits.
Each of the following types designates an integer type that is usually fastest<sup><a href="#note262"><b>262)</b></a></sup> to operate
with among all integer types that have at least the specified width.
<p><a name="7.20.1.3p2" href="#7.20.1.3p2"><small>2</small></a>
- The typedef name int_fastN_t designates the fastest signed integer type with a width
- of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer
+ The typedef name int_fast<i>N</i>_t designates the fastest signed integer type with a width
+ of at least N . The typedef name uint_fast<i>N</i>_t designates the fastest unsigned integer
type with a width of at least N .
<ul>
<li> minimum values of exact-width signed integer types
<pre>
- INTN_MIN exactly -(2 N -1 )
+ INT<i>N</i>_MIN exactly -(2<sup>N-1</sup>)
</pre>
<li> maximum values of exact-width signed integer types
<pre>
- INTN_MAX exactly 2 N -1 - 1
+ INT<i>N</i>_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>
+ UINT<i>N</i>_MAX exactly 2<sup>N</sup> - 1
+</pre>
</ul>
<p><small><a href="#Contents">Contents</a></small>
<ul>
<li> minimum values of minimum-width signed integer types
<pre>
- INT_LEASTN_MIN -(2 N -1 - 1)
+ INT_LEAST<i>N</i>_MIN -(2<sup>N-1</sup> - 1)
</pre>
<li> maximum values of minimum-width signed integer types
<pre>
- INT_LEASTN_MAX 2 N -1 - 1
+ INT_LEAST<i>N</i>_MAX 2<sup>N-1</sup> - 1
</pre>
<li> maximum values of minimum-width unsigned integer types
- UINT_LEASTN_MAX 2N - 1
+<pre>
+ UINT_LEAST<i>N</i>_MAX 2<sup>N</sup> - 1
+</pre>
</ul>
<p><small><a href="#Contents">Contents</a></small>
<ul>
<li> minimum values of fastest minimum-width signed integer types
<pre>
- INT_FASTN_MIN -(2 N -1 - 1)
+ INT_FAST<i>N</i>_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_FAST<i>N</i>_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_FAST<i>N</i>_MAX 2<sup>N</sup> - 1
+</pre>
</ul>
<p><small><a href="#Contents">Contents</a></small>
<ul>
<li> minimum value of pointer-holding signed integer type
<pre>
- INTPTR_MIN -(215 - 1)
+ INTPTR_MIN -(2<sup>15</sup> - 1)
</pre>
<li> maximum value of pointer-holding signed integer type
- 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
-<!--page 311 -->
+<pre>
+ UINTPTR_MAX 2<sup>16</sup> - 1
+</pre>
</ul>
+<!--page 311 -->
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.20.2.5" href="#7.20.2.5">7.20.2.5 Limits of greatest-width integer types</a></h5>
<p><a name="7.20.2.5p1" href="#7.20.2.5p1"><small>1</small></a>
<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>
<p><small><a href="#Contents">Contents</a></small>
actually provides.<sup><a href="#note263"><b>263)</b></a></sup>
<ul>
<li> limits of ptrdiff_t
+<pre>
PTRDIFF_MIN -65535
PTRDIFF_MAX +65535
+</pre>
<li> limits of sig_atomic_t
+<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
+<pre>
WCHAR_MIN see below
WCHAR_MAX see below
+</pre>
<li> limits of wint_t
-
-
-
-
<!--page 312 -->
- WINT_MIN see below
- WINT_MAX see below
+<pre>
+ WINT_MIN see below
+ WINT_MAX see below
+</pre>
</ul>
<p><a name="7.20.3p3" href="#7.20.3p3"><small>3</small></a>
If sig_atomic_t (see <a href="#7.14">7.14</a>) is defined as a signed integer type, the value of
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="7.20.4.1" href="#7.20.4.1">7.20.4.1 Macros for minimum-width integer constants</a></h5>
<p><a name="7.20.4.1p1" href="#7.20.4.1p1"><small>1</small></a>
- The macro INTN_C(value) shall expand to an integer constant expression
- corresponding to the type int_leastN_t. The macro UINTN_C(value) shall expand
- to an integer constant expression corresponding to the type uint_leastN_t. For
+ The macro INT<i>N</i>_C(value) shall expand to an integer constant expression
+ corresponding to the type int_least<i>N</i>_t. The macro UINT<i>N</i>_C(value) shall expand
+ to an integer constant expression corresponding to the type uint_least<i>N</i>_t. For
example, if uint_least64_t is a name for the type unsigned long long int,
then UINT64_C(0x123) might expand to the integer constant 0x123ULL.
<!--page 319 -->
<p><a name="7.21.3p7" href="#7.21.3p7"><small>7</small></a>
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
<p><a name="7.21.5.3p3" href="#7.21.5.3p3"><small>3</small></a>
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="#note271"><b>271)</b></a></sup>
- r open text file for reading
- w truncate to zero length or create text file for writing
- wx 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
-
-
+<dl>
+<dt> r <dd>open text file for reading
+<dt> w <dd>truncate to zero length or create text file for writing
+<dt> wx <dd>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
<!--page 324 -->
- wbx 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
- w+x create text file for update
- a+ append; open or create text file for update, writing at end-of-file
- 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
- w+bx or wb+x create binary file for update
- a+b or ab+ append; open or create binary file for update, writing at end-of-file
+<dt> wbx <dd>create binary file for writing
+<dt> ab <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> w+x <dd>create text file for update
+<dt> a+ <dd>append; open or create text 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> w+bx or wb+x <dd>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><a name="7.21.5.3p4" href="#7.21.5.3p4"><small>4</small></a>
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><a name="7.21.6.1p6" href="#7.21.6.1p6"><small>6</small></a>
The flag characters and their meanings are:
- - The result of the conversion is left-justified within the field. (It is right-justified if
-<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.)
-</pre>
- + The result of a signed conversion always begins with a plus or minus sign. (It
-<pre>
+<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="#note276"><b>276)</b></a></sup>
-</pre>
- space If the first character of a signed conversion is not a sign, or if a signed conversion
-<pre>
+<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>
+<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,
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
-<pre>
+<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
-</pre>
-
-
<!--page 329 -->
-<pre>
conversions, if a precision is specified, the 0 flag is ignored. For other
conversions, the behavior is undefined.
-</pre>
+</dl>
<p><a name="7.21.6.1p7" href="#7.21.6.1p7"><small>7</small></a>
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>
+<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>
+<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>
+<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>
+<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>
+<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
+<dt> t <dd>Specifies that a following d, i, o, u, x, or X conversion specifier applies to a
<!--page 330 -->
-<pre>
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>
+<dt> L <dd>Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
applies to a long double argument.
-</pre>
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><a name="7.21.6.1p8" href="#7.21.6.1p8"><small>8</small></a>
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
-<pre>
+<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 characters.
-</pre>
- f,F A double argument representing a floating-point number is converted to
-<pre>
+<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
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="#note277"><b>277)</b></a></sup>
-</pre>
- e,E A double argument representing a floating-point number is converted in the
-<pre>
+<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
-</pre>
-
-
<!--page 331 -->
-<pre>
6; if the precision is zero and the # flag is not specified, no decimal-point
character appears. The value is rounded to the appropriate number of digits.
The E conversion specifier produces a number with E instead of e
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>
+<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 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>
+<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="#note278"><b>278)</b></a></sup> and the number
missing and FLT_RADIX is a power of 2, then the precision is sufficient 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
-</pre>
-
-
-
-
<!--page 332 -->
-<pre>
distinguish<sup><a href="#note279"><b>279)</b></a></sup> values of type double, except that trailing zeros may be
omitted; if the precision is zero and the # flag is not specified, no decimal-
point character appears. The letters abcdef are used for a conversion and
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>
+<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>
+<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="#note280"><b>280)</b></a></sup> Characters from the array are
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
character. If a precision is specified, no more than that many bytes are
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
-</pre>
-
<!--page 333 -->
-<pre>
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="#note281"><b>281)</b></a></sup>
-</pre>
- p The argument shall be a pointer to void. The value of the pointer is
-<pre>
+<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>
+<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
-<pre>
+<dt> % <dd>A % character is written. No argument is converted. The complete
conversion specification shall be %%.
-</pre>
+</dl>
<p><a name="7.21.6.1p9" href="#7.21.6.1p9"><small>9</small></a>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note282"><b>282)</b></a></sup> If any argument is
not the correct type for the corresponding conversion specification, the behavior is
<p><a name="7.21.6.1p17" href="#7.21.6.1p17"><small>17</small></a>
EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the
members of the extended character set that consist of more than one byte each consist of exactly two bytes,
- the first of which is denoted here by a and the second by an uppercase letter.
+ the first of which is denoted here by a # and the second by an uppercase letter.
<p><a name="7.21.6.1p18" href="#7.21.6.1p18"><small>18</small></a>
Given the following wide string with length seven,
<pre>
- static wchar_t wstr[] = L" X Yabc Z W";
+ static wchar_t wstr[] = L"#X#Yabc#Z#W";
</pre>
the seven calls
<pre>
- fprintf(stdout, "|1234567890123|\n");
- fprintf(stdout, "|%13ls|\n", wstr);
- fprintf(stdout, "|%-13.9ls|\n", wstr);
- fprintf(stdout, "|%13.10ls|\n", wstr);
- fprintf(stdout, "|%13.11ls|\n", wstr);
- fprintf(stdout, "|%13.15ls|\n", &wstr[2]);
- fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
+ fprintf(stdout, "|1234567890123|\n");
+ fprintf(stdout, "|%13ls|\n", wstr);
+ fprintf(stdout, "|%-13.9ls|\n", wstr);
+ fprintf(stdout, "|%13.10ls|\n", wstr);
+ fprintf(stdout, "|%13.11ls|\n", wstr);
+ fprintf(stdout, "|%13.15ls|\n", &wstr[2]);
+ fprintf(stdout, "|%13lc|\n", (wint_t) wstr[5]);
</pre>
will print the following seven lines:
<pre>
|1234567890123|
- | X Yabc Z W|
- | X Yabc Z |
- | X Yabc Z|
- | X Yabc Z W|
- | abc Z W|
- | Z|
+ | #X#Yabc#Z#W|
+ |#X#Yabc#Z |
+ | #X#Yabc#Z|
+ | #X#Yabc#Z#W|
+ | abc#Z#W|
+ | #Z|
</pre>
<p><b> Forward references</b>: conversion state (<a href="#7.29.6">7.29.6</a>), the wcrtomb function (<a href="#7.29.6.3.3">7.29.6.3.3</a>).
in the object, the behavior is undefined.
<p><a name="7.21.6.2p11" href="#7.21.6.2p11"><small>11</small></a>
The length modifiers and their meanings are:
- hh 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.
-</pre>
- h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<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>
+<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>
+<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>
-
-
-
<!--page 337 -->
- j Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<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.
-</pre>
- z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<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>
+<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>
+<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.
-</pre>
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><a name="7.21.6.2p12" href="#7.21.6.2p12"><small>12</small></a>
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
-<pre>
+<dt> i <dd>Matches an optionally signed integer, whose format is the same as expected
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>
+<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>
+<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>
+<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
+<dt> a,e,f,g <dd>Matches an optionally signed floating-point number, infinity, or NaN, whose
<!--page 338 -->
-<pre>
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>
+<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="#note286"><b>286)</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
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.<sup><a href="#note286"><b>286)</b></a></sup>
-<pre>
+<dt> s <dd>Matches a sequence of non-white-space characters.<sup><a href="#note286"><b>286)</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.
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>
+<dt> [ <dd>Matches a nonempty sequence of characters from a set of expected characters
(the scanset).<sup><a href="#note286"><b>286)</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
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
-</pre>
-
<!--page 339 -->
-<pre>
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
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
-<pre>
+<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 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>
+<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
-<pre>
+<dt> % <dd>Matches a single % character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
-</pre>
+</dl>
<p><a name="7.21.6.2p13" href="#7.21.6.2p13"><small>13</small></a>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note287"><b>287)</b></a></sup>
<p><a name="7.21.6.2p14" href="#7.21.6.2p14"><small>14</small></a>
#include <a href="#7.21"><stdio.h></a>
/* ... */
int n, i;
- n = sscanf("foo % bar 42", "foo%%bar%d", &i);
+ n = sscanf("foo % bar 42", "foo%%bar%d", &i);
</pre>
will assign to n the value 1 and to i the value 42 because input white-space characters are skipped for both
the % and d conversion specifiers.
<p><a name="7.21.6.2p23" href="#7.21.6.2p23"><small>23</small></a>
EXAMPLE 6 In these examples, multibyte characters do have a state-dependent encoding, and the
members of the extended character set that consist of more than one byte each consist of exactly two bytes,
- the first of which is denoted here by a and the second by an uppercase letter, but are only recognized as
- such when in the alternate shift state. The shift sequences are denoted by (uparrow) and (downarrow), in which the first causes
+ the first of which is denoted here by a # and the second by an uppercase letter, but are only recognized as
+ such when in the alternate shift state. The shift sequences are denoted by ^ and $, in which the first causes
entry into the alternate shift state.
<p><a name="7.21.6.2p24" href="#7.21.6.2p24"><small>24</small></a>
After the call:
</pre>
with the input line:
<pre>
- a(uparrow) X Y(downarrow) bc
+ a^#X#Y$ bc
</pre>
- str will contain (uparrow) X Y(downarrow)\0 assuming that none of the bytes of the shift sequences (or of the multibyte
+ str will contain ^#X#Y$\0 assuming that none of the bytes of the shift sequences (or of the multibyte
characters, in the more general case) appears to be a single-byte white-space character.
<p><a name="7.21.6.2p25" href="#7.21.6.2p25"><small>25</small></a>
In contrast, after the call:
wchar_t wstr[50];
fscanf(stdin, "a%ls", wstr);
</pre>
- with the same input line, wstr will contain the two wide characters that correspond to X and Y and a
+ with the same input line, wstr will contain the two wide characters that correspond to #X and #Y and a
terminating null wide character.
<p><a name="7.21.6.2p26" href="#7.21.6.2p26"><small>26</small></a>
However, the call:
#include <a href="#7.19"><stddef.h></a>
/* ... */
wchar_t wstr[50];
- fscanf(stdin, "a(uparrow) X(downarrow)%ls", wstr);
+ fscanf(stdin, "a^#X$%ls", wstr);
</pre>
- with the same input line will return zero due to a matching failure against the (downarrow) sequence in the format
+ with the same input line will return zero due to a matching failure against the $ sequence in the format
string.
<p><a name="7.21.6.2p27" href="#7.21.6.2p27"><small>27</small></a>
- Assuming that the first byte of the multibyte character X is the same as the first byte of the multibyte
- character Y, after the call:
+ Assuming that the first byte of the multibyte character #X is the same as the first byte of the multibyte
+ character #Y, after the call:
<pre>
#include <a href="#7.21"><stdio.h></a>
#include <a href="#7.19"><stddef.h></a>
/* ... */
wchar_t wstr[50];
- fscanf(stdin, "a(uparrow) Y(downarrow)%ls", wstr);
+ fscanf(stdin, "a^#Y$%ls", wstr);
</pre>
with the same input line, zero will again be returned, but stdin will be left with a partially consumed
multibyte character.
<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
<!--page 394 -->
<pre>
macro use invokes
+
exp(n) exp(n), the function
acosh(f) acoshf(f)
sin(d) sin(d), the function
<p><a name="7.26.4.2p2" href="#7.26.4.2p2"><small>2</small></a>
The mtx_init function creates a mutex object with properties indicated by type,
which must have one of the six values:
- mtx_plain for a simple non-recursive mutex,
- mtx_timed for a non-recursive mutex that supports timeout, *
- mtx_plain | mtx_recursive for a simple recursive mutex, or
- mtx_timed | mtx_recursive for a recursive mutex that supports timeout.
+<dl>
+<dt> mtx_plain <dd>for a simple non-recursive mutex,
+<dt> mtx_timed <dd>for a non-recursive mutex that supports timeout,
+<dt> mtx_plain | mtx_recursive <dd>for a simple recursive mutex, or
+<dt> mtx_timed | mtx_recursive <dd>for a recursive mutex that supports timeout.
+</dl>
<p><a name="7.26.4.2p3" href="#7.26.4.2p3"><small>3</small></a>
If the mtx_init function succeeds, it sets the mutex pointed to by mtx to a value that
uniquely identifies the newly created mutex.
on the same mutex shall synchronize with this operation.
<p><b>Returns</b>
<p><a name="7.26.4.3p3" href="#7.26.4.3p3"><small>3</small></a>
- The mtx_lock function returns thrd_success on success, or thrd_error if the *
+ The mtx_lock function returns thrd_success on success, or thrd_error if the
request could not be honored.
<p><small><a href="#Contents">Contents</a></small>
</pre>
<p><b>Description</b>
<p><a name="7.26.4.5p2" href="#7.26.4.5p2"><small>2</small></a>
- The mtx_trylock function endeavors to lock the mutex pointed to by mtx. If the *
+ The mtx_trylock function endeavors to lock the mutex pointed to by mtx. If the
mutex is already locked, the function returns without blocking. If the operation succeeds,
prior calls to mtx_unlock on the same mutex shall synchronize with this operation.
<p><b>Returns</b>
<p><b>Returns</b>
<p><a name="7.26.6.4p3" href="#7.26.6.4p3"><small>3</small></a>
The tss_set function returns thrd_success on success or thrd_error if the
- request could not be honored. *
+ request could not be honored.
<!--page 406 -->
<p><small><a href="#Contents">Contents</a></small>
Saving Time, which is a temporary change in the algorithm for determining local time.
The local time zone and Daylight Saving Time are implementation-defined.
<p><a name="7.27.1p2" href="#7.27.1p2"><small>2</small></a>
- The macros defined are NULL (described in <a href="#7.19">7.19</a>); *
+ The macros defined are NULL (described in <a href="#7.19">7.19</a>);
<pre>
CLOCKS_PER_SEC
</pre>
Sun Sep 16 01:03:52 1973\n\0
</pre>
using the equivalent of the following algorithm.
- char *asctime(const struct tm *timeptr)
- {
<pre>
- static const char wday_name[7][3] = {
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
- };
- static const char mon_name[12][3] = {
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
- };
- static char result[26];
-</pre>
-
-
-
+ char *asctime(const struct tm *timeptr)
+ {
+ static const char wday_name[7][3] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+ };
+ static const char mon_name[12][3] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+ };
+ static char result[26];
<!--page 411 -->
-<pre>
sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
wday_name[timeptr->tm_wday],
mon_name[timeptr->tm_mon],
timeptr->tm_min, timeptr->tm_sec,
1900 + timeptr->tm_year);
return result;
+ }
</pre>
- }
<p><a name="7.27.3.1p3" href="#7.27.3.1p3"><small>3</small></a>
If any of the members of the broken-down time contain values that are outside their
normal ranges,<sup><a href="#note323"><b>323)</b></a></sup> the behavior of the asctime function is undefined. Likewise, if the
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>
+<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.27.1">7.27.1</a>]
-</pre>
- %C is replaced by the year divided by 100 and truncated to an integer, as a decimal
-<pre>
+<dt> %C <dd>is replaced by the year divided by 100 and truncated to an integer, as a decimal
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>
+<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]
-</pre>
- %F is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
-<pre>
+<dt> %F <dd>is equivalent to ''%Y-%m-%d'' (the ISO 8601 date format). [tm_year, tm_mon,
tm_mday]
-</pre>
- %g is replaced by the last 2 digits of the week-based year (see below) as a decimal
-<pre>
+<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]
-</pre>
- %G is replaced by the week-based year (see below) as a decimal number (e.g., 1997).
-<pre>
+<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]
-</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>
+<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]
-</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,
-<pre>
+<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,
tm_sec]
-</pre>
- %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
-<pre>
+<dt> %u <dd>is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
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>
+<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]
-</pre>
- %V is replaced by the ISO 8601 week number (see below) as a decimal number
+<dt> %V <dd>is replaced by the ISO 8601 week number (see below) as a decimal number
<!--page 414 -->
-<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>
+<dt> %w <dd>is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
[tm_wday]
-</pre>
- %W is replaced by the week number of the year (the first Monday as the first day of
-<pre>
+<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]
-</pre>
- %x is replaced by the locale's appropriate date representation. [all specified in <a href="#7.27.1">7.27.1</a>]
- %X is replaced by the locale's appropriate time representation. [all specified in <a href="#7.27.1">7.27.1</a>]
- %y is replaced by the last 2 digits of the year as a decimal number (00-99).
-<pre>
+<dt> %x <dd>is replaced by the locale's appropriate date representation. [all specified in <a href="#7.27.1">7.27.1</a>]
+<dt> %X <dd>is replaced by the locale's appropriate time representation. [all specified in <a href="#7.27.1">7.27.1</a>]
+<dt> %y <dd>is replaced by the last 2 digits of the year as a decimal number (00-99).
[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>
+<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>
+<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]
-</pre>
- %% is replaced by %.
+<dt> %% <dd>is replaced by %.
+</dl>
<p><a name="7.27.3.5p4" href="#7.27.3.5p4"><small>4</small></a>
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>
+<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.
-</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>
+<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.
-</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>
+<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>
+<dt> %Oe <dd>is replaced by the day of the month, using the locale's alternative numeric symbols
(filled as needed with leading spaces).
-</pre>
- %OH is replaced by the hour (24-hour clock), using the locale's alternative numeric
-<pre>
+<dt> %OH <dd>is replaced by the hour (24-hour clock), using the locale's alternative numeric
symbols.
-</pre>
- %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric
-<pre>
+<dt> %OI <dd>is replaced by the hour (12-hour clock), using the locale's alternative numeric
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
+<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
<!--page 415 -->
-<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>
+<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.
-</pre>
- %Ow is replaced by the weekday as a number, using the locale's alternative numeric
-<pre>
+<dt> %Ow <dd>is replaced by the weekday as a number, using the locale's alternative numeric
symbols.
-</pre>
- %OW is replaced by the week number of the year, using the locale's alternative numeric
-<pre>
+<dt> %OW <dd>is replaced by the week number of the year, using the locale's alternative numeric
symbols.
-</pre>
- %Oy is replaced by the last 2 digits of the year, using the locale's alternative numeric
-<pre>
+<dt> %Oy <dd>is replaced by the last 2 digits of the year, using the locale's alternative numeric
symbols.
-</pre>
+</dl>
<p><a name="7.27.3.5p5" href="#7.27.3.5p5"><small>5</small></a>
%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,
<p><a name="7.27.3.5p7" href="#7.27.3.5p7"><small>7</small></a>
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>
<p><b>Returns</b>
<p><a name="7.27.3.5p8" href="#7.27.3.5p8"><small>8</small></a>
If the total number of resulting characters including the terminating null character is not
<p><a name="7.28.1.1p4" href="#7.28.1.1p4"><small>4</small></a>
The mbrtoc16 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>
+<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).
-</pre>
- between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
-<pre>
+<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)(-3) if the next character resulting from a previous call has been stored (no
-<pre>
+<dt> (size_t)(-3) <dd>if the next character resulting from a previous call has been stored (no
bytes from the input have been consumed by this call).
-</pre>
- (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
-<pre>
+<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="#note324"><b>324)</b></a></sup>
-</pre>
- (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
-<pre>
+<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>
+</dl>
<p><b>Footnotes</b>
<p><small><a name="note324" href="#note324">324)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
<p><a name="7.28.1.3p4" href="#7.28.1.3p4"><small>4</small></a>
The mbrtoc32 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>
+<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).
-</pre>
- between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
+<dt> between 1 and n inclusive <dd>if the next n or fewer bytes complete a valid multibyte
<!--page 419 -->
-<pre>
character (which is the value stored); the value returned is the number
of bytes that complete the multibyte character.
-</pre>
- (size_t)(-3) if the next character resulting from a previous call has been stored (no
-<pre>
+<dt> (size_t)(-3) <dd>if the next character resulting from a previous call has been stored (no
bytes from the input have been consumed by this call).
-</pre>
- (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
-<pre>
+<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="#note325"><b>325)</b></a></sup>
-</pre>
- (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
-<pre>
+<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>
+</dl>
<p><b>Footnotes</b>
<p><small><a name="note325" href="#note325">325)</a> When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
precision were omitted.
<p><a name="7.29.2.1p6" href="#7.29.2.1p6"><small>6</small></a>
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>
+<dl>
+<dt> - <dd>The result of the conversion is left-justified within the field. (It is right-justified if
this flag is not specified.)
-</pre>
- + The result of a signed conversion always begins with a plus or minus sign. (It
-<pre>
+<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
-</pre>
-
-
-
-
<!--page 423 -->
-<pre>
specified.)<sup><a href="#note331"><b>331)</b></a></sup>
-</pre>
- space If the first wide character of a signed conversion is not a sign, or if a signed
-<pre>
+<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>
+<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,
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
-<pre>
+<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>
+</dl>
<p><a name="7.29.2.1p7" href="#7.29.2.1p7"><small>7</small></a>
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>
+<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>
+<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>
-
-
<!--page 424 -->
-<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>
+<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>
+<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>
+<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>
+<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>
+<dt> L <dd>Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
applies to a long double argument.
-</pre>
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><a name="7.29.2.1p8" href="#7.29.2.1p8"><small>8</small></a>
The conversion specifiers and their meanings are:
- d,i The int argument is converted to signed decimal in the style [-]dddd. The
-<pre>
+<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
+<dt> o,u,x,X <dd>The unsigned int argument is converted to unsigned octal (o), unsigned
<!--page 425 -->
-<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 wide characters.
-</pre>
- f,F A double argument representing a floating-point number is converted to
-<pre>
+<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 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
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="#note332"><b>332)</b></a></sup>
-</pre>
- e,E A double argument representing a floating-point number is converted in the
-<pre>
+<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
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>
+<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
-</pre>
-
-
<!--page 426 -->
-<pre>
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>
+<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="#note333"><b>333)</b></a></sup> and the
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>
+<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>
+<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
described by an mbstate_t object initialized to zero before the first
multibyte character is converted, and written up to (but not including) the
-</pre>
-
<!--page 427 -->
-<pre>
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 converted array, the converted array shall contain a
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>
+<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-
defined manner.
-</pre>
- n The argument shall be a pointer to signed integer into which is written the
-<pre>
+<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
-<pre>
+<dt> % <dd>A % wide character is written. No argument is converted. The complete
conversion specification shall be %%.
-</pre>
+</dl>
<p><a name="7.29.2.1p9" href="#7.29.2.1p9"><small>9</small></a>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note335"><b>335)</b></a></sup> If any argument is
not the correct type for the corresponding conversion specification, the behavior is
represented in the object, the behavior is undefined.
<p><a name="7.29.2.2p11" href="#7.29.2.2p11"><small>11</small></a>
The length modifiers and their meanings are:
- hh 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.
-</pre>
- h Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<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>
+<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>
+<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>
+<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.
-</pre>
- z Specifies that a following d, i, o, u, x, X, or n conversion specifier applies
-<pre>
+<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>
+<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>
-
-
<!--page 431 -->
- L Specifies that a following a, A, e, E, f, F, g, or G conversion specifier
-<pre>
+<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.
-</pre>
+</dl>
If a length modifier appears with any conversion specifier other than as specified above,
the behavior is undefined.
<p><a name="7.29.2.2p12" href="#7.29.2.2p12"><small>12</small></a>
The conversion specifiers and their meanings are:
- d Matches an optionally signed decimal integer, whose format is the same as
-<pre>
+<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
-<pre>
+<dt> i <dd>Matches an optionally signed integer, whose format is the same as expected
for the subject sequence of the wcstol function with the value 0 for the
base argument. The corresponding argument shall be a pointer to signed
integer.
-</pre>
- o Matches an optionally signed octal integer, whose format is the same as
-<pre>
+<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>
+<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>
+<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>
+<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
-<!--page 432 -->
-<pre>
+<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
shall be a pointer to the initial element of a character array large enough to
accept the sequence. No null character is added.
If an l length modifier is present, the corresponding argument shall be a
+<!--page 432 -->
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.
-<pre>
+<dt> s <dd>Matches a sequence of non-white-space wide characters.
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
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
-<!--page 433 -->
-<pre>
+<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
+<!--page 433 -->
last character, the behavior is implementation-defined.
-</pre>
- p Matches an implementation-defined set of sequences, which should be the
-<pre>
+<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
-<pre>
+<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 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
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
-<pre>
+<dt> % <dd>Matches a single % wide character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
-</pre>
+</dl>
<p><a name="7.29.2.2p13" href="#7.29.2.2p13"><small>13</small></a>
If a conversion specification is invalid, the behavior is undefined.<sup><a href="#note339"><b>339)</b></a></sup>
<p><a name="7.29.2.2p14" href="#7.29.2.2p14"><small>14</small></a>
<p><a name="7.29.6.3.2p4" href="#7.29.6.3.2p4"><small>4</small></a>
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>
+<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).
-</pre>
- between 1 and n inclusive if the next n or fewer bytes complete a valid multibyte
-<pre>
+<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>
+<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="#note349"><b>349)</b></a></sup>
-</pre>
- (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes
-<pre>
+<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>
+</dl>
<!--page 462 -->
<h4><a name="A.1.2" href="#A.1.2">A.1.2 Keywords</a></h4>
(<a href="#6.4.1">6.4.1</a>) keyword: one of
<pre>
- auto * if unsigned
+ auto if unsigned
break inline void
case int volatile
char long while
</pre>
(<a href="#6.4.2.1">6.4.2.1</a>) nondigit: one of
<pre>
- _ a b c d e f g h i j k l m
- n o p q r s t u v w x y z
- A B C D E F G H I J K L M
- N O P Q R S T U V W X Y Z
+ _ a b c d e f g h i j k l m
+ n o p q r s t u v w x y z
+ A B C D E F G H I J K L M
+ N O P Q R S T U V W X Y Z
</pre>
(<a href="#6.4.2.1">6.4.2.1</a>) digit: one of
<!--page 478 -->
<pre>
- 0 1 2 3 4 5 6 7 8 9
+ 0 1 2 3 4 5 6 7 8 9
</pre>
<p><small><a href="#Contents">Contents</a></small>
ATOMIC_FLAG_INIT atomic_int_least16_t
memory_order atomic_uint_least16_t
atomic_flag atomic_int_least32_t
- memory_order_relaxed * atomic_uint_least32_t
+ memory_order_relaxed atomic_uint_least32_t
memory_order_consume atomic_int_least64_t
memory_order_acquire atomic_uint_least64_t
memory_order_release atomic_int_fast8_t
<!--page 514 -->
<pre>
thread_local once_flag
- ONCE_FLAG_INIT mtx_plain *
+ ONCE_FLAG_INIT mtx_plain
TSS_DTOR_ITERATIONS mtx_recursive
cnd_t mtx_timed
thrd_t thrd_timedout
<p><small><a href="#Contents">Contents</a></small>
<h4><a name="F.9.2" href="#F.9.2">F.9.2 Expression transformations</a></h4>
<p><a name="F.9.2p1" href="#F.9.2p1"><small>1</small></a>
- x/2 <-> x x 0.5 Although similar transformations involving inexact constants
-<pre>
+<table border=1>
+<tr><td><pre> x/2 <-> x * 0.5 </pre><td>Although similar transformations involving inexact constants
generally do not yield numerically equivalent expressions, if the
constants are exact then such transformations can be made on
IEC 60559 machines and others that round perfectly.
-</pre>
- 1 x x and x/1 -> x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
-<pre>
+<tr><td><pre> 1 * x and x/1 -> x </pre><td>The expressions 1*x, x/1, and x are equivalent (on IEC 60559
machines, among others).<sup><a href="#note368"><b>368)</b></a></sup>
-</pre>
- x/x -> 1.0 The expressions x/x and 1.0 are not equivalent if x can be zero,
-<pre>
+<tr><td><pre> x/x -> 1.0 </pre><td>The expressions x/x and 1.0 are not equivalent if x can be zero,
infinite, or NaN.
-</pre>
- x - y <-> x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on
-<pre>
+<tr><td><pre> x - y <-> x + (-y) </pre><td>The expressions x - y, x + (-y), and (-y) + x are equivalent (on
IEC 60559 machines, among others).
-</pre>
- x - y <-> -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1
-<pre>
+<tr><td><pre> x - y <-> -(y - x) </pre><td>The expressions x - y and -(y - x) are not equivalent because 1 - 1
is +0 but -(1 - 1) is -0 (in the default rounding direction).<sup><a href="#note369"><b>369)</b></a></sup>
-</pre>
- x - x -> 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or
-<pre>
+<tr><td><pre> x - x -> 0.0 </pre><td>The expressions x - x and 0.0 are not equivalent if x is a NaN or
infinite.
-</pre>
- 0 x x -> 0.0 The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
-<pre>
+<tr><td><pre> 0 * x -> 0.0 </pre><td>The expressions 0*x and 0.0 are not equivalent if x is a NaN,
infinite, or -0.
-</pre>
- x+0-> x The expressions x + 0 and x are not equivalent if x is -0, because
-<pre>
+<tr><td><pre> x + 0 -> x </pre><td>The expressions x + 0 and x are not equivalent if x is -0, because
(-0) + (+0) yields +0 (in the default rounding direction), not -0.
-</pre>
- x-0-> x (+0) - (+0) yields -0 when rounding is downward (toward -(inf)), but
-<pre>
+<tr><td><pre> x - 0 -> x </pre><td>(+0) - (+0) yields -0 when rounding is downward (toward -(inf)), but
+0 otherwise, and (-0) - (+0) always yields -0; so, if the state of the
FENV_ACCESS pragma is ''off'', promising default rounding, then
the implementation can replace x - 0 by x, even if x might be zero.
-</pre>
- -x <-> 0 - x The expressions -x and 0 - x are not equivalent if x is +0, because
-<pre>
+<tr><td><pre> -x <-> 0 - x </pre><td>The expressions -x and 0 - x are not equivalent if x is +0, because
-(+0) yields -0, but 0 - (+0) yields +0 (unless rounding is
downward).
-</pre>
+</table>
<!--page 534 -->
Examples include:
<pre>
- 1/(1/ (+-) (inf)) is (+-) (inf)
+ 1/(1/(+-)(inf)) is (+-)(inf)
</pre>
and
<p><small><a href="#Contents">Contents</a></small>
<h4><a name="F.9.3" href="#F.9.3">F.9.3 Relational operators</a></h4>
<p><a name="F.9.3p1" href="#F.9.3p1"><small>1</small></a>
- x != x -> false The expression x != x is true if x is a NaN.
- x = x -> true The expression x = x is false if x is a NaN.
- x < y -> isless(x,y) (and similarly for <=, >, >=) Though numerically equal, these
-<pre>
+<table border=1>
+<tr><td><pre> x != x -> false </pre><td>The expression x != x is true if x is a NaN.
+<tr><td><pre> x == x -> true </pre><td>The expression x = x is false if x is a NaN.
+<tr><td><pre> x < y -> isless(x,y)</pre> (and similarly for <=, >, >=) <td>Though numerically equal, these
expressions are not equivalent because of side effects when x or y is a
NaN and the state of the FENV_ACCESS pragma is ''on''. This
transformation, which would be desirable if extra code were required
to cause the ''invalid'' floating-point exception for unordered cases,
could be performed provided the state of the FENV_ACCESS pragma
is ''off''.
-</pre>
+</table>
The sense of relational operators shall be maintained. This includes handling unordered
cases as expressed by the source code.
<p><a name="F.9.3p2" href="#F.9.3p2"><small>2</small></a>
<p><a name="G.5.1p2" href="#G.5.1p2"><small>2</small></a>
If the operands are not both complex, then the result and floating-point exception
behavior of the * operator is defined by the usual mathematical formula:
-<pre>
- * u iv u + iv
-</pre>
-
-<pre>
- x xu i(xv) (xu) + i(xv)
-</pre>
-
-<pre>
- iy i(yu) -yv (-yv) + i(yu)
-</pre>
-
-<pre>
- x + iy (xu) + i(yu) (-yv) + i(xv)
-</pre>
+<table border=1>
+<tr><td> * <td> u <td> iv <td> u + iv
+<tr><td> x <td> xu <td> i(xv) <td> (xu) + i(xv)
+<tr><td> iy <td> i(yu) <td> -yv <td> (-yv) + i(yu)
+<tr><td> x + iy <td> (xu) + i(yu) <td> (-yv) + i(xv) <td>
+</table>
<p><a name="G.5.1p3" href="#G.5.1p3"><small>3</small></a>
If the second operand is not complex, then the result and floating-point exception
behavior of the / operator is defined by the usual mathematical formula:
-<pre>
- / u iv
-</pre>
-
-<pre>
- x x/u i(-x/v)
-</pre>
-
-<pre>
- iy i(y/u) y/v
-</pre>
-
-<pre>
- x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
-</pre>
+<table border=1>
+<tr><td> / <td> u <td> iv
+<tr><td> x <td> x/u <td> i(-x/v)
+<tr><td> iy <td> i(y/u) <td> y/v
+<tr><td> x + iy <td> (x/u) + i(y/u) <td> (y/v) + i(-x/v)
+</table>
<p><a name="G.5.1p4" href="#G.5.1p4"><small>4</small></a>
The * and / operators satisfy the following infinity properties for all real, imaginary, and
complex operands:<sup><a href="#note377"><b>377)</b></a></sup>
<p><a name="G.5.2p2" href="#G.5.2p2"><small>2</small></a>
In all cases the result and floating-point exception behavior of a + or - operator is defined
by the usual mathematical formula:
-<pre>
- + or - u iv u + iv
-</pre>
-
-<pre>
- x x(+-)u x (+-) iv (x (+-) u) (+-) iv
-</pre>
-
-<pre>
- iy (+-)u + iy i(y (+-) v) (+-)u + i(y (+-) v)
-</pre>
-
-<pre>
- x + iy (x (+-) u) + iy x + i(y (+-) v) (x (+-) u) + i(y (+-) v)
-</pre>
+<table border=1>
+<tr><td> + or - <td> u <td> iv <td> u + iv
+<tr><td> x <td> x(+-)u <td> x (+-) iv <td> (x (+-) u) (+-) iv
+<tr><td> iy <td> (+-)u + iy <td> i(y (+-) v) <td> (+-)u + i(y (+-) v)
+<tr><td> x + iy <td> (x (+-) u) + iy <td> x + i(y (+-) v) <td> (x (+-) u) + i(y (+-) v)
+</table>
<p><small><a href="#Contents">Contents</a></small>
<h3><a name="G.6" href="#G.6">G.6 Complex arithmetic <complex.h></a></h3>
only integer divide-by-zero need be detected.
<p><a name="H.2.2p2" href="#H.2.2p2"><small>2</small></a>
The parameters for the integer data types can be accessed by the following:
- maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
<pre>
+ maxint INT_MAX, LONG_MAX, LLONG_MAX, UINT_MAX, ULONG_MAX,
ULLONG_MAX
-</pre>
minint INT_MIN, LONG_MIN, LLONG_MIN
+</pre>
<p><a name="H.2.2p3" href="#H.2.2p3"><small>3</small></a>
The parameter ''bounded'' is always true, and is not provided. The parameter ''minint''
is always 0 for the unsigned types, and is not provided for those types.
<h5><a name="H.2.2.1" href="#H.2.2.1">H.2.2.1 Integer operations</a></h5>
<p><a name="H.2.2.1p1" href="#H.2.2.1p1"><small>1</small></a>
The integer operations on integer types are the following:
+<pre>
addI x + y
subI x - y
mulI x * y
leqI x <= y
gtrI x > y
geqI x >= y
+</pre>
where x and y are expressions of the same integer type.
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="H.2.3.1" href="#H.2.3.1">H.2.3.1 Floating-point parameters</a></h5>
<p><a name="H.2.3.1p1" href="#H.2.3.1p1"><small>1</small></a>
The parameters for a floating point data type can be accessed by the following:
+<pre>
r FLT_RADIX
p FLT_MANT_DIG, DBL_MANT_DIG, LDBL_MANT_DIG
emax FLT_MAX_EXP, DBL_MAX_EXP, LDBL_MAX_EXP
emin FLT_MIN_EXP, DBL_MIN_EXP, LDBL_MIN_EXP
+</pre>
<p><a name="H.2.3.1p2" href="#H.2.3.1p2"><small>2</small></a>
The derived constants for the floating point types are accessed by the following:
<!--page 566 -->
+<pre>
fmax FLT_MAX, DBL_MAX, LDBL_MAX
fminN FLT_MIN, DBL_MIN, LDBL_MIN
epsilon FLT_EPSILON, DBL_EPSILON, LDBL_EPSILON
rnd_style FLT_ROUNDS
-
+</pre>
<p><small><a href="#Contents">Contents</a></small>
<h5><a name="H.2.3.2" href="#H.2.3.2">H.2.3.2 Floating-point operations</a></h5>
<p><a name="H.2.3.2p1" href="#H.2.3.2p1"><small>1</small></a>
The floating-point operations on floating-point types are the following:
+<pre>
addF x + y
subF x - y
mulF x * y
absF fabsf(x), fabs(x), fabsl(x)
exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x)
scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n),
-<pre>
scalblnf(x, li), scalbln(x, li), scalblnl(x, li)
-</pre>
intpartF modff(x, &y), modf(x, &y), modfl(x, &y)
fractpartF modff(x, &y), modf(x, &y), modfl(x, &y)
eqF x == y
leqF x <= y
gtrF x > y
geqF x >= y
+</pre>
where x and y are expressions of the same floating point type, n is of type int, and li
is of type long int.
that only one identifier for each is provided to map to LIA-1.
<p><a name="H.2.3.3p2" href="#H.2.3.3p2"><small>2</small></a>
The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles:
+<pre>
truncate FLT_ROUNDS == 0
<!--page 567 -->
nearest FLT_ROUNDS == 1
other FLT_ROUNDS != 0 && FLT_ROUNDS != 1
+</pre>
provided that an implementation extends FLT_ROUNDS to cover the rounding style used
in all relevant LIA-1 operations, not just addition as in C.
<h4><a name="H.2.4" href="#H.2.4">H.2.4 Type conversions</a></h4>
<p><a name="H.2.4p1" href="#H.2.4p1"><small>1</small></a>
The LIA-1 type conversions are the following type casts:
- cvtI' -> I (int)i, (long int)i, (long long int)i,
<pre>
+ cvtI' -> I (int)i, (long int)i, (long long int)i,
(unsigned int)i, (unsigned long int)i,
(unsigned long long int)i
-</pre>
cvtF -> I (int)x, (long int)x, (long long int)x,
-<pre>
(unsigned int)x, (unsigned long int)x,
(unsigned long long int)x
-</pre>
cvtI -> F (float)i, (double)i, (long double)i
cvtF' -> F (float)x, (double)x, (long double)x
+</pre>
<p><a name="H.2.4p2" href="#H.2.4p2"><small>2</small></a>
In the above conversions from floating to integer, the use of (cast)x can be replaced with
(cast)round(x), (cast)rint(x), (cast)nearbyint(x), (cast)trunc(x),
C's <a href="#7.6"><fenv.h></a> status flags are compatible with the LIA-1 indicators.
<p><a name="H.3.1.1p2" href="#H.3.1.1p2"><small>2</small></a>
The following mapping is for floating-point types:
+<pre>
undefined FE_INVALID, FE_DIVBYZERO
floating_overflow FE_OVERFLOW
underflow FE_UNDERFLOW
+</pre>
<p><a name="H.3.1.1p3" href="#H.3.1.1p3"><small>3</small></a>
The floating-point indicator interrogation and manipulation operations are:
+<pre>
set_indicators feraiseexcept(i)
clear_indicators feclearexcept(i)
test_indicators fetestexcept(i)
current_indicators fetestexcept(FE_ALL_EXCEPT)
+</pre>
where i is an expression of type int representing a subset of the LIA-1 indicators.
<p><a name="H.3.1.1p4" href="#H.3.1.1p4"><small>4</small></a>
C allows an implementation to provide the following LIA-1 required behavior: at
<p><a name="K.3.5.2.1p5" href="#K.3.5.2.1p5"><small>5</small></a>
The mode string shall be as described for fopen, with the addition that modes starting
with the character 'w' or 'a' may be preceded by the character 'u', see below:
- uw truncate to zero length or create text file for writing, default
-<pre>
+<dl>
+<dt> uw <dd>truncate to zero length or create text file for writing, default
permissions
-</pre>
- uwx create text file for writing, default permissions
- ua append; open or create text file for writing at end-of-file, default
-<pre>
+<dt> uwx <dd>create text file for writing, default permissions
+<dt> ua <dd>append; open or create text file for writing at end-of-file, default
permissions
-</pre>
- uwb truncate to zero length or create binary file for writing, default
-<pre>
+<dt> uwb <dd>truncate to zero length or create binary file for writing, default
permissions
-</pre>
- uwbx create binary file for writing, default permissions
- uab append; open or create binary file for writing at end-of-file, default
-<pre>
+<dt> uwbx <dd>create binary file for writing, default permissions
+<dt> uab <dd>append; open or create binary file for writing at end-of-file, default
permissions
-</pre>
- uw+ truncate to zero length or create text file for update, default
-<pre>
+<dt> uw+ <dd>truncate to zero length or create text file for update, default
permissions
-</pre>
- uw+x create text file for update, default permissions
- ua+ append; open or create text file for update, writing at end-of-file,
-<pre>
+<dt> uw+x <dd>create text file for update, default permissions
+<dt> ua+ <dd>append; open or create text file for update, writing at end-of-file,
default permissions
-</pre>
- uw+b or uwb+ truncate to zero length or create binary file for update, default
-<pre>
+<dt> uw+b or uwb+ <dd>truncate to zero length or create binary file for update, default
permissions
-</pre>
- uw+bx or uwb+x create binary file for update, default permissions
- ua+b or uab+ append; open or create binary file for update, writing at end-of-file,
-<pre>
+<dt> uw+bx or uwb+x <dd>create binary file for update, default permissions
+<dt> ua+b or uab+ <dd>append; open or create binary file for update, writing at end-of-file,
default permissions
-</pre>
+</dl>
<p><a name="K.3.5.2.1p6" href="#K.3.5.2.1p6"><small>6</small></a>
Opening a file with exclusive mode ('x' as the last character in the mode argument)
fails if the file already exists or cannot be created.
wscanf_s function, <a href="#K.3.9.1.12">K.3.9.1.12</a>, <a href="#K.3.9.1.14">K.3.9.1.14</a>
xor macro, <a href="#7.9">7.9</a>
- xor_eq macro, <a href="#7.9">7.9</a> *
+ xor_eq macro, <a href="#7.9">7.9</a>
</pre>
<p><small><a href="#Contents">Contents</a></small>
</body></html>