X-Git-Url: http://nsz.repo.hu/git/?p=c-standard;a=blobdiff_plain;f=n1256.html;h=ffaafbbf3e8a9f7d86bc080ec8d9b536b9fb9c14;hp=7c91502936067b16eb6bdcd67753f98a4acc74a8;hb=7580b254a0869cd01093b0b60f1ee65d573c4999;hpb=1f14f5cb499d0c6d6927c643f6b20d8792a31bd9 diff --git a/n1256.html b/n1256.html index 7c91502..ffaafbb 100644 --- a/n1256.html +++ b/n1256.html @@ -548,9 +548,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
1) This International Standard is designed to promote the portability of C programs among a variety of +
1) This International Standard is designed to promote the portability of C programs among a variety of
data-processing systems. It is intended for use by implementors and programmers.
-
+
2. Normative references
@@ -879,7 +879,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
2) A strictly conforming program can use conditional features (such as those in annex F) provided the +
2) A strictly conforming program can use conditional features (such as those in annex F) provided the
use is guarded by a #ifdef directive with the appropriate macro. For example:
@@ -889,14 +889,14 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
/* ... */
#endif
-
-
3) This implies that a conforming implementation reserves no identifiers other than those explicitly + +
3) This implies that a conforming implementation reserves no identifiers other than those explicitly reserved in this International Standard. - -
4) Strictly conforming programs are intended to be maximally portable among conforming + +
4) Strictly conforming programs are intended to be maximally portable among conforming
implementations. Conforming programs may depend upon nonportable features of a conforming
implementation.
-
+
5. Environment
@@ -979,18 +979,18 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
5) Implementations shall behave as if these separate phases occur, even though many are typically folded +
5) Implementations shall behave as if these separate phases occur, even though many are typically folded 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 particular implementation. - -
6) As described in 6.4, the process of dividing a source file's characters into preprocessing tokens is + +
6) As described in 6.4, the process of dividing a source file's characters into preprocessing tokens is context-dependent. For example, see the handling of < within a #include preprocessing directive. - -
7) An implementation need not convert all non-corresponding source characters to the same execution + +
7) An implementation need not convert all non-corresponding source characters to the same execution
character.
-
+
5.1.1.3 Diagnostics
@@ -1009,10 +1009,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
8) The intent is that an implementation should identify the nature of, and where possible localize, each +
8) 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.
-
+
5.1.2 Execution environments
@@ -1080,9 +1080,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as +
9) Thus, int can be replaced by a typedef name defined as int, or the type of argv can be written as
char ** argv, and so on.
-
+
5.1.2.2.2 Program execution
@@ -1103,9 +1103,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: definition of terms (7.1.1), the exit function (7.20.4.3).
10) In accordance with 6.2.4, the lifetimes of objects with automatic storage duration declared in main +
10) In accordance with 6.2.4, the lifetimes of objects with automatic storage duration declared in main
will have ended in the former case, even where they would not have in the latter.
-
+
5.1.2.3 Program execution
@@ -1264,13 +1264,13 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
11) The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status +
11) The IEC 60559 standard for binary floating-point arithmetic requires certain user-accessible status
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 annex F for details. The floating-point
environment library <fenv.h> provides a programming facility for indicating when these side
effects matter, freeing the implementations in other cases.
-
+
5.2 Environmental considerations
@@ -1355,9 +1355,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
12) The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as +
12) The trigraph sequences enable the input of characters that are not defined in the Invariant Code Set as
described in ISO/IEC 646, which is a subset of the seven-bit US ASCII code set.
-
+
5.2.1.2 Multibyte characters
@@ -1485,10 +1485,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
13) Implementations should avoid imposing fixed translation limits whenever possible. - -
14) See ''future language directions'' (6.11.3). - +
13) Implementations should avoid imposing fixed translation limits whenever possible. + +
14) See ''future language directions'' (6.11.3).
+
5.2.4.2 Numerical limits
@@ -1558,8 +1558,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: representations of types (6.2.6), conditional inclusion (6.10.1).
15) See 6.2.5.
+
5.2.4.2.2 Characteristics of floating types
@@ -1810,24 +1810,24 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
16) The floating-point model is intended to clarify the description of each floating-point characteristic and +
16) The floating-point model is intended to clarify the description of each floating-point characteristic and does not require the floating-point arithmetic of the implementation to be identical. - -
17) IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support + +
17) IEC 60559:1989 specifies quiet and signaling NaNs. For implementations that do not support IEC 60559:1989, the terms quiet NaN and signaling NaN are intended to apply to encodings with similar behavior. - -
18) Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through + +
18) Evaluation of FLT_ROUNDS correctly reflects any execution-time change of rounding mode through the function fesetround in <fenv.h>. - -
19) The evaluation method determines evaluation formats of expressions involving all floating types, not + +
19) The evaluation method determines evaluation formats of expressions involving all floating types, not 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. - -
20) The floating-point model in that standard sums powers of b from zero, so the values of the exponent + +
20) The floating-point model in that standard sums powers of b from zero, so the values of the exponent
limits are one less than shown here.
-
+
6. Language
@@ -1941,13 +1941,13 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
statements (6.8).
21) There is no linkage between different identifiers. - -
22) A function declaration can contain the storage-class specifier static only if it is at file scope; see +
21) There is no linkage between different identifiers. + +
22) A function declaration can contain the storage-class specifier static only if it is at file scope; see 6.7.1. - -
23) As specified in 6.2.1, the later declaration might hide the prior declaration. - + +
23) As specified in 6.2.1, the later declaration might hide the prior declaration.
+
6.2.3 Name spaces of identifiers
@@ -1974,8 +1974,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
24) There is only one name space for tags even though three are possible. - +
24) There is only one name space for tags even though three are possible.
+
6.2.4 Storage durations of objects
@@ -2018,15 +2018,15 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
25) The term ''constant address'' means that two pointers to the object constructed at possibly different +
25) The term ''constant address'' means that two pointers to the object constructed at possibly different times will compare equal. The address may be different during two different executions of the same program. - -
26) In the case of a volatile object, the last store need not be explicit in the program. - -
27) Leaving the innermost block containing the declaration, or jumping to a point in that block or an + +
26) In the case of a volatile object, the last store need not be explicit in the program. + +
27) Leaving the innermost block containing the declaration, or jumping to a point in that block or an
embedded block prior to the declaration, leaves the scope of the declaration.
-
+
6.2.5 Types
@@ -2209,41 +2209,41 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: compatible type and composite type (6.2.7), declarations (6.7).
28) Implementation-defined keywords shall have the form of an identifier reserved for any use as +
28) Implementation-defined keywords shall have the form of an identifier reserved for any use as described in 7.1.3. - -
29) Therefore, any statement in this Standard about signed integer types also applies to the extended + +
29) Therefore, any statement in this Standard about signed integer types also applies to the extended signed integer types. - -
30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended + +
30) Therefore, any statement in this Standard about unsigned integer types also applies to the extended unsigned integer types. - -
31) The same representation and alignment requirements are meant to imply interchangeability as + +
31) The same representation and alignment requirements are meant to imply interchangeability as arguments to functions, return values from functions, and members of unions. - -
32) See ''future language directions'' (6.11.1). - -
33) A specification for imaginary types is in informative annex G. - -
34) An implementation may define new keywords that provide alternative ways to designate a basic (or + +
32) See ''future language directions'' (6.11.1). + +
33) A specification for imaginary types is in informative annex G. + +
34) 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 7.1.3. - -
35) CHAR_MIN, defined in <limits.h>, will have one of the values 0 or SCHAR_MIN, and this can be + +
35) CHAR_MIN, defined in <limits.h>, 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. - -
36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed. - -
37) Note that aggregate type does not include union type because an object with union type can only + +
36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed. + +
37) Note that aggregate type does not include union type because an object with union type can only contain one member at a time. - -
38) See 6.7.3 regarding qualified array and function types. - -
39) The same representation and alignment requirements are meant to imply interchangeability as + +
38) See 6.7.3 regarding qualified array and function types. + +
39) The same representation and alignment requirements are meant to imply interchangeability as
arguments to functions, return values from functions, and members of unions.
-
+
6.2.6 Representations of types
@@ -2295,7 +2295,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
designators (6.3.2.1).
40) A positional representation for integers that uses the binary digits 0 and 1, in which the values +
40) A positional representation for integers that uses the binary digits 0 and 1, in which the values
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
@@ -2304,18 +2304,18 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
CHAR_BIT
- 1.
-
-
41) Thus, an automatic variable can be initialized to a trap representation without causing undefined + +
41) Thus, an automatic variable can be initialized to a trap representation without causing undefined behavior, but the value of the variable cannot be used until a proper value is stored in it. - -
42) Thus, for example, structure assignment need not copy any padding bits. - -
43) It is possible for objects x and y with the same effective type T to have the same value when they are + +
42) Thus, for example, structure assignment need not copy any padding bits. + +
43) 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.
-
+
6.2.6.2 Integer types
@@ -2374,18 +2374,18 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 for signed integer types the width is one greater than the precision.
44) Some combinations of padding bits might generate trap representations, for example, if one padding +
44) 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 the value specified by the value bits. - -
45) Some combinations of padding bits might generate trap representations, for example, if one padding + +
45) 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
bits.
-
+
6.2.7 Compatible type and composite type
@@ -2439,10 +2439,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 int f(int (*)(char *), double (*)[3]);
46) Two types need not be identical to be compatible. - -
47) As specified in 6.2.1, the later declaration might hide the prior declaration. - +
46) Two types need not be identical to be compatible. + +
47) As specified in 6.2.1, the later declaration might hide the prior declaration.
+
6.3 Conversions
@@ -2502,10 +2502,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 (6.7.2.1).
48) The integer promotions are applied only: as part of the usual arithmetic conversions, to certain +
48) The integer promotions are applied only: as part of the usual arithmetic conversions, to certain
argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the
shift operators, as specified by their respective subclauses.
-
+
6.3.1.2 Boolean type
@@ -2525,8 +2525,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 result is implementation-defined or an implementation-defined signal is raised.
49) The rules describe arithmetic on the mathematical value, not the value of a given type of expression. - +
49) The rules describe arithmetic on the mathematical value, not the value of a given type of expression.
+
6.3.1.4 Real floating and integer
@@ -2544,10 +2544,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 values that can be represented, the behavior is undefined.
50) The remaindering operation performed when a value of integer type is converted to unsigned type +
50) 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).
-
+
6.3.1.5 Real floating types
@@ -2626,12 +2626,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
51) For example, addition of a double _Complex and a float entails just the conversion of the +
51) For example, addition of a double _Complex and a float entails just the conversion of the float operand to double (and yields a double _Complex result). - -
52) The cast and assignment operators are still required to perform their specified conversions as + +
52) The cast and assignment operators are still required to perform their specified conversions as
described in 6.3.1.4 and 6.3.1.5.
-
+
6.3.2 Other operands
@@ -2672,16 +2672,16 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
53) The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left +
53) The name ''lvalue'' comes originally from the assignment expression E1 = E2, in which the left 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. - -
54) Because this conversion does not occur, the operand of the sizeof operator remains a function + +
54) Because this conversion does not occur, the operand of the sizeof operator remains a function
designator and violates the constraint in 6.5.3.4.
-
+
6.3.2.2 void
@@ -2738,15 +2738,15 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
55) The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.17. - -
56) The mapping functions for converting a pointer to an integer or an integer to a pointer are intended to +
55) The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.17. + +
56) 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. - -
57) In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a + +
57) In general, the concept ''correctly aligned'' is transitive: if a pointer to type A is correctly aligned for a
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.
-
+
6.4 Lexical elements
58) An additional category, placemarkers, is used internally in translation phase 4 (see 6.10.3.3); it cannot +
58) An additional category, placemarkers, is used internally in translation phase 4 (see 6.10.3.3); it cannot
occur in source files.
-
+
6.4.1 Keywords
59) One possible specification for imaginary types appears in annex G. - +
59) One possible specification for imaginary types appears in annex G.
+
6.4.2 Identifiers
@@ -2903,11 +2903,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: universal character names (6.4.3), macro replacement (6.10.3).
60) On systems in which linkers cannot accept extended characters, an encoding of the universal character +
60) 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.
-
+
6.4.2.2 Predefined identifiers
61) Since the name __func__ is reserved for any use by the implementation (7.1.3), if any other +
61) Since the name __func__ is reserved for any use by the implementation (7.1.3), if any other
identifier is explicitly declared using the name __func__, the behavior is undefined.
-
+
6.4.3 Universal character names
62) The disallowed characters are the characters in the basic character set and the code positions reserved +
62) The disallowed characters are the characters in the basic character set and the code positions reserved by ISO/IEC 10646 for control characters, the character DELETE, and the S-zone (reserved for use by UTF-16). - -
63) Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997. - + +
63) Short identifiers for characters were first specified in ISO/IEC 10646-1/AMD9:1997.
+
6.4.4 Constants
64) The specification for the library functions recommends more accurate conversion than required for +
64) The specification for the library functions recommends more accurate conversion than required for
floating constants (see 7.20.1.3).
-
+
6.4.4.3 Enumeration constants
65) The semantics of these characters were discussed in 5.2.2. If any other character follows a backslash, +
65) The semantics of these characters were discussed in 5.2.2. If any other character follows a backslash,
the result is not a token and a diagnostic is required. See ''future language directions'' (6.11.4).
-
+
6.4.5 String literals
66) A character string literal need not be a string (see 7.1.1), because a null character may be embedded in +
66) A character string literal need not be a string (see 7.1.1), because a null character may be embedded in
it by a \0 escape sequence.
-
+
6.4.6 Punctuators
67) These tokens are sometimes called ''digraphs''. - -
68) Thus [ and <: behave differently when ''stringized'' (see 6.10.3.2), but can otherwise be freely +
67) These tokens are sometimes called ''digraphs''. + +
68) Thus [ and <: behave differently when ''stringized'' (see 6.10.3.2), but can otherwise be freely
interchanged.
-
+
6.4.7 Header names
Forward references: source file inclusion (6.10.2).
69) Thus, sequences of characters that resemble escape sequences cause undefined behavior. - -
70) For an example of a header name preprocessing token used in a #pragma directive, see 6.10.9. - +
69) Thus, sequences of characters that resemble escape sequences cause undefined behavior. + +
70) For an example of a header name preprocessing token used in a #pragma directive, see 6.10.9.
+
6.4.8 Preprocessing numbers
71) Thus, /* ... */ comments do not nest. - +
71) Thus, /* ... */ comments do not nest.
+
6.5 Expressions
@@ -3620,9 +3620,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
72) A floating-point status flag is not an object and can be set more than once within an expression. - -
73) This paragraph renders undefined statement expressions such as +
72) A floating-point status flag is not an object and can be set more than once within an expression. + +
73) This paragraph renders undefined statement expressions such as
i = ++i + 1;
@@ -3631,8 +3631,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
i = i + 1;
a[i] = i;
-
-
74) The syntax specifies the precedence of operators in the evaluation of an expression, which is the same + +
74) The syntax specifies the precedence of operators in the evaluation of an expression, which is the same
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 (6.5.6) are those expressions defined in
6.5.1 through 6.5.6. The exceptions are cast expressions (6.5.4) as operands of unary operators
@@ -3643,18 +3643,18 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
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.
-
-
75) Allocated objects have no declared type. - -
76) The intent of this list is to specify those circumstances in which an object may or may not be aliased. - -
77) A contracted expression might also omit the raising of floating-point exceptions. - -
78) This license is specifically intended to allow implementations to exploit fast machine instructions that + +
75) Allocated objects have no declared type. + +
76) The intent of this list is to specify those circumstances in which an object may or may not be aliased. + +
77) A contracted expression might also omit the raising of floating-point exceptions. + +
78) This license is specifically intended to allow implementations to exploit fast machine instructions that
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.
-
+
6.5.1 Primary expressions
Forward references: declarations (6.7).
79) Thus, an undeclared identifier is a violation of the syntax. - +
79) Thus, an undeclared identifier is a violation of the syntax.
+
6.5.2 Postfix operators
80) Most often, this is the result of converting an identifier that is a function designator. - -
81) A function may change the values of its parameters, but these changes cannot affect the values of the +
80) Most often, this is the result of converting an identifier that is a function designator. + +
81) A function may change the values of its parameters, but these changes cannot affect the values of the
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 6.9.1.
-
+
6.5.2.3 Structure and union members
82) If the member used to access the contents of a union object is not the same as the member last used to +
82) If the member used to access 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 6.2.6 (a process sometimes called "type punning"). This might be a trap representation. - -
83) If &E is a valid pointer expression (where & is the ''address-of '' operator, which generates a pointer to + +
83) If &E is a valid pointer expression (where & is the ''address-of '' operator, which generates a pointer to
its operand), the expression (&E)->MOS is the same as E.MOS.
-
+
6.5.2.4 Postfix increment and decrement operators
84) Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types +
84) Note that this differs from a cast expression. For example, a cast specifies a conversion to scalar types or void only, and the result of a cast expression is not an lvalue. - -
85) For example, subobjects without explicit initializers are initialized to zero. - -
86) This allows implementations to share storage for string literals and constant compound literals with + +
85) For example, subobjects without explicit initializers are initialized to zero. + +
86) This allows implementations to share storage for string literals and constant compound literals with
the same or overlapping representations.
-
+
6.5.3 Unary operators
87) Thus, &*E is equivalent to E (even if E is a null pointer), and &(E1[E2]) to ((E1)+(E2)). It is +
87) 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.
Among the invalid values for dereferencing a pointer by the unary * operator are a null pointer, an
address inappropriately aligned for the type of object pointed to, and the address of an object after the
end of its lifetime.
-
+
6.5.3.3 Unary arithmetic operators
88) When applied to a parameter declared to have array or function type, the sizeof operator yields the +
88) When applied to a parameter declared to have array or function type, the sizeof operator yields the
size of the adjusted (pointer) type (see 6.9.1).
-
+
6.5.4 Cast operators
89) A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the +
89) A cast does not yield an lvalue. Thus, a cast to a qualified type has the same effect as a cast to the
unqualified version of the type.
-
+
6.5.5 Multiplicative operators
90) This is often called ''truncation toward zero''. - +
90) This is often called ''truncation toward zero''.
+
6.5.6 Additive operators
91) Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In +
91) Another way to approach pointer arithmetic is first to convert the pointer(s) to character pointer(s): In
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
@@ -4428,7 +4428,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
When viewed in this way, an implementation need only provide one extra byte (which may overlap
another object in the program) just after the end of the object in order to satisfy the ''one past the last
element'' requirements.
-
+
6.5.7 Bitwise shift operators
92) The expression a<b<c is not interpreted as in ordinary mathematics. As the syntax indicates, it +
92) The expression a<b<c is not interpreted as in ordinary mathematics. As the syntax indicates, it
means (a<b)<c; in other words, ''if a is less than b, compare 1 to c; otherwise, compare 0 to c''.
-
+
6.5.9 Equality operators
93) Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value. - -
94) Two objects may be adjacent in memory because they are adjacent elements of a larger array or +
93) Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value. + +
94) Two objects may be adjacent in memory because they are adjacent elements of a larger array or
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
behavior.
-
+
6.5.10 Bitwise AND operator
95) A conditional expression does not yield an lvalue. - +
95) A conditional expression does not yield an lvalue.
+
6.5.16 Assignment operators
96) The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion +
96) The asymmetric appearance of these constraints with respect to type qualifiers is due to the conversion
(specified in 6.3.2.1) 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).
-
+
6.5.16.2 Compound assignment
97) A comma operator does not yield an lvalue. - +
97) A comma operator does not yield an lvalue.
+
6.6 Constant expressions
98) The operand of a sizeof operator is usually not evaluated (6.5.3.4). - -
99) An integer constant expression is used to specify the size of a bit-field member of a structure, the +
98) The operand of a sizeof operator is usually not evaluated (6.5.3.4). + +
99) An integer constant expression is used to specify the size of a bit-field member of a structure, the value of an enumeration constant, the size of an array, or the value of a case constant. Further constraints that apply to the integer constant expressions used in conditional-inclusion preprocessing directives are discussed in 6.10.1. - -
100) Thus, in the following initialization, + +
100) Thus, in the following initialization,
static int i = 2 || 1 / 0;
the expression is a valid integer constant expression with value one.
-
+
6.7 Declarations
101) Function definitions have a different syntax, described in 6.9.1. - +
101) Function definitions have a different syntax, described in 6.9.1.
+
6.7.1 Storage-class specifiers
Forward references: type definitions (6.7.7).
102) See ''future language directions'' (6.11.5). - -
103) The implementation may treat any register declaration simply as an auto declaration. However, +
102) See ''future language directions'' (6.11.5). + +
103) The implementation may treat any register declaration simply as an auto declaration. However,
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 6.5.3.2) or implicitly (by converting an array name to a pointer as discussed in
6.3.2.1). Thus, the only operator that can be applied to an array declared with storage-class specifier
register is sizeof.
-
+
6.7.2 Type specifiers
104) Freestanding implementations are not required to provide complex types. * - +
104) Freestanding implementations are not required to provide complex types. *
+
6.7.2.1 Structure and union specifiers
105) A structure or union can not contain a member with a variably modified type because member names +
105) A structure or union can not contain a member with a variably modified type because member names are not ordinary identifiers as defined in 6.2.3. - -
106) The unary & (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to + +
106) The unary & (address-of) operator cannot be applied to a bit-field object; thus, there are no pointers to or arrays of bit-field objects. - -
107) As specified in 6.7.2 above, if the actual type specifier used is int or a typedef-name defined as int, + +
107) As specified in 6.7.2 above, if the actual type specifier used is int or a typedef-name defined as int, then it is implementation-defined whether the bit-field is signed or unsigned. - -
108) An unnamed bit-field structure member is useful for padding to conform to externally imposed + +
108) An unnamed bit-field structure member is useful for padding to conform to externally imposed
layouts.
-
+
6.7.2.2 Enumeration specifiers
Forward references: tags (6.7.2.3).
109) Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from +
109) Thus, the identifiers of enumeration constants declared in the same scope shall all be distinct from each other and from other identifiers declared in ordinary declarators. - -
110) An implementation may delay the choice of which integer type until all enumeration constants have + +
110) An implementation may delay the choice of which integer type until all enumeration constants have
been seen.
-
+
6.7.2.3 Tags
111) An incomplete type may only by used when the size of an object of that type is not needed. It is not +
111) An incomplete type may only by used when the size of an object of that type is not needed. It is not 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 6.2.5.) The specification has to be complete before such a function is called or defined. - -
112) If there is no identifier, the type can, within the translation unit, only be referred to by the declaration + +
112) 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. - -
113) A similar construction with enum does not exist. - + +
113) A similar construction with enum does not exist.
+
6.7.3 Type qualifiers
114) The implementation may place a const object that is not volatile in a read-only region of +
114) The implementation may place a const object that is not volatile in a read-only region of storage. Moreover, the implementation need not allocate storage for such an object if its address is never used. - -
115) This applies to those objects that behave as if they were defined with qualified types, even if they are + +
115) This applies to those objects that behave as if they were defined with qualified types, even if they are never actually defined as objects in the program (such as an object at a memory-mapped input/output address). - -
116) A volatile declaration may be used to describe an object corresponding to a memory-mapped + +
116) A volatile declaration may be used to describe an object corresponding to a memory-mapped 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. - -
117) For example, a statement that assigns a value returned by malloc to a single pointer establishes this + +
117) For example, a statement that assigns a value returned by malloc to a single pointer establishes this association between the allocated object and the pointer. - -
118) Both of these can occur through the use of typedefs. - + +
118) Both of these can occur through the use of typedefs.
+
6.7.3.1 Formal definition of restrict
@@ -5755,11 +5755,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
119) In other words, E depends on the value of P itself rather than on the value of an object referenced +
119) In other words, E depends on the value of P itself rather than on the value of an object referenced
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.
-
+
6.7.4 Function specifiers
120) By using, for example, an alternative to the usual function call mechanism, such as ''inline +
120) 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. - -
121) For example, an implementation might never perform inline substitution, or might only perform inline + +
121) For example, an implementation might never perform inline substitution, or might only perform inline substitutions to calls in the scope of an inline declaration. - -
122) Since an inline definition is distinct from the corresponding external definition and from any other + +
122) Since an inline definition is distinct from the corresponding external definition and from any other
corresponding inline definitions in other translation units, all corresponding objects with static storage
duration are also distinct in each of the definitions.
-
+
6.7.5 Declarators
123) When several ''array of'' specifications are adjacent, a multidimensional array is declared. - -
124) Thus, * can be used only in function declarations that are not definitions (see 6.7.5.3). - +
123) When several ''array of'' specifications are adjacent, a multidimensional array is declared. + +
124) Thus, * can be used only in function declarations that are not definitions (see 6.7.5.3).
+
6.7.5.3 Function declarators (including prototypes)
125) The macros defined in the <stdarg.h> header (7.15) may be used to access arguments that +
125) The macros defined in the <stdarg.h> header (7.15) may be used to access arguments that correspond to the ellipsis. - -
126) See ''future language directions'' (6.11.6). - -
127) If both function types are ''old style'', parameter types are not compared. - + +
126) See ''future language directions'' (6.11.6). + +
127) If both function types are ''old style'', parameter types are not compared.
+
6.7.6 Type names
128) As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no +
128) As indicated by the syntax, empty parentheses in a type name are interpreted as ''function with no
parameter specification'', rather than redundant parentheses around the omitted identifier.
-
+
6.7.7 Type definitions
129) If the initializer list for a subaggregate or contained union does not begin with a left brace, its +
129) If the initializer list for a subaggregate or contained union does not begin with a left brace, its 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. - -
130) After a union member is initialized, the next object is not the next member of the union; instead, it is + +
130) After a union member is initialized, the next object is not the next member of the union; instead, it is the next subobject of an object containing the union. - -
131) Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with + +
131) Thus, a designator can only specify a strict subobject of the aggregate or union that is associated with the surrounding brace pair. Note, too, that each separate designator list is independent. - -
132) Any initializer for the subobject which is overridden and so not used to initialize that subobject might + +
132) Any initializer for the subobject which is overridden and so not used to initialize that subobject might not be evaluated at all. - -
133) In particular, the evaluation order need not be the same as the order of subobject initialization. - + +
133) In particular, the evaluation order need not be the same as the order of subobject initialization.
+
6.8 Statements and blocks
Forward references: iteration statements (6.8.5).
134) Such as assignments, and function calls which have side effects. - +
134) Such as assignments, and function calls which have side effects.
+
6.8.4 Selection statements
135) That is, the declaration either precedes the switch statement, or it follows the last case or +
135) That is, the declaration either precedes the switch statement, or it follows the last case or
default label associated with the switch that is in the block containing the declaration.
-
+
6.8.5 Iteration statements
136) Code jumped over is not executed. In particular, the controlling expression of a for or while +
136) Code jumped over is not executed. In particular, the controlling expression of a for or while
statement is not evaluated before entering the loop body, nor is clause-1 of a for statement.
-
+
6.8.5.1 The while statement
@@ -6970,11 +6970,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 nonzero constant.
137) Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in +
137) 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.
-
+
6.8.6 Jump statements
138) Following the contin: label is a null statement. - +
138) Following the contin: label is a null statement.
+
6.8.6.3 The break statement
139) The return statement is not an assignment. The overlap restriction of subclause 6.5.16.1 does not +
139) The return statement is not an assignment. The overlap restriction of subclause 6.5.16.1 does not
apply to the case of function return. The representation of floating-point values may have wider range
or precision and is determined by FLT_EVAL_METHOD. A cast may be used to remove this extra
range and precision.
-
+
6.9 External definitions
140) Thus, if an identifier declared with external linkage is not used in an expression, there need be no +
140) Thus, if an identifier declared with external linkage is not used in an expression, there need be no
external definition for it.
-
+
6.9.1 Function definitions
141) The intent is that the type category in a function definition cannot be inherited from a typedef: +
141) The intent is that the type category in a function definition cannot be inherited from a typedef:
typedef int F(void); // type F is ''function with no parameters
@@ -7308,9 +7308,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
F *((e))(void) { /* ... */ } // same: parentheses irrelevant
int (*fp)(void); // fp points to a function that has type F
F *Fp; // Fp points to a function that has type F
-
-
142) See ''future language directions'' (6.11.7). - + +
142) See ''future language directions'' (6.11.7).
+
6.9.2 External object definitions
143) Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic +
143) Thus, preprocessing directives are commonly called ''lines''. These ''lines'' have no other syntactic
significance, as all white space is equivalent except in certain situations during preprocessing (see the
# character string literal creation operator in 6.10.3.2, for example).
-
+
6.10.1 Conditional inclusion
144) Because the controlling constant expression is evaluated during translation phase 4, all identifiers +
144) Because the controlling constant expression is evaluated during translation phase 4, all identifiers either are or are not macro names -- there simply are no keywords, enumeration constants, etc. - -
145) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant + +
145) Thus, on an implementation where INT_MAX is 0x7FFF and UINT_MAX is 0xFFFF, the constant 0x8000 is signed and positive within a #if expression even though it would be unsigned in translation phase 7. - -
146) Thus, the constant expression in the following #if directive and if statement is not guaranteed to + +
146) Thus, the constant expression in the following #if directive and if statement is not guaranteed to evaluate to the same value in these two contexts. #if 'z' - 'a' == 25 if ('z' - 'a' == 25) - -
147) As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive + +
147) As indicated by the syntax, a preprocessing token shall not follow a #else or #endif directive
before the terminating new-line character. However, comments may appear anywhere in a source file,
including within a preprocessing directive.
-
+
6.10.2 Source file inclusion
Forward references: macro replacement (6.10.3).
148) Note that adjacent string literals are not concatenated into a single string literal (see the translation +
148) Note that adjacent string literals are not concatenated into a single string literal (see the translation
phases in 5.1.1.2); thus, an expansion that results in two string literals is an invalid directive.
-
+
6.10.3 Macro replacement
149) Since, by macro-replacement time, all character constants and string literals are preprocessing tokens, +
149) Since, by macro-replacement time, all character constants and string literals are preprocessing tokens, not sequences possibly containing identifier-like subsequences (see 5.1.1.2, translation phases), they are never scanned for macro names or parameters. - -
150) Despite the name, a non-directive is a preprocessing directive. - + +
150) Despite the name, a non-directive is a preprocessing directive.
+
6.10.3.1 Argument substitution
@@ -7810,9 +7810,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
151) Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that +
151) Placemarker preprocessing tokens do not appear in the syntax because they are temporary entities that
exist only within translation phase 4.
-
+
6.10.3.4 Rescanning and further replacement
@@ -8050,14 +8050,14 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
152) An implementation is not required to perform macro replacement in pragmas, but it is permitted +
152) An implementation is not required to perform macro replacement in pragmas, but it is permitted 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. - -
153) See ''future language directions'' (6.11.8). - + +
153) See ''future language directions'' (6.11.8).
+
6.10.7 Null directive
Forward references: the asctime function (7.23.3.1), standard headers (7.1.2).
154) See ''future language directions'' (6.11.9). - -
155) The presumed source file name and line number can be changed by the #line directive. - -
156) This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in +
154) See ''future language directions'' (6.11.9). + +
155) The presumed source file name and line number can be changed by the #line directive. + +
156) This macro was not specified in ISO/IEC 9899:1990 and was specified as 199409L in
ISO/IEC 9899/AMD1:1995. The intention is that this will remain an integer constant of type long
int that is increased with each revision of this International Standard.
-
+
6.10.9 Pragma operator
157) The functions that make use of the decimal-point character are the numeric conversion functions +
157) The functions that make use of the decimal-point character are the numeric conversion functions (7.20.1, 7.24.4.1) and the formatted input/output functions (7.19.6, 7.24.2). - -
158) For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large + +
158) For state-dependent encodings, the values for MB_CUR_MAX and MB_LEN_MAX shall thus be large
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.
-
+
7.1.2 Standard headers
@@ -8311,9 +8311,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
159) A header is not necessarily a source file, nor are the < and > delimited sequences in header names +
159) A header is not necessarily a source file, nor are the < and > delimited sequences in header names
necessarily valid source file names.
-
+
7.1.3 Reserved identifiers
@@ -8345,9 +8345,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 group listed above, the behavior is undefined.
160) The list of reserved identifiers with external linkage includes errno, math_errhandling, +
160) The list of reserved identifiers with external linkage includes errno, math_errhandling,
setjmp, and va_end.
-
+
7.1.4 Use of library functions
@@ -8423,12 +8423,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
161) This means that an implementation shall provide an actual function for each library function, even if it +
161) This means that an implementation shall provide an actual function for each library function, even if it also provides a macro for that function. - -
162) Such macros might not contain the sequence points that the corresponding function calls do. - -
163) Because external identifiers and some macro names beginning with an underscore are reserved, + +
162) Such macros might not contain the sequence points that the corresponding function calls do. + +
163) 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 @@ -8444,9 +8444,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 whether the implementation's header provides a macro implementation of abs or a built-in implementation. The prototype for the function, which precedes and is hidden by any macro definition, is thereby revealed also. - -
164) Thus, a signal handler cannot, in general, call standard library functions. - + +
164) Thus, a signal handler cannot, in general, call standard library functions.
+
7.2 Diagnostics
@@ -8494,9 +8494,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
165) The message written might be of the form: +
165) The message written might be of the form:
Assertion failed: expression, function abc, file xyz, line nnn.
-
+
7.3 Complex arithmetic
@@ -8543,12 +8543,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
166) See ''future library directions'' (7.26.1). - -
167) The imaginary unit is a number i such that i 2 = -1. - -
168) A specification for imaginary types is in informative annex G. - +
166) See ''future library directions'' (7.26.1). + +
167) The imaginary unit is a number i such that i 2 = -1. + +
168) A specification for imaginary types is in informative annex G.
+
7.3.2 Conventions
@@ -8600,7 +8600,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 undefined. The default state for the pragma is ''off''.
169) The purpose of the pragma is to allow the implementation to use the formulas: +
169) The purpose of the pragma is to allow the implementation to use the formulas:
(x + iy) x (u + iv) = (xu - yv) + i(yu + xv)
@@ -8608,7 +8608,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
| x + iy | = (sqrt) x 2 + y 2
???????????????
where the programmer can determine they are safe.
-
+
7.3.5 Trigonometric functions
@@ -8940,8 +8940,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
The cimag functions return the imaginary part value (as a real).
170) For a variable z of complex type, z == creal(z) + cimag(z)*I. - +
170) For a variable z of complex type, z == creal(z) + cimag(z)*I.
+
7.3.9.3 The conj functions
171) For a variable z of complex type, z == creal(z) + cimag(z)*I. - +
171) For a variable z of complex type, z == creal(z) + cimag(z)*I.
+
7.4 Character handling
@@ -9025,12 +9025,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: EOF (7.19.1), localization (7.11).
172) See ''future library directions'' (7.26.2). - -
173) In an implementation that uses the seven-bit US ASCII character set, the printing characters are those +
172) See ''future library directions'' (7.26.2). + +
173) 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).
-
+
7.4.1 Character classification functions
@@ -9065,9 +9065,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 isalpha returns true only for the characters for which isupper or islower is true.
174) The functions islower and isupper test true or false separately for each of these additional +
174) The functions islower and isupper test true or false separately for each of these additional
characters; all four combinations are possible.
-
+
7.4.1.3 The isblank function
175) The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue +
175) The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue resulting from a function call (for example, *errno()). - -
176) Thus, a program that uses errno for error checking should set it to zero before a library function call, + +
176) 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. - -
177) See ''future library directions'' (7.26.3). - + +
177) See ''future library directions'' (7.26.3).
+
7.6 Floating-point environment
@@ -9364,25 +9364,25 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 also be specified by the implementation.
178) This header is designed to support the floating-point exception status flags and directed-rounding +
178) This header is designed to support the floating-point exception status flags and directed-rounding control modes required by IEC 60559, and other similar floating-point state information. Also it is designed to facilitate code portability among all systems. - -
179) A floating-point status flag is not an object and can be set more than once within an expression. - -
180) With these conventions, a programmer can safely assume default floating-point control modes (or be + +
179) A floating-point status flag is not an object and can be set more than once within an expression. + +
180) 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. - -
181) The implementation supports an exception if there are circumstances where a call to at least one of the + +
181) The implementation supports an exception if there are circumstances where a call to at least one of the functions in 7.6.2, using the macro as the appropriate argument, will succeed. It is not necessary for all the functions to succeed all the time. - -
182) The macros should be distinct powers of two. - -
183) Even though the rounding direction macros may expand to constants corresponding to the values of + +
182) The macros should be distinct powers of two. + +
183) Even though the rounding direction macros may expand to constants corresponding to the values of
FLT_ROUNDS, they are not required to do so.
-
+
7.6.1 The FENV_ACCESS pragma
184) The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag +
184) The purpose of the FENV_ACCESS pragma is to allow certain optimizations that could subvert flag 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. - -
185) The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other + +
185) The side effects impose a temporal ordering that requires two evaluations of x + 1. On the other
hand, without the #pragma STDC FENV_ACCESS ON pragma, and assuming the default state is
''off'', just one evaluation of x + 1 would suffice.
-
+
7.6.2 Floating-point exceptions
@@ -9455,12 +9455,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 functions is undefined.
186) The functions fetestexcept, feraiseexcept, and feclearexcept support the basic +
186) 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
content of flags.
-
+
7.6.2.1 The feclearexcept function
187) The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations. +
187) The effect is intended to be similar to that of floating-point exceptions raised by arithmetic operations.
Hence, enabled traps for floating-point exceptions raised by this function are taken. The specification
in F.7.6 is in the same spirit.
-
+
7.6.2.4 The fesetexceptflag function
188) This mechanism allows testing several floating-point exceptions with just one function call. - +
188) This mechanism allows testing several floating-point exceptions with just one function call.
+
7.6.3 Rounding
@@ -9684,11 +9684,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 exception handling was successfully installed.
189) IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap +
189) IEC 60559 systems have a default non-stop mode, and typically at least one other mode for trap
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.
-
+
7.6.4.3 The fesetenv function
190) See ''future library directions'' (7.26.4). - +
190) See ''future library directions'' (7.26.4).
+
7.8.1 Macros for format specifiers
@@ -9838,13 +9838,13 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
191) C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined +
191) C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined before <inttypes.h> is included. - -
192) Separate macros are given for use with fprintf and fscanf functions because, in the general case, + +
192) Separate macros are given for use with fprintf and fscanf functions because, in the general case,
different format specifiers may be required for fprintf and fscanf, even when the type is the
same.
-
+
7.8.2 Functions for greatest-width integer types
@@ -9867,8 +9867,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
The imaxabs function returns the absolute value.
193) The absolute value of the most negative number cannot be represented in two's complement. - +
193) The absolute value of the most negative number cannot be represented in two's complement.
+
7.8.2.2 The imaxdiv function
194) ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C. - -
195) See ''future library directions'' (7.26.5). - +
194) ISO/IEC 9945-2 specifies locale and charmap formats that may be used to specify locales for C. + +
195) See ''future library directions'' (7.26.5).
+
7.11.1 Locale control
@@ -10078,12 +10078,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
strftime function (7.23.3.5), the strxfrm function (7.21.4.5).
196) The only functions in 7.4 whose behavior is not affected by the current locale are isdigit and +
196) The only functions in 7.4 whose behavior is not affected by the current locale are isdigit and isxdigit. - -
197) The implementation shall arrange to encode in a string the various categories due to a heterogeneous + +
197) The implementation shall arrange to encode in a string the various categories due to a heterogeneous
locale when category has the value LC_ALL.
-
+
7.11.2 Numeric formatting convention inquiry
@@ -10415,22 +10415,22 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
<fenv.h>.
198) Particularly on systems with wide expression evaluation, a <math.h> function might pass arguments +
198) Particularly on systems with wide expression evaluation, a <math.h> function might pass arguments and return values in wider format than the synopsis prototype indicates. - -
199) The types float_t and double_t are intended to be the implementation's most efficient types at + +
199) The types float_t and double_t are intended to be the implementation's most efficient types at 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. - -
200) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that + +
200) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that supports infinities. - -
201) In this case, using INFINITY will violate the constraint in 6.4.4 and thus require a diagnostic. - -
202) Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented + +
201) In this case, using INFINITY will violate the constraint in 6.4.4 and thus require a diagnostic. + +
202) Typically, the FP_FAST_FMA macro is defined if and only if the fma function is implemented
directly with a hardware multiply-add instruction. Software implementations are expected to be
substantially slower.
-
+
7.12.1 Treatment of error conditions
@@ -10477,12 +10477,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 floating-point exception is raised is implementation-defined.
203) In an implementation that supports infinities, this allows an infinity as an argument to be a domain +
203) In an implementation that supports infinities, this allows an infinity as an argument to be a domain error if the mathematical domain of the function does not include the infinity. - -
204) The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and + +
204) The term underflow here is intended to encompass both ''gradual underflow'' as in IEC 60559 and
also ''flush-to-zero'' underflow.
-
+
7.12.2 The FP_CONTRACT pragma
205) Since an expression can be evaluated with more range and precision than its type has, it is important to +
205) Since an expression can be evaluated with more range and precision than its type has, it is important to
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.
-
+
7.12.3.2 The isfinite macro
206) For the isnan macro, the type for determination does not matter unless the implementation supports +
206) For the isnan macro, the type for determination does not matter unless the implementation supports
NaNs in the evaluation type but not in the semantic type.
-
+
7.12.3.5 The isnormal macro
207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is +
207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is
unsigned, it is treated as positive.
-
+
7.12.4 Trigonometric functions
@@ -10914,8 +10914,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
The expm1 functions return ex - 1.
208) For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1. - +
208) For small magnitude x, expm1(x) is expected to be more accurate than exp(x) - 1.
+
7.12.6.4 The frexp functions
209) For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x). - +
209) For small magnitude x, log1p(x) is expected to be more accurate than log(1 + x).
+
7.12.6.10 The log2 functions
210) ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the +
210) ''When y != 0, the remainder r = x REM y is defined regardless of the rounding mode by the
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. Thus, the remainder is always exact. If r = 0, its sign shall be that of
x.'' This definition is applicable for all implementations.
-
+
7.12.10.3 The remquo functions
211) The argument values are converted to the type of the function, even by a macro implementation of the +
211) The argument values are converted to the type of the function, even by a macro implementation of the
function.
-
+
7.12.11.4 The nexttoward functions
212) The result of the nexttoward functions is determined in the type of the function, without loss of +
212) The result of the nexttoward functions is determined in the type of the function, without loss of
range or precision in a floating second argument.
-
+
7.12.12 Maximum, minimum, and positive difference functions
@@ -11637,9 +11637,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
The fmax functions return the maximum numeric value of their arguments.
213) NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the +
213) NaN arguments are treated as missing data: if one argument is a NaN and the other numeric, then the
fmax functions choose the numeric value. See F.9.9.2.
-
+
7.12.12.3 The fmin functions
214) The fmin functions are analogous to the fmax functions in their treatment of NaNs. - +
214) The fmin functions are analogous to the fmax functions in their treatment of NaNs.
+
7.12.13 Floating multiply-add
@@ -11699,10 +11699,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
expression of real floating type.
215) IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if +
215) IEC 60559 requires that the built-in relational operators raise the ''invalid'' floating-point exception if
the operands compare unordered, as an error indicator for programs written without consideration of
NaNs; the result in these cases is false.
-
+
7.12.14.1 The isgreater macro
216) These functions are useful for dealing with unusual conditions encountered in a low-level function of +
216) These functions are useful for dealing with unusual conditions encountered in a low-level function of
a program.
-
+
7.13.1 Save calling environment
@@ -11925,11 +11925,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
}
217) For example, by executing a return statement or because another longjmp call has caused a +
217) For example, by executing a return statement or because another longjmp call has caused a transfer to a setjmp invocation in a function earlier in the set of nested calls. - -
218) This includes, but is not limited to, the floating-point status flags and the state of open files. - + +
218) This includes, but is not limited to, the floating-point status flags and the state of open files.
+
7.14 Signal handling
@@ -11974,10 +11974,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
219) See ''future library directions'' (7.26.9). The names of the signal numbers reflect the following terms +
219) See ''future library directions'' (7.26.9). The names of the signal numbers reflect the following terms
(respectively): abort, floating-point exception, illegal instruction, interrupt, segmentation violation,
and termination.
-
+
7.14.1 Specify signal handling
@@ -12041,8 +12041,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
_Exit function (7.20.4.4).
220) If any signal is generated by an asynchronous signal handler, the behavior is undefined. - +
220) If any signal is generated by an asynchronous signal handler, the behavior is undefined.
+
7.14.2 Send signal
@@ -12085,9 +12085,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
macro prior to any further reference to ap.221)
221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in which +
221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in which
case the original function may make further use of the original list after the other function returns.
-
+
7.15.1 Variable argument list access macros
@@ -12276,8 +12276,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
222) See ''future library directions'' (7.26.7). - +
222) See ''future library directions'' (7.26.7).
+
7.17 Common definitions
@@ -12349,10 +12349,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 (described as ''optional'').
223) See ''future library directions'' (7.26.8). - -
224) Some of these types may denote implementation-defined extended integer types. - +
223) See ''future library directions'' (7.26.8). + +
224) Some of these types may denote implementation-defined extended integer types.
+
7.18.1 Integer types
@@ -12423,10 +12423,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 All other types of this form are optional.
225) The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear +
225) The designated type is not guaranteed to be fastest for all purposes; if the implementation has no clear
grounds for choosing one type over another, it will simply pick some integer type satisfying the
signedness and width requirements.
-
+
7.18.1.4 Integer types capable of holding object pointers
@@ -12470,9 +12470,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 except where stated to be exactly the given value.
226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined +
226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined
before <stdint.h> is included.
-
+
7.18.2.1 Limits of exact-width integer types
@@ -12582,14 +12582,14 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 shall be 0 and the value of WINT_MAX shall be no less than 65535.
227) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined +
227) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before <stdint.h> is included. - -
228) A freestanding implementation need not provide all of these types. - -
229) The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended + +
228) A freestanding implementation need not provide all of these types. + +
229) The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended
character set.
-
+
7.18.4 Macros for integer constants
@@ -12612,9 +12612,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
230) C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is +
230) C++ implementations should define these macros only when __STDC_CONSTANT_MACROS is
defined before <stdint.h> is included.
-
+
7.18.4.1 Macros for minimum-width integer constants
@@ -12732,11 +12732,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 tmpnam function (7.19.4.4), <wchar.h> (7.24).
231) If the implementation imposes no practical limit on the length of file name strings, the value of +
231) If the implementation imposes no practical limit on the length of file name strings, the value of
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.
-
+
7.19.2 Streams
@@ -12809,12 +12809,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
232) An implementation need not distinguish between text streams and binary streams. In such an +
232) An implementation need not distinguish between text streams and binary streams. In such an implementation, there need be no new-line characters in a text stream nor any limit to the length of a line. - -
233) The three predefined streams stdin, stdout, and stderr are unoriented at program startup. - + +
233) The three predefined streams stdin, stdout, and stderr are unoriented at program startup.
+
7.19.3 Files
@@ -12923,10 +12923,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 (7.24.6.3.2), the wcrtomb function (7.24.6.3.3).
234) Setting the file position indicator to end-of-file, as with fseek(file, 0, SEEK_END), has +
234) 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.
-
+
7.19.4 Operations on files
@@ -12965,9 +12965,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
which case if the file existed previously it is still known by its original name.
235) Among the reasons the implementation may cause the rename function to fail are that the file is open +
235) Among the reasons the implementation may cause the rename function to fail are that the file is open
or that it is necessary to copy its contents to effectuate its renaming.
-
+
7.19.4.3 The tmpfile function
236) Files created using strings generated by the tmpnam function are temporary only in the sense that +
236) Files created using strings generated by the tmpnam function are temporary only in the sense that
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.
-
+
7.19.5 File access functions
@@ -13134,10 +13134,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: file positioning functions (7.19.9).
237) If the string begins with one of the above sequences, the implementation might choose to ignore the +
237) If the string begins with one of the above sequences, the implementation might choose to ignore the
remaining characters, or it might use them to select different kinds of a file (some of which might not
conform to the properties in 7.19.2).
-
+
7.19.5.4 The freopen function
238) The primary use of the freopen function is to change the file associated with a standard text stream +
238) The primary use of the freopen function is to change the file associated with a standard text stream
(stderr, stdin, or stdout), as those identifiers need not be modifiable lvalues to which the value
returned by the fopen function may be assigned.
-
+
7.19.5.5 The setbuf function
239) The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed +
239) The buffer has to have a lifetime at least as great as the open stream, so the stream should be closed
before a buffer that has automatic storage duration is deallocated upon block exit.
-
+
7.19.6 Formatted input/output functions
@@ -13231,8 +13231,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 actions associated with each specifier.240)
240) The fprintf functions perform writes to memory for the %n specifier. - +
240) The fprintf functions perform writes to memory for the %n specifier.
+
7.19.6.1 The fprintf function
Forward references: conversion state (7.24.6), the wcrtomb function (7.24.6.3.3).
241) Note that 0 is taken as a flag, not as the beginning of a field width. - -
242) The results of all floating conversions of a negative zero, and of negative values that round to zero, +
241) Note that 0 is taken as a flag, not as the beginning of a field width. + +
242) The results of all floating conversions of a negative zero, and of negative values that round to zero, include a minus sign. - -
243) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning; + +
243) When applied to infinite and NaN values, the -, +, and space flag characters have their usual meaning; the # and 0 flag characters have no effect. - -
244) Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so + +
244) Binary implementations can choose the hexadecimal digit to the left of the decimal-point character so that subsequent digits align to nibble (4-bit) boundaries. - -
245) The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is + +
245) The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p might suffice depending on the implementation's scheme for determining the digit to the left of the decimal-point character. - -
246) No special provisions are made for multibyte characters. - -
247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding. - -
248) See ''future library directions'' (7.26.9). - -
249) For binary-to-decimal conversion, the result format's values are the numbers representable with the + +
246) No special provisions are made for multibyte characters. + +
247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding. + +
248) See ''future library directions'' (7.26.9). + +
249) 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.
-
+
7.19.6.2 The fscanf function
250) These white-space characters are not counted against a specified field width. - -
251) fscanf pushes back at most one input character onto the input stream. Therefore, some sequences +
250) These white-space characters are not counted against a specified field width. + +
251) fscanf pushes back at most one input character onto the input stream. Therefore, some sequences that are acceptable to strtod, strtol, etc., are unacceptable to fscanf. - -
252) No special provisions are made for multibyte characters in the matching rules used by the c, s, and [ + +
252) 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. - -
253) See ''future library directions'' (7.26.9). - + +
253) See ''future library directions'' (7.26.9).
+
7.19.6.3 The printf function
254) As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and +
254) As the functions vfprintf, vfscanf, vprintf, vscanf, vsnprintf, vsprintf, and
vsscanf invoke the va_arg macro, the value of arg after the return is indeterminate.
-
+
7.19.6.9 The vfscanf function
255) An end-of-file and a read error can be distinguished by use of the feof and ferror functions. - +
255) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
+
7.19.7.2 The fgets function
256) See ''future library directions'' (7.26.9). - +
256) See ''future library directions'' (7.26.9).
+
7.19.8 Direct input/output functions
@@ -14756,8 +14756,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
257) See ''future library directions'' (7.26.10). - +
257) See ''future library directions'' (7.26.10).
+
7.20.1 Numeric conversion functions
@@ -14904,17 +14904,17 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 the value ERANGE is implementation-defined.
258) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by +
258) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by negating the value resulting from converting the corresponding unsigned sequence (see F.5); 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. - -
259) An implementation may use the n-char sequence to determine extra information to be represented in + +
259) An implementation may use the n-char sequence to determine extra information to be represented in the NaN's significand. - -
260) DECIMAL_DIG, defined in <float.h>, should be sufficiently large that L and U will usually round + +
260) DECIMAL_DIG, defined in <float.h>, 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.
-
+
7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions
261) Note that this need not be the same as the representation of floating-point zero or a null pointer +
261) Note that this need not be the same as the representation of floating-point zero or a null pointer
constant.
-
+
7.20.3.2 The free function
262) Each function is called as many times as it was registered, and in the correct order with respect to +
262) Each function is called as many times as it was registered, and in the correct order with respect to
other registered functions.
-
+
7.20.4.4 The _Exit function
263) That is, if the value passed is p, then the following expressions are always nonzero: +
263) 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
-
+
7.20.5.1 The bsearch function
264) In practice, the entire array is sorted according to the comparison function. - +
264) In practice, the entire array is sorted according to the comparison function.
+
7.20.5.2 The qsort function
265) The absolute value of the most negative number cannot be represented in two's complement. - +
265) The absolute value of the most negative number cannot be represented in two's complement.
+
7.20.6.2 The div, ldiv, and lldiv functions
266) If the locale employs special bytes to change the shift state, these bytes do not produce separate wide +
266) If the locale employs special bytes to change the shift state, these bytes do not produce separate wide
character codes, but are grouped with an adjacent multibyte character.
-
+
7.20.7.1 The mblen function
267) The array will not be null-terminated if the value returned is n. - +
267) The array will not be null-terminated if the value returned is n.
+
7.20.8.2 The wcstombs function
268) See ''future library directions'' (7.26.11). - +
268) See ''future library directions'' (7.26.11).
+
7.21.2 Copying functions
@@ -15699,9 +15699,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
The strncpy function returns the value of s1.
269) Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will +
269) Thus, if there is no null character in the first n characters of the array pointed to by s2, the result will
not be null-terminated.
-
+
7.21.3 Concatenation functions
@@ -15745,9 +15745,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: the strlen function (7.21.6.3).
270) Thus, the maximum number of characters that can end up in the array pointed to by s1 is +
270) Thus, the maximum number of characters that can end up in the array pointed to by s1 is
strlen(s1)+n+1.
-
+
7.21.4 Comparison functions
@@ -15773,10 +15773,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 pointed to by s2.
271) The contents of ''holes'' used as padding for purposes of alignment within structure objects are +
271) The contents of ''holes'' used as padding for purposes of alignment within structure objects are
indeterminate. Strings shorter than their allocated space and unions may also cause problems in
comparison.
-
+
7.21.4.2 The strcmp function
272) Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to +
272) Like other function-like macros in Standard libraries, each type-generic macro can be suppressed to make available the corresponding ordinary function. - -
273) If the type of the argument is not compatible with the type of the parameter for the selected function, + +
273) If the type of the argument is not compatible with the type of the parameter for the selected function,
the behavior is undefined.
-
+
7.23 Date and time
@@ -16246,8 +16246,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Saving Time is not in effect, and negative if the information is not available.
274) The range [0, 60] for tm_sec allows for a positive leap second. - +
274) The range [0, 60] for tm_sec allows for a positive leap second.
+
7.23.2 Time manipulation functions
@@ -16270,9 +16270,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
returns the value (clock_t)(-1).275)
275) In order to measure the time spent in a program, the clock function should be called at the start of +
275) In order to measure the time spent in a program, the clock function should be called at the start of
the program and its return value subtracted from the value returned by subsequent calls.
-
+
7.23.2.2 The difftime function
276) Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that +
276) Thus, a positive or zero value for tm_isdst causes the mktime function to presume initially that
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.
-
+
7.23.2.4 The time function
277) See ''future library directions'' (7.26.12). - -
278) wchar_t and wint_t can be the same integer type. - -
279) The value of the macro WEOF may differ from that of EOF and need not be negative. - +
277) See ''future library directions'' (7.26.12). + +
278) wchar_t and wint_t can be the same integer type. + +
279) The value of the macro WEOF may differ from that of EOF and need not be negative.
+
7.24.2 Formatted wide character input/output functions
@@ -16706,8 +16706,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 point after the actions associated with each specifier.280)
280) The fwprintf functions perform writes to memory for the %n specifier. - +
280) The fwprintf functions perform writes to memory for the %n specifier.
+
7.24.2.1 The fwprintf function
281) Note that 0 is taken as a flag, not as the beginning of a field width. - -
282) The results of all floating conversions of a negative zero, and of negative values that round to zero, +
281) Note that 0 is taken as a flag, not as the beginning of a field width. + +
282) The results of all floating conversions of a negative zero, and of negative values that round to zero, include a minus sign. - -
283) When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual + +
283) When applied to infinite and NaN values, the -, +, and space flag wide characters have their usual meaning; the # and 0 flag wide characters have no effect. - -
284) Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide + +
284) Binary implementations can choose the hexadecimal digit to the left of the decimal-point wide character so that subsequent digits align to nibble (4-bit) boundaries. - -
285) The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is + +
285) The precision p is sufficient to distinguish values of the source type if 16 p-1 > b n where b is FLT_RADIX and n is the number of base-b digits in the significand of the source type. A smaller p might suffice depending on the implementation's scheme for determining the digit to the left of the decimal-point wide character. - -
286) See ''future library directions'' (7.26.12). - -
287) For binary-to-decimal conversion, the result format's values are the numbers representable with the + +
286) See ''future library directions'' (7.26.12). + +
287) 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.
-
+
7.24.2.2 The fwscanf function
288) These white-space wide characters are not counted against a specified field width. - -
289) fwscanf pushes back at most one input wide character onto the input stream. Therefore, some +
288) These white-space wide characters are not counted against a specified field width. + +
289) fwscanf pushes back at most one input wide character onto the input stream. Therefore, some sequences that are acceptable to wcstod, wcstol, etc., are unacceptable to fwscanf. - -
290) See ''future library directions'' (7.26.12). - + +
290) See ''future library directions'' (7.26.12).
+
7.24.2.3 The swprintf function
291) As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf +
291) As the functions vfwprintf, vswprintf, vfwscanf, vwprintf, vwscanf, and vswscanf
invoke the va_arg macro, the value of arg after the return is indeterminate.
-
+
7.24.2.6 The vfwscanf function
292) An end-of-file and a read error can be distinguished by use of the feof and ferror functions. +
292) An end-of-file and a read error can be distinguished by use of the feof and ferror functions.
Also, errno will be set to EILSEQ by input/output functions only if an encoding error occurs.
-
+
7.24.3.2 The fgetws function
293) If the orientation of the stream has already been determined, fwide does not change it. - +
293) If the orientation of the stream has already been determined, fwide does not change it.
+
7.24.3.6 The getwc function
294) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by +
294) It is unspecified whether a minus-signed sequence is converted to a negative number directly or by negating the value resulting from converting the corresponding unsigned sequence (see F.5); 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. - -
295) An implementation may use the n-wchar sequence to determine extra information to be represented in + +
295) An implementation may use the n-wchar sequence to determine extra information to be represented in the NaN's significand. - -
296) DECIMAL_DIG, defined in <float.h>, should be sufficiently large that L and U will usually round + +
296) DECIMAL_DIG, defined in <float.h>, 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.
-
+
7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions
297) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the +
297) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the
result will not be null-terminated.
-
+
7.24.4.2.3 The wmemcpy function
298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is +
298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is
wcslen(s1)+n+1.
-
+
7.24.4.4 Wide string comparison functions
@@ -18474,10 +18474,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
299) Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and +
299) Thus, a particular mbstate_t object can be used, for example, with both the mbrtowc and
mbsrtowcs functions as long as they are used to step sequentially through the same multibyte
character string.
-
+
7.24.6.1 Single-byte/wide character conversion functions
@@ -18616,9 +18616,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
300) When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a +
300) When n has at least the value of the MB_CUR_MAX macro, this case can only occur if s points at a
sequence of redundant shift sequences (for implementations with state-dependent encodings).
-
+
7.24.6.3.3 The wcrtomb function
301) Thus, the value of len is ignored if dst is a null pointer. - +
301) Thus, the value of len is ignored if dst is a null pointer.
+
7.24.6.4.2 The wcsrtombs function
302) If conversion stops because a terminating null wide character has been reached, the bytes stored +
302) If conversion stops because a terminating null wide character has been reached, the bytes stored
include those necessary to reach the initial shift state immediately before the null byte.
-
+
7.25 Wide character classification and mapping utilities
@@ -18794,8 +18794,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
303) See ''future library directions'' (7.26.13). - +
303) See ''future library directions'' (7.26.13).
+
7.25.2 Wide character classification utilities
@@ -18820,11 +18820,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
Forward references: the wctob function (7.24.6.1.2).
304) For example, if the expression isalpha(wctob(wc)) evaluates to true, then the call +
304) 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.
-
+
7.25.2.1.1 The iswalnum function
305) The functions iswlower and iswupper test true or false separately for each of these additional +
305) The functions iswlower and iswupper test true or false separately for each of these additional
wide characters; all four combinations are possible.
-
+
7.25.2.1.3 The iswblank function
306) Note that the behavior of the iswgraph and iswpunct functions may differ from their +
306) Note that the behavior of the iswgraph and iswpunct functions may differ from their
corresponding functions in 7.4.1 with respect to printing, white-space, single-byte execution
characters other than ' '.
-
+
7.25.2.1.7 The iswlower function
307) ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit +
307) ''Extended'' is IEC 60559's double-extended data format. Extended refers to both the common 80-bit and quadruple 128-bit IEC 60559 formats. - -
308) A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include + +
308) A non-IEC 60559 long double type is required to provide infinity and NaNs, as its values include
all double values.
-
+
F.2.1 Infinities, signed zeros, and NaNs
@@ -20950,9 +20950,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 functions in <math.h> provide designations for IEC 60559 NaNs and infinities.
309) Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are +
309) Since NaNs created by IEC 60559 operations are always quiet, quiet NaNs (along with infinities) are
sufficient for closure of the arithmetic.
-
+
F.3 Operators and functions
@@ -21041,12 +21041,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 exception is unspecified.310)
310) ANSI/IEEE 854, but not IEC 60559 (ANSI/IEEE 754), directly specifies that floating-to-integer +
310) 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
<math.h>.
-
+
F.5 Binary-decimal conversion
@@ -21070,11 +21070,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
311) If the minimum-width IEC 60559 extended format (64 bits of precision) is supported, +
311) If the minimum-width IEC 60559 extended format (64 bits of precision) is supported,
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.)
-
+
F.6 Contracted expressions
@@ -21095,8 +21095,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 implementation supports them.312)
312) This specification does not require dynamic rounding precision nor trap enablement modes. - +
312) This specification does not require dynamic rounding precision nor trap enablement modes.
+
F.7.1 Environment management
@@ -21107,10 +21107,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 which respect sequence points.313)
313) If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating- +
313) 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 F.8).
-
+
F.7.2 Translation
@@ -21132,11 +21132,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 proceed with the translation of the program.
314) As floating constants are converted to appropriate internal representations at translation time, their +
314) As floating constants are converted to appropriate internal representations at translation time, their
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.
-
+
F.7.3 Execution
@@ -21180,14 +21180,14 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
315) Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0 +
315) Where the state for the FENV_ACCESS pragma is ''on'', results of inexact expressions like 1.0/3.0
are affected by rounding modes set at execution time, and expressions such as 0.0/0.0 and
1.0/0.0 generate execution-time floating-point exceptions. The programmer can achieve the
efficiency of translation-time evaluation through static initialization, such as
const static double one_third = 1.0/3.0;
-
+
F.7.5 Initialization
@@ -21227,13 +21227,13 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
316) Use of float_t and double_t variables increases the likelihood of translation-time computation. +
316) Use of float_t and double_t variables increases the likelihood of translation-time computation.
For example, the automatic initialization
double_t x = 1.1e75;
could be done at translation time, regardless of the expression evaluation method.
-
+
F.7.6 Changing the environment
@@ -21333,10 +21333,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 (unless rounding is downward).
317) Strict support for signaling NaNs -- not required by this specification -- would invalidate these and +
317) Strict support for signaling NaNs -- not required by this specification -- would invalidate these and other transformations that remove arithmetic operators. - -
318) IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities. + +
318) IEC 60559 prescribes a signed zero to preserve mathematical identities across certain discontinuities.
Examples include:
@@ -21346,7 +21346,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
conj(csqrt(z)) is csqrt(conj(z)),
for complex z.
-
+F.8.3 Relational operators
@@ -21413,8 +21413,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 point exception when converted to the semantic type of the operation.
319) 0 - 0 yields -0 instead of +0 just when the rounding direction is downward. - +
319) 0 - 0 yields -0 instead of +0 just when the rounding direction is downward.
+
F.9 Mathematics
@@ -21472,12 +21472,12 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 for the sign.
320) IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on +
320) IEC 60559 allows different definitions of underflow. They all result in the same values, but differ on when the floating-point exception is raised. - -
321) It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if + +
321) It is intended that undeserved ''underflow'' and ''inexact'' floating-point exceptions are raised only if
avoiding them would be too costly.
-
+
F.9.1 Trigonometric functions
@@ -21526,9 +21526,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
322) atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise +
322) atan2(0, 0) does not raise the ''invalid'' floating-point exception, nor does atan2( y , 0) raise
the ''divide-by-zero'' floating-point exception.
-
+
F.9.1.5 The cos functions
@@ -22009,9 +22009,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 isnan(y)) ? x : y; }
323) Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would +
323) Ideally, fmax would be sensitive to the sign of zero, for example fmax(-0.0, +0.0) would
return +0; however, implementation in software might be impractical.
-
+
F.9.9.3 The fmin functions
@@ -22093,8 +22093,8 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 imaginary zero.
324) See 6.3.1.2.
+
G.4.3 Imaginary and complex
@@ -22290,9 +22290,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
325) These properties are already implied for those cases covered in the tables, but are required for all cases +
325) These properties are already implied for those cases covered in the tables, but are required for all cases
(at least where the state for CX_LIMITED_RANGE is ''off'').
-
+
G.5.2 Additive operators
326) As noted in G.3, a complex value with at least one infinite part is regarded as an infinity even if its +
326) As noted in G.3, a complex value with at least one infinite part is regarded as an infinity even if its
other part is a NaN.
-
+
G.6.1 Trigonometric functions
@@ -22602,9 +22602,9 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007
the parts of the result, and may raise spurious exceptions.327)
327) This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding +
327) This allows cpow( z , c ) to be implemented as cexp(c clog( z )) without precluding
implementations that treat special cases more carefully.
-
+
G.6.4.2 The csqrt functions