<a name="1" href="#1"><b> 1. Scope</b></a>
1 This International Standard specifies the form and establishes the interpretation of
<a name="1" href="#1"><b> 1. Scope</b></a>
1 This International Standard specifies the form and establishes the interpretation of
-- the representation of C programs;
-- the syntax and constraints of the C language;
-- the semantic rules for interpreting C programs;
-- the representation of C programs;
-- the syntax and constraints of the C language;
-- the semantic rules for interpreting C programs;
data-processing systems. It is intended for use by implementors and programmers.
[<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
data-processing systems. It is intended for use by implementors and programmers.
[<a name="p1" href="#p1">page 1</a>] (<a href="#Contents">Contents</a>)
1 perform a trap
interrupt execution of the program such that no further operations are performed
2 NOTE In this International Standard, when the word ''trap'' is not immediately followed by
1 perform a trap
interrupt execution of the program such that no further operations are performed
2 NOTE In this International Standard, when the word ''trap'' is not immediately followed by
representation might perform a trap but is not required to (see <a href="#6.2.6.1">6.2.6.1</a>).
[<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
representation might perform a trap but is not required to (see <a href="#6.2.6.1">6.2.6.1</a>).
[<a name="p7" href="#p7">page 7</a>] (<a href="#Contents">Contents</a>)
containing a #error preprocessing directive unless it is part of a group skipped by
conditional inclusion.
5 A strictly conforming program shall use only those features of the language and library
containing a #error preprocessing directive unless it is part of a group skipped by
conditional inclusion.
5 A strictly conforming program shall use only those features of the language and library
unspecified, undefined, or implementation-defined behavior, and shall not exceed any
minimum implementation limit.
6 The two forms of conforming implementation are hosted and freestanding. A conforming
unspecified, undefined, or implementation-defined behavior, and shall not exceed any
minimum implementation limit.
6 The two forms of conforming implementation are hosted and freestanding. A conforming
<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>, and <a href="#7.20"><stdint.h></a>. A conforming implementation may have extensions
(including additional library functions), provided they do not alter the behavior of any
<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>, and <a href="#7.20"><stdint.h></a>. A conforming implementation may have extensions
(including additional library functions), provided they do not alter the behavior of any
by an appropriate conditional inclusion preprocessing directive using the related macro. For example:
#ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
/* ... */
by an appropriate conditional inclusion preprocessing directive using the related macro. For example:
#ifdef __STDC_IEC_559__ /* FE_UPWARD defined */
/* ... */
reserved in this International Standard.
[<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
reserved in this International Standard.
[<a name="p8" href="#p8">page 8</a>] (<a href="#Contents">Contents</a>)
8 An implementation shall be accompanied by a document that defines all implementation-
defined and locale-specific characteristics and all extensions.
Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
8 An implementation shall be accompanied by a document that defines all implementation-
defined and locale-specific characteristics and all extensions.
Forward references: conditional inclusion (<a href="#6.10.1">6.10.1</a>), error directive (<a href="#6.10.5">6.10.5</a>),
preprocessing directives (<a href="#6.10">6.10</a>).
<a name="5.1.1.2" href="#5.1.1.2"><b> 5.1.1.2 Translation phases</b></a>
1 The precedence among the syntax rules of translation is specified by the following
preprocessing directives (<a href="#6.10">6.10</a>).
<a name="5.1.1.2" href="#5.1.1.2"><b> 5.1.1.2 Translation phases</b></a>
1 The precedence among the syntax rules of translation is specified by the following
1. Physical source file multibyte characters are mapped, in an implementation-
defined manner, to the source character set (introducing new-line characters for
end-of-line indicators) if necessary. Trigraph sequences are replaced by
1. Physical source file multibyte characters are mapped, in an implementation-
defined manner, to the source character set (introducing new-line characters for
end-of-line indicators) if necessary. Trigraph sequences are replaced by
together in practice. Source files, translation units, and translated translation units need not
necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
and any external representation. The description is conceptual only, and does not specify any
together in practice. Source files, translation units, and translated translation units need not
necessarily be stored as files, nor need there be any one-to-one correspondence between these entities
and any external representation. The description is conceptual only, and does not specify any
of such a splice. A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character before any such
splicing takes place.
of such a splice. A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character before any such
splicing takes place.
white-space characters (including comments). A source file shall not end in a
partial preprocessing token or in a partial comment. Each comment is replaced by
one space character. New-line characters are retained. Whether each nonempty
white-space characters (including comments). A source file shall not end in a
partial preprocessing token or in a partial comment. Each comment is replaced by
one space character. New-line characters are retained. Whether each nonempty
5. Each source character set member and escape sequence in character constants and
string literals is converted to the corresponding member of the execution character
set; if there is no corresponding member, it is converted to an implementation-
5. Each source character set member and escape sequence in character constants and
string literals is converted to the corresponding member of the execution character
set; if there is no corresponding member, it is converted to an implementation-
6. Adjacent string literal tokens are concatenated.
7. White-space characters separating tokens are no longer significant. Each
preprocessing token is converted into a token. The resulting tokens are
6. Adjacent string literal tokens are concatenated.
7. White-space characters separating tokens are no longer significant. Each
preprocessing token is converted into a token. The resulting tokens are
an implementation-defined manner) if a preprocessing translation unit or translation unit
contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
specified as undefined or implementation-defined. Diagnostic messages need not be
an implementation-defined manner) if a preprocessing translation unit or translation unit
contains a violation of any syntax rule or constraint, even if the behavior is also explicitly
specified as undefined or implementation-defined. Diagnostic messages need not be
- 9) The intent is that an implementation should identify the nature of, and where possible localize, each
+ <sup><a name="note9" href="#note9"><b>9)</b></a></sup> The intent is that an implementation should identify the nature of, and where possible localize, each
violation. Of course, an implementation is free to produce any number of diagnostics as long as a
valid program is still correctly translated. It may also successfully translate an invalid program.
violation. Of course, an implementation is free to produce any number of diagnostics as long as a
valid program is still correctly translated. It may also successfully translate an invalid program.
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
or with two parameters (referred to here as argc and argv, though any names may be
used, as they are local to the function in which they are declared):
int main(int argc, char *argv[]) { /* ... */ }
2 If they are declared, the parameters to the main function shall obey the following
constraints:
-- The value of argc shall be nonnegative.
2 If they are declared, the parameters to the main function shall obey the following
constraints:
-- The value of argc shall be nonnegative.
- 10) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
+ <sup><a name="note10" href="#note10"><b>10)</b></a></sup> Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
<a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
1 If the return type of the main function is a type compatible with int, a return from the
initial call to the main function is equivalent to calling the exit function with the value
<a name="5.1.2.2.3" href="#5.1.2.2.3"><b> 5.1.2.2.3 Program termination</b></a>
1 If the return type of the main function is a type compatible with int, a return from the
initial call to the main function is equivalent to calling the exit function with the value
main function returns a value of 0. If the return type is not compatible with int, the
termination status returned to the host environment is unspecified.
Forward references: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>).
main function returns a value of 0. If the return type is not compatible with int, the
termination status returned to the host environment is unspecified.
Forward references: definition of terms (<a href="#7.1.1">7.1.1</a>), the exit function (<a href="#7.22.4.4">7.22.4.4</a>).
1 The semantic descriptions in this International Standard describe the behavior of an
abstract machine in which issues of optimization are irrelevant.
2 Accessing a volatile object, modifying an object, modifying a file, or calling a function
1 The semantic descriptions in this International Standard describe the behavior of an
abstract machine in which issues of optimization are irrelevant.
2 Accessing a volatile object, modifying an object, modifying a file, or calling a function
the execution environment. Evaluation of an expression in general includes both value
computations and initiation of side effects. Value computation for an lvalue expression
includes determining the identity of the designated object.
the execution environment. Evaluation of an expression in general includes both value
computations and initiation of side effects. Value computation for an lvalue expression
includes determining the identity of the designated object.
shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
sequenced after A.) If A is not sequenced before or after B, then A and B are
unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
shall precede the execution of B. (Conversely, if A is sequenced before B, then B is
sequenced after A.) If A is not sequenced before or after B, then A and B are
unsequenced. Evaluations A and B are indeterminately sequenced when A is sequenced
between the evaluation of expressions A and B implies that every value computation and
side effect associated with A is sequenced before every value computation and side effect
associated with B. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
between the evaluation of expressions A and B implies that every value computation and
side effect associated with A is sequenced before every value computation and side effect
associated with B. (A summary of the sequence points is given in <a href="#C">annex C</a>.)
actual implementation need not evaluate part of an expression if it can deduce that its
value is not used and that no needed side effects are produced (including any caused by
actual implementation need not evaluate part of an expression if it can deduce that its
value is not used and that no needed side effects are produced (including any caused by
flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
values of floating-point operations. Implementations that support such floating-point state are
required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
environment library <a href="#7.6"><fenv.h></a> provides a programming facility for indicating when these side
effects matter, freeing the implementations in other cases.
flags and control modes. Floating-point operations implicitly set the status flags; modes affect result
values of floating-point operations. Implementations that support such floating-point state are
required to regard changes to it as side effects -- see <a href="#F">annex F</a> for details. The floating-point
environment library <a href="#7.6"><fenv.h></a> provides a programming facility for indicating when these side
effects matter, freeing the implementations in other cases.
cannot interleave, but can be executed in any order.
[<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
cannot interleave, but can be executed in any order.
[<a name="p14" href="#p14">page 14</a>] (<a href="#Contents">Contents</a>)
1 Under a hosted implementation, a program can have more than one thread of execution
(or thread) running concurrently. The execution of each thread proceeds as defined by
the remainder of this standard. The execution of the entire program consists of an
1 Under a hosted implementation, a program can have more than one thread of execution
(or thread) running concurrently. The execution of each thread proceeds as defined by
the remainder of this standard. The execution of the entire program consists of an
implementation-defined whether a program can have more than one thread of execution.
2 The value of an object visible to a thread T at a particular point is the initial value of the
object, a value stored in the object by T , or a value stored in the object by another thread,
implementation-defined whether a program can have more than one thread of execution.
2 The value of an object visible to a thread T at a particular point is the initial value of the
object, a value stored in the object by T , or a value stored in the object by another thread,
atomic operations, for example, allow executions inconsistent with a simple interleaving as described
below.
atomic operations, for example, allow executions inconsistent with a simple interleaving as described
below.
another. For atomic variables, the definition is clear. All operations on a given mutex occur in a single total
order. Each mutex acquisition ''reads the value written'' by the last mutex release.
another. For atomic variables, the definition is clear. All operations on a given mutex occur in a single total
order. Each mutex acquisition ''reads the value written'' by the last mutex release.
-- A writes a scalar object or bit-field M, B reads from M the value written by A, and A
is sequenced before B, or
-- for some evaluation X, A carries a dependency to X and X carries a dependency to B.
-- A writes a scalar object or bit-field M, B reads from M the value written by A, and A
is sequenced before B, or
-- for some evaluation X, A carries a dependency to X and X carries a dependency to B.
-- A performs a release operation on an atomic object M, and B performs a consume
operation on M and reads a value written by any side effect in the release sequence
headed by A, or
-- A performs a release operation on an atomic object M, and B performs a consume
operation on M and reads a value written by any side effect in the release sequence
headed by A, or
release/consume in place of release/acquire.
[<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
release/consume in place of release/acquire.
[<a name="p19" href="#p19">page 19</a>] (<a href="#Contents">Contents</a>)
preprocessing directives (<a href="#6.10">6.10</a>), string literals (<a href="#6.4.5">6.4.5</a>), comments (<a href="#6.4.9">6.4.9</a>), string (<a href="#7.1.1">7.1.1</a>).
<a name="5.2.1.1" href="#5.2.1.1"><b> 5.2.1.1 Trigraph sequences</b></a>
1 Before any other processing takes place, each occurrence of one of the following
preprocessing directives (<a href="#6.10">6.10</a>), string literals (<a href="#6.4.5">6.4.5</a>), comments (<a href="#6.4.9">6.4.9</a>), string (<a href="#7.1.1">7.1.1</a>).
<a name="5.2.1.1" href="#5.2.1.1"><b> 5.2.1.1 Trigraph sequences</b></a>
1 Before any other processing takes place, each occurrence of one of the following
described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
[<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
[<a name="p23" href="#p23">page 23</a>] (<a href="#Contents">Contents</a>)
discussed in clause 7.
<a name="5.2.4.1" href="#5.2.4.1"><b> 5.2.4.1 Translation limits</b></a>
1 The implementation shall be able to translate and execute at least one program that
discussed in clause 7.
<a name="5.2.4.1" href="#5.2.4.1"><b> 5.2.4.1 Translation limits</b></a>
1 The implementation shall be able to translate and execute at least one program that
-- 127 nesting levels of blocks
-- 63 nesting levels of conditional inclusion
-- 12 pointer, array, and function declarators (in any combinations) modifying an
-- 127 nesting levels of blocks
-- 63 nesting levels of conditional inclusion
-- 12 pointer, array, and function declarators (in any combinations) modifying an
[<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
universal character name specifying a short identifier of 00010000 or more is
considered 10 characters, and each extended source character is considered the same
[<a name="p25" href="#p25">page 25</a>] (<a href="#Contents">Contents</a>)
universal character name specifying a short identifier of 00010000 or more is
considered 10 characters, and each extended source character is considered the same
-- 4095 external identifiers in one translation unit
-- 511 identifiers with block scope declared in one block
-- 4095 macro identifiers simultaneously defined in one preprocessing translation unit
-- 4095 external identifiers in one translation unit
-- 511 identifiers with block scope declared in one block
-- 4095 macro identifiers simultaneously defined in one preprocessing translation unit
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
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
Forward references: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
<a name="5.2.4.2.2" href="#5.2.4.2.2"><b> 5.2.4.2.2 Characteristics of floating types <float.h></b></a>
1 The characteristics of floating types are defined in terms of a model that describes a
representation of floating-point numbers and values that provide information about an
Forward references: representations of types (<a href="#6.2.6">6.2.6</a>), conditional inclusion (<a href="#6.10.1">6.10.1</a>).
<a name="5.2.4.2.2" href="#5.2.4.2.2"><b> 5.2.4.2.2 Characteristics of floating types <float.h></b></a>
1 The characteristics of floating types are defined in terms of a model that describes a
representation of floating-point numbers and values that provide information about an
define the model for each floating-point type:
s sign ((+-)1)
b base or radix of exponent representation (an integer > 1)
define the model for each floating-point type:
s sign ((+-)1)
b base or radix of exponent representation (an integer > 1)
- 20) See <a href="#6.2.5">6.2.5</a>.
- 21) The floating-point model is intended to clarify the description of each floating-point characteristic and
+ <sup><a name="note20" href="#note20"><b>20)</b></a></sup> See <a href="#6.2.5">6.2.5</a>.
+ <sup><a name="note21" href="#note21"><b>21)</b></a></sup> The floating-point model is intended to clarify the description of each floating-point characteristic and
does not require the floating-point arithmetic of the implementation to be identical.
[<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
does not require the floating-point arithmetic of the implementation to be identical.
[<a name="p28" href="#p28">page 28</a>] (<a href="#Contents">Contents</a>)
4 An implementation may give zero and values that are not floating-point numbers (such as
infinities and NaNs) a sign or may leave them unsigned. Wherever such values are
unsigned, any requirement in this International Standard to retrieve the sign shall produce
4 An implementation may give zero and values that are not floating-point numbers (such as
infinities and NaNs) a sign or may leave them unsigned. Wherever such values are
unsigned, any requirement in this International Standard to retrieve the sign shall produce
point model representation is provided for all values except FLT_EVAL_METHOD and
FLT_ROUNDS.
8 The rounding mode for floating-point addition is characterized by the implementation-
point model representation is provided for all values except FLT_EVAL_METHOD and
FLT_ROUNDS.
8 The rounding mode for floating-point addition is characterized by the implementation-
the function fesetround in <a href="#7.6"><fenv.h></a>.
[<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
the function fesetround in <a href="#7.6"><fenv.h></a>.
[<a name="p29" href="#p29">page 29</a>] (<a href="#Contents">Contents</a>)
yielded by operators with floating operands and values subject to the usual arithmetic
conversions and of floating constants are evaluated to a format whose range and precision
may be greater than required by the type. The use of evaluation formats is characterized
yielded by operators with floating operands and values subject to the usual arithmetic
conversions and of floating constants are evaluated to a format whose range and precision
may be greater than required by the type. The use of evaluation formats is characterized
10 The presence or absence of subnormal numbers is characterized by the implementation-
defined values of FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, and
LDBL_HAS_SUBNORM:
10 The presence or absence of subnormal numbers is characterized by the implementation-
defined values of FLT_HAS_SUBNORM, DBL_HAS_SUBNORM, and
LDBL_HAS_SUBNORM:
1 present (type does support subnormal numbers)
11 The values given in the following list shall be replaced by constant expressions with
implementation-defined values that are greater or equal in magnitude (absolute value) to
1 present (type does support subnormal numbers)
11 The values given in the following list shall be replaced by constant expressions with
implementation-defined values that are greater or equal in magnitude (absolute value) to
just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
_Complex operands is represented in the double _Complex format, and its parts are evaluated to
double.
just real types. For example, if FLT_EVAL_METHOD is 1, then the product of two float
_Complex operands is represented in the double _Complex format, and its parts are evaluated to
double.
non-subnormal inputs, even if the type format includes representations of subnormal numbers.
[<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
non-subnormal inputs, even if the type format includes representations of subnormal numbers.
[<a name="p30" href="#p30">page 30</a>] (<a href="#Contents">Contents</a>)
<a href="#7.7"><float.h></a> header for types float and double:
24
x f = s2e (Sum) f k 2-k ,
<a href="#7.7"><float.h></a> header for types float and double:
24
x f = s2e (Sum) f k 2-k ,
limits are one less than shown here.
[<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
limits are one less than shown here.
[<a name="p33" href="#p33">page 33</a>] (<a href="#Contents">Contents</a>)
source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
<a name="6.2.2" href="#6.2.2"><b> 6.2.2 Linkages of identifiers</b></a>
1 An identifier declared in different scopes or in the same scope more than once can be
source file inclusion (<a href="#6.10.2">6.10.2</a>), statements (<a href="#6.8">6.8</a>).
<a name="6.2.2" href="#6.2.2"><b> 6.2.2 Linkages of identifiers</b></a>
1 An identifier declared in different scopes or in the same scope more than once can be
three kinds of linkage: external, internal, and none.
2 In the set of translation units and libraries that constitutes an entire program, each
declaration of a particular identifier with external linkage denotes the same object or
three kinds of linkage: external, internal, and none.
2 In the set of translation units and libraries that constitutes an entire program, each
declaration of a particular identifier with external linkage denotes the same object or
linkage denotes the same object or function. Each declaration of an identifier with no
linkage denotes a unique entity.
3 If the declaration of a file scope identifier for an object or a function contains the storage-
linkage denotes the same object or function. Each declaration of an identifier with no
linkage denotes a unique entity.
3 If the declaration of a file scope identifier for an object or a function contains the storage-
[<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
4 For an identifier declared with the storage-class specifier extern in a scope in which a
[<a name="p36" href="#p36">page 36</a>] (<a href="#Contents">Contents</a>)
4 For an identifier declared with the storage-class specifier extern in a scope in which a
external linkage, the linkage of the identifier at the later declaration is the same as the
linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
declaration specifies no linkage, then the identifier has external linkage.
external linkage, the linkage of the identifier at the later declaration is the same as the
linkage specified at the prior declaration. If no prior declaration is visible, or if the prior
declaration specifies no linkage, then the identifier has external linkage.
translation unit, the syntactic context disambiguates uses that refer to different entities.
Thus, there are separate name spaces for various categories of identifiers, as follows:
-- label names (disambiguated by the syntax of the label declaration and use);
translation unit, the syntactic context disambiguates uses that refer to different entities.
Thus, there are separate name spaces for various categories of identifiers, as follows:
-- label names (disambiguated by the syntax of the label declaration and use);
- -- the tags of structures, unions, and enumerations (disambiguated by following any32)
+ -- the tags of structures, unions, and enumerations (disambiguated by following any<sup><a href="#note32"><b>32)</b></a></sup>
of the keywords struct, union, or enum);
-- the members of structures or unions; each structure or union has a separate name
space for its members (disambiguated by the type of the expression used to access the
of the keywords struct, union, or enum);
-- the members of structures or unions; each structure or union has a separate name
space for its members (disambiguated by the type of the expression used to access the
structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), structure and union members (<a href="#6.5.2.3">6.5.2.3</a>), tags
(<a href="#6.7.2.3">6.7.2.3</a>), the goto statement (<a href="#6.8.6.1">6.8.6.1</a>).
structure and union specifiers (<a href="#6.7.2.1">6.7.2.1</a>), structure and union members (<a href="#6.5.2.3">6.5.2.3</a>), tags
(<a href="#6.7.2.3">6.7.2.3</a>), the goto statement (<a href="#6.8.6.1">6.8.6.1</a>).
- 31) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
- 32) There is only one name space for tags even though three are possible.
+ <sup><a name="note31" href="#note31"><b>31)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
+ <sup><a name="note32" href="#note32"><b>32)</b></a></sup> There is only one name space for tags even though three are possible.
durations: static, thread, automatic, and allocated. Allocated storage is described in
<a href="#7.22.3">7.22.3</a>.
2 The lifetime of an object is the portion of program execution during which storage is
durations: static, thread, automatic, and allocated. Allocated storage is described in
<a href="#7.22.3">7.22.3</a>.
2 The lifetime of an object is the portion of program execution during which storage is
- guaranteed to be reserved for it. An object exists, has a constant address,33) and retains
- its last-stored value throughout its lifetime.34) If an object is referred to outside of its
+ guaranteed to be reserved for it. An object exists, has a constant address,<sup><a href="#note33"><b>33)</b></a></sup> and retains
+ its last-stored value throughout its lifetime.<sup><a href="#note34"><b>34)</b></a></sup> If an object is referred to outside of its
lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
the object it points to (or just past) reaches the end of its lifetime.
3 An object whose identifier is declared without the storage-class specifier
lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when
the object it points to (or just past) reaches the end of its lifetime.
3 An object whose identifier is declared without the storage-class specifier
[<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
7 For such an object that does have a variable length array type, its lifetime extends from
the declaration of the object until execution of the program leaves the scope of the
[<a name="p38" href="#p38">page 38</a>] (<a href="#Contents">Contents</a>)
7 For such an object that does have a variable length array type, its lifetime extends from
the declaration of the object until execution of the program leaves the scope of the
each time. The initial value of the object is indeterminate.
8 A non-lvalue expression with structure or union type, where the structure or union
contains a member with array type (including, recursively, members of all contained
structures and unions) refers to an object with automatic storage duration and temporary
each time. The initial value of the object is indeterminate.
8 A non-lvalue expression with structure or union type, where the structure or union
contains a member with array type (including, recursively, members of all contained
structures and unions) refers to an object with automatic storage duration and temporary
value of the expression. Its lifetime ends when the evaluation of the containing full
expression or full declarator ends. Any attempt to modify an object with temporary
lifetime results in undefined behavior.
value of the expression. Its lifetime ends when the evaluation of the containing full
expression or full declarator ends. Any attempt to modify an object with temporary
lifetime results in undefined behavior.
are partitioned into object types (types that describe objects) and function types (types
that describe functions). At various points within a translation unit an object type may be
incomplete (lacking sufficient information to determine the size of objects of that type) or
are partitioned into object types (types that describe objects) and function types (types
that describe functions). At various points within a translation unit an object type may be
incomplete (lacking sufficient information to determine the size of objects of that type) or
2 An object declared as type _Bool is large enough to store the values 0 and 1.
3 An object declared as type char is large enough to store any member of the basic
execution character set. If a member of the basic execution character set is stored in a
2 An object declared as type _Bool is large enough to store the values 0 and 1.
3 An object declared as type char is large enough to store any member of the basic
execution character set. If a member of the basic execution character set is stored in a
4 There are five standard signed integer types, designated as signed char, short
int, int, long int, and long long int. (These and other types may be
designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
4 There are five standard signed integer types, designated as signed char, short
int, int, long int, and long long int. (These and other types may be
designated in several additional ways, as described in <a href="#6.7.2">6.7.2</a>.) There may also be
- implementation-defined extended signed integer types.38) The standard and extended
- signed integer types are collectively called signed integer types.39)
+ implementation-defined extended signed integer types.<sup><a href="#note38"><b>38)</b></a></sup> The standard and extended
+ signed integer types are collectively called signed integer types.<sup><a href="#note39"><b>39)</b></a></sup>
- 36) The address of such an object is taken implicitly when an array member is accessed.
- 37) A type may be incomplete or complete throughout an entire translation unit, or it may change states at
+ <sup><a name="note36" href="#note36"><b>36)</b></a></sup> The address of such an object is taken implicitly when an array member is accessed.
+ <sup><a name="note37" href="#note37"><b>37)</b></a></sup> A type may be incomplete or complete throughout an entire translation unit, or it may change states at
different points within a translation unit.
[<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
different points within a translation unit.
[<a name="p39" href="#p39">page 39</a>] (<a href="#Contents">Contents</a>)
types are the standard unsigned integer types. The unsigned integer types that
correspond to the extended signed integer types are the extended unsigned integer types.
The standard and extended unsigned integer types are collectively called unsigned integer
types are the standard unsigned integer types. The unsigned integer types that
correspond to the extended signed integer types are the extended unsigned integer types.
The standard and extended unsigned integer types are collectively called unsigned integer
7 The standard signed integer types and standard unsigned integer types are collectively
called the standard integer types, the extended signed integer types and extended
unsigned integer types are collectively called the extended integer types.
7 The standard signed integer types and standard unsigned integer types are collectively
called the standard integer types, the extended signed integer types and extended
unsigned integer types are collectively called the extended integer types.
subrange of the values of the other type.
9 The range of nonnegative values of a signed integer type is a subrange of the
corresponding unsigned integer type, and the representation of the same value in each
subrange of the values of the other type.
9 The range of nonnegative values of a signed integer type is a subrange of the
corresponding unsigned integer type, and the representation of the same value in each
because a result that cannot be represented by the resulting unsigned integer type is
reduced modulo the number that is one greater than the largest value that can be
represented by the resulting type.
10 There are three real floating types, designated as float, double, and long
because a result that cannot be represented by the resulting unsigned integer type is
reduced modulo the number that is one greater than the largest value that can be
represented by the resulting type.
10 There are three real floating types, designated as float, double, and long
[<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
11 There are three complex types, designated as float _Complex, double
[<a name="p40" href="#p40">page 40</a>] (<a href="#Contents">Contents</a>)
11 There are three complex types, designated as float _Complex, double
feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.) The real floating and
complex types are collectively called the floating types.
12 For each floating type there is a corresponding real type, which is always a real floating
feature that implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.) The real floating and
complex types are collectively called the floating types.
12 For each floating type there is a corresponding real type, which is always a real floating
14 The type char, the signed and unsigned integer types, and the floating types are
collectively called the basic types. The basic types are complete object types. Even if the
implementation defines two or more basic types to have the same representation, they are
14 The type char, the signed and unsigned integer types, and the floating types are
collectively called the basic types. The basic types are complete object types. Even if the
implementation defines two or more basic types to have the same representation, they are
15 The three types char, signed char, and unsigned char are collectively called
the character types. The implementation shall define char to have the same range,
15 The three types char, signed char, and unsigned char are collectively called
the character types. The implementation shall define char to have the same range,
16 An enumeration comprises a set of named integer constant values. Each distinct
enumeration constitutes a different enumerated type.
17 The type char, the signed and unsigned integer types, and the enumerated types are
16 An enumeration comprises a set of named integer constant values. Each distinct
enumeration constitutes a different enumerated type.
17 The type char, the signed and unsigned integer types, and the enumerated types are
- 43) A specification for imaginary types is in <a href="#G">annex G</a>.
- 44) An implementation may define new keywords that provide alternative ways to designate a basic (or
+ <sup><a name="note43" href="#note43"><b>43)</b></a></sup> A specification for imaginary types is in <a href="#G">annex G</a>.
+ <sup><a name="note44" href="#note44"><b>44)</b></a></sup> An implementation may define new keywords that provide alternative ways to designate a basic (or
any other) type; this does not violate the requirement that all basic types be different.
Implementation-defined keywords shall have the form of an identifier reserved for any use as
described in <a href="#7.1.3">7.1.3</a>.
any other) type; this does not violate the requirement that all basic types be different.
Implementation-defined keywords shall have the form of an identifier reserved for any use as
described in <a href="#7.1.3">7.1.3</a>.
- 45) CHAR_MIN, defined in <a href="#7.10"><limits.h></a>, will have one of the values 0 or SCHAR_MIN, and this can be
+ <sup><a name="note45" href="#note45"><b>45)</b></a></sup> CHAR_MIN, defined in <a href="#7.10"><limits.h></a>, will have one of the values 0 or SCHAR_MIN, and this can be
used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
other two and is not compatible with either.
used to distinguish the two options. Irrespective of the choice made, char is a separate type from the
other two and is not compatible with either.
support; see <a href="#6.10.8.3">6.10.8.3</a>.)
These methods of constructing derived types can be applied recursively.
21 Arithmetic types and pointer types are collectively called scalar types. Array and
support; see <a href="#6.10.8.3">6.10.8.3</a>.)
These methods of constructing derived types can be applied recursively.
21 Arithmetic types and pointer types are collectively called scalar types. Array and
22 An array type of unknown size is an incomplete type. It is completed, for an identifier of
that type, by specifying the size in a later declaration (with internal or external linkage).
A structure or union type of unknown content (as described in <a href="#6.7.2.3">6.7.2.3</a>) is an incomplete
22 An array type of unknown size is an incomplete type. It is completed, for an identifier of
that type, by specifying the size in a later declaration (with internal or external linkage).
A structure or union type of unknown content (as described in <a href="#6.7.2.3">6.7.2.3</a>) is an incomplete
contain one member at a time.
[<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
contain one member at a time.
[<a name="p42" href="#p42">page 42</a>] (<a href="#Contents">Contents</a>)
derived type (as noted above in the construction of derived types), or the type itself if the
type consists of no derived types.
26 Any type so far mentioned is an unqualified type. Each unqualified type has several
derived type (as noted above in the construction of derived types), or the type itself if the
type consists of no derived types.
26 Any type so far mentioned is an unqualified type. Each unqualified type has several
- qualified versions of its type,47) corresponding to the combinations of one, two, or all
+ qualified versions of its type,<sup><a href="#note47"><b>47)</b></a></sup> corresponding to the combinations of one, two, or all
three of the const, volatile, and restrict qualifiers. The qualified or unqualified
versions of a type are distinct types that belong to the same type category and have the
three of the const, volatile, and restrict qualifiers. The qualified or unqualified
versions of a type are distinct types that belong to the same type category and have the
qualifiers (if any) of the type from which it is derived.
27 Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier
designates an atomic type. The size, representation, and alignment of an atomic type
qualifiers (if any) of the type from which it is derived.
27 Further, there is the _Atomic qualifier. The presence of the _Atomic qualifier
designates an atomic type. The size, representation, and alignment of an atomic type
- 47) See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
- 48) The same representation and alignment requirements are meant to imply interchangeability as
+ <sup><a name="note47" href="#note47"><b>47)</b></a></sup> See <a href="#6.7.3">6.7.3</a> regarding qualified array and function types.
+ <sup><a name="note48" href="#note48"><b>48)</b></a></sup> The same representation and alignment requirements are meant to imply interchangeability as
arguments to functions, return values from functions, and members of unions.
[<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
arguments to functions, return values from functions, and members of unions.
[<a name="p43" href="#p43">page 43</a>] (<a href="#Contents">Contents</a>)
the number, order, and encoding of which are either explicitly specified or
implementation-defined.
3 Values stored in unsigned bit-fields and objects of type unsigned char shall be
the number, order, and encoding of which are either explicitly specified or
implementation-defined.
3 Values stored in unsigned bit-fields and objects of type unsigned char shall be
4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
bits, where n is the size of an object of that type, in bytes. The value may be copied into
an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT
bits, where n is the size of an object of that type, in bytes. The value may be copied into
an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is
value of an object has such a representation and is read by an lvalue expression that does
not have character type, the behavior is undefined. If such a representation is produced
by a side effect that modifies all or any part of the object by an lvalue expression that
value of an object has such a representation and is read by an lvalue expression that does
not have character type, the behavior is undefined. If such a representation is produced
by a side effect that modifies all or any part of the object by an lvalue expression that
a trap representation.
6 When a value is stored in an object of structure or union type, including in a member
object, the bytes of the object representation that correspond to any padding bytes take
a trap representation.
6 When a value is stored in an object of structure or union type, including in a member
object, the bytes of the object representation that correspond to any padding bytes take
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
CHAR_BIT
- 1.
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
CHAR_BIT
- 1.
behavior, but the value of the variable cannot be used until a proper value is stored in it.
[<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
behavior, but the value of the variable cannot be used until a proper value is stored in it.
[<a name="p44" href="#p44">page 44</a>] (<a href="#Contents">Contents</a>)
representation that do not correspond to that member but do correspond to other members
take unspecified values.
8 Where an operator is applied to a value that has more than one object representation,
representation that do not correspond to that member but do correspond to other members
take unspecified values.
8 Where an operator is applied to a value that has more than one object representation,
value is stored in an object using a type that has more than one object representation for
that value, it is unspecified which representation is used, but a trap representation shall
not be generated.
value is stored in an object using a type that has more than one object representation for
that value, it is unspecified which representation is used, but a trap representation shall
not be generated.
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
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
2 For signed integer types, the bits of the object representation shall be divided into three
groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
signed char shall not have any padding bits. There shall be exactly one sign bit.
2 For signed integer types, the bits of the object representation shall be divided into three
groups: value bits, padding bits, and the sign bit. There need not be any padding bits;
signed char shall not have any padding bits. There shall be exactly one sign bit.
representation of the corresponding unsigned type (if there are M value bits in the signed
type and N in the unsigned type, then M <= N ). If the sign bit is zero, it shall not affect
representation of the corresponding unsigned type (if there are M value bits in the signed
type and N in the unsigned type, then M <= N ). If the sign bit is zero, it shall not affect
- 51) Thus, for example, structure assignment need not copy any padding bits.
- 52) It is possible for objects x and y with the same effective type T to have the same value when they are
+ <sup><a name="note51" href="#note51"><b>51)</b></a></sup> Thus, for example, structure assignment need not copy any padding bits.
+ <sup><a name="note52" href="#note52"><b>52)</b></a></sup> It is possible for objects x and y with the same effective type T to have the same value when they are
accessed as objects of type T, but to have different values in other contexts. In particular, if == is
defined for type T, then x == y does not imply that memcmp(&x, &y, sizeof (T)) == 0.
Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
on values of type T may distinguish between them.
accessed as objects of type T, but to have different values in other contexts. In particular, if == is
defined for type T, then x == y does not imply that memcmp(&x, &y, sizeof (T)) == 0.
Furthermore, x == y does not necessarily imply that x and y have the same value; other operations
on values of type T may distinguish between them.
- 53) Some combinations of padding bits might generate trap representations, for example, if one padding
+ <sup><a name="note53" href="#note53"><b>53)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
representation other than as part of an exceptional condition such as an overflow, and this cannot occur
with unsigned types. All other combinations of padding bits are alternative object representations of
bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
representation other than as part of an exceptional condition such as an overflow, and this cannot occur
with unsigned types. All other combinations of padding bits are alternative object representations of
and whether a negative zero becomes a normal zero when stored in an object.
4 If the implementation does not support negative zeros, the behavior of the &, |, ^, ~, <<,
and >> operators with operands that would produce such a value is undefined.
and whether a negative zero becomes a normal zero when stored in an object.
4 If the implementation does not support negative zeros, the behavior of the &, |, ^, ~, <<,
and >> operators with operands that would produce such a value is undefined.
of a signed integer type where the sign bit is zero is a valid object representation of the
corresponding unsigned type, and shall represent the same value. For any integer type,
the object representation where all the bits are zero shall be a representation of the value
of a signed integer type where the sign bit is zero is a valid object representation of the
corresponding unsigned type, and shall represent the same value. For any integer type,
the object representation where all the bits are zero shall be a representation of the value
- 54) Some combinations of padding bits might generate trap representations, for example, if one padding
+ <sup><a name="note54" href="#note54"><b>54)</b></a></sup> Some combinations of padding bits might generate trap representations, for example, if one padding
bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
representation other than as part of an exceptional condition such as an overflow. All other
combinations of padding bits are alternative object representations of the value specified by the value
bit is a parity bit. Regardless, no arithmetic operation on valid values can generate a trap
representation other than as part of an exceptional condition such as an overflow. All other
combinations of padding bits are alternative object representations of the value specified by the value
<a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
1 Two types have compatible type if their types are the same. Additional rules for
determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
<a name="6.2.7" href="#6.2.7"><b> 6.2.7 Compatible type and composite type</b></a>
1 Two types have compatible type if their types are the same. Additional rules for
determining whether two types are compatible are described in <a href="#6.7.2">6.7.2</a> for type specifiers,
- in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.6">6.7.6</a> for declarators.55) Moreover, two structure,
+ in <a href="#6.7.3">6.7.3</a> for type qualifiers, and in <a href="#6.7.6">6.7.6</a> for declarators.<sup><a href="#note55"><b>55)</b></a></sup> Moreover, two structure,
union, or enumerated types declared in separate translation units are compatible if their
tags and members satisfy the following requirements: If one is declared with a tag, the
other shall be declared with the same tag. If both are completed anywhere within their
union, or enumerated types declared in separate translation units are compatible if their
tags and members satisfy the following requirements: If one is declared with a tag, the
other shall be declared with the same tag. If both are completed anywhere within their
parameters.
These rules apply recursively to the types from which the two types are derived.
4 For an identifier with internal or external linkage declared in a scope in which a prior
parameters.
These rules apply recursively to the types from which the two types are derived.
4 For an identifier with internal or external linkage declared in a scope in which a prior
external linkage, the type of the identifier at the later declaration becomes the composite
type.
Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
external linkage, the type of the identifier at the later declaration becomes the composite
type.
Forward references: array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
3 An extended alignment is represented by an alignment greater than
alignof(max_align_t). It is implementation-defined whether any extended
alignments are supported and the contexts in which they are supported. A type having an
3 An extended alignment is represented by an alignment greater than
alignof(max_align_t). It is implementation-defined whether any extended
alignments are supported and the contexts in which they are supported. A type having an
4 Alignments are represented as values of the type size_t. Valid alignments include only
those values returned by an alignof expression for fundamental types, plus an
additional implementation-defined set of values, which may be empty. Every valid
alignment value shall be a nonnegative integral power of two.
4 Alignments are represented as values of the type size_t. Valid alignments include only
those values returned by an alignof expression for fundamental types, plus an
additional implementation-defined set of values, which may be empty. Every valid
alignment value shall be a nonnegative integral power of two.
- 56) As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
- 57) Every over-aligned type is, or contains, a structure or union type with a member to which an extended
+ <sup><a name="note56" href="#note56"><b>56)</b></a></sup> As specified in <a href="#6.2.1">6.2.1</a>, the later declaration might hide the prior declaration.
+ <sup><a name="note57" href="#note57"><b>57)</b></a></sup> Every over-aligned type is, or contains, a structure or union type with a member to which an extended
alignment has been applied.
[<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
alignment has been applied.
[<a name="p48" href="#p48">page 48</a>] (<a href="#Contents">Contents</a>)
-- A bit-field of type _Bool, int, signed int, or unsigned int.
If an int can represent all values of the original type (as restricted by the width, for a
bit-field), the value is converted to an int; otherwise, it is converted to an unsigned
-- A bit-field of type _Bool, int, signed int, or unsigned int.
If an int can represent all values of the original type (as restricted by the width, for a
bit-field), the value is converted to an int; otherwise, it is converted to an unsigned
integer promotions.
3 The integer promotions preserve value including sign. As discussed earlier, whether a
''plain'' char is treated as signed is implementation-defined.
integer promotions.
3 The integer promotions preserve value including sign. As discussed earlier, whether a
''plain'' char is treated as signed is implementation-defined.
(<a href="#6.7.2.1">6.7.2.1</a>).
<a name="6.3.1.2" href="#6.3.1.2"><b> 6.3.1.2 Boolean type</b></a>
1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
(<a href="#6.7.2.1">6.7.2.1</a>).
<a name="6.3.1.2" href="#6.3.1.2"><b> 6.3.1.2 Boolean type</b></a>
1 When any scalar value is converted to _Bool, the result is 0 if the value compares equal
<a name="6.3.1.3" href="#6.3.1.3"><b> 6.3.1.3 Signed and unsigned integers</b></a>
1 When a value with integer type is converted to another integer type other than _Bool, if
the value can be represented by the new type, it is unchanged.
2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
subtracting one more than the maximum value that can be represented in the new type
<a name="6.3.1.3" href="#6.3.1.3"><b> 6.3.1.3 Signed and unsigned integers</b></a>
1 When a value with integer type is converted to another integer type other than _Bool, if
the value can be represented by the new type, it is unchanged.
2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or
subtracting one more than the maximum value that can be represented in the new type
3 Otherwise, the new type is signed and the value cannot be represented in it; either the
result is implementation-defined or an implementation-defined signal is raised.
<a name="6.3.1.4" href="#6.3.1.4"><b> 6.3.1.4 Real floating and integer</b></a>
1 When a finite value of real floating type is converted to an integer type other than _Bool,
the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
3 Otherwise, the new type is signed and the value cannot be represented in it; either the
result is implementation-defined or an implementation-defined signal is raised.
<a name="6.3.1.4" href="#6.3.1.4"><b> 6.3.1.4 Real floating and integer</b></a>
1 When a finite value of real floating type is converted to an integer type other than _Bool,
the fractional part is discarded (i.e., the value is truncated toward zero). If the value of
argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
shift operators, as specified by their respective subclauses.
argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
shift operators, as specified by their respective subclauses.
- 59) NaNs do not compare equal to 0 and thus convert to 1.
- 60) The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
- 61) The remaindering operation performed when a value of integer type is converted to unsigned type
+ <sup><a name="note59" href="#note59"><b>59)</b></a></sup> NaNs do not compare equal to 0 and thus convert to 1.
+ <sup><a name="note60" href="#note60"><b>60)</b></a></sup> The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
+ <sup><a name="note61" href="#note61"><b>61)</b></a></sup> The remaindering operation performed when a value of integer type is converted to unsigned type
need not be performed when a value of real floating type is converted to unsigned type. Thus, the
range of portable real floating values is (-1, Utype_MAX+1).
need not be performed when a value of real floating type is converted to unsigned type. Thus, the
range of portable real floating values is (-1, Utype_MAX+1).
corresponding real type is double.
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 double.
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
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, 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.
corresponding to the type of the operand with signed integer type.
2 The values of floating operands and of the results of floating expressions may be
represented in greater precision and range than that required by the type; the types are not
corresponding to the type of the operand with signed integer type.
2 The values of floating operands and of the results of floating expressions may be
represented in greater precision and range than that required by the type; the types are not
[<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
<a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
<a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
1 An lvalue is an expression (with an object type other than void) that potentially
[<a name="p53" href="#p53">page 53</a>] (<a href="#Contents">Contents</a>)
<a name="6.3.2" href="#6.3.2"><b> 6.3.2 Other operands</b></a>
<a name="6.3.2.1" href="#6.3.2.1"><b> 6.3.2.1 Lvalues, arrays, and function designators</b></a>
1 An lvalue is an expression (with an object type other than void) that potentially
behavior is undefined. When an object is said to have a particular type, the type is
specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that
does not have array type, does not have an incomplete type, does not have a const-
behavior is undefined. When an object is said to have a particular type, the type is
specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that
does not have array type, does not have an incomplete type, does not have a const-
the array object and is not an lvalue. If the array object has register storage class, the
behavior is undefined.
4 A function designator is an expression that has function type. Except when it is the
the array object and is not an lvalue. If the array object has register storage class, the
behavior is undefined.
4 A function designator is an expression that has function type. Except when it is the
operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
as the ''value of an expression''.
An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
operand E1 is required to be a (modifiable) lvalue. It is perhaps better considered as representing an
object ''locator value''. What is sometimes called ''rvalue'' is in this International Standard described
as the ''value of an expression''.
An obvious example of an lvalue is an identifier of an object. As a further example, if E is a unary
expression that is a pointer to an object, *E is an lvalue that designates the object to which E points.
designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
[<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
designator and violates the constraint in <a href="#6.5.3.4">6.5.3.4</a>.
[<a name="p54" href="#p54">page 54</a>] (<a href="#Contents">Contents</a>)
the q-qualified version of the type; the values stored in the original and converted pointers
shall compare equal.
3 An integer constant expression with the value 0, or such an expression cast to type
the q-qualified version of the type; the values stored in the original and converted pointers
shall compare equal.
3 An integer constant expression with the value 0, or such an expression cast to type
pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
to a pointer to any object or function.
4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
Any two null pointers shall compare equal.
5 An integer may be converted to any pointer type. Except as previously specified, the
result is implementation-defined, might not be correctly aligned, might not point to an
pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal
to a pointer to any object or function.
4 Conversion of a null pointer to another pointer type yields a null pointer of that type.
Any two null pointers shall compare equal.
5 An integer may be converted to any pointer type. Except as previously specified, the
result is implementation-defined, might not be correctly aligned, might not point to an
6 Any pointer type may be converted to an integer type. Except as previously specified, the
result is implementation-defined. If the result cannot be represented in the integer type,
the behavior is undefined. The result need not be in the range of values of any integer
6 Any pointer type may be converted to an integer type. Except as previously specified, the
result is implementation-defined. If the result cannot be represented in the integer type,
the behavior is undefined. The result need not be in the range of values of any integer
- 66) The macro NULL is defined in <a href="#7.19"><stddef.h></a> (and other headers) as a null pointer constant; see <a href="#7.19">7.19</a>.
- 67) The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
+ <sup><a name="note66" href="#note66"><b>66)</b></a></sup> The macro NULL is defined in <a href="#7.19"><stddef.h></a> (and other headers) as a null pointer constant; see <a href="#7.19">7.19</a>.
+ <sup><a name="note67" href="#note67"><b>67)</b></a></sup> The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to
be consistent with the addressing structure of the execution environment.
[<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
7 A pointer to an object type may be converted to a pointer to a different object type. If the
be consistent with the addressing structure of the execution environment.
[<a name="p55" href="#p55">page 55</a>] (<a href="#Contents">Contents</a>)
7 A pointer to an object type may be converted to a pointer to a different object type. If the
undefined. Otherwise, when converted back again, the result shall compare equal to the
original pointer. When a pointer to an object is converted to a pointer to a character type,
the result points to the lowest addressed byte of the object. Successive increments of the
undefined. Otherwise, when converted back again, the result shall compare equal to the
original pointer. When a pointer to an object is converted to a pointer to a character type,
the result points to the lowest addressed byte of the object. Successive increments of the
pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
correctly aligned for a pointer to type C.
pointer to type B, which in turn is correctly aligned for a pointer to type C, then a pointer to type A is
correctly aligned for a pointer to type C.
phases 3 through 6. The categories of preprocessing tokens are: header names,
identifiers, preprocessing numbers, character constants, string literals, punctuators, and
single non-white-space characters that do not lexically match the other preprocessing
phases 3 through 6. The categories of preprocessing tokens are: header names,
identifiers, preprocessing numbers, character constants, string literals, punctuators, and
single non-white-space characters that do not lexically match the other preprocessing
undefined. Preprocessing tokens can be separated by white space; this consists of
comments (described later), or white-space characters (space, horizontal tab, new-line,
vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
undefined. Preprocessing tokens can be separated by white space; this consists of
comments (described later), or white-space characters (space, horizontal tab, new-line,
vertical tab, and form-feed), or both. As described in <a href="#6.10">6.10</a>, in certain circumstances
- 69) An additional category, placemarkers, is used internally in translation phase 4 (see <a href="#6.10.3.3">6.10.3.3</a>); it cannot
+ <sup><a name="note69" href="#note69"><b>69)</b></a></sup> An additional category, placemarkers, is used internally in translation phase 4 (see <a href="#6.10.3.3">6.10.3.3</a>); it cannot
keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
[<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for
[<a name="p58" href="#p58">page 58</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
<a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
<b> Syntax</b>
<a name="6.4.2" href="#6.4.2"><b> 6.4.2 Identifiers</b></a>
<a name="6.4.2.1" href="#6.4.2.1"><b> 6.4.2.1 General</b></a>
<b> Syntax</b>
one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
There is no specific limit on the maximum length of an identifier.
3 Each universal character name in an identifier shall designate a character whose encoding
one or more entities as described in <a href="#6.2.1">6.2.1</a>. Lowercase and uppercase letters are distinct.
There is no specific limit on the maximum length of an identifier.
3 Each universal character name in an identifier shall designate a character whose encoding
shall not be a universal character name designating a character whose encoding falls into
one of the ranges specified in <a href="#D.2">D.2</a>. An implementation may allow multibyte characters
that are not part of the basic source character set to appear in identifiers; which characters
shall not be a universal character name designating a character whose encoding falls into
one of the ranges specified in <a href="#D.2">D.2</a>. An implementation may allow multibyte characters
that are not part of the basic source character set to appear in identifiers; which characters
- 70) One possible specification for imaginary types appears in <a href="#G">annex G</a>.
- 71) On systems in which linkers cannot accept extended characters, an encoding of the universal character
+ <sup><a name="note70" href="#note70"><b>70)</b></a></sup> One possible specification for imaginary types appears in <a href="#G">annex G</a>.
+ <sup><a name="note71" href="#note71"><b>71)</b></a></sup> On systems in which linkers cannot accept extended characters, an encoding of the universal character
name may be used in forming valid external identifiers. For example, some otherwise unused
character or sequence of characters may be used to encode the \u in a universal character name.
Extended characters may produce a long external identifier.
name may be used in forming valid external identifiers. For example, some otherwise unused
character or sequence of characters may be used to encode the \u in a universal character name.
Extended characters may produce a long external identifier.
1 The identifier __func__ shall be implicitly declared by the translator as if,
immediately following the opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
1 The identifier __func__ shall be implicitly declared by the translator as if,
immediately following the opening brace of each function definition, the declaration
static const char __func__[] = "function-name";
2 This name is encoded as if the implicit declaration had been written in the source
character set and then translated into the execution character set as indicated in translation
phase 5.
2 This name is encoded as if the implicit declaration had been written in the source
character set and then translated into the execution character set as indicated in translation
phase 5.
identifier is explicitly declared using the name __func__, the behavior is undefined.
[<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
identifier is explicitly declared using the name __func__, the behavior is undefined.
[<a name="p60" href="#p60">page 60</a>] (<a href="#Contents">Contents</a>)
<b> Constraints</b>
2 A universal character name shall not specify a character whose short identifier is less than
00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
<b> Constraints</b>
2 A universal character name shall not specify a character whose short identifier is less than
00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through
<b> Description</b>
3 Universal character names may be used in identifiers, character constants, and string
literals to designate characters that are not in the basic character set.
<b> Semantics</b>
4 The universal character name \Unnnnnnnn designates the character whose eight-digit
<b> Description</b>
3 Universal character names may be used in identifiers, character constants, and string
literals to designate characters that are not in the basic character set.
<b> Semantics</b>
4 The universal character name \Unnnnnnnn designates the character whose eight-digit
character name \unnnn designates the character whose four-digit short identifier is nnnn
(and whose eight-digit short identifier is 0000nnnn).
character name \unnnn designates the character whose four-digit short identifier is nnnn
(and whose eight-digit short identifier is 0000nnnn).
type float. If suffixed by the letter l or L, it has type long double.
5 Floating constants are converted to internal format as if at translation-time. The
conversion of a floating constant shall not raise an exceptional condition or a floating-
type float. If suffixed by the letter l or L, it has type long double.
5 Floating constants are converted to internal format as if at translation-time. The
conversion of a floating constant shall not raise an exceptional condition or a floating-
convert to the same internal format with the same value.
Recommended practice
6 The implementation should produce a diagnostic message if a hexadecimal constant
convert to the same internal format with the same value.
Recommended practice
6 The implementation should produce a diagnostic message if a hexadecimal constant
7 The translation-time conversion of floating constants should match the execution-time
conversion of character strings by library functions, such as strtod, given matching
inputs suitable for both conversions, the same result format, and default execution-time
7 The translation-time conversion of floating constants should match the execution-time
conversion of character strings by library functions, such as strtod, given matching
inputs suitable for both conversions, the same result format, and default execution-time
- 75) <a href="#1.23">1.23</a>, 1.230, 123e-2, 123e-02, and 1.23L are all different source forms and thus need not
+ <sup><a name="note75" href="#note75"><b>75)</b></a></sup> <a href="#1.23">1.23</a>, 1.230, 123e-2, 123e-02, and 1.23L are all different source forms and thus need not
floating constants (see <a href="#7.22.1.3">7.22.1.3</a>).
[<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
floating constants (see <a href="#7.22.1.3">7.22.1.3</a>).
[<a name="p66" href="#p66">page 66</a>] (<a href="#Contents">Contents</a>)
8 In addition, characters not in the basic character set are representable by universal
character names and certain nongraphic characters are representable by escape sequences
consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
8 In addition, characters not in the basic character set are representable by universal
character names and certain nongraphic characters are representable by escape sequences
consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t,
the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
[<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
the result is not a token and a diagnostic is required. See ''future language directions'' (<a href="#6.11.4">6.11.4</a>).
[<a name="p69" href="#p69">page 69</a>] (<a href="#Contents">Contents</a>)
tokens can be concatenated and, if so, the treatment of the resulting multibyte character
sequence are implementation-defined.
6 In translation phase 7, a byte or code of value zero is appended to each multibyte
tokens can be concatenated and, if so, the treatment of the resulting multibyte character
sequence are implementation-defined.
6 In translation phase 7, a byte or code of value zero is appended to each multibyte
sequence is then used to initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string literals, the array elements have
type char, and are initialized with the individual bytes of the multibyte character
sequence is then used to initialize an array of static storage duration and length just
sufficient to contain the sequence. For character string literals, the array elements have
type char, and are initialized with the individual bytes of the multibyte character
<: :> <% %> %: %:%:
behave, respectively, the same as the six tokens
[ ] { } # ##
<: :> <% %> %: %:%:
behave, respectively, the same as the six tokens
[ ] { } # ##
Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
(<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
<a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
Forward references: expressions (<a href="#6.5">6.5</a>), declarations (<a href="#6.7">6.7</a>), preprocessing directives
(<a href="#6.10">6.10</a>), statements (<a href="#6.8">6.8</a>).
<a name="6.4.7" href="#6.4.7"><b> 6.4.7 Header names</b></a>
- 79) These tokens are sometimes called ''digraphs''.
- 80) Thus [ and <: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
+ <sup><a name="note79" href="#note79"><b>79)</b></a></sup> These tokens are sometimes called ''digraphs''.
+ <sup><a name="note80" href="#note80"><b>80)</b></a></sup> Thus [ and <: behave differently when ''stringized'' (see <a href="#6.10.3.2">6.10.3.2</a>), but can otherwise be freely
- 81) Thus, sequences of characters that resemble escape sequences cause undefined behavior.
- 82) For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
+ <sup><a name="note81" href="#note81"><b>81)</b></a></sup> Thus, sequences of characters that resemble escape sequences cause undefined behavior.
+ <sup><a name="note82" href="#note82"><b>82)</b></a></sup> For an example of a header name preprocessing token used in a #pragma directive, see <a href="#6.10.9">6.10.9</a>.
[<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
1 Except within a character constant, a string literal, or a comment, the characters /*
introduce a comment. The contents of such a comment are examined only to identify
[<a name="p74" href="#p74">page 74</a>] (<a href="#Contents">Contents</a>)
<a name="6.4.9" href="#6.4.9"><b> 6.4.9 Comments</b></a>
1 Except within a character constant, a string literal, or a comment, the characters /*
introduce a comment. The contents of such a comment are examined only to identify
2 Except within a character constant, a string literal, or a comment, the characters //
introduce a comment that includes all multibyte characters up to, but not including, the
next new-line character. The contents of such a comment are examined only to identify
2 Except within a character constant, a string literal, or a comment, the characters //
introduce a comment that includes all multibyte characters up to, but not including, the
next new-line character. The contents of such a comment are examined only to identify
on the same scalar object or a value computation using the value of the same scalar
object, the behavior is undefined. If there are multiple allowable orderings of the
subexpressions of an expression, the behavior is undefined if such an unsequenced side
on the same scalar object or a value computation using the value of the same scalar
object, the behavior is undefined. If there are multiple allowable orderings of the
subexpressions of an expression, the behavior is undefined if such an unsequenced side
- effect occurs in any of the orderings.84)
-3 The grouping of operators and operands is indicated by the syntax.85) Except as specified
- later, side effects and value computations of subexpressions are unsequenced.86) *
+ effect occurs in any of the orderings.<sup><a href="#note84"><b>84)</b></a></sup>
+3 The grouping of operators and operands is indicated by the syntax.<sup><a href="#note85"><b>85)</b></a></sup> Except as specified
+ later, side effects and value computations of subexpressions are unsequenced.<sup><a href="#note86"><b>86)</b></a></sup> *
4 Some operators (the unary operator ~, and the binary operators <<, >>, &, ^, and |,
collectively described as bitwise operators) are required to have operands that have
integer type. These operators yield values that depend on the internal representations of
4 Some operators (the unary operator ~, and the binary operators <<, >>, &, ^, and |,
collectively described as bitwise operators) are required to have operands that have
integer type. These operators yield values that depend on the internal representations of
as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
<a href="#6.5.1">6.5.1</a> through <a href="#6.5.6">6.5.6</a>. The exceptions are cast expressions (<a href="#6.5.4">6.5.4</a>) as operands of unary operators
as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the
expressions allowed as the operands of the binary + operator (<a href="#6.5.6">6.5.6</a>) are those expressions defined in
<a href="#6.5.1">6.5.1</a> through <a href="#6.5.6">6.5.6</a>. The exceptions are cast expressions (<a href="#6.5.4">6.5.4</a>) as operands of unary operators
the conditional operator ? : (<a href="#6.5.15">6.5.15</a>).
Within each major subclause, the operators have the same precedence. Left- or right-associativity is
indicated in each subclause by the syntax for the expressions discussed therein.
the conditional operator ? : (<a href="#6.5.15">6.5.15</a>).
Within each major subclause, the operators have the same precedence. Left- or right-associativity is
indicated in each subclause by the syntax for the expressions discussed therein.
indeterminately sequenced evaluations of its subexpressions need not be performed consistently in
different evaluations.
[<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
6 The effective type of an object for an access to its stored value is the declared type of the
indeterminately sequenced evaluations of its subexpressions need not be performed consistently in
different evaluations.
[<a name="p76" href="#p76">page 76</a>] (<a href="#Contents">Contents</a>)
6 The effective type of an object for an access to its stored value is the declared type of the
lvalue having a type that is not a character type, then the type of the lvalue becomes the
effective type of the object for that access and for subsequent accesses that do not modify
the stored value. If a value is copied into an object having no declared type using
lvalue having a type that is not a character type, then the type of the lvalue becomes the
effective type of the object for that access and for subsequent accesses that do not modify
the stored value. If a value is copied into an object having no declared type using
all other accesses to an object having no declared type, the effective type of the object is
simply the type of the lvalue used for the access.
7 An object shall have its stored value accessed only by an lvalue expression that has one of
all other accesses to an object having no declared type, the effective type of the object is
simply the type of the lvalue used for the access.
7 An object shall have its stored value accessed only by an lvalue expression that has one of
-- a type compatible with the effective type of the object,
-- a qualified version of a type compatible with the effective type of the object,
-- a type that is the signed or unsigned type corresponding to the effective type of the
-- a type compatible with the effective type of the object,
-- a qualified version of a type compatible with the effective type of the object,
-- a type that is the signed or unsigned type corresponding to the effective type of the
-- a character type.
8 A floating expression may be contracted, that is, evaluated as though it were a single
operation, thereby omitting rounding errors implied by the source code and the
-- a character type.
8 A floating expression may be contracted, that is, evaluated as though it were a single
operation, thereby omitting rounding errors implied by the source code and the
- 87) Allocated objects have no declared type.
- 88) The intent of this list is to specify those circumstances in which an object may or may not be aliased.
- 89) The intermediate operations in the contracted expression are evaluated as if to infinite precision and
+ <sup><a name="note87" href="#note87"><b>87)</b></a></sup> Allocated objects have no declared type.
+ <sup><a name="note88" href="#note88"><b>88)</b></a></sup> The intent of this list is to specify those circumstances in which an object may or may not be aliased.
+ <sup><a name="note89" href="#note89"><b>89)</b></a></sup> The intermediate operations in the contracted expression are evaluated as if to infinite precision and
range, while the final operation is rounded to the format determined by the expression evaluation
method. A contracted expression might also omit the raising of floating-point exceptions.
range, while the final operation is rounded to the format determined by the expression evaluation
method. A contracted expression might also omit the raising of floating-point exceptions.
combine multiple C operators. As contractions potentially undermine predictability, and can even
decrease accuracy for containing expressions, their use needs to be well-defined and clearly
documented.
combine multiple C operators. As contractions potentially undermine predictability, and can even
decrease accuracy for containing expressions, their use needs to be well-defined and clearly
documented.
<b> Semantics</b>
2 An identifier is a primary expression, provided it has been declared as designating an
object (in which case it is an lvalue) or a function (in which case it is a function
<b> Semantics</b>
2 An identifier is a primary expression, provided it has been declared as designating an
object (in which case it is an lvalue) or a function (in which case it is a function
3 A constant is a primary expression. Its type depends on its form and value, as detailed in
<a href="#6.4.4">6.4.4</a>.
4 A string literal is a primary expression. It is an lvalue with type as detailed in <a href="#6.4.5">6.4.5</a>.
3 A constant is a primary expression. Its type depends on its form and value, as detailed in
<a href="#6.4.4">6.4.4</a>.
4 A string literal is a primary expression. It is an lvalue with type as detailed in <a href="#6.4.5">6.4.5</a>.
2 A generic selection shall have no more than one default generic association. The type
name in a generic association shall specify a complete object type other than a variably
2 A generic selection shall have no more than one default generic association. The type
name in a generic association shall specify a complete object type other than a variably
(<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
<a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
<b> Constraints</b>
(<a href="#6.5.3.2">6.5.3.2</a>), array declarators (<a href="#6.7.6.2">6.7.6.2</a>).
<a name="6.5.2.2" href="#6.5.2.2"><b> 6.5.2.2 Function calls</b></a>
<b> Constraints</b>
returning void or returning a complete object type other than an array type.
2 If the expression that denotes the called function has a type that includes a prototype, the
number of arguments shall agree with the number of parameters. Each argument shall
returning void or returning a complete object type other than an array type.
2 If the expression that denotes the called function has a type that includes a prototype, the
number of arguments shall agree with the number of parameters. Each argument shall
function. The list of expressions specifies the arguments to the function.
4 An argument may be an expression of any complete object type. In preparing for the call
to a function, the arguments are evaluated, and each parameter is assigned the value of the
function. The list of expressions specifies the arguments to the function.
4 An argument may be an expression of any complete object type. In preparing for the call
to a function, the arguments are evaluated, and each parameter is assigned the value of the
5 If the expression that denotes the called function has type pointer to function returning an
object type, the function call expression has the same type as that object type, and has the
value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. *
5 If the expression that denotes the called function has type pointer to function returning an
object type, the function call expression has the same type as that object type, and has the
value determined as specified in <a href="#6.8.6.4">6.8.6.4</a>. Otherwise, the function call has type void. *
arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
change the value of the object pointed to. A parameter declared to have array or function type is
adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
arguments. On the other hand, it is possible to pass a pointer to an object, and the function may
change the value of the object pointed to. A parameter declared to have array or function type is
adjusted to have a pointer type as described in <a href="#6.9.1">6.9.1</a>.
arguments but before the actual call. Every evaluation in the calling function (including
other function calls) that is not otherwise specifically sequenced before or after the
execution of the body of the called function is indeterminately sequenced with respect to
arguments but before the actual call. Every evaluation in the calling function (including
other function calls) that is not otherwise specifically sequenced before or after the
execution of the body of the called function is indeterminately sequenced with respect to
11 Recursive function calls shall be permitted, both directly and indirectly through any chain
of other functions.
12 EXAMPLE In the function call
11 Recursive function calls shall be permitted, both directly and indirectly through any chain
of other functions.
12 EXAMPLE In the function call
second operand shall name a member of the type pointed to.
<b> Semantics</b>
3 A postfix expression followed by the . operator and an identifier designates a member of
second operand shall name a member of the type pointed to.
<b> Semantics</b>
3 A postfix expression followed by the . operator and an identifier designates a member of
the first expression is an lvalue. If the first expression has qualified type, the result has
the so-qualified version of the type of the designated member.
the first expression is an lvalue. If the first expression has qualified type, the result has
the so-qualified version of the type of the designated member.
- 94) In other words, function executions do not ''interleave'' with each other.
- 95) If the member used to read the contents of a union object is not the same as the member last used to
+ <sup><a name="note94" href="#note94"><b>94)</b></a></sup> In other words, function executions do not ''interleave'' with each other.
+ <sup><a name="note95" href="#note95"><b>95)</b></a></sup> If the member used to read the contents of a union object is not the same as the member last used to
store a value in the object, the appropriate part of the object representation of the value is reinterpreted
as an object representation in the new type as described in <a href="#6.2.6">6.2.6</a> (a process sometimes called ''type
punning''). This might be a trap representation.
store a value in the object, the appropriate part of the object representation of the value is reinterpreted
as an object representation in the new type as described in <a href="#6.2.6">6.2.6</a> (a process sometimes called ''type
punning''). This might be a trap representation.
4 A postfix expression followed by the -> operator and an identifier designates a member
of a structure or union object. The value is that of the named member of the object to
4 A postfix expression followed by the -> operator and an identifier designates a member
of a structure or union object. The value is that of the named member of the object to
a qualified type, the result has the so-qualified version of the type of the designated
member.
5 Accessing a member of an atomic structure or union object results in undefined
a qualified type, the result has the so-qualified version of the type of the designated
member.
5 Accessing a member of an atomic structure or union object results in undefined
6 One special guarantee is made in order to simplify the use of unions: if a union contains
several structures that share a common initial sequence (see below), and if the union
object currently contains one of these structures, it is permitted to inspect the common
6 One special guarantee is made in order to simplify the use of unions: if a union contains
several structures that share a common initial sequence (see below), and if the union
object currently contains one of these structures, it is permitted to inspect the common
with access to a member from another thread, where at least one access is a modification. Members
can be safely accessed using a non-atomic object which is assigned to or from the atomic object.
with access to a member from another thread, where at least one access is a modification. Members
can be safely accessed using a non-atomic object which is assigned to or from the atomic object.
updating the stored value of the operand. With respect to an indeterminately-sequenced
function call, the operation of postfix ++ is a single evaluation. Postfix ++ on an object
with atomic type is a read-modify-write operation with memory_order_seq_cst
updating the stored value of the operand. With respect to an indeterminately-sequenced
function call, the operation of postfix ++ is a single evaluation. Postfix ++ on an object
with atomic type is a read-modify-write operation with memory_order_seq_cst
3 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
it).
3 The postfix -- operator is analogous to the postfix ++ operator, except that the value of
the operand is decremented (that is, the value 1 of the appropriate type is subtracted from
it).
<b> Semantics</b>
3 A postfix expression that consists of a parenthesized type name followed by a brace-
enclosed list of initializers is a compound literal. It provides an unnamed object whose
<b> Semantics</b>
3 A postfix expression that consists of a parenthesized type name followed by a brace-
enclosed list of initializers is a compound literal. It provides an unnamed object whose
initializer list. If the compound literal occurs outside the body of a function, the object
has static storage duration; otherwise, it has automatic storage duration associated with
the enclosing block.
initializer list. If the compound literal occurs outside the body of a function, the object
has static storage duration; otherwise, it has automatic storage duration associated with
the enclosing block.
8 EXAMPLE 1 The file scope definition
int *p = (int []){2, 4};
initializes p to point to the first element of an array of two ints, the first having the value two and the
8 EXAMPLE 1 The file scope definition
int *p = (int []){2, 4};
initializes p to point to the first element of an array of two ints, the first having the value two and the
- 100) For example, subobjects without explicit initializers are initialized to zero.
- 101) This allows implementations to share storage for string literals and constant compound literals with
+ <sup><a name="note100" href="#note100"><b>100)</b></a></sup> For example, subobjects without explicit initializers are initialized to zero.
+ <sup><a name="note101" href="#note101"><b>101)</b></a></sup> This allows implementations to share storage for string literals and constant compound literals with
the same or overlapping representations.
[<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
the same or overlapping representations.
[<a name="p86" href="#p86">page 86</a>] (<a href="#Contents">Contents</a>)
a function designator; if it points to an object, the result is an lvalue designating the
object. If the operand has type ''pointer to type'', the result has type ''type''. If an
invalid value has been assigned to the pointer, the behavior of the unary * operator is
a function designator; if it points to an object, the result is an lvalue designating the
object. If the operand has type ''pointer to type'', the result has type ''type''. If an
invalid value has been assigned to the pointer, the behavior of the unary * operator is
Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
(<a href="#6.7.2.1">6.7.2.1</a>).
<a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
Forward references: storage-class specifiers (<a href="#6.7.1">6.7.1</a>), structure and union specifiers
(<a href="#6.7.2.1">6.7.2.1</a>).
<a name="6.5.3.3" href="#6.5.3.3"><b> 6.5.3.3 Unary arithmetic operators</b></a>
- 102) Thus, &*E is equivalent to E (even if E is a null pointer), and &(E1[E2]) to ((E1)+(E2)). It is
+ <sup><a name="note102" href="#note102"><b>102)</b></a></sup> Thus, &*E is equivalent to E (even if E is a null pointer), and &(E1[E2]) to ((E1)+(E2)). It is
always true that if E is a function designator or an lvalue that is a valid operand of the unary &
operator, *&E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
always true that if E is a function designator or an lvalue that is a valid operand of the unary &
operator, *&E is a function designator or an lvalue equal to E. If *P is an lvalue and T is the name of
an object pointer type, *(T)P is an lvalue that has a type compatible with that to which T points.
requirement of the element type.
4 When sizeof is applied to an operand that has type char, unsigned char, or
signed char, (or a qualified version thereof) the result is 1. When applied to an
requirement of the element type.
4 When sizeof is applied to an operand that has type char, unsigned char, or
signed char, (or a qualified version thereof) the result is 1. When applied to an
applied to an operand that has structure or union type, the result is the total number of
bytes in such an object, including internal and trailing padding.
5 The value of the result of both operators is implementation-defined, and its type (an
applied to an operand that has structure or union type, the result is the total number of
bytes in such an object, including internal and trailing padding.
5 The value of the result of both operators is implementation-defined, and its type (an
size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
[<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
size of the adjusted (pointer) type (see <a href="#6.9.1">6.9.1</a>).
[<a name="p90" href="#p90">page 90</a>] (<a href="#Contents">Contents</a>)
converted to any pointer type.
<b> Semantics</b>
5 Preceding an expression by a parenthesized type name converts the value of the
converted to any pointer type.
<b> Semantics</b>
5 Preceding an expression by a parenthesized type name converts the value of the
no conversion has no effect on the type or value of an expression.
6 If the value of the expression is represented with greater precision or range than required
by the type named by the cast (<a href="#6.3.1.8">6.3.1.8</a>), then the cast specifies a conversion even if the
no conversion has no effect on the type or value of an expression.
6 If the value of the expression is represented with greater precision or range than required
by the type named by the cast (<a href="#6.3.1.8">6.3.1.8</a>), then the cast specifies a conversion even if the
Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
Forward references: equality operators (<a href="#6.5.9">6.5.9</a>), function declarators (including
prototypes) (<a href="#6.7.6.3">6.7.6.3</a>), simple assignment (<a href="#6.5.16.1">6.5.16.1</a>), type names (<a href="#6.7.7">6.7.7</a>).
unqualified version of the type.
[<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
unqualified version of the type.
[<a name="p91" href="#p91">page 91</a>] (<a href="#Contents">Contents</a>)
second; the result of the % operator is the remainder. In both operations, if the value of
the second operand is zero, the behavior is undefined.
6 When integers are divided, the result of the / operator is the algebraic quotient with any
second; the result of the % operator is the remainder. In both operations, if the value of
the second operand is zero, the behavior is undefined.
6 When integers are divided, the result of the / operator is the algebraic quotient with any
(a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is
undefined.
<a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
(a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is
undefined.
<a name="6.5.6" href="#6.5.6"><b> 6.5.6 Additive operators</b></a>
to the last element of the same array object, the expression ((Q)+1)-(P) has the same
value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
expression P points one past the last element of the array object, even though the
to the last element of the same array object, the expression ((Q)+1)-(P) has the same
value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the
expression P points one past the last element of the array object, even though the
3 The integer promotions are performed on each of the operands. The type of the result is
that of the promoted left operand. If the value of the right operand is negative or is
3 The integer promotions are performed on each of the operands. The type of the result is
that of the promoted left operand. If the value of the right operand is negative or is
this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
by the size of the object originally pointed to, and the resulting pointer is converted back to the
original type. For pointer subtraction, the result of the difference between the character pointers is
this scheme the integer expression added to or subtracted from the converted pointer is first multiplied
by the size of the object originally pointed to, and the resulting pointer is converted back to the
original type. For pointer subtraction, the result of the difference between the character pointers is
P. In all other cases, the behavior is undefined.
6 Each of the operators < (less than), > (greater than), <= (less than or equal to), and >=
(greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is
P. In all other cases, the behavior is undefined.
6 Each of the operators < (less than), > (greater than), <= (less than or equal to), and >=
(greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is
-- one operand is a pointer and the other is a null pointer constant.
<b> Semantics</b>
3 The == (equal to) and != (not equal to) operators are analogous to the relational
-- one operand is a pointer and the other is a null pointer constant.
<b> Semantics</b>
3 The == (equal to) and != (not equal to) operators are analogous to the relational
specified relation is true and 0 if it is false. The result has type int. For any pair of
operands, exactly one of the relations is true.
4 If both of the operands have arithmetic type, the usual arithmetic conversions are
specified relation is true and 0 if it is false. The result has type int. For any pair of
operands, exactly one of the relations is true.
4 If both of the operands have arithmetic type, the usual arithmetic conversions are
means (a<b)<c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
means (a<b)<c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
both are pointers to one past the last element of the same array object, or one is a pointer
to one past the end of one array object and the other is a pointer to the start of a different
array object that happens to immediately follow the first array object in the address
both are pointers to one past the last element of the same array object, or one is a pointer
to one past the end of one array object and the other is a pointer to the start of a different
array object that happens to immediately follow the first array object in the address
7 For the purposes of these operators, a pointer to an object that is not an element of an
array behaves the same as a pointer to the first element of an array of length one with the
type of the object as its element type.
7 For the purposes of these operators, a pointer to an object that is not an element of an
array behaves the same as a pointer to the first element of an array of length one with the
type of the object as its element type.
adjacent members of a structure with no padding between them, or because the implementation chose
to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
adjacent members of a structure with no padding between them, or because the implementation chose
to place them so, even though they are unrelated. If prior invalid pointer operations (such as accesses
outside array bounds) produced undefined behavior, subsequent comparisons also produce undefined
evaluation of the second or third operand (whichever is evaluated). The second operand
is evaluated only if the first compares unequal to 0; the third operand is evaluated only if
the first compares equal to 0; the result is the value of the second or third operand
evaluation of the second or third operand (whichever is evaluated). The second operand
is evaluated only if the first compares unequal to 0; the third operand is evaluated only if
the first compares equal to 0; the result is the value of the second or third operand
5 If both the second and third operands have arithmetic type, the result type that would be
determined by the usual arithmetic conversions, were they applied to those two operands,
is the type of the result. If both the operands have structure or union type, the result has
5 If both the second and third operands have arithmetic type, the result type that would be
determined by the usual arithmetic conversions, were they applied to those two operands,
is the type of the result. If both the operands have structure or union type, the result has
is a pointer to void or a qualified version of void, in which case the result type is a
pointer to an appropriately qualified version of void.
is a pointer to void or a qualified version of void, in which case the result type is a
pointer to an appropriately qualified version of void.
2 An assignment operator shall have a modifiable lvalue as its left operand.
<b> Semantics</b>
3 An assignment operator stores a value in the object designated by the left operand. An
2 An assignment operator shall have a modifiable lvalue as its left operand.
<b> Semantics</b>
3 An assignment operator stores a value in the object designated by the left operand. An
an lvalue. The type of an assignment expression is the type the left operand would have
after lvalue conversion. The side effect of updating the stored value of the left operand is
sequenced after the value computations of the left and right operands. The evaluations of
an lvalue. The type of an assignment expression is the type the left operand would have
after lvalue conversion. The side effect of updating the stored value of the left operand is
sequenced after the value computations of the left and right operands. The evaluations of
when the object has volatile-qualified type.
[<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
<b> Constraints</b>
when the object has volatile-qualified type.
[<a name="p101" href="#p101">page 101</a>] (<a href="#Contents">Contents</a>)
<a name="6.5.16.1" href="#6.5.16.1"><b> 6.5.16.1 Simple assignment</b></a>
<b> Constraints</b>
-- the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
arithmetic type;
-- the left operand has an atomic, qualified, or unqualified version of a structure or union
-- the left operand has atomic, qualified, or unqualified arithmetic type, and the right has
arithmetic type;
-- the left operand has an atomic, qualified, or unqualified version of a structure or union
(specified in <a href="#6.3.2.1">6.3.2.1</a>) that changes lvalues to ''the value of the expression'' and thus removes any type
qualifiers that were applied to the type category of the expression (for example, it removes const but
not volatile from the type int volatile * const).
(specified in <a href="#6.3.2.1">6.3.2.1</a>) that changes lvalues to ''the value of the expression'' and thus removes any type
qualifiers that were applied to the type category of the expression (for example, it removes const but
not volatile from the type int volatile * const).
assignment is a single evaluation. If E1 has an atomic type, compound assignment is a
read-modify-write operation with memory_order_seq_cst memory order
assignment is a single evaluation. If E1 has an atomic type, compound assignment is a
read-modify-write operation with memory_order_seq_cst memory order
<b> Semantics</b>
2 The left operand of a comma operator is evaluated as a void expression; there is a
sequence point between its evaluation and that of the right operand. Then the right
<b> Semantics</b>
2 The left operand of a comma operator is evaluated as a void expression; there is a
sequence point between its evaluation and that of the right operand. Then the right
3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
of initializers). On the other hand, it can be used within a parenthesized expression or within the second
3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot
appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists
of initializers). On the other hand, it can be used within a parenthesized expression or within the second
result = tmp op (E2);
} while (!atomic_compare_exchange_strong(&E1, &tmp, result));
with result being the result of the operation.
result = tmp op (E2);
} while (!atomic_compare_exchange_strong(&E1, &tmp, result));
with result being the result of the operation.
<b> Constraints</b>
3 Constant expressions shall not contain assignment, increment, decrement, function-call,
or comma operators, except when they are contained within a subexpression that is not
<b> Constraints</b>
3 Constant expressions shall not contain assignment, increment, decrement, function-call,
or comma operators, except when they are contained within a subexpression that is not
4 Each constant expression shall evaluate to a constant that is in the range of representable
values for its type.
<b> Semantics</b>
5 An expression that evaluates to a constant is required in several contexts. If a floating
expression is evaluated in the translation environment, the arithmetic precision and range
shall be at least as great as if the expression were being evaluated in the execution
4 Each constant expression shall evaluate to a constant that is in the range of representable
values for its type.
<b> Semantics</b>
5 An expression that evaluates to a constant is required in several contexts. If a floating
expression is evaluated in the translation environment, the arithmetic precision and range
shall be at least as great as if the expression were being evaluated in the execution
that are integer constants, enumeration constants, character constants, sizeof
expressions whose results are integer constants, and floating constants that are the
immediate operands of casts. Cast operators in an integer constant expression shall only
that are integer constants, enumeration constants, character constants, sizeof
expressions whose results are integer constants, and floating constants that are the
immediate operands of casts. Cast operators in an integer constant expression shall only
- 115) The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
- 116) The use of evaluation formats as characterized by FLT_EVAL_METHOD also applies to evaluation in
+ <sup><a name="note115" href="#note115"><b>115)</b></a></sup> The operand of a sizeof operator is usually not evaluated (<a href="#6.5.3.4">6.5.3.4</a>).
+ <sup><a name="note116" href="#note116"><b>116)</b></a></sup> The use of evaluation formats as characterized by FLT_EVAL_METHOD also applies to evaluation in
member of a structure, the value of an enumeration constant, and the size of a non-variable length
array. Further constraints that apply to the integer constant expressions used in conditional-inclusion
preprocessing directives are discussed in <a href="#6.10.1">6.10.1</a>.
member of a structure, the value of an enumeration constant, and the size of a non-variable length
array. Further constraints that apply to the integer constant expressions used in conditional-inclusion
preprocessing directives are discussed in <a href="#6.10.1">6.10.1</a>.
accessed by use of these operators.
10 An implementation may accept other forms of constant expressions.
11 The semantic rules for the evaluation of a constant expression are the same as for
accessed by use of these operators.
10 An implementation may accept other forms of constant expressions.
11 The semantic rules for the evaluation of a constant expression are the same as for
5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
of an identifier is a declaration for that identifier that:
-- for an object, causes storage to be reserved for that object;
5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition
of an identifier is a declaration for that identifier that:
-- for an object, causes storage to be reserved for that object;
3 In the declaration of an object with block scope, if the declaration specifiers include
_Thread_local, they shall also include either static or extern. If
_Thread_local appears in any declaration of an object, it shall be present in every
3 In the declaration of an object with block scope, if the declaration specifiers include
_Thread_local, they shall also include either static or extern. If
_Thread_local appears in any declaration of an object, it shall be present in every
[<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
5 A declaration of an identifier for an object with storage-class specifier register
suggests that access to the object be as fast as possible. The extent to which such
[<a name="p108" href="#p108">page 108</a>] (<a href="#Contents">Contents</a>)
5 A declaration of an identifier for an object with storage-class specifier register
suggests that access to the object be as fast as possible. The extent to which such
6 The declaration of an identifier for a function that has block scope shall have no explicit
storage-class specifier other than extern.
7 If an aggregate or union object is declared with a storage-class specifier other than
6 The declaration of an identifier for a function that has block scope shall have no explicit
storage-class specifier other than extern.
7 If an aggregate or union object is declared with a storage-class specifier other than
whether or not addressable storage is actually used, the address of any part of an object declared with
storage-class specifier register cannot be computed, either explicitly (by use of the unary &
operator as discussed in <a href="#6.5.3.2">6.5.3.2</a>) or implicitly (by converting an array name to a pointer as discussed in
whether or not addressable storage is actually used, the address of any part of an object declared with
storage-class specifier register cannot be computed, either explicitly (by use of the unary &
operator as discussed in <a href="#6.5.3.2">6.5.3.2</a>) or implicitly (by converting an array name to a pointer as discussed in
element of an array.
4 The expression that specifies the width of a bit-field shall be an integer constant
expression with a nonnegative value that does not exceed the width of an object of the
element of an array.
4 The expression that specifies the width of a bit-field shall be an integer constant
expression with a nonnegative value that does not exceed the width of an object of the
zero, the declaration shall have no declarator.
5 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
int, unsigned int, or some other implementation-defined type. It is
zero, the declaration shall have no declarator.
5 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed
int, unsigned int, or some other implementation-defined type. It is
The type is incomplete until immediately after the } that terminates the list, and complete
thereafter.
9 A member of a structure or union may have any complete object type other than a
The type is incomplete until immediately after the } that terminates the list, and complete
thereafter.
9 A member of a structure or union may have any complete object type other than a
or arrays of bit-field objects.
[<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
or arrays of bit-field objects.
[<a name="p112" href="#p112">page 112</a>] (<a href="#Contents">Contents</a>)
low-order or low-order to high-order) is implementation-defined. The alignment of the
addressable storage unit is unspecified.
12 A bit-field declaration with no declarator, but only a colon and a width, indicates an
low-order or low-order to high-order) is implementation-defined. The alignment of the
addressable storage unit is unspecified.
12 A bit-field declaration with no declarator, but only a colon and a width, indicates an
indicates that no further bit-field is to be packed into the unit in which the previous bit-
field, if any, was placed.
13 An unnamed member of structure type with no tag is called an anonymous structure; an
indicates that no further bit-field is to be packed into the unit in which the previous bit-
field, if any, was placed.
13 An unnamed member of structure type with no tag is called an anonymous structure; an
- 125) As specified in <a href="#6.7.2">6.7.2</a> above, if the actual type specifier used is int or a typedef-name defined as int,
+ <sup><a name="note125" href="#note125"><b>125)</b></a></sup> As specified in <a href="#6.7.2">6.7.2</a> above, if the actual type specifier used is int or a typedef-name defined as int,
constant expression that has a value representable as an int.
<b> Semantics</b>
3 The identifiers in an enumerator list are declared as constants that have type int and
constant expression that has a value representable as an int.
<b> Semantics</b>
3 The identifiers in an enumerator list are declared as constants that have type int and
enumeration constant as the value of the constant expression. If the first enumerator has
no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
defines its enumeration constant as the value of the constant expression obtained by
enumeration constant as the value of the constant expression. If the first enumerator has
no =, the value of its enumeration constant is 0. Each subsequent enumerator with no =
defines its enumeration constant as the value of the constant expression obtained by
= may produce enumeration constants with values that duplicate other values in the same
enumeration.) The enumerators of an enumeration are also known as its members.
4 Each enumerated type shall be compatible with char, a signed integer type, or an
= may produce enumeration constants with values that duplicate other values in the same
enumeration.) The enumerators of an enumeration are also known as its members.
4 Each enumerated type shall be compatible with char, a signed integer type, or an
capable of representing the values of all the members of the enumeration. The
enumerated type is incomplete until immediately after the } that terminates the list of
enumerator declarations, and complete thereafter.
capable of representing the values of all the members of the enumeration. The
enumerated type is incomplete until immediately after the } that terminates the list of
enumerator declarations, and complete thereafter.
<b> Semantics</b>
4 All declarations of structure, union, or enumerated types that have the same scope and
use the same tag declare the same type. Irrespective of whether there is a tag or what
<b> Semantics</b>
4 All declarations of structure, union, or enumerated types that have the same scope and
use the same tag declare the same type. Irrespective of whether there is a tag or what
until immediately after the closing brace of the list defining the content, and complete
thereafter.
5 Two declarations of structure, union, or enumerated types which are in different scopes or
until immediately after the closing brace of the list defining the content, and complete
thereafter.
5 Two declarations of structure, union, or enumerated types which are in different scopes or
needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
when a pointer to or a function returning a structure or union is being declared. (See incomplete types
in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
needed, for example, when a typedef name is declared to be a specifier for a structure or union, or
when a pointer to or a function returning a structure or union is being declared. (See incomplete types
in <a href="#6.2.5">6.2.5</a>.) The specification has to be complete before such a function is called or defined.
or
enum identifieropt { enumerator-list , }
declares a structure, union, or enumerated type. The list defines the structure content,
or
enum identifieropt { enumerator-list , }
declares a structure, union, or enumerated type. The list defines the structure content,
- union content, or enumeration content. If an identifier is provided,130) the type specifier
+ union content, or enumeration content. If an identifier is provided,<sup><a href="#note130"><b>130)</b></a></sup> the type specifier
also declares the identifier to be the tag of that type.
7 A declaration of the form
struct-or-union identifier ;
also declares the identifier to be the tag of that type.
7 A declaration of the form
struct-or-union identifier ;
8 If a type specifier of the form
struct-or-union identifier
occurs other than as part of one of the above forms, and no other declaration of the
8 If a type specifier of the form
struct-or-union identifier
occurs other than as part of one of the above forms, and no other declaration of the
- 130) If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
+ <sup><a name="note130" href="#note130"><b>130)</b></a></sup> If there is no identifier, the type can, within the translation unit, only be referred to by the declaration
of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
can make use of that typedef name to declare objects having the specified structure, union, or
enumerated type.
of which it is a part. Of course, when the declaration is of a typedef name, subsequent declarations
can make use of that typedef name to declare objects having the specified structure, union, or
enumerated type.
5 If the same qualifier appears more than once in the same specifier-qualifier-list, either
directly or via one or more typedefs, the behavior is the same as if it appeared only
once. If other qualifiers appear along with the _Atomic qualifier in a specifier-qualifier-
5 If the same qualifier appears more than once in the same specifier-qualifier-list, either
directly or via one or more typedefs, the behavior is the same as if it appeared only
once. If other qualifiers appear along with the _Atomic qualifier in a specifier-qualifier-
6 If an attempt is made to modify an object defined with a const-qualified type through use
of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
made to refer to an object defined with a volatile-qualified type through use of an lvalue
6 If an attempt is made to modify an object defined with a const-qualified type through use
of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is
made to refer to an object defined with a volatile-qualified type through use of an lvalue
7 An object that has volatile-qualified type may be modified in ways unknown to the
implementation or have other unknown side effects. Therefore any expression referring
to such an object shall be evaluated strictly according to the rules of the abstract machine,
7 An object that has volatile-qualified type may be modified in ways unknown to the
implementation or have other unknown side effects. Therefore any expression referring
to such an object shall be evaluated strictly according to the rules of the abstract machine,
never actually defined as objects in the program (such as an object at a memory-mapped input/output
address).
[<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
never actually defined as objects in the program (such as an object at a memory-mapped input/output
address).
[<a name="p120" href="#p120">page 120</a>] (<a href="#Contents">Contents</a>)
has volatile-qualified type is implementation-defined.
8 An object that is accessed through a restrict-qualified pointer has a special association
with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
has volatile-qualified type is implementation-defined.
8 An object that is accessed through a restrict-qualified pointer has a special association
with that pointer. This association, defined in <a href="#6.7.3.1">6.7.3.1</a> below, requires that all accesses to
- that object use, directly or indirectly, the value of that particular pointer.135) The intended
+ that object use, directly or indirectly, the value of that particular pointer.<sup><a href="#note135"><b>135)</b></a></sup> The intended
use of the restrict qualifier (like the register storage class) is to promote
optimization, and deleting all instances of the qualifier from all preprocessing translation
units composing a conforming program does not change its meaning (i.e., observable
behavior).
9 If the specification of an array type includes any type qualifiers, the element type is so-
qualified, not the array type. If the specification of a function type includes any type
use of the restrict qualifier (like the register storage class) is to promote
optimization, and deleting all instances of the qualifier from all preprocessing translation
units composing a conforming program does not change its meaning (i.e., observable
behavior).
9 If the specification of an array type includes any type qualifiers, the element type is so-
qualified, not the array type. If the specification of a function type includes any type
10 For two qualified types to be compatible, both shall have the identically qualified version
of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
does not affect the specified type.
10 For two qualified types to be compatible, both shall have the identically qualified version
of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers
does not affect the specified type.
input/output port or an object accessed by an asynchronously interrupting function. Actions on
objects so declared shall not be ''optimized out'' by an implementation or reordered except as
permitted by the rules for evaluating expressions.
input/output port or an object accessed by an asynchronously interrupting function. Actions on
objects so declared shall not be ''optimized out'' by an implementation or reordered except as
permitted by the rules for evaluating expressions.
whatever function is called at program startup in a freestanding environment).
3 In what follows, a pointer expression E is said to be based on object P if (at some
sequence point in the execution of B prior to the evaluation of E) modifying P to point to
whatever function is called at program startup in a freestanding environment).
3 In what follows, a pointer expression E is said to be based on object P if (at some
sequence point in the execution of B prior to the evaluation of E) modifying P to point to
Note that ''based'' is defined only for expressions with pointer types.
4 During each execution of B, let L be any lvalue that has &L based on P. If L is used to
access the value of the object X that it designates, and X is also modified (by any means),
Note that ''based'' is defined only for expressions with pointer types.
4 During each execution of B, let L be any lvalue that has &L based on P. If L is used to
access the value of the object X that it designates, and X is also modified (by any means),
indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
expressions *p and p[1] are not.
indirectly through P. For example, if identifier p has type (int **restrict), then the pointer
expressions p and p+1 are based on the restricted pointer object designated by p, but the pointer
expressions *p and p[1] are not.
5 A function specifier may appear more than once; the behavior is the same as if it
appeared only once.
6 A function declared with an inline function specifier is an inline function. Making a *
5 A function specifier may appear more than once; the behavior is the same as if it
appeared only once.
6 A function declared with an inline function specifier is an inline function. Making a *
- function an inline function suggests that calls to the function be as fast as possible.138)
- The extent to which such suggestions are effective is implementation-defined.139)
+ function an inline function suggests that calls to the function be as fast as possible.<sup><a href="#note138"><b>138)</b></a></sup>
+ The extent to which such suggestions are effective is implementation-defined.<sup><a href="#note139"><b>139)</b></a></sup>
- 138) By using, for example, an alternative to the usual function call mechanism, such as ''inline
+ <sup><a name="note138" href="#note138"><b>138)</b></a></sup> By using, for example, an alternative to the usual function call mechanism, such as ''inline
substitution''. Inline substitution is not textual substitution, nor does it create a new function.
Therefore, for example, the expansion of a macro used within the body of the function uses the
definition it had at the point the function body appears, and not where the function is called; and
identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
single address, regardless of the number of inline definitions that occur in addition to the external
definition.
substitution''. Inline substitution is not textual substitution, nor does it create a new function.
Therefore, for example, the expansion of a macro used within the body of the function uses the
definition it had at the point the function body appears, and not where the function is called; and
identifiers refer to the declarations in scope where the body occurs. Likewise, the function has a
single address, regardless of the number of inline definitions that occur in addition to the external
definition.
- 139) For example, an implementation might never perform inline substitution, or might only perform inline
+ <sup><a name="note139" href="#note139"><b>139)</b></a></sup> For example, an implementation might never perform inline substitution, or might only perform inline
substitutions to calls in the scope of an inline declaration.
[<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
substitutions to calls in the scope of an inline declaration.
[<a name="p124" href="#p124">page 124</a>] (<a href="#Contents">Contents</a>)
and does not forbid an external definition in another translation unit. An inline definition
provides an alternative to an external definition, which a translator may use to implement
any call to the function in the same translation unit. It is unspecified whether a call to the
and does not forbid an external definition in another translation unit. An inline definition
provides an alternative to an external definition, which a translator may use to implement
any call to the function in the same translation unit. It is unspecified whether a call to the
8 A function declared with a _Noreturn function specifier shall not return to its caller.
Recommended practice
9 The implementation should produce a diagnostic message for a function declared with a
8 A function declared with a _Noreturn function specifier shall not return to its caller.
Recommended practice
9 The implementation should produce a diagnostic message for a function declared with a
corresponding inline definitions in other translation units, all corresponding objects with static storage
duration are also distinct in each of the definitions.
corresponding inline definitions in other translation units, all corresponding objects with static storage
duration are also distinct in each of the definitions.
<b> Semantics</b>
5 The first form is equivalent to _Alignas(alignof(type-name)).
6 The alignment requirement of the declared object or member is taken to be the specified
<b> Semantics</b>
5 The first form is equivalent to _Alignas(alignof(type-name)).
6 The alignment requirement of the declared object or member is taken to be the specified
alignment specifiers occur in a declaration, the effective alignment requirement is the
strictest specified alignment.
7 If the definition of an object has an alignment specifier, any other declaration of that
alignment specifiers occur in a declaration, the effective alignment requirement is the
strictest specified alignment.
7 If the definition of an object has an alignment specifier, any other declaration of that
D[ type-qualifier-list static assignment-expression ]
D[ type-qualifier-listopt * ]
and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
D[ type-qualifier-list static assignment-expression ]
D[ type-qualifier-listopt * ]
and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list
(See <a href="#6.7.6.3">6.7.6.3</a> for the meaning of the optional type qualifiers and the keyword static.)
4 If the size is not present, the array type is an incomplete type. If the size is * instead of
being an expression, the array type is a variable length array type of unspecified size,
(See <a href="#6.7.6.3">6.7.6.3</a> for the meaning of the optional type qualifiers and the keyword static.)
4 If the size is not present, the array type is an incomplete type. If the size is * instead of
being an expression, the array type is a variable length array type of unspecified size,
8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
9 If the list terminates with an ellipsis (, ...), no information about the number or types
8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to
function returning type'', as in <a href="#6.3.2.1">6.3.2.1</a>.
9 If the list terminates with an ellipsis (, ...), no information about the number or types
10 The special case of an unnamed parameter of type void as the only item in the list
specifies that the function has no parameters.
11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
10 The special case of an unnamed parameter of type void as the only item in the list
specifies that the function has no parameters.
11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a
list in a function declarator that is part of a definition of that function specifies that the
function has no parameters. The empty list in a function declarator that is not part of a
definition of that function specifies that no information about the number or types of the
list in a function declarator that is part of a definition of that function specifies that the
function has no parameters. The empty list in a function declarator that is not part of a
definition of that function specifies that no information about the number or types of the
correspond to the ellipsis.
[<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
correspond to the ellipsis.
[<a name="p132" href="#p132">page 132</a>] (<a href="#Contents">Contents</a>)
Moreover, the parameter type lists, if both are present, shall agree in the number of
parameters and in use of the ellipsis terminator; corresponding parameters shall have
compatible types. If one type has a parameter type list and the other type is specified by a
Moreover, the parameter type lists, if both are present, shall agree in the number of
parameters and in use of the ellipsis terminator; corresponding parameters shall have
compatible types. If one type has a parameter type list and the other type is specified by a
- 145) See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
- 146) If both function types are ''old style'', parameter types are not compared.
+ <sup><a name="note145" href="#note145"><b>145)</b></a></sup> See ''future language directions'' (<a href="#6.11.6">6.11.6</a>).
+ <sup><a name="note146" href="#note146"><b>146)</b></a></sup> If both function types are ''old style'', parameter types are not compared.
<b> Semantics</b>
2 In several contexts, it is necessary to specify a type. This is accomplished using a type
name, which is syntactically a declaration for a function or an object of that type that
<b> Semantics</b>
2 In several contexts, it is necessary to specify a type. This is accomplished using a type
name, which is syntactically a declaration for a function or an object of that type that
parameter specification'', rather than redundant parentheses around the omitted identifier.
[<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
parameter specification'', rather than redundant parentheses around the omitted identifier.
[<a name="p135" href="#p135">page 135</a>] (<a href="#Contents">Contents</a>)
17 Each brace-enclosed initializer list has an associated current object. When no
designations are present, subobjects of the current object are initialized in order according
to the type of the current object: array elements in increasing subscript order, structure
17 Each brace-enclosed initializer list has an associated current object. When no
designations are present, subobjects of the current object are initialized in order according
to the type of the current object: array elements in increasing subscript order, structure
- members in declaration order, and the first named member of a union.148) In contrast, a
+ members in declaration order, and the first named member of a union.<sup><a href="#note148"><b>148)</b></a></sup> In contrast, a
designation causes the following initializer to begin initialization of the subobject
described by the designator. Initialization then continues forward in order, beginning
designation causes the following initializer to begin initialization of the subobject
described by the designator. Initialization then continues forward in order, beginning
18 Each designator list begins its description with the current object associated with the
closest surrounding brace pair. Each item in the designator list (in order) specifies a
particular member of its current object and changes the current object for the next
18 Each designator list begins its description with the current object associated with the
closest surrounding brace pair. Each item in the designator list (in order) specifies a
particular member of its current object and changes the current object for the next
designator list is the subobject to be initialized by the following initializer.
19 The initialization shall occur in initializer list order, each initializer provided for a
designator list is the subobject to be initialized by the following initializer.
19 The initialization shall occur in initializer list order, each initializer provided for a
all subobjects that are not initialized explicitly shall be initialized implicitly the same as
objects that have static storage duration.
20 If the aggregate or union contains elements or members that are aggregates or unions,
all subobjects that are not initialized explicitly shall be initialized implicitly the same as
objects that have static storage duration.
20 If the aggregate or union contains elements or members that are aggregates or unions,
subobjects are initialized as usual, but the subaggregate or contained union does not become the
current object: current objects are associated only with brace-enclosed initializer lists.
subobjects are initialized as usual, but the subaggregate or contained union does not become the
current object: current objects are associated only with brace-enclosed initializer lists.
- 149) After a union member is initialized, the next object is not the next member of the union; instead, it is
+ <sup><a name="note149" href="#note149"><b>149)</b></a></sup> After a union member is initialized, the next object is not the next member of the union; instead, it is
initializer list.
23 The evaluations of the initialization list expressions are indeterminately sequenced with
respect to one another and thus the order in which any side effects occur is
initializer list.
23 The evaluations of the initialization list expressions are indeterminately sequenced with
respect to one another and thus the order in which any side effects occur is
24 EXAMPLE 1 Provided that <a href="#7.3"><complex.h></a> has been #included, the declarations
int i = <a href="#3.5">3.5</a>;
double complex c = 5 + 3 * I;
24 EXAMPLE 1 Provided that <a href="#7.3"><complex.h></a> has been #included, the declarations
int i = <a href="#3.5">3.5</a>;
double complex c = 5 + 3 * I;
3 A null statement (consisting of just a semicolon) performs no operations.
4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
discarding of its value may be made explicit by converting the expression to a void expression by means of
3 A null statement (consisting of just a semicolon) performs no operations.
4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the
discarding of its value may be made explicit by converting the expression to a void expression by means of
1 The controlling expression of a switch statement shall have integer type.
2 If a switch statement has an associated case or default label within the scope of an
identifier with a variably modified type, the entire switch statement shall be within the
1 The controlling expression of a switch statement shall have integer type.
2 If a switch statement has an associated case or default label within the scope of an
identifier with a variably modified type, the entire switch statement shall be within the
3 The expression of each case label shall be an integer constant expression and no two of
the case constant expressions in the same switch statement shall have the same value
after conversion. There may be at most one default label in a switch statement.
3 The expression of each case label shall be an integer constant expression and no two of
the case constant expressions in the same switch statement shall have the same value
after conversion. There may be at most one default label in a switch statement.
- 154) That is, the declaration either precedes the switch statement, or it follows the last case or
+ <sup><a name="note154" href="#note154"><b>154)</b></a></sup> That is, the declaration either precedes the switch statement, or it follows the last case or
default label associated with the switch that is in the block containing the declaration.
[<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
default label associated with the switch that is in the block containing the declaration.
[<a name="p148" href="#p148">page 148</a>] (<a href="#Contents">Contents</a>)
<b> Semantics</b>
4 An iteration statement causes a statement called the loop body to be executed repeatedly
until the controlling expression compares equal to 0. The repetition occurs regardless of
<b> Semantics</b>
4 An iteration statement causes a statement called the loop body to be executed repeatedly
until the controlling expression compares equal to 0. The repetition occurs regardless of
5 An iteration statement is a block whose scope is a strict subset of the scope of its
enclosing block. The loop body is also a block whose scope is a strict subset of the scope
of the iteration statement.
5 An iteration statement is a block whose scope is a strict subset of the scope of its
enclosing block. The loop body is also a block whose scope is a strict subset of the scope
of the iteration statement.
performs no input/output operations, does not access volatile objects, and performs no
synchronization or atomic operations in its body, controlling expression, or (in the case of
performs no input/output operations, does not access volatile objects, and performs no
synchronization or atomic operations in its body, controlling expression, or (in the case of
[<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
a for statement) its expression-3, may be assumed by the implementation to
[<a name="p149" href="#p149">page 149</a>] (<a href="#Contents">Contents</a>)
a for statement) its expression-3, may be assumed by the implementation to
<a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
1 The evaluation of the controlling expression takes place before each execution of the loop
body.
<a name="6.8.5.1" href="#6.8.5.1"><b> 6.8.5.1 The while statement</b></a>
1 The evaluation of the controlling expression takes place before each execution of the loop
body.
declaration, the scope of any identifiers it declares is the remainder of the declaration and
the entire loop, including the other two expressions; it is reached in the order of execution
before the first evaluation of the controlling expression. If clause-1 is an expression, it is
declaration, the scope of any identifiers it declares is the remainder of the declaration and
the entire loop, including the other two expressions; it is reached in the order of execution
before the first evaluation of the controlling expression. If clause-1 is an expression, it is
2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
nonzero constant.
<a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
nonzero constant.
<a name="6.8.6" href="#6.8.6"><b> 6.8.6 Jump statements</b></a>
- 158) Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
+ <sup><a name="note158" href="#note158"><b>158)</b></a></sup> Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
such that execution of the loop continues until the expression compares equal to 0; and expression-3
specifies an operation (such as incrementing) that is performed after each iteration.
the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
such that execution of the loop continues until the expression compares equal to 0; and expression-3
specifies an operation (such as incrementing) that is performed after each iteration.
contin: ; contin: ; contin: ;
} } while (/* ... */); }
unless the continue statement shown is in an enclosed iteration statement (in which
contin: ; contin: ; contin: ;
} } while (/* ... */); }
unless the continue statement shown is in an enclosed iteration statement (in which
<a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
<b> Constraints</b>
1 A break statement shall appear only in or as a switch body or loop body.
<a name="6.8.6.3" href="#6.8.6.3"><b> 6.8.6.3 The break statement</b></a>
<b> Constraints</b>
1 A break statement shall appear only in or as a switch body or loop body.
3 If a return statement with an expression is executed, the value of the expression is
returned to the caller as the value of the function call expression. If the expression has a
type different from the return type of the function in which it appears, the value is
3 If a return statement with an expression is executed, the value of the expression is
returned to the caller as the value of the function call expression. If the expression has a
type different from the return type of the function in which it appears, the value is
apply to the case of function return. The representation of floating-point values may have wider range
or precision than implied by the type; a cast may be used to remove this extra range and precision.
apply to the case of function return. The representation of floating-point values may have wider range
or precision than implied by the type; a cast may be used to remove this extra range and precision.
linkage is used in an expression (other than as part of the operand of a sizeof operator
whose result is an integer constant), somewhere in the entire program there shall be
exactly one external definition for the identifier; otherwise, there shall be no more than
linkage is used in an expression (other than as part of the operand of a sizeof operator
whose result is an integer constant), somewhere in the entire program there shall be
exactly one external definition for the identifier; otherwise, there shall be no more than
- 161) Thus, if an identifier declared with external linkage is not used in an expression, there need be no
+ <sup><a name="note161" href="#note161"><b>161)</b></a></sup> Thus, if an identifier declared with external linkage is not used in an expression, there need be no
external definition for it.
[<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
external definition for it.
[<a name="p154" href="#p154">page 154</a>] (<a href="#Contents">Contents</a>)
declaration-list declaration
<b> Constraints</b>
2 The identifier declared in a function definition (which is the name of the function) shall
declaration-list declaration
<b> Constraints</b>
2 The identifier declared in a function definition (which is the name of the function) shall
3 The return type of a function shall be void or a complete object type other than array
type.
4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
3 The return type of a function shall be void or a complete object type other than array
type.
4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or
typedef int F(void); // type F is ''function with no parameters
// returning int''
F f, g; // f and g both have type compatible with F
typedef int F(void); // type F is ''function with no parameters
// returning int''
F f, g; // f and g both have type compatible with F
and the identifiers of its parameters. If the declarator includes a parameter type list, the
list also specifies the types of all the parameters; such a declarator also serves as a
function prototype for later calls to the same function in the same translation unit. If the
and the identifiers of its parameters. If the declarator includes a parameter type list, the
list also specifies the types of all the parameters; such a declarator also serves as a
function prototype for later calls to the same function in the same translation unit. If the
following declaration list. In either case, the type of each parameter is adjusted as
described in <a href="#6.7.6.3">6.7.6.3</a> for a parameter type list; the resulting type shall be a complete object
type.
8 If a function that accepts a variable number of arguments is defined without a parameter
type list that ends with the ellipsis notation, the behavior is undefined.
following declaration list. In either case, the type of each parameter is adjusted as
described in <a href="#6.7.6.3">6.7.6.3</a> for a parameter type list; the resulting type shall be a complete object
type.
8 If a function that accepts a variable number of arguments is defined without a parameter
type list that ends with the ellipsis notation, the behavior is undefined.
of the storage for parameters is unspecified.
10 On entry to the function, the size expressions of each variably modified parameter are
evaluated and the value of each argument expression is converted to the type of the
of the storage for parameters is unspecified.
10 On entry to the function, the size expressions of each variably modified parameter are
evaluated and the value of each argument expression is converted to the type of the
- 163) See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
- 164) A parameter identifier cannot be redeclared in the function body except in an enclosed block.
+ <sup><a name="note163" href="#note163"><b>163)</b></a></sup> See ''future language directions'' (<a href="#6.11.7">6.11.7</a>).
+ <sup><a name="note164" href="#note164"><b>164)</b></a></sup> A parameter identifier cannot be redeclared in the function body except in an enclosed block.
the start of translation phase 4) is either the first character in the source file (optionally
after white space containing no new-line characters) or that follows white space
containing at least one new-line character. The last token in the sequence is the first new-
the start of translation phase 4) is either the first character in the source file (optionally
after white space containing no new-line characters) or that follows white space
containing at least one new-line character. The last token in the sequence is the first new-
significance, as all white space is equivalent except in certain situations during preprocessing (see the
# character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
significance, as all white space is equivalent except in certain situations during preprocessing (see the
# character string literal creation operator in <a href="#6.10.3.2">6.10.3.2</a>, for example).
<b> Constraints</b>
1 The expression that controls conditional inclusion shall be an integer constant expression
except that: identifiers (including those lexically identical to keywords) are interpreted as *
<b> Constraints</b>
1 The expression that controls conditional inclusion shall be an integer constant expression
except that: identifiers (including those lexically identical to keywords) are interpreted as *
either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
[<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
either are or are not macro names -- there simply are no keywords, enumeration constants, etc.
[<a name="p161" href="#p161">page 161</a>] (<a href="#Contents">Contents</a>)
expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
token conversion and evaluation, all signed integer types and all unsigned integer types
act as if they have the same representation as, respectively, the types intmax_t and
expression which is evaluated according to the rules of <a href="#6.6">6.6</a>. For the purposes of this
token conversion and evaluation, all signed integer types and all unsigned integer types
act as if they have the same representation as, respectively, the types intmax_t and
character constants, which may involve converting escape sequences into execution
character set members. Whether the numeric value for these character constants matches
the value obtained when an identical character constant occurs in an expression (other
character constants, which may involve converting escape sequences into execution
character set members. Whether the numeric value for these character constants matches
the value obtained when an identical character constant occurs in an expression (other
- 167) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
+ <sup><a name="note167" href="#note167"><b>167)</b></a></sup> Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant
group. Only the first group whose control condition evaluates to true (nonzero) is
processed. If none of the conditions evaluates to true, and there is a #else directive, the
group controlled by the #else is processed; lacking a #else directive, all the groups
group. Only the first group whose control condition evaluates to true (nonzero) is
processed. If none of the conditions evaluates to true, and there is a #else directive, the
group controlled by the #else is processed; lacking a #else directive, all the groups
Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>), source file inclusion (<a href="#6.10.2">6.10.2</a>), largest
integer types (<a href="#7.20.1.5">7.20.1.5</a>).
<a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
Forward references: macro replacement (<a href="#6.10.3">6.10.3</a>), source file inclusion (<a href="#6.10.2">6.10.2</a>), largest
integer types (<a href="#7.20.1.5">7.20.1.5</a>).
<a name="6.10.2" href="#6.10.2"><b> 6.10.2 Source file inclusion</b></a>
before the terminating new-line character. However, comments may appear anywhere in a source file,
including within a preprocessing directive.
before the terminating new-line character. However, comments may appear anywhere in a source file,
including within a preprocessing directive.
tokens after include in the directive are processed just as in normal text. (Each
identifier currently defined as a macro name is replaced by its replacement list of
preprocessing tokens.) The directive resulting after all replacements shall match one of
tokens after include in the directive are processed just as in normal text. (Each
identifier currently defined as a macro name is replaced by its replacement list of
preprocessing tokens.) The directive resulting after all replacements shall match one of
between a < and a > preprocessing token pair or a pair of " characters is combined into a
single header name preprocessing token is implementation-defined.
5 The implementation shall provide unique mappings for sequences consisting of one or
between a < and a > preprocessing token pair or a pair of " characters is combined into a
single header name preprocessing token is implementation-defined.
5 The implementation shall provide unique mappings for sequences consisting of one or
phases in <a href="#5.1.1.2">5.1.1.2</a>); thus, an expansion that results in two string literals is an invalid directive.
[<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
phases in <a href="#5.1.1.2">5.1.1.2</a>); thus, an expansion that results in two string literals is an invalid directive.
[<a name="p164" href="#p164">page 164</a>] (<a href="#Contents">Contents</a>)
a preprocessing directive could begin, the identifier is not subject to macro replacement.
9 A preprocessing directive of the form
# define identifier replacement-list new-line
a preprocessing directive could begin, the identifier is not subject to macro replacement.
9 A preprocessing directive of the form
# define identifier replacement-list new-line
to be replaced by the replacement list of preprocessing tokens that constitute the
remainder of the directive. The replacement list is then rescanned for more macro names
as specified below.
to be replaced by the replacement list of preprocessing tokens that constitute the
remainder of the directive. The replacement list is then rescanned for more macro names
as specified below.
the list are separated by comma preprocessing tokens, but comma preprocessing tokens
between matching inner parentheses do not separate arguments. If there are sequences of
preprocessing tokens within the list of arguments that would otherwise act as
the list are separated by comma preprocessing tokens, but comma preprocessing tokens
between matching inner parentheses do not separate arguments. If there are sequences of
preprocessing tokens within the list of arguments that would otherwise act as
12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
including any separating comma preprocessing tokens, are merged to form a single item:
12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments,
including any separating comma preprocessing tokens, are merged to form a single item:
- 171) Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
+ <sup><a name="note171" href="#note171"><b>171)</b></a></sup> Since, by macro-replacement time, all character constants and string literals are preprocessing tokens,
not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
are never scanned for macro names or parameters.
not sequences possibly containing identifier-like subsequences (see <a href="#5.1.1.2">5.1.1.2</a>, translation phases), they
are never scanned for macro names or parameters.
or followed by a ## preprocessing token, the parameter is replaced by the corresponding
argument's preprocessing token sequence; however, if an argument consists of no
preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
or followed by a ## preprocessing token, the parameter is replaced by the corresponding
argument's preprocessing token sequence; however, if an argument consists of no
preprocessing tokens, the parameter is replaced by a placemarker preprocessing token
3 For both object-like and function-like macro invocations, before the replacement list is
reexamined for more macro names to replace, each instance of a ## preprocessing token
in the replacement list (not from an argument) is deleted and the preceding preprocessing
3 For both object-like and function-like macro invocations, before the replacement list is
reexamined for more macro names to replace, each instance of a ## preprocessing token
in the replacement list (not from an argument) is deleted and the preceding preprocessing
exist only within translation phase 4.
[<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
exist only within translation phase 4.
[<a name="p168" href="#p168">page 168</a>] (<a href="#Contents">Contents</a>)
1 A preprocessing directive of the form
# pragma pp-tokensopt new-line
where the preprocessing token STDC does not immediately follow pragma in the
1 A preprocessing directive of the form
# pragma pp-tokensopt new-line
where the preprocessing token STDC does not immediately follow pragma in the
implementation-defined manner. The behavior might cause translation to fail or cause the
translator or the resulting program to behave in a non-conforming manner. Any such
pragma that is not recognized by the implementation is ignored.
2 If the preprocessing token STDC does immediately follow pragma in the directive (prior
to any macro replacement), then no macro replacement is performed on the directive, and
implementation-defined manner. The behavior might cause translation to fail or cause the
translator or the resulting program to behave in a non-conforming manner. Any such
pragma that is not recognized by the implementation is ignored.
2 If the preprocessing token STDC does immediately follow pragma in the directive (prior
to any macro replacement), then no macro replacement is performed on the directive, and
except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
but is not required to.
except for in standard pragmas (where STDC immediately follows pragma). If the result of macro
replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still
implementation-defined; an implementation is permitted to behave as if it were the standard pragma,
but is not required to.
__FILE__ and __LINE__) remain constant throughout the translation unit.
2 None of these macro names, nor the identifier defined, shall be the subject of a
#define or a #undef preprocessing directive. Any other predefined macro names
__FILE__ and __LINE__) remain constant throughout the translation unit.
2 None of these macro names, nor the identifier defined, shall be the subject of a
#define or a #undef preprocessing directive. Any other predefined macro names
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.
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.
__LINE__ The presumed line number (within the current source file) of the current
source line (an integer constant).177)
__STDC__ The integer constant 1, intended to indicate a conforming implementation.
__LINE__ The presumed line number (within the current source file) of the current
source line (an integer constant).177)
__STDC__ The integer constant 1, intended to indicate a conforming implementation.
- 176) See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
- 177) The presumed source file name and line number can be changed by the #line directive.
+ <sup><a name="note176" href="#note176"><b>176)</b></a></sup> See ''future language directions'' (<a href="#6.11.9">6.11.9</a>).
+ <sup><a name="note177" href="#note177"><b>177)</b></a></sup> The presumed source file name and line number can be changed by the #line directive.
__TIME__ 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
__TIME__ 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
ISO/IEC 9899/AMD1:1995 and as 199901L in ISO/IEC 9899:1999. The intention is that this will
remain an integer constant of type long int that is increased with each revision of this International
Standard.
ISO/IEC 9899/AMD1:1995 and as 199901L in ISO/IEC 9899:1999. The intention is that this will
remain an integer constant of type long int that is increased with each revision of this International
Standard.
adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
arithmetic).
__STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
adherence to the specifications in <a href="#G">annex G</a> (IEC 60559 compatible complex
arithmetic).
__STDC_LIB_EXT1__ The integer constant 201ymmL, intended to indicate support
__STDC_NO_COMPLEX__ 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.
__STDC_NO_COMPLEX__ 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.
each revision of this International Standard.
[<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
each revision of this International Standard.
[<a name="p176" href="#p176">page 176</a>] (<a href="#Contents">Contents</a>)
the value of a string is the sequence of the values of the contained characters, in order.
2 The decimal-point character is the character used by functions that convert floating-point
numbers to or from character sequences to denote the beginning of the fractional part of
the value of a string is the sequence of the values of the contained characters, in order.
2 The decimal-point character is the character used by functions that convert floating-point
numbers to or from character sequences to denote the beginning of the fractional part of
may be changed by the setlocale function.
3 A null wide character is a wide character with code value zero.
4 A wide string is a contiguous sequence of wide characters terminated by and including
may be changed by the setlocale function.
3 A null wide character is a wide character with code value zero.
4 A wide string is a contiguous sequence of wide characters terminated by and including
5 A shift sequence is a contiguous sequence of bytes within a multibyte string that
(potentially) causes a change in shift state (see <a href="#5.2.1.2">5.2.1.2</a>). A shift sequence shall not have a
corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
5 A shift sequence is a contiguous sequence of bytes within a multibyte string that
(potentially) causes a change in shift state (see <a href="#5.2.1.2">5.2.1.2</a>). A shift sequence shall not have a
corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte
(<a href="#7.22.1">7.22.1</a>, <a href="#7.28.4.1">7.28.4.1</a>) and the formatted input/output functions (<a href="#7.21.6">7.21.6</a>, <a href="#7.28.2">7.28.2</a>).
(<a href="#7.22.1">7.22.1</a>, <a href="#7.28.4.1">7.28.4.1</a>) and the formatted input/output functions (<a href="#7.21.6">7.21.6</a>, <a href="#7.28.2">7.28.2</a>).
enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
sequence of maximum length. Whether these counts provide for more than one shift sequence is the
implementation's choice.
enough to count all the bytes in any complete multibyte character plus at least one adjacent shift
sequence of maximum length. Whether these counts provide for more than one shift sequence is the
implementation's choice.
[<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
<a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
[<a name="p179" href="#p179">page 179</a>] (<a href="#Contents">Contents</a>)
<a name="7.1.2" href="#7.1.2"><b> 7.1.2 Standard headers</b></a>
-1 Each library function is declared, with a type that includes a prototype, in a header,182)
+1 Each library function is declared, with a type that includes a prototype, in a header,<sup><a href="#note182"><b>182)</b></a></sup>
whose contents are made available by the #include preprocessing directive. The
header declares a set of related functions, plus any necessary types and additional macros
needed to facilitate their use. Declarations of types described in this clause shall not
include type qualifiers, unless explicitly stated otherwise.
whose contents are made available by the #include preprocessing directive. The
header declares a set of related functions, plus any necessary types and additional macros
needed to facilitate their use. Declarations of types described in this clause shall not
include type qualifiers, unless explicitly stated otherwise.
<a href="#7.2"><assert.h></a> <a href="#7.9"><iso646.h></a> <a href="#7.16"><stdarg.h></a> <a href="#7.23"><string.h></a>
<a href="#7.3"><complex.h></a> <a href="#7.10"><limits.h></a> <a href="#7.17"><stdatomic.h></a> <a href="#7.24"><tgmath.h></a>
<a href="#7.4"><ctype.h></a> <a href="#7.11"><locale.h></a> <a href="#7.18"><stdbool.h></a> <a href="#7.25"><threads.h></a>
<a href="#7.2"><assert.h></a> <a href="#7.9"><iso646.h></a> <a href="#7.16"><stdarg.h></a> <a href="#7.23"><string.h></a>
<a href="#7.3"><complex.h></a> <a href="#7.10"><limits.h></a> <a href="#7.17"><stdatomic.h></a> <a href="#7.24"><tgmath.h></a>
<a href="#7.4"><ctype.h></a> <a href="#7.11"><locale.h></a> <a href="#7.18"><stdbool.h></a> <a href="#7.25"><threads.h></a>
- 183) The headers <a href="#7.3"><complex.h></a>, <a href="#7.17"><stdatomic.h></a>, and <a href="#7.25"><threads.h></a> are conditional features that
+ <sup><a name="note183" href="#note183"><b>183)</b></a></sup> The headers <a href="#7.3"><complex.h></a>, <a href="#7.17"><stdatomic.h></a>, and <a href="#7.25"><threads.h></a> are conditional features that
implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.
[<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
implementations need not support; see <a href="#6.10.8.3">6.10.8.3</a>.
[<a name="p180" href="#p180">page 180</a>] (<a href="#Contents">Contents</a>)
unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
-- All identifiers with external linkage in any of the following subclauses (including the
future library directions) and errno are always reserved for use as identifiers with
unless explicitly stated otherwise (see <a href="#7.1.4">7.1.4</a>).
-- All identifiers with external linkage in any of the following subclauses (including the
future library directions) and errno are always reserved for use as identifiers with
-- Each identifier with file scope listed in any of the following subclauses (including the
future library directions) is reserved for use as a macro name and as an identifier with
file scope in the same name space if any of its associated headers is included.
-- Each identifier with file scope listed in any of the following subclauses (including the
future library directions) is reserved for use as a macro name and as an identifier with
file scope in the same name space if any of its associated headers is included.
- 184) The list of reserved identifiers with external linkage includes math_errhandling, setjmp,
+ <sup><a name="note184" href="#note184"><b>184)</b></a></sup> The list of reserved identifiers with external linkage includes math_errhandling, setjmp,
the name of the function in parentheses, because the name is then not followed by the left
parenthesis that indicates expansion of a macro function name. For the same syntactic
reason, it is permitted to take the address of a library function even if it is also defined as
the name of the function in parentheses, because the name is then not followed by the left
parenthesis that indicates expansion of a macro function name. For the same syntactic
reason, it is permitted to take the address of a library function even if it is also defined as
actual function is referred to. Any invocation of a library function that is implemented as
a macro shall expand to code that evaluates each of its arguments exactly once, fully
protected by parentheses where necessary, so it is generally safe to use arbitrary
actual function is referred to. Any invocation of a library function that is implemented as
a macro shall expand to code that evaluates each of its arguments exactly once, fully
protected by parentheses where necessary, so it is generally safe to use arbitrary
- 186) Such macros might not contain the sequence points that the corresponding function calls do.
- 187) Because external identifiers and some macro names beginning with an underscore are reserved,
+ <sup><a name="note186" href="#note186"><b>186)</b></a></sup> Such macros might not contain the sequence points that the corresponding function calls do.
+ <sup><a name="note187" href="#note187"><b>187)</b></a></sup> Because external identifiers and some macro names beginning with an underscore are reserved,
implementations may provide special semantics for such names. For example, the identifier
_BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
appropriate header could specify
implementations may provide special semantics for such names. For example, the identifier
_BUILTIN_abs could be used to indicate generation of in-line code for the abs function. Thus, the
appropriate header could specify
associated header.
3 There is a sequence point immediately before a library function returns.
4 The functions in the standard library are not guaranteed to be reentrant and may modify
associated header.
3 There is a sequence point immediately before a library function returns.
4 The functions in the standard library are not guaranteed to be reentrant and may modify
5 Unless explicitly stated otherwise in the detailed descriptions that follow, library
functions shall prevent data races as follows: A library function shall not directly or
indirectly access objects accessible by threads other than the current thread unless the
objects are accessed directly or indirectly via the function's arguments. A library
function shall not directly or indirectly modify objects accessible by threads other than
the current thread unless the objects are accessed directly or indirectly via the function's
5 Unless explicitly stated otherwise in the detailed descriptions that follow, library
functions shall prevent data races as follows: A library function shall not directly or
indirectly access objects accessible by threads other than the current thread unless the
objects are accessed directly or indirectly via the function's arguments. A library
function shall not directly or indirectly modify objects accessible by threads other than
the current thread unless the objects are accessed directly or indirectly via the function's
threads if the objects are not visible to users and are protected against data races.
6 Unless otherwise specified, library functions shall perform all operations solely within the
threads if the objects are not visible to users and are protected against data races.
6 Unless otherwise specified, library functions shall perform all operations solely within the
7 EXAMPLE The function atoi may be used in any of several ways:
-- by use of its associated header (possibly generating a macro expansion)
#include <a href="#7.22"><stdlib.h></a>
7 EXAMPLE The function atoi may be used in any of several ways:
-- by use of its associated header (possibly generating a macro expansion)
#include <a href="#7.22"><stdlib.h></a>
- 188) Thus, a signal handler cannot, in general, call standard library functions.
- 189) This means, for example, that an implementation is not permitted to use a static object for internal
+ <sup><a name="note188" href="#note188"><b>188)</b></a></sup> Thus, a signal handler cannot, in general, call standard library functions.
+ <sup><a name="note189" href="#note189"><b>189)</b></a></sup> This means, for example, that an implementation is not permitted to use a static object for internal
purposes without synchronization because it could cause a data race even in programs that do not
explicitly share objects between threads.
purposes without synchronization because it could cause a data race even in programs that do not
explicitly share objects between threads.
failed (including the text of the argument, the name of the source file, the source line
number, and the name of the enclosing function -- the latter are respectively the values of
the preprocessing macros __FILE__ and __LINE__ and of the identifier
failed (including the text of the argument, the name of the source file, the source line
number, and the name of the enclosing function -- the latter are respectively the values of
the preprocessing macros __FILE__ and __LINE__ and of the identifier
Assertion failed: expression, function abc, file xyz, line nnn.
Assertion failed: expression, function abc, file xyz, line nnn.
<a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic <complex.h></b></a>
<a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
1 The header <a href="#7.3"><complex.h></a> defines macros and declares functions that support complex
<a name="7.3" href="#7.3"><b> 7.3 Complex arithmetic <complex.h></b></a>
<a name="7.3.1" href="#7.3.1"><b> 7.3.1 Introduction</b></a>
1 The header <a href="#7.3"><complex.h></a> defines macros and declares functions that support complex
2 Implementations that define the macro __STDC_NO_COMPLEX__ need not provide
this header nor support any of its facilities.
3 Each synopsis specifies a family of functions consisting of a principal function with one
2 Implementations that define the macro __STDC_NO_COMPLEX__ need not provide
this header nor support any of its facilities.
3 Each synopsis specifies a family of functions consisting of a principal function with one
expands to _Complex; the macro
_Complex_I
expands to a constant expression of type const float _Complex, with the value of
expands to _Complex; the macro
_Complex_I
expands to a constant expression of type const float _Complex, with the value of
they expand to _Imaginary and a constant expression of type const float
_Imaginary with the value of the imaginary unit.
6 The macro
they expand to _Imaginary and a constant expression of type const float
_Imaginary with the value of the imaginary unit.
6 The macro
7 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
redefine the macros complex, imaginary, and I.
7 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
redefine the macros complex, imaginary, and I.
- 192) See ''future library directions'' (<a href="#7.30.1">7.30.1</a>).
- 193) The imaginary unit is a number i such that i 2 = -1.
- 194) A specification for imaginary types is in informative <a href="#G">annex G</a>.
+ <sup><a name="note192" href="#note192"><b>192)</b></a></sup> See ''future library directions'' (<a href="#7.30.1">7.30.1</a>).
+ <sup><a name="note193" href="#note193"><b>193)</b></a></sup> The imaginary unit is a number i such that i 2 = -1.
+ <sup><a name="note194" href="#note194"><b>194)</b></a></sup> A specification for imaginary types is in informative <a href="#G">annex G</a>.
problematic because of their treatment of infinities and because of undue overflow and
underflow. The CX_LIMITED_RANGE pragma can be used to inform the
implementation that (where the state is ''on'') the usual mathematical formulas are
problematic because of their treatment of infinities and because of undue overflow and
underflow. The CX_LIMITED_RANGE pragma can be used to inform the
implementation that (where the state is ''on'') the usual mathematical formulas are
explicit declarations and statements inside a compound statement. When outside external
declarations, the pragma takes effect from its occurrence until another
CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
explicit declarations and statements inside a compound statement. When outside external
declarations, the pragma takes effect from its occurrence until another
CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit.
3 The casin functions return the complex arc sine value, in the range of a strip
mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
3 The casin functions return the complex arc sine value, in the range of a strip
mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2]
(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) 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
<b> Returns</b>
3 The cimag functions return the imaginary part value (as a real).
<a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The CMPLX macros</b></a>
<b> Returns</b>
3 The cimag functions return the imaginary part value (as a real).
<a name="7.3.9.3" href="#7.3.9.3"><b> 7.3.9.3 The CMPLX macros</b></a>
[<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
<a name="7.4" href="#7.4"><b> 7.4 Character handling <ctype.h></b></a>
1 The header <a href="#7.4"><ctype.h></a> declares several functions useful for classifying and mapping
[<a name="p198" href="#p198">page 198</a>] (<a href="#Contents">Contents</a>)
<a name="7.4" href="#7.4"><b> 7.4 Character handling <ctype.h></b></a>
1 The header <a href="#7.4"><ctype.h></a> declares several functions useful for classifying and mapping
representable as an unsigned char or shall equal the value of the macro EOF. If the
argument has any other value, the behavior is undefined.
2 The behavior of these functions is affected by the current locale. Those functions that
representable as an unsigned char or shall equal the value of the macro EOF. If the
argument has any other value, the behavior is undefined.
2 The behavior of these functions is affected by the current locale. Those functions that
3 The term printing character refers to a member of a locale-specific set of characters, each
of which occupies one printing position on a display device; the term control character
refers to a member of a locale-specific set of characters that are not printing
3 The term printing character refers to a member of a locale-specific set of characters, each
of which occupies one printing position on a display device; the term control character
refers to a member of a locale-specific set of characters that are not printing
Forward references: EOF (<a href="#7.21.1">7.21.1</a>), localization (<a href="#7.11">7.11</a>).
<a name="7.4.1" href="#7.4.1"><b> 7.4.1 Character classification functions</b></a>
1 The functions in this subclause return nonzero (true) if and only if the value of the
Forward references: EOF (<a href="#7.21.1">7.21.1</a>), localization (<a href="#7.11">7.11</a>).
<a name="7.4.1" href="#7.4.1"><b> 7.4.1 Character classification functions</b></a>
1 The functions in this subclause return nonzero (true) if and only if the value of the
- 198) See ''future library directions'' (<a href="#7.30.2">7.30.2</a>).
- 199) In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
+ <sup><a name="note198" href="#note198"><b>198)</b></a></sup> See ''future library directions'' (<a href="#7.30.2">7.30.2</a>).
+ <sup><a name="note199" href="#note199"><b>199)</b></a></sup> In an implementation that uses the seven-bit US ASCII character set, the printing characters are those
whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
[<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
whose values lie from 0x20 (space) through 0x7E (tilde); the control characters are those whose
values lie from 0 (NUL) through 0x1F (US), and the character 0x7F (DEL).
[<a name="p199" href="#p199">page 199</a>] (<a href="#Contents">Contents</a>)
- none of iscntrl, isdigit, ispunct, or isspace is true.200) In the "C" locale,
+ none of iscntrl, isdigit, ispunct, or isspace is true.<sup><a href="#note200"><b>200)</b></a></sup> In the "C" locale,
isalpha returns true only for the characters for which isupper or islower is true.
<a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
<b> Synopsis</b>
isalpha returns true only for the characters for which isupper or islower is true.
<a name="7.4.1.3" href="#7.4.1.3"><b> 7.4.1.3 The isblank function</b></a>
<b> Synopsis</b>
characters; all four combinations are possible.
[<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
characters; all four combinations are possible.
[<a name="p200" href="#p200">page 200</a>] (<a href="#Contents">Contents</a>)
which expand to integer constant expressions with type int, distinct positive values, and
which are suitable for use in #if preprocessing directives; and
errno
which expand to integer constant expressions with type int, distinct positive values, and
which are suitable for use in #if preprocessing directives; and
errno
duration, the value of which is set to a positive error number by several library functions.
If a macro definition is suppressed in order to access an actual object, or a program
defines an identifier with the name errno, the behavior is undefined.
3 The value of errno in the initial thread is zero at program startup (the initial value of
errno in other threads is an indeterminate value), but is never set to zero by any library
duration, the value of which is set to a positive error number by several library functions.
If a macro definition is suppressed in order to access an actual object, or a program
defines an identifier with the name errno, the behavior is undefined.
3 The value of errno in the initial thread is zero at program startup (the initial value of
errno in other threads is an indeterminate value), but is never set to zero by any library
whether or not there is an error, provided the use of errno is not documented in the
description of the function in this International Standard.
4 Additional macro definitions, beginning with E and a digit or E and an uppercase
whether or not there is an error, provided the use of errno is not documented in the
description of the function in this International Standard.
4 Additional macro definitions, beginning with E and a digit or E and an uppercase
- 202) Thus, a program that uses errno for error checking should set it to zero before a library function call,
+ <sup><a name="note202" href="#note202"><b>202)</b></a></sup> Thus, a program that uses errno for error checking should set it to zero before a library function call,
then inspect it before a subsequent library function call. Of course, a library function can save the
value of errno on entry and then set it to zero, as long as the original value is restored if errno's
value is still zero just before the return.
then inspect it before a subsequent library function call. Of course, a library function can save the
value of errno on entry and then set it to zero, as long as the original value is restored if errno's
value is still zero just before the return.
1 The header <a href="#7.6"><fenv.h></a> defines several macros, and declares types and functions that
provide access to the floating-point environment. The floating-point environment refers
collectively to any floating-point status flags and control modes supported by the
1 The header <a href="#7.6"><fenv.h></a> defines several macros, and declares types and functions that
provide access to the floating-point environment. The floating-point environment refers
collectively to any floating-point status flags and control modes supported by the
point control mode is a system variable whose value may be set by the user to affect the
subsequent behavior of floating-point arithmetic.
2 The floating-point environment has thread storage duration. The initial state for a
thread's floating-point environment is the current state of the floating-point environment
of the thread that creates it at the time of creation.
3 Certain programming conventions support the intended model of use for the floating-
point control mode is a system variable whose value may be set by the user to affect the
subsequent behavior of floating-point arithmetic.
2 The floating-point environment has thread storage duration. The initial state for a
thread's floating-point environment is the current state of the floating-point environment
of the thread that creates it at the time of creation.
3 Certain programming conventions support the intended model of use for the floating-
-- a function call does not alter its caller's floating-point control modes, clear its caller's
floating-point status flags, nor depend on the state of its caller's floating-point status
flags unless the function is so documented;
-- a function call does not alter its caller's floating-point control modes, clear its caller's
floating-point status flags, nor depend on the state of its caller's floating-point status
flags unless the function is so documented;
control modes required by IEC 60559, and other similar floating-point state information. It is also
designed to facilitate code portability among all systems.
control modes required by IEC 60559, and other similar floating-point state information. It is also
designed to facilitate code portability among all systems.
- 205) A floating-point status flag is not an object and can be set more than once within an expression.
- 206) With these conventions, a programmer can safely assume default floating-point control modes (or be
+ <sup><a name="note205" href="#note205"><b>205)</b></a></sup> A floating-point status flag is not an object and can be set more than once within an expression.
+ <sup><a name="note206" href="#note206"><b>206)</b></a></sup> With these conventions, a programmer can safely assume default floating-point control modes (or be
unaware of them). The responsibilities associated with accessing the floating-point environment fall
on the programmer or program that does so explicitly.
unaware of them). The responsibilities associated with accessing the floating-point environment fall
on the programmer or program that does so explicitly.
exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
be specified by the implementation. The defined macros expand to integer constant
expressions with values such that bitwise ORs of all combinations of the macros result in
distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also
be specified by the implementation. The defined macros expand to integer constant
expressions with values such that bitwise ORs of all combinations of the macros result in
distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in
Additional implementation-defined rounding directions, with macro definitions beginning
with FE_ and an uppercase letter, may also be specified by the implementation. The
defined macros expand to integer constant expressions whose values are distinct
Additional implementation-defined rounding directions, with macro definitions beginning
with FE_ and an uppercase letter, may also be specified by the implementation. The
defined macros expand to integer constant expressions whose values are distinct
least one of the functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not
necessary for all the functions to succeed all the time.
least one of the functions in <a href="#7.6.2">7.6.2</a>, using the macro as the appropriate argument, will succeed. It is not
necessary for all the functions to succeed all the time.
- 208) The macros should be distinct powers of two.
- 209) Even though the rounding direction macros may expand to constants corresponding to the values of
+ <sup><a name="note208" href="#note208"><b>208)</b></a></sup> The macros should be distinct powers of two.
+ <sup><a name="note209" href="#note209"><b>209)</b></a></sup> Even though the rounding direction macros may expand to constants corresponding to the values of
FLT_ROUNDS, they are not required to do so.
[<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
FLT_ROUNDS, they are not required to do so.
[<a name="p206" href="#p206">page 206</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
2 The FENV_ACCESS pragma provides a means to inform the implementation when a
program might access the floating-point environment to test floating-point status flags or
<b> Description</b>
2 The FENV_ACCESS pragma provides a means to inform the implementation when a
program might access the floating-point environment to test floating-point status flags or
outside external declarations or preceding all explicit declarations and statements inside a
compound statement. When outside external declarations, the pragma takes effect from
its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
outside external declarations or preceding all explicit declarations and statements inside a
compound statement. When outside external declarations, the pragma takes effect from
its occurrence until another FENV_ACCESS pragma is encountered, or until the end of
tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
modes are in effect and the flags are not tested.
tests and mode changes (e.g., global common subexpression elimination, code motion, and constant
folding). In general, if the state of FENV_ACCESS is ''off'', the translator can assume that default
modes are in effect and the flags are not tested.
}
4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
}
4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second
x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall
input argument for the functions represents a subset of floating-point exceptions, and can
be zero or the bitwise OR of one or more floating-point exception macros, for example
FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
input argument for the functions represents a subset of floating-point exceptions, and can
be zero or the bitwise OR of one or more floating-point exception macros, for example
FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these
hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
''off'', just one evaluation of x + 1 would suffice.
hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
''off'', just one evaluation of x + 1 would suffice.
- 212) The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
+ <sup><a name="note212" href="#note212"><b>212)</b></a></sup> The functions fetestexcept, feraiseexcept, and feclearexcept support the basic
abstraction of flags that are either set or clear. An implementation may endow floating-point status
flags with more information -- for example, the address of the code which first raised the floating-
point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
abstraction of flags that are either set or clear. An implementation may endow floating-point status
flags with more information -- for example, the address of the code which first raised the floating-
point exception; the functions fegetexceptflag and fesetexceptflag deal with the full
int feraiseexcept(int excepts);
<b> Description</b>
2 The feraiseexcept function attempts to raise the supported floating-point exceptions
int feraiseexcept(int excepts);
<b> Description</b>
2 The feraiseexcept function attempts to raise the supported floating-point exceptions
raised is unspecified, except as stated in <a href="#F.8.6">F.8.6</a>. Whether the feraiseexcept function
additionally raises the ''inexact'' floating-point exception whenever it raises the
''overflow'' or ''underflow'' floating-point exception is implementation-defined.
raised is unspecified, except as stated in <a href="#F.8.6">F.8.6</a>. Whether the feraiseexcept function
additionally raises the ''inexact'' floating-point exception whenever it raises the
''overflow'' or ''underflow'' floating-point exception is implementation-defined.
Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
in <a href="#F.8.6">F.8.6</a> is in the same spirit.
Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
in <a href="#F.8.6">F.8.6</a> is in the same spirit.
<b> Description</b>
2 The fetestexcept function determines which of a specified subset of the floating-
point exception flags are currently set. The excepts argument specifies the floating-
<b> Description</b>
2 The fetestexcept function determines which of a specified subset of the floating-
point exception flags are currently set. The excepts argument specifies the floating-
<b> Returns</b>
3 The fetestexcept function returns the value of the bitwise OR of the floating-point
exception macros corresponding to the currently set floating-point exceptions included in
<b> Returns</b>
3 The fetestexcept function returns the value of the bitwise OR of the floating-point
exception macros corresponding to the currently set floating-point exceptions included in
2 The feholdexcept function saves the current floating-point environment in the object
pointed to by envp, clears the floating-point status flags, and then installs a non-stop
(continue on floating-point exceptions) mode, if available, for all floating-point
2 The feholdexcept function saves the current floating-point environment in the object
pointed to by envp, clears the floating-point status flags, and then installs a non-stop
(continue on floating-point exceptions) mode, if available, for all floating-point
handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
such systems, the feholdexcept function can be used in conjunction with the feupdateenv
function to write routines that hide spurious floating-point exceptions from their callers.
handling or aborting; if the system provides only the non-stop mode then installing it is trivial. For
such systems, the feholdexcept function can be used in conjunction with the feupdateenv
function to write routines that hide spurious floating-point exceptions from their callers.
imaxdiv_t
which is a structure type that is the type of the value returned by the imaxdiv function.
For each type declared in <a href="#7.20"><stdint.h></a>, it defines corresponding macros for conversion
imaxdiv_t
which is a structure type that is the type of the value returned by the imaxdiv function.
For each type declared in <a href="#7.20"><stdint.h></a>, it defines corresponding macros for conversion
Forward references: integer types <a href="#7.20"><stdint.h></a> (<a href="#7.20">7.20</a>), formatted input/output
functions (<a href="#7.21.6">7.21.6</a>), formatted wide character input/output functions (<a href="#7.28.2">7.28.2</a>).
<a name="7.8.1" href="#7.8.1"><b> 7.8.1 Macros for format specifiers</b></a>
Forward references: integer types <a href="#7.20"><stdint.h></a> (<a href="#7.20">7.20</a>), formatted input/output
functions (<a href="#7.21.6">7.21.6</a>), formatted wide character input/output functions (<a href="#7.28.2">7.28.2</a>).
<a name="7.8.1" href="#7.8.1"><b> 7.8.1 Macros for format specifiers</b></a>
format argument of a formatted input/output function when converting the corresponding
integer type. These macro names have the general form of PRI (character string literals
for the fprintf and fwprintf family) or SCN (character string literals for the
format argument of a formatted input/output function when converting the corresponding
integer type. These macro names have the general form of PRI (character string literals
for the fprintf and fwprintf family) or SCN (character string literals for the
- fscanf and fwscanf family),217) followed by the conversion specifier, followed by a
+ fscanf and fwscanf family),<sup><a href="#note217"><b>217)</b></a></sup> followed by the conversion specifier, followed by a
name corresponding to a similar type name in <a href="#7.20.1">7.20.1</a>. In these names, N represents the
width of the type as described in <a href="#7.20.1">7.20.1</a>. For example, PRIdFAST32 can be used in a
format string to print the value of an integer of type int_fast32_t.
name corresponding to a similar type name in <a href="#7.20.1">7.20.1</a>. In these names, N represents the
width of the type as described in <a href="#7.20.1">7.20.1</a>. For example, PRIdFAST32 can be used in a
format string to print the value of an integer of type int_fast32_t.
- 216) See ''future library directions'' (<a href="#7.30.4">7.30.4</a>).
- 217) Separate macros are given for use with fprintf and fscanf functions because, in the general case,
+ <sup><a name="note216" href="#note216"><b>216)</b></a></sup> See ''future library directions'' (<a href="#7.30.4">7.30.4</a>).
+ <sup><a name="note217" href="#note217"><b>217)</b></a></sup> Separate macros are given for use with fprintf and fscanf functions because, in the general case,
intmax_t imaxabs(intmax_t j);
<b> Description</b>
2 The imaxabs function computes the absolute value of an integer j. If the result cannot
intmax_t imaxabs(intmax_t j);
<b> Description</b>
2 The imaxabs function computes the absolute value of an integer j. If the result cannot
- first argument to the setlocale function.219) Additional macro definitions, beginning
- with the characters LC_ and an uppercase letter,220) may also be specified by the
+ first argument to the setlocale function.<sup><a href="#note219"><b>219)</b></a></sup> Additional macro definitions, beginning
+ with the characters LC_ and an uppercase letter,<sup><a href="#note220"><b>220)</b></a></sup> may also be specified by the
implementation.
<a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
<a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
implementation.
<a name="7.11.1" href="#7.11.1"><b> 7.11.1 Locale control</b></a>
<a name="7.11.1.1" href="#7.11.1.1"><b> 7.11.1.1 The setlocale function</b></a>
LC_ALL for category names the program's entire locale; the other values for
category name only a portion of the program's locale. LC_COLLATE affects the
behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
LC_ALL for category names the program's entire locale; the other values for
category name only a portion of the program's locale. LC_COLLATE affects the
behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of
LC_MONETARY affects the monetary formatting information returned by the
localeconv function. LC_NUMERIC affects the decimal-point character for the
formatted input/output functions and the string conversion functions, as well as the
LC_MONETARY affects the monetary formatting information returned by the
localeconv function. LC_NUMERIC affects the decimal-point character for the
formatted input/output functions and the string conversion functions, as well as the
of "" for locale specifies the locale-specific native environment. Other
implementation-defined strings may be passed as the second argument to setlocale.
of "" for locale specifies the locale-specific native environment. Other
implementation-defined strings may be passed as the second argument to setlocale.
- 219) ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
- 220) See ''future library directions'' (<a href="#7.30.5">7.30.5</a>).
- 221) The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
+ <sup><a name="note219" href="#note219"><b>219)</b></a></sup> ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C.
+ <sup><a name="note220" href="#note220"><b>220)</b></a></sup> See ''future library directions'' (<a href="#7.30.5">7.30.5</a>).
+ <sup><a name="note221" href="#note221"><b>221)</b></a></sup> The only functions in <a href="#7.4">7.4</a> whose behavior is not affected by the current locale are isdigit and
function returns a null pointer and the program's locale is not changed.
7 A null pointer for locale causes the setlocale function to return a pointer to the
string associated with the category for the program's current locale; the program's
function returns a null pointer and the program's locale is not changed.
7 A null pointer for locale causes the setlocale function to return a pointer to the
string associated with the category for the program's current locale; the program's
8 The pointer to string returned by the setlocale function is such that a subsequent call
with that string value and its associated category will restore that part of the program's
locale. The string pointed to shall not be modified by the program, but may be
8 The pointer to string returned by the setlocale function is such that a subsequent call
with that string value and its associated category will restore that part of the program's
locale. The string pointed to shall not be modified by the program, but may be
locale when category has the value LC_ALL.
[<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
locale when category has the value LC_ALL.
[<a name="p224" href="#p224">page 224</a>] (<a href="#Contents">Contents</a>)
several macros. Most synopses specify a family of functions consisting of a principal
function with one or more double parameters, a double return value, or both; and
other functions with the same name but with f and l suffixes, which are corresponding
several macros. Most synopses specify a family of functions consisting of a principal
function with one or more double parameters, a double return value, or both; and
other functions with the same name but with f and l suffixes, which are corresponding
float_t and double_t are float and double, respectively; if
FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
float_t and double_t are float and double, respectively; if
FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals
2, they are both long double; and for other values of FLT_EVAL_METHOD, they are
least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
type float_t is the narrowest type used by the implementation to evaluate floating expressions.
least as wide as float and double, respectively. For FLT_EVAL_METHOD equal 0, 1, or 2, the
type float_t is the narrowest type used by the implementation to evaluate floating expressions.
- 225) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
+ <sup><a name="note225" href="#note225"><b>225)</b></a></sup> HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that
- about as fast as, or faster than, a multiply and an add of double operands.227) The
+ about as fast as, or faster than, a multiply and an add of double operands.<sup><a href="#note227"><b>227)</b></a></sup> The
- 226) In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
- 227) Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
+ <sup><a name="note226" href="#note226"><b>226)</b></a></sup> In this case, using INFINITY will violate the constraint in <a href="#6.4.4">6.4.4</a> and thus require a diagnostic.
+ <sup><a name="note227" href="#note227"><b>227)</b></a></sup> Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
2 For all functions, a domain error occurs if an input argument is outside the domain over
which the mathematical function is defined. The description of each function lists any
required domain errors; an implementation may define additional domain errors, provided
2 For all functions, a domain error occurs if an input argument is outside the domain over
which the mathematical function is defined. The description of each function lists any
required domain errors; an implementation may define additional domain errors, provided
domain error, the function returns an implementation-defined value; if the integer
expression math_errhandling & MATH_ERRNO is nonzero, the integer expression
errno acquires the value EDOM; if the integer expression math_errhandling &
domain error, the function returns an implementation-defined value; if the integer
expression math_errhandling & MATH_ERRNO is nonzero, the integer expression
errno acquires the value EDOM; if the integer expression math_errhandling &
error if the mathematical domain of the function does not include the infinity.
[<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
error if the mathematical domain of the function does not include the infinity.
[<a name="p232" href="#p232">page 232</a>] (<a href="#Contents">Contents</a>)
point exception is raised.
6 The result underflows if the magnitude of the mathematical result is so small that the
mathematical result cannot be represented, without extraordinary roundoff error, in an
point exception is raised.
6 The result underflows if the magnitude of the mathematical result is so small that the
mathematical result cannot be represented, without extraordinary roundoff error, in an
implementation-defined value whose magnitude is no greater than the smallest
normalized positive number in the specified type; if the integer expression
math_errhandling & MATH_ERRNO is nonzero, whether errno acquires the
implementation-defined value whose magnitude is no greater than the smallest
normalized positive number in the specified type; if the integer expression
math_errhandling & MATH_ERRNO is nonzero, whether errno acquires the
math_errhandling & MATH_ERREXCEPT is nonzero, whether the ''underflow''
floating-point exception is raised is implementation-defined.
7 If a domain, pole, or range error occurs and the integer expression
math_errhandling & MATH_ERREXCEPT is nonzero, whether the ''underflow''
floating-point exception is raised is implementation-defined.
7 If a domain, pole, or range error occurs and the integer expression
the value corresponding to the error or left unmodified. If no such error occurs, errno
shall be left unmodified regardless of the setting of math_errhandling.
the value corresponding to the error or left unmodified. If no such error occurs, errno
shall be left unmodified regardless of the setting of math_errhandling.
2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
subnormal, zero, or into another implementation-defined category. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
2 The fpclassify macro classifies its argument value as NaN, infinite, normal,
subnormal, zero, or into another implementation-defined category. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
<b> Returns</b>
3 The fpclassify macro returns the value of the number classification macro
appropriate to the value of its argument. *
<b> Returns</b>
3 The fpclassify macro returns the value of the number classification macro
appropriate to the value of its argument. *
know the type that classification is based on. For example, a normal long double value might
become subnormal when converted to double, and zero when converted to float.
know the type that classification is based on. For example, a normal long double value might
become subnormal when converted to double, and zero when converted to float.
<b> Description</b>
2 The isnan macro determines whether its argument value is a NaN. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
<b> Description</b>
2 The isnan macro determines whether its argument value is a NaN. First, an argument
represented in a format wider than its semantic type is converted to its semantic type.
NaNs in the evaluation type but not in the semantic type.
[<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
NaNs in the evaluation type but not in the semantic type.
[<a name="p235" href="#p235">page 235</a>] (<a href="#Contents">Contents</a>)
- 233) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
+ <sup><a name="note233" href="#note233"><b>233)</b></a></sup> The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
unsigned, it is treated as positive.
[<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
unsigned, it is treated as positive.
[<a name="p236" href="#p236">page 236</a>] (<a href="#Contents">Contents</a>)
long double expm1l(long double x);
<b> Description</b>
2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
long double expm1l(long double x);
<b> Description</b>
2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range
<b> Returns</b>
3 The expm1 functions return ex - 1.
<a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
<b> Returns</b>
3 The expm1 functions return ex - 1.
<a name="7.12.6.4" href="#7.12.6.4"><b> 7.12.6.4 The frexp functions</b></a>
float remainderf(float x, float y);
long double remainderl(long double x, long double y);
<b> Description</b>
float remainderf(float x, float y);
long double remainderl(long double x, long double y);
<b> Description</b>
mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
| n - x/y | = 1/2, then n is even. If r = 0, its sign shall be that of x.'' This definition is applicable for *
all implementations.
mathematical relation r = x - ny, where n is the integer nearest the exact value of x/y; whenever
| n - x/y | = 1/2, then n is even. If r = 0, its sign shall be that of x.'' This definition is applicable for *
all implementations.
<b> Description</b>
2 The nextafter functions determine the next representable value, in the type of the
function, after x in the direction of y, where x and y are first converted to the type of the
<b> Description</b>
2 The nextafter functions determine the next representable value, in the type of the
function, after x in the direction of y, where x and y are first converted to the type of the
if the magnitude of x is the largest finite value representable in the type and the result is
infinite or not representable in the type.
<b> Returns</b>
if the magnitude of x is the largest finite value representable in the type and the result is
infinite or not representable in the type.
<b> Returns</b>
<b> Description</b>
2 The nexttoward functions are equivalent to the nextafter functions except that the
second parameter has type long double and the functions return y converted to the
<b> Description</b>
2 The nexttoward functions are equivalent to the nextafter functions except that the
second parameter has type long double and the functions return y converted to the
<a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
<a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
<b> Synopsis</b>
<a name="7.12.12" href="#7.12.12"><b> 7.12.12 Maximum, minimum, and positive difference functions</b></a>
<a name="7.12.12.1" href="#7.12.12.1"><b> 7.12.12.1 The fdim functions</b></a>
<b> Synopsis</b>
range or precision in a floating second argument.
[<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
range or precision in a floating second argument.
[<a name="p256" href="#p256">page 256</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
<b> Returns</b>
3 The fmax functions return the maximum numeric value of their arguments.
<a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
<b> Returns</b>
3 The fmax functions return the maximum numeric value of their arguments.
<a name="7.12.12.3" href="#7.12.12.3"><b> 7.12.12.3 The fmin functions</b></a>
float fminf(float x, float y);
long double fminl(long double x, long double y);
<b> Description</b>
float fminf(float x, float y);
long double fminl(long double x, long double y);
<b> Description</b>
<b> Returns</b>
3 The fmin functions return the minimum numeric value of their arguments.
<a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
<b> Returns</b>
3 The fmin functions return the minimum numeric value of their arguments.
<a name="7.12.13" href="#7.12.13"><b> 7.12.13 Floating multiply-add</b></a>
between numeric values. For any ordered pair of numeric values exactly one of the
relationships -- less, greater, and equal -- is true. Relational operators may raise the
''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
between numeric values. For any ordered pair of numeric values exactly one of the
relationships -- less, greater, and equal -- is true. Relational operators may raise the
''invalid'' floating-point exception when argument values are NaNs. For a NaN and a
- numeric value, or for two NaNs, just the unordered relationship is true.241) The following
+ numeric value, or for two NaNs, just the unordered relationship is true.<sup><a href="#note241"><b>241)</b></a></sup> The following
subclauses provide macros that are quiet (non floating-point exception raising) versions
of the relational operators, and other comparison macros that facilitate writing efficient
code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
the synopses in this subclause, real-floating indicates that the argument shall be an
subclauses provide macros that are quiet (non floating-point exception raising) versions
of the relational operators, and other comparison macros that facilitate writing efficient
code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In
the synopses in this subclause, real-floating indicates that the argument shall be an
<a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
<a name="7.12.14.1" href="#7.12.14.1"><b> 7.12.14.1 The isgreater macro</b></a>
<b> Synopsis</b>
1 #include <a href="#7.12"><math.h></a>
the operands compare unordered, as an error indicator for programs written without consideration of
NaNs; the result in these cases is false.
the operands compare unordered, as an error indicator for programs written without consideration of
NaNs; the result in these cases is false.
- 242) If any argument is of integer type, or any other type that is not a real floating type, the behavior is
+ <sup><a name="note242" href="#note242"><b>242)</b></a></sup> If any argument is of integer type, or any other type that is not a real floating type, the behavior is
<a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps <setjmp.h></b></a>
1 The header <a href="#7.13"><setjmp.h></a> defines the macro setjmp, and declares one function and
<a name="7.13" href="#7.13"><b> 7.13 Nonlocal jumps <setjmp.h></b></a>
1 The header <a href="#7.13"><setjmp.h></a> defines the macro setjmp, and declares one function and
2 The longjmp function restores the environment saved by the most recent invocation of
the setjmp macro in the same invocation of the program with the corresponding
jmp_buf argument. If there has been no such invocation, or if the function containing
2 The longjmp function restores the environment saved by the most recent invocation of
the setjmp macro in the same invocation of the program with the corresponding
jmp_buf argument. If there has been no such invocation, or if the function containing
invocation of the setjmp macro was within the scope of an identifier with variably
modified type and execution has left that scope in the interim, the behavior is undefined.
invocation of the setjmp macro was within the scope of an identifier with variably
modified type and execution has left that scope in the interim, the behavior is undefined.
have state, as of the time the longjmp function was called, except that the values of
objects of automatic storage duration that are local to the function containing the
invocation of the corresponding setjmp macro that do not have volatile-qualified type
have state, as of the time the longjmp function was called, except that the values of
objects of automatic storage duration that are local to the function containing the
invocation of the corresponding setjmp macro that do not have volatile-qualified type
- 246) This includes, but is not limited to, the floating-point status flags and the state of open files.
+ <sup><a name="note246" href="#note246"><b>246)</b></a></sup> This includes, but is not limited to, the floating-point status flags and the state of open files.
4 An implementation need not generate any of these signals, except as a result of explicit
calls to the raise function. Additional signals and pointers to undeclarable functions,
with macro definitions beginning, respectively, with the letters SIG and an uppercase
4 An implementation need not generate any of these signals, except as a result of explicit
calls to the raise function. Additional signals and pointers to undeclarable functions,
with macro definitions beginning, respectively, with the letters SIG and an uppercase
implementation. The complete set of signals, their semantics, and their default handling
is implementation-defined; all signal numbers shall be positive.
implementation. The complete set of signals, their semantics, and their default handling
is implementation-defined; all signal numbers shall be positive.
(respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
and termination.
(respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
and termination.
for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
Otherwise, func shall point to a function to be called when that signal occurs. An
invocation of such a function because of a signal, or (recursively) of any further functions
for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored.
Otherwise, func shall point to a function to be called when that signal occurs. An
invocation of such a function because of a signal, or (recursively) of any further functions
signal handler.
3 When a signal occurs and func points to a function, it is implementation-defined
whether the equivalent of signal(sig, SIG_DFL); is executed or the
signal handler.
3 When a signal occurs and func points to a function, it is implementation-defined
whether the equivalent of signal(sig, SIG_DFL); is executed or the
quick_exit function, or the signal function with the first argument equal to the
signal number corresponding to the signal that caused the invocation of the handler.
Furthermore, if such a call to the signal function results in a SIG_ERR return, the
quick_exit function, or the signal function with the first argument equal to the
signal number corresponding to the signal that caused the invocation of the handler.
Furthermore, if such a call to the signal function results in a SIG_ERR return, the
subclause) having type va_list. The object ap may be passed as an argument to
another function; if that function invokes the va_arg macro with parameter ap, the
value of ap in the calling function is indeterminate and shall be passed to the va_end
subclause) having type va_list. The object ap may be passed as an argument to
another function; if that function invokes the va_arg macro with parameter ap, the
value of ap in the calling function is indeterminate and shall be passed to the va_end
<a name="7.16.1" href="#7.16.1"><b> 7.16.1 Variable argument list access macros</b></a>
1 The va_start and va_arg macros described in this subclause shall be implemented
as macros, not functions. It is unspecified whether va_copy and va_end are macros or
<a name="7.16.1" href="#7.16.1"><b> 7.16.1 Variable argument list access macros</b></a>
1 The va_start and va_arg macros described in this subclause shall be implemented
as macros, not functions. It is unspecified whether va_copy and va_end are macros or
the next argument in the call. The parameter ap shall have been initialized by the
va_start or va_copy macro (without an intervening invocation of the va_end
the next argument in the call. The parameter ap shall have been initialized by the
va_start or va_copy macro (without an intervening invocation of the va_end
case the original function may make further use of the original list after the other function returns.
[<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
case the original function may make further use of the original list after the other function returns.
[<a name="p268" href="#p268">page 268</a>] (<a href="#Contents">Contents</a>)
13 An atomic store shall only store a value that has been computed from constants and
program input values by a finite sequence of program evaluations, such that each
evaluation observes the values of variables as computed by the last prior assignment in
13 An atomic store shall only store a value that has been computed from constants and
program input values by a finite sequence of program evaluations, such that each
evaluation observes the values of variables as computed by the last prior assignment in
-- If an evaluation B observes a value computed by A in a different thread, then B does
not happen before A.
-- If an evaluation A is included in the sequence, then all evaluations that assign to the
-- If an evaluation B observes a value computed by A in a different thread, then B does
not happen before A.
-- If an evaluation A is included in the sequence, then all evaluations that assign to the
__bool_true_false_are_defined
which expands to the integer constant 1.
4 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
__bool_true_false_are_defined
which expands to the integer constant 1.
4 Notwithstanding the provisions of <a href="#7.1.3">7.1.3</a>, a program may undefine and perhaps then
<a name="7.20" href="#7.20"><b> 7.20 Integer types <stdint.h></b></a>
1 The header <a href="#7.20"><stdint.h></a> declares sets of integer types having specified widths, and
<a name="7.20" href="#7.20"><b> 7.20 Integer types <stdint.h></b></a>
1 The header <a href="#7.20"><stdint.h></a> declares sets of integer types having specified widths, and
integer types corresponding to types defined in other standard headers.
2 Types are defined in the following categories:
-- integer types having certain exact widths;
integer types corresponding to types defined in other standard headers.
2 Types are defined in the following categories:
-- integer types having certain exact widths;
(Some of these types may denote the same type.)
3 Corresponding macros specify limits of the declared types and construct suitable
constants.
(Some of these types may denote the same type.)
3 Corresponding macros specify limits of the declared types and construct suitable
constants.
declare that typedef name and define the associated macros. Conversely, for each type
described herein that the implementation does not provide, <a href="#7.20"><stdint.h></a> shall not
declare that typedef name nor shall it define the associated macros. An implementation
declare that typedef name and define the associated macros. Conversely, for each type
described herein that the implementation does not provide, <a href="#7.20"><stdint.h></a> shall not
declare that typedef name nor shall it define the associated macros. An implementation
- 253) See ''future library directions'' (<a href="#7.30.8">7.30.8</a>).
- 254) Some of these types may denote implementation-defined extended integer types.
+ <sup><a name="note253" href="#note253"><b>253)</b></a></sup> See ''future library directions'' (<a href="#7.30.8">7.30.8</a>).
+ <sup><a name="note254" href="#note254"><b>254)</b></a></sup> Some of these types may denote implementation-defined extended integer types.
int_least64_t uint_least64_t
All other types of this form are optional.
<a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 Fastest minimum-width integer types</b></a>
int_least64_t uint_least64_t
All other types of this form are optional.
<a name="7.20.1.3" href="#7.20.1.3"><b> 7.20.1.3 Fastest minimum-width integer types</b></a>
with among all integer types that have at least the specified width.
2 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
with among all integer types that have at least the specified width.
2 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
grounds for choosing one type over another, it will simply pick some integer type satisfying the
signedness and width requirements.
grounds for choosing one type over another, it will simply pick some integer type satisfying the
signedness and width requirements.
promotions. Its implementation-defined value shall be equal to or greater in magnitude
(absolute value) than the corresponding value given below, with the same sign. An
implementation shall define only the macros corresponding to those typedef names it
promotions. Its implementation-defined value shall be equal to or greater in magnitude
(absolute value) than the corresponding value given below, with the same sign. An
implementation shall define only the macros corresponding to those typedef names it
4 If wchar_t (see <a href="#7.19">7.19</a>) is defined as a signed integer type, the value of WCHAR_MIN
shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
otherwise, wchar_t is defined as an unsigned integer type, and the value of
4 If wchar_t (see <a href="#7.19">7.19</a>) is defined as a signed integer type, the value of WCHAR_MIN
shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127;
otherwise, wchar_t is defined as an unsigned integer type, and the value of
5 If wint_t (see <a href="#7.28">7.28</a>) is defined as a signed integer type, the value of WINT_MIN shall
be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
5 If wint_t (see <a href="#7.28">7.28</a>) is defined as a signed integer type, the value of WINT_MIN shall
be no greater than -32767 and the value of WINT_MAX shall be no less than 32767;
otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN
L_tmpnam
which expands to an integer constant expression that is the size needed for an array of
char large enough to hold a temporary file name string generated by the tmpnam
L_tmpnam
which expands to an integer constant expression that is the size needed for an array of
char large enough to hold a temporary file name string generated by the tmpnam
putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
putwchar, fwprintf, wprintf, vfwprintf, and vwprintf.
FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
string. Of course, file name string contents are subject to other system-specific constraints; therefore
all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
FILENAME_MAX should instead be the recommended size of an array intended to hold a file name
string. Of course, file name string contents are subject to other system-specific constraints; therefore
all possible strings of length FILENAME_MAX cannot be expected to be opened successfully.
or whether to or from files supported on structured storage devices, are mapped into
logical data streams, whose properties are more uniform than their various inputs and
outputs. Two forms of mapping are supported, for text streams and for binary
or whether to or from files supported on structured storage devices, are mapped into
logical data streams, whose properties are more uniform than their various inputs and
outputs. Two forms of mapping are supported, for text streams and for binary
2 A text stream is an ordered sequence of characters composed into lines, each line
consisting of zero or more characters plus a terminating new-line character. Whether the
last line requires a terminating new-line character is implementation-defined. Characters
2 A text stream is an ordered sequence of characters composed into lines, each line
consisting of zero or more characters plus a terminating new-line character. Whether the
last line requires a terminating new-line character is implementation-defined. Characters
stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
been applied to a stream without orientation, the stream becomes a byte-oriented stream.
Only a call to the freopen function or the fwide function can otherwise alter the
stream becomes a wide-oriented stream. Similarly, once a byte input/output function has
been applied to a stream without orientation, the stream becomes a byte-oriented stream.
Only a call to the freopen function or the fwide function can otherwise alter the
5 Byte input/output functions shall not be applied to a wide-oriented stream and wide
character input/output functions shall not be applied to a byte-oriented stream. The
remaining stream operations do not affect, and are not affected by, a stream's orientation,
5 Byte input/output functions shall not be applied to a wide-oriented stream and wide
character input/output functions shall not be applied to a byte-oriented stream. The
remaining stream operations do not affect, and are not affected by, a stream's orientation,
- 260) The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
+ <sup><a name="note260" href="#note260"><b>260)</b></a></sup> The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
multibyte characters, generalized as follows:
-- Multibyte encodings within files may contain embedded null bytes (unlike multibyte
encodings valid for use internal to the program).
multibyte characters, generalized as follows:
-- Multibyte encodings within files may contain embedded null bytes (unlike multibyte
encodings valid for use internal to the program).
10 Moreover, the encodings used for multibyte characters may differ among files. Both the
nature and choice of such encodings are implementation-defined.
11 The wide character input functions read multibyte characters from the stream and convert
10 Moreover, the encodings used for multibyte characters may differ among files. Both the
nature and choice of such encodings are implementation-defined.
11 The wide character input functions read multibyte characters from the stream and convert
- 261) Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
+ <sup><a name="note261" href="#note261"><b>261)</b></a></sup> Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has
undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
with state-dependent encoding that does not assuredly end in the initial shift state.
undefined behavior for a binary stream (because of possible trailing null characters) or for any stream
with state-dependent encoding that does not assuredly end in the initial shift state.
-3 The rename function returns zero if the operation succeeds, nonzero if it fails,262) in
+3 The rename function returns zero if the operation succeeds, nonzero if it fails,<sup><a href="#note262"><b>262)</b></a></sup> in
which case if the file existed previously it is still known by its original name.
<a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The tmpfile function</b></a>
<b> Synopsis</b>
which case if the file existed previously it is still known by its original name.
<a name="7.21.4.3" href="#7.21.4.3"><b> 7.21.4.3 The tmpfile function</b></a>
<b> Synopsis</b>
their names should not collide with those generated by conventional naming rules for the
implementation. It is still necessary to use the remove function to remove such files when their use
is ended, and before program termination.
their names should not collide with those generated by conventional naming rules for the
implementation. It is still necessary to use the remove function to remove such files when their use
is ended, and before program termination.
2 The fopen function opens the file whose name is the string pointed to by filename,
and associates a stream with it.
3 The argument mode points to a string. If the string is one of the following, the file is
2 The fopen function opens the file whose name is the string pointed to by filename,
and associates a stream with it.
3 The argument mode points to a string. If the string is one of the following, the file is
r open text file for reading
w truncate to zero length or create text file for writing
wx create text file for writing
r open text file for reading
w truncate to zero length or create text file for writing
wx create text file for writing
remaining characters, or it might use them to select different kinds of a file (some of which might not
conform to the properties in <a href="#7.21.2">7.21.2</a>).
remaining characters, or it might use them to select different kinds of a file (some of which might not
conform to the properties in <a href="#7.21.2">7.21.2</a>).
<b> Description</b>
2 The freopen function opens the file whose name is the string pointed to by filename
and associates the stream pointed to by stream with it. The mode argument is used just
<b> Description</b>
2 The freopen function opens the file whose name is the string pointed to by filename
and associates the stream pointed to by stream with it. The mode argument is used just
3 If filename is a null pointer, the freopen function attempts to change the mode of
the stream to that specified by mode, as if the name of the file currently associated with
the stream had been used. It is implementation-defined which changes of mode are
3 If filename is a null pointer, the freopen function attempts to change the mode of
the stream to that specified by mode, as if the name of the file currently associated with
the stream had been used. It is implementation-defined which changes of mode are
(stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
returned by the fopen function may be assigned.
(stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
returned by the fopen function may be assigned.
determines how stream will be buffered, as follows: _IOFBF causes input/output to be
fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
determines how stream will be buffered, as follows: _IOFBF causes input/output to be
fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes
input/output to be unbuffered. If buf is not a null pointer, the array it points to may be
specifies the size of the array; otherwise, size may determine the size of a buffer
allocated by the setvbuf function. The contents of the array at any time are
indeterminate.
specifies the size of the array; otherwise, size may determine the size of a buffer
allocated by the setvbuf function. The contents of the array at any time are
indeterminate.
before a buffer that has automatic storage duration is deallocated upon block exit.
[<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.6" href="#7.21.6"><b> 7.21.6 Formatted input/output functions</b></a>
1 The formatted input/output functions shall behave as if there is a sequence point after the
before a buffer that has automatic storage duration is deallocated upon block exit.
[<a name="p308" href="#p308">page 308</a>] (<a href="#Contents">Contents</a>)
<a name="7.21.6" href="#7.21.6"><b> 7.21.6 Formatted input/output functions</b></a>
1 The formatted input/output functions shall behave as if there is a sequence point after the
<a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The fprintf function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
<a name="7.21.6.1" href="#7.21.6.1"><b> 7.21.6.1 The fprintf function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
-- An optional minimum field width. If the converted value has fewer characters than the
field width, it is padded with spaces (by default) on the left (or right, if the left
adjustment flag, described later, has been given) to the field width. The field width
-- An optional minimum field width. If the converted value has fewer characters than the
field width, it is padded with spaces (by default) on the left (or right, if the left
adjustment flag, described later, has been given) to the field width. The field width
-- An optional precision that gives the minimum number of digits to appear for the d, i,
o, u, x, and X conversions, the number of digits to appear after the decimal-point
character for a, A, e, E, f, and F conversions, the maximum number of significant
digits for the g and G conversions, or the maximum number of bytes to be written for
-- An optional precision that gives the minimum number of digits to appear for the d, i,
o, u, x, and X conversions, the number of digits to appear after the decimal-point
character for a, A, e, E, f, and F conversions, the maximum number of significant
digits for the g and G conversions, or the maximum number of bytes to be written for
- 267) The fprintf functions perform writes to memory for the %n specifier.
- 268) Note that 0 is taken as a flag, not as the beginning of a field width.
+ <sup><a name="note267" href="#note267"><b>267)</b></a></sup> The fprintf functions perform writes to memory for the %n specifier.
+ <sup><a name="note268" href="#note268"><b>268)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
this flag is not specified.)
+ 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
this flag is not specified.)
+ 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
space 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.
space 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.
0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
0 and - flags both appear, the 0 flag is ignored. For d, i, o, u, x, and X
- 269) The results of all floating conversions of a negative zero, and of negative values that round to zero,
+ <sup><a name="note269" href="#note269"><b>269)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
[-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
any n-char-sequence, is implementation-defined. The F conversion specifier
produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
[-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of
any n-char-sequence, is implementation-defined. The F conversion specifier
produces INF, INFINITY, or NAN instead of inf, infinity, or nan,
e,E 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
e,E 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
- 270) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
+ <sup><a name="note270" href="#note270"><b>270)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning;
the # and 0 flag characters have no effect.
[<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
the # and 0 flag characters have no effect.
[<a name="p312" href="#p312">page 312</a>] (<a href="#Contents">Contents</a>)
a,A 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
a,A 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
of hexadecimal digits after it is equal to the precision; if the precision is
missing and FLT_RADIX is a power of 2, then the precision is sufficient for
an exact representation of the value; if the precision is missing and
of hexadecimal digits after it is equal to the precision; if the precision is
missing and FLT_RADIX is a power of 2, then the precision is sufficient for
an exact representation of the value; if the precision is missing and
that subsequent digits align to nibble (4-bit) boundaries.
[<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
that subsequent digits align to nibble (4-bit) boundaries.
[<a name="p313" href="#p313">page 313</a>] (<a href="#Contents">Contents</a>)
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
the letters ABCDEF for A conversion. The A conversion specifier produces a
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
the letters ABCDEF for A conversion. The A conversion specifier produces a
containing the wint_t argument to the lc conversion specification and the
second a null wide character.
s If no l length modifier is present, the argument shall be a pointer to the initial
containing the wint_t argument to the lc conversion specification and the
second a null wide character.
s If no l length modifier is present, the argument shall be a pointer to the initial
written up to (but not including) the terminating null character. If the
precision is specified, no more than that many bytes are written. If the
precision is not specified or is greater than the size of the array, the array shall
written up to (but not including) the terminating null character. If the
precision is specified, no more than that many bytes are written. If the
precision is not specified or is greater than the size of the array, the array shall
written (including shift sequences, if any), and the array shall contain a null
wide character if, to equal the multibyte character sequence length given by
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
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point character.
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point character.
[<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
the precision, the function would need to access a wide character one past the
[<a name="p314" href="#p314">page 314</a>] (<a href="#Contents">Contents</a>)
the precision, the function would need to access a wide character one past the
p 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.
p 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.
undefined.
% A % character is written. No argument is converted. The complete
conversion specification shall be %%.
undefined.
% A % character is written. No argument is converted. The complete
conversion specification shall be %%.
not the correct type for the corresponding conversion specification, the behavior is
undefined.
10 In no case does a nonexistent or small field width cause truncation of a field; if the result
not the correct type for the corresponding conversion specification, the behavior is
undefined.
10 In no case does a nonexistent or small field width cause truncation of a field; if the result
in hexadecimal floating style with the given precision, with the extra stipulation that the
error should have a correct sign for the current rounding direction.
13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
in hexadecimal floating style with the given precision, with the extra stipulation that the
error should have a correct sign for the current rounding direction.
13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
significant decimal digits is more than DECIMAL_DIG but the source value is exactly
representable with DECIMAL_DIG digits, then the result should be an exact
representation with trailing zeros. Otherwise, the source value is bounded by two
adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
significant decimal digits is more than DECIMAL_DIG but the source value is exactly
representable with DECIMAL_DIG digits, then the result should be an exact
representation with trailing zeros. Otherwise, the source value is bounded by two
adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value
- 274) Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
- 275) See ''future library directions'' (<a href="#7.30.9">7.30.9</a>).
- 276) For binary-to-decimal conversion, the result format's values are the numbers representable with the
+ <sup><a name="note274" href="#note274"><b>274)</b></a></sup> Redundant shift sequences may result if multibyte characters have a state-dependent encoding.
+ <sup><a name="note275" href="#note275"><b>275)</b></a></sup> See ''future library directions'' (<a href="#7.30.9">7.30.9</a>).
+ <sup><a name="note276" href="#note276"><b>276)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
9 An input item is read from the stream, unless the specification includes an n specifier. An
input item is defined as the longest sequence of input characters which does not exceed
9 An input item is read from the stream, unless the specification includes an n specifier. An
input item is defined as the longest sequence of input characters which does not exceed
- any specified field width and which is, or is a prefix of, a matching input sequence.278)
+ any specified field width and which is, or is a prefix of, a matching input sequence.<sup><a href="#note278"><b>278)</b></a></sup>
The first character, if any, after the input item remains unread. If the length of the input
item is zero, the execution of the directive fails; this condition is a matching failure unless
end-of-file, an encoding error, or a read error prevented input from the stream, in which
The first character, if any, after the input item remains unread. If the length of the input
item is zero, the execution of the directive fails; this condition is a matching failure unless
end-of-file, an encoding error, or a read error prevented input from the stream, in which
- 277) These white-space characters are not counted against a specified field width.
- 278) fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
+ <sup><a name="note277" href="#note277"><b>277)</b></a></sup> These white-space characters are not counted against a specified field width.
+ <sup><a name="note278" href="#note278"><b>278)</b></a></sup> fscanf pushes back at most one input character onto the input stream. Therefore, some sequences
that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
[<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
that are acceptable to strtod, strtol, etc., are unacceptable to fscanf.
[<a name="p318" href="#p318">page 318</a>] (<a href="#Contents">Contents</a>)
[<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
c Matches a sequence of characters of exactly the number specified by the field
[<a name="p319" href="#p319">page 319</a>] (<a href="#Contents">Contents</a>)
c Matches a sequence of characters of exactly the number specified by the field
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. No null character is added.
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. No null character is added.
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
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
-279) No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
+<sup><a name="note279" href="#note279"><b>279)</b></a></sup> No special provisions are made for multibyte characters in the matching rules used by the c, s, and [
conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
conversion specifiers -- the extent of the input field is determined on a byte-by-byte basis. The
resulting field is nevertheless a sequence of multibyte characters that begins in the initial shift state.
suppressing character or a field width, the behavior is undefined.
% Matches a single % character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
suppressing character or a field width, the behavior is undefined.
% Matches a single % character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
respectively, a, e, f, g, and x.
14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
respectively, a, e, f, g, and x.
2 The vfprintf function is equivalent to fprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfprintf function does not invoke the
2 The vfprintf function is equivalent to fprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfprintf function does not invoke the
<b> Returns</b>
3 The vfprintf function returns the number of characters transmitted, or a negative
value if an output or encoding error occurred.
<b> Returns</b>
3 The vfprintf function returns the number of characters transmitted, or a negative
value if an output or encoding error occurred.
- 281) As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
+ <sup><a name="note281" href="#note281"><b>281)</b></a></sup> As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
[<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
[<a name="p326" href="#p326">page 326</a>] (<a href="#Contents">Contents</a>)
of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
fgetc function returns the next character from the input stream pointed to by stream.
If a read error occurs, the error indicator for the stream is set and the fgetc function
of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the
fgetc function returns the next character from the input stream pointed to by stream.
If a read error occurs, the error indicator for the stream is set and the fgetc function
<a name="7.21.7.2" href="#7.21.7.2"><b> 7.21.7.2 The fgets function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
<a name="7.21.7.2" href="#7.21.7.2"><b> 7.21.7.2 The fgets function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
null pointer is returned. If a read error occurs during the operation, the array contents are
indeterminate and a null pointer is returned.
null pointer is returned. If a read error occurs during the operation, the array contents are
indeterminate and a null pointer is returned.
For a binary stream, its file position indicator is decremented by each successful call to
the ungetc function; if its value was zero before a call, it is indeterminate after the
For a binary stream, its file position indicator is decremented by each successful call to
the ungetc function; if its value was zero before a call, it is indeterminate after the
<a name="7.22" href="#7.22"><b> 7.22 General utilities <stdlib.h></b></a>
1 The header <a href="#7.22"><stdlib.h></a> declares five types and several functions of general utility, and
<a name="7.22" href="#7.22"><b> 7.22 General utilities <stdlib.h></b></a>
1 The header <a href="#7.22"><stdlib.h></a> declares five types and several functions of general utility, and
2 The types declared are size_t and wchar_t (both described in <a href="#7.19">7.19</a>),
div_t
which is a structure type that is the type of the value returned by the div function,
2 The types declared are size_t and wchar_t (both described in <a href="#7.19">7.19</a>),
div_t
which is a structure type that is the type of the value returned by the div function,
nor a decimal-point character appears in a decimal floating point number, or if a binary
exponent part does not appear in a hexadecimal floating point number, an exponent part
of the appropriate type with value zero is assumed to follow the last digit in the string. If
nor a decimal-point character appears in a decimal floating point number, or if a binary
exponent part does not appear in a hexadecimal floating point number, an exponent part
of the appropriate type with value zero is assumed to follow the last digit in the string. If
A character sequence INF or INFINITY is interpreted as an infinity, if representable in
the return type, else like a floating constant that is too large for the range of the return
type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
NaN, if supported in the return type, else like a subject sequence part that does not have
A character sequence INF or INFINITY is interpreted as an infinity, if representable in
the return type, else like a floating constant that is too large for the range of the return
type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet
NaN, if supported in the return type, else like a subject sequence part that does not have
pointer to the final string is stored in the object pointed to by endptr, provided that
endptr is not a null pointer.
5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
pointer to the final string is stored in the object pointed to by endptr, provided that
endptr is not a null pointer.
5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
The result should be one of the (equal or adjacent) values that would be obtained by
correctly rounding L and U according to the current rounding direction, with the extra
The result should be one of the (equal or adjacent) values that would be obtained by
correctly rounding L and U according to the current rounding direction, with the extra
negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
methods may yield different results if rounding is toward positive or negative infinity. In either case,
the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
methods may yield different results if rounding is toward positive or negative infinity. In either case,
the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
the NaN's significand.
[<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
stipulation that the error with respect to D should have a correct sign for the current
the NaN's significand.
[<a name="p343" href="#p343">page 343</a>] (<a href="#Contents">Contents</a>)
stipulation that the error with respect to D should have a correct sign for the current
<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
- 287) DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
+ <sup><a name="note287" href="#note287"><b>287)</b></a></sup> DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
to the same internal floating value, but if not will round to adjacent values.
[<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
to the same internal floating value, but if not will round to adjacent values.
[<a name="p344" href="#p344">page 344</a>] (<a href="#Contents">Contents</a>)
3 The rand function is not required to avoid data races. The implementation shall behave
as if no library function calls the rand function.
<b> Returns</b>
3 The rand function is not required to avoid data races. The implementation shall behave
as if no library function calls the rand function.
<b> Returns</b>
are known to produce sequences with distressingly non-random low-order bits. Applications with
particular requirements should use a generator that is known to be sufficient for their needs.
are known to produce sequences with distressingly non-random low-order bits. Applications with
particular requirements should use a generator that is known to be sufficient for their needs.
void *calloc(size_t nmemb, size_t size);
<b> Description</b>
2 The calloc function allocates space for an array of nmemb objects, each of whose size
void *calloc(size_t nmemb, size_t size);
<b> Description</b>
2 The calloc function allocates space for an array of nmemb objects, each of whose size
<b> Returns</b>
3 The calloc function returns either a null pointer or a pointer to the allocated space.
<a name="7.22.3.3" href="#7.22.3.3"><b> 7.22.3.3 The free function</b></a>
<b> Returns</b>
3 The calloc function returns either a null pointer or a pointer to the allocated space.
<a name="7.22.3.3" href="#7.22.3.3"><b> 7.22.3.3 The free function</b></a>
int atexit(void (*func)(void));
<b> Description</b>
2 The atexit function registers the function pointed to by func, to be called without
int atexit(void (*func)(void));
<b> Description</b>
2 The atexit function registers the function pointed to by func, to be called without
int at_quick_exit(void (*func)(void));
<b> Description</b>
2 The at_quick_exit function registers the function pointed to by func, to be called
int at_quick_exit(void (*func)(void));
<b> Description</b>
2 The at_quick_exit function registers the function pointed to by func, to be called
applications may need to call both registration functions with the same argument.
[<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
applications may need to call both registration functions with the same argument.
[<a name="p350" href="#p350">page 350</a>] (<a href="#Contents">Contents</a>)
more than once, or calls the quick_exit function in addition to the exit function, the
behavior is undefined.
3 First, all functions registered by the atexit function are called, in the reverse order of
more than once, or calls the quick_exit function in addition to the exit function, the
behavior is undefined.
3 First, all functions registered by the atexit function are called, in the reverse order of
functions that had already been called at the time it was registered. If, during the call to
any such function, a call to the longjmp function is made that would terminate the call
to the registered function, the behavior is undefined.
functions that had already been called at the time it was registered. If, during the call to
any such function, a call to the longjmp function is made that would terminate the call
to the registered function, the behavior is undefined.
other registered functions.
[<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
other registered functions.
[<a name="p351" href="#p351">page 351</a>] (<a href="#Contents">Contents</a>)
for a string that matches the string pointed to by name. The set of environment names
and the method for altering the environment list are implementation-defined. The
getenv function need not avoid data races with other threads of execution that modify
for a string that matches the string pointed to by name. The set of environment names
and the method for altering the environment list are implementation-defined. The
getenv function need not avoid data races with other threads of execution that modify
3 The implementation shall behave as if no library function calls the getenv function.
<b> Returns</b>
4 The getenv function returns a pointer to a string associated with the matched list
3 The implementation shall behave as if no library function calls the getenv function.
<b> Returns</b>
4 The getenv function returns a pointer to a string associated with the matched list
are called. If a program calls the quick_exit function more than once, or calls the
exit function in addition to the quick_exit function, the behavior is undefined.
3 The quick_exit function first calls all functions registered by the at_quick_exit
are called. If a program calls the quick_exit function more than once, or calls the
exit function in addition to the quick_exit function, the behavior is undefined.
3 The quick_exit function first calls all functions registered by the at_quick_exit
- function, in the reverse order of their registration,294) except that a function is called after
+ function, in the reverse order of their registration,<sup><a href="#note294"><b>294)</b></a></sup> except that a function is called after
in <a href="#7.1.4">7.1.4</a>.
2 The implementation shall ensure that the second argument of the comparison function
(when called from bsearch), or both arguments (when called from qsort), are
in <a href="#7.1.4">7.1.4</a>.
2 The implementation shall ensure that the second argument of the comparison function
(when called from bsearch), or both arguments (when called from qsort), are
other registered functions.
[<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
other registered functions.
[<a name="p353" href="#p353">page 353</a>] (<a href="#Contents">Contents</a>)
integer less than, equal to, or greater than zero if the key object is considered,
respectively, to be less than, to match, or to be greater than the array element. The array
shall consist of: all the elements that compare less than, all the elements that compare
integer less than, equal to, or greater than zero if the key object is considered,
respectively, to be less than, to match, or to be greater than the array element. The array
shall consist of: all the elements that compare less than, all the elements that compare
- equal to, and all the elements that compare greater than the key object, in that order.296)
+ equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note296"><b>296)</b></a></sup>
<b> Returns</b>
4 The bsearch function returns a pointer to a matching element of the array, or a null
pointer if no match is found. If two elements compare as equal, which element is
<b> Returns</b>
4 The bsearch function returns a pointer to a matching element of the array, or a null
pointer if no match is found. If two elements compare as equal, which element is
- 295) That is, if the value passed is p, then the following expressions are always nonzero:
+ <sup><a name="note295" href="#note295"><b>295)</b></a></sup> That is, if the value passed is p, then the following expressions are always nonzero:
((char *)p - (char *)base) % size == 0
(char *)p >= (char *)base
(char *)p < (char *)base + nmemb * size
((char *)p - (char *)base) % size == 0
(char *)p >= (char *)base
(char *)p < (char *)base + nmemb * size
long long int llabs(long long int j);
<b> Description</b>
2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
long long int llabs(long long int j);
<b> Description</b>
2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the
<b> Returns</b>
3 The abs, labs, and llabs, functions return the absolute value.
<b> Returns</b>
3 The abs, labs, and llabs, functions return the absolute value.
which its character pointer argument, s, is a null pointer. Subsequent calls with s as
other than a null pointer cause the internal conversion state of the function to be altered as
necessary. A call with s as a null pointer causes these functions to return a nonzero value
which its character pointer argument, s, is a null pointer. Subsequent calls with s as
other than a null pointer cause the internal conversion state of the function to be altered as
necessary. A call with s as a null pointer causes these functions to return a nonzero value
category causes the conversion state of these functions to be indeterminate.
<a name="7.22.7.1" href="#7.22.7.1"><b> 7.22.7.1 The mblen function</b></a>
<b> Synopsis</b>
category causes the conversion state of these functions to be indeterminate.
<a name="7.22.7.1" href="#7.22.7.1"><b> 7.22.7.1 The mblen function</b></a>
<b> Synopsis</b>
character codes, but are grouped with an adjacent multibyte character.
[<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
character codes, but are grouped with an adjacent multibyte character.
[<a name="p356" href="#p356">page 356</a>] (<a href="#Contents">Contents</a>)
<b> Returns</b>
4 If an invalid multibyte character is encountered, the mbstowcs function returns
(size_t)(-1). Otherwise, the mbstowcs function returns the number of array
<b> Returns</b>
4 If an invalid multibyte character is encountered, the mbstowcs function returns
(size_t)(-1). Otherwise, the mbstowcs function returns the number of array
- elements modified, not including a terminating null wide character, if any.299)
+ elements modified, not including a terminating null wide character, if any.<sup><a href="#note299"><b>299)</b></a></sup>
<a name="7.22.8.2" href="#7.22.8.2"><b> 7.22.8.2 The wcstombs function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.22"><stdlib.h></a>
<a name="7.22.8.2" href="#7.22.8.2"><b> 7.22.8.2 The wcstombs function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.22"><stdlib.h></a>
<a name="7.23.1" href="#7.23.1"><b> 7.23.1 String function conventions</b></a>
1 The header <a href="#7.23"><string.h></a> declares one type and several functions, and defines one
macro useful for manipulating arrays of character type and other objects treated as arrays
<a name="7.23.1" href="#7.23.1"><b> 7.23.1 String function conventions</b></a>
1 The header <a href="#7.23"><string.h></a> declares one type and several functions, and defines one
macro useful for manipulating arrays of character type and other objects treated as arrays
<a name="7.19)" href="#7.19)"><b> 7.19). Various methods are used for determining the lengths of the arrays, but in all cases</b></a>
a char * or void * argument points to the initial (lowest addressed) character of the
array. If an array is accessed beyond the end of an object, the behavior is undefined.
<a name="7.19)" href="#7.19)"><b> 7.19). Various methods are used for determining the lengths of the arrays, but in all cases</b></a>
a char * or void * argument points to the initial (lowest addressed) character of the
array. If an array is accessed beyond the end of an object, the behavior is undefined.
3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
are appended to the copy in the array pointed to by s1, until n characters in all have been
written.
3 If the array pointed to by s2 is a string that is shorter than n characters, null characters
are appended to the copy in the array pointed to by s1, until n characters in all have been
written.
2 The strncat function appends not more than n characters (a null character and
characters that follow it are not appended) from the array pointed to by s2 to the end of
the string pointed to by s1. The initial character of s2 overwrites the null character at the
2 The strncat function appends not more than n characters (a null character and
characters that follow it are not appended) from the array pointed to by s2 to the end of
the string pointed to by s1. The initial character of s2 overwrites the null character at the
- 301) Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
+ <sup><a name="note301" href="#note301"><b>301)</b></a></sup> Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
int memcmp(const void *s1, const void *s2, size_t n);
<b> Description</b>
2 The memcmp function compares the first n characters of the object pointed to by s1 to
int memcmp(const void *s1, const void *s2, size_t n);
<b> Description</b>
2 The memcmp function compares the first n characters of the object pointed to by s1 to
<b> Returns</b>
3 The memcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
<b> Returns</b>
3 The memcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the object pointed to by s1 is greater than, equal to, or less than the object
3 The strcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
3 The strcmp function returns an integer greater than, equal to, or less than zero,
accordingly as the string pointed to by s1 is greater than, equal to, or less than the string
2 Of the <a href="#7.12"><math.h></a> and <a href="#7.3"><complex.h></a> functions without an f (float) or l (long
double) suffix, several have one or more parameters whose corresponding real type is
double. For each such function, except modf, there is a corresponding type-generic
2 Of the <a href="#7.12"><math.h></a> and <a href="#7.3"><complex.h></a> functions without an f (float) or l (long
double) suffix, several have one or more parameters whose corresponding real type is
double. For each such function, except modf, there is a corresponding type-generic
synopsis are generic parameters. Use of the macro invokes a function whose
corresponding real type and type domain are determined by the arguments for the generic
synopsis are generic parameters. Use of the macro invokes a function whose
corresponding real type and type domain are determined by the arguments for the generic
3 Use of the macro invokes a function whose generic parameters have the corresponding
real type determined as follows:
-- First, if any argument for generic parameters has type long double, the type
3 Use of the macro invokes a function whose generic parameters have the corresponding
real type determined as follows:
-- First, if any argument for generic parameters has type long double, the type
the behavior is undefined.
[<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
the behavior is undefined.
[<a name="p370" href="#p370">page 370</a>] (<a href="#Contents">Contents</a>)
time based on the time base base.
<b> Returns</b>
3 If the xtime_get function is successful it returns the nonzero value base, which must
time based on the time base base.
<b> Returns</b>
3 If the xtime_get function is successful it returns the nonzero value base, which must
xtime object is system dependent.
[<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
xtime object is system dependent.
[<a name="p384" href="#p384">page 384</a>] (<a href="#Contents">Contents</a>)
4 The range and precision of times representable in clock_t and time_t are
implementation-defined. The tm structure shall contain at least the following members,
in any order. The semantics of the members and their normal ranges are expressed in the
4 The range and precision of times representable in clock_t and time_t are
implementation-defined. The tm structure shall contain at least the following members,
in any order. The semantics of the members and their normal ranges are expressed in the
int tm_sec; // seconds after the minute -- [0, 60]
int tm_min; // minutes after the hour -- [0, 59]
int tm_hour; // hours since midnight -- [0, 23]
int tm_sec; // seconds after the minute -- [0, 60]
int tm_min; // minutes after the hour -- [0, 59]
int tm_hour; // hours since midnight -- [0, 23]
only to the program invocation. To determine the time in seconds, the value returned by
the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
the processor time used is not available or its value cannot be represented, the function
only to the program invocation. To determine the time in seconds, the value returned by
the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If
the processor time used is not available or its value cannot be represented, the function
<a name="7.26.2.2" href="#7.26.2.2"><b> 7.26.2.2 The difftime function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.26"><time.h></a>
<a name="7.26.2.2" href="#7.26.2.2"><b> 7.26.2.2 The difftime function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.26"><time.h></a>
the program and its return value subtracted from the value returned by subsequent calls.
[<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
the program and its return value subtracted from the value returned by subsequent calls.
[<a name="p386" href="#p386">page 386</a>] (<a href="#Contents">Contents</a>)
structure pointed to by timeptr into a calendar time value with the same encoding as
that of the values returned by the time function. The original values of the tm_wday
and tm_yday components of the structure are ignored, and the original values of the
structure pointed to by timeptr into a calendar time value with the same encoding as
that of the values returned by the time function. The original values of the tm_wday
and tm_yday components of the structure are ignored, and the original values of the
completion, the values of the tm_wday and tm_yday components of the structure are
set appropriately, and the other components are set to represent the specified calendar
time, but with their values forced to the ranges indicated above; the final value of
completion, the values of the tm_wday and tm_yday components of the structure are
set appropriately, and the other components are set to represent the specified calendar
time, but with their values forced to the ranges indicated above; the final value of
Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
Daylight Saving Time, respectively, is or is not in effect for the specified time. A negative value
causes it to attempt to determine whether Daylight Saving Time is in effect for the specified time.
- ranges,310) the behavior of the asctime function is undefined. Likewise, if the
+ ranges,<sup><a href="#note310"><b>310)</b></a></sup> the behavior of the asctime function is undefined. Likewise, if the
%u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
is 1. [tm_wday]
%U is replaced by the week number of the year (the first Sunday as the first day of week
%u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday
is 1. [tm_wday]
%U is replaced by the week number of the year (the first Sunday as the first day of week
%V is replaced by the ISO 8601 week number (see below) as a decimal number
(01-53). [tm_year, tm_wday, tm_yday]
%w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
%V is replaced by the ISO 8601 week number (see below) as a decimal number
(01-53). [tm_year, tm_wday, tm_yday]
%w is replaced by the weekday as a decimal number (0-6), where Sunday is 0.
bytes from the input have been consumed by this call).
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
bytes from the input have been consumed by this call).
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
(size_t)(-1) 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,
(size_t)(-1) 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,
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p396" href="#p396">page 396</a>] (<a href="#Contents">Contents</a>)
bytes from the input have been consumed by this call).
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
bytes from the input have been consumed by this call).
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
(size_t)(-1) 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,
(size_t)(-1) 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,
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p398" href="#p398">page 398</a>] (<a href="#Contents">Contents</a>)
<a name="7.28" href="#7.28"><b> 7.28 Extended multibyte and wide character utilities <wchar.h></b></a>
<a name="7.28.1" href="#7.28.1"><b> 7.28.1 Introduction</b></a>
1 The header <a href="#7.28"><wchar.h></a> defines four macros, and declares four data types, one tag, and
<a name="7.28" href="#7.28"><b> 7.28 Extended multibyte and wide character utilities <wchar.h></b></a>
<a name="7.28.1" href="#7.28.1"><b> 7.28.1 Introduction</b></a>
1 The header <a href="#7.28"><wchar.h></a> defines four macros, and declares four data types, one tag, and
2 The types declared are wchar_t and size_t (both described in <a href="#7.19">7.19</a>);
mbstate_t
which is a complete object type other than an array type that can hold the conversion state
2 The types declared are wchar_t and size_t (both described in <a href="#7.19">7.19</a>);
mbstate_t
which is a complete object type other than an array type that can hold the conversion state
which is an integer type unchanged by default argument promotions that can hold any
value corresponding to members of the extended character set, as well as at least one
value that does not correspond to any member of the extended character set (see WEOF
which is an integer type unchanged by default argument promotions that can hold any
value corresponding to members of the extended character set, as well as at least one
value that does not correspond to any member of the extended character set (see WEOF
struct tm
which is declared as an incomplete structure type (the contents are described in <a href="#7.26.1">7.26.1</a>).
3 The macros defined are NULL (described in <a href="#7.19">7.19</a>); WCHAR_MIN and WCHAR_MAX
(described in <a href="#7.20.3">7.20.3</a>); and
WEOF
which expands to a constant expression of type wint_t whose value does not
struct tm
which is declared as an incomplete structure type (the contents are described in <a href="#7.26.1">7.26.1</a>).
3 The macros defined are NULL (described in <a href="#7.19">7.19</a>); WCHAR_MIN and WCHAR_MAX
(described in <a href="#7.20.3">7.20.3</a>); and
WEOF
which expands to a constant expression of type wint_t whose value does not
by several functions in this subclause to indicate end-of-file, that is, no more input from a
stream. It is also used as a wide character value that does not correspond to any member
of the extended character set.
by several functions in this subclause to indicate end-of-file, that is, no more input from a
stream. It is also used as a wide character value that does not correspond to any member
of the extended character set.
- 313) See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
- 314) wchar_t and wint_t can be the same integer type.
- 315) The value of the macro WEOF may differ from that of EOF and need not be negative.
+ <sup><a name="note313" href="#note313"><b>313)</b></a></sup> See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
+ <sup><a name="note314" href="#note314"><b>314)</b></a></sup> wchar_t and wint_t can be the same integer type.
+ <sup><a name="note315" href="#note315"><b>315)</b></a></sup> The value of the macro WEOF may differ from that of EOF and need not be negative.
undefined.
<a name="7.28.2" href="#7.28.2"><b> 7.28.2 Formatted wide character input/output functions</b></a>
1 The formatted wide character input/output functions shall behave as if there is a sequence
undefined.
<a name="7.28.2" href="#7.28.2"><b> 7.28.2 Formatted wide character input/output functions</b></a>
1 The formatted wide character input/output functions shall behave as if there is a sequence
<a name="7.28.2.1" href="#7.28.2.1"><b> 7.28.2.1 The fwprintf function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
<a name="7.28.2.1" href="#7.28.2.1"><b> 7.28.2.1 The fwprintf function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
[<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
left adjustment flag, described later, has been given) to the field width. The field
width takes the form of an asterisk * (described later) or a nonnegative decimal
[<a name="p400" href="#p400">page 400</a>] (<a href="#Contents">Contents</a>)
left adjustment flag, described later, has been given) to the field width. The field
width takes the form of an asterisk * (described later) or a nonnegative decimal
-- An optional precision that gives the minimum number of digits to appear for the d, i,
o, u, x, and X conversions, the number of digits to appear after the decimal-point
wide character for a, A, e, E, f, and F conversions, the maximum number of
-- An optional precision that gives the minimum number of digits to appear for the d, i,
o, u, x, and X conversions, the number of digits to appear after the decimal-point
wide character for a, A, e, E, f, and F conversions, the maximum number of
this flag is not specified.)
+ 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
this flag is not specified.)
+ 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
space 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.
space 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.
conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g,
- 317) Note that 0 is taken as a flag, not as the beginning of a field width.
- 318) The results of all floating conversions of a negative zero, and of negative values that round to zero,
+ <sup><a name="note317" href="#note317"><b>317)</b></a></sup> Note that 0 is taken as a flag, not as the beginning of a field width.
+ <sup><a name="note318" href="#note318"><b>318)</b></a></sup> The results of all floating conversions of a negative zero, and of negative values that round to zero,
e,E 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
e,E 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
a,A 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
a,A 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
number of hexadecimal digits after it is equal to the precision; if the precision
is missing and FLT_RADIX is a power of 2, then the precision is sufficient
number of hexadecimal digits after it is equal to the precision; if the precision
is missing and FLT_RADIX is a power of 2, then the precision is sufficient
-319) When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
+<sup><a name="note319" href="#note319"><b>319)</b></a></sup> When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual
character so that subsequent digits align to nibble (4-bit) boundaries.
[<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
for an exact representation of the value; if the precision is missing and
FLT_RADIX is not a power of 2, then the precision is sufficient to
character so that subsequent digits align to nibble (4-bit) boundaries.
[<a name="p404" href="#p404">page 404</a>] (<a href="#Contents">Contents</a>)
for an exact representation of the value; if the precision is missing and
FLT_RADIX is not a power of 2, then the precision is sufficient to
omitted; if the precision is zero and the # flag is not specified, no decimal-
point wide character appears. The letters abcdef are used for a conversion
and the letters ABCDEF for A conversion. The A conversion specifier
omitted; if the precision is zero and the # flag is not specified, no decimal-
point wide character appears. The letters abcdef are used for a conversion
and the letters ABCDEF for A conversion. The A conversion specifier
p 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-
p 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-
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point wide character.
FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p
might suffice depending on the implementation's scheme for determining the digit to the left of the
decimal-point wide character.
behavior is undefined.
% A % wide character is written. No argument is converted. The complete
conversion specification shall be %%.
behavior is undefined.
% A % wide character is written. No argument is converted. The complete
conversion specification shall be %%.
not the correct type for the corresponding conversion specification, the behavior is
undefined.
10 In no case does a nonexistent or small field width cause truncation of a field; if the result
not the correct type for the corresponding conversion specification, the behavior is
undefined.
10 In no case does a nonexistent or small field width cause truncation of a field; if the result
in hexadecimal floating style with the given precision, with the extra stipulation that the
error should have a correct sign for the current rounding direction.
13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
in hexadecimal floating style with the given precision, with the extra stipulation that the
error should have a correct sign for the current rounding direction.
13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most
significant decimal digits is more than DECIMAL_DIG but the source value is exactly
representable with DECIMAL_DIG digits, then the result should be an exact
representation with trailing zeros. Otherwise, the source value is bounded by two
significant decimal digits is more than DECIMAL_DIG but the source value is exactly
representable with DECIMAL_DIG digits, then the result should be an exact
representation with trailing zeros. Otherwise, the source value is bounded by two
14 The fwprintf function returns the number of wide characters transmitted, or a negative
value if an output or encoding error occurred.
14 The fwprintf function returns the number of wide characters transmitted, or a negative
value if an output or encoding error occurred.
- 322) See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
- 323) For binary-to-decimal conversion, the result format's values are the numbers representable with the
+ <sup><a name="note322" href="#note322"><b>322)</b></a></sup> See ''future library directions'' (<a href="#7.30.12">7.30.12</a>).
+ <sup><a name="note323" href="#note323"><b>323)</b></a></sup> For binary-to-decimal conversion, the result format's values are the numbers representable with the
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
given format specifier. The number of significant digits is determined by the format specifier, and in
the case of fixed-point conversion by the source value as well.
described below for each specifier. A conversion specification is executed in the
following steps:
8 Input white-space wide characters (as specified by the iswspace function) are skipped,
described below for each specifier. A conversion specification is executed in the
following steps:
8 Input white-space wide characters (as specified by the iswspace function) are skipped,
9 An input item is read from the stream, unless the specification includes an n specifier. An
input item is defined as the longest sequence of input wide characters which does not
exceed any specified field width and which is, or is a prefix of, a matching input
9 An input item is read from the stream, unless the specification includes an n specifier. An
input item is defined as the longest sequence of input wide characters which does not
exceed any specified field width and which is, or is a prefix of, a matching input
- sequence.325) The first wide character, if any, after the input item remains unread. If the
+ sequence.<sup><a href="#note325"><b>325)</b></a></sup> The first wide character, if any, after the input item remains unread. If the
length of the input item is zero, the execution of the directive fails; this condition is a
matching failure unless end-of-file, an encoding error, or a read error prevented input
from the stream, in which case it is an input failure.
length of the input item is zero, the execution of the directive fails; this condition is a
matching failure unless end-of-file, an encoding error, or a read error prevented input
from the stream, in which case it is an input failure.
- 324) These white-space wide characters are not counted against a specified field width.
- 325) fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
+ <sup><a name="note324" href="#note324"><b>324)</b></a></sup> These white-space wide characters are not counted against a specified field width.
+ <sup><a name="note325" href="#note325"><b>325)</b></a></sup> fwscanf pushes back at most one input wide character onto the input stream. Therefore, some
sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
[<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf.
[<a name="p408" href="#p408">page 408</a>] (<a href="#Contents">Contents</a>)
undefined.
% Matches a single % wide character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
undefined.
% Matches a single % wide character; no conversion or assignment occurs. The
complete conversion specification shall be %%.
14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
respectively, a, e, f, g, and x.
15 Trailing white space (including new-line wide characters) is left unread unless matched
14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as,
respectively, a, e, f, g, and x.
15 Trailing white space (including new-line wide characters) is left unread unless matched
2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwprintf function does not invoke the
2 The vfwprintf function is equivalent to fwprintf, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwprintf function does not invoke the
<b> Returns</b>
3 The vfwprintf function returns the number of wide characters transmitted, or a
negative value if an output or encoding error occurred.
<b> Returns</b>
3 The vfwprintf function returns the number of wide characters transmitted, or a
negative value if an output or encoding error occurred.
- 327) As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
+ <sup><a name="note327" href="#note327"><b>327)</b></a></sup> As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
invoke the va_arg macro, the value of arg after the return is indeterminate.
[<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
invoke the va_arg macro, the value of arg after the return is indeterminate.
[<a name="p414" href="#p414">page 414</a>] (<a href="#Contents">Contents</a>)
the fgetwc function returns the next wide character from the input stream pointed to by
stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
function returns WEOF. If an encoding error occurs (including too few bytes), the value of
the fgetwc function returns the next wide character from the input stream pointed to by
stream. If a read error occurs, the error indicator for the stream is set and the fgetwc
function returns WEOF. If an encoding error occurs (including too few bytes), the value of
<a name="7.28.3.2" href="#7.28.3.2"><b> 7.28.3.2 The fgetws function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
<a name="7.28.3.2" href="#7.28.3.2"><b> 7.28.3.2 The fgetws function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.21"><stdio.h></a>
Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
[<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
[<a name="p418" href="#p418">page 418</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
2 The fwide function determines the orientation of the stream pointed to by stream. If
mode is greater than zero, the function first attempts to make the stream wide oriented. If
<b> Description</b>
2 The fwide function determines the orientation of the stream pointed to by stream. If
mode is greater than zero, the function first attempts to make the stream wide oriented. If
Otherwise, mode is zero and the function does not alter the orientation of the stream.
<b> Returns</b>
3 The fwide function returns a value greater than zero if, after the call, the stream has
Otherwise, mode is zero and the function does not alter the orientation of the stream.
<b> Returns</b>
3 The fwide function returns a value greater than zero if, after the call, the stream has
floating point number, or if a binary exponent part does not appear in a hexadecimal
floating point number, an exponent part of the appropriate type with value zero is
assumed to follow the last digit in the string. If the subject sequence begins with a minus
floating point number, or if a binary exponent part does not appear in a hexadecimal
floating point number, an exponent part of the appropriate type with value zero is
assumed to follow the last digit in the string. If the subject sequence begins with a minus
INFINITY is interpreted as an infinity, if representable in the return type, else like a
floating constant that is too large for the range of the return type. A wide character
sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
in the return type, else like a subject sequence part that does not have the expected form;
INFINITY is interpreted as an infinity, if representable in the return type, else like a
floating constant that is too large for the range of the return type. A wide character
sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported
in the return type, else like a subject sequence part that does not have the expected form;
final wide string is stored in the object pointed to by endptr, provided that endptr is
not a null pointer.
5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
final wide string is stored in the object pointed to by endptr, provided that endptr is
not a null pointer.
5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the
negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
methods may yield different results if rounding is toward positive or negative infinity. In either case,
the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
negating the value resulting from converting the corresponding unsigned sequence (see <a href="#F.5">F.5</a>); the two
methods may yield different results if rounding is toward positive or negative infinity. In either case,
the functions honor the sign of zero if floating-point arithmetic supports signed zeros.
The result should be one of the (equal or adjacent) values that would be obtained by
correctly rounding L and U according to the current rounding direction, with the extra
stipulation that the error with respect to D should have a correct sign for the current
The result should be one of the (equal or adjacent) values that would be obtained by
correctly rounding L and U according to the current rounding direction, with the extra
stipulation that the error with respect to D should have a correct sign for the current
<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
<b> Returns</b>
10 The functions return the converted value, if any. If no conversion could be performed,
zero is returned. If the correct value overflows and default rounding is in effect (<a href="#7.12.1">7.12.1</a>),
- 332) DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
+ <sup><a name="note332" href="#note332"><b>332)</b></a></sup> DECIMAL_DIG, defined in <a href="#7.7"><float.h></a>, should be sufficiently large that L and U will usually round
to the same internal floating value, but if not will round to adjacent values.
[<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
to the same internal floating value, but if not will round to adjacent values.
[<a name="p425" href="#p425">page 425</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
2 The wcsncpy function copies not more than n wide characters (those that follow a null
wide character are not copied) from the array pointed to by s2 to the array pointed to by
<b> Description</b>
2 The wcsncpy function copies not more than n wide characters (those that follow a null
wide character are not copied) from the array pointed to by s2 to the array pointed to by
3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
wide characters are appended to the copy in the array pointed to by s1, until n wide
characters in all have been written.
3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null
wide characters are appended to the copy in the array pointed to by s1, until n wide
characters in all have been written.
- 333) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
+ <sup><a name="note333" href="#note333"><b>333)</b></a></sup> Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
result will not be null-terminated.
[<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
result will not be null-terminated.
[<a name="p428" href="#p428">page 428</a>] (<a href="#Contents">Contents</a>)
the wide string pointed to by s1. The initial wide character of s2 overwrites the null
wide character at the end of s1. A terminating null wide character is always appended to
the wide string pointed to by s1. The initial wide character of s2 overwrites the null
wide character at the end of s1. A terminating null wide character is always appended to
<b> Returns</b>
3 The wcsncat function returns the value of s1.
<a name="7.28.4.4" href="#7.28.4.4"><b> 7.28.4.4 Wide string comparison functions</b></a>
<b> Returns</b>
3 The wcsncat function returns the value of s1.
<a name="7.28.4.4" href="#7.28.4.4"><b> 7.28.4.4 Wide string comparison functions</b></a>
been altered by any of the functions described in this subclause, and is then used with a
different multibyte character sequence, or in the other conversion direction, or with a
different LC_CTYPE category setting than on earlier function calls, the behavior is
been altered by any of the functions described in this subclause, and is then used with a
different multibyte character sequence, or in the other conversion direction, or with a
different LC_CTYPE category setting than on earlier function calls, the behavior is
4 On entry, each function takes the described conversion state (either internal or pointed to
by an argument) as current. The conversion state described by the referenced object is
altered as needed to track the shift state, and the position within a multibyte character, for
4 On entry, each function takes the described conversion state (either internal or pointed to
by an argument) as current. The conversion state described by the referenced object is
altered as needed to track the shift state, and the position within a multibyte character, for
- 335) Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
+ <sup><a name="note335" href="#note335"><b>335)</b></a></sup> Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
of bytes that complete the multibyte character.
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
of bytes that complete the multibyte character.
(size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid)
multibyte character, and all n bytes have been processed (no value is
(size_t)(-1) 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.
(size_t)(-1) 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.
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
sequence of redundant shift sequences (for implementations with state-dependent encodings).
[<a name="p440" href="#p440">page 440</a>] (<a href="#Contents">Contents</a>)
continues up to and including a terminating null character, which is also stored.
Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
not form a valid multibyte character, or (if dst is not a null pointer) when len wide
continues up to and including a terminating null character, which is also stored.
Conversion stops earlier in two cases: when a sequence of bytes is encountered that does
not form a valid multibyte character, or (if dst is not a null pointer) when len wide
place as if by a call to the mbrtowc function.
3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null character) or the address
place as if by a call to the mbrtowc function.
3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null character) or the address
not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
next multibyte character would exceed the limit of len total bytes to be stored into the
array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
not correspond to a valid multibyte character, or (if dst is not a null pointer) when the
next multibyte character would exceed the limit of len total bytes to be stored into the
array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb
3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null wide character) or the
address just past the last wide character converted (if any). If conversion stopped due to
3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null wide character) or the
address just past the last wide character converted (if any). If conversion stopped due to
include those necessary to reach the initial shift state immediately before the null byte.
[<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
include those necessary to reach the initial shift state immediately before the null byte.
[<a name="p443" href="#p443">page 443</a>] (<a href="#Contents">Contents</a>)
<a name="7.29" href="#7.29"><b> 7.29 Wide character classification and mapping utilities <wctype.h></b></a>
<a name="7.29.1" href="#7.29.1"><b> 7.29.1 Introduction</b></a>
1 The header <a href="#7.29"><wctype.h></a> defines one macro, and declares three data types and many
<a name="7.29" href="#7.29"><b> 7.29 Wide character classification and mapping utilities <wctype.h></b></a>
<a name="7.29.1" href="#7.29.1"><b> 7.29.1 Introduction</b></a>
1 The header <a href="#7.29"><wctype.h></a> defines one macro, and declares three data types and many
if by a call to the wctob function) to a single-byte character for which the corresponding
character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
iswpunct functions may differ with respect to wide characters other than L' ' that are
if by a call to the wctob function) to a single-byte character for which the corresponding
character classification function from <a href="#7.4.1">7.4.1</a> returns true, except that the iswgraph and
iswpunct functions may differ with respect to wide characters other than L' ' that are
Forward references: the wctob function (<a href="#7.28.6.1.2">7.28.6.1.2</a>).
<a name="7.29.2.1.1" href="#7.29.2.1.1"><b> 7.29.2.1.1 The iswalnum function</b></a>
<b> Synopsis</b>
Forward references: the wctob function (<a href="#7.28.6.1.2">7.28.6.1.2</a>).
<a name="7.29.2.1.1" href="#7.29.2.1.1"><b> 7.29.2.1.1 The iswalnum function</b></a>
<b> Synopsis</b>
2 The iswalpha function tests for any wide character for which iswupper or
iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
2 The iswalpha function tests for any wide character for which iswupper or
iswlower is true, or any wide character that is one of a locale-specific set of alphabetic
- 340) For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
+ <sup><a name="note340" href="#note340"><b>340)</b></a></sup> For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call
iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
(which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
&& iswspace(wc) is true, but not both.
iswalpha(wc) also returns true. But, if the expression isgraph(wctob(wc)) evaluates to true
(which cannot occur for wc == L' ' of course), then either iswgraph(wc) or iswprint(wc)
&& iswspace(wc) is true, but not both.
[<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
[<a name="p445" href="#p445">page 445</a>] (<a href="#Contents">Contents</a>)
wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace
<a name="7.29.2.1.3" href="#7.29.2.1.3"><b> 7.29.2.1.3 The iswblank function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.29"><wctype.h></a>
<a name="7.29.2.1.3" href="#7.29.2.1.3"><b> 7.29.2.1.3 The iswblank function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.29"><wctype.h></a>
wide characters; all four combinations are possible.
[<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
2 The iswgraph function tests for any wide character for which iswprint is true and
wide characters; all four combinations are possible.
[<a name="p446" href="#p446">page 446</a>] (<a href="#Contents">Contents</a>)
<b> Description</b>
2 The iswgraph function tests for any wide character for which iswprint is true and
<a name="7.29.2.1.7" href="#7.29.2.1.7"><b> 7.29.2.1.7 The iswlower function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.29"><wctype.h></a>
<a name="7.29.2.1.7" href="#7.29.2.1.7"><b> 7.29.2.1.7 The iswlower function</b></a>
<b> Synopsis</b>
1 #include <a href="#7.29"><wctype.h></a>
corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
characters other than ' '.
corresponding functions in <a href="#7.4.1">7.4.1</a> with respect to printing, white-space, single-byte execution
characters other than ' '.
Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
dependencies on radix and word length. IEC 60559 generally refers to the floating-point
standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
Arithmetic (ANSI/IEEE 854-1987) generalizes the binary standard to remove
dependencies on radix and word length. IEC 60559 generally refers to the floating-point
standard, as in IEC 60559 operation, IEC 60559 format, etc. An implementation that
Where a binding between the C language and IEC 60559 is indicated, the
IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since
negative and positive infinity are representable in IEC 60559 formats, all real numbers lie
Where a binding between the C language and IEC 60559 is indicated, the
IEC 60559-specified behavior is adopted by reference, unless stated otherwise. Since
negative and positive infinity are representable in IEC 60559 formats, all real numbers lie
1 The C floating types match the IEC 60559 formats as follows:
-- The float type matches the IEC 60559 single format.
-- The double type matches the IEC 60559 double format.
1 The C floating types match the IEC 60559 formats as follows:
-- The float type matches the IEC 60559 single format.
-- The double type matches the IEC 60559 double format.
non-IEC 60559 extended format, else the IEC 60559 double format.
Any non-IEC 60559 extended format used for the long double type shall have more
non-IEC 60559 extended format, else the IEC 60559 double format.
Any non-IEC 60559 extended format used for the long double type shall have more
Recommended practice
2 The long double type should match an IEC 60559 extended format.
<a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
Recommended practice
2 The long double type should match an IEC 60559 extended format.
<a name="F.2.1" href="#F.2.1"><b> F.2.1 Infinities, signed zeros, and NaNs</b></a>
the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
functions in <a href="#7.12"><math.h></a> provide designations for IEC 60559 NaNs and infinities.
<a name="F.3" href="#F.3"><b> F.3 Operators and functions</b></a>
the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan
functions in <a href="#7.12"><math.h></a> provide designations for IEC 60559 NaNs and infinities.
<a name="F.3" href="#F.3"><b> F.3 Operators and functions</b></a>
strtold, fprintf, fscanf, and related library functions in <a href="#7.22"><stdlib.h></a>,
strtold, fprintf, fscanf, and related library functions in <a href="#7.22"><stdlib.h></a>,
sufficient for closure of the arithmetic.
[<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
sufficient for closure of the arithmetic.
[<a name="p504" href="#p504">page 504</a>] (<a href="#Contents">Contents</a>)
value is determined by <a href="#6.3.1.4">6.3.1.4</a>. Conversion of an integral floating value that does not
exceed the range of the integer type raises no floating-point exceptions; whether
conversion of a non-integral floating value raises the ''inexact'' floating-point exception is
value is determined by <a href="#6.3.1.4">6.3.1.4</a>. Conversion of an integral floating value that does not
exceed the range of the integer type raises no floating-point exceptions; whether
conversion of a non-integral floating value raises the ''inexact'' floating-point exception is
<a name="F.5" href="#F.5"><b> F.5 Binary-decimal conversion</b></a>
1 Conversion from the widest supported IEC 60559 format to decimal with
<a name="F.5" href="#F.5"><b> F.5 Binary-decimal conversion</b></a>
1 Conversion from the widest supported IEC 60559 format to decimal with
2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
particular, conversion between any supported IEC 60559 format and decimal with
DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In
particular, conversion between any supported IEC 60559 format and decimal with
DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current
- 347) ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
+ <sup><a name="note347" href="#note347"><b>347)</b></a></sup> ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer
conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
cases where it matters, library functions can be used to effect such conversions with or without raising
the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
<a href="#7.12"><math.h></a>.
conversions raise the ''inexact'' floating-point exception for non-integer in-range values. In those
cases where it matters, library functions can be used to effect such conversions with or without raising
the ''inexact'' floating-point exception. See rint, lrint, llrint, and nearbyint in
<a href="#7.12"><math.h></a>.
DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
DBL_DIG are 18 and 15, respectively, for these formats.)
DECIMAL_DIG shall be at least 21. If IEC 60559 double (53 bits of precision) is the widest
IEC 60559 format supported, then DECIMAL_DIG shall be at least 17. (By contrast, LDBL_DIG and
DBL_DIG are 18 and 15, respectively, for these formats.)
unsigned sequence.
<a name="F.6" href="#F.6"><b> F.6 The return statement</b></a>
If the return expression is evaluated in a floating-point format different from the return
unsigned sequence.
<a name="F.6" href="#F.6"><b> F.6 The return statement</b></a>
If the return expression is evaluated in a floating-point format different from the return
and the resulting value is returned to the caller.
<a name="F.7" href="#F.7"><b> F.7 Contracted expressions</b></a>
1 A contracted expression is correctly rounded (once) and treats infinities, NaNs, signed
and the resulting value is returned to the caller.
<a name="F.7" href="#F.7"><b> F.7 Contracted expressions</b></a>
1 A contracted expression is correctly rounded (once) and treats infinities, NaNs, signed
1 The floating-point environment defined in <a href="#7.6"><fenv.h></a> includes the IEC 60559 floating-
point exception status flags and directed-rounding control modes. It includes also
IEC 60559 dynamic rounding precision and trap enablement modes, if the
1 The floating-point environment defined in <a href="#7.6"><fenv.h></a> includes the IEC 60559 floating-
point exception status flags and directed-rounding control modes. It includes also
IEC 60559 dynamic rounding precision and trap enablement modes, if the
<a name="F.8.1" href="#F.8.1"><b> F.8.1 Environment management</b></a>
1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
status flags, and that rounding control modes can be set explicitly to affect result values of
floating-point operations. When the state for the FENV_ACCESS pragma (defined in
<a href="#7.6"><fenv.h></a>) is ''on'', these changes to the floating-point state are treated as side effects
<a name="F.8.1" href="#F.8.1"><b> F.8.1 Environment management</b></a>
1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception
status flags, and that rounding control modes can be set explicitly to affect result values of
floating-point operations. When the state for the FENV_ACCESS pragma (defined in
<a href="#7.6"><fenv.h></a>) is ''on'', these changes to the floating-point state are treated as side effects
- 349) Assignment removes any extra range and precision.
- 350) This specification does not require dynamic rounding precision nor trap enablement modes.
- 351) If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
+ <sup><a name="note349" href="#note349"><b>349)</b></a></sup> Assignment removes any extra range and precision.
+ <sup><a name="note350" href="#note350"><b>350)</b></a></sup> This specification does not require dynamic rounding precision nor trap enablement modes.
+ <sup><a name="note351" href="#note351"><b>351)</b></a></sup> If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating-
point control modes will be the default ones and the floating-point status flags will not be tested,
which allows certain optimizations (see <a href="#F.9">F.9</a>).
point control modes will be the default ones and the floating-point status flags will not be tested,
which allows certain optimizations (see <a href="#F.9">F.9</a>).
-- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
Recommended practice
2 The implementation should produce a diagnostic message for each translation-time
-- Trapping or stopping (if supported) is disabled on all floating-point exceptions.
Recommended practice
2 The implementation should produce a diagnostic message for each translation-time
proceed with the translation of the program.
<a name="F.8.3" href="#F.8.3"><b> F.8.3 Execution</b></a>
1 At program startup the floating-point environment is initialized as prescribed by
proceed with the translation of the program.
<a name="F.8.3" href="#F.8.3"><b> F.8.3 Execution</b></a>
1 At program startup the floating-point environment is initialized as prescribed by
object that has static or thread storage duration, is evaluated (as if) during execution; thus,
it is affected by any operative floating-point control modes and raises floating-point
exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
object that has static or thread storage duration, is evaluated (as if) during execution; thus,
it is affected by any operative floating-point control modes and raises floating-point
exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma
conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
(even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
strtod, provide execution-time conversion of numeric strings.
conversion is subject to default rounding modes and raises no execution-time floating-point exceptions
(even where the state of the FENV_ACCESS pragma is ''on''). Library functions, for example
strtod, provide execution-time conversion of numeric strings.
are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
efficiency of translation-time evaluation through static initialization, such as
are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
efficiency of translation-time evaluation through static initialization, such as
done at translation time. The automatic initialization of u and w require an execution-time conversion to
float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
of x and y entail execution-time conversion; however, in some expression evaluation methods, the
done at translation time. The automatic initialization of u and w require an execution-time conversion to
float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations
of x and y entail execution-time conversion; however, in some expression evaluation methods, the
automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating-
point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to
For example, the automatic initialization
double_t x = 1.1e75;
could be done at translation time, regardless of the expression evaluation method.
For example, the automatic initialization
double_t x = 1.1e75;
could be done at translation time, regardless of the expression evaluation method.
constants are exact then such transformations can be made on
IEC 60559 machines and others that round perfectly.
1 x x and x/1 (->) x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
constants are exact then such transformations can be made on
IEC 60559 machines and others that round perfectly.
1 x x and x/1 (->) x The expressions 1 x x, x/1, and x are equivalent (on IEC 60559
x/x (->) 1.0 The expressions x/x and 1.0 are not equivalent if x can be zero,
infinite, or NaN.
x - y (<->) x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on
IEC 60559 machines, among others).
x - y (<->) -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1
x/x (->) 1.0 The expressions x/x and 1.0 are not equivalent if x can be zero,
infinite, or NaN.
x - y (<->) x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on
IEC 60559 machines, among others).
x - y (<->) -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1
x - x (->) 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or
infinite.
0 x x (->) 0.0 The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
x - x (->) 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or
infinite.
0 x x (->) 0.0 The expressions 0 x x and 0.0 are not equivalent if x is a NaN,
and <a href="#F.8.5">F.8.5</a>.) An operation on constants that raises no floating-point exception can be
folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
further check is required to assure that changing the rounding direction to downward does
and <a href="#F.8.5">F.8.5</a>.) An operation on constants that raises no floating-point exception can be
folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a
further check is required to assure that changing the rounding direction to downward does
precision modes shall assure further that the result of the operation raises no floating-
point exception when converted to the semantic type of the operation.
<a name="F.10" href="#F.10"><b> F.10 Mathematics <math.h></b></a>
precision modes shall assure further that the result of the operation raises no floating-
point exception when converted to the semantic type of the operation.
<a name="F.10" href="#F.10"><b> F.10 Mathematics <math.h></b></a>
rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
whose magnitude is too large.
7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value
whose magnitude is too large.
7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially
- 357) 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
- 358) IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
+ <sup><a name="note357" href="#note357"><b>357)</b></a></sup> 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
+ <sup><a name="note358" href="#note358"><b>358)</b></a></sup> IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on
when the floating-point exception is raised.
[<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
when the floating-point exception is raised.
[<a name="p513" href="#p513">page 513</a>] (<a href="#Contents">Contents</a>)
8 Whether or when library functions raise the ''inexact'' floating-point exception is
unspecified, unless explicitly specified otherwise.
9 Whether or when library functions raise an undeserved ''underflow'' floating-point
8 Whether or when library functions raise the ''inexact'' floating-point exception is
unspecified, unless explicitly specified otherwise.
9 Whether or when library functions raise an undeserved ''underflow'' floating-point
- exception is unspecified.359) Otherwise, as implied by <a href="#F.8.6">F.8.6</a>, the <a href="#7.12"><math.h></a> functions do
+ exception is unspecified.<sup><a href="#note359"><b>359)</b></a></sup> Otherwise, as implied by <a href="#F.8.6">F.8.6</a>, the <a href="#7.12"><math.h></a> functions do
not raise spurious floating-point exceptions (detectable by the user), other than the
''inexact'' floating-point exception.
10 Whether the functions honor the rounding direction mode is implementation-defined,
not raise spurious floating-point exceptions (detectable by the user), other than the
''inexact'' floating-point exception.
10 Whether the functions honor the rounding direction mode is implementation-defined,
avoiding them would be too costly.
[<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
avoiding them would be too costly.
[<a name="p514" href="#p514">page 514</a>] (<a href="#Contents">Contents</a>)
1 -- atan((+-)0) returns (+-)0.
-- atan((+-)(inf)) returns (+-)pi /2.
<a name="F.10.1.4" href="#F.10.1.4"><b> F.10.1.4 The atan2 functions</b></a>
1 -- atan((+-)0) returns (+-)0.
-- atan((+-)(inf)) returns (+-)pi /2.
<a name="F.10.1.4" href="#F.10.1.4"><b> F.10.1.4 The atan2 functions</b></a>
-- atan2((+-)0, +0) returns (+-)0.
-- atan2((+-)0, x) returns (+-)pi for x < 0.
-- atan2((+-)0, x) returns (+-)0 for x > 0.
-- atan2((+-)0, +0) returns (+-)0.
-- atan2((+-)0, x) returns (+-)pi for x < 0.
-- atan2((+-)0, x) returns (+-)0 for x > 0.
- 360) atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
+ <sup><a name="note360" href="#note360"><b>360)</b></a></sup> atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
the ''divide-by-zero'' floating-point exception.
[<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
the ''divide-by-zero'' floating-point exception.
[<a name="p515" href="#p515">page 515</a>] (<a href="#Contents">Contents</a>)
1 If just one argument is a NaN, the fmax functions return the other argument (if both
arguments are NaNs, the functions return a NaN).
2 The returned value is exact and is independent of the current rounding direction mode.
1 If just one argument is a NaN, the fmax functions return the other argument (if both
arguments are NaNs, the functions return a NaN).
2 The returned value is exact and is independent of the current rounding direction mode.
{ return (isgreaterequal(x, y) ||
isnan(y)) ? x : y; }
<a name="F.10.9.3" href="#F.10.9.3"><b> F.10.9.3 The fmin functions</b></a>
{ return (isgreaterequal(x, y) ||
isnan(y)) ? x : y; }
<a name="F.10.9.3" href="#F.10.9.3"><b> F.10.9.3 The fmin functions</b></a>
- 361) Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
+ <sup><a name="note361" href="#note361"><b>361)</b></a></sup> Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
return +0; however, implementation in software might be impractical.
[<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
return +0; however, implementation in software might be impractical.
[<a name="p526" href="#p526">page 526</a>] (<a href="#Contents">Contents</a>)
<a name="G.1" href="#G.1"><b> G.1 Introduction</b></a>
1 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
IEC 60559 real floating-point arithmetic. An implementation that defines *
<a name="G.1" href="#G.1"><b> G.1 Introduction</b></a>
1 This annex supplements <a href="#F">annex F</a> to specify complex arithmetic for compatibility with
IEC 60559 real floating-point arithmetic. An implementation that defines *
<a name="G.2" href="#G.2"><b> G.2 Types</b></a>
1 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
used as a type specifier within declaration specifiers in the same way as _Complex is
<a name="G.2" href="#G.2"><b> G.2 Types</b></a>
1 There is a new keyword _Imaginary, which is used to specify imaginary types. It is
used as a type specifier within declaration specifiers in the same way as _Complex is
1 Conversions among imaginary types follow rules analogous to those for real floating
types.
<a name="G.4.2" href="#G.4.2"><b> G.4.2 Real and imaginary</b></a>
1 Conversions among imaginary types follow rules analogous to those for real floating
types.
<a name="G.4.2" href="#G.4.2"><b> G.4.2 Real and imaginary</b></a>
result is a positive zero.
2 When a value of real type is converted to an imaginary type, the result is a positive
imaginary zero.
result is a positive zero.
2 When a value of real type is converted to an imaginary type, the result is a positive
imaginary zero.
x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
4 The * and / operators satisfy the following infinity properties for all real, imaginary, and
x + iy (x/u) + i(y/u) (y/v) + i(-x/v)
4 The * and / operators satisfy the following infinity properties for all real, imaginary, and
-- if one operand is an infinity and the other operand is a nonzero finite number or an
infinity, then the result of the * operator is an infinity;
-- if the first operand is an infinity and the second operand is a finite number, then the
-- if one operand is an infinity and the other operand is a nonzero finite number or an
infinity, then the result of the * operator is an infinity;
-- if the first operand is an infinity and the second operand is a finite number, then the
(at least where the state for CX_LIMITED_RANGE is ''off'').
[<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
(at least where the state for CX_LIMITED_RANGE is ''off'').
[<a name="p530" href="#p530">page 530</a>] (<a href="#Contents">Contents</a>)
4 Since complex and imaginary values are composed of real values, each function may be
regarded as computing real values from real values. Except as noted, the functions treat
real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
4 Since complex and imaginary values are composed of real values, each function may be
regarded as computing real values from real values. Except as noted, the functions treat
real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a
5 The functions cimag, conj, cproj, and creal are fully specified for all
implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
point exceptions.
5 The functions cimag, conj, cproj, and creal are fully specified for all
implementations, including IEC 60559 ones, in <a href="#7.3.9">7.3.9</a>. These functions raise no floating-
point exceptions.
<a name="G.6.4" href="#G.6.4"><b> G.6.4 Power and absolute-value functions</b></a>
<a name="G.6.4.1" href="#G.6.4.1"><b> G.6.4.1 The cpow functions</b></a>
1 The cpow functions raise floating-point exceptions if appropriate for the calculation of
<a name="G.6.4" href="#G.6.4"><b> G.6.4 Power and absolute-value functions</b></a>
<a name="G.6.4.1" href="#G.6.4.1"><b> G.6.4.1 The cpow functions</b></a>
1 The cpow functions raise floating-point exceptions if appropriate for the calculation of
<a name="G.6.4.2" href="#G.6.4.2"><b> G.6.4.2 The csqrt functions</b></a>
1 -- csqrt(conj(z)) = conj(csqrt(z)).
-- csqrt((+-)0 + i0) returns +0 + i0.
<a name="G.6.4.2" href="#G.6.4.2"><b> G.6.4.2 The csqrt functions</b></a>
1 -- csqrt(conj(z)) = conj(csqrt(z)).
-- csqrt((+-)0 + i0) returns +0 + i0.
implementations that treat special cases more carefully.
[<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
implementations that treat special cases more carefully.
[<a name="p540" href="#p540">page 540</a>] (<a href="#Contents">Contents</a>)
security vulnerabilities in programs, and comprise new functions, macros, and types
declared or defined in existing standard headers.
2 An implementation that defines __STDC_LIB_EXT1__ shall conform to the
security vulnerabilities in programs, and comprise new functions, macros, and types
declared or defined in existing standard headers.
2 An implementation that defines __STDC_LIB_EXT1__ shall conform to the
3 Subclause <a href="#K.3">K.3</a> should be read as if it were merged into the parallel structure of named
subclauses of clause 7.
<a name="K.3" href="#K.3"><b> K.3 Library</b></a>
3 Subclause <a href="#K.3">K.3</a> should be read as if it were merged into the parallel structure of named
subclauses of clause 7.
<a name="K.3" href="#K.3"><b> K.3 Library</b></a>
2 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are
declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
defined as a macro which expands to the integer constant 1 at the point in the source file
2 The functions, macros, and types declared or defined in <a href="#K.3">K.3</a> and its subclauses are
declared and defined by their respective headers if __STDC_WANT_LIB_EXT1__ is
defined as a macro which expands to the integer constant 1 at the point in the source file
3 It is implementation-defined whether the functions, macros, and types declared or defined
in <a href="#K.3">K.3</a> and its subclauses are declared or defined by their respective headers if
__STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file
3 It is implementation-defined whether the functions, macros, and types declared or defined
in <a href="#K.3">K.3</a> and its subclauses are declared or defined by their respective headers if
__STDC_WANT_LIB_EXT1__ is not defined as a macro at the point in the source file
4 Within a preprocessing translation unit, __STDC_WANT_LIB_EXT1__ shall be
defined identically for all inclusions of any headers from subclause <a href="#K.3">K.3</a>. If
__STDC_WANT_LIB_EXT1__ is defined differently for any such inclusion, the
implementation shall issue a diagnostic as if a preprocessor error directive were used.
4 Within a preprocessing translation unit, __STDC_WANT_LIB_EXT1__ shall be
defined identically for all inclusions of any headers from subclause <a href="#K.3">K.3</a>. If
__STDC_WANT_LIB_EXT1__ is defined differently for any such inclusion, the
implementation shall issue a diagnostic as if a preprocessor error directive were used.
headers. All other names are not reserved, and a conforming implementation is not permitted to use
them. While some of the names defined in <a href="#K.3">K.3</a> and its subclauses are reserved, others are not. If an
unreserved name is defined in a header when __STDC_WANT_LIB_EXT1__ is defined as 0, the
headers. All other names are not reserved, and a conforming implementation is not permitted to use
them. While some of the names defined in <a href="#K.3">K.3</a> and its subclauses are reserved, others are not. If an
unreserved name is defined in a header when __STDC_WANT_LIB_EXT1__ is defined as 0, the
<a name="K.3.1.4" href="#K.3.1.4"><b> K.3.1.4 Runtime-constraint violations</b></a>
1 Most functions in this annex include as part of their specification a list of runtime-
constraints. These runtime-constraints are requirements on the program using the
<a name="K.3.1.4" href="#K.3.1.4"><b> K.3.1.4 Runtime-constraint violations</b></a>
1 Most functions in this annex include as part of their specification a list of runtime-
constraints. These runtime-constraints are requirements on the program using the
2 Implementations shall verify that the runtime-constraints for a function are not violated
by the program. If a runtime-constraint is violated, the implementation shall call the
currently registered runtime-constraint handler (see set_constraint_handler_s
2 Implementations shall verify that the runtime-constraints for a function are not violated
by the program. If a runtime-constraint is violated, the implementation shall call the
currently registered runtime-constraint handler (see set_constraint_handler_s
exists in this annex. Implementations are free to detect any case of undefined behavior and treat it as a
runtime-constraint violation by calling the runtime-constraint handler. This license comes directly
from the definition of undefined behavior.
exists in this annex. Implementations are free to detect any case of undefined behavior and treat it as a
runtime-constraint violation by calling the runtime-constraint handler. This license comes directly
from the definition of undefined behavior.
<a name="K.3.3" href="#K.3.3"><b> K.3.3 Common definitions <stddef.h></b></a>
1 The header <a href="#7.19"><stddef.h></a> defines a type.
2 The type is
rsize_t
<a name="K.3.3" href="#K.3.3"><b> K.3.3 Common definitions <stddef.h></b></a>
1 The header <a href="#7.19"><stddef.h></a> defines a type.
2 The type is
rsize_t
<a name="K.3.4" href="#K.3.4"><b> K.3.4 Integer types <stdint.h></b></a>
1 The header <a href="#7.20"><stdint.h></a> defines a macro.
2 The macro is
RSIZE_MAX
<a name="K.3.4" href="#K.3.4"><b> K.3.4 Integer types <stdint.h></b></a>
1 The header <a href="#7.20"><stdint.h></a> defines a macro.
2 The macro is
RSIZE_MAX
some legitimate, but very large, objects. Implementations targeting machines with small
address spaces may wish to define RSIZE_MAX as SIZE_MAX, which means that there
some legitimate, but very large, objects. Implementations targeting machines with small
address spaces may wish to define RSIZE_MAX as SIZE_MAX, which means that there
with the values that might be found in errno. For example, a function which returns the value of
errno might be declared as having the return type errno_t.
with the values that might be found in errno. For example, a function which returns the value of
errno might be declared as having the return type errno_t.
- 372) See the description of the RSIZE_MAX macro in <a href="#7.20"><stdint.h></a>.
- 373) The macro RSIZE_MAX need not expand to a constant expression.
+ <sup><a name="note372" href="#note372"><b>372)</b></a></sup> See the description of the RSIZE_MAX macro in <a href="#7.20"><stdint.h></a>.
+ <sup><a name="note373" href="#note373"><b>373)</b></a></sup> The macro RSIZE_MAX need not expand to a constant expression.
maxsize shall be greater than the length of the generated file name string.
<b> Description</b>
3 The tmpnam_s function generates a string that is a valid file name and that is not the
maxsize shall be greater than the length of the generated file name string.
<b> Description</b>
3 The tmpnam_s function generates a string that is a valid file name and that is not the
TMP_MAX_S different strings, but any or all of them may already be in use by existing
files and thus not be suitable return values. The lengths of these strings shall be less than
the value of the L_tmpnam_s macro.
TMP_MAX_S different strings, but any or all of them may already be in use by existing
files and thus not be suitable return values. The lengths of these strings shall be less than
the value of the L_tmpnam_s macro.
their names should not collide with those generated by conventional naming rules for the
implementation. It is still necessary to use the remove function to remove such files when their use
is ended, and before program termination. Implementations should take care in choosing the patterns
their names should not collide with those generated by conventional naming rules for the
implementation. It is still necessary to use the remove function to remove such files when their use
is ended, and before program termination. Implementations should take care in choosing the patterns
[<a name="p583" href="#p583">page 583</a>] (<a href="#Contents">Contents</a>)
6 The implementation shall behave as if no library function except tmpnam calls the
[<a name="p583" href="#p583">page 583</a>] (<a href="#Contents">Contents</a>)
6 The implementation shall behave as if no library function except tmpnam calls the
Recommended practice
7 After a program obtains a file name using the tmpnam_s function and before the
program creates a file with that name, the possibility exists that someone else may create
Recommended practice
7 After a program obtains a file name using the tmpnam_s function and before the
program creates a file with that name, the possibility exists that someone else may create
convention for temporary files), but this is not required.
[<a name="p584" href="#p584">page 584</a>] (<a href="#Contents">Contents</a>)
convention for temporary files), but this is not required.
[<a name="p584" href="#p584">page 584</a>] (<a href="#Contents">Contents</a>)
underlying system supports it, the file shall have a file permission that prevents other
users on the system from accessing the file. If the file is being created and first character
of the mode string is 'u', then by the time the file has been closed, it shall have the
underlying system supports it, the file shall have a file permission that prevents other
users on the system from accessing the file. If the file is being created and first character
of the mode string is 'u', then by the time the file has been closed, it shall have the
8 If the file was opened successfully, then the pointer to FILE pointed to by streamptr
will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
8 If the file was opened successfully, then the pointer to FILE pointed to by streamptr
will be set to the pointer to the object controlling the opened file. Otherwise, the pointer
int fprintf_s(FILE * restrict stream,
const char * restrict format, ...);
Runtime-constraints
int fprintf_s(FILE * restrict stream,
const char * restrict format, ...);
Runtime-constraints
not by flags, field width, or precision) shall not appear in the string pointed to by
format. Any argument to fprintf_s corresponding to a %s specifier shall not be a
null pointer.
not by flags, field width, or precision) shall not appear in the string pointed to by
format. Any argument to fprintf_s corresponding to a %s specifier shall not be a
null pointer.
to produce further output, and it is unspecified to what extent fprintf_s produced
output before discovering the runtime-constraint violation.
<b> Description</b>
to produce further output, and it is unspecified to what extent fprintf_s produced
output before discovering the runtime-constraint violation.
<b> Description</b>
Runtime-constraints
2 Neither stream nor format shall be a null pointer. Any argument indirected though in
order to store converted input shall not be a null pointer.
Runtime-constraints
2 Neither stream nor format shall be a null pointer. Any argument indirected though in
order to store converted input shall not be a null pointer.
perform further input, and it is unspecified to what extent fscanf_s performed input
before discovering the runtime-constraint violation.
<b> Description</b>
perform further input, and it is unspecified to what extent fscanf_s performed input
before discovering the runtime-constraint violation.
<b> Description</b>
immediately followed in the argument list by the second argument, which has type
rsize_t and gives the number of elements in the array pointed to by the first argument
of the pair. If the first argument points to a scalar object, it is considered to be an array of
immediately followed in the argument list by the second argument, which has type
rsize_t and gives the number of elements in the array pointed to by the first argument
of the pair. If the first argument points to a scalar object, it is considered to be an array of
5 A matching failure occurs if the number of elements in a receiving object is insufficient to
hold the converted input (including any trailing null character).
<b> Returns</b>
6 The fscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
5 A matching failure occurs if the number of elements in a receiving object is insufficient to
hold the converted input (including any trailing null character).
<b> Returns</b>
6 The fscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
the format is not known at translation time. For example, an implementation may issue a diagnostic
used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
the format is not known at translation time. For example, an implementation may issue a diagnostic
#include <a href="#7.21"><stdio.h></a>
int printf_s(const char * restrict format, ...);
Runtime-constraints
#include <a href="#7.21"><stdio.h></a>
int printf_s(const char * restrict format, ...);
Runtime-constraints
width, or precision) shall not appear in the string pointed to by format. Any argument
to printf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the printf_s function does not attempt to
width, or precision) shall not appear in the string pointed to by format. Any argument
to printf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the printf_s function does not attempt to
const char * restrict format, ...);
Runtime-constraints
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
const char * restrict format, ...);
Runtime-constraints
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
- than RSIZE_MAX. The %n specifier382) (modified or not by flags, field width, or
+ than RSIZE_MAX. The %n specifier<sup><a href="#note382"><b>382)</b></a></sup> (modified or not by flags, field width, or
precision) shall not appear in the string pointed to by format. Any argument to
[<a name="p590" href="#p590">page 590</a>] (<a href="#Contents">Contents</a>)
precision) shall not appear in the string pointed to by format. Any argument to
[<a name="p590" href="#p590">page 590</a>] (<a href="#Contents">Contents</a>)
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of characters (including the trailing null) required for the
result to be written to the array pointed to by s shall not be greater than n. The %n
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of characters (including the trailing null) required for the
result to be written to the array pointed to by s shall not be greater than n. The %n
- specifier383) (modified or not by flags, field width, or precision) shall not appear in the
+ specifier<sup><a href="#note383"><b>383)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
string pointed to by format. Any argument to sprintf_s corresponding to a %s
specifier shall not be a null pointer. No encoding error shall occur.
string pointed to by format. Any argument to sprintf_s corresponding to a %s
specifier shall not be a null pointer. No encoding error shall occur.
not by flags, field width, or precision) shall not appear in the string pointed to by
format. Any argument to vfprintf_s corresponding to a %s specifier shall not be a
null pointer.
not by flags, field width, or precision) shall not appear in the string pointed to by
format. Any argument to vfprintf_s corresponding to a %s specifier shall not be a
null pointer.
4 The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfscanf_s function does not invoke the
4 The vfscanf_s function is equivalent to fscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfscanf_s function does not invoke the
<b> Returns</b>
5 The vfscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
<b> Returns</b>
5 The vfscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
width, or precision) shall not appear in the string pointed to by format. Any argument
to vprintf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the vprintf_s function does not attempt to
produce further output, and it is unspecified to what extent vprintf_s produced output
before discovering the runtime-constraint violation.
width, or precision) shall not appear in the string pointed to by format. Any argument
to vprintf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the vprintf_s function does not attempt to
produce further output, and it is unspecified to what extent vprintf_s produced output
before discovering the runtime-constraint violation.
- 385) As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
+ <sup><a name="note385" href="#note385"><b>385)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
4 The vscanf_s function is equivalent to scanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vscanf_s function does not invoke the
4 The vscanf_s function is equivalent to scanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vscanf_s function does not invoke the
<b> Returns</b>
5 The vscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
<b> Returns</b>
5 The vscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
- 387) As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
+ <sup><a name="note387" href="#note387"><b>387)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
- than RSIZE_MAX. The %n specifier388) (modified or not by flags, field width, or
+ than RSIZE_MAX. The %n specifier<sup><a href="#note388"><b>388)</b></a></sup> (modified or not by flags, field width, or
precision) shall not appear in the string pointed to by format. Any argument to
vsnprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
error shall occur.
precision) shall not appear in the string pointed to by format. Any argument to
vsnprintf_s corresponding to a %s specifier shall not be a null pointer. No encoding
error shall occur.
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of characters (including the trailing null) required for the
result to be written to the array pointed to by s shall not be greater than n. The %n
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of characters (including the trailing null) required for the
result to be written to the array pointed to by s shall not be greater than n. The %n
- specifier389) (modified or not by flags, field width, or precision) shall not appear in the
+ specifier<sup><a href="#note389"><b>389)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
string pointed to by format. Any argument to vsprintf_s corresponding to a %s
specifier shall not be a null pointer. No encoding error shall occur.
3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
string pointed to by format. Any argument to vsprintf_s corresponding to a %s
specifier shall not be a null pointer. No encoding error shall occur.
3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
4 The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vsscanf_s function does not invoke the
4 The vsscanf_s function is equivalent to sscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vsscanf_s function does not invoke the
<b> Returns</b>
5 The vsscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
<b> Returns</b>
5 The vsscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
- 390) As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
+ <sup><a name="note390" href="#note390"><b>390)</b></a></sup> As the functions vfprintf_s, vfscanf_s, vprintf_s, vscanf_s, vsnprintf_s,
Runtime-constraints
2 s shall not be a null pointer. n shall neither be equal to zero nor be greater than
RSIZE_MAX. A new-line character, end-of-file, or read error shall occur within reading
Runtime-constraints
2 s shall not be a null pointer. n shall neither be equal to zero nor be greater than
RSIZE_MAX. A new-line character, end-of-file, or read error shall occur within reading
3 If there is a runtime-constraint violation, s[0] is set to the null character, and characters
are read and discarded from stdin until a new-line character is read, or end-of-file or a
read error occurs.
3 If there is a runtime-constraint violation, s[0] is set to the null character, and characters
are read and discarded from stdin until a new-line character is read, or end-of-file or a
read error occurs.
- 391) The gets_s function, unlike the historical gets function, makes it a runtime-constraint violation for
+ <sup><a name="note391" href="#note391"><b>391)</b></a></sup> The gets_s function, unlike the historical gets function, makes it a runtime-constraint violation for
a line of input to overflow the buffer to store it. Unlike the fgets function, gets_s maintains a
one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets
expect such a relationship.
a line of input to overflow the buffer to store it. Unlike the fgets function, gets_s maintains a
one-to-one relationship between input lines and successful calls to gets_s. Programs that use gets
expect such a relationship.
implementation default handler becomes the current constraint handler.
<b> Returns</b>
6 The set_constraint_handler_s function returns a pointer to the previously
implementation default handler becomes the current constraint handler.
<b> Returns</b>
6 The set_constraint_handler_s function returns a pointer to the previously
<a name="K.3.6.1.2" href="#K.3.6.1.2"><b> K.3.6.1.2 The abort_handler_s function</b></a>
<b> Synopsis</b>
1 #define __STDC_WANT_LIB_EXT1__ 1
<a name="K.3.6.1.2" href="#K.3.6.1.2"><b> K.3.6.1.2 The abort_handler_s function</b></a>
<b> Synopsis</b>
1 #define __STDC_WANT_LIB_EXT1__ 1
set_constraint_handler_s function.
3 The abort_handler_s function writes a message on the standard error stream in an
implementation-defined format. The message shall include the string pointed to by msg.
set_constraint_handler_s function.
3 The abort_handler_s function writes a message on the standard error stream in an
implementation-defined format. The message shall include the string pointed to by msg.
<b> Description</b>
2 A pointer to the ignore_handler_s function shall be a suitable argument to the
set_constraint_handler_s function.
<b> Description</b>
2 A pointer to the ignore_handler_s function shall be a suitable argument to the
set_constraint_handler_s function.
<b> Returns</b>
4 The ignore_handler_s function returns no value.
<a name="K.3.6.2" href="#K.3.6.2"><b> K.3.6.2 Communication with the environment</b></a>
<b> Returns</b>
4 The ignore_handler_s function returns no value.
<a name="K.3.6.2" href="#K.3.6.2"><b> K.3.6.2 Communication with the environment</b></a>
which a runtime-constraint violation occurs will return to its caller. The caller can determine whether
a runtime-constraint violation occurred based on the library function's specification (usually, the
library function returns a nonzero errno_t).
which a runtime-constraint violation occurs will return to its caller. The caller can determine whether
a runtime-constraint violation occurred based on the library function's specification (usually, the
library function returns a nonzero errno_t).
rearrangement, and the pointer to the array may be null.
2 The implementation shall ensure that the second argument of the comparison function
(when called from bsearch_s), or both arguments (when called from qsort_s), are
rearrangement, and the pointer to the array may be null.
2 The implementation shall ensure that the second argument of the comparison function
(when called from bsearch_s), or both arguments (when called from qsort_s), are
shall equal key.
3 The comparison function shall not alter the contents of either the array or search key. The
implementation may reorder elements of the array between calls to the comparison
shall equal key.
3 The comparison function shall not alter the contents of either the array or search key. The
implementation may reorder elements of the array between calls to the comparison
- 395) That is, if the value passed is p, then the following expressions are always valid and nonzero:
+ <sup><a name="note395" href="#note395"><b>395)</b></a></sup> That is, if the value passed is p, then the following expressions are always valid and nonzero:
((char *)p - (char *)base) % size == 0
(char *)p >= (char *)base
(char *)p < (char *)base + nmemb * size
((char *)p - (char *)base) % size == 0
(char *)p >= (char *)base
(char *)p < (char *)base + nmemb * size
return an integer less than, equal to, or greater than zero if the key object is considered,
respectively, to be less than, to match, or to be greater than the array element. The array
shall consist of: all the elements that compare less than, all the elements that compare
return an integer less than, equal to, or greater than zero if the key object is considered,
respectively, to be less than, to match, or to be greater than the array element. The array
shall consist of: all the elements that compare less than, all the elements that compare
- equal to, and all the elements that compare greater than the key object, in that order.396)
+ equal to, and all the elements that compare greater than the key object, in that order.<sup><a href="#note396"><b>396)</b></a></sup>
The third argument to the comparison function is the context argument passed to
bsearch_s. The sole use of context by bsearch_s is to pass it to the comparison
The third argument to the comparison function is the context argument passed to
bsearch_s. The sole use of context by bsearch_s is to pass it to the comparison
- 396) In practice, this means that the entire array has been sorted according to the comparison function.
- 397) The context argument is for the use of the comparison function in performing its duties. For
+ <sup><a name="note396" href="#note396"><b>396)</b></a></sup> In practice, this means that the entire array has been sorted according to the comparison function.
+ <sup><a name="note397" href="#note397"><b>397)</b></a></sup> The context argument is for the use of the comparison function in performing its duties. For
example, it might specify a collating sequence used by the comparison function.
[<a name="p604" href="#p604">page 604</a>] (<a href="#Contents">Contents</a>)
example, it might specify a collating sequence used by the comparison function.
[<a name="p604" href="#p604">page 604</a>] (<a href="#Contents">Contents</a>)
to, or greater than zero if the first argument is considered to be respectively less than,
equal to, or greater than the second. The third argument to the comparison function is the
context argument passed to qsort_s. The sole use of context by qsort_s is to
to, or greater than zero if the first argument is considered to be respectively less than,
equal to, or greater than the second. The third argument to the comparison function is the
context argument passed to qsort_s. The sole use of context by qsort_s is to
example, it might specify a collating sequence used by the comparison function.
[<a name="p605" href="#p605">page 605</a>] (<a href="#Contents">Contents</a>)
example, it might specify a collating sequence used by the comparison function.
[<a name="p605" href="#p605">page 605</a>] (<a href="#Contents">Contents</a>)
pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
state of the function to be altered as necessary. A call with s as a null pointer causes
these functions to set the int pointed to by their status argument to a nonzero value if
pointer. Subsequent calls with s as other than a null pointer cause the internal conversion
state of the function to be altered as necessary. A call with s as a null pointer causes
these functions to set the int pointed to by their status argument to a nonzero value if
category causes the conversion state of these functions to be indeterminate.
<a name="K.3.6.4.1" href="#K.3.6.4.1"><b> K.3.6.4.1 The wctomb_s function</b></a>
<b> Synopsis</b>
category causes the conversion state of these functions to be indeterminate.
<a name="K.3.6.4.1" href="#K.3.6.4.1"><b> K.3.6.4.1 The wctomb_s function</b></a>
<b> Synopsis</b>
character codes, but are grouped with an adjacent multibyte character.
[<a name="p606" href="#p606">page 606</a>] (<a href="#Contents">Contents</a>)
character codes, but are grouped with an adjacent multibyte character.
[<a name="p606" href="#p606">page 606</a>] (<a href="#Contents">Contents</a>)
bytes is encountered that does not form a valid multibyte character, or (if dst is not a
null pointer) when len wide characters have been stored into the array pointed to by
bytes is encountered that does not form a valid multibyte character, or (if dst is not a
null pointer) when len wide characters have been stored into the array pointed to by
pointed to by dst, then dst[len] is set to the null wide character. Each conversion
takes place as if by a call to the mbrtowc function.
5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
pointed to by dst, then dst[len] is set to the null wide character. Each conversion
takes place as if by a call to the mbrtowc function.
5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
characters successfully converted, not including the terminating null character (if any).
6 All elements following the terminating null wide character (if any) written by
mbstowcs_s in the array of dstmax wide characters pointed to by dst take
characters successfully converted, not including the terminating null character (if any).
6 All elements following the terminating null wide character (if any) written by
mbstowcs_s in the array of dstmax wide characters pointed to by dst take
- 400) Thus, the value of len is ignored if dst is a null pointer.
- 401) This allows an implementation to attempt converting the multibyte string before discovering a
+ <sup><a name="note400" href="#note400"><b>400)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
+ <sup><a name="note401" href="#note401"><b>401)</b></a></sup> This allows an implementation to attempt converting the multibyte string before discovering a
terminating null character did not occur where required.
[<a name="p608" href="#p608">page 608</a>] (<a href="#Contents">Contents</a>)
terminating null character did not occur where required.
[<a name="p608" href="#p608">page 608</a>] (<a href="#Contents">Contents</a>)
If the conversion stops without converting a null wide character and dst is not a null
pointer, then a null character is stored into the array pointed to by dst immediately
following any multibyte characters already stored. Each conversion takes place as if by a
If the conversion stops without converting a null wide character and dst is not a null
pointer, then a null character is stored into the array pointed to by dst immediately
following any multibyte characters already stored. Each conversion takes place as if by a
5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
wide character that does not correspond to a valid multibyte character, an encoding error
occurs: the wcstombs_s function stores the value (size_t)(-1) into *retval.
5 Regardless of whether dst is or is not a null pointer, if the input conversion encounters a
wide character that does not correspond to a valid multibyte character, an encoding error
occurs: the wcstombs_s function stores the value (size_t)(-1) into *retval.
any).
6 All elements following the terminating null character (if any) written by wcstombs_s
in the array of dstmax elements pointed to by dst take unspecified values when
any).
6 All elements following the terminating null character (if any) written by wcstombs_s
in the array of dstmax elements pointed to by dst take unspecified values when
include those necessary to reach the initial shift state immediately before the null byte. However, if
the conversion stops before a terminating null wide character has been reached, the result will be null
terminated, but might not end in the initial shift state.
include those necessary to reach the initial shift state immediately before the null byte. However, if
the conversion stops before a terminating null wide character has been reached, the result will be null
terminated, but might not end in the initial shift state.
runtime-constraint violation.
[<a name="p609" href="#p609">page 609</a>] (<a href="#Contents">Contents</a>)
runtime-constraint violation.
[<a name="p609" href="#p609">page 609</a>] (<a href="#Contents">Contents</a>)
null character) into the array pointed to by s1.
5 All elements following the terminating null character (if any) written by strcpy_s in
the array of s1max characters pointed to by s1 take unspecified values when
null character) into the array pointed to by s1.
5 All elements following the terminating null character (if any) written by strcpy_s in
the array of s1max characters pointed to by s1 take unspecified values when
Otherwise, a nonzero value is returned.
<a name="K.3.7.1.4" href="#K.3.7.1.4"><b> K.3.7.1.4 The strncpy_s function</b></a>
<b> Synopsis</b>
Otherwise, a nonzero value is returned.
<a name="K.3.7.1.4" href="#K.3.7.1.4"><b> K.3.7.1.4 The strncpy_s function</b></a>
<b> Synopsis</b>
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p612" href="#p612">page 612</a>] (<a href="#Contents">Contents</a>)
5 All elements following the terminating null character (if any) written by strncpy_s in
the array of s1max characters pointed to by s1 take unspecified values when
within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p612" href="#p612">page 612</a>] (<a href="#Contents">Contents</a>)
5 All elements following the terminating null character (if any) written by strncpy_s in
the array of s1max characters pointed to by s1 take unspecified values when
Otherwise, a nonzero value is returned.
7 EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result
will not be null terminated or that characters will be written past the end of the destination array.
Otherwise, a nonzero value is returned.
7 EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result
will not be null terminated or that characters will be written past the end of the destination array.
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p613" href="#p613">page 613</a>] (<a href="#Contents">Contents</a>)
3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p613" href="#p613">page 613</a>] (<a href="#Contents">Contents</a>)
3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
strnlen_s(s2, m). Copying shall not take place between objects that overlap.
4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the
strnlen_s(s2, m). Copying shall not take place between objects that overlap.
4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is
greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the
from s2 overwrites the null character at the end of s1.
6 All elements following the terminating null character (if any) written by strcat_s in
the array of s1max characters pointed to by s1 take unspecified values when
from s2 overwrites the null character at the end of s1.
6 All elements following the terminating null character (if any) written by strcat_s in
the array of s1max characters pointed to by s1 take unspecified values when
Otherwise, a nonzero value is returned.
<a name="K.3.7.2.2" href="#K.3.7.2.2"><b> K.3.7.2.2 The strncat_s function</b></a>
<b> Synopsis</b>
Otherwise, a nonzero value is returned.
<a name="K.3.7.2.2" href="#K.3.7.2.2"><b> K.3.7.2.2 The strncat_s function</b></a>
<b> Synopsis</b>
2 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
strncat_s.
3 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
2 Let m denote the value s1max - strnlen_s(s1, s1max) upon entry to
strncat_s.
3 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
- 408) Zero means that s1 was not null terminated upon entry to strcat_s.
- 409) This allows an implementation to append characters from s2 to s1 while simultaneously checking if
+ <sup><a name="note408" href="#note408"><b>408)</b></a></sup> Zero means that s1 was not null terminated upon entry to strcat_s.
+ <sup><a name="note409" href="#note409"><b>409)</b></a></sup> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
appended to the string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p614" href="#p614">page 614</a>] (<a href="#Contents">Contents</a>)
appended to the string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p614" href="#p614">page 614</a>] (<a href="#Contents">Contents</a>)
a null character.
6 All elements following the terminating null character (if any) written by strncat_s in
the array of s1max characters pointed to by s1 take unspecified values when
a null character.
6 All elements following the terminating null character (if any) written by strncat_s in
the array of s1max characters pointed to by s1 take unspecified values when
Otherwise, a nonzero value is returned.
8 EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result
will not be null terminated or that characters will be written past the end of the destination array.
Otherwise, a nonzero value is returned.
8 EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result
will not be null terminated or that characters will be written past the end of the destination array.
- 411) Zero means that s1 was not null terminated upon entry to strncat_s.
- 412) This allows an implementation to append characters from s2 to s1 while simultaneously checking if
+ <sup><a name="note411" href="#note411"><b>411)</b></a></sup> Zero means that s1 was not null terminated upon entry to strncat_s.
+ <sup><a name="note412" href="#note412"><b>412)</b></a></sup> This allows an implementation to append characters from s2 to s1 while simultaneously checking if
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
any of those characters are null. Such an approach might write a character to every element of s1
before discovering that the first element should be set to the null character.
appended to the string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p615" href="#p615">page 615</a>] (<a href="#Contents">Contents</a>)
appended to the string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p615" href="#p615">page 615</a>] (<a href="#Contents">Contents</a>)
4 Otherwise, the strnlen_s function returns the number of characters that precede the
terminating null character. If there is no null character in the first maxsize characters of
s then strnlen_s returns maxsize. At most the first maxsize characters of s shall
4 Otherwise, the strnlen_s function returns the number of characters that precede the
terminating null character. If there is no null character in the first maxsize characters of
s then strnlen_s returns maxsize. At most the first maxsize characters of s shall
along with the values returned for a null pointer or an unterminated string argument make
strnlen_s useful in algorithms that gracefully handle such exceptional data.
along with the values returned for a null pointer or an unterminated string argument make
strnlen_s useful in algorithms that gracefully handle such exceptional data.
which is the type size_t.
<a name="K.3.8.1" href="#K.3.8.1"><b> K.3.8.1 Components of time</b></a>
1 A broken-down time is normalized if the values of the members of the tm structure are in
which is the type size_t.
<a name="K.3.8.1" href="#K.3.8.1"><b> K.3.8.1 Components of time</b></a>
1 A broken-down time is normalized if the values of the members of the tm structure are in
<a name="K.3.8.2" href="#K.3.8.2"><b> K.3.8.2 Time conversion functions</b></a>
1 Like the strftime function, the asctime_s and ctime_s functions do not return a
pointer to a static object, and other library functions are permitted to call them.
<a name="K.3.8.2" href="#K.3.8.2"><b> K.3.8.2 Time conversion functions</b></a>
1 Like the strftime function, the asctime_s and ctime_s functions do not return a
pointer to a static object, and other library functions are permitted to call them.
int fwprintf_s(FILE * restrict stream,
const wchar_t * restrict format, ...);
Runtime-constraints
int fwprintf_s(FILE * restrict stream,
const wchar_t * restrict format, ...);
Runtime-constraints
not by flags, field width, or precision) shall not appear in the wide string pointed to by
format. Any argument to fwprintf_s corresponding to a %s specifier shall not be a
null pointer.
not by flags, field width, or precision) shall not appear in the wide string pointed to by
format. Any argument to fwprintf_s corresponding to a %s specifier shall not be a
null pointer.
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
argument is immediately followed in the argument list by the second argument, which has
type size_t and gives the number of elements in the array pointed to by the first
argument of the pair. If the first argument points to a scalar object, it is considered to be
argument is immediately followed in the argument list by the second argument, which has
type size_t and gives the number of elements in the array pointed to by the first
argument of the pair. If the first argument points to a scalar object, it is considered to be
5 A matching failure occurs if the number of elements in a receiving object is insufficient to
hold the converted input (including any trailing null character).
<b> Returns</b>
5 A matching failure occurs if the number of elements in a receiving object is insufficient to
hold the converted input (including any trailing null character).
<b> Returns</b>
const wchar_t * restrict format, ...);
Runtime-constraints
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
const wchar_t * restrict format, ...);
Runtime-constraints
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
- than RSIZE_MAX. The %n specifier418) (modified or not by flags, field width, or
+ than RSIZE_MAX. The %n specifier<sup><a href="#note418"><b>418)</b></a></sup> (modified or not by flags, field width, or
used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
the format is not known at translation time. For example, an implementation may issue a diagnostic
used to store the result from a c, s, or [ conversion specifier if that argument is not followed by an
argument of a type compatible with rsize_t. A limited amount of checking may be done if even if
the format is not known at translation time. For example, an implementation may issue a diagnostic
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of wide characters (including the trailing null) required
for the result to be written to the array pointed to by s shall not be greater than n. The %n
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of wide characters (including the trailing null) required
for the result to be written to the array pointed to by s shall not be greater than n. The %n
- specifier419) (modified or not by flags, field width, or precision) shall not appear in the
+ specifier<sup><a href="#note419"><b>419)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
wide string pointed to by format. Any argument to swprintf_s corresponding to a
%s specifier shall not be a null pointer. No encoding error shall occur.
wide string pointed to by format. Any argument to swprintf_s corresponding to a
%s specifier shall not be a null pointer. No encoding error shall occur.
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
not by flags, field width, or precision) shall not appear in the wide string pointed to by
format. Any argument to vfwprintf_s corresponding to a %s specifier shall not be
a null pointer.
not by flags, field width, or precision) shall not appear in the wide string pointed to by
format. Any argument to vfwprintf_s corresponding to a %s specifier shall not be
a null pointer.
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
4 The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument
list replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the
4 The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument
list replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the
<b> Returns</b>
5 The vfwscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
<b> Returns</b>
5 The vfwscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
- than RSIZE_MAX. The %n specifier422) (modified or not by flags, field width, or
+ than RSIZE_MAX. The %n specifier<sup><a href="#note422"><b>422)</b></a></sup> (modified or not by flags, field width, or
precision) shall not appear in the wide string pointed to by format. Any argument to
vsnwprintf_s corresponding to a %s specifier shall not be a null pointer. No
encoding error shall occur.
precision) shall not appear in the wide string pointed to by format. Any argument to
vsnwprintf_s corresponding to a %s specifier shall not be a null pointer. No
encoding error shall occur.
- 421) As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
+ <sup><a name="note421" href="#note421"><b>421)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of wide characters (including the trailing null) required
for the result to be written to the array pointed to by s shall not be greater than n. The %n
2 Neither s nor format shall be a null pointer. n shall neither equal zero nor be greater
than RSIZE_MAX. The number of wide characters (including the trailing null) required
for the result to be written to the array pointed to by s shall not be greater than n. The %n
- specifier423) (modified or not by flags, field width, or precision) shall not appear in the
+ specifier<sup><a href="#note423"><b>423)</b></a></sup> (modified or not by flags, field width, or precision) shall not appear in the
wide string pointed to by format. Any argument to vswprintf_s corresponding to a
%s specifier shall not be a null pointer. No encoding error shall occur.
3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
than zero and less than RSIZE_MAX, then the vswprintf_s function sets s[0] to the
null wide character.
wide string pointed to by format. Any argument to vswprintf_s corresponding to a
%s specifier shall not be a null pointer. No encoding error shall occur.
3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater
than zero and less than RSIZE_MAX, then the vswprintf_s function sets s[0] to the
null wide character.
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
4 The vswscanf_s function is equivalent to swscanf_s, with the variable argument
list replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vswscanf_s function does not invoke the
4 The vswscanf_s function is equivalent to swscanf_s, with the variable argument
list replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vswscanf_s function does not invoke the
- 424) As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
+ <sup><a name="note424" href="#note424"><b>424)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
value of arg after the return is indeterminate.
[<a name="p631" href="#p631">page 631</a>] (<a href="#Contents">Contents</a>)
value of arg after the return is indeterminate.
[<a name="p631" href="#p631">page 631</a>] (<a href="#Contents">Contents</a>)
width, or precision) shall not appear in the wide string pointed to by format. Any
argument to vwprintf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the vwprintf_s function does not attempt to
width, or precision) shall not appear in the wide string pointed to by format. Any
argument to vwprintf_s corresponding to a %s specifier shall not be a null pointer.
3 If there is a runtime-constraint violation, the vwprintf_s function does not attempt to
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
4 The vwscanf_s function is equivalent to wscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vwscanf_s function does not invoke the
4 The vwscanf_s function is equivalent to wscanf_s, with the variable argument list
replaced by arg, which shall have been initialized by the va_start macro (and
possibly subsequent va_arg calls). The vwscanf_s function does not invoke the
<b> Returns</b>
5 The vwscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
<b> Returns</b>
5 The vwscanf_s function returns the value of the macro EOF if an input failure occurs
before any conversion or if there is a runtime-constraint violation. Otherwise, the
#include <a href="#7.28"><wchar.h></a>
int wprintf_s(const wchar_t * restrict format, ...);
Runtime-constraints
#include <a href="#7.28"><wchar.h></a>
int wprintf_s(const wchar_t * restrict format, ...);
Runtime-constraints
- 426) As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
+ <sup><a name="note426" href="#note426"><b>426)</b></a></sup> As the functions vfwscanf_s, vwscanf_s, and vswscanf_s invoke the va_arg macro, the
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
string pointed at by format when those wide characters are not a interpreted as a %n specifier. For
example, if the entire format string was L"%%n".
terminating null wide character) into the array pointed to by s1.
5 All elements following the terminating null wide character (if any) written by
wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified
terminating null wide character) into the array pointed to by s1.
5 All elements following the terminating null wide character (if any) written by
wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified
if any of those wide characters are null. Such an approach might write a wide character to every
element of s1 before discovering that the first element should be set to the null wide character.
if any of those wide characters are null. Such an approach might write a wide character to every
element of s1 before discovering that the first element should be set to the null wide character.
fit within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p635" href="#p635">page 635</a>] (<a href="#Contents">Contents</a>)
fit within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p635" href="#p635">page 635</a>] (<a href="#Contents">Contents</a>)
s1[n] is set to a null wide character.
11 All elements following the terminating null wide character (if any) written by
wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified
s1[n] is set to a null wide character.
11 All elements following the terminating null wide character (if any) written by
wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified
Otherwise, a nonzero value is returned.
13 EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the
result will not be null terminated or that wide characters will be written past the end of the destination
Otherwise, a nonzero value is returned.
13 EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the
result will not be null terminated or that wide characters will be written past the end of the destination
if any of those wide characters are null. Such an approach might write a wide character to every
element of s1 before discovering that the first element should be set to the null wide character.
if any of those wide characters are null. Such an approach might write a wide character to every
element of s1 before discovering that the first element should be set to the null wide character.
fit within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p636" href="#p636">page 636</a>] (<a href="#Contents">Contents</a>)
fit within the array pointed to by s1 and that the result in s1 is null terminated.
[<a name="p636" href="#p636">page 636</a>] (<a href="#Contents">Contents</a>)
2 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
wcscat_s.
3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
2 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
wcscat_s.
3 Neither s1 nor s2 shall be a null pointer. s1max shall not be greater than RSIZE_MAX.
wcsnlen_s(s2, m). Copying shall not take place between objects that overlap.
[<a name="p638" href="#p638">page 638</a>] (<a href="#Contents">Contents</a>)
wcsnlen_s(s2, m). Copying shall not take place between objects that overlap.
[<a name="p638" href="#p638">page 638</a>] (<a href="#Contents">Contents</a>)
initial wide character from s2 overwrites the null wide character at the end of s1.
6 All elements following the terminating null wide character (if any) written by
wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified
initial wide character from s2 overwrites the null wide character at the end of s1.
6 All elements following the terminating null wide character (if any) written by
wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified
Otherwise, a nonzero value is returned.
<a name="K.3.9.2.2.2" href="#K.3.9.2.2.2"><b> K.3.9.2.2.2 The wcsncat_s function</b></a>
<b> Synopsis</b>
Otherwise, a nonzero value is returned.
<a name="K.3.9.2.2.2" href="#K.3.9.2.2.2"><b> K.3.9.2.2.2 The wcsncat_s function</b></a>
<b> Synopsis</b>
9 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
wcsncat_s.
10 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
9 Let m denote the value s1max - wcsnlen_s(s1, s1max) upon entry to
wcsncat_s.
10 Neither s1 nor s2 shall be a null pointer. Neither s1max nor n shall be greater than
than m, then m shall be greater than wcsnlen_s(s2, m). Copying shall not take
place between objects that overlap.
than m, then m shall be greater than wcsnlen_s(s2, m). Copying shall not take
place between objects that overlap.
- 432) Zero means that s1 was not null terminated upon entry to wcscat_s.
- 433) This allows an implementation to append wide characters from s2 to s1 while simultaneously
+ <sup><a name="note432" href="#note432"><b>432)</b></a></sup> Zero means that s1 was not null terminated upon entry to wcscat_s.
+ <sup><a name="note433" href="#note433"><b>433)</b></a></sup> This allows an implementation to append wide characters from s2 to s1 while simultaneously
checking if any of those wide characters are null. Such an approach might write a wide character to
every element of s1 before discovering that the first element should be set to the null wide character.
checking if any of those wide characters are null. Such an approach might write a wide character to
every element of s1 before discovering that the first element should be set to the null wide character.
from s2, then s1[s1max-m+n] is set to a null wide character.
13 All elements following the terminating null wide character (if any) written by
wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified
from s2, then s1[s1max-m+n] is set to a null wide character.
13 All elements following the terminating null wide character (if any) written by
wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified
Otherwise, a nonzero value is returned.
15 EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the
result will not be null terminated or that wide characters will be written past the end of the destination
Otherwise, a nonzero value is returned.
15 EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the
result will not be null terminated or that wide characters will be written past the end of the destination
checking if any of those wide characters are null. Such an approach might write a wide character to
every element of s1 before discovering that the first element should be set to the null wide character.
checking if any of those wide characters are null. Such an approach might write a wide character to
every element of s1 before discovering that the first element should be set to the null wide character.
s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p640" href="#p640">page 640</a>] (<a href="#Contents">Contents</a>)
s2 were appended to the wide string pointed to by s1 and that the result in s1 is null terminated.
[<a name="p640" href="#p640">page 640</a>] (<a href="#Contents">Contents</a>)
4 Otherwise, the wcsnlen_s function returns the number of wide characters that precede
the terminating null wide character. If there is no null wide character in the first
maxsize wide characters of s then wcsnlen_s returns maxsize. At most the first
4 Otherwise, the wcsnlen_s function returns the number of wide characters that precede
the terminating null wide character. If there is no null wide character in the first
maxsize wide characters of s then wcsnlen_s returns maxsize. At most the first
along with the values returned for a null pointer or an unterminated wide string argument make
wcsnlen_s useful in algorithms that gracefully handle such exceptional data.
along with the values returned for a null pointer or an unterminated wide string argument make
wcsnlen_s useful in algorithms that gracefully handle such exceptional data.
not form a valid multibyte character, or (if dst is not a null pointer) when len wide
[<a name="p644" href="#p644">page 644</a>] (<a href="#Contents">Contents</a>)
not form a valid multibyte character, or (if dst is not a null pointer) when len wide
[<a name="p644" href="#p644">page 644</a>] (<a href="#Contents">Contents</a>)
pointer and no null wide character was stored into the array pointed to by dst, then
dst[len] is set to the null wide character. Each conversion takes place as if by a call
to the mbrtowc function.
pointer and no null wide character was stored into the array pointed to by dst, then
dst[len] is set to the null wide character. Each conversion takes place as if by a call
to the mbrtowc function.
terminating null character (if any).
8 All elements following the terminating null wide character (if any) written by
mbsrtowcs_s in the array of dstmax wide characters pointed to by dst take
terminating null character (if any).
8 All elements following the terminating null wide character (if any) written by
mbsrtowcs_s in the array of dstmax wide characters pointed to by dst take
- 439) Thus, the value of len is ignored if dst is a null pointer.
- 440) This allows an implementation to attempt converting the multibyte string before discovering a
+ <sup><a name="note439" href="#note439"><b>439)</b></a></sup> Thus, the value of len is ignored if dst is a null pointer.
+ <sup><a name="note440" href="#note440"><b>440)</b></a></sup> This allows an implementation to attempt converting the multibyte string before discovering a
terminating null character did not occur where required.
[<a name="p645" href="#p645">page 645</a>] (<a href="#Contents">Contents</a>)
terminating null character did not occur where required.
[<a name="p645" href="#p645">page 645</a>] (<a href="#Contents">Contents</a>)
If the conversion stops without converting a null wide character and dst is not a null
pointer, then a null character is stored into the array pointed to by dst immediately
following any multibyte characters already stored. Each conversion takes place as if by a
If the conversion stops without converting a null wide character and dst is not a null
pointer, then a null character is stored into the array pointed to by dst immediately
following any multibyte characters already stored. Each conversion takes place as if by a
15 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null wide character) or the
address just past the last wide character converted (if any). If conversion stopped due to
15 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null
pointer (if conversion stopped due to reaching a terminating null wide character) or the
address just past the last wide character converted (if any). If conversion stopped due to
include those necessary to reach the initial shift state immediately before the null byte. However, if
the conversion stops before a terminating null wide character has been reached, the result will be null
terminated, but might not end in the initial shift state.
include those necessary to reach the initial shift state immediately before the null byte. However, if
the conversion stops before a terminating null wide character has been reached, the result will be null
terminated, but might not end in the initial shift state.
including the terminating null character (if any).
17 All elements following the terminating null character (if any) written by wcsrtombs_s
in the array of dstmax elements pointed to by dst take unspecified values when
including the terminating null character (if any).
17 All elements following the terminating null character (if any) written by wcsrtombs_s
in the array of dstmax elements pointed to by dst take unspecified values when
runtime-constraint violation.
[<a name="p647" href="#p647">page 647</a>] (<a href="#Contents">Contents</a>)
runtime-constraint violation.
[<a name="p647" href="#p647">page 647</a>] (<a href="#Contents">Contents</a>)
<a name="L.1" href="#L.1"><b> L.1 Scope</b></a>
1 This annex specifies optional behavior that can aid in the analyzability of C programs.
2 An implementation that defines __STDC_ANALYZABLE__ shall conform to the
<a name="L.1" href="#L.1"><b> L.1 Scope</b></a>
1 This annex specifies optional behavior that can aid in the analyzability of C programs.
2 An implementation that defines __STDC_ANALYZABLE__ shall conform to the
<a name="L.2" href="#L.2"><b> L.2 Definitions</b></a>
<a name="L.2.1" href="#L.2.1"><b> L.2.1</b></a>
1 out-of-bounds store
<a name="L.2" href="#L.2"><b> L.2 Definitions</b></a>
<a name="L.2.1" href="#L.2.1"><b> L.2.1</b></a>
1 out-of-bounds store