X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=n1256.html;h=62616832b2196500d1ed25a811a2c1b30abf020c;hb=e0dad195ae10aa54dbb0e9f4c65562ccdf423ea4;hp=d92365c44ad3e1341c15c26c6293ccd8f0aa3177;hpb=17cf8804ce9a599dd8c41bf83515a2068ccc01f3;p=c-standard diff --git a/n1256.html b/n1256.html index d92365c..6261683 100644 --- a/n1256.html +++ b/n1256.html @@ -310,11 +310,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -[page ix] (Contents) +[page ix] (Contents) -[page x] (Contents) +[page x] (Contents) Foreword 1 ISO (the International Organization for Standardization) and IEC (the International @@ -355,7 +355,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -- the long long int type and library functions -[page xi] (Contents) +[page xi] (Contents) -- increased minimum translation limits -- additional floating-point characteristics in <float.h> @@ -390,7 +390,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -- empty macro arguments -[page xii] (Contents) +[page xii] (Contents) -- new structure type compatibility rules (tag compatibility) -- additional predefined macro names @@ -415,7 +415,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -[page xiii] (Contents) +[page xiii] (Contents) Introduction 1 With the introduction of new devices and extended character sets, new features may be @@ -444,7 +444,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -[page xiv] (Contents) +[page xiv] (Contents) @@ -455,7 +455,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 1. Scope 1 This International Standard specifies the form and establishes the interpretation of - programs written in the C programming language.1) It specifies + programs written in the C programming language.1) It specifies -- the representation of C programs; -- the syntax and constraints of the C language; -- the semantic rules for interpreting C programs; @@ -474,10 +474,10 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 specific data-processing system or the capacity of a particular processor; - 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. -[page 1] (Contents) +[page 1] (Contents) -- all minimal requirements of a data-processing system that is capable of supporting a conforming implementation. @@ -508,7 +508,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -[page 2] (Contents) +[page 2] (Contents) 3. Terms, definitions, and symbols @@ -553,7 +553,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 implementation documents -[page 3] (Contents) +[page 3] (Contents) 2 EXAMPLE An example of locale-specific behavior is whether the islower function returns true for characters other than the 26 lowercase Latin letters. @@ -601,7 +601,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 1 character single-byte character <C> bit representation that fits in a byte -[page 4] (Contents) +[page 4] (Contents) 3.7.2 1 multibyte character @@ -642,7 +642,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 region of data storage in the execution environment, the contents of which can represent values -[page 5] (Contents) +[page 5] (Contents) 2 NOTE When referenced, an object may be interpreted as having a particular type; see 6.3.2.1. @@ -685,7 +685,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 -[page 6] (Contents) +[page 6] (Contents) 4. Conformance @@ -703,7 +703,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 containing a #error preprocessing directive unless it is part of a group skipped by conditional inclusion. 5 A strictly conforming program shall use only those features of the language and library - specified in this International Standard.2) It shall not produce output dependent on any + specified in this International Standard.2) It shall not produce output dependent on any unspecified, undefined, or implementation-defined behavior, and shall not exceed any minimum implementation limit. 6 The two forms of conforming implementation are hosted and freestanding. A conforming @@ -714,11 +714,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 <iso646.h>, <limits.h>, <stdarg.h>, <stdbool.h>, <stddef.h>, and <stdint.h>. A conforming implementation may have extensions (including additional library functions), provided they do not alter the behavior of any strictly conforming - program.3) + program.3) - 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: #ifdef __STDC_IEC_559__ /* FE_UPWARD defined */ /* ... */ @@ -726,12 +726,12 @@ 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. -[page 7] (Contents) +[page 7] (Contents) -7 A conforming program is one that is acceptable to a conforming implementation.4) +7 A conforming program is one that is acceptable to a conforming implementation.4) 8 An implementation shall be accompanied by a document that defines all implementation- defined and locale-specific characteristics and all extensions. Forward references: conditional inclusion (6.10.1), error directive (6.10.5), @@ -743,11 +743,11 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 - 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. -[page 8] (Contents) +[page 8] (Contents) 5. Environment @@ -775,7 +775,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 preprocessing directives (6.10). 5.1.1.2 Translation phases 1 The precedence among the syntax rules of translation is specified by the following - phases.5) + phases.5) 1. Physical source file multibyte characters are mapped, in an implementation- defined manner, to the source character set (introducing new-line characters for end-of-line indicators) if necessary. Trigraph sequences are replaced by @@ -783,13 +783,13 @@ 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. -[page 9] (Contents) +[page 9] (Contents) 2. Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. @@ -797,7 +797,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 of such a splice. A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place. - 3. The source file is decomposed into preprocessing tokens6) and sequences of + 3. The source file is decomposed into preprocessing tokens6) and sequences of white-space characters (including comments). A source file shall not end in a partial preprocessing token or in a partial comment. Each comment is replaced by one space character. New-line characters are retained. Whether each nonempty @@ -812,7 +812,7 @@ WG14/N1256 Committee Draft -- Septermber 7, 2007 5. Each source character set member and escape sequence in character constants and string literals is converted to the corresponding member of the execution character set; if there is no corresponding member, it is converted to an implementation- - defined member other than the null (wide) character.7) + defined member other than the null (wide) character.7) 6. Adjacent string literal tokens are concatenated. 7. White-space characters separating tokens are no longer significant. Each preprocessing token is converted into a token. The resulting tokens are @@ -826,19 +826,19 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 10] (Contents) +[page 10] (Contents) 5.1.1.3 Diagnostics 1 A conforming implementation shall produce at least one diagnostic message (identified in an implementation-defined manner) if a preprocessing translation unit or translation unit contains a violation of any syntax rule or constraint, even if the behavior is also explicitly specified as undefined or implementation-defined. Diagnostic messages need not be - produced in other circumstances.8) + produced in other circumstances.8) 2 EXAMPLE An implementation shall issue a diagnostic for the translation unit: char i; int i; @@ -867,11 +867,11 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 11] (Contents) +[page 11] (Contents) 5.1.2.2.1 Program startup 1 The function called at program startup is named main. The implementation declares no @@ -881,7 +881,7 @@ preprocessing directives (6.10), trigraph sequences (9) or in some other implementation-defined manner. 2 If they are declared, the parameters to the main function shall obey the following constraints: -- The value of argc shall be nonnegative. @@ -907,15 +907,15 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 12] (Contents) +[page 12] (Contents) 5.1.2.2.3 Program termination 1 If the return type of the main function is a type compatible with int, a return from the initial call to the main function is equivalent to calling the exit function with the value - returned by the main function as its argument;10) reaching the } that terminates the + returned by the main function as its argument;10) reaching the } that terminates the main function returns a value of 0. If the return type is not compatible with int, the termination status returned to the host environment is unspecified. Forward references: definition of terms (7.1.1), the exit function (7.20.4.3). @@ -923,11 +923,11 @@ preprocessing directives (6.10), trigraph sequences (11) which are changes in the state of the execution environment. Evaluation of an expression may produce side effects. At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations - shall have taken place. (A summary of the sequence points is given in annex C.) + shall have taken place. (A summary of the sequence points is given in annex C.) 3 In the abstract machine, all expressions are evaluated as specified by the semantics. An actual implementation need not evaluate part of an expression if it can deduce that its value is not used and that no needed side effects are produced (including any caused by @@ -943,16 +943,16 @@ preprocessing directives (6.10), trigraph sequences (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. - 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 + 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. -[page 13] (Contents) +[page 13] (Contents) -- At program termination, all data written into files shall be identical to the result that execution of the program according to the abstract semantics would have produced. @@ -993,12 +993,12 @@ preprocessing directives (6.10), trigraph sequences (2.0, which has type double). + were replaced by the constant 2.0, which has type double). -[page 14] (Contents) +[page 14] (Contents) 12 EXAMPLE 4 Implementations employing wide registers have to take care to honor appropriate semantics. Values are independent of whether they are represented in a register or in memory. For @@ -1021,8 +1021,8 @@ preprocessing directives (6.10), trigraph sequences (1.0 + y); - y = x / 5.0; // not equivalent to y = x * 0.2; + z = x + x * y; // not equivalent to z = x * (1.0 + y); + y = x / 5.0; // not equivalent to y = x * 0.2; 14 EXAMPLE 6 To illustrate the grouping behavior of expressions, in the following fragment int a, b; @@ -1048,7 +1048,7 @@ preprocessing directives (6.10), trigraph sequences (page 15] (Contents) +[page 15] (Contents) 15 EXAMPLE 7 The grouping of an expression does not completely determine its evaluation. In the following fragment @@ -1069,7 +1069,7 @@ preprocessing directives (6.10), trigraph sequences (page 16] (Contents) +[page 16] (Contents) 5.2 Environmental considerations 5.2.1 Character sets @@ -1108,7 +1108,7 @@ preprocessing directives (6.10), trigraph sequences (page 17] (Contents) +[page 17] (Contents) converted to a token), the behavior is undefined. 4 A letter is an uppercase letter or a lowercase letter as defined above; in this International @@ -1118,7 +1118,7 @@ preprocessing directives (6.10), trigraph sequences (6.10), string literals (6.4.5), comments (6.4.9), string (7.1.1). 5.2.1.1 Trigraph sequences 1 Before any other processing takes place, each occurrence of one of the following - sequences of three characters (called trigraph sequences12)) is replaced with the + sequences of three characters (called trigraph sequences12)) is replaced with the corresponding single character. ??= # ??) ] ??! | ??( [ ??' ^ ??> } @@ -1145,10 +1145,10 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 18] (Contents) +[page 18] (Contents) -- A multibyte character set may have a state-dependent encoding, wherein each sequence of multibyte characters begins in an initial shift state and enters other @@ -1186,7 +1186,7 @@ preprocessing directives (6.10), trigraph sequences (page 19] (Contents) +[page 19] (Contents) tabulation position, the behavior of the display device is unspecified. 3 Each of these escape sequences shall produce a unique implementation-defined value @@ -1208,7 +1208,7 @@ preprocessing directives (6.10), trigraph sequences ( 5.2.4.1 Translation limits 1 The implementation shall be able to translate and execute at least one program that - contains at least one instance of every one of the following limits:13) + contains at least one instance of every one of the following limits:13) -- 127 nesting levels of blocks -- 63 nesting levels of conditional inclusion -- 12 pointer, array, and function declarators (in any combinations) modifying an @@ -1222,13 +1222,13 @@ preprocessing directives (6.10), trigraph sequences (13) Implementations should avoid imposing fixed translation limits whenever possible. -[page 20] (Contents) +[page 20] (Contents) universal character name specifying a short identifier of 00010000 or more is considered 10 characters, and each extended source character is considered the same - number of characters as the corresponding universal character name, if any)14) + number of characters as the corresponding universal character name, if any)14) -- 4095 external identifiers in one translation unit -- 511 identifiers with block scope declared in one block -- 4095 macro identifiers simultaneously defined in one preprocessing translation unit @@ -1258,9 +1258,9 @@ preprocessing directives (6.10), trigraph sequences (6.11.3). + 14) See ''future language directions'' (6.11.3). -[page 21] (Contents) +[page 21] (Contents) (absolute value) to those shown, with the same sign. -- number of bits for smallest object that is not a bit-field (byte) @@ -1297,7 +1297,7 @@ preprocessing directives (6.10), trigraph sequences (page 22] (Contents) +[page 22] (Contents) -- minimum value for an object of type long long int LLONG_MIN -9223372036854775807 // -(263 - 1) @@ -1309,12 +1309,12 @@ preprocessing directives (6.10), trigraph sequences (15) The value UCHAR_MAX shall equal 2CHAR_BIT - 1. Forward references: representations of types (6.2.6), conditional inclusion (6.10.1). 5.2.4.2.2 Characteristics of floating types <float.h> 1 The characteristics of floating types are defined in terms of a model that describes a representation of floating-point numbers and values that provide information about an - implementation's floating-point arithmetic.16) The following parameters are used to + implementation's floating-point arithmetic.16) The following parameters are used to define the model for each floating-point type: s sign ((+-)1) b base or radix of exponent representation (an integer > 1) @@ -1336,13 +1336,13 @@ preprocessing directives (6.10), trigraph sequences (6.2.5. - 16) The floating-point model is intended to clarify the description of each floating-point characteristic and + 15) See 6.2.5. + 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. -[page 23] (Contents) +[page 23] (Contents) - arithmetic operand.17) + arithmetic operand.17) 4 An implementation may give zero and non-numeric values (such as infinities and NaNs) a sign or may leave them unsigned. Wherever such values are unsigned, any requirement in this International Standard to retrieve the sign shall produce an unspecified sign, and @@ -1360,7 +1360,7 @@ preprocessing directives (6.10), trigraph sequences (18) -1 indeterminable 0 toward zero 1 to nearest @@ -1372,17 +1372,17 @@ preprocessing directives (6.10), trigraph sequences (19) - 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>. -[page 24] (Contents) +[page 24] (Contents) -1 indeterminable; 0 evaluate all operations and constants just to the range and precision of the @@ -1418,12 +1418,12 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 25] (Contents) +[page 25] (Contents) ??? p log10 b if b is a power of 10 ??? @@ -1462,7 +1462,7 @@ preprocessing directives (6.10), trigraph sequences (page 26] (Contents) +[page 26] (Contents) FLT_EPSILON 1E-5 DBL_EPSILON 1E-9 @@ -1494,7 +1494,7 @@ preprocessing directives (6.10), trigraph sequences (20) and the appropriate values in a <float.h> header for types float and double: 24 x f = s2e (Sum) f k 2-k , @@ -1513,10 +1513,10 @@ preprocessing directives (6.10), trigraph sequences (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. -[page 27] (Contents) +[page 27] (Contents) FLT_DIG 6 FLT_MIN_EXP -125 @@ -1551,7 +1551,7 @@ Forward references: conditional inclusion (6.10.1), -[page 28] (Contents) +[page 28] (Contents) 6. Language @@ -1565,7 +1565,7 @@ Forward references: conditional inclusion (6.10.1), indicates an optional expression enclosed in braces. 2 When syntactic categories are referred to in the main text, they are not italicized and words are separated by spaces instead of hyphens. -3 A summary of the language syntax is given in annex A. +3 A summary of the language syntax is given in annex A. 6.2 Concepts 6.2.1 Scopes of identifiers 1 An identifier can denote an object; a function; a tag or a member of a structure, union, or @@ -1590,7 +1590,7 @@ Forward references: conditional inclusion (6.10.1), declares the identifier appears inside a block or within the list of parameter declarations in a function definition, the identifier has block scope, which terminates at the end of the associated block. If the declarator or type specifier that declares the identifier appears -[page 29] (Contents) +[page 29] (Contents) within the list of parameter declarations in a function prototype (not part of a function definition), the identifier has function prototype scope, which terminates at the end of the @@ -1614,7 +1614,7 @@ Forward references: conditional inclusion (6.10.1), source file inclusion (6.10.2), statements (6.8). 6.2.2 Linkages of identifiers 1 An identifier declared in different scopes or in the same scope more than once can be - made to refer to the same object or function by a process called linkage.21) There are + made to refer to the same object or function by a process called linkage.21) There are three kinds of linkage: external, internal, and none. 2 In the set of translation units and libraries that constitutes an entire program, each declaration of a particular identifier with external linkage denotes the same object or @@ -1622,18 +1622,18 @@ Forward references: conditional inclusion (6.10.1), linkage denotes the same object or function. Each declaration of an identifier with no linkage denotes a unique entity. 3 If the declaration of a file scope identifier for an object or a function contains the storage- - class specifier static, the identifier has internal linkage.22) + class specifier static, the identifier has internal linkage.22) 4 For an identifier declared with the storage-class specifier extern in a scope in which a - 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. + 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. -[page 30] (Contents) +[page 30] (Contents) - prior declaration of that identifier is visible,23) if the prior declaration specifies internal or + prior declaration of that identifier is visible,23) if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage. @@ -1653,7 +1653,7 @@ Forward references: conditional inclusion (6.10.1), translation unit, the syntactic context disambiguates uses that refer to different entities. Thus, there are separate name spaces for various categories of identifiers, as follows: -- label names (disambiguated by the syntax of the label declaration and use); - -- the tags of structures, unions, and enumerations (disambiguated by following any24) + -- the tags of structures, unions, and enumerations (disambiguated by following any24) of the keywords struct, union, or enum); -- the members of structures or unions; each structure or union has a separate name space for its members (disambiguated by the type of the expression used to access the @@ -1667,17 +1667,17 @@ Forward references: conditional inclusion (6.10.1), - 23) As specified in 6.2.1, the later declaration might hide the prior declaration. - 24) There is only one name space for tags even though three are possible. + 23) As specified in 6.2.1, the later declaration might hide the prior declaration. + 24) There is only one name space for tags even though three are possible. -[page 31] (Contents) +[page 31] (Contents) 6.2.4 Storage durations of objects 1 An object has a storage duration that determines its lifetime. There are three storage durations: static, automatic, and allocated. Allocated storage is described in 7.20.3. 2 The lifetime of an object is the portion of program execution during which storage is - guaranteed to be reserved for it. An object exists, has a constant address,25) and retains - its last-stored value throughout its lifetime.26) If an object is referred to outside of its + guaranteed to be reserved for it. An object exists, has a constant address,25) and retains + its last-stored value throughout its lifetime.26) If an object is referred to outside of its lifetime, the behavior is undefined. The value of a pointer becomes indeterminate when the object it points to reaches the end of its lifetime. 3 An object whose identifier is declared with external or internal linkage, or with the @@ -1696,7 +1696,7 @@ Forward references: conditional inclusion (6.10.1), time the declaration is reached. 6 For such an object that does have a variable length array type, its lifetime extends from the declaration of the object until execution of the program leaves the scope of the - declaration.27) If the scope is entered recursively, a new instance of the object is created + declaration.27) If the scope is entered recursively, a new instance of the object is created each time. The initial value of the object is indeterminate. Forward references: statements (6.8), function calls (6.5.2.2), declarators (6.7.5), array declarators (6.7.5.2), initialization (6.7.8). @@ -1704,14 +1704,14 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 32] (Contents) +[page 32] (Contents) 6.2.5 Types 1 The meaning of a value stored in an object or returned by a function is determined by the @@ -1729,8 +1729,8 @@ Forward references: conditional inclusion (6.10.1), 4 There are five standard signed integer types, designated as signed char, short int, int, long int, and long long int. (These and other types may be designated in several additional ways, as described in 6.7.2.) There may also be - implementation-defined extended signed integer types.28) The standard and extended - signed integer types are collectively called signed integer types.29) + implementation-defined extended signed integer types.28) The standard and extended + signed integer types are collectively called signed integer types.29) 5 An object declared as type signed char occupies the same amount of storage as a ''plain'' char object. A ''plain'' int object has the natural size suggested by the architecture of the execution environment (large enough to contain any value in the range @@ -1742,18 +1742,18 @@ Forward references: conditional inclusion (6.10.1), types are the standard unsigned integer types. The unsigned integer types that correspond to the extended signed integer types are the extended unsigned integer types. The standard and extended unsigned integer types are collectively called unsigned integer - types.30) + types.30) - 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. -[page 33] (Contents) +[page 33] (Contents) 7 The standard signed integer types and standard unsigned integer types are collectively called the standard integer types, the extended signed integer types and extended @@ -1763,16 +1763,16 @@ Forward references: conditional inclusion (6.10.1), subrange of the values of the other type. 9 The range of nonnegative values of a signed integer type is a subrange of the corresponding unsigned integer type, and the representation of the same value in each - type is the same.31) A computation involving unsigned operands can never overflow, + type is the same.31) A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type. 10 There are three real floating types, designated as float, double, and long - double.32) The set of values of the type float is a subset of the set of values of the + double.32) The set of values of the type float is a subset of the set of values of the type double; the set of values of the type double is a subset of the set of values of the type long double. 11 There are three complex types, designated as float _Complex, double - _Complex, and long double _Complex.33) The real floating and complex types + _Complex, and long double _Complex.33) The real floating and complex types are collectively called the floating types. 12 For each floating type there is a corresponding real type, which is always a real floating type. For real floating types, it is the same type. For complex types, it is the type given @@ -1783,22 +1783,22 @@ Forward references: conditional inclusion (6.10.1), number. 14 The type char, the signed and unsigned integer types, and the floating types are collectively called the basic types. Even if the implementation defines two or more basic - types to have the same representation, they are nevertheless different types.34) + types to have the same representation, they are nevertheless different types.34) - 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. -[page 34] (Contents) +[page 34] (Contents) 15 The three types char, signed char, and unsigned char are collectively called the character types. The implementation shall define char to have the same range, - representation, and behavior as either signed char or unsigned char.35) + representation, and behavior as either signed char or unsigned char.35) 16 An enumeration comprises a set of named integer constant values. Each distinct enumeration constitutes a different enumerated type. 17 The type char, the signed and unsigned integer types, and the enumerated types are @@ -1812,7 +1812,7 @@ Forward references: conditional inclusion (6.10.1), 20 Any number of derived types can be constructed from the object, function, and incomplete types, as follows: -- An array type describes a contiguously allocated nonempty set of objects with a - particular member object type, called the element type.36) Array types are + particular member object type, called the element type.36) Array types are characterized by their element type and by the number of elements in the array. An array type is said to be derived from its element type, and if its element type is T , the array type is sometimes called ''array of T ''. The construction of an array type from @@ -1830,12 +1830,12 @@ Forward references: conditional inclusion (6.10.1), - 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. + 36) Since object types do not include incomplete types, an array of incomplete type cannot be constructed. -[page 35] (Contents) +[page 35] (Contents) -- A pointer type may be derived from a function type, an object type, or an incomplete type, called the referenced type. A pointer type describes an object whose value @@ -1844,7 +1844,7 @@ Forward references: conditional inclusion (6.10.1), pointer type from a referenced type is called ''pointer type derivation''. These methods of constructing derived types can be applied recursively. 21 Arithmetic types and pointer types are collectively called scalar types. Array and - structure types are collectively called aggregate types.37) + structure types are collectively called aggregate types.37) 22 An array type of unknown size is an incomplete type. It is completed, for an identifier of that type, by specifying the size in a later declaration (with internal or external linkage). A structure or union type of unknown content (as described in 6.7.2.3) is an incomplete @@ -1860,23 +1860,23 @@ Forward references: conditional inclusion (6.10.1), derived type (as noted above in the construction of derived types), or the type itself if the type consists of no derived types. 26 Any type so far mentioned is an unqualified type. Each unqualified type has several - qualified versions of its type,38) corresponding to the combinations of one, two, or all + qualified versions of its type,38) corresponding to the combinations of one, two, or all three of the const, volatile, and restrict qualifiers. The qualified or unqualified versions of a type are distinct types that belong to the same type category and have the - same representation and alignment requirements.39) A derived type is not qualified by the + same representation and alignment requirements.39) A derived type is not qualified by the qualifiers (if any) of the type from which it is derived. 27 A pointer to void shall have the same representation and alignment requirements as a pointer to a character type.39) Similarly, pointers to qualified or unqualified versions of compatible types shall have the same representation and alignment requirements. All - 37) Note that aggregate type does not include union type because an object with union type can only + 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. -[page 36] (Contents) +[page 36] (Contents) pointers to structure types shall have the same representation and alignment requirements as each other. All pointers to union types shall have the same representation and @@ -1899,7 +1899,7 @@ Forward references: conditional inclusion (6.10.1), the number, order, and encoding of which are either explicitly specified or implementation-defined. 3 Values stored in unsigned bit-fields and objects of type unsigned char shall be - represented using a pure binary notation.40) + represented using a pure binary notation.40) 4 Values stored in non-bit-field objects of any other object type consist of n x CHAR_BIT bits, where n is the size of an object of that type, in bytes. The value may be copied into an object of type unsigned char [n] (e.g., by memcpy); the resulting set of bytes is @@ -1912,9 +1912,9 @@ Forward references: conditional inclusion (6.10.1), value of an object has such a representation and is read by an lvalue expression that does not have character type, the behavior is undefined. If such a representation is produced by a side effect that modifies all or any part of the object by an lvalue expression that - does not have character type, the behavior is undefined.41) Such a representation is called + does not have character type, the behavior is undefined.41) Such a representation is called - 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 @@ -1922,19 +1922,19 @@ Forward references: conditional inclusion (6.10.1), CHAR_BIT - 1. -[page 37] (Contents) +[page 37] (Contents) a trap representation. 6 When a value is stored in an object of structure or union type, including in a member object, the bytes of the object representation that correspond to any padding bytes take - unspecified values.42) The value of a structure or union object is never a trap + unspecified values.42) The value of a structure or union object is never a trap representation, even though the value of a member of the structure or union object may be a trap representation. 7 When a value is stored in a member of an object of union type, the bytes of the object representation that do not correspond to that member but do correspond to other members take unspecified values. 8 Where an operator is applied to a value that has more than one object representation, - which object representation is used shall not affect the value of the result.43) Where a + which object representation is used shall not affect the value of the result.43) Where a value is stored in an object using a type that has more than one object representation for that value, it is unspecified which representation is used, but a trap representation shall not be generated. @@ -1946,25 +1946,25 @@ Forward references: conditional inclusion (6.10.1), not be any of the latter). If there are N value bits, each bit shall represent a different power of 2 between 1 and 2 N -1 , so that objects of that type shall be capable of representing values from 0 to 2 N - 1 using a pure binary representation; this shall be - known as the value representation. The values of any padding bits are unspecified.44) + known as the value representation. The values of any padding bits are unspecified.44) 2 For signed integer types, the bits of the object representation shall be divided into three groups: value bits, padding bits, and the sign bit. There need not be any padding bits; - 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. - 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. -[page 38] (Contents) +[page 38] (Contents) there shall be exactly one sign bit. Each bit that is a value bit shall have the same value as the same bit in the object representation of the corresponding unsigned type (if there are @@ -1988,7 +1988,7 @@ Forward references: conditional inclusion (6.10.1), and whether a negative zero becomes a normal zero when stored in an object. 4 If the implementation does not support negative zeros, the behavior of the &, |, ^, ~, <<, and >> operators with arguments that would produce such a value is undefined. -5 The values of any padding bits are unspecified.45) A valid (non-trap) object representation +5 The values of any padding bits are unspecified.45) A valid (non-trap) object representation of a signed integer type where the sign bit is zero is a valid object representation of the corresponding unsigned type, and shall represent the same value. For any integer type, the object representation where all the bits are zero shall be a representation of the value @@ -1998,19 +1998,19 @@ Forward references: conditional inclusion (6.10.1), including any sign bit; thus for unsigned integer types the two values are the same, while - 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. -[page 39] (Contents) +[page 39] (Contents) for signed integer types the width is one greater than the precision. 6.2.7 Compatible type and composite type 1 Two types have compatible type if their types are the same. Additional rules for determining whether two types are compatible are described in 6.7.2 for type specifiers, - in 6.7.3 for type qualifiers, and in 6.7.5 for declarators.46) Moreover, two structure, + in 6.7.3 for type qualifiers, and in 6.7.5 for declarators.46) Moreover, two structure, union, or enumerated types declared in separate translation units are compatible if their tags and members satisfy the following requirements: If one is declared with a tag, the other shall be declared with the same tag. If both are complete types, then the following @@ -2034,17 +2034,17 @@ Forward references: conditional inclusion (6.10.1), parameters. These rules apply recursively to the types from which the two types are derived. 4 For an identifier with internal or external linkage declared in a scope in which a prior - declaration of that identifier is visible,47) if the prior declaration specifies internal or + declaration of that identifier is visible,47) if the prior declaration specifies internal or external linkage, the type of the identifier at the later declaration becomes the composite type. - 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. -[page 40] (Contents) +[page 40] (Contents) 5 EXAMPLE Given the following two file scope declarations: int f(int (*)(), double (*)[3]); @@ -2055,7 +2055,7 @@ Forward references: conditional inclusion (6.10.1), -[page 41] (Contents) +[page 41] (Contents) 6.3 Conversions 1 Several operators convert operand values from one type to another automatically. This @@ -2092,14 +2092,14 @@ Forward references: conditional inclusion (6.10.1), 2 The following may be used in an expression wherever an int or unsigned int may be used: -[page 42] (Contents) +[page 42] (Contents) -- An object or expression with an integer type whose integer conversion rank is less than or equal to the rank of int and unsigned int. -- A bit-field of type _Bool, int, signed int, or unsigned int. If an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer - promotions.48) All other types are unchanged by the integer promotions. + promotions.48) All other types are unchanged by the integer promotions. 3 The integer promotions preserve value including sign. As discussed earlier, whether a ''plain'' char is treated as signed is implementation-defined. Forward references: enumeration specifiers (6.7.2.2), structure and union specifiers @@ -2112,26 +2112,26 @@ Forward references: conditional inclusion (6.10.1), the value can be represented by the new type, it is unchanged. 2 Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type - until the value is in the range of the new type.49) + until the value is in the range of the new type.49) 3 Otherwise, the new type is signed and the value cannot be represented in it; either the result is implementation-defined or an implementation-defined signal is raised. 6.3.1.4 Real floating and integer 1 When a finite value of real floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero). If the value of - the integral part cannot be represented by the integer type, the behavior is undefined.50) + the integral part cannot be represented by the integer type, the behavior is undefined.50) 2 When a value of integer type is converted to a real floating type, if the value being converted can be represented exactly in the new type, it is unchanged. If the value being converted is in the range of values that can be represented but cannot be represented - 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. - 49) The rules describe arithmetic on the mathematical value, not the value of a given type of expression. - 50) The remaindering operation performed when a value of integer type is converted to unsigned type + 49) The rules describe arithmetic on the mathematical value, not the value of a given type of expression. + 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). -[page 43] (Contents) +[page 43] (Contents) exactly, the result is either the nearest higher or nearest lower representable value, chosen in an implementation-defined manner. If the value being converted is outside the range of @@ -2170,14 +2170,14 @@ Forward references: conditional inclusion (6.10.1), operand is converted, without change of type domain, to a type whose corresponding real type is long double. -[page 44] (Contents) +[page 44] (Contents) Otherwise, if the corresponding real type of either operand is double, the other operand is converted, without change of type domain, to a type whose corresponding real type is double. Otherwise, if the corresponding real type of either operand is float, the other operand is converted, without change of type domain, to a type whose - corresponding real type is float.51) + corresponding real type is float.51) Otherwise, the integer promotions are performed on both operands. Then the following rules are applied to the promoted operands: If both operands have the same type, then no further conversion is needed. @@ -2196,21 +2196,21 @@ Forward references: conditional inclusion (6.10.1), corresponding to the type of the operand with signed integer type. 2 The values of floating operands and of the results of floating expressions may be represented in greater precision and range than that required by the type; the types are not - changed thereby.52) + changed thereby.52) - 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. -[page 45] (Contents) +[page 45] (Contents) 6.3.2 Other operands 6.3.2.1 Lvalues, arrays, and function designators -1 An lvalue is an expression with an object type or an incomplete type other than void;53) +1 An lvalue is an expression with an object type or an incomplete type other than void;53) if an lvalue does not designate an object when it is evaluated, the behavior is undefined. When an object is said to have a particular type, the type is specified by the lvalue used to designate the object. A modifiable lvalue is an lvalue that does not have array type, does @@ -2230,7 +2230,7 @@ Forward references: conditional inclusion (6.10.1), the array object and is not an lvalue. If the array object has register storage class, the behavior is undefined. 4 A function designator is an expression that has function type. Except when it is the - operand of the sizeof operator54) or the unary & operator, a function designator with + operand of the sizeof operator54) or the unary & operator, a function designator with type ''function returning type'' is converted to an expression that has type ''pointer to function returning type''. Forward references: address and indirection operators (6.5.3.2), assignment operators @@ -2239,16 +2239,16 @@ Forward references: conditional inclusion (6.10.1), (6.5.3.1), the sizeof operator (6.5.3.4), structure and union members (6.5.2.3). - 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. -[page 46] (Contents) +[page 46] (Contents) 6.3.2.2 void 1 The (nonexistent) value of a void expression (an expression that has type void) shall not @@ -2264,32 +2264,32 @@ Forward references: conditional inclusion (6.10.1), the q-qualified version of the type; the values stored in the original and converted pointers shall compare equal. 3 An integer constant expression with the value 0, or such an expression cast to type - void *, is called a null pointer constant.55) If a null pointer constant is converted to a + void *, is called a null pointer constant.55) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function. 4 Conversion of a null pointer to another pointer type yields a null pointer of that type. Any two null pointers shall compare equal. 5 An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an - entity of the referenced type, and might be a trap representation.56) + entity of the referenced type, and might be a trap representation.56) 6 Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type. 7 A pointer to an object or incomplete type may be converted to a pointer to a different - object or incomplete type. If the resulting pointer is not correctly aligned57) for the + object or incomplete type. If the resulting pointer is not correctly aligned57) for the pointed-to type, the behavior is undefined. Otherwise, when converted back again, the result shall compare equal to the original pointer. When a pointer to an object is - 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. -[page 47] (Contents) +[page 47] (Contents) converted to a pointer to a character type, the result points to the lowest addressed byte of the object. Successive increments of the result, up to the size of the object, yield pointers @@ -2304,10 +2304,10 @@ Forward references: conditional inclusion (6.10.1), -[page 48] (Contents) +[page 48] (Contents) 6.4 Lexical elements - Syntax + Syntax 1 token: keyword identifier @@ -2322,17 +2322,17 @@ Forward references: conditional inclusion (6.10.1), string-literal punctuator each non-white-space character that cannot be one of the above - Constraints + Constraints 2 Each preprocessing token that is converted to a token shall have the lexical form of a keyword, an identifier, a constant, a string literal, or a punctuator. - Semantics + Semantics 3 A token is the minimal lexical element of the language in translation phases 7 and 8. The categories of tokens are: keywords, identifiers, constants, string literals, and punctuators. A preprocessing token is the minimal lexical element of the language in translation phases 3 through 6. The categories of preprocessing tokens are: header names, identifiers, preprocessing numbers, character constants, string literals, punctuators, and single non-white-space characters that do not lexically match the other preprocessing - token categories.58) If a ' or a " character matches the last category, the behavior is + token categories.58) If a ' or a " character matches the last category, the behavior is undefined. Preprocessing tokens can be separated by white space; this consists of comments (described later), or white-space characters (space, horizontal tab, new-line, vertical tab, and form-feed), or both. As described in 6.10, in certain circumstances @@ -2343,10 +2343,10 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 49] (Contents) +[page 49] (Contents) 4 If the input stream has been parsed into preprocessing tokens up to a given character, the next preprocessing token is the longest sequence of characters that could constitute a @@ -2370,7 +2370,7 @@ Forward references: conditional inclusion (6.10.1), (6.5.3.1), preprocessing directives (6.10), preprocessing numbers (6.4.8), string literals (6.4.5). 6.4.1 Keywords - Syntax + Syntax 1 keyword: one of auto enum restrict unsigned break extern return void @@ -2382,20 +2382,20 @@ Forward references: conditional inclusion (6.10.1), do int switch double long typedef else register union - Semantics + Semantics 2 The above tokens (case sensitive) are reserved (in translation phases 7 and 8) for use as keywords, and shall not be used otherwise. The keyword _Imaginary is reserved for - specifying imaginary types.59) + specifying imaginary types.59) - 59) One possible specification for imaginary types appears in annex G. + 59) One possible specification for imaginary types appears in annex G. -[page 50] (Contents) +[page 50] (Contents) 6.4.2 Identifiers 6.4.2.1 General - Syntax + Syntax 1 identifier: identifier-nondigit identifier identifier-nondigit @@ -2411,13 +2411,13 @@ Forward references: conditional inclusion (6.10.1), N O P Q R S T U V W X Y Z digit: one of 0 1 2 3 4 5 6 7 8 9 - Semantics + Semantics 2 An identifier is a sequence of nondigit characters (including the underscore _, the lowercase and uppercase Latin letters, and other characters) and digits, which designates one or more entities as described in 6.2.1. Lowercase and uppercase letters are distinct. There is no specific limit on the maximum length of an identifier. 3 Each universal character name in an identifier shall designate a character whose encoding - in ISO/IEC 10646 falls into one of the ranges specified in annex D.60) The initial + in ISO/IEC 10646 falls into one of the ranges specified in annex D.60) The initial character shall not be a universal character name designating a digit. An implementation may allow multibyte characters that are not part of the basic source character set to appear in identifiers; which characters and their correspondence to universal character @@ -2427,12 +2427,12 @@ Forward references: conditional inclusion (6.10.1), to a keyword. - 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. -[page 51] (Contents) +[page 51] (Contents) Implementation limits 5 As discussed in 5.2.4.1, an implementation may limit the number of significant initial @@ -2444,11 +2444,11 @@ Forward references: conditional inclusion (6.10.1), identifiers differ only in nonsignificant characters, the behavior is undefined. Forward references: universal character names (6.4.3), macro replacement (6.10.3). 6.4.2.2 Predefined identifiers - Semantics + Semantics 1 The identifier __func__ shall be implicitly declared by the translator as if, immediately following the opening brace of each function definition, the declaration static const char __func__[] = "function-name"; - appeared, where function-name is the name of the lexically-enclosing function.61) + appeared, where function-name is the name of the lexically-enclosing function.61) 2 This name is encoded as if the implicit declaration had been written in the source character set and then translated into the execution character set as indicated in translation phase 5. @@ -2467,56 +2467,56 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 52] (Contents) +[page 52] (Contents) 6.4.3 Universal character names - Syntax + Syntax 1 universal-character-name: \u hex-quad \U hex-quad hex-quad hex-quad: hexadecimal-digit hexadecimal-digit hexadecimal-digit hexadecimal-digit - Constraints + Constraints 2 A universal character name shall not specify a character whose short identifier is less than 00A0 other than 0024 ($), 0040 (@), or 0060 ('), nor one in the range D800 through - DFFF inclusive.62) - Description + DFFF inclusive.62) + Description 3 Universal character names may be used in identifiers, character constants, and string literals to designate characters that are not in the basic character set. - Semantics + Semantics 4 The universal character name \Unnnnnnnn designates the character whose eight-digit - short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.63) Similarly, the universal + short identifier (as specified by ISO/IEC 10646) is nnnnnnnn.63) Similarly, the universal character name \unnnn designates the character whose four-digit short identifier is nnnn (and whose eight-digit short identifier is 0000nnnn). - 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. -[page 53] (Contents) +[page 53] (Contents) 6.4.4 Constants - Syntax + Syntax 1 constant: integer-constant floating-constant enumeration-constant character-constant - Constraints + Constraints 2 Each constant shall have a type and the value of a constant shall be in the range of representable values for its type. - Semantics + Semantics 3 Each constant has a type, determined by its form and value, as detailed later. 6.4.4.1 Integer constants - Syntax + Syntax 1 integer-constant: decimal-constant integer-suffixopt octal-constant integer-suffixopt @@ -2540,7 +2540,7 @@ Forward references: conditional inclusion (6.10.1), -[page 54] (Contents) +[page 54] (Contents) hexadecimal-digit: one of 0 1 2 3 4 5 6 7 8 9 @@ -2557,7 +2557,7 @@ Forward references: conditional inclusion (6.10.1), l L long-long-suffix: one of ll LL - Description + Description 2 An integer constant begins with a digit, but has no period or exponent part. It may have a prefix that specifies its base and a suffix that specifies its type. 3 A decimal constant begins with a nonzero digit and consists of a sequence of decimal @@ -2565,7 +2565,7 @@ Forward references: conditional inclusion (6.10.1), digits 0 through 7 only. A hexadecimal constant consists of the prefix 0x or 0X followed by a sequence of the decimal digits and the letters a (or A) through f (or F) with values 10 through 15 respectively. - Semantics + Semantics 4 The value of a decimal constant is computed base 10; that of an octal constant, base 8; that of a hexadecimal constant, base 16. The lexically first digit is the most significant. 5 The type of an integer constant is the first of the corresponding list in which its value can @@ -2574,7 +2574,7 @@ Forward references: conditional inclusion (6.10.1), -[page 55] (Contents) +[page 55] (Contents) Octal or Hexadecimal Suffix Decimal Constant Constant @@ -2614,10 +2614,10 @@ Forward references: conditional inclusion (6.10.1), -[page 56] (Contents) +[page 56] (Contents) 6.4.4.2 Floating constants - Syntax + Syntax 1 floating-constant: decimal-floating-constant hexadecimal-floating-constant @@ -2653,9 +2653,9 @@ Forward references: conditional inclusion (6.10.1), floating-suffix: one of f l F L -[page 57] (Contents) +[page 57] (Contents) - Description + Description 2 A floating constant has a significand part that may be followed by an exponent part and a suffix that specifies its type. The components of the significand part may include a digit sequence representing the whole-number part, followed by a period (.), followed by a @@ -2663,7 +2663,7 @@ Forward references: conditional inclusion (6.10.1), e, E, p, or P followed by an exponent consisting of an optionally signed digit sequence. Either the whole-number part or the fraction part has to be present; for decimal floating constants, either the period or the exponent part has to be present. - Semantics + Semantics 3 The significand part is interpreted as a (decimal or hexadecimal) rational number; the digit sequence in the exponent part is interpreted as a decimal integer. For decimal floating constants, the exponent indicates the power of 10 by which the significand part is @@ -2686,25 +2686,25 @@ Forward references: conditional inclusion (6.10.1), 7 The translation-time conversion of floating constants should match the execution-time conversion of character strings by library functions, such as strtod, given matching inputs suitable for both conversions, the same result format, and default execution-time - rounding.64) + rounding.64) - 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). -[page 58] (Contents) +[page 58] (Contents) 6.4.4.3 Enumeration constants - Syntax + Syntax 1 enumeration-constant: identifier - Semantics + Semantics 2 An identifier declared as an enumeration constant has type int. Forward references: enumeration specifiers (6.7.2.2). 6.4.4.4 Character constants - Syntax + Syntax 1 character-constant: ' c-char-sequence ' L' c-char-sequence ' @@ -2733,9 +2733,9 @@ Forward references: conditional inclusion (6.10.1), -[page 59] (Contents) +[page 59] (Contents) - Description + Description 2 An integer character constant is a sequence of one or more multibyte characters enclosed in single-quotes, as in 'x'. A wide character constant is the same, except prefixed by the letter L. With a few exceptions detailed later, the elements of the sequence are any @@ -2767,21 +2767,21 @@ Forward references: conditional inclusion (6.10.1), 8 In addition, characters not in the basic character set are representable by universal character names and certain nongraphic characters are representable by escape sequences consisting of the backslash \ followed by a lowercase letter: \a, \b, \f, \n, \r, \t, - and \v.65) + and \v.65) - 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). -[page 60] (Contents) +[page 60] (Contents) - Constraints + Constraints 9 The value of an octal or hexadecimal escape sequence shall be in the range of representable values for the type unsigned char for an integer character constant, or the unsigned type corresponding to wchar_t for a wide character constant. - Semantics + Semantics 10 An integer character constant has type int. The value of an integer character constant containing a single character that maps to a single-byte execution character is the numerical value of the representation of the mapped character interpreted as an integer. @@ -2823,10 +2823,10 @@ Forward references: conditional inclusion (6.10.1), -[page 61] (Contents) +[page 61] (Contents) 6.4.5 String literals - Syntax + Syntax 1 string-literal: " s-char-sequenceopt " L" s-char-sequenceopt " @@ -2837,7 +2837,7 @@ Forward references: conditional inclusion (6.10.1), any member of the source character set except the double-quote ", backslash \, or new-line character escape-sequence - Description + Description 2 A character string literal is a sequence of zero or more multibyte characters enclosed in double-quotes, as in "xyz". A wide string literal is the same, except prefixed by the letter L. @@ -2846,24 +2846,24 @@ Forward references: conditional inclusion (6.10.1), character constant, except that the single-quote ' is representable either by itself or by the escape sequence \', but the double-quote " shall be represented by the escape sequence \". - Semantics + Semantics 4 In translation phase 6, the multibyte character sequences specified by any sequence of adjacent character and wide string literal tokens are concatenated into a single multibyte character sequence. If any of the tokens are wide string literal tokens, the resulting multibyte character sequence is treated as a wide string literal; otherwise, it is treated as a character string literal. 5 In translation phase 7, a byte or code of value zero is appended to each multibyte - character sequence that results from a string literal or literals.66) The multibyte character + character sequence that results from a string literal or literals.66) The multibyte character sequence is then used to initialize an array of static storage duration and length just sufficient to contain the sequence. For character string literals, the array elements have type char, and are initialized with the individual bytes of the multibyte character sequence; for wide string literals, the array elements have type wchar_t, and are initialized with the sequence of wide characters corresponding to the multibyte character - 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. -[page 62] (Contents) +[page 62] (Contents) sequence, as defined by the mbstowcs function with an implementation-defined current locale. The value of a string literal containing a multibyte character or escape sequence @@ -2880,7 +2880,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: common definitions <stddef.h> (7.17), the mbstowcs function (7.20.8.1). 6.4.6 Punctuators - Syntax + Syntax 1 punctuator: one of [ ] ( ) { } . -> ++ -- & * + - ~ ! @@ -2889,7 +2889,7 @@ Forward references: conditional inclusion (6.10.1), = *= /= %= += -= <<= >>= &= ^= |= , # ## <: :> <% %> %: %:%: - Semantics + Semantics 2 A punctuator is a symbol that has independent syntactic and semantic significance. Depending on context, it may specify an operation to be performed (which in turn may yield a value or a function designator, produce a side effect, or some combination thereof) @@ -2899,17 +2899,17 @@ Forward references: conditional inclusion (6.10.1), -[page 63] (Contents) +[page 63] (Contents) -3 In all aspects of the language, the six tokens67) +3 In all aspects of the language, the six tokens67) <: :> <% %> %: %:%: behave, respectively, the same as the six tokens [ ] { } # ## - except for their spelling.68) + except for their spelling.68) Forward references: expressions (6.5), declarations (6.7), preprocessing directives (6.10), statements (6.8). 6.4.7 Header names - Syntax + Syntax 1 header-name: < h-char-sequence > " q-char-sequence " @@ -2925,7 +2925,7 @@ Forward references: conditional inclusion (6.10.1), q-char: any member of the source character set except the new-line character and " - Semantics + Semantics 2 The sequences in both forms of header names are mapped in an implementation-defined manner to headers or external source file names as specified in 6.10.2. 3 If the characters ', \, ", //, or /* occur in the sequence between the < and > delimiters, @@ -2934,15 +2934,15 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 64] (Contents) +[page 64] (Contents) - sequence between the " delimiters, the behavior is undefined.69) Header name + sequence between the " delimiters, the behavior is undefined.69) Header name preprocessing tokens are recognized only within #include preprocessing directives and - in implementation-defined locations within #pragma directives.70) + in implementation-defined locations within #pragma directives.70) 4 EXAMPLE The following sequence of characters: 0x3<1/a.h>1e2 #include <1/a.h> @@ -2955,7 +2955,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: source file inclusion (6.10.2). 6.4.8 Preprocessing numbers - Syntax + Syntax 1 pp-number: digit . digit @@ -2966,26 +2966,26 @@ Forward references: conditional inclusion (6.10.1), pp-number p sign pp-number P sign pp-number . - Description + Description 2 A preprocessing number begins with a digit optionally preceded by a period (.) and may be followed by valid identifier characters and the character sequences e+, e-, E+, E-, p+, p-, P+, or P-. 3 Preprocessing number tokens lexically include all floating and integer constant tokens. - Semantics + Semantics 4 A preprocessing number does not have type or a value; it acquires both after a successful conversion (as part of translation phase 7) to a floating constant token or an integer constant token. - 69) Thus, sequences of characters that resemble escape sequences cause undefined behavior. - 70) For an example of a header name preprocessing token used in a #pragma directive, see 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. -[page 65] (Contents) +[page 65] (Contents) 6.4.9 Comments 1 Except within a character constant, a string literal, or a comment, the characters /* introduce a comment. The contents of such a comment are examined only to identify - multibyte characters and to find the characters */ that terminate it.71) + multibyte characters and to find the characters */ that terminate it.71) 2 Except within a character constant, a string literal, or a comment, the characters // introduce a comment that includes all multibyte characters up to, but not including, the next new-line character. The contents of such a comment are examined only to identify @@ -3008,18 +3008,18 @@ Forward references: conditional inclusion (6.10.1), - 71) Thus, /* ... */ comments do not nest. + 71) Thus, /* ... */ comments do not nest. -[page 66] (Contents) +[page 66] (Contents) 6.5 Expressions 1 An expression is a sequence of operators and operands that specifies computation of a value, or that designates an object or a function, or that generates side effects, or that performs a combination thereof. 2 Between the previous and next sequence point an object shall have its stored value - modified at most once by the evaluation of an expression.72) Furthermore, the prior value - shall be read only to determine the value to be stored.73) -3 The grouping of operators and operands is indicated by the syntax.74) Except as specified + modified at most once by the evaluation of an expression.72) Furthermore, the prior value + shall be read only to determine the value to be stored.73) +3 The grouping of operators and operands is indicated by the syntax.74) Except as specified later (for the function-call (), &&, ||, ?:, and comma operators), the order of evaluation of subexpressions and the order in which side effects take place are both unspecified. 4 Some operators (the unary operator ~, and the binary operators <<, >>, &, ^, and |, @@ -3030,19 +3030,19 @@ Forward references: conditional inclusion (6.10.1), result is not mathematically defined or not in the range of representable values for its type), the behavior is undefined. 6 The effective type of an object for an access to its stored value is the declared type of the - object, if any.75) If a value is stored into an object having no declared type through an + object, if any.75) If a value is stored into an object having no declared type through an lvalue having a type that is not a character type, then the type of the lvalue becomes the - 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; a[i++] = i; while allowing 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 @@ -3051,9 +3051,9 @@ Forward references: conditional inclusion (6.10.1), the conditional operator ?: (6.5.15). 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. + 75) Allocated objects have no declared type. -[page 67] (Contents) +[page 67] (Contents) effective type of the object for that access and for subsequent accesses that do not modify the stored value. If a value is copied into an object having no declared type using @@ -3063,7 +3063,7 @@ Forward references: conditional inclusion (6.10.1), all other accesses to an object having no declared type, the effective type of the object is simply the type of the lvalue used for the access. 7 An object shall have its stored value accessed only by an lvalue expression that has one of - the following types:76) + the following types:76) -- a type compatible with the effective type of the object, -- a qualified version of a type compatible with the effective type of the object, -- a type that is the signed or unsigned type corresponding to the effective type of the @@ -3075,36 +3075,36 @@ Forward references: conditional inclusion (6.10.1), -- a character type. 8 A floating expression may be contracted, that is, evaluated as though it were an atomic operation, thereby omitting rounding errors implied by the source code and the - expression evaluation method.77) The FP_CONTRACT pragma in <math.h> provides a + expression evaluation method.77) The FP_CONTRACT pragma in <math.h> provides a way to disallow contracted expressions. Otherwise, whether and how expressions are - contracted is implementation-defined.78) + contracted is implementation-defined.78) Forward references: the FP_CONTRACT pragma (7.12.2), copying functions (7.21.2). - 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 + 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. -[page 68] (Contents) +[page 68] (Contents) 6.5.1 Primary expressions - Syntax + Syntax 1 primary-expression: identifier constant string-literal ( expression ) - Semantics + Semantics 2 An identifier is a primary expression, provided it has been declared as designating an object (in which case it is an lvalue) or a function (in which case it is a function - designator).79) + designator).79) 3 A constant is a primary expression. Its type depends on its form and value, as detailed in - 6.4.4. + 6.4.4. 4 A string literal is a primary expression. It is an lvalue with type as detailed in 6.4.5. 5 A parenthesized expression is a primary expression. Its type and value are identical to those of the unparenthesized expression. It is an lvalue, a function designator, or a void @@ -3112,7 +3112,7 @@ Forward references: conditional inclusion (6.10.1), designator, or a void expression. Forward references: declarations (6.7). 6.5.2 Postfix operators - Syntax + Syntax 1 postfix-expression: primary-expression postfix-expression [ expression ] @@ -3127,18 +3127,18 @@ Forward references: conditional inclusion (6.10.1), - 79) Thus, an undeclared identifier is a violation of the syntax. + 79) Thus, an undeclared identifier is a violation of the syntax. -[page 69] (Contents) +[page 69] (Contents) argument-expression-list: assignment-expression argument-expression-list , assignment-expression 6.5.2.1 Array subscripting - Constraints + Constraints 1 One of the expressions shall have type ''pointer to object type'', the other expression shall have integer type, and the result has type ''type''. - Semantics + Semantics 2 A postfix expression followed by an expression in square brackets [] is a subscripted designation of an element of an array object. The definition of the subscript operator [] is that E1[E2] is identical to (*((E1)+(E2))). Because of the conversion rules that @@ -3168,23 +3168,23 @@ Forward references: conditional inclusion (6.10.1), -[page 70] (Contents) +[page 70] (Contents) 6.5.2.2 Function calls - Constraints -1 The expression that denotes the called function80) shall have type pointer to function + Constraints +1 The expression that denotes the called function80) shall have type pointer to function returning void or returning an object type other than an array type. 2 If the expression that denotes the called function has a type that includes a prototype, the number of arguments shall agree with the number of parameters. Each argument shall have a type such that its value may be assigned to an object with the unqualified version of the type of its corresponding parameter. - Semantics + Semantics 3 A postfix expression followed by parentheses () containing a possibly empty, comma- separated list of expressions is a function call. The postfix expression denotes the called function. The list of expressions specifies the arguments to the function. 4 An argument may be an expression of any object type. In preparing for the call to a function, the arguments are evaluated, and each parameter is assigned the value of the - corresponding argument.81) + corresponding argument.81) 5 If the expression that denotes the called function has type pointer to function returning an object type, the function call expression has the same type as that object type, and has the value determined as specified in 6.8.6.4. Otherwise, the function call has type void. If @@ -3204,13 +3204,13 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 71] (Contents) +[page 71] (Contents) -- one promoted type is a signed integer type, the other promoted type is the corresponding unsigned integer type, and the value is representable in both types; @@ -3241,7 +3241,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: function declarators (including prototypes) (6.7.5.3), function definitions (6.9.1), the return statement (6.8.6.4), simple assignment (6.5.16.1). 6.5.2.3 Structure and union members - Constraints + Constraints 1 The first operand of the . operator shall have a qualified or unqualified structure or union type, and the second operand shall name a member of that type. 2 The first operand of the -> operator shall have type ''pointer to qualified or unqualified @@ -3251,16 +3251,16 @@ Forward references: conditional inclusion (6.10.1), -[page 72] (Contents) +[page 72] (Contents) - Semantics + Semantics 3 A postfix expression followed by the . operator and an identifier designates a member of - a structure or union object. The value is that of the named member,82) and is an lvalue if + a structure or union object. The value is that of the named member,82) and is an lvalue if the first expression is an lvalue. If the first expression has qualified type, the result has the so-qualified version of the type of the designated member. 4 A postfix expression followed by the -> operator and an identifier designates a member of a structure or union object. The value is that of the named member of the object to - which the first expression points, and is an lvalue.83) If the first expression is a pointer to + which the first expression points, and is an lvalue.83) If the first expression is a pointer to a qualified type, the result has the so-qualified version of the type of the designated member. 5 One special guarantee is made in order to simplify the use of unions: if a union contains @@ -3289,14 +3289,14 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 73] (Contents) +[page 73] (Contents) 8 EXAMPLE 3 The following is a valid fragment: union { @@ -3343,13 +3343,13 @@ Forward references: conditional inclusion (6.10.1), -[page 74] (Contents) +[page 74] (Contents) 6.5.2.4 Postfix increment and decrement operators - Constraints + Constraints 1 The operand of the postfix increment or decrement operator shall have qualified or unqualified real or pointer type and shall be a modifiable lvalue. - Semantics + Semantics 2 The result of the postfix ++ operator is the value of the operand. After the result is obtained, the value of the operand is incremented. (That is, the value 1 of the appropriate type is added to it.) See the discussions of additive operators and compound assignment @@ -3361,17 +3361,17 @@ Forward references: conditional inclusion (6.10.1), it). Forward references: additive operators (6.5.6), compound assignment (6.5.16.2). 6.5.2.5 Compound literals - Constraints + Constraints 1 The type name shall specify an object type or an array of unknown size, but not a variable length array type. 2 No initializer shall attempt to provide a value for an object not contained within the entire unnamed object specified by the compound literal. 3 If the compound literal occurs outside the body of a function, the initializer list shall consist of constant expressions. - Semantics + Semantics 4 A postfix expression that consists of a parenthesized type name followed by a brace- enclosed list of initializers is a compound literal. It provides an unnamed object whose - value is given by the initializer list.84) + value is given by the initializer list.84) 5 If the type name specifies an array of unknown size, the size is determined by the initializer list as specified in 6.7.8, and the type of the compound literal is that of the completed array type. Otherwise (when the type name specifies an object type), the type @@ -3379,19 +3379,19 @@ Forward references: conditional inclusion (6.10.1), lvalue. - 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. -[page 75] (Contents) +[page 75] (Contents) 6 The value of the compound literal is that of an unnamed object initialized by the initializer list. If the compound literal occurs outside the body of a function, the object has static storage duration; otherwise, it has automatic storage duration associated with the enclosing block. 7 All the semantic rules and constraints for initializer lists in 6.7.8 are applicable to - compound literals.85) + compound literals.85) 8 String literals, and compound literals with const-qualified types, need not designate - distinct objects.86) + distinct objects.86) 9 EXAMPLE 1 The file scope definition int *p = (int []){2, 4}; initializes p to point to the first element of an array of two ints, the first having the value two and the @@ -3424,11 +3424,11 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 76] (Contents) +[page 76] (Contents) 13 EXAMPLE 5 The following three expressions have different meanings: "/tmp/fileXXXXXX" @@ -3471,10 +3471,10 @@ Forward references: conditional inclusion (6.10.1), -[page 77] (Contents) +[page 77] (Contents) 6.5.3 Unary operators - Syntax + Syntax 1 unary-expression: postfix-expression ++ unary-expression @@ -3485,10 +3485,10 @@ Forward references: conditional inclusion (6.10.1), unary-operator: one of & * + - ~ ! 6.5.3.1 Prefix increment and decrement operators - Constraints + Constraints 1 The operand of the prefix increment or decrement operator shall have qualified or unqualified real or pointer type and shall be a modifiable lvalue. - Semantics + Semantics 2 The value of the operand of the prefix ++ operator is incremented. The result is the new value of the operand after incrementation. The expression ++E is equivalent to (E+=1). See the discussions of additive operators and compound assignment for information on @@ -3497,19 +3497,19 @@ Forward references: conditional inclusion (6.10.1), operand is decremented. Forward references: additive operators (6.5.6), compound assignment (6.5.16.2). 6.5.3.2 Address and indirection operators - Constraints + Constraints 1 The operand of the unary & operator shall be either a function designator, the result of a [] or unary * operator, or an lvalue that designates an object that is not a bit-field and is not declared with the register storage-class specifier. 2 The operand of the unary * operator shall have pointer type. - Semantics + Semantics 3 The unary & operator yields the address of its operand. If the operand has type ''type'', the result has type ''pointer to type''. If the operand is the result of a unary * operator, neither that operator nor the & operator is evaluated and the result is as if both were omitted, except that the constraints on the operators still apply and the result is not an lvalue. Similarly, if the operand is the result of a [] operator, neither the & operator nor -[page 78] (Contents) +[page 78] (Contents) the unary * that is implied by the [] is evaluated and the result is as if the & operator were removed and the [] operator were changed to a + operator. Otherwise, the result is @@ -3518,14 +3518,14 @@ Forward references: conditional inclusion (6.10.1), a function designator; if it points to an object, the result is an lvalue designating the object. If the operand has type ''pointer to type'', the result has type ''type''. If an invalid value has been assigned to the pointer, the behavior of the unary * operator is - undefined.87) + undefined.87) Forward references: storage-class specifiers (6.7.1), structure and union specifiers (6.7.2.1). 6.5.3.3 Unary arithmetic operators - Constraints + Constraints 1 The operand of the unary + or - operator shall have arithmetic type; of the ~ operator, integer type; of the ! operator, scalar type. - Semantics + Semantics 2 The result of the unary + operator is the value of its (promoted) operand. The integer promotions are performed on the operand, and the result has the promoted type. 3 The result of the unary - operator is the negative of its (promoted) operand. The integer @@ -3542,7 +3542,7 @@ Forward references: conditional inclusion (6.10.1), - 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. @@ -3550,14 +3550,14 @@ Forward references: conditional inclusion (6.10.1), address inappropriately aligned for the type of object pointed to, and the address of an object after the end of its lifetime. -[page 79] (Contents) +[page 79] (Contents) 6.5.3.4 The sizeof operator - Constraints + Constraints 1 The sizeof operator shall not be applied to an expression that has function type or an incomplete type, to the parenthesized name of such a type, or to an expression that designates a bit-field member. - Semantics + Semantics 2 The sizeof operator yields the size (in bytes) of its operand, which may be an expression or the parenthesized name of a type. The size is determined from the type of the operand. The result is an integer. If the type of the operand is a variable length array @@ -3565,7 +3565,7 @@ Forward references: conditional inclusion (6.10.1), integer constant. 3 When applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1. When applied to an operand that has array - type, the result is the total number of bytes in the array.88) When applied to an operand + type, the result is the total number of bytes in the array.88) When applied to an operand that has structure or union type, the result is the total number of bytes in such an object, including internal and trailing padding. 4 The value of the result is implementation-defined, and its type (an unsigned integer type) @@ -3592,10 +3592,10 @@ Forward references: conditional inclusion (6.10.1), - 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). -[page 80] (Contents) +[page 80] (Contents) int main() { @@ -3607,18 +3607,18 @@ Forward references: conditional inclusion (6.10.1), Forward references: common definitions <stddef.h> (7.17), declarations (6.7), structure and union specifiers (6.7.2.1), type names (6.7.6), array declarators (6.7.5.2). 6.5.4 Cast operators - Syntax + Syntax 1 cast-expression: unary-expression ( type-name ) cast-expression - Constraints + Constraints 2 Unless the type name specifies a void type, the type name shall specify qualified or unqualified scalar type and the operand shall have scalar type. 3 Conversions that involve pointers, other than where permitted by the constraints of 6.5.16.1, shall be specified by means of an explicit cast. - Semantics + Semantics 4 Preceding an expression by a parenthesized type name converts the value of the - expression to the named type. This construction is called a cast.89) A cast that specifies + expression to the named type. This construction is called a cast.89) A cast that specifies no conversion has no effect on the type or value of an expression. 5 If the value of the expression is represented with greater precision or range than required by the type named by the cast (6.3.1.8), then the cast specifies a conversion even if the @@ -3629,37 +3629,37 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 81] (Contents) +[page 81] (Contents) 6.5.5 Multiplicative operators - Syntax + Syntax 1 multiplicative-expression: cast-expression multiplicative-expression * cast-expression multiplicative-expression / cast-expression multiplicative-expression % cast-expression - Constraints + Constraints 2 Each of the operands shall have arithmetic type. The operands of the % operator shall have integer type. - Semantics + Semantics 3 The usual arithmetic conversions are performed on the operands. 4 The result of the binary * operator is the product of the operands. 5 The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined. 6 When integers are divided, the result of the / operator is the algebraic quotient with any - fractional part discarded.90) If the quotient a/b is representable, the expression + fractional part discarded.90) If the quotient a/b is representable, the expression (a/b)*b + a%b shall equal a. 6.5.6 Additive operators - Syntax + Syntax 1 additive-expression: multiplicative-expression additive-expression + multiplicative-expression additive-expression - multiplicative-expression - Constraints + Constraints 2 For addition, either both operands shall have arithmetic type, or one operand shall be a pointer to an object type and the other shall have integer type. (Incrementing is equivalent to adding 1.) @@ -3668,15 +3668,15 @@ Forward references: conditional inclusion (6.10.1), - 90) This is often called ''truncation toward zero''. + 90) This is often called ''truncation toward zero''. -[page 82] (Contents) +[page 82] (Contents) -- both operands are pointers to qualified or unqualified versions of compatible object types; or -- the left operand is a pointer to an object type and the right operand has integer type. (Decrementing is equivalent to subtracting 1.) - Semantics + Semantics 4 If both operands have arithmetic type, the usual arithmetic conversions are performed on them. 5 The result of the binary + operator is the sum of the operands. @@ -3710,11 +3710,11 @@ Forward references: conditional inclusion (6.10.1), object of type ptrdiff_t. Moreover, if the expression P points either to an element of an array object or one past the last element of an array object, and the expression Q points to the last element of the same array object, the expression ((Q)+1)-(P) has the same -[page 83] (Contents) +[page 83] (Contents) value as ((Q)-(P))+1 and as -((P)-((Q)+1)), and has the value zero if the expression P points one past the last element of the array object, even though the - expression (Q)+1 does not point to an element of the array object.91) + expression (Q)+1 does not point to an element of the array object.91) 10 EXAMPLE Pointer arithmetic is well defined with pointers to variable length array types. { int n = 4, m = 3; @@ -3731,14 +3731,14 @@ Forward references: conditional inclusion (6.10.1), Forward references: array declarators (6.7.5.2), common definitions <stddef.h> (7.17). 6.5.7 Bitwise shift operators - Syntax + Syntax 1 shift-expression: additive-expression shift-expression << additive-expression shift-expression >> additive-expression - Constraints + Constraints 2 Each of the operands shall have integer type. - Semantics + Semantics 3 The integer promotions are performed on each of the operands. The type of the result is that of the promoted left operand. If the value of the right operand is negative or is greater than or equal to the width of the promoted left operand, the behavior is undefined. @@ -3746,7 +3746,7 @@ Forward references: conditional inclusion (6.10.1), - 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 @@ -3755,7 +3755,7 @@ Forward references: conditional inclusion (6.10.1), another object in the program) just after the end of the object in order to satisfy the ''one past the last element'' requirements. -[page 84] (Contents) +[page 84] (Contents) 4 The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has an unsigned type, the value of the result is E1 x 2E2 , reduced modulo @@ -3767,21 +3767,21 @@ Forward references: conditional inclusion (6.10.1), part of the quotient of E1 / 2E2 . If E1 has a signed type and a negative value, the resulting value is implementation-defined. 6.5.8 Relational operators - Syntax + Syntax 1 relational-expression: shift-expression relational-expression < shift-expression relational-expression > shift-expression relational-expression <= shift-expression relational-expression >= shift-expression - Constraints + Constraints 2 One of the following shall hold: -- both operands have real type; -- both operands are pointers to qualified or unqualified versions of compatible object types; or -- both operands are pointers to qualified or unqualified versions of compatible incomplete types. - Semantics + Semantics 3 If both of the operands have arithmetic type, the usual arithmetic conversions are performed. 4 For the purposes of these operators, a pointer to an object that is not an element of an @@ -3794,7 +3794,7 @@ Forward references: conditional inclusion (6.10.1), pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript -[page 85] (Contents) +[page 85] (Contents) values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the @@ -3802,24 +3802,24 @@ Forward references: conditional inclusion (6.10.1), last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined. 6 Each of the operators < (less than), > (greater than), <= (less than or equal to), and >= - (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.92) + (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.92) The result has type int. 6.5.9 Equality operators - Syntax + Syntax 1 equality-expression: relational-expression equality-expression == relational-expression equality-expression != relational-expression - Constraints + Constraints 2 One of the following shall hold: -- both operands have arithmetic type; -- both operands are pointers to qualified or unqualified versions of compatible types; -- one operand is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void; or -- one operand is a pointer and the other is a null pointer constant. - Semantics + Semantics 3 The == (equal to) and != (not equal to) operators are analogous to the relational - operators except for their lower precedence.93) Each of the operators yields 1 if the + operators except for their lower precedence.93) Each of the operators yields 1 if the specified relation is true and 0 if it is false. The result has type int. For any pair of operands, exactly one of the relations is true. 4 If both of the operands have arithmetic type, the usual arithmetic conversions are @@ -3829,11 +3829,11 @@ Forward references: conditional inclusion (6.10.1), (complex) result type determined by the usual arithmetic conversions are equal. - 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''. - 93) Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value. + 93) Because of the precedences, a<b == c<d is 1 whenever a<b and c<d have the same truth-value. -[page 86] (Contents) +[page 86] (Contents) 5 Otherwise, at least one operand is a pointer. If one operand is a pointer and the other is a null pointer constant, the null pointer constant is converted to the type of the pointer. If @@ -3844,18 +3844,18 @@ Forward references: conditional inclusion (6.10.1), both are pointers to one past the last element of the same array object, or one is a pointer to one past the end of one array object and the other is a pointer to the start of a different array object that happens to immediately follow the first array object in the address - space.94) + space.94) 7 For the purposes of these operators, a pointer to an object that is not an element of an array behaves the same as a pointer to the first element of an array of length one with the type of the object as its element type. 6.5.10 Bitwise AND operator - Syntax + Syntax 1 AND-expression: equality-expression AND-expression & equality-expression - Constraints + Constraints 2 Each of the operands shall have integer type. - Semantics + Semantics 3 The usual arithmetic conversions are performed on the operands. 4 The result of the binary & operator is the bitwise AND of the operands (that is, each bit in the result is set if and only if each of the corresponding bits in the converted operands is @@ -3864,34 +3864,34 @@ Forward references: conditional inclusion (6.10.1), - 94) Two objects may be adjacent in memory because they are adjacent elements of a larger array or + 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. -[page 87] (Contents) +[page 87] (Contents) 6.5.11 Bitwise exclusive OR operator - Syntax + Syntax 1 exclusive-OR-expression: AND-expression exclusive-OR-expression ^ AND-expression - Constraints + Constraints 2 Each of the operands shall have integer type. - Semantics + Semantics 3 The usual arithmetic conversions are performed on the operands. 4 The result of the ^ operator is the bitwise exclusive OR of the operands (that is, each bit in the result is set if and only if exactly one of the corresponding bits in the converted operands is set). 6.5.12 Bitwise inclusive OR operator - Syntax + Syntax 1 inclusive-OR-expression: exclusive-OR-expression inclusive-OR-expression | exclusive-OR-expression - Constraints + Constraints 2 Each of the operands shall have integer type. - Semantics + Semantics 3 The usual arithmetic conversions are performed on the operands. 4 The result of the | operator is the bitwise inclusive OR of the operands (that is, each bit in the result is set if and only if at least one of the corresponding bits in the converted @@ -3900,29 +3900,29 @@ Forward references: conditional inclusion (6.10.1), -[page 88] (Contents) +[page 88] (Contents) 6.5.13 Logical AND operator - Syntax + Syntax 1 logical-AND-expression: inclusive-OR-expression logical-AND-expression && inclusive-OR-expression - Constraints + Constraints 2 Each of the operands shall have scalar type. - Semantics + Semantics 3 The && operator shall yield 1 if both of its operands compare unequal to 0; otherwise, it yields 0. The result has type int. 4 Unlike the bitwise binary & operator, the && operator guarantees left-to-right evaluation; there is a sequence point after the evaluation of the first operand. If the first operand compares equal to 0, the second operand is not evaluated. 6.5.14 Logical OR operator - Syntax + Syntax 1 logical-OR-expression: logical-AND-expression logical-OR-expression || logical-AND-expression - Constraints + Constraints 2 Each of the operands shall have scalar type. - Semantics + Semantics 3 The || operator shall yield 1 if either of its operands compare unequal to 0; otherwise, it yields 0. The result has type int. 4 Unlike the bitwise | operator, the || operator guarantees left-to-right evaluation; there is @@ -3932,14 +3932,14 @@ Forward references: conditional inclusion (6.10.1), -[page 89] (Contents) +[page 89] (Contents) 6.5.15 Conditional operator - Syntax + Syntax 1 conditional-expression: logical-OR-expression logical-OR-expression ? expression : conditional-expression - Constraints + Constraints 2 The first operand shall have scalar type. 3 One of the following shall hold for the second and third operands: -- both operands have arithmetic type; @@ -3949,11 +3949,11 @@ Forward references: conditional inclusion (6.10.1), -- one operand is a pointer and the other is a null pointer constant; or -- one operand is a pointer to an object or incomplete type and the other is a pointer to a qualified or unqualified version of void. - Semantics + Semantics 4 The first operand is evaluated; there is a sequence point after its evaluation. The second operand is evaluated only if the first compares unequal to 0; the third operand is evaluated only if the first compares equal to 0; the result is the value of the second or third operand - (whichever is evaluated), converted to the type described below.95) If an attempt is made + (whichever is evaluated), converted to the type described below.95) If an attempt is made to modify the result of a conditional operator or to access it after the next sequence point, the behavior is undefined. 5 If both the second and third operands have arithmetic type, the result type that would be @@ -3968,9 +3968,9 @@ Forward references: conditional inclusion (6.10.1), null pointer constant, the result has the type of the other operand; otherwise, one operand is a pointer to void or a qualified version of void, in which case the result type is a - 95) A conditional expression does not yield an lvalue. + 95) A conditional expression does not yield an lvalue. -[page 90] (Contents) +[page 90] (Contents) pointer to an appropriately qualified version of void. 7 EXAMPLE The common type that results when the second and third operands are pointers is determined @@ -3993,15 +3993,15 @@ Forward references: conditional inclusion (6.10.1), vp ip void * 6.5.16 Assignment operators - Syntax + Syntax 1 assignment-expression: conditional-expression unary-expression assignment-operator assignment-expression assignment-operator: one of = *= /= %= += -= <<= >>= &= ^= |= - Constraints + Constraints 2 An assignment operator shall have a modifiable lvalue as its left operand. - Semantics + Semantics 3 An assignment operator stores a value in the object designated by the left operand. An assignment expression has the value of the left operand after the assignment, but is not an lvalue. The type of an assignment expression is the type of the left operand unless the @@ -4013,11 +4013,11 @@ Forward references: conditional inclusion (6.10.1), behavior is undefined. -[page 91] (Contents) +[page 91] (Contents) 6.5.16.1 Simple assignment - Constraints -1 One of the following shall hold:96) + Constraints +1 One of the following shall hold:96) -- the left operand has qualified or unqualified arithmetic type and the right has arithmetic type; -- the left operand has a qualified or unqualified version of a structure or union type @@ -4030,7 +4030,7 @@ Forward references: conditional inclusion (6.10.1), the qualifiers of the type pointed to by the right; -- the left operand is a pointer and the right is a null pointer constant; or -- the left operand has type _Bool and the right is a pointer. - Semantics + Semantics 2 In simple assignment (=), the value of the right operand is converted to the type of the assignment expression and replaces the value stored in the object designated by the left operand. @@ -4050,12 +4050,12 @@ Forward references: conditional inclusion (6.10.1), - 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). -[page 92] (Contents) +[page 92] (Contents) negative, so the operands of the comparison can never compare equal. Therefore, for full portability, the variable c should be declared as int. @@ -4080,30 +4080,30 @@ Forward references: conditional inclusion (6.10.1), value of the const object c. 6.5.16.2 Compound assignment - Constraints + Constraints 1 For the operators += and -= only, either the left operand shall be a pointer to an object type and the right shall have integer type, or the left operand shall have qualified or unqualified arithmetic type and the right shall have arithmetic type. 2 For the other operators, each operand shall have arithmetic type consistent with those allowed by the corresponding binary operator. - Semantics + Semantics 3 A compound assignment of the form E1 op = E2 differs from the simple assignment expression E1 = E1 op (E2) only in that the lvalue E1 is evaluated only once. -[page 93] (Contents) +[page 93] (Contents) 6.5.17 Comma operator - Syntax + Syntax 1 expression: assignment-expression expression , assignment-expression - Semantics + Semantics 2 The left operand of a comma operator is evaluated as a void expression; there is a sequence point after its evaluation. Then the right operand is evaluated; the result has its - type and value.97) If an attempt is made to modify the result of a comma operator or to + type and value.97) If an attempt is made to modify the result of a comma operator or to access it after the next sequence point, the behavior is undefined. 3 EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists @@ -4117,29 +4117,29 @@ Forward references: conditional inclusion (6.10.1), - 97) A comma operator does not yield an lvalue. + 97) A comma operator does not yield an lvalue. -[page 94] (Contents) +[page 94] (Contents) 6.6 Constant expressions - Syntax + Syntax 1 constant-expression: conditional-expression - Description + Description 2 A constant expression can be evaluated during translation rather than runtime, and accordingly may be used in any place that a constant may be. - Constraints + Constraints 3 Constant expressions shall not contain assignment, increment, decrement, function-call, or comma operators, except when they are contained within a subexpression that is not - evaluated.98) + evaluated.98) 4 Each constant expression shall evaluate to a constant that is in the range of representable values for its type. - Semantics + Semantics 5 An expression that evaluates to a constant is required in several contexts. If a floating expression is evaluated in the translation environment, the arithmetic precision and range shall be at least as great as if the expression were being evaluated in the execution environment. -6 An integer constant expression99) shall have integer type and shall only have operands +6 An integer constant expression99) shall have integer type and shall only have operands that are integer constants, enumeration constants, character constants, sizeof expressions whose results are integer constants, and floating constants that are the immediate operands of casts. Cast operators in an integer constant expression shall only @@ -4153,13 +4153,13 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 95] (Contents) +[page 95] (Contents) -- an address constant, or -- an address constant for an object type plus or minus an integer constant expression. @@ -4177,20 +4177,20 @@ Forward references: conditional inclusion (6.10.1), accessed by use of these operators. 10 An implementation may accept other forms of constant expressions. 11 The semantic rules for the evaluation of a constant expression are the same as for - nonconstant expressions.100) + nonconstant expressions.100) Forward references: array declarators (6.7.5.2), initialization (6.7.8). - 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. -[page 96] (Contents) +[page 96] (Contents) 6.7 Declarations - Syntax + Syntax 1 declaration: declaration-specifiers init-declarator-listopt ; declaration-specifiers: @@ -4204,7 +4204,7 @@ Forward references: conditional inclusion (6.10.1), init-declarator: declarator declarator = initializer - Constraints + Constraints 2 A declaration shall declare at least a declarator (other than the parameters of a function or the members of a structure or union), a tag, or the members of an enumeration. 3 If an identifier has no linkage, there shall be no more than one declaration of the identifier @@ -4212,20 +4212,20 @@ Forward references: conditional inclusion (6.10.1), for tags as specified in 6.7.2.3. 4 All declarations in the same scope that refer to the same object or function shall specify compatible types. - Semantics + Semantics 5 A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that: -- for an object, causes storage to be reserved for that object; - -- for a function, includes the function body;101) + -- for a function, includes the function body;101) -- for an enumeration constant or typedef name, is the (only) declaration of the identifier. 6 The declaration specifiers consist of a sequence of specifiers that indicate the linkage, storage duration, and part of the type of the entities that the declarators denote. The init- declarator-list is a comma-separated sequence of declarators, each of which may have - 101) Function definitions have a different syntax, described in 6.9.1. + 101) Function definitions have a different syntax, described in 6.9.1. -[page 97] (Contents) +[page 97] (Contents) additional type information, or an initializer, or both. The declarators contain the identifiers (if any) being declared. @@ -4236,37 +4236,37 @@ Forward references: conditional inclusion (6.10.1), Forward references: declarators (6.7.5), enumeration specifiers (6.7.2.2), initialization (6.7.8). 6.7.1 Storage-class specifiers - Syntax + Syntax 1 storage-class-specifier: typedef extern static auto register - Constraints + Constraints 2 At most, one storage-class specifier may be given in the declaration specifiers in a - declaration.102) - Semantics + declaration.102) + Semantics 3 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience only; it is discussed in 6.7.7. The meanings of the various linkages and storage durations were discussed in 6.2.2 and 6.2.4. 4 A declaration of an identifier for an object with storage-class specifier register suggests that access to the object be as fast as possible. The extent to which such - suggestions are effective is implementation-defined.103) + suggestions are effective is implementation-defined.103) 5 The declaration of an identifier for a function that has block scope shall have no explicit storage-class specifier other than extern. - 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. -[page 98] (Contents) +[page 98] (Contents) 6 If an aggregate or union object is declared with a storage-class specifier other than typedef, the properties resulting from the storage-class specifier, except with respect to @@ -4274,7 +4274,7 @@ Forward references: conditional inclusion (6.10.1), or union member objects. Forward references: type definitions (6.7.7). 6.7.2 Type specifiers - Syntax + Syntax 1 type-specifier: void char @@ -4290,7 +4290,7 @@ Forward references: conditional inclusion (6.10.1), struct-or-union-specifier * enum-specifier typedef-name - Constraints + Constraints 2 At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each struct declaration and type name. Each list of type specifiers shall be one of the following sets (delimited by commas, when there is @@ -4305,7 +4305,7 @@ Forward references: conditional inclusion (6.10.1), -- int, signed, or signed int -[page 99] (Contents) +[page 99] (Contents) -- unsigned, or unsigned int -- long, signed long, long int, or signed long int @@ -4324,8 +4324,8 @@ Forward references: conditional inclusion (6.10.1), -- enum specifier -- typedef name 3 The type specifier _Complex shall not be used if the implementation does not provide - complex types.104) - Semantics + complex types.104) + Semantics 4 Specifiers for structures, unions, and enumerations are discussed in 6.7.2.1 through 6.7.2.3. Declarations of typedef names are discussed in 6.7.7. The characteristics of the other types are discussed in 6.2.5. @@ -4338,12 +4338,12 @@ Forward references: conditional inclusion (6.10.1), - 104) Freestanding implementations are not required to provide complex types. * + 104) Freestanding implementations are not required to provide complex types. * -[page 100] (Contents) +[page 100] (Contents) 6.7.2.1 Structure and union specifiers - Syntax + Syntax 1 struct-or-union-specifier: struct-or-union identifieropt { struct-declaration-list } struct-or-union identifier @@ -4364,7 +4364,7 @@ Forward references: conditional inclusion (6.10.1), struct-declarator: declarator declaratoropt : constant-expression - Constraints + Constraints 2 A structure or union shall not contain a member with incomplete or function type (hence, a structure shall not contain an instance of itself, but may contain a pointer to an instance of itself), except that the last member of a structure with more than one named member @@ -4379,9 +4379,9 @@ Forward references: conditional inclusion (6.10.1), int, unsigned int, or some other implementation-defined type. -[page 101] (Contents) +[page 101] (Contents) - Semantics + Semantics 5 As discussed in 6.2.5, a structure is a type consisting of a sequence of members, whose storage is allocated in an ordered sequence, and a union is a type consisting of a sequence of members whose storage overlap. @@ -4393,11 +4393,11 @@ Forward references: conditional inclusion (6.10.1), members, the behavior is undefined. The type is incomplete until after the } that terminates the list. 8 A member of a structure or union may have any object type other than a variably - modified type.105) In addition, a member may be declared to consist of a specified - number of bits (including a sign bit, if any). Such a member is called a bit-field;106) its + modified type.105) In addition, a member may be declared to consist of a specified + number of bits (including a sign bit, if any). Such a member is called a bit-field;106) its width is preceded by a colon. 9 A bit-field is interpreted as a signed or unsigned integer type consisting of the specified - number of bits.107) If the value 0 or 1 is stored into a nonzero-width bit-field of type + number of bits.107) If the value 0 or 1 is stored into a nonzero-width bit-field of type _Bool, the value of the bit-field shall compare equal to the value stored. 10 An implementation may allocate any addressable storage unit large enough to hold a bit- field. If enough space remains, a bit-field that immediately follows another bit-field in a @@ -4407,21 +4407,21 @@ Forward references: conditional inclusion (6.10.1), low-order or low-order to high-order) is implementation-defined. The alignment of the addressable storage unit is unspecified. 11 A bit-field declaration with no declarator, but only a colon and a width, indicates an - unnamed bit-field.108) As a special case, a bit-field structure member with a width of 0 + unnamed bit-field.108) As a special case, a bit-field structure member with a width of 0 indicates that no further bit-field is to be packed into the unit in which the previous bit- field, if any, was placed. - 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. -[page 102] (Contents) +[page 102] (Contents) 12 Each non-bit-field member of a structure or union object is aligned in an implementation- defined manner appropriate to its type. @@ -4462,7 +4462,7 @@ Forward references: conditional inclusion (6.10.1), -[page 103] (Contents) +[page 103] (Contents) struct s t1 = { 0 }; // valid struct s t2 = { 1, { 4.2 }}; // invalid @@ -4506,10 +4506,10 @@ Forward references: conditional inclusion (6.10.1), Forward references: tags (6.7.2.3). -[page 104] (Contents) +[page 104] (Contents) 6.7.2.2 Enumeration specifiers - Syntax + Syntax 1 enum-specifier: enum identifieropt { enumerator-list } enum identifieropt { enumerator-list , } @@ -4520,12 +4520,12 @@ Forward references: conditional inclusion (6.10.1), enumerator: enumeration-constant enumeration-constant = constant-expression - Constraints + Constraints 2 The expression that defines the value of an enumeration constant shall be an integer constant expression that has a value representable as an int. - Semantics + Semantics 3 The identifiers in an enumerator list are declared as constants that have type int and - may appear wherever such are permitted.109) An enumerator with = defines its + may appear wherever such are permitted.109) An enumerator with = defines its enumeration constant as the value of the constant expression. If the first enumerator has no =, the value of its enumeration constant is 0. Each subsequent enumerator with no = defines its enumeration constant as the value of the constant expression obtained by @@ -4533,7 +4533,7 @@ Forward references: conditional inclusion (6.10.1), = may produce enumeration constants with values that duplicate other values in the same enumeration.) The enumerators of an enumeration are also known as its members. 4 Each enumerated type shall be compatible with char, a signed integer type, or an - unsigned integer type. The choice of type is implementation-defined,110) but shall be + unsigned integer type. The choice of type is implementation-defined,110) but shall be capable of representing the values of all the members of the enumeration. The enumerated type is incomplete until after the } that terminates the list of enumerator declarations. @@ -4541,12 +4541,12 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 105] (Contents) +[page 105] (Contents) 5 EXAMPLE The following fragment: enum hue { chartreuse, burgundy, claret=20, winedark }; @@ -4560,16 +4560,16 @@ Forward references: conditional inclusion (6.10.1), Forward references: tags (6.7.2.3). 6.7.2.3 Tags - Constraints + Constraints 1 A specific type shall have its content defined at most once. 2 Where two declarations that use the same tag declare the same type, they shall both use the same choice of struct, union, or enum. 3 A type specifier of the form enum identifier without an enumerator list shall only appear after the type it specifies is complete. - Semantics + Semantics 4 All declarations of structure, union, or enumerated types that have the same scope and - use the same tag declare the same type. The type is incomplete111) until the closing brace + use the same tag declare the same type. The type is incomplete111) until the closing brace of the list defining the content, and complete thereafter. 5 Two declarations of structure, union, or enumerated types which are in different scopes or use different tags declare distinct types. Each declaration of a structure, union, or @@ -4582,18 +4582,18 @@ Forward references: conditional inclusion (6.10.1), enum identifier { enumerator-list , } declares a structure, union, or enumerated type. The list defines the structure content, - 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. -[page 106] (Contents) +[page 106] (Contents) - union content, or enumeration content. If an identifier is provided,112) the type specifier + union content, or enumeration content. If an identifier is provided,112) the type specifier also declares the identifier to be the tag of that type. 7 A declaration of the form struct-or-union identifier ; - specifies a structure or union type and declares the identifier as a tag of that type.113) + specifies a structure or union type and declares the identifier as a tag of that type.113) 8 If a type specifier of the form struct-or-union identifier occurs other than as part of one of the above forms, and no other declaration of the @@ -4623,13 +4623,13 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 107] (Contents) +[page 107] (Contents) typedef struct tnode TNODE; struct tnode { @@ -4652,17 +4652,17 @@ Forward references: conditional inclusion (6.10.1), Forward references: declarators (6.7.5), array declarators (6.7.5.2), type definitions (6.7.7). 6.7.3 Type qualifiers - Syntax + Syntax 1 type-qualifier: const restrict volatile - Constraints + Constraints 2 Types other than pointer types derived from object or incomplete types shall not be restrict-qualified. - Semantics + Semantics 3 The properties associated with qualified types are meaningful only for expressions that - are lvalues.114) + are lvalues.114) 4 If the same qualifier appears more than once in the same specifier-qualifier-list, either directly or via one or more typedefs, the behavior is the same as if it appeared only once. @@ -4670,33 +4670,33 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 108] (Contents) +[page 108] (Contents) 5 If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is undefined. If an attempt is made to refer to an object defined with a volatile-qualified type through use of an lvalue - with non-volatile-qualified type, the behavior is undefined.115) + with non-volatile-qualified type, the behavior is undefined.115) 6 An object that has volatile-qualified type may be modified in ways unknown to the implementation or have other unknown side effects. Therefore any expression referring to such an object shall be evaluated strictly according to the rules of the abstract machine, as described in 5.1.2.3. Furthermore, at every sequence point the value last stored in the object shall agree with that prescribed by the abstract machine, except as modified by the - unknown factors mentioned previously.116) What constitutes an access to an object that + unknown factors mentioned previously.116) What constitutes an access to an object that has volatile-qualified type is implementation-defined. 7 An object that is accessed through a restrict-qualified pointer has a special association with that pointer. This association, defined in 6.7.3.1 below, requires that all accesses to - that object use, directly or indirectly, the value of that particular pointer.117) The intended + that object use, directly or indirectly, the value of that particular pointer.117) The intended use of the restrict qualifier (like the register storage class) is to promote optimization, and deleting all instances of the qualifier from all preprocessing translation units composing a conforming program does not change its meaning (i.e., observable behavior). 8 If the specification of an array type includes any type qualifiers, the element type is so- qualified, not the array type. If the specification of a function type includes any type - qualifiers, the behavior is undefined.118) + qualifiers, the behavior is undefined.118) 9 For two qualified types to be compatible, both shall have the identically qualified version of a compatible type; the order of type qualifiers within a list of specifiers or qualifiers does not affect the specified type. @@ -4707,18 +4707,18 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 109] (Contents) +[page 109] (Contents) 11 EXAMPLE 2 The following declarations and expressions illustrate the behavior when type qualifiers modify an aggregate type: @@ -4744,7 +4744,7 @@ Forward references: conditional inclusion (6.10.1), whatever function is called at program startup in a freestanding environment). 3 In what follows, a pointer expression E is said to be based on object P if (at some sequence point in the execution of B prior to the evaluation of E) modifying P to point to - a copy of the array object into which it formerly pointed would change the value of E.119) + a copy of the array object into which it formerly pointed would change the value of E.119) Note that ''based'' is defined only for expressions with pointer types. 4 During each execution of B, let L be any lvalue that has &L based on P. If L is used to access the value of the object X that it designates, and X is also modified (by any means), @@ -4758,12 +4758,12 @@ Forward references: conditional inclusion (6.10.1), 5 Here an execution of B means that portion of the execution of the program that would correspond to the lifetime of an object with scalar type and automatic storage duration - 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. -[page 110] (Contents) +[page 110] (Contents) associated with B. 6 A translator is free to ignore any or all aliasing implications of uses of restrict. @@ -4812,7 +4812,7 @@ Forward references: conditional inclusion (6.10.1), -[page 111] (Contents) +[page 111] (Contents) { int * restrict p1; @@ -4838,25 +4838,25 @@ Forward references: conditional inclusion (6.10.1), } 6.7.4 Function specifiers - Syntax + Syntax 1 function-specifier: inline - Constraints + Constraints 2 Function specifiers shall be used only in the declaration of an identifier for a function. 3 An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static storage duration, and shall not contain a reference to an identifier with internal linkage. 4 In a hosted environment, the inline function specifier shall not appear in a declaration of main. - Semantics + Semantics 5 A function declared with an inline function specifier is an inline function. The function specifier may appear more than once; the behavior is the same as if it appeared only once. Making a function an inline function suggests that calls to the function be as - fast as possible.120) The extent to which such suggestions are effective is - implementation-defined.121) + fast as possible.120) The extent to which such suggestions are effective is + implementation-defined.121) 6 Any function with internal linkage can be an inline function. For a function with external linkage, the following restrictions apply: If a function is declared with an inline -[page 112] (Contents) +[page 112] (Contents) function specifier, then it shall also be defined in the same translation unit. If all of the file scope declarations for a function in a translation unit include the inline function @@ -4865,17 +4865,17 @@ Forward references: conditional inclusion (6.10.1), and does not forbid an external definition in another translation unit. An inline definition provides an alternative to an external definition, which a translator may use to implement any call to the function in the same translation unit. It is unspecified whether a call to the - function uses the inline definition or the external definition.122) + function uses the inline definition or the external definition.122) 7 EXAMPLE The declaration of an inline function with external linkage can result in either an external definition, or a definition available for use only within the translation unit. A file scope declaration with extern creates an external definition. The following example shows an entire translation unit. inline double fahr(double t) { - return (9.0 * t) / 5.0 + 32.0; + return (9.0 * t) / 5.0 + 32.0; } inline double cels(double t) { - return (5.0 * (t - 32.0)) / 9.0; + return (5.0 * (t - 32.0)) / 9.0; } extern double fahr(double); // creates an external definition double convert(int is_fahr, double temp) @@ -4891,23 +4891,23 @@ Forward references: conditional inclusion (6.10.1), Forward references: function definitions (6.9.1). - 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. -[page 113] (Contents) +[page 113] (Contents) 6.7.5 Declarators - Syntax + Syntax 1 declarator: pointeropt direct-declarator direct-declarator: @@ -4937,13 +4937,13 @@ Forward references: conditional inclusion (6.10.1), identifier-list: identifier identifier-list , identifier - Semantics + Semantics 2 Each declarator declares one identifier, and asserts that when an operand of the same form as the declarator appears in an expression, it designates a function or object with the scope, storage duration, and type indicated by the declaration specifiers. 3 A full declarator is a declarator that is not part of another declarator. The end of a full declarator is a sequence point. If, in the nested sequence of declarators in a full -[page 114] (Contents) +[page 114] (Contents) declarator, there is a declarator specifying a variable length array type, the type specified by the full declarator is said to be variably modified. Furthermore, any type derived by @@ -4967,7 +4967,7 @@ Forward references: conditional inclusion (6.10.1), directly or via one or more typedefs. Forward references: array declarators (6.7.5.2), type definitions (6.7.7). 6.7.5.1 Pointer declarators - Semantics + Semantics 1 If, in the declaration ''T D1'', D1 has the form * type-qualifier-listopt D and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list @@ -4981,7 +4981,7 @@ Forward references: conditional inclusion (6.10.1), -[page 115] (Contents) +[page 115] (Contents) const int *ptr_to_constant; int *const constant_ptr; @@ -4996,7 +4996,7 @@ Forward references: conditional inclusion (6.10.1), declares constant_ptr as an object that has type ''const-qualified pointer to int''. 6.7.5.2 Array declarators - Constraints + Constraints 1 In addition to optional type qualifiers and the keyword static, the [ and ] may delimit an expression or *. If they delimit an expression (which specifies the size of an array), the expression shall have an integer type. If the expression is a constant expression, it shall @@ -5007,23 +5007,23 @@ Forward references: conditional inclusion (6.10.1), 2 An ordinary identifier (as defined in 6.2.3) that has a variably modified type shall have either block scope and no linkage or function prototype scope. If an identifier is declared to be an object with static storage duration, it shall not have a variable length array type. - Semantics + Semantics 3 If, in the declaration ''T D1'', D1 has one of the forms: D[ type-qualifier-listopt assignment-expressionopt ] D[ static type-qualifier-listopt assignment-expression ] D[ type-qualifier-list static assignment-expression ] D[ type-qualifier-listopt * ] and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list - T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.123) + T '', then the type specified for ident is ''derived-declarator-type-list array of T ''.123) (See 6.7.5.3 for the meaning of the optional type qualifiers and the keyword static.) 4 If the size is not present, the array type is an incomplete type. If the size is * instead of being an expression, the array type is a variable length array type of unspecified size, - which can only be used in declarations with function prototype scope;124) such arrays are + which can only be used in declarations with function prototype scope;124) such arrays are nonetheless complete types. If the size is an integer constant expression and the element - 123) When several ''array of'' specifications are adjacent, a multidimensional array is declared. + 123) When several ''array of'' specifications are adjacent, a multidimensional array is declared. -[page 116] (Contents) +[page 116] (Contents) type has a known constant size, the array type is not a variable length array type; otherwise, the array type is a variable length array type. @@ -5066,9 +5066,9 @@ Forward references: conditional inclusion (6.10.1), - 124) Thus, * can be used only in function declarations that are not definitions (see 6.7.5.3). + 124) Thus, * can be used only in function declarations that are not definitions (see 6.7.5.3). -[page 117] (Contents) +[page 117] (Contents) 10 EXAMPLE 4 All declarations of variably modified (VM) types have to be at either block scope or function prototype scope. Array objects declared with the static or extern storage-class specifier @@ -5098,7 +5098,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: function declarators (6.7.5.3), function definitions (6.9.1), initialization (6.7.8). 6.7.5.3 Function declarators (including prototypes) - Constraints + Constraints 1 A function declarator shall not specify a return type that is a function type or an array type. 2 The only storage-class specifier that shall occur in a parameter declaration is register. @@ -5106,13 +5106,13 @@ Forward references: conditional inclusion (6.10.1), shall be empty. 4 After adjustment, the parameters in a parameter type list in a function declarator that is part of a definition of that function shall not have incomplete type. - Semantics + Semantics 5 If, in the declaration ''T D1'', D1 has the form D( parameter-type-list ) or D( identifier-listopt ) -[page 118] (Contents) +[page 118] (Contents) and the type specified for ident in the declaration ''T D'' is ''derived-declarator-type-list T '', then the type specified for ident is ''derived-declarator-type-list function returning @@ -5128,7 +5128,7 @@ Forward references: conditional inclusion (6.10.1), 8 A declaration of a parameter as ''function returning type'' shall be adjusted to ''pointer to function returning type'', as in 6.3.2.1. 9 If the list terminates with an ellipsis (, ...), no information about the number or types - of the parameters after the comma is supplied.125) + of the parameters after the comma is supplied.125) 10 The special case of an unnamed parameter of type void as the only item in the list specifies that the function has no parameters. 11 If, in a parameter declaration, an identifier can be treated either as a typedef name or as a @@ -5143,16 +5143,16 @@ Forward references: conditional inclusion (6.10.1), list in a function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the - parameters is supplied.126) -15 For two function types to be compatible, both shall specify compatible return types.127) + parameters is supplied.126) +15 For two function types to be compatible, both shall specify compatible return types.127) - 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. -[page 119] (Contents) +[page 119] (Contents) Moreover, the parameter type lists, if both are present, shall agree in the number of parameters and in use of the ellipsis terminator; corresponding parameters shall have @@ -5198,7 +5198,7 @@ Forward references: conditional inclusion (6.10.1), -[page 120] (Contents) +[page 120] (Contents) 20 EXAMPLE 4 The following prototype has a variably modified parameter. void addscalar(int n, int m, @@ -5236,10 +5236,10 @@ Forward references: conditional inclusion (6.10.1), -[page 121] (Contents) +[page 121] (Contents) 6.7.6 Type names - Syntax + Syntax 1 type-name: specifier-qualifier-list abstract-declaratoropt abstract-declarator: @@ -5255,10 +5255,10 @@ Forward references: conditional inclusion (6.10.1), assignment-expression ] direct-abstract-declaratoropt [ * ] direct-abstract-declaratoropt ( parameter-type-listopt ) - Semantics + Semantics 2 In several contexts, it is necessary to specify a type. This is accomplished using a type name, which is syntactically a declaration for a function or an object of that type that - omits the identifier.128) + omits the identifier.128) 3 EXAMPLE The constructions (a) int (b) int * @@ -5278,18 +5278,18 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 122] (Contents) +[page 122] (Contents) 6.7.7 Type definitions - Syntax + Syntax 1 typedef-name: identifier - Constraints + Constraints 2 If a typedef name specifies a variably modified type then it shall have block scope. - Semantics + Semantics 3 In a declaration whose storage-class specifier is typedef, each declarator defines an identifier to be a typedef name that denotes the type specified for the identifier in the way described in 6.7.5. Any array size expressions associated with variable length array @@ -5324,7 +5324,7 @@ Forward references: conditional inclusion (6.10.1), -[page 123] (Contents) +[page 123] (Contents) 6 EXAMPLE 3 The following obscure constructions typedef signed int t; @@ -5371,10 +5371,10 @@ Forward references: conditional inclusion (6.10.1), -[page 124] (Contents) +[page 124] (Contents) 6.7.8 Initialization - Syntax + Syntax 1 initializer: assignment-expression { initializer-list } @@ -5390,7 +5390,7 @@ Forward references: conditional inclusion (6.10.1), designator: [ constant-expression ] . identifier - Constraints + Constraints 2 No initializer shall attempt to provide a value for an object not contained within the entity being initialized. 3 The type of the entity to be initialized shall be an array of unknown size or an object type @@ -5408,9 +5408,9 @@ Forward references: conditional inclusion (6.10.1), . identifier then the current object (defined below) shall have structure or union type and the identifier shall be the name of a member of that type. -[page 125] (Contents) +[page 125] (Contents) - Semantics + Semantics 8 An initializer specifies the initial value stored in an object. 9 Except where explicitly stated otherwise, for the purposes of this subclause unnamed members of objects of structure and union type do not participate in initialization. @@ -5446,19 +5446,19 @@ Forward references: conditional inclusion (6.10.1), 17 Each brace-enclosed initializer list has an associated current object. When no designations are present, subobjects of the current object are initialized in order according to the type of the current object: array elements in increasing subscript order, structure -[page 126] (Contents) +[page 126] (Contents) - members in declaration order, and the first named member of a union.129) In contrast, a + members in declaration order, and the first named member of a union.129) In contrast, a designation causes the following initializer to begin initialization of the subobject described by the designator. Initialization then continues forward in order, beginning - with the next subobject after that described by the designator.130) + with the next subobject after that described by the designator.130) 18 Each designator list begins its description with the current object associated with the closest surrounding brace pair. Each item in the designator list (in order) specifies a particular member of its current object and changes the current object for the next - designator (if any) to be that member.131) The current object that results at the end of the + designator (if any) to be that member.131) The current object that results at the end of the designator list is the subobject to be initialized by the following initializer. 19 The initialization shall occur in initializer list order, each initializer provided for a - particular subobject overriding any previously listed initializer for the same subobject;132) + particular subobject overriding any previously listed initializer for the same subobject;132) all subobjects that are not initialized explicitly shall be initialized implicitly the same as objects that have static storage duration. 20 If the aggregate or union contains elements or members that are aggregates or unions, @@ -5479,24 +5479,24 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 127] (Contents) +[page 127] (Contents) 23 The order in which any side effects occur among the initialization list expressions is - unspecified.133) + unspecified.133) 24 EXAMPLE 1 Provided that <complex.h> has been #included, the declarations int i = 3.5; double complex c = 5 + 3 * I; - define and initialize i with the value 3 and c with the value 5.0 + i3.0. + define and initialize i with the value 3 and c with the value 5.0 + i3.0. 25 EXAMPLE 2 The declaration int x[] = { 1, 3, 5 }; @@ -5533,9 +5533,9 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 128] (Contents) +[page 128] (Contents) 29 EXAMPLE 6 The declaration short q[4][3][2] = { @@ -5584,7 +5584,7 @@ Forward references: conditional inclusion (6.10.1), -[page 129] (Contents) +[page 129] (Contents) 32 EXAMPLE 8 The declaration char s[] = "abc", t[3] = "abc"; @@ -5629,10 +5629,10 @@ Forward references: conditional inclusion (6.10.1), -[page 130] (Contents) +[page 130] (Contents) 6.8 Statements and blocks - Syntax + Syntax 1 statement: labeled-statement compound-statement @@ -5640,7 +5640,7 @@ Forward references: conditional inclusion (6.10.1), selection-statement iteration-statement jump-statement - Semantics + Semantics 2 A statement specifies an action to be performed. Except as indicated, statements are executed in sequence. 3 A block allows a set of declarations and statements to be grouped into one syntactic unit. @@ -5658,26 +5658,26 @@ Forward references: conditional inclusion (6.10.1), Forward references: expression and null statements (6.8.3), selection statements (6.8.4), iteration statements (6.8.5), the return statement (6.8.6.4). 6.8.1 Labeled statements - Syntax + Syntax 1 labeled-statement: identifier : statement case constant-expression : statement default : statement - Constraints + Constraints 2 A case or default label shall appear only in a switch statement. Further constraints on such labels are discussed under the switch statement. -[page 131] (Contents) +[page 131] (Contents) 3 Label names shall be unique within a function. - Semantics + Semantics 4 Any statement may be preceded by a prefix that declares an identifier as a label name. Labels in themselves do not alter the flow of control, which continues unimpeded across them. Forward references: the goto statement (6.8.6.1), the switch statement (6.8.4.2). 6.8.2 Compound statement - Syntax + Syntax 1 compound-statement: { block-item-listopt } block-item-list: @@ -5686,15 +5686,15 @@ Forward references: conditional inclusion (6.10.1), block-item: declaration statement - Semantics + Semantics 2 A compound statement is a block. 6.8.3 Expression and null statements - Syntax + Syntax 1 expression-statement: expressionopt ; - Semantics + Semantics 2 The expression in an expression statement is evaluated as a void expression for its side - effects.134) + effects.134) 3 A null statement (consisting of just a semicolon) performs no operations. 4 EXAMPLE 1 If a function call is evaluated as an expression statement for its side effects only, the discarding of its value may be made explicit by converting the expression to a void expression by means of @@ -5705,9 +5705,9 @@ Forward references: conditional inclusion (6.10.1), - 134) Such as assignments, and function calls which have side effects. + 134) Such as assignments, and function calls which have side effects. -[page 132] (Contents) +[page 132] (Contents) 5 EXAMPLE 2 In the program fragment char *s; @@ -5732,43 +5732,43 @@ Forward references: conditional inclusion (6.10.1), Forward references: iteration statements (6.8.5). 6.8.4 Selection statements - Syntax + Syntax 1 selection-statement: if ( expression ) statement if ( expression ) statement else statement switch ( expression ) statement - Semantics + Semantics 2 A selection statement selects among a set of statements depending on the value of a controlling expression. 3 A selection statement is a block whose scope is a strict subset of the scope of its enclosing block. Each associated substatement is also a block whose scope is a strict subset of the scope of the selection statement. 6.8.4.1 The if statement - Constraints + Constraints 1 The controlling expression of an if statement shall have scalar type. - Semantics + Semantics 2 In both forms, the first substatement is executed if the expression compares unequal to 0. In the else form, the second substatement is executed if the expression compares equal -[page 133] (Contents) +[page 133] (Contents) to 0. If the first substatement is reached via a label, the second substatement is not executed. 3 An else is associated with the lexically nearest preceding if that is allowed by the syntax. 6.8.4.2 The switch statement - Constraints + Constraints 1 The controlling expression of a switch statement shall have integer type. 2 If a switch statement has an associated case or default label within the scope of an identifier with a variably modified type, the entire switch statement shall be within the - scope of that identifier.135) + scope of that identifier.135) 3 The expression of each case label shall be an integer constant expression and no two of the case constant expressions in the same switch statement shall have the same value after conversion. There may be at most one default label in a switch statement. (Any enclosed switch statement may have a default label or case constant expressions with values that duplicate case constant expressions in the enclosing switch statement.) - Semantics + Semantics 4 A switch statement causes control to jump to, into, or past the statement that is the switch body, depending on the value of a controlling expression, and on the presence of a default label and the values of any case labels on or in the switch body. A case or @@ -5787,10 +5787,10 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 134] (Contents) +[page 134] (Contents) 7 EXAMPLE In the artificial program fragment switch (expr) @@ -5808,20 +5808,20 @@ Forward references: conditional inclusion (6.10.1), access an indeterminate value. Similarly, the call to the function f cannot be reached. 6.8.5 Iteration statements - Syntax + Syntax 1 iteration-statement: while ( expression ) statement do statement while ( expression ) ; for ( expressionopt ; expressionopt ; expressionopt ) statement for ( declaration expressionopt ; expressionopt ) statement - Constraints + Constraints 2 The controlling expression of an iteration statement shall have scalar type. 3 The declaration part of a for statement shall only declare identifiers for objects having storage class auto or register. - Semantics + Semantics 4 An iteration statement causes a statement called the loop body to be executed repeatedly until the controlling expression compares equal to 0. The repetition occurs regardless of - whether the loop body is entered from the iteration statement or by a jump.136) + whether the loop body is entered from the iteration statement or by a jump.136) 5 An iteration statement is a block whose scope is a strict subset of the scope of its enclosing block. The loop body is also a block whose scope is a strict subset of the scope of the iteration statement. @@ -5829,10 +5829,10 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 135] (Contents) +[page 135] (Contents) 6.8.5.1 The while statement 1 The evaluation of the controlling expression takes place before each execution of the loop @@ -5849,35 +5849,35 @@ Forward references: conditional inclusion (6.10.1), declaration, the scope of any identifiers it declares is the remainder of the declaration and the entire loop, including the other two expressions; it is reached in the order of execution before the first evaluation of the controlling expression. If clause-1 is an expression, it is - evaluated as a void expression before the first evaluation of the controlling expression.137) + evaluated as a void expression before the first evaluation of the controlling expression.137) 2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a nonzero constant. 6.8.6 Jump statements - Syntax + Syntax 1 jump-statement: goto identifier ; continue ; break ; return expressionopt ; - Semantics + Semantics 2 A jump statement causes an unconditional jump to another place. - 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. -[page 136] (Contents) +[page 136] (Contents) 6.8.6.1 The goto statement - Constraints + Constraints 1 The identifier in a goto statement shall name a label located somewhere in the enclosing function. A goto statement shall not jump from outside the scope of an identifier having a variably modified type to inside the scope of that identifier. - Semantics + Semantics 2 A goto statement causes an unconditional jump to the statement prefixed by the named label in the enclosing function. 3 EXAMPLE 1 It is sometimes convenient to jump into the middle of a complicated set of statements. The @@ -5906,7 +5906,7 @@ Forward references: conditional inclusion (6.10.1), -[page 137] (Contents) +[page 137] (Contents) 4 EXAMPLE 2 A goto statement is not allowed to jump past any declarations of objects with variably modified types. A jump within the scope, however, is permitted. @@ -5924,9 +5924,9 @@ Forward references: conditional inclusion (6.10.1), goto lab4; // invalid: going INTO scope of VLA. 6.8.6.2 The continue statement - Constraints + Constraints 1 A continue statement shall appear only in or as a loop body. - Semantics + Semantics 2 A continue statement causes a jump to the loop-continuation portion of the smallest enclosing iteration statement; that is, to the end of the loop body. More precisely, in each of the statements @@ -5937,32 +5937,32 @@ Forward references: conditional inclusion (6.10.1), contin: ; contin: ; contin: ; } } while (/* ... */); } unless the continue statement shown is in an enclosed iteration statement (in which - case it is interpreted within that statement), it is equivalent to goto contin;.138) + case it is interpreted within that statement), it is equivalent to goto contin;.138) 6.8.6.3 The break statement - Constraints + Constraints 1 A break statement shall appear only in or as a switch body or loop body. - Semantics + Semantics 2 A break statement terminates execution of the smallest enclosing switch or iteration statement. - 138) Following the contin: label is a null statement. + 138) Following the contin: label is a null statement. -[page 138] (Contents) +[page 138] (Contents) 6.8.6.4 The return statement - Constraints + Constraints 1 A return statement with an expression shall not appear in a function whose return type is void. A return statement without an expression shall only appear in a function whose return type is void. - Semantics + Semantics 2 A return statement terminates execution of the current function and returns control to its caller. A function may have any number of return statements. 3 If a return statement with an expression is executed, the value of the expression is returned to the caller as the value of the function call expression. If the expression has a type different from the return type of the function in which it appears, the value is - converted as if by assignment to an object having the return type of the function.139) + converted as if by assignment to an object having the return type of the function.139) 4 EXAMPLE In: struct s { double i; } f(void); union { @@ -5987,22 +5987,22 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 139] (Contents) +[page 139] (Contents) 6.9 External definitions - Syntax + Syntax 1 translation-unit: external-declaration translation-unit external-declaration external-declaration: function-definition declaration - Constraints + Constraints 2 The storage-class specifiers auto and register shall not appear in the declaration specifiers in an external declaration. 3 There shall be no more than one external definition for each identifier declared with @@ -6010,7 +6010,7 @@ Forward references: conditional inclusion (6.10.1), linkage is used in an expression (other than as a part of the operand of a sizeof operator whose result is an integer constant), there shall be exactly one external definition for the identifier in the translation unit. - Semantics + Semantics 4 As discussed in 5.1.1.1, the unit of program text after preprocessing is a translation unit, which consists of a sequence of external declarations. These are described as ''external'' because they appear outside any function (and hence have file scope). As discussed in @@ -6021,26 +6021,26 @@ Forward references: conditional inclusion (6.10.1), linkage is used in an expression (other than as part of the operand of a sizeof operator whose result is an integer constant), somewhere in the entire program there shall be exactly one external definition for the identifier; otherwise, there shall be no more than - one.140) + one.140) - 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. -[page 140] (Contents) +[page 140] (Contents) 6.9.1 Function definitions - Syntax + Syntax 1 function-definition: declaration-specifiers declarator declaration-listopt compound-statement declaration-list: declaration declaration-list declaration - Constraints + Constraints 2 The identifier declared in a function definition (which is the name of the function) shall - have a function type, as specified by the declarator portion of the function definition.141) + have a function type, as specified by the declarator portion of the function definition.141) 3 The return type of a function shall be void or an object type other than array type. 4 The storage-class specifier, if any, in the declaration specifiers shall be either extern or static. @@ -6058,7 +6058,7 @@ Forward references: conditional inclusion (6.10.1), - 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 // returning int'' F f, g; // f and g both have type compatible with F @@ -6072,14 +6072,14 @@ Forward references: conditional inclusion (6.10.1), F *Fp; // Fp points to a function that has type F -[page 141] (Contents) +[page 141] (Contents) - Semantics + Semantics 7 The declarator in a function definition specifies the name of the function being defined and the identifiers of its parameters. If the declarator includes a parameter type list, the list also specifies the types of all the parameters; such a declarator also serves as a function prototype for later calls to the same function in the same translation unit. If the - declarator includes an identifier list,142) the types of the parameters shall be declared in a + declarator includes an identifier list,142) the types of the parameters shall be declared in a following declaration list. In either case, the type of each parameter is adjusted as described in 6.7.5.3 for a parameter type list; the resulting type shall be an object type. 8 If a function that accepts a variable number of arguments is defined without a parameter @@ -6110,9 +6110,9 @@ Forward references: conditional inclusion (6.10.1), - 142) See ''future language directions'' (6.11.7). + 142) See ''future language directions'' (6.11.7). -[page 142] (Contents) +[page 142] (Contents) extern int max(a, b) int a, b; @@ -6141,7 +6141,7 @@ Forward references: conditional inclusion (6.10.1), } 6.9.2 External object definitions - Semantics + Semantics 1 If the declaration of an identifier for an object has file scope and an initializer, the declaration is an external definition for the identifier. 2 A declaration of an identifier for an object that has file scope without an initializer, and @@ -6157,7 +6157,7 @@ Forward references: conditional inclusion (6.10.1), -[page 143] (Contents) +[page 143] (Contents) 4 EXAMPLE 1 int i1 = 1; // definition, external linkage @@ -6184,10 +6184,10 @@ Forward references: conditional inclusion (6.10.1), -[page 144] (Contents) +[page 144] (Contents) 6.10 Preprocessing directives - Syntax + Syntax 1 preprocessing-file: groupopt group: @@ -6217,7 +6217,7 @@ Forward references: conditional inclusion (6.10.1), -[page 145] (Contents) +[page 145] (Contents) control-line: # include pp-tokens new-line @@ -6245,20 +6245,20 @@ Forward references: conditional inclusion (6.10.1), pp-tokens preprocessing-token new-line: the new-line character - Description + Description 2 A preprocessing directive consists of a sequence of preprocessing tokens that satisfies the following constraints: The first token in the sequence is a # preprocessing token that (at the start of translation phase 4) is either the first character in the source file (optionally after white space containing no new-line characters) or that follows white space containing at least one new-line character. The last token in the sequence is the first new- - line character that follows the first token in the sequence.143) A new-line character ends + line character that follows the first token in the sequence.143) A new-line character ends the preprocessing directive even if it occurs within what would otherwise be an - 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). -[page 146] (Contents) +[page 146] (Contents) invocation of a function-like macro. 3 A text line shall not begin with a # preprocessing token. A non-directive shall not begin @@ -6266,13 +6266,13 @@ Forward references: conditional inclusion (6.10.1), 4 When in a group that is skipped (6.10.1), the directive syntax is relaxed to allow any sequence of preprocessing tokens to occur between the directive name and the following new-line character. - Constraints + Constraints 5 The only white-space characters that shall appear between preprocessing tokens within a preprocessing directive (from just after the introducing # preprocessing token through just before the terminating new-line character) are space and horizontal-tab (including spaces that have replaced comments or possibly other white-space characters in translation phase 3). - Semantics + Semantics 6 The implementation can process and skip sections of source files conditionally, include other source files, and replace macros. These capabilities are called preprocessing, because conceptually they occur before translation of the resulting translation unit. @@ -6286,19 +6286,19 @@ Forward references: conditional inclusion (6.10.1), replaced. 6.10.1 Conditional inclusion - Constraints + Constraints 1 The expression that controls conditional inclusion shall be an integer constant expression except that: it shall not contain a cast; identifiers (including those lexically identical to - keywords) are interpreted as described below;144) and it may contain unary operator + keywords) are interpreted as described below;144) and it may contain unary operator expressions of the form - 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. -[page 147] (Contents) +[page 147] (Contents) defined identifier or @@ -6309,7 +6309,7 @@ Forward references: conditional inclusion (6.10.1), 2 Each preprocessing token that remains (in the list of preprocessing tokens that will become the controlling expression) after all macro replacements have occurred shall be in the lexical form of a token (6.4). - Semantics + Semantics 3 Preprocessing directives of the forms # if constant-expression new-line groupopt # elif constant-expression new-line groupopt @@ -6326,21 +6326,21 @@ Forward references: conditional inclusion (6.10.1), expression which is evaluated according to the rules of 6.6. For the purposes of this token conversion and evaluation, all signed integer types and all unsigned integer types act as if they have the same representation as, respectively, the types intmax_t and - uintmax_t defined in the header <stdint.h>.145) This includes interpreting + uintmax_t defined in the header <stdint.h>.145) This includes interpreting character constants, which may involve converting escape sequences into execution character set members. Whether the numeric value for these character constants matches the value obtained when an identical character constant occurs in an expression (other - than within a #if or #elif directive) is implementation-defined.146) Also, whether a + than within a #if or #elif directive) is implementation-defined.146) Also, whether a single-character character constant may have a negative value is implementation-defined. 5 Preprocessing directives of the forms - 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. -[page 148] (Contents) +[page 148] (Contents) # ifdef identifier new-line groupopt # ifndef identifier new-line groupopt @@ -6354,14 +6354,14 @@ Forward references: conditional inclusion (6.10.1), group. Only the first group whose control condition evaluates to true (nonzero) is processed. If none of the conditions evaluates to true, and there is a #else directive, the group controlled by the #else is processed; lacking a #else directive, all the groups - until the #endif are skipped.147) + until the #endif are skipped.147) Forward references: macro replacement (6.10.3), source file inclusion (6.10.2), largest integer types (7.18.1.5). 6.10.2 Source file inclusion - Constraints + Constraints 1 A #include directive shall identify a header or source file that can be processed by the implementation. - Semantics + Semantics 2 A preprocessing directive of the form # include <h-char-sequence> new-line searches a sequence of implementation-defined places for a header identified uniquely by @@ -6372,16 +6372,16 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 149] (Contents) +[page 149] (Contents) # include "q-char-sequence" new-line causes the replacement of that directive by the entire contents of the source file identified @@ -6397,7 +6397,7 @@ Forward references: conditional inclusion (6.10.1), tokens after include in the directive are processed just as in normal text. (Each identifier currently defined as a macro name is replaced by its replacement list of preprocessing tokens.) The directive resulting after all replacements shall match one of - the two previous forms.148) The method by which a sequence of preprocessing tokens + the two previous forms.148) The method by which a sequence of preprocessing tokens between a < and a > preprocessing token pair or a pair of " characters is combined into a single header name preprocessing token is implementation-defined. 5 The implementation shall provide unique mappings for sequences consisting of one or @@ -6417,10 +6417,10 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 150] (Contents) +[page 150] (Contents) #if VERSION == 1 #define INCFILE "vers1.h" @@ -6433,7 +6433,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: macro replacement (6.10.3). 6.10.3 Macro replacement - Constraints + Constraints 1 Two replacement lists are identical if and only if the preprocessing tokens in both have the same number, ordering, spelling, and white-space separation, where all white-space separations are considered identical. @@ -6456,19 +6456,19 @@ Forward references: conditional inclusion (6.10.1), macro that uses the ellipsis notation in the parameters. 6 A parameter identifier in a function-like macro shall be uniquely declared within its scope. - Semantics + Semantics 7 The identifier immediately following the define is called the macro name. There is one name space for macro names. Any white-space characters preceding or following the replacement list of preprocessing tokens are not considered part of the replacement list for either form of macro. -[page 151] (Contents) +[page 151] (Contents) 8 If a # preprocessing token, followed by an identifier, occurs lexically at the point at which a preprocessing directive could begin, the identifier is not subject to macro replacement. 9 A preprocessing directive of the form # define identifier replacement-list new-line - defines an object-like macro that causes each subsequent instance of the macro name149) + defines an object-like macro that causes each subsequent instance of the macro name149) to be replaced by the replacement list of preprocessing tokens that constitute the remainder of the directive. The replacement list is then rescanned for more macro names as specified below. @@ -6492,18 +6492,18 @@ Forward references: conditional inclusion (6.10.1), the list are separated by comma preprocessing tokens, but comma preprocessing tokens between matching inner parentheses do not separate arguments. If there are sequences of preprocessing tokens within the list of arguments that would otherwise act as - preprocessing directives,150) the behavior is undefined. + preprocessing directives,150) the behavior is undefined. 12 If there is a ... in the identifier-list in the macro definition, then the trailing arguments, including any separating comma preprocessing tokens, are merged to form a single item: the variable arguments. The number of arguments so combined is such that, following - 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. -[page 152] (Contents) +[page 152] (Contents) merger, the number of arguments is one more than the number of parameters in the macro definition (excluding the ...). @@ -6519,10 +6519,10 @@ Forward references: conditional inclusion (6.10.1), were a parameter, and the variable arguments shall form the preprocessing tokens used to replace it. 6.10.3.2 The # operator - Constraints + Constraints 1 Each # preprocessing token in the replacement list for a function-like macro shall be followed by a parameter as the next preprocessing token in the replacement list. - Semantics + Semantics 2 If, in the replacement list, a parameter is immediately preceded by a # preprocessing token, both are replaced by a single character string literal preprocessing token that contains the spelling of the preprocessing token sequence for the corresponding @@ -6542,18 +6542,18 @@ Forward references: conditional inclusion (6.10.1), -[page 153] (Contents) +[page 153] (Contents) 6.10.3.3 The ## operator - Constraints + Constraints 1 A ## preprocessing token shall not occur at the beginning or at the end of a replacement list for either form of macro definition. - Semantics + Semantics 2 If, in the replacement list of a function-like macro, a parameter is immediately preceded or followed by a ## preprocessing token, the parameter is replaced by the corresponding argument's preprocessing token sequence; however, if an argument consists of no preprocessing tokens, the parameter is replaced by a placemarker preprocessing token - instead.151) + instead.151) 3 For both object-like and function-like macro invocations, before the replacement list is reexamined for more macro names to replace, each instance of a ## preprocessing token in the replacement list (not from an argument) is deleted and the preceding preprocessing @@ -6581,10 +6581,10 @@ Forward references: conditional inclusion (6.10.1), this new token is not the ## operator. - 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. -[page 154] (Contents) +[page 154] (Contents) 6.10.3.4 Rescanning and further replacement 1 After all parameters in the replacement list have been substituted and # and ## @@ -6623,7 +6623,7 @@ Forward references: conditional inclusion (6.10.1), -[page 155] (Contents) +[page 155] (Contents) 5 EXAMPLE 3 To illustrate the rules for redefinition and reexamination, the sequence #define x 3 @@ -6673,7 +6673,7 @@ Forward references: conditional inclusion (6.10.1), -[page 156] (Contents) +[page 156] (Contents) printf("x" "1" "= %d, x" "2" "= %s", x1, x2); fputs( @@ -6724,7 +6724,7 @@ Forward references: conditional inclusion (6.10.1), report(x>y, "x is %d but y is %d", x, y); -[page 157] (Contents) +[page 157] (Contents) results in fprintf(stderr, "Flag" ); @@ -6734,9 +6734,9 @@ Forward references: conditional inclusion (6.10.1), printf("x is %d but y is %d", x, y)); 6.10.4 Line control - Constraints + Constraints 1 The string literal of a #line directive, if present, shall be a character string literal. - Semantics + Semantics 2 The line number of the current source line is one greater than the number of new-line characters read or introduced in translation phase 1 (5.1.1.2) while processing the source file to the current token. @@ -6761,26 +6761,26 @@ Forward references: conditional inclusion (6.10.1), -[page 158] (Contents) +[page 158] (Contents) 6.10.5 Error directive - Semantics + Semantics 1 A preprocessing directive of the form # error pp-tokensopt new-line causes the implementation to produce a diagnostic message that includes the specified sequence of preprocessing tokens. 6.10.6 Pragma directive - Semantics + Semantics 1 A preprocessing directive of the form # pragma pp-tokensopt new-line where the preprocessing token STDC does not immediately follow pragma in the - directive (prior to any macro replacement)152) causes the implementation to behave in an + directive (prior to any macro replacement)152) causes the implementation to behave in an implementation-defined manner. The behavior might cause translation to fail or cause the translator or the resulting program to behave in a non-conforming manner. Any such pragma that is not recognized by the implementation is ignored. 2 If the preprocessing token STDC does immediately follow pragma in the directive (prior to any macro replacement), then no macro replacement is performed on the directive, and - the directive shall have one of the following forms153) whose meanings are described + the directive shall have one of the following forms153) whose meanings are described elsewhere: #pragma STDC FP_CONTRACT on-off-switch #pragma STDC FENV_ACCESS on-off-switch @@ -6793,29 +6793,29 @@ Forward references: conditional inclusion (6.10.1), - 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). -[page 159] (Contents) +[page 159] (Contents) 6.10.7 Null directive - Semantics + Semantics 1 A preprocessing directive of the form # new-line has no effect. 6.10.8 Predefined macro names -1 The following macro names154) shall be defined by the implementation: +1 The following macro names154) shall be defined by the implementation: __DATE__ The date of translation of the preprocessing translation unit: a character string literal of the form "Mmm dd yyyy", where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10. If the date of translation is not available, an implementation-defined valid date shall be supplied. - __FILE__ The presumed name of the current source file (a character string literal).155) + __FILE__ The presumed name of the current source file (a character string literal).155) __LINE__ The presumed line number (within the current source file) of the current source line (an integer constant).155) __STDC__ The integer constant 1, intended to indicate a conforming implementation. @@ -6825,7 +6825,7 @@ Forward references: conditional inclusion (6.10.1), the encoding for wchar_t, a member of the basic character set need not have a code value equal to its value when used as the lone character in an integer character constant. - __STDC_VERSION__ The integer constant 199901L.156) + __STDC_VERSION__ The integer constant 199901L.156) __TIME__ The time of translation of the preprocessing translation unit: a character string literal of the form "hh:mm:ss" as in the time generated by the asctime function. If the time of translation is not available, an @@ -6833,19 +6833,19 @@ Forward references: conditional inclusion (6.10.1), - 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. -[page 160] (Contents) +[page 160] (Contents) 2 The following macro names are conditionally defined by the implementation: __STDC_IEC_559__ The integer constant 1, intended to indicate conformance to the - specifications in annex F (IEC 60559 floating-point arithmetic). + specifications in annex F (IEC 60559 floating-point arithmetic). __STDC_IEC_559_COMPLEX__ The integer constant 1, intended to indicate - adherence to the specifications in informative annex G (IEC 60559 + adherence to the specifications in informative annex G (IEC 60559 compatible complex arithmetic). __STDC_ISO_10646__ An integer constant of the form yyyymmL (for example, 199712L). If this symbol is defined, then every character in the Unicode @@ -6864,7 +6864,7 @@ Forward references: conditional inclusion (6.10.1), in any standard header. Forward references: the asctime function (7.23.3.1), standard headers (7.1.2). 6.10.9 Pragma operator - Semantics + Semantics 1 A unary operator expression of the form: _Pragma ( string-literal ) is processed as follows: The string literal is destringized by deleting the L prefix, if @@ -6877,7 +6877,7 @@ Forward references: conditional inclusion (6.10.1), 2 EXAMPLE A directive of the form: #pragma listing on "..\listing.dir" can also be expressed as: -[page 161] (Contents) +[page 161] (Contents) _Pragma ( "listing on \"..\\listing.dir\"" ) The latter form is processed in the same way whether it appears literally as shown, or results from macro @@ -6889,7 +6889,7 @@ replacement, as in: -[page 162] (Contents) +[page 162] (Contents) 6.11 Future language directions 6.11.1 Floating types @@ -6922,7 +6922,7 @@ replacement, as in: -[page 163] (Contents) +[page 163] (Contents) 7. Library @@ -6937,7 +6937,7 @@ replacement, as in: the value of a string is the sequence of the values of the contained characters, in order. 2 The decimal-point character is the character used by functions that convert floating-point numbers to or from character sequences to denote the beginning of the fractional part of - such character sequences.157) It is represented in the text and examples by a period, but + such character sequences.157) It is represented in the text and examples by a period, but may be changed by the setlocale function. 3 A null wide character is a wide character with code value zero. 4 A wide string is a contiguous sequence of wide characters terminated by and including @@ -6948,23 +6948,23 @@ replacement, as in: 5 A shift sequence is a contiguous sequence of bytes within a multibyte string that (potentially) causes a change in shift state (see 5.2.1.2). A shift sequence shall not have a corresponding wide character; it is instead taken to be an adjunct to an adjacent multibyte - character.158) + character.158) Forward references: character handling (7.4), the setlocale function (7.11.1.1). - 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. -[page 164] (Contents) +[page 164] (Contents) 7.1.2 Standard headers -1 Each library function is declared, with a type that includes a prototype, in a header,159) +1 Each library function is declared, with a type that includes a prototype, in a header,159) whose contents are made available by the #include preprocessing directive. The header declares a set of related functions, plus any necessary types and additional macros needed to facilitate their use. Declarations of types described in this clause shall not @@ -6993,16 +6993,16 @@ replacement, as in: fully protected by parentheses where necessary, so that it groups in an arbitrary expression as if it were a single identifier. 6 Any declaration of a library function shall have external linkage. -7 A summary of the contents of the standard headers is given in annex B. +7 A summary of the contents of the standard headers is given in annex B. Forward references: diagnostics (7.2). - 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. -[page 165] (Contents) +[page 165] (Contents) 7.1.3 Reserved identifiers 1 Each header declares or defines all identifiers listed in its associated subclause, and @@ -7018,7 +7018,7 @@ replacement, as in: unless explicitly stated otherwise (see 7.1.4). -- All identifiers with external linkage in any of the following subclauses (including the future library directions) are always reserved for use as identifiers with external - linkage.160) + linkage.160) -- Each identifier with file scope listed in any of the following subclauses (including the future library directions) is reserved for use as a macro name and as an identifier with file scope in the same name space if any of its associated headers is included. @@ -7039,10 +7039,10 @@ replacement, as in: pointer did point to the first element of such an array) are in fact valid. Any function declared in a header may be additionally implemented as a function-like macro defined in - 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. -[page 166] (Contents) +[page 166] (Contents) the header, so if a library function is declared explicitly when its header is included, one of the techniques shown below can be used to ensure the declaration is not affected by @@ -7050,13 +7050,13 @@ replacement, as in: the name of the function in parentheses, because the name is then not followed by the left parenthesis that indicates expansion of a macro function name. For the same syntactic reason, it is permitted to take the address of a library function even if it is also defined as - a macro.161) The use of #undef to remove any macro definition will also ensure that an + a macro.161) The use of #undef to remove any macro definition will also ensure that an actual function is referred to. Any invocation of a library function that is implemented as a macro shall expand to code that evaluates each of its arguments exactly once, fully protected by parentheses where necessary, so it is generally safe to use arbitrary - expressions as arguments.162) Likewise, those function-like macros described in the + expressions as arguments.162) Likewise, those function-like macros described in the following subclauses may be invoked in an expression anywhere a function with a - compatible return type could be called.163) All object-like macros listed as expanding to + compatible return type could be called.163) All object-like macros listed as expanding to integer constant expressions shall additionally be suitable for use in #if preprocessing directives. 2 Provided that a library function can be declared without reference to any type defined in a @@ -7064,14 +7064,14 @@ replacement, as in: associated header. 3 There is a sequence point immediately before a library function returns. 4 The functions in the standard library are not guaranteed to be reentrant and may modify - objects with static storage duration.164) + objects with static storage duration.164) - 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 @@ -7083,9 +7083,9 @@ replacement, as in: 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. -[page 167] (Contents) +[page 167] (Contents) 5 EXAMPLE The function atoi may be used in any of several ways: -- by use of its associated header (possibly generating a macro expansion) @@ -7113,7 +7113,7 @@ replacement, as in: -[page 168] (Contents) +[page 168] (Contents) 7.2 Diagnostics <assert.h> 1 The header <assert.h> defines the assert macro and refers to another macro, @@ -7129,35 +7129,35 @@ replacement, as in: undefined. 7.2.1 Program diagnostics 7.2.1.1 The assert macro - Synopsis + Synopsis 1 #include <assert.h> void assert(scalar expression); - Description + Description 2 The assert macro puts diagnostic tests into programs; it expands to a void expression. When it is executed, if expression (which shall have a scalar type) is false (that is, compares equal to 0), the assert macro writes information about the particular call that failed (including the text of the argument, the name of the source file, the source line number, and the name of the enclosing function -- the latter are respectively the values of the preprocessing macros __FILE__ and __LINE__ and of the identifier - __func__) on the standard error stream in an implementation-defined format.165) It + __func__) on the standard error stream in an implementation-defined format.165) It then calls the abort function. - Returns + Returns 3 The assert macro returns no value. Forward references: the abort function (7.20.4.1). - 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. -[page 169] (Contents) +[page 169] (Contents) 7.3 Complex arithmetic <complex.h> 7.3.1 Introduction 1 The header <complex.h> defines macros and declares functions that support complex - arithmetic.166) Each synopsis specifies a family of functions consisting of a principal + arithmetic.166) Each synopsis specifies a family of functions consisting of a principal function with one or more double complex parameters and a double complex or double return value; and other functions with the same name but with f and l suffixes which are corresponding functions with float and long double parameters and @@ -7167,12 +7167,12 @@ replacement, as in: expands to _Complex; the macro _Complex_I expands to a constant expression of type const float _Complex, with the value of - the imaginary unit.167) + the imaginary unit.167) 3 The macros imaginary and _Imaginary_I - are defined if and only if the implementation supports imaginary types;168) if defined, + are defined if and only if the implementation supports imaginary types;168) if defined, they expand to _Imaginary and a constant expression of type const float _Imaginary with the value of the imaginary unit. 4 The macro @@ -7181,15 +7181,15 @@ replacement, as in: defined, I shall expand to _Complex_I. 5 Notwithstanding the provisions of 7.1.3, a program may undefine and perhaps then redefine the macros complex, imaginary, and I. - Forward references: IEC 60559-compatible complex arithmetic (annex G). + Forward references: IEC 60559-compatible complex arithmetic (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. + 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. -[page 170] (Contents) +[page 170] (Contents) 7.3.2 Conventions 1 Values are interpreted as radians, not degrees. An implementation may set errno but is @@ -7197,13 +7197,13 @@ replacement, as in: 7.3.3 Branch cuts 1 Some of the functions below have branch cuts, across which the function is discontinuous. For implementations with a signed zero (including all IEC 60559 - implementations) that follow the specifications of annex G, the sign of zero distinguishes + implementations) that follow the specifications of annex G, the sign of zero distinguishes one side of a cut from another so the function is continuous (except for format limitations) as the cut is approached from either side. For example, for the square root function, which has a branch cut along the negative real axis, the top of the cut, with imaginary part +0, maps to the positive imaginary axis, and the bottom of the cut, with imaginary part -0, maps to the negative imaginary axis. -2 Implementations that do not support a signed zero (see annex F) cannot distinguish the +2 Implementations that do not support a signed zero (see annex F) cannot distinguish the sides of branch cuts. These implementations shall map a cut so the function is continuous as the cut is approached coming around the finite endpoint of the cut in a counter clockwise direction. (Branch cuts for the functions specified here have just one finite @@ -7211,25 +7211,25 @@ replacement, as in: the finite endpoint of the cut along the negative real axis approaches the cut from above, so the cut maps to the positive imaginary axis. 7.3.4 The CX_LIMITED_RANGE pragma - Synopsis + Synopsis 1 #include <complex.h> #pragma STDC CX_LIMITED_RANGE on-off-switch - Description + Description 2 The usual mathematical formulas for complex multiply, divide, and absolute value are problematic because of their treatment of infinities and because of undue overflow and underflow. The CX_LIMITED_RANGE pragma can be used to inform the implementation that (where the state is ''on'') the usual mathematical formulas are - acceptable.169) The pragma can occur either outside external declarations or preceding all + acceptable.169) The pragma can occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement. When outside external - 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) (x + iy) / (u + iv) = [(xu + yv) + i(yu - xv)]/(u2 + v 2 ) | x + iy | = sqrt: x 2 + y 2 ??????????????? where the programmer can determine they are safe. -[page 171] (Contents) +[page 171] (Contents) declarations, the pragma takes effect from its occurrence until another CX_LIMITED_RANGE pragma is encountered, or until the end of the translation unit. @@ -7241,171 +7241,171 @@ replacement, as in: undefined. The default state for the pragma is ''off''. 7.3.5 Trigonometric functions 7.3.5.1 The cacos functions - Synopsis + Synopsis 1 #include <complex.h> double complex cacos(double complex z); float complex cacosf(float complex z); long double complex cacosl(long double complex z); - Description + Description 2 The cacos functions compute the complex arc cosine of z, with branch cuts outside the interval [-1, +1] along the real axis. - Returns + Returns 3 The cacos functions return the complex arc cosine value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [0, pi ] along the real axis. 7.3.5.2 The casin functions - Synopsis + Synopsis 1 #include <complex.h> double complex casin(double complex z); float complex casinf(float complex z); long double complex casinl(long double complex z); - Description + Description 2 The casin functions compute the complex arc sine of z, with branch cuts outside the interval [-1, +1] along the real axis. - Returns + Returns 3 The casin functions return the complex arc sine value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2] along the real axis. -[page 172] (Contents) +[page 172] (Contents) 7.3.5.3 The catan functions - Synopsis + Synopsis 1 #include <complex.h> double complex catan(double complex z); float complex catanf(float complex z); long double complex catanl(long double complex z); - Description + Description 2 The catan functions compute the complex arc tangent of z, with branch cuts outside the interval [-i, +i] along the imaginary axis. - Returns + Returns 3 The catan functions return the complex arc tangent value, in the range of a strip mathematically unbounded along the imaginary axis and in the interval [-pi /2, +pi /2] along the real axis. 7.3.5.4 The ccos functions - Synopsis + Synopsis 1 #include <complex.h> double complex ccos(double complex z); float complex ccosf(float complex z); long double complex ccosl(long double complex z); - Description + Description 2 The ccos functions compute the complex cosine of z. - Returns + Returns 3 The ccos functions return the complex cosine value. 7.3.5.5 The csin functions - Synopsis + Synopsis 1 #include <complex.h> double complex csin(double complex z); float complex csinf(float complex z); long double complex csinl(long double complex z); - Description + Description 2 The csin functions compute the complex sine of z. - Returns + Returns 3 The csin functions return the complex sine value. -[page 173] (Contents) +[page 173] (Contents) 7.3.5.6 The ctan functions - Synopsis + Synopsis 1 #include <complex.h> double complex ctan(double complex z); float complex ctanf(float complex z); long double complex ctanl(long double complex z); - Description + Description 2 The ctan functions compute the complex tangent of z. - Returns + Returns 3 The ctan functions return the complex tangent value. 7.3.6 Hyperbolic functions 7.3.6.1 The cacosh functions - Synopsis + Synopsis 1 #include <complex.h> double complex cacosh(double complex z); float complex cacoshf(float complex z); long double complex cacoshl(long double complex z); - Description + Description 2 The cacosh functions compute the complex arc hyperbolic cosine of z, with a branch cut at values less than 1 along the real axis. - Returns + Returns 3 The cacosh functions return the complex arc hyperbolic cosine value, in the range of a half-strip of non-negative values along the real axis and in the interval [-ipi , +ipi ] along the imaginary axis. 7.3.6.2 The casinh functions - Synopsis + Synopsis 1 #include <complex.h> double complex casinh(double complex z); float complex casinhf(float complex z); long double complex casinhl(long double complex z); - Description + Description 2 The casinh functions compute the complex arc hyperbolic sine of z, with branch cuts outside the interval [-i, +i] along the imaginary axis. -[page 174] (Contents) +[page 174] (Contents) - Returns + Returns 3 The casinh functions return the complex arc hyperbolic sine value, in the range of a strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2] along the imaginary axis. 7.3.6.3 The catanh functions - Synopsis + Synopsis 1 #include <complex.h> double complex catanh(double complex z); float complex catanhf(float complex z); long double complex catanhl(long double complex z); - Description + Description 2 The catanh functions compute the complex arc hyperbolic tangent of z, with branch cuts outside the interval [-1, +1] along the real axis. - Returns + Returns 3 The catanh functions return the complex arc hyperbolic tangent value, in the range of a strip mathematically unbounded along the real axis and in the interval [-ipi /2, +ipi /2] along the imaginary axis. 7.3.6.4 The ccosh functions - Synopsis + Synopsis 1 #include <complex.h> double complex ccosh(double complex z); float complex ccoshf(float complex z); long double complex ccoshl(long double complex z); - Description + Description 2 The ccosh functions compute the complex hyperbolic cosine of z. - Returns + Returns 3 The ccosh functions return the complex hyperbolic cosine value. 7.3.6.5 The csinh functions - Synopsis + Synopsis 1 #include <complex.h> double complex csinh(double complex z); float complex csinhf(float complex z); long double complex csinhl(long double complex z); -[page 175] (Contents) +[page 175] (Contents) - Description + Description 2 The csinh functions compute the complex hyperbolic sine of z. - Returns + Returns 3 The csinh functions return the complex hyperbolic sine value. 7.3.6.6 The ctanh functions - Synopsis + Synopsis 1 #include <complex.h> double complex ctanh(double complex z); float complex ctanhf(float complex z); long double complex ctanhl(long double complex z); - Description + Description 2 The ctanh functions compute the complex hyperbolic tangent of z. - Returns + Returns 3 The ctanh functions return the complex hyperbolic tangent value. 7.3.7 Exponential and logarithmic functions 7.3.7.1 The cexp functions - Synopsis + Synopsis 1 #include <complex.h> double complex cexp(double complex z); float complex cexpf(float complex z); long double complex cexpl(long double complex z); - Description + Description 2 The cexp functions compute the complex base-e exponential of z. - Returns + Returns 3 The cexp functions return the complex base-e exponential value. 7.3.7.2 The clog functions - Synopsis + Synopsis 1 #include <complex.h> double complex clog(double complex z); float complex clogf(float complex z); @@ -7413,71 +7413,71 @@ replacement, as in: -[page 176] (Contents) +[page 176] (Contents) - Description + Description 2 The clog functions compute the complex natural (base-e) logarithm of z, with a branch cut along the negative real axis. - Returns + Returns 3 The clog functions return the complex natural logarithm value, in the range of a strip mathematically unbounded along the real axis and in the interval [-ipi , +ipi ] along the imaginary axis. 7.3.8 Power and absolute-value functions 7.3.8.1 The cabs functions - Synopsis + Synopsis 1 #include <complex.h> double cabs(double complex z); float cabsf(float complex z); long double cabsl(long double complex z); - Description + Description 2 The cabs functions compute the complex absolute value (also called norm, modulus, or magnitude) of z. - Returns + Returns 3 The cabs functions return the complex absolute value. 7.3.8.2 The cpow functions - Synopsis + Synopsis 1 #include <complex.h> double complex cpow(double complex x, double complex y); float complex cpowf(float complex x, float complex y); long double complex cpowl(long double complex x, long double complex y); - Description + Description 2 The cpow functions compute the complex power function xy , with a branch cut for the first parameter along the negative real axis. - Returns + Returns 3 The cpow functions return the complex power function value. -[page 177] (Contents) +[page 177] (Contents) 7.3.8.3 The csqrt functions - Synopsis + Synopsis 1 #include <complex.h> double complex csqrt(double complex z); float complex csqrtf(float complex z); long double complex csqrtl(long double complex z); - Description + Description 2 The csqrt functions compute the complex square root of z, with a branch cut along the negative real axis. - Returns + Returns 3 The csqrt functions return the complex square root value, in the range of the right half- plane (including the imaginary axis). 7.3.9 Manipulation functions 7.3.9.1 The carg functions - Synopsis + Synopsis 1 #include <complex.h> double carg(double complex z); float cargf(float complex z); long double cargl(long double complex z); - Description + Description 2 The carg functions compute the argument (also called phase angle) of z, with a branch cut along the negative real axis. - Returns + Returns 3 The carg functions return the value of the argument in the interval [-pi , +pi ]. 7.3.9.2 The cimag functions - Synopsis + Synopsis 1 #include <complex.h> double cimag(double complex z); float cimagf(float complex z); @@ -7486,66 +7486,66 @@ replacement, as in: -[page 178] (Contents) +[page 178] (Contents) - Description -2 The cimag functions compute the imaginary part of z.170) - Returns + Description +2 The cimag functions compute the imaginary part of z.170) + Returns 3 The cimag functions return the imaginary part value (as a real). 7.3.9.3 The conj functions - Synopsis + Synopsis 1 #include <complex.h> double complex conj(double complex z); float complex conjf(float complex z); long double complex conjl(long double complex z); - Description + Description 2 The conj functions compute the complex conjugate of z, by reversing the sign of its imaginary part. - Returns + Returns 3 The conj functions return the complex conjugate value. 7.3.9.4 The cproj functions - Synopsis + Synopsis 1 #include <complex.h> double complex cproj(double complex z); float complex cprojf(float complex z); long double complex cprojl(long double complex z); - Description + Description 2 The cproj functions compute a projection of z onto the Riemann sphere: z projects to z except that all complex infinities (even those with one infinite part and one NaN part) project to positive infinity on the real axis. If z has an infinite part, then cproj(z) is equivalent to INFINITY + I * copysign(0.0, cimag(z)) - Returns + Returns 3 The cproj functions return the value of the projection onto the Riemann sphere. - 170) For a variable z of complex type, z == creal(z) + cimag(z)*I. + 170) For a variable z of complex type, z == creal(z) + cimag(z)*I. -[page 179] (Contents) +[page 179] (Contents) 7.3.9.5 The creal functions - Synopsis + Synopsis 1 #include <complex.h> double creal(double complex z); float crealf(float complex z); long double creall(long double complex z); - Description -2 The creal functions compute the real part of z.171) - Returns + Description +2 The creal functions compute the real part of z.171) + Returns 3 The creal functions return the real part value. - 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. -[page 180] (Contents) +[page 180] (Contents) 7.4 Character handling <ctype.h> 1 The header <ctype.h> declares several functions useful for classifying and mapping - characters.172) In all cases the argument is an int, the value of which shall be + characters.172) In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. 2 The behavior of these functions is affected by the current locale. Those functions that @@ -7553,133 +7553,133 @@ replacement, as in: 3 The term printing character refers to a member of a locale-specific set of characters, each of which occupies one printing position on a display device; the term control character refers to a member of a locale-specific set of characters that are not printing - characters.173) All letters and digits are printing characters. + characters.173) All letters and digits are printing characters. Forward references: EOF (7.19.1), localization (7.11). 7.4.1 Character classification functions 1 The functions in this subclause return nonzero (true) if and only if the value of the argument c conforms to that in the description of the function. 7.4.1.1 The isalnum function - Synopsis + Synopsis 1 #include <ctype.h> int isalnum(int c); - Description + Description 2 The isalnum function tests for any character for which isalpha or isdigit is true. 7.4.1.2 The isalpha function - Synopsis + Synopsis 1 #include <ctype.h> int isalpha(int c); - Description + Description 2 The isalpha function tests for any character for which isupper or islower is true, or any character that is one of a locale-specific set of alphabetic characters for which - 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). -[page 181] (Contents) +[page 181] (Contents) - none of iscntrl, isdigit, ispunct, or isspace is true.174) In the "C" locale, + none of iscntrl, isdigit, ispunct, or isspace is true.174) In the "C" locale, isalpha returns true only for the characters for which isupper or islower is true. 7.4.1.3 The isblank function - Synopsis + Synopsis 1 #include <ctype.h> int isblank(int c); - Description + Description 2 The isblank function tests for any character that is a standard blank character or is one of a locale-specific set of characters for which isspace is true and that is used to separate words within a line of text. The standard blank characters are the following: space (' '), and horizontal tab ('\t'). In the "C" locale, isblank returns true only for the standard blank characters. 7.4.1.4 The iscntrl function - Synopsis + Synopsis 1 #include <ctype.h> int iscntrl(int c); - Description + Description 2 The iscntrl function tests for any control character. 7.4.1.5 The isdigit function - Synopsis + Synopsis 1 #include <ctype.h> int isdigit(int c); - Description + Description 2 The isdigit function tests for any decimal-digit character (as defined in 5.2.1). 7.4.1.6 The isgraph function - Synopsis + Synopsis 1 #include <ctype.h> int isgraph(int c); - 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. -[page 182] (Contents) +[page 182] (Contents) - Description + Description 2 The isgraph function tests for any printing character except space (' '). 7.4.1.7 The islower function - Synopsis + Synopsis 1 #include <ctype.h> int islower(int c); - Description + Description 2 The islower function tests for any character that is a lowercase letter or is one of a locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or isspace is true. In the "C" locale, islower returns true only for the lowercase letters (as defined in 5.2.1). 7.4.1.8 The isprint function - Synopsis + Synopsis 1 #include <ctype.h> int isprint(int c); - Description + Description 2 The isprint function tests for any printing character including space (' '). 7.4.1.9 The ispunct function - Synopsis + Synopsis 1 #include <ctype.h> int ispunct(int c); - Description + Description 2 The ispunct function tests for any printing character that is one of a locale-specific set of punctuation characters for which neither isspace nor isalnum is true. In the "C" locale, ispunct returns true for every printing character for which neither isspace nor isalnum is true. 7.4.1.10 The isspace function - Synopsis + Synopsis 1 #include <ctype.h> int isspace(int c); - Description + Description 2 The isspace function tests for any character that is a standard white-space character or is one of a locale-specific set of characters for which isalnum is false. The standard -[page 183] (Contents) +[page 183] (Contents) white-space characters are the following: space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). In the "C" locale, isspace returns true only for the standard white-space characters. 7.4.1.11 The isupper function - Synopsis + Synopsis 1 #include <ctype.h> int isupper(int c); - Description + Description 2 The isupper function tests for any character that is an uppercase letter or is one of a locale-specific set of characters for which none of iscntrl, isdigit, ispunct, or isspace is true. In the "C" locale, isupper returns true only for the uppercase letters (as defined in 5.2.1). 7.4.1.12 The isxdigit function - Synopsis + Synopsis 1 #include <ctype.h> int isxdigit(int c); - Description + Description 2 The isxdigit function tests for any hexadecimal-digit character (as defined in 6.4.4.1). 7.4.2 Character case mapping functions 7.4.2.1 The tolower function - Synopsis + Synopsis 1 #include <ctype.h> int tolower(int c); - Description + Description 2 The tolower function converts an uppercase letter to a corresponding lowercase letter. - Returns + Returns 3 If the argument is a character for which isupper is true and there are one or more corresponding characters, as specified by the current locale, for which islower is true, the tolower function returns one of the corresponding characters (always the same one @@ -7688,15 +7688,15 @@ replacement, as in: -[page 184] (Contents) +[page 184] (Contents) 7.4.2.2 The toupper function - Synopsis + Synopsis 1 #include <ctype.h> int toupper(int c); - Description + Description 2 The toupper function converts a lowercase letter to a corresponding uppercase letter. - Returns + Returns 3 If the argument is a character for which islower is true and there are one or more corresponding characters, as specified by the current locale, for which isupper is true, the toupper function returns one of the corresponding characters (always the same one @@ -7705,7 +7705,7 @@ replacement, as in: -[page 185] (Contents) +[page 185] (Contents) 7.5 Errors <errno.h> 1 The header <errno.h> defines several macros, all relating to the reporting of error @@ -7717,42 +7717,42 @@ replacement, as in: which expand to integer constant expressions with type int, distinct positive values, and which are suitable for use in #if preprocessing directives; and errno - which expands to a modifiable lvalue175) that has type int, the value of which is set to a + which expands to a modifiable lvalue175) that has type int, the value of which is set to a positive error number by several library functions. It is unspecified whether errno is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual object, or a program defines an identifier with the name errno, the behavior is undefined. 3 The value of errno is zero at program startup, but is never set to zero by any library - function.176) The value of errno may be set to nonzero by a library function call + function.176) The value of errno may be set to nonzero by a library function call whether or not there is an error, provided the use of errno is not documented in the description of the function in this International Standard. 4 Additional macro definitions, beginning with E and a digit or E and an uppercase - letter,177) may also be specified by the implementation. + letter,177) may also be specified by the implementation. - 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). -[page 186] (Contents) +[page 186] (Contents) 7.6 Floating-point environment <fenv.h> 1 The header <fenv.h> declares two types and several macros and functions to provide access to the floating-point environment. The floating-point environment refers collectively to any floating-point status flags and control modes supported by the - implementation.178) A floating-point status flag is a system variable whose value is set + implementation.178) A floating-point status flag is a system variable whose value is set (but never cleared) when a floating-point exception is raised, which occurs as a side effect - of exceptional floating-point arithmetic to provide auxiliary information.179) A floating- + of exceptional floating-point arithmetic to provide auxiliary information.179) A floating- point control mode is a system variable whose value may be set by the user to affect the subsequent behavior of floating-point arithmetic. 2 Certain programming conventions support the intended model of use for the floating- - point environment:180) + point environment:180) -- a function call does not alter its caller's floating-point control modes, clear its caller's floating-point status flags, nor depend on the state of its caller's floating-point status flags unless the function is so documented; @@ -7771,15 +7771,15 @@ replacement, as in: - 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. -[page 187] (Contents) +[page 187] (Contents) 5 Each of the macros FE_DIVBYZERO @@ -7788,12 +7788,12 @@ replacement, as in: FE_OVERFLOW FE_UNDERFLOW is defined if and only if the implementation supports the floating-point exception by - means of the functions in 7.6.2.181) Additional implementation-defined floating-point + means of the functions in 7.6.2.181) Additional implementation-defined floating-point exceptions, with macro definitions beginning with FE_ and an uppercase letter, may also be specified by the implementation. The defined macros expand to integer constant expressions with values such that bitwise ORs of all combinations of the macros result in distinct values, and furthermore, bitwise ANDs of all combinations of the macros result in - zero.182) + zero.182) 6 The macro FE_ALL_EXCEPT is simply the bitwise OR of all floating-point exception macros defined by the @@ -7808,19 +7808,19 @@ replacement, as in: Additional implementation-defined rounding directions, with macro definitions beginning with FE_ and an uppercase letter, may also be specified by the implementation. The defined macros expand to integer constant expressions whose values are distinct - nonnegative values.183) + nonnegative values.183) 8 The macro - 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. -[page 188] (Contents) +[page 188] (Contents) FE_DFL_ENV represents the default floating-point environment -- the one installed at program startup @@ -7830,13 +7830,13 @@ replacement, as in: FE_ and an uppercase letter, and having type ''pointer to const-qualified fenv_t'', may also be specified by the implementation. 7.6.1 The FENV_ACCESS pragma - Synopsis + Synopsis 1 #include <fenv.h> #pragma STDC FENV_ACCESS on-off-switch - Description + Description 2 The FENV_ACCESS pragma provides a means to inform the implementation when a program might access the floating-point environment to test floating-point status flags or - run under non-default floating-point control modes.184) The pragma shall occur either + run under non-default floating-point control modes.184) The pragma shall occur either outside external declarations or preceding all explicit declarations and statements inside a compound statement. When outside external declarations, the pragma takes effect from its occurrence until another FENV_ACCESS pragma is encountered, or until the end of @@ -7856,12 +7856,12 @@ replacement, as in: - 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. -[page 189] (Contents) +[page 189] (Contents) 3 EXAMPLE #include <fenv.h> @@ -7877,97 +7877,97 @@ replacement, as in: } 4 If the function g might depend on status flags set as a side effect of the first x + 1, or if the second x + 1 might depend on control modes set as a side effect of the call to function g, then the program shall - contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.185) + contain an appropriately placed invocation of #pragma STDC FENV_ACCESS ON.185) 7.6.2 Floating-point exceptions -1 The following functions provide access to the floating-point status flags.186) The int +1 The following functions provide access to the floating-point status flags.186) The int input argument for the functions represents a subset of floating-point exceptions, and can be zero or the bitwise OR of one or more floating-point exception macros, for example FE_OVERFLOW | FE_INEXACT. For other argument values the behavior of these functions is undefined. 7.6.2.1 The feclearexcept function - Synopsis + Synopsis 1 #include <fenv.h> int feclearexcept(int excepts); - Description + Description 2 The feclearexcept function attempts to clear the supported floating-point exceptions represented by its argument. - Returns + Returns 3 The feclearexcept function returns zero if the excepts argument is zero or if all the specified exceptions were successfully cleared. Otherwise, it returns a nonzero value. - 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. - 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. -[page 190] (Contents) +[page 190] (Contents) 7.6.2.2 The fegetexceptflag function - Synopsis + Synopsis 1 #include <fenv.h> int fegetexceptflag(fexcept_t *flagp, int excepts); - Description + Description 2 The fegetexceptflag function attempts to store an implementation-defined representation of the states of the floating-point status flags indicated by the argument excepts in the object pointed to by the argument flagp. - Returns + Returns 3 The fegetexceptflag function returns zero if the representation was successfully stored. Otherwise, it returns a nonzero value. 7.6.2.3 The feraiseexcept function - Synopsis + Synopsis 1 #include <fenv.h> int feraiseexcept(int excepts); - Description + Description 2 The feraiseexcept function attempts to raise the supported floating-point exceptions - represented by its argument.187) The order in which these floating-point exceptions are + represented by its argument.187) The order in which these floating-point exceptions are raised is unspecified, except as stated in F.7.6. Whether the feraiseexcept function additionally raises the ''inexact'' floating-point exception whenever it raises the ''overflow'' or ''underflow'' floating-point exception is implementation-defined. - Returns + Returns 3 The feraiseexcept function returns zero if the excepts argument is zero or if all the specified exceptions were successfully raised. Otherwise, it returns a nonzero value. - 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. -[page 191] (Contents) +[page 191] (Contents) 7.6.2.4 The fesetexceptflag function - Synopsis + Synopsis 1 #include <fenv.h> int fesetexceptflag(const fexcept_t *flagp, int excepts); - Description + Description 2 The fesetexceptflag function attempts to set the floating-point status flags indicated by the argument excepts to the states stored in the object pointed to by flagp. The value of *flagp shall have been set by a previous call to fegetexceptflag whose second argument represented at least those floating-point exceptions represented by the argument excepts. This function does not raise floating- point exceptions, but only sets the state of the flags. - Returns + Returns 3 The fesetexceptflag function returns zero if the excepts argument is zero or if all the specified flags were successfully set to the appropriate state. Otherwise, it returns a nonzero value. 7.6.2.5 The fetestexcept function - Synopsis + Synopsis 1 #include <fenv.h> int fetestexcept(int excepts); - Description + Description 2 The fetestexcept function determines which of a specified subset of the floating- point exception flags are currently set. The excepts argument specifies the floating- - point status flags to be queried.188) - Returns + point status flags to be queried.188) + Returns 3 The fetestexcept function returns the value of the bitwise OR of the floating-point exception macros corresponding to the currently set floating-point exceptions included in excepts. @@ -7976,9 +7976,9 @@ replacement, as in: - 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. -[page 192] (Contents) +[page 192] (Contents) #include <fenv.h> /* ... */ @@ -7997,29 +7997,29 @@ replacement, as in: 1 The fegetround and fesetround functions provide control of rounding direction modes. 7.6.3.1 The fegetround function - Synopsis + Synopsis 1 #include <fenv.h> int fegetround(void); - Description + Description 2 The fegetround function gets the current rounding direction. - Returns + Returns 3 The fegetround function returns the value of the rounding direction macro representing the current rounding direction or a negative value if there is no such rounding direction macro or the current rounding direction is not determinable. 7.6.3.2 The fesetround function - Synopsis + Synopsis 1 #include <fenv.h> int fesetround(int round); - Description + Description 2 The fesetround function establishes the rounding direction represented by its argument round. If the argument is not equal to the value of a rounding direction macro, the rounding direction is not changed. - Returns + Returns 3 The fesetround function returns zero if and only if the requested rounding direction was established. -[page 193] (Contents) +[page 193] (Contents) 4 EXAMPLE Save, set, and restore the rounding direction. Report an error and abort if setting the rounding direction fails. @@ -8042,66 +8042,66 @@ replacement, as in: 1 The functions in this section manage the floating-point environment -- status flags and control modes -- as one entity. 7.6.4.1 The fegetenv function - Synopsis + Synopsis 1 #include <fenv.h> int fegetenv(fenv_t *envp); - Description + Description 2 The fegetenv function attempts to store the current floating-point environment in the object pointed to by envp. - Returns + Returns 3 The fegetenv function returns zero if the environment was successfully stored. Otherwise, it returns a nonzero value. 7.6.4.2 The feholdexcept function - Synopsis + Synopsis 1 #include <fenv.h> int feholdexcept(fenv_t *envp); - Description + Description 2 The feholdexcept function saves the current floating-point environment in the object pointed to by envp, clears the floating-point status flags, and then installs a non-stop (continue on floating-point exceptions) mode, if available, for all floating-point - exceptions.189) + exceptions.189) -[page 194] (Contents) +[page 194] (Contents) - Returns + Returns 3 The feholdexcept function returns zero if and only if non-stop floating-point exception handling was successfully installed. 7.6.4.3 The fesetenv function - Synopsis + Synopsis 1 #include <fenv.h> int fesetenv(const fenv_t *envp); - Description + Description 2 The fesetenv function attempts to establish the floating-point environment represented by the object pointed to by envp. The argument envp shall point to an object set by a call to fegetenv or feholdexcept, or equal a floating-point environment macro. Note that fesetenv merely installs the state of the floating-point status flags represented through its argument, and does not raise these floating-point exceptions. - Returns + Returns 3 The fesetenv function returns zero if the environment was successfully established. Otherwise, it returns a nonzero value. 7.6.4.4 The feupdateenv function - Synopsis + Synopsis 1 #include <fenv.h> int feupdateenv(const fenv_t *envp); - Description + Description 2 The feupdateenv function attempts to save the currently raised floating-point exceptions in its automatic storage, install the floating-point environment represented by the object pointed to by envp, and then raise the saved floating-point exceptions. The argument envp shall point to an object set by a call to feholdexcept or fegetenv, or equal a floating-point environment macro. - Returns + Returns 3 The feupdateenv function returns zero if all the actions were successfully carried out. Otherwise, it returns a nonzero value. - 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. -[page 195] (Contents) +[page 195] (Contents) 4 EXAMPLE Hide spurious underflow floating-point exceptions: #include <fenv.h> @@ -8124,7 +8124,7 @@ replacement, as in: -[page 196] (Contents) +[page 196] (Contents) 7.7 Characteristics of floating types <float.h> 1 The header <float.h> defines several macros that expand to various limits and @@ -8135,7 +8135,7 @@ replacement, as in: -[page 197] (Contents) +[page 197] (Contents) 7.8 Format conversion of integer types <inttypes.h> 1 The header <inttypes.h> includes the header <stdint.h> and extends it with @@ -8145,16 +8145,16 @@ replacement, as in: imaxdiv_t which is a structure type that is the type of the value returned by the imaxdiv function. For each type declared in <stdint.h>, it defines corresponding macros for conversion - specifiers for use with the formatted input/output functions.190) + specifiers for use with the formatted input/output functions.190) Forward references: integer types <stdint.h> (7.18), formatted input/output functions (7.19.6), formatted wide character input/output functions (7.24.2). 7.8.1 Macros for format specifiers -1 Each of the following object-like macros191) expands to a character string literal +1 Each of the following object-like macros191) expands to a character string literal containing a conversion specifier, possibly modified by a length modifier, suitable for use within the format argument of a formatted input/output function when converting the corresponding integer type. These macro names have the general form of PRI (character string literals for the fprintf and fwprintf family) or SCN (character string literals - for the fscanf and fwscanf family),192) followed by the conversion specifier, + for the fscanf and fwscanf family),192) followed by the conversion specifier, followed by a name corresponding to a similar type name in 7.18.1. In these names, N represents the width of the type as described in 7.18.1. For example, PRIdFAST32 can be used in a format string to print the value of an integer of type int_fast32_t. @@ -8165,14 +8165,14 @@ replacement, as in: - 190) See ''future library directions'' (7.26.4). - 191) C++ implementations should define these macros only when __STDC_FORMAT_MACROS is defined + 190) See ''future library directions'' (7.26.4). + 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. -[page 198] (Contents) +[page 198] (Contents) 3 The fprintf macros for unsigned integers are: PRIoN PRIoLEASTN PRIoFASTN PRIoMAX PRIoPTR @@ -8203,45 +8203,45 @@ replacement, as in: 7.8.2 Functions for greatest-width integer types 7.8.2.1 The imaxabs function - Synopsis + Synopsis 1 #include <inttypes.h> intmax_t imaxabs(intmax_t j); - Description + Description 2 The imaxabs function computes the absolute value of an integer j. If the result cannot - be represented, the behavior is undefined.193) + be represented, the behavior is undefined.193) - 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. -[page 199] (Contents) +[page 199] (Contents) - Returns + Returns 3 The imaxabs function returns the absolute value. 7.8.2.2 The imaxdiv function - Synopsis + Synopsis 1 #include <inttypes.h> imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); - Description + Description 2 The imaxdiv function computes numer / denom and numer % denom in a single operation. - Returns + Returns 3 The imaxdiv function returns a structure of type imaxdiv_t comprising both the quotient and the remainder. The structure shall contain (in either order) the members quot (the quotient) and rem (the remainder), each of which has type intmax_t. If either part of the result cannot be represented, the behavior is undefined. 7.8.2.3 The strtoimax and strtoumax functions - Synopsis + Synopsis 1 #include <inttypes.h> intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base); uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base); - Description + Description 2 The strtoimax and strtoumax functions are equivalent to the strtol, strtoll, strtoul, and strtoull functions, except that the initial portion of the string is converted to intmax_t and uintmax_t representation, respectively. - Returns + Returns 3 The strtoimax and strtoumax functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned @@ -8252,21 +8252,21 @@ replacement, as in: -[page 200] (Contents) +[page 200] (Contents) 7.8.2.4 The wcstoimax and wcstoumax functions - Synopsis + Synopsis 1 #include <stddef.h> // for wchar_t #include <inttypes.h> intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base); uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base); - Description + Description 2 The wcstoimax and wcstoumax functions are equivalent to the wcstol, wcstoll, wcstoul, and wcstoull functions except that the initial portion of the wide string is converted to intmax_t and uintmax_t representation, respectively. - Returns + Returns 3 The wcstoimax function returns the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, INTMAX_MAX, INTMAX_MIN, or UINTMAX_MAX is returned (according to the @@ -8278,7 +8278,7 @@ replacement, as in: -[page 201] (Contents) +[page 201] (Contents) 7.9 Alternative spellings <iso646.h> 1 The header <iso646.h> defines the following eleven macros (on the left) that expand @@ -8298,7 +8298,7 @@ replacement, as in: -[page 202] (Contents) +[page 202] (Contents) 7.10 Sizes of integer types <limits.h> 1 The header <limits.h> defines several macros that expand to various limits and @@ -8309,7 +8309,7 @@ replacement, as in: -[page 203] (Contents) +[page 203] (Contents) 7.11 Localization <locale.h> 1 The header <locale.h> declares two functions, one type, and defines several macros. @@ -8347,7 +8347,7 @@ replacement, as in: -[page 204] (Contents) +[page 204] (Contents) 3 The macros defined are NULL (described in 7.17); and LC_ALL @@ -8357,22 +8357,22 @@ replacement, as in: LC_NUMERIC LC_TIME which expand to integer constant expressions with distinct values, suitable for use as the - first argument to the setlocale function.194) Additional macro definitions, beginning - with the characters LC_ and an uppercase letter,195) may also be specified by the + first argument to the setlocale function.194) Additional macro definitions, beginning + with the characters LC_ and an uppercase letter,195) may also be specified by the implementation. 7.11.1 Locale control 7.11.1.1 The setlocale function - Synopsis + Synopsis 1 #include <locale.h> char *setlocale(int category, const char *locale); - Description + Description 2 The setlocale function selects the appropriate portion of the program's locale as specified by the category and locale arguments. The setlocale function may be used to change or query the program's entire current locale or portions thereof. The value LC_ALL for category names the program's entire locale; the other values for category name only a portion of the program's locale. LC_COLLATE affects the behavior of the strcoll and strxfrm functions. LC_CTYPE affects the behavior of - the character handling functions196) and the multibyte and wide character functions. + the character handling functions196) and the multibyte and wide character functions. LC_MONETARY affects the monetary formatting information returned by the localeconv function. LC_NUMERIC affects the decimal-point character for the formatted input/output functions and the string conversion functions, as well as the @@ -8382,25 +8382,25 @@ replacement, as in: of "" for locale specifies the locale-specific native environment. Other implementation-defined strings may be passed as the second argument to setlocale. - 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). - 196) The only functions in 7.4 whose behavior is not affected by the current locale are isdigit and + 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). + 196) The only functions in 7.4 whose behavior is not affected by the current locale are isdigit and isxdigit. -[page 205] (Contents) +[page 205] (Contents) 4 At program startup, the equivalent of setlocale(LC_ALL, "C"); is executed. 5 The implementation shall behave as if no library function calls the setlocale function. - Returns + Returns 6 If a pointer to a string is given for locale and the selection can be honored, the setlocale function returns a pointer to the string associated with the specified category for the new locale. If the selection cannot be honored, the setlocale function returns a null pointer and the program's locale is not changed. 7 A null pointer for locale causes the setlocale function to return a pointer to the string associated with the category for the program's current locale; the program's - locale is not changed.197) + locale is not changed.197) 8 The pointer to string returned by the setlocale function is such that a subsequent call with that string value and its associated category will restore that part of the program's locale. The string pointed to shall not be modified by the program, but may be @@ -8411,10 +8411,10 @@ replacement, as in: strftime function (7.23.3.5), the strxfrm function (7.21.4.5). 7.11.2 Numeric formatting convention inquiry 7.11.2.1 The localeconv function - Synopsis + Synopsis 1 #include <locale.h> struct lconv *localeconv(void); - Description + Description 2 The localeconv function sets the components of an object with type struct lconv with values appropriate for the formatting of numeric quantities (monetary and otherwise) according to the rules of the current locale. @@ -8422,10 +8422,10 @@ replacement, as in: (except decimal_point) can point to "", to indicate that the value is not available in the current locale or is of zero length. Apart from grouping and mon_grouping, the - 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. -[page 206] (Contents) +[page 206] (Contents) strings shall start and end in the initial shift state. The members with type char are nonnegative numbers, any of which can be CHAR_MAX to indicate that the value is not @@ -8464,7 +8464,7 @@ char n_cs_precedes succeeds the value for a negative locally formatted monetary quantity. -[page 207] (Contents) +[page 207] (Contents) char p_sep_by_space Set to a value indicating the separation of the currency_symbol, the @@ -8505,7 +8505,7 @@ char int_p_sep_by_space -[page 208] (Contents) +[page 208] (Contents) char int_n_sep_by_space Set to a value indicating the separation of the int_curr_symbol, the @@ -8543,11 +8543,11 @@ char int_p_sep_by_space 4 The sign string immediately succeeds the currency symbol. -[page 209] (Contents) +[page 209] (Contents) 7 The implementation shall behave as if no library function calls the localeconv function. - Returns + Returns 8 The localeconv function returns a pointer to the filled-in object. The structure pointed to by the return value shall not be modified by the program, but may be overwritten by a subsequent call to the localeconv function. In addition, calls to the @@ -8592,7 +8592,7 @@ char int_p_sep_by_space -[page 210] (Contents) +[page 210] (Contents) 11 EXAMPLE 2 The following table illustrates how the cs_precedes, sep_by_space, and sign_posn members affect the formatted value. @@ -8615,14 +8615,14 @@ char int_p_sep_by_space -[page 211] (Contents) +[page 211] (Contents) 7.12 Mathematics <math.h> 1 The header <math.h> declares two types and many mathematical functions and defines several macros. Most synopses specify a family of functions consisting of a principal function with one or more double parameters, a double return value, or both; and other functions with the same name but with f and l suffixes, which are corresponding - functions with float and long double parameters, return values, or both.198) + functions with float and long double parameters, return values, or both.198) Integer arithmetic functions and conversion functions are discussed later. 2 The types float_t @@ -8632,14 +8632,14 @@ char int_p_sep_by_space float_t and double_t are float and double, respectively; if FLT_EVAL_METHOD equals 1, they are both double; if FLT_EVAL_METHOD equals 2, they are both long double; and for other values of FLT_EVAL_METHOD, they are - otherwise implementation-defined.199) + otherwise implementation-defined.199) 3 The macro HUGE_VAL expands to a positive double constant expression, not necessarily representable as a float. The macros HUGE_VALF HUGE_VALL - are respectively float and long double analogs of HUGE_VAL.200) + are respectively float and long double analogs of HUGE_VAL.200) 4 The macro INFINITY expands to a constant expression of type float representing positive or unsigned @@ -8647,17 +8647,17 @@ char int_p_sep_by_space - 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. -[page 212] (Contents) +[page 212] (Contents) - translation time.201) + translation time.201) 5 The macro NAN is defined if and only if the implementation supports quiet NaNs for the float type. It @@ -8675,7 +8675,7 @@ char int_p_sep_by_space 7 The macro FP_FAST_FMA is optionally defined. If defined, it indicates that the fma function generally executes - about as fast as, or faster than, a multiply and an add of double operands.202) The + about as fast as, or faster than, a multiply and an add of double operands.202) The macros FP_FAST_FMAF FP_FAST_FMAL @@ -8689,12 +8689,12 @@ char int_p_sep_by_space -INT_MAX. The value of FP_ILOGBNAN shall be either INT_MAX or INT_MIN. - 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. -[page 213] (Contents) +[page 213] (Contents) 9 The macros MATH_ERRNO @@ -8718,7 +8718,7 @@ char int_p_sep_by_space 2 For all functions, a domain error occurs if an input argument is outside the domain over which the mathematical function is defined. The description of each function lists any required domain errors; an implementation may define additional domain errors, provided - that such errors are consistent with the mathematical definition of the function.203) On a + that such errors are consistent with the mathematical definition of the function.203) On a domain error, the function returns an implementation-defined value; if the integer expression math_errhandling & MATH_ERRNO is nonzero, the integer expression errno acquires the value EDOM; if the integer expression math_errhandling & @@ -8732,10 +8732,10 @@ char int_p_sep_by_space example log(0.0)), then the function returns the value of the macro HUGE_VAL, - 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. -[page 214] (Contents) +[page 214] (Contents) HUGE_VALF, or HUGE_VALL according to the return type, with the same sign as the correct value of the function; if the integer expression math_errhandling & @@ -8745,7 +8745,7 @@ char int_p_sep_by_space infinity and the ''overflow'' floating-point exception is raised otherwise. 5 The result underflows if the magnitude of the mathematical result is so small that the mathematical result cannot be represented, without extraordinary roundoff error, in an - object of the specified type.204) If the result underflows, the function returns an + object of the specified type.204) If the result underflows, the function returns an implementation-defined value whose magnitude is no greater than the smallest normalized positive number in the specified type; if the integer expression math_errhandling & MATH_ERRNO is nonzero, whether errno acquires the @@ -8753,10 +8753,10 @@ char int_p_sep_by_space math_errhandling & MATH_ERREXCEPT is nonzero, whether the ''underflow'' floating-point exception is raised is implementation-defined. 7.12.2 The FP_CONTRACT pragma - Synopsis + Synopsis 1 #include <math.h> #pragma STDC FP_CONTRACT on-off-switch - Description + Description 2 The FP_CONTRACT pragma can be used to allow (if the state is ''on'') or disallow (if the state is ''off'') the implementation to contract expressions (6.5). Each pragma can occur either outside external declarations or preceding all explicit declarations and statements @@ -8773,24 +8773,24 @@ char int_p_sep_by_space - 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. -[page 215] (Contents) +[page 215] (Contents) 7.12.3 Classification macros 1 In the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type. 7.12.3.1 The fpclassify macro - Synopsis + Synopsis 1 #include <math.h> int fpclassify(real-floating x); - Description + Description 2 The fpclassify macro classifies its argument value as NaN, infinite, normal, subnormal, zero, or into another implementation-defined category. First, an argument represented in a format wider than its semantic type is converted to its semantic type. - Then classification is based on the type of the argument.205) - Returns + Then classification is based on the type of the argument.205) + Returns 3 The fpclassify macro returns the value of the number classification macro appropriate to the value of its argument. 4 EXAMPLE The fpclassify macro might be implemented in terms of ordinary functions as @@ -8800,10 +8800,10 @@ char int_p_sep_by_space __fpclassifyl(x)) 7.12.3.2 The isfinite macro - Synopsis + Synopsis 1 #include <math.h> int isfinite(real-floating x); - Description + Description 2 The isfinite macro determines whether its argument has a finite value (zero, subnormal, or normal, and not infinite or NaN). First, an argument represented in a format wider than its semantic type is converted to its semantic type. Then determination @@ -8812,261 +8812,261 @@ char int_p_sep_by_space - 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. -[page 216] (Contents) +[page 216] (Contents) - Returns + Returns 3 The isfinite macro returns a nonzero value if and only if its argument has a finite value. 7.12.3.3 The isinf macro - Synopsis + Synopsis 1 #include <math.h> int isinf(real-floating x); - Description + Description 2 The isinf macro determines whether its argument value is an infinity (positive or negative). First, an argument represented in a format wider than its semantic type is converted to its semantic type. Then determination is based on the type of the argument. - Returns + Returns 3 The isinf macro returns a nonzero value if and only if its argument has an infinite value. 7.12.3.4 The isnan macro - Synopsis + Synopsis 1 #include <math.h> int isnan(real-floating x); - Description + Description 2 The isnan macro determines whether its argument value is a NaN. First, an argument represented in a format wider than its semantic type is converted to its semantic type. - Then determination is based on the type of the argument.206) - Returns + Then determination is based on the type of the argument.206) + Returns 3 The isnan macro returns a nonzero value if and only if its argument has a NaN value. 7.12.3.5 The isnormal macro - Synopsis + Synopsis 1 #include <math.h> int isnormal(real-floating x); - 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. -[page 217] (Contents) +[page 217] (Contents) - Description + Description 2 The isnormal macro determines whether its argument value is normal (neither zero, subnormal, infinite, nor NaN). First, an argument represented in a format wider than its semantic type is converted to its semantic type. Then determination is based on the type of the argument. - Returns + Returns 3 The isnormal macro returns a nonzero value if and only if its argument has a normal value. 7.12.3.6 The signbit macro - Synopsis + Synopsis 1 #include <math.h> int signbit(real-floating x); - Description -2 The signbit macro determines whether the sign of its argument value is negative.207) - Returns + Description +2 The signbit macro determines whether the sign of its argument value is negative.207) + Returns 3 The signbit macro returns a nonzero value if and only if the sign of its argument value is negative. 7.12.4 Trigonometric functions 7.12.4.1 The acos functions - Synopsis + Synopsis 1 #include <math.h> double acos(double x); float acosf(float x); long double acosl(long double x); - Description + Description 2 The acos functions compute the principal value of the arc cosine of x. A domain error occurs for arguments not in the interval [-1, +1]. - Returns + Returns 3 The acos functions return arccos x in the interval [0, pi ] radians. - 207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is + 207) The signbit macro reports the sign of all values, including infinities, zeros, and NaNs. If zero is unsigned, it is treated as positive. -[page 218] (Contents) +[page 218] (Contents) 7.12.4.2 The asin functions - Synopsis + Synopsis 1 #include <math.h> double asin(double x); float asinf(float x); long double asinl(long double x); - Description + Description 2 The asin functions compute the principal value of the arc sine of x. A domain error occurs for arguments not in the interval [-1, +1]. - Returns + Returns 3 The asin functions return arcsin x in the interval [-pi /2, +pi /2] radians. 7.12.4.3 The atan functions - Synopsis + Synopsis 1 #include <math.h> double atan(double x); float atanf(float x); long double atanl(long double x); - Description + Description 2 The atan functions compute the principal value of the arc tangent of x. - Returns + Returns 3 The atan functions return arctan x in the interval [-pi /2, +pi /2] radians. 7.12.4.4 The atan2 functions - Synopsis + Synopsis 1 #include <math.h> double atan2(double y, double x); float atan2f(float y, float x); long double atan2l(long double y, long double x); - Description + Description 2 The atan2 functions compute the value of the arc tangent of y/x, using the signs of both arguments to determine the quadrant of the return value. A domain error may occur if both arguments are zero. - Returns + Returns 3 The atan2 functions return arctan y/x in the interval [-pi , +pi ] radians. -[page 219] (Contents) +[page 219] (Contents) 7.12.4.5 The cos functions - Synopsis + Synopsis 1 #include <math.h> double cos(double x); float cosf(float x); long double cosl(long double x); - Description + Description 2 The cos functions compute the cosine of x (measured in radians). - Returns + Returns 3 The cos functions return cos x. 7.12.4.6 The sin functions - Synopsis + Synopsis 1 #include <math.h> double sin(double x); float sinf(float x); long double sinl(long double x); - Description + Description 2 The sin functions compute the sine of x (measured in radians). - Returns + Returns 3 The sin functions return sin x. 7.12.4.7 The tan functions - Synopsis + Synopsis 1 #include <math.h> double tan(double x); float tanf(float x); long double tanl(long double x); - Description + Description 2 The tan functions return the tangent of x (measured in radians). - Returns + Returns 3 The tan functions return tan x. -[page 220] (Contents) +[page 220] (Contents) 7.12.5 Hyperbolic functions 7.12.5.1 The acosh functions - Synopsis + Synopsis 1 #include <math.h> double acosh(double x); float acoshf(float x); long double acoshl(long double x); - Description + Description 2 The acosh functions compute the (nonnegative) arc hyperbolic cosine of x. A domain error occurs for arguments less than 1. - Returns + Returns 3 The acosh functions return arcosh x in the interval [0, +(inf)]. 7.12.5.2 The asinh functions - Synopsis + Synopsis 1 #include <math.h> double asinh(double x); float asinhf(float x); long double asinhl(long double x); - Description + Description 2 The asinh functions compute the arc hyperbolic sine of x. - Returns + Returns 3 The asinh functions return arsinh x. 7.12.5.3 The atanh functions - Synopsis + Synopsis 1 #include <math.h> double atanh(double x); float atanhf(float x); long double atanhl(long double x); - Description + Description 2 The atanh functions compute the arc hyperbolic tangent of x. A domain error occurs for arguments not in the interval [-1, +1]. A range error may occur if the argument equals -1 or +1. -[page 221] (Contents) +[page 221] (Contents) - Returns + Returns 3 The atanh functions return artanh x. 7.12.5.4 The cosh functions - Synopsis + Synopsis 1 #include <math.h> double cosh(double x); float coshf(float x); long double coshl(long double x); - Description + Description 2 The cosh functions compute the hyperbolic cosine of x. A range error occurs if the magnitude of x is too large. - Returns + Returns 3 The cosh functions return cosh x. 7.12.5.5 The sinh functions - Synopsis + Synopsis 1 #include <math.h> double sinh(double x); float sinhf(float x); long double sinhl(long double x); - Description + Description 2 The sinh functions compute the hyperbolic sine of x. A range error occurs if the magnitude of x is too large. - Returns + Returns 3 The sinh functions return sinh x. 7.12.5.6 The tanh functions - Synopsis + Synopsis 1 #include <math.h> double tanh(double x); float tanhf(float x); long double tanhl(long double x); - Description + Description 2 The tanh functions compute the hyperbolic tangent of x. -[page 222] (Contents) +[page 222] (Contents) - Returns + Returns 3 The tanh functions return tanh x. 7.12.6 Exponential and logarithmic functions 7.12.6.1 The exp functions - Synopsis + Synopsis 1 #include <math.h> double exp(double x); float expf(float x); long double expl(long double x); - Description + Description 2 The exp functions compute the base-e exponential of x. A range error occurs if the magnitude of x is too large. - Returns + Returns 3 The exp functions return ex . 7.12.6.2 The exp2 functions - Synopsis + Synopsis 1 #include <math.h> double exp2(double x); float exp2f(float x); long double exp2l(long double x); - Description + Description 2 The exp2 functions compute the base-2 exponential of x. A range error occurs if the magnitude of x is too large. - Returns + Returns 3 The exp2 functions return 2x . 7.12.6.3 The expm1 functions - Synopsis + Synopsis 1 #include <math.h> double expm1(double x); float expm1f(float x); @@ -9075,33 +9075,33 @@ char int_p_sep_by_space -[page 223] (Contents) +[page 223] (Contents) - Description + Description 2 The expm1 functions compute the base-e exponential of the argument, minus 1. A range - error occurs if x is too large.208) - Returns + error occurs if x is too large.208) + Returns 3 The expm1 functions return ex - 1. 7.12.6.4 The frexp functions - Synopsis + Synopsis 1 #include <math.h> double frexp(double value, int *exp); float frexpf(float value, int *exp); long double frexpl(long double value, int *exp); - Description + Description 2 The frexp functions break a floating-point number into a normalized fraction and an integral power of 2. They store the integer in the int object pointed to by exp. - Returns + Returns 3 If value is not a floating-point number, the results are unspecified. Otherwise, the frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x x 2*exp . If value is zero, both parts of the result are zero. 7.12.6.5 The ilogb functions - Synopsis + Synopsis 1 #include <math.h> int ilogb(double x); int ilogbf(float x); int ilogbl(long double x); - Description + Description 2 The ilogb functions extract the exponent of x as a signed int value. If x is zero they compute the value FP_ILOGB0; if x is infinite they compute the value INT_MAX; if x is a NaN they compute the value FP_ILOGBNAN; otherwise, they are equivalent to calling @@ -9112,37 +9112,37 @@ char int_p_sep_by_space - 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. -[page 224] (Contents) +[page 224] (Contents) - Returns + Returns 3 The ilogb functions return the exponent of x as a signed int value. Forward references: the logb functions (7.12.6.11). 7.12.6.6 The ldexp functions - Synopsis + Synopsis 1 #include <math.h> double ldexp(double x, int exp); float ldexpf(float x, int exp); long double ldexpl(long double x, int exp); - Description + Description 2 The ldexp functions multiply a floating-point number by an integral power of 2. A range error may occur. - Returns + Returns 3 The ldexp functions return x x 2exp . 7.12.6.7 The log functions - Synopsis + Synopsis 1 #include <math.h> double log(double x); float logf(float x); long double logl(long double x); - Description + Description 2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero. - Returns + Returns 3 The log functions return loge x. 7.12.6.8 The log10 functions - Synopsis + Synopsis 1 #include <math.h> double log10(double x); float log10f(float x); @@ -9151,78 +9151,78 @@ char int_p_sep_by_space -[page 225] (Contents) +[page 225] (Contents) - Description + Description 2 The log10 functions compute the base-10 (common) logarithm of x. A domain error occurs if the argument is negative. A range error may occur if the argument is zero. - Returns + Returns 3 The log10 functions return log10 x. 7.12.6.9 The log1p functions - Synopsis + Synopsis 1 #include <math.h> double log1p(double x); float log1pf(float x); long double log1pl(long double x); - Description -2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.209) + Description +2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.209) A domain error occurs if the argument is less than -1. A range error may occur if the argument equals -1. - Returns + Returns 3 The log1p functions return loge (1 + x). 7.12.6.10 The log2 functions - Synopsis + Synopsis 1 #include <math.h> double log2(double x); float log2f(float x); long double log2l(long double x); - Description + Description 2 The log2 functions compute the base-2 logarithm of x. A domain error occurs if the argument is less than zero. A range error may occur if the argument is zero. - Returns + Returns 3 The log2 functions return log2 x. - 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). -[page 226] (Contents) +[page 226] (Contents) 7.12.6.11 The logb functions - Synopsis + Synopsis 1 #include <math.h> double logb(double x); float logbf(float x); long double logbl(long double x); - Description + Description 2 The logb functions extract the exponent of x, as a signed integer value in floating-point format. If x is subnormal it is treated as though it were normalized; thus, for positive finite x, 1 <= x x FLT_RADIX-logb(x) < FLT_RADIX A domain error or range error may occur if the argument is zero. - Returns + Returns 3 The logb functions return the signed exponent of x. 7.12.6.12 The modf functions - Synopsis + Synopsis 1 #include <math.h> double modf(double value, double *iptr); float modff(float value, float *iptr); long double modfl(long double value, long double *iptr); - Description + Description 2 The modf functions break the argument value into integral and fractional parts, each of which has the same type and sign as the argument. They store the integral part (in floating-point format) in the object pointed to by iptr. - Returns + Returns 3 The modf functions return the signed fractional part of value. -[page 227] (Contents) +[page 227] (Contents) 7.12.6.13 The scalbn and scalbln functions - Synopsis + Synopsis 1 #include <math.h> double scalbn(double x, int n); float scalbnf(float x, int n); @@ -9230,43 +9230,43 @@ char int_p_sep_by_space double scalbln(double x, long int n); float scalblnf(float x, long int n); long double scalblnl(long double x, long int n); - Description + Description 2 The scalbn and scalbln functions compute x x FLT_RADIXn efficiently, not normally by computing FLT_RADIXn explicitly. A range error may occur. - Returns + Returns 3 The scalbn and scalbln functions return x x FLT_RADIXn . 7.12.7 Power and absolute-value functions 7.12.7.1 The cbrt functions - Synopsis + Synopsis 1 #include <math.h> double cbrt(double x); float cbrtf(float x); long double cbrtl(long double x); - Description + Description 2 The cbrt functions compute the real cube root of x. - Returns + Returns 3 The cbrt functions return x1/3 . 7.12.7.2 The fabs functions - Synopsis + Synopsis 1 #include <math.h> double fabs(double x); float fabsf(float x); long double fabsl(long double x); - Description + Description 2 The fabs functions compute the absolute value of a floating-point number x. -[page 228] (Contents) +[page 228] (Contents) - Returns + Returns 3 The fabs functions return | x |. 7.12.7.3 The hypot functions - Synopsis + Synopsis 1 #include <math.h> double hypot(double x, double y); float hypotf(float x, float y); long double hypotl(long double x, long double y); - Description + Description 2 The hypot functions compute the square root of the sum of the squares of x and y, without undue overflow or underflow. A range error may occur. 3 Returns @@ -9274,20 +9274,20 @@ char int_p_sep_by_space ??? ??????????????? 7.12.7.4 The pow functions - Synopsis + Synopsis 1 #include <math.h> double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); - Description + Description 2 The pow functions compute x raised to the power y. A domain error occurs if x is finite and negative and y is finite and not an integer value. A range error may occur. A domain error may occur if x is zero and y is zero. A domain error or range error may occur if x is zero and y is less than zero. - Returns + Returns 3 The pow functions return xy . 7.12.7.5 The sqrt functions - Synopsis + Synopsis 1 #include <math.h> double sqrt(double x); float sqrtf(float x); @@ -9296,25 +9296,25 @@ char int_p_sep_by_space -[page 229] (Contents) +[page 229] (Contents) - Description + Description 2 The sqrt functions compute the nonnegative square root of x. A domain error occurs if the argument is less than zero. - Returns + Returns 3 The sqrt functions return sqrt:x. ??? ??? 7.12.8 Error and gamma functions 7.12.8.1 The erf functions - Synopsis + Synopsis 1 #include <math.h> double erf(double x); float erff(float x); long double erfl(long double x); - Description + Description 2 The erf functions compute the error function of x. - Returns + Returns 2 x (integral) 3 @@ -9327,15 +9327,15 @@ char int_p_sep_by_space ??? 0 7.12.8.2 The erfc functions - Synopsis + Synopsis 1 #include <math.h> double erfc(double x); float erfcf(float x); long double erfcl(long double x); - Description + Description 2 The erfc functions compute the complementary error function of x. A range error occurs if x is too large. - Returns + Returns 2 (inf) (integral) 3 @@ -9350,85 +9350,85 @@ char int_p_sep_by_space -[page 230] (Contents) +[page 230] (Contents) 7.12.8.3 The lgamma functions - Synopsis + Synopsis 1 #include <math.h> double lgamma(double x); float lgammaf(float x); long double lgammal(long double x); - Description + Description 2 The lgamma functions compute the natural logarithm of the absolute value of gamma of x. A range error occurs if x is too large. A range error may occur if x is a negative integer or zero. - Returns + Returns 3 The lgamma functions return loge | (Gamma)(x) |. 7.12.8.4 The tgamma functions - Synopsis + Synopsis 1 #include <math.h> double tgamma(double x); float tgammaf(float x); long double tgammal(long double x); - Description + Description 2 The tgamma functions compute the gamma function of x. A domain error or range error may occur if x is a negative integer or zero. A range error may occur if the magnitude of x is too large or too small. - Returns + Returns 3 The tgamma functions return (Gamma)(x). 7.12.9 Nearest integer functions 7.12.9.1 The ceil functions - Synopsis + Synopsis 1 #include <math.h> double ceil(double x); float ceilf(float x); long double ceill(long double x); - Description + Description 2 The ceil functions compute the smallest integer value not less than x. -[page 231] (Contents) +[page 231] (Contents) - Returns + Returns 3 The ceil functions return ???x???, expressed as a floating-point number. 7.12.9.2 The floor functions - Synopsis + Synopsis 1 #include <math.h> double floor(double x); float floorf(float x); long double floorl(long double x); - Description + Description 2 The floor functions compute the largest integer value not greater than x. - Returns + Returns 3 The floor functions return ???x???, expressed as a floating-point number. 7.12.9.3 The nearbyint functions - Synopsis + Synopsis 1 #include <math.h> double nearbyint(double x); float nearbyintf(float x); long double nearbyintl(long double x); - Description + Description 2 The nearbyint functions round their argument to an integer value in floating-point format, using the current rounding direction and without raising the ''inexact'' floating- point exception. - Returns + Returns 3 The nearbyint functions return the rounded integer value. 7.12.9.4 The rint functions - Synopsis + Synopsis 1 #include <math.h> double rint(double x); float rintf(float x); long double rintl(long double x); - Description + Description 2 The rint functions differ from the nearbyint functions (7.12.9.3) only in that the rint functions may raise the ''inexact'' floating-point exception if the result differs in value from the argument. -[page 232] (Contents) +[page 232] (Contents) - Returns + Returns 3 The rint functions return the rounded integer value. 7.12.9.5 The lrint and llrint functions - Synopsis + Synopsis 1 #include <math.h> long int lrint(double x); long int lrintf(float x); @@ -9436,33 +9436,33 @@ char int_p_sep_by_space long long int llrint(double x); long long int llrintf(float x); long long int llrintl(long double x); - Description + Description 2 The lrint and llrint functions round their argument to the nearest integer value, rounding according to the current rounding direction. If the rounded value is outside the range of the return type, the numeric result is unspecified and a domain error or range error may occur. * - Returns + Returns 3 The lrint and llrint functions return the rounded integer value. 7.12.9.6 The round functions - Synopsis + Synopsis 1 #include <math.h> double round(double x); float roundf(float x); long double roundl(long double x); - Description + Description 2 The round functions round their argument to the nearest integer value in floating-point format, rounding halfway cases away from zero, regardless of the current rounding direction. - Returns + Returns 3 The round functions return the rounded integer value. -[page 233] (Contents) +[page 233] (Contents) 7.12.9.7 The lround and llround functions - Synopsis + Synopsis 1 #include <math.h> long int lround(double x); long int lroundf(float x); @@ -9470,168 +9470,168 @@ char int_p_sep_by_space long long int llround(double x); long long int llroundf(float x); long long int llroundl(long double x); - Description + Description 2 The lround and llround functions round their argument to the nearest integer value, rounding halfway cases away from zero, regardless of the current rounding direction. If the rounded value is outside the range of the return type, the numeric result is unspecified and a domain error or range error may occur. - Returns + Returns 3 The lround and llround functions return the rounded integer value. 7.12.9.8 The trunc functions - Synopsis + Synopsis 1 #include <math.h> double trunc(double x); float truncf(float x); long double truncl(long double x); - Description + Description 2 The trunc functions round their argument to the integer value, in floating format, nearest to but no larger in magnitude than the argument. - Returns + Returns 3 The trunc functions return the truncated integer value. -[page 234] (Contents) +[page 234] (Contents) 7.12.10 Remainder functions 7.12.10.1 The fmod functions - Synopsis + Synopsis 1 #include <math.h> double fmod(double x, double y); float fmodf(float x, float y); long double fmodl(long double x, long double y); - Description + Description 2 The fmod functions compute the floating-point remainder of x/y. - Returns + Returns 3 The fmod functions return the value x - ny, for some integer n such that, if y is nonzero, the result has the same sign as x and magnitude less than the magnitude of y. If y is zero, whether a domain error occurs or the fmod functions return zero is implementation- defined. 7.12.10.2 The remainder functions - Synopsis + Synopsis 1 #include <math.h> double remainder(double x, double y); float remainderf(float x, float y); long double remainderl(long double x, long double y); - Description -2 The remainder functions compute the remainder x REM y required by IEC 60559.210) - Returns + Description +2 The remainder functions compute the remainder x REM y required by IEC 60559.210) + Returns 3 The remainder functions return x REM y. If y is zero, whether a domain error occurs or the functions return zero is implementation defined. - 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. -[page 235] (Contents) +[page 235] (Contents) 7.12.10.3 The remquo functions - Synopsis + Synopsis 1 #include <math.h> double remquo(double x, double y, int *quo); float remquof(float x, float y, int *quo); long double remquol(long double x, long double y, int *quo); - Description + Description 2 The remquo functions compute the same remainder as the remainder functions. In the object pointed to by quo they store a value whose sign is the sign of x/y and whose magnitude is congruent modulo 2n to the magnitude of the integral quotient of x/y, where n is an implementation-defined integer greater than or equal to 3. - Returns + Returns 3 The remquo functions return x REM y. If y is zero, the value stored in the object pointed to by quo is unspecified and whether a domain error occurs or the functions return zero is implementation defined. 7.12.11 Manipulation functions 7.12.11.1 The copysign functions - Synopsis + Synopsis 1 #include <math.h> double copysign(double x, double y); float copysignf(float x, float y); long double copysignl(long double x, long double y); - Description + Description 2 The copysign functions produce a value with the magnitude of x and the sign of y. They produce a NaN (with the sign of y) if x is a NaN. On implementations that represent a signed zero but do not treat negative zero consistently in arithmetic operations, the copysign functions regard the sign of zero as positive. - Returns + Returns 3 The copysign functions return a value with the magnitude of x and the sign of y. -[page 236] (Contents) +[page 236] (Contents) 7.12.11.2 The nan functions - Synopsis + Synopsis 1 #include <math.h> double nan(const char *tagp); float nanf(const char *tagp); long double nanl(const char *tagp); - Description + Description 2 The call nan("n-char-sequence") is equivalent to strtod("NAN(n-char- sequence)", (char**) NULL); the call nan("") is equivalent to strtod("NAN()", (char**) NULL). If tagp does not point to an n-char sequence or an empty string, the call is equivalent to strtod("NAN", (char**) NULL). Calls to nanf and nanl are equivalent to the corresponding calls to strtof and strtold. - Returns + Returns 3 The nan functions return a quiet NaN, if available, with content indicated through tagp. If the implementation does not support quiet NaNs, the functions return zero. Forward references: the strtod, strtof, and strtold functions (7.20.1.3). 7.12.11.3 The nextafter functions - Synopsis + Synopsis 1 #include <math.h> double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y); - Description + Description 2 The nextafter functions determine the next representable value, in the type of the function, after x in the direction of y, where x and y are first converted to the type of the - function.211) The nextafter functions return y if x equals y. A range error may occur + function.211) The nextafter functions return y if x equals y. A range error may occur if the magnitude of x is the largest finite value representable in the type and the result is infinite or not representable in the type. - Returns + Returns 3 The nextafter functions return the next representable value in the specified format after x in the direction of y. - 211) The argument values are converted to the type of the function, even by a macro implementation of the + 211) The argument values are converted to the type of the function, even by a macro implementation of the function. -[page 237] (Contents) +[page 237] (Contents) 7.12.11.4 The nexttoward functions - Synopsis + Synopsis 1 #include <math.h> double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); - Description + Description 2 The nexttoward functions are equivalent to the nextafter functions except that the second parameter has type long double and the functions return y converted to the - type of the function if x equals y.212) + type of the function if x equals y.212) 7.12.12 Maximum, minimum, and positive difference functions 7.12.12.1 The fdim functions - Synopsis + Synopsis 1 #include <math.h> double fdim(double x, double y); float fdimf(float x, float y); long double fdiml(long double x, long double y); - Description + Description 2 The fdim functions determine the positive difference between their arguments: ???x - y if x > y ??? ???+0 if x <= y A range error may occur. - Returns + Returns 3 The fdim functions return the positive difference value. 7.12.12.2 The fmax functions - Synopsis + Synopsis 1 #include <math.h> double fmax(double x, double y); float fmaxf(float x, float y); @@ -9639,76 +9639,76 @@ char int_p_sep_by_space - 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. -[page 238] (Contents) +[page 238] (Contents) - Description -2 The fmax functions determine the maximum numeric value of their arguments.213) - Returns + Description +2 The fmax functions determine the maximum numeric value of their arguments.213) + Returns 3 The fmax functions return the maximum numeric value of their arguments. 7.12.12.3 The fmin functions - Synopsis + Synopsis 1 #include <math.h> double fmin(double x, double y); float fminf(float x, float y); long double fminl(long double x, long double y); - Description -2 The fmin functions determine the minimum numeric value of their arguments.214) - Returns + Description +2 The fmin functions determine the minimum numeric value of their arguments.214) + Returns 3 The fmin functions return the minimum numeric value of their arguments. 7.12.13 Floating multiply-add 7.12.13.1 The fma functions - Synopsis + Synopsis 1 #include <math.h> double fma(double x, double y, double z); float fmaf(float x, float y, float z); long double fmal(long double x, long double y, long double z); - Description + Description 2 The fma functions compute (x x y) + z, rounded as one ternary operation: they compute the value (as if) to infinite precision and round once to the result format, according to the current rounding mode. A range error may occur. - Returns + Returns 3 The fma functions return (x x y) + z, rounded as one ternary operation. - 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. - 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. -[page 239] (Contents) +[page 239] (Contents) 7.12.14 Comparison macros 1 The relational and equality operators support the usual mathematical relationships between numeric values. For any ordered pair of numeric values exactly one of the relationships -- less, greater, and equal -- is true. Relational operators may raise the ''invalid'' floating-point exception when argument values are NaNs. For a NaN and a - numeric value, or for two NaNs, just the unordered relationship is true.215) The following + numeric value, or for two NaNs, just the unordered relationship is true.215) The following subclauses provide macros that are quiet (non floating-point exception raising) versions of the relational operators, and other comparison macros that facilitate writing efficient code that accounts for NaNs without suffering the ''invalid'' floating-point exception. In the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type. 7.12.14.1 The isgreater macro - Synopsis + Synopsis 1 #include <math.h> int isgreater(real-floating x, real-floating y); - Description + Description 2 The isgreater macro determines whether its first argument is greater than its second argument. The value of isgreater(x, y) is always equal to (x) > (y); however, unlike (x) > (y), isgreater(x, y) does not raise the ''invalid'' floating-point exception when x and y are unordered. - Returns + Returns 3 The isgreater macro returns the value of (x) > (y). 7.12.14.2 The isgreaterequal macro - Synopsis + Synopsis 1 #include <math.h> int isgreaterequal(real-floating x, real-floating y); - Description + Description 2 The isgreaterequal macro determines whether its first argument is greater than or equal to its second argument. The value of isgreaterequal(x, y) is always equal to (x) >= (y); however, unlike (x) >= (y), isgreaterequal(x, y) does @@ -9716,67 +9716,67 @@ char int_p_sep_by_space - 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. -[page 240] (Contents) +[page 240] (Contents) - Returns + Returns 3 The isgreaterequal macro returns the value of (x) >= (y). 7.12.14.3 The isless macro - Synopsis + Synopsis 1 #include <math.h> int isless(real-floating x, real-floating y); - Description + Description 2 The isless macro determines whether its first argument is less than its second argument. The value of isless(x, y) is always equal to (x) < (y); however, unlike (x) < (y), isless(x, y) does not raise the ''invalid'' floating-point exception when x and y are unordered. - Returns + Returns 3 The isless macro returns the value of (x) < (y). 7.12.14.4 The islessequal macro - Synopsis + Synopsis 1 #include <math.h> int islessequal(real-floating x, real-floating y); - Description + Description 2 The islessequal macro determines whether its first argument is less than or equal to its second argument. The value of islessequal(x, y) is always equal to (x) <= (y); however, unlike (x) <= (y), islessequal(x, y) does not raise the ''invalid'' floating-point exception when x and y are unordered. - Returns + Returns 3 The islessequal macro returns the value of (x) <= (y). 7.12.14.5 The islessgreater macro - Synopsis + Synopsis 1 #include <math.h> int islessgreater(real-floating x, real-floating y); - Description + Description 2 The islessgreater macro determines whether its first argument is less than or greater than its second argument. The islessgreater(x, y) macro is similar to (x) < (y) || (x) > (y); however, islessgreater(x, y) does not raise the ''invalid'' floating-point exception when x and y are unordered (nor does it evaluate x and y twice). -[page 241] (Contents) +[page 241] (Contents) - Returns + Returns 3 The islessgreater macro returns the value of (x) < (y) || (x) > (y). 7.12.14.6 The isunordered macro - Synopsis + Synopsis 1 #include <math.h> int isunordered(real-floating x, real-floating y); - Description + Description 2 The isunordered macro determines whether its arguments are unordered. - Returns + Returns 3 The isunordered macro returns 1 if its arguments are unordered and 0 otherwise. -[page 242] (Contents) +[page 242] (Contents) 7.13 Nonlocal jumps <setjmp.h> 1 The header <setjmp.h> defines the macro setjmp, and declares one function and - one type, for bypassing the normal function call and return discipline.216) + one type, for bypassing the normal function call and return discipline.216) 2 The type declared is jmp_buf which is an array type suitable for holding the information needed to restore a calling @@ -9790,13 +9790,13 @@ char int_p_sep_by_space program defines an external identifier with the name setjmp, the behavior is undefined. 7.13.1 Save calling environment 7.13.1.1 The setjmp macro - Synopsis + Synopsis 1 #include <setjmp.h> int setjmp(jmp_buf env); - Description + Description 2 The setjmp macro saves its calling environment in its jmp_buf argument for later use by the longjmp function. - Returns + Returns 3 If the return is from a direct invocation, the setjmp macro returns the value zero. If the return is from a call to the longjmp function, the setjmp macro returns a nonzero value. @@ -9807,10 +9807,10 @@ char int_p_sep_by_space constant expression, with the resulting expression being the entire controlling - 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. -[page 243] (Contents) +[page 243] (Contents) expression of a selection or iteration statement; -- the operand of a unary ! operator with the resulting expression being the entire @@ -9819,23 +9819,23 @@ char int_p_sep_by_space 5 If the invocation appears in any other context, the behavior is undefined. 7.13.2 Restore calling environment 7.13.2.1 The longjmp function - Synopsis + Synopsis 1 #include <setjmp.h> void longjmp(jmp_buf env, int val); - Description + Description 2 The longjmp function restores the environment saved by the most recent invocation of the setjmp macro in the same invocation of the program with the corresponding jmp_buf argument. If there has been no such invocation, or if the function containing - the invocation of the setjmp macro has terminated execution217) in the interim, or if the + the invocation of the setjmp macro has terminated execution217) in the interim, or if the invocation of the setjmp macro was within the scope of an identifier with variably modified type and execution has left that scope in the interim, the behavior is undefined. -3 All accessible objects have values, and all other components of the abstract machine218) +3 All accessible objects have values, and all other components of the abstract machine218) have state, as of the time the longjmp function was called, except that the values of objects of automatic storage duration that are local to the function containing the invocation of the corresponding setjmp macro that do not have volatile-qualified type and have been changed between the setjmp invocation and longjmp call are indeterminate. - Returns + Returns 4 After longjmp is completed, program execution continues as if the corresponding invocation of the setjmp macro had just returned the value specified by val. The longjmp function cannot cause the setjmp macro to return the value 0; if val is 0, @@ -9846,11 +9846,11 @@ char int_p_sep_by_space - 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. -[page 244] (Contents) +[page 244] (Contents) #include <setjmp.h> jmp_buf buf; @@ -9877,7 +9877,7 @@ char int_p_sep_by_space -[page 245] (Contents) +[page 245] (Contents) 7.14 Signal handling <signal.h> 1 The header <signal.h> declares a type and two functions and defines several macros, @@ -9905,25 +9905,25 @@ char int_p_sep_by_space 4 An implementation need not generate any of these signals, except as a result of explicit calls to the raise function. Additional signals and pointers to undeclarable functions, with macro definitions beginning, respectively, with the letters SIG and an uppercase - letter or with SIG_ and an uppercase letter,219) may also be specified by the + letter or with SIG_ and an uppercase letter,219) may also be specified by the implementation. The complete set of signals, their semantics, and their default handling is implementation-defined; all signal numbers shall be positive. - 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. -[page 246] (Contents) +[page 246] (Contents) 7.14.1 Specify signal handling 7.14.1.1 The signal function - Synopsis + Synopsis 1 #include <signal.h> void (*signal(int sig, void (*func)(int)))(int); - Description + Description 2 The signal function chooses one of three ways in which receipt of the signal number sig is to be subsequently handled. If the value of func is SIG_DFL, default handling for that signal will occur. If the value of func is SIG_IGN, the signal will be ignored. @@ -9949,21 +9949,21 @@ char int_p_sep_by_space function, the _Exit function, or the signal function with the first argument equal to the signal number corresponding to the signal that caused the invocation of the handler. Furthermore, if such a call to the signal function results in a SIG_ERR return, the - value of errno is indeterminate.220) + value of errno is indeterminate.220) 6 At program startup, the equivalent of signal(sig, SIG_IGN); - 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. -[page 247] (Contents) +[page 247] (Contents) may be executed for some signals selected in an implementation-defined manner; the equivalent of signal(sig, SIG_DFL); is executed for all other signals defined by the implementation. 7 The implementation shall behave as if no library function calls the signal function. - Returns + Returns 8 If the request can be honored, the signal function returns the value of func for the most recent successful call to signal for the specified signal sig. Otherwise, a value of SIG_ERR is returned and a positive value is stored in errno. @@ -9971,20 +9971,20 @@ char int_p_sep_by_space _Exit function (7.20.4.4). 7.14.2 Send signal 7.14.2.1 The raise function - Synopsis + Synopsis 1 #include <signal.h> int raise(int sig); - Description + Description 2 The raise function carries out the actions described in 7.14.1.1 for the signal sig. If a signal handler is called, the raise function shall not return until after the signal handler does. - Returns + Returns 3 The raise function returns zero if successful, nonzero if unsuccessful. -[page 248] (Contents) +[page 248] (Contents) 7.15 Variable arguments <stdarg.h> 1 The header <stdarg.h> declares a type and defines four macros, for advancing @@ -10002,7 +10002,7 @@ char int_p_sep_by_space subclause) having type va_list. The object ap may be passed as an argument to another function; if that function invokes the va_arg macro with parameter ap, the value of ap in the calling function is indeterminate and shall be passed to the va_end - macro prior to any further reference to ap.221) + macro prior to any further reference to ap.221) 7.15.1 Variable argument list access macros 1 The va_start and va_arg macros described in this subclause shall be implemented as macros, not functions. It is unspecified whether va_copy and va_end are macros or @@ -10012,18 +10012,18 @@ char int_p_sep_by_space shall be matched by a corresponding invocation of the va_end macro in the same function. 7.15.1.1 The va_arg macro - Synopsis + Synopsis 1 #include <stdarg.h> type va_arg(va_list ap, type); - Description + Description 2 The va_arg macro expands to an expression that has the specified type and the value of the next argument in the call. The parameter ap shall have been initialized by the va_start or va_copy macro (without an intervening invocation of the va_end - 221) It is permitted to create a pointer to a va_list and pass that pointer to another function, in which + 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. -[page 249] (Contents) +[page 249] (Contents) macro for the same ap). Each invocation of the va_arg macro modifies ap so that the values of successive arguments are returned in turn. The parameter type shall be a type @@ -10035,44 +10035,44 @@ char int_p_sep_by_space -- one type is a signed integer type, the other type is the corresponding unsigned integer type, and the value is representable in both types; -- one type is pointer to void and the other is a pointer to a character type. - Returns + Returns 3 The first invocation of the va_arg macro after that of the va_start macro returns the value of the argument after that specified by parmN . Successive invocations return the values of the remaining arguments in succession. 7.15.1.2 The va_copy macro - Synopsis + Synopsis 1 #include <stdarg.h> void va_copy(va_list dest, va_list src); - Description + Description 2 The va_copy macro initializes dest as a copy of src, as if the va_start macro had been applied to dest followed by the same sequence of uses of the va_arg macro as had previously been used to reach the present state of src. Neither the va_copy nor va_start macro shall be invoked to reinitialize dest without an intervening invocation of the va_end macro for the same dest. - Returns + Returns 3 The va_copy macro returns no value. 7.15.1.3 The va_end macro - Synopsis + Synopsis 1 #include <stdarg.h> void va_end(va_list ap); - Description + Description 2 The va_end macro facilitates a normal return from the function whose variable argument list was referred to by the expansion of the va_start macro, or the function containing the expansion of the va_copy macro, that initialized the va_list ap. The va_end macro may modify ap so that it is no longer usable (without being reinitialized -[page 250] (Contents) +[page 250] (Contents) by the va_start or va_copy macro). If there is no corresponding invocation of the va_start or va_copy macro, or if the va_end macro is not invoked before the return, the behavior is undefined. - Returns + Returns 3 The va_end macro returns no value. 7.15.1.4 The va_start macro - Synopsis + Synopsis 1 #include <stdarg.h> void va_start(va_list ap, parmN); - Description + Description 2 The va_start macro shall be invoked before any access to the unnamed arguments. 3 The va_start macro initializes ap for subsequent use by the va_arg and va_end macros. Neither the va_start nor va_copy macro shall be invoked to reinitialize ap @@ -10082,7 +10082,7 @@ char int_p_sep_by_space parmN is declared with the register storage class, with a function or array type, or with a type that is not compatible with the type that results after application of the default argument promotions, the behavior is undefined. - Returns + Returns 5 The va_start macro returns no value. 6 EXAMPLE 1 The function f1 gathers into an array a list of arguments that are pointers to strings (but not more than MAXARGS arguments), then passes the array as a single argument to function f2. The number of @@ -10098,7 +10098,7 @@ char int_p_sep_by_space -[page 251] (Contents) +[page 251] (Contents) if (n_ptrs > MAXARGS) n_ptrs = MAXARGS; @@ -10143,7 +10143,7 @@ char int_p_sep_by_space -[page 252] (Contents) +[page 252] (Contents) 7.16 Boolean type and values <stdbool.h> 1 The header <stdbool.h> defines four macros. @@ -10159,14 +10159,14 @@ char int_p_sep_by_space __bool_true_false_are_defined which expands to the integer constant 1. 4 Notwithstanding the provisions of 7.1.3, a program may undefine and perhaps then - redefine the macros bool, true, and false.222) + redefine the macros bool, true, and false.222) - 222) See ''future library directions'' (7.26.7). + 222) See ''future library directions'' (7.26.7). -[page 253] (Contents) +[page 253] (Contents) 7.17 Common definitions <stddef.h> 1 The following types and macros are defined in the standard header <stddef.h>. Some @@ -10203,11 +10203,11 @@ char int_p_sep_by_space -[page 254] (Contents) +[page 254] (Contents) 7.18 Integer types <stdint.h> 1 The header <stdint.h> declares sets of integer types having specified widths, and - defines corresponding sets of macros.223) It also defines macros that specify limits of + defines corresponding sets of macros.223) It also defines macros that specify limits of integer types corresponding to types defined in other standard headers. 2 Types are defined in the following categories: -- integer types having certain exact widths; @@ -10218,7 +10218,7 @@ char int_p_sep_by_space (Some of these types may denote the same type.) 3 Corresponding macros specify limits of the declared types and construct suitable constants. -4 For each type described herein that the implementation provides,224) <stdint.h> shall +4 For each type described herein that the implementation provides,224) <stdint.h> shall declare that typedef name and define the associated macros. Conversely, for each type described herein that the implementation does not provide, <stdint.h> shall not declare that typedef name nor shall it define the associated macros. An implementation @@ -10234,10 +10234,10 @@ char int_p_sep_by_space - 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. -[page 255] (Contents) +[page 255] (Contents) 7.18.1.1 Exact-width integer types 1 The typedef name intN_t designates a signed integer type with width N , no padding @@ -10263,7 +10263,7 @@ char int_p_sep_by_space int_least64_t uint_least64_t All other types of this form are optional. 7.18.1.3 Fastest minimum-width integer types -1 Each of the following types designates an integer type that is usually fastest225) to operate +1 Each of the following types designates an integer type that is usually fastest225) to operate with among all integer types that have at least the specified width. 2 The typedef name int_fastN_t designates the fastest signed integer type with a width of at least N . The typedef name uint_fastN_t designates the fastest unsigned integer @@ -10272,11 +10272,11 @@ char int_p_sep_by_space - 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. -[page 256] (Contents) +[page 256] (Contents) 3 The following types are required: int_fast8_t uint_fast8_t @@ -10303,17 +10303,17 @@ char int_p_sep_by_space uintmax_t These types are required. 7.18.2 Limits of specified-width integer types -1 The following object-like macros226) specify the minimum and maximum limits of the +1 The following object-like macros226) specify the minimum and maximum limits of the types declared in <stdint.h>. Each macro name corresponds to a similar type name in - 7.18.1. + 7.18.1. 2 Each instance of any defined macro shall be replaced by a constant expression suitable for use in #if preprocessing directives, and this expression shall have the same type as would an expression that is an object of the corresponding type converted according to - 226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined + 226) C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before <stdint.h> is included. -[page 257] (Contents) +[page 257] (Contents) the integer promotions. Its implementation-defined value shall be equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign, @@ -10347,7 +10347,7 @@ char int_p_sep_by_space -[page 258] (Contents) +[page 258] (Contents) -- maximum value of pointer-holding unsigned integer type UINTPTR_MAX 216 - 1 @@ -10359,7 +10359,7 @@ char int_p_sep_by_space -- maximum value of greatest-width unsigned integer type UINTMAX_MAX 264 - 1 7.18.3 Limits of other integer types -1 The following object-like macros227) specify the minimum and maximum limits of +1 The following object-like macros227) specify the minimum and maximum limits of integer types corresponding to types defined in other standard headers. 2 Each instance of these macros shall be replaced by a constant expression suitable for use in #if preprocessing directives, and this expression shall have the same type as would an @@ -10367,7 +10367,7 @@ char int_p_sep_by_space promotions. Its implementation-defined value shall be equal to or greater in magnitude (absolute value) than the corresponding value given below, with the same sign. An implementation shall define only the macros corresponding to those typedef names it - actually provides.228) + actually provides.228) -- limits of ptrdiff_t PTRDIFF_MIN -65535 PTRDIFF_MAX +65535 @@ -10380,11 +10380,11 @@ char int_p_sep_by_space - 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. + 228) A freestanding implementation need not provide all of these types. -[page 259] (Contents) +[page 259] (Contents) WCHAR_MIN see below WCHAR_MAX see below @@ -10399,16 +10399,16 @@ char int_p_sep_by_space 4 If wchar_t (see 7.17) is defined as a signed integer type, the value of WCHAR_MIN shall be no greater than -127 and the value of WCHAR_MAX shall be no less than 127; otherwise, wchar_t is defined as an unsigned integer type, and the value of - WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.229) + WCHAR_MIN shall be 0 and the value of WCHAR_MAX shall be no less than 255.229) 5 If wint_t (see 7.24) is defined as a signed integer type, the value of WINT_MIN shall be no greater than -32767 and the value of WINT_MAX shall be no less than 32767; otherwise, wint_t is defined as an unsigned integer type, and the value of WINT_MIN shall be 0 and the value of WINT_MAX shall be no less than 65535. 7.18.4 Macros for integer constants -1 The following function-like macros230) expand to integer constants suitable for +1 The following function-like macros230) expand to integer constants suitable for initializing objects that have integer types corresponding to types defined in <stdint.h>. Each macro name corresponds to a similar type name in 7.18.1.2 or - 7.18.1.5. + 7.18.1.5. 2 The argument in any instance of these macros shall be an unsuffixed integer constant (as defined in 6.4.4.1) with a value that does not exceed the limits for the corresponding type. 3 Each invocation of one of these macros shall expand to an integer constant expression @@ -10419,12 +10419,12 @@ char int_p_sep_by_space - 229) The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended + 229) The values WCHAR_MIN and WCHAR_MAX do not necessarily correspond to members of the extended character set. - 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. -[page 260] (Contents) +[page 260] (Contents) 7.18.4.1 Macros for minimum-width integer constants 1 The macro INTN_C(value) shall expand to an integer constant expression @@ -10443,7 +10443,7 @@ char int_p_sep_by_space -[page 261] (Contents) +[page 261] (Contents) 7.19 Input/output <stdio.h> 7.19.1 Introduction @@ -10480,9 +10480,9 @@ char int_p_sep_by_space -[page 262] (Contents) +[page 262] (Contents) - guarantees can be opened;231) + guarantees can be opened;231) L_tmpnam which expands to an integer constant expression that is the size needed for an array of char large enough to hold a temporary file name string generated by the tmpnam @@ -10515,12 +10515,12 @@ char int_p_sep_by_space putwchar, fwprintf, wprintf, vfwprintf, and vwprintf. - 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. -[page 263] (Contents) +[page 263] (Contents) -- The wide character input/output functions -- the union of the ungetwc function, the wide character input functions, and the wide character output functions. @@ -10535,7 +10535,7 @@ char int_p_sep_by_space or whether to or from files supported on structured storage devices, are mapped into logical data streams, whose properties are more uniform than their various inputs and outputs. Two forms of mapping are supported, for text streams and for binary - streams.232) + streams.232) 2 A text stream is an ordered sequence of characters composed into lines, each line consisting of zero or more characters plus a terminating new-line character. Whether the last line requires a terminating new-line character is implementation-defined. Characters @@ -10558,16 +10558,16 @@ char int_p_sep_by_space character input/output function has been applied to a stream without orientation, the - 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. -[page 264] (Contents) +[page 264] (Contents) stream becomes a wide-oriented stream. Similarly, once a byte input/output function has been applied to a stream without orientation, the stream becomes a byte-oriented stream. Only a call to the freopen function or the fwide function can otherwise alter the - orientation of a stream. (A successful call to freopen removes any orientation.)233) + orientation of a stream. (A successful call to freopen removes any orientation.)233) 5 Byte input/output functions shall not be applied to a wide-oriented stream and wide character input/output functions shall not be applied to a byte-oriented stream. The remaining stream operations do not affect, and are not affected by, a stream's orientation, @@ -10594,9 +10594,9 @@ char int_p_sep_by_space - 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. -[page 265] (Contents) +[page 265] (Contents) 7.19.3 Files 1 A stream is associated with an external file (which may be a physical device) by opening @@ -10637,7 +10637,7 @@ char int_p_sep_by_space 6 The address of the FILE object used to control a stream may be significant; a copy of a FILE object need not serve in place of the original. -[page 266] (Contents) +[page 266] (Contents) 7 At program startup, three text streams are predefined and need not be opened explicitly -- standard input (for reading conventional input), standard output (for writing @@ -10653,7 +10653,7 @@ char int_p_sep_by_space multibyte characters, generalized as follows: -- Multibyte encodings within files may contain embedded null bytes (unlike multibyte encodings valid for use internal to the program). - -- A file need not begin nor end in the initial shift state.234) + -- A file need not begin nor end in the initial shift state.234) 10 Moreover, the encodings used for multibyte characters may differ among files. Both the nature and choice of such encodings are implementation-defined. 11 The wide character input functions read multibyte characters from the stream and convert @@ -10674,11 +10674,11 @@ char int_p_sep_by_space value passed to the underlying wcrtomb does not correspond to a valid (generalized) - 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. -[page 267] (Contents) +[page 267] (Contents) multibyte character. The wide character input/output functions and the byte input/output functions store the value of the macro EILSEQ in errno if and only if an encoding error @@ -10693,21 +10693,21 @@ char int_p_sep_by_space (7.24.6.3.2), the wcrtomb function (7.24.6.3.3). 7.19.4 Operations on files 7.19.4.1 The remove function - Synopsis + Synopsis 1 #include <stdio.h> int remove(const char *filename); - Description + Description 2 The remove function causes the file whose name is the string pointed to by filename to be no longer accessible by that name. A subsequent attempt to open that file using that name will fail, unless it is created anew. If the file is open, the behavior of the remove function is implementation-defined. - Returns + Returns 3 The remove function returns zero if the operation succeeds, nonzero if it fails. 7.19.4.2 The rename function - Synopsis + Synopsis 1 #include <stdio.h> int rename(const char *old, const char *new); - Description + Description 2 The rename function causes the file whose name is the string pointed to by old to be henceforth known by the name given by the string pointed to by new. The file named old is no longer accessible by that name. If a file named by the string pointed to by new @@ -10716,16 +10716,16 @@ char int_p_sep_by_space -[page 268] (Contents) +[page 268] (Contents) - Returns -3 The rename function returns zero if the operation succeeds, nonzero if it fails,235) in + Returns +3 The rename function returns zero if the operation succeeds, nonzero if it fails,235) in which case if the file existed previously it is still known by its original name. 7.19.4.3 The tmpfile function - Synopsis + Synopsis 1 #include <stdio.h> FILE *tmpfile(void); - Description + Description 2 The tmpfile function creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination. If the program terminates abnormally, whether an open temporary file is @@ -10735,33 +10735,33 @@ char int_p_sep_by_space program (this limit may be shared with tmpnam) and there should be no limit on the number simultaneously open other than this limit and any limit on the number of open files (FOPEN_MAX). - Returns + Returns 4 The tmpfile function returns a pointer to the stream of the file that it created. If the file cannot be created, the tmpfile function returns a null pointer. Forward references: the fopen function (7.19.5.3). 7.19.4.4 The tmpnam function - Synopsis + Synopsis 1 #include <stdio.h> char *tmpnam(char *s); - Description + Description 2 The tmpnam function generates a string that is a valid file name and that is not the same - as the name of an existing file.236) The function is potentially capable of generating + as the name of an existing file.236) The function is potentially capable of generating - 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. - 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. -[page 269] (Contents) +[page 269] (Contents) TMP_MAX different strings, but any or all of them may already be in use by existing files and thus not be suitable return values. 3 The tmpnam function generates a different string each time it is called. 4 The implementation shall behave as if no library function calls the tmpnam function. - Returns + Returns 5 If no suitable string can be generated, the tmpnam function returns a null pointer. Otherwise, if the argument is a null pointer, the tmpnam function leaves its result in an internal static object and returns a pointer to that object (subsequent calls to the tmpnam @@ -10772,50 +10772,50 @@ char int_p_sep_by_space 6 The value of the macro TMP_MAX shall be at least 25. 7.19.5 File access functions 7.19.5.1 The fclose function - Synopsis + Synopsis 1 #include <stdio.h> int fclose(FILE *stream); - Description + Description 2 A successful call to the fclose function causes the stream pointed to by stream to be flushed and the associated file to be closed. Any unwritten buffered data for the stream are delivered to the host environment to be written to the file; any unread buffered data are discarded. Whether or not the call succeeds, the stream is disassociated from the file and any buffer set by the setbuf or setvbuf function is disassociated from the stream (and deallocated if it was automatically allocated). - Returns + Returns 3 The fclose function returns zero if the stream was successfully closed, or EOF if any errors were detected. 7.19.5.2 The fflush function - Synopsis + Synopsis 1 #include <stdio.h> int fflush(FILE *stream); -[page 270] (Contents) +[page 270] (Contents) - Description + Description 2 If stream points to an output stream or an update stream in which the most recent operation was not input, the fflush function causes any unwritten data for that stream to be delivered to the host environment to be written to the file; otherwise, the behavior is undefined. 3 If stream is a null pointer, the fflush function performs this flushing action on all streams for which the behavior is defined above. - Returns + Returns 4 The fflush function sets the error indicator for the stream and returns EOF if a write error occurs, otherwise it returns zero. Forward references: the fopen function (7.19.5.3). 7.19.5.3 The fopen function - Synopsis + Synopsis 1 #include <stdio.h> FILE *fopen(const char * restrict filename, const char * restrict mode); - Description + Description 2 The fopen function opens the file whose name is the string pointed to by filename, and associates a stream with it. 3 The argument mode points to a string. If the string is one of the following, the file is - open in the indicated mode. Otherwise, the behavior is undefined.237) + open in the indicated mode. Otherwise, the behavior is undefined.237) r open text file for reading w truncate to zero length or create text file for writing a append; open or create text file for writing at end-of-file @@ -10829,11 +10829,11 @@ char int_p_sep_by_space - 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). -[page 271] (Contents) +[page 271] (Contents) r+b or rb+ open binary file for update (reading and writing) w+b or wb+ truncate to zero length or create binary file for update @@ -10856,26 +10856,26 @@ char int_p_sep_by_space binary stream in some implementations. 7 When opened, a stream is fully buffered if and only if it can be determined not to refer to an interactive device. The error and end-of-file indicators for the stream are cleared. - Returns + Returns 8 The fopen function returns a pointer to the object controlling the stream. If the open operation fails, fopen returns a null pointer. Forward references: file positioning functions (7.19.9). 7.19.5.4 The freopen function - Synopsis + Synopsis 1 #include <stdio.h> FILE *freopen(const char * restrict filename, const char * restrict mode, FILE * restrict stream); - Description + Description 2 The freopen function opens the file whose name is the string pointed to by filename and associates the stream pointed to by stream with it. The mode argument is used just -[page 272] (Contents) +[page 272] (Contents) - as in the fopen function.238) + as in the fopen function.238) 3 If filename is a null pointer, the freopen function attempts to change the mode of the stream to that specified by mode, as if the name of the file currently associated with the stream had been used. It is implementation-defined which changes of mode are @@ -10883,23 +10883,23 @@ char int_p_sep_by_space 4 The freopen function first attempts to close any file that is associated with the specified stream. Failure to close the file is ignored. The error and end-of-file indicators for the stream are cleared. - Returns + Returns 5 The freopen function returns a null pointer if the open operation fails. Otherwise, freopen returns the value of stream. 7.19.5.5 The setbuf function - Synopsis + Synopsis 1 #include <stdio.h> void setbuf(FILE * restrict stream, char * restrict buf); - Description + Description 2 Except that it returns no value, the setbuf function is equivalent to the setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for size, or (if buf is a null pointer), with the value _IONBF for mode. - Returns + Returns 3 The setbuf function returns no value. Forward references: the setvbuf function (7.19.5.6). 7.19.5.6 The setvbuf function - Synopsis + Synopsis 1 #include <stdio.h> int setvbuf(FILE * restrict stream, char * restrict buf, @@ -10908,35 +10908,35 @@ char int_p_sep_by_space - 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. -[page 273] (Contents) +[page 273] (Contents) - Description + Description 2 The setvbuf function may be used only after the stream pointed to by stream has been associated with an open file and before any other operation (other than an unsuccessful call to setvbuf) is performed on the stream. The argument mode determines how stream will be buffered, as follows: _IOFBF causes input/output to be fully buffered; _IOLBF causes input/output to be line buffered; _IONBF causes input/output to be unbuffered. If buf is not a null pointer, the array it points to may be - used instead of a buffer allocated by the setvbuf function239) and the argument size + used instead of a buffer allocated by the setvbuf function239) and the argument size specifies the size of the array; otherwise, size may determine the size of a buffer allocated by the setvbuf function. The contents of the array at any time are indeterminate. - Returns + Returns 3 The setvbuf function returns zero on success, or nonzero if an invalid value is given for mode or if the request cannot be honored. 7.19.6 Formatted input/output functions 1 The formatted input/output functions shall behave as if there is a sequence point after the - actions associated with each specifier.240) + actions associated with each specifier.240) 7.19.6.1 The fprintf function - Synopsis + Synopsis 1 #include <stdio.h> int fprintf(FILE * restrict stream, const char * restrict format, ...); - Description + Description 2 The fprintf function writes output to the stream pointed to by stream, under control of the string pointed to by format that specifies how subsequent arguments are converted for output. If there are insufficient arguments for the format, the behavior is @@ -10948,11 +10948,11 @@ char int_p_sep_by_space characters (not %), which are copied unchanged to the output stream; and conversion - 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. - 240) The fprintf functions perform writes to memory for the %n specifier. + 240) The fprintf functions perform writes to memory for the %n specifier. -[page 274] (Contents) +[page 274] (Contents) specifications, each of which results in fetching zero or more subsequent arguments, converting them, if applicable, according to the corresponding conversion specifier, and @@ -10964,7 +10964,7 @@ char int_p_sep_by_space -- An optional minimum field width. If the converted value has fewer characters than the field width, it is padded with spaces (by default) on the left (or right, if the left adjustment flag, described later, has been given) to the field width. The field width - takes the form of an asterisk * (described later) or a nonnegative decimal integer.241) + takes the form of an asterisk * (described later) or a nonnegative decimal integer.241) -- An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point character for a, A, e, E, f, and F conversions, the maximum number of significant @@ -10990,11 +10990,11 @@ char int_p_sep_by_space - 241) Note that 0 is taken as a flag, not as the beginning of a field width. + 241) Note that 0 is taken as a flag, not as the beginning of a field width. -[page 275] (Contents) +[page 275] (Contents) - specified.)242) + specified.)242) space If the first character of a signed conversion is not a sign, or if a signed conversion results in no characters, a space is prefixed to the result. If the space and + flags both appear, the space flag is ignored. @@ -11030,10 +11030,10 @@ char int_p_sep_by_space long int or unsigned long int argument; that a following n conversion specifier applies to a pointer to a long int argument; that a - 242) The results of all floating conversions of a negative zero, and of negative values that round to zero, + 242) The results of all floating conversions of a negative zero, and of negative values that round to zero, include a minus sign. -[page 276] (Contents) +[page 276] (Contents) following c conversion specifier applies to a wint_t argument; that a following s conversion specifier applies to a pointer to a wchar_t @@ -11073,7 +11073,7 @@ char int_p_sep_by_space zero value with a precision of zero is no characters. -[page 277] (Contents) +[page 277] (Contents) f,F A double argument representing a floating-point number is converted to decimal notation in the style [-]ddd.ddd, where the number of digits after @@ -11088,7 +11088,7 @@ f,F A double argument representing a floating-point number is converted [-]nan or [-]nan(n-char-sequence) -- which style, and the meaning of any n-char-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or nan, - respectively.243) + respectively.243) e,E A double argument representing a floating-point number is converted in the style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the argument is nonzero) before the decimal-point character and the number of @@ -11111,10 +11111,10 @@ g,G A double argument representing a floating-point number is converted -- otherwise, the conversion is with style e (or E) and precision P - 1. Finally, unless the # flag is used, any trailing zeros are removed from the -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. -[page 278] (Contents) +[page 278] (Contents) fractional portion of the result and the decimal-point character is removed if there is no fractional portion remaining. @@ -11123,12 +11123,12 @@ g,G A double argument representing a floating-point number is converted a,A A double argument representing a floating-point number is converted in the style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is nonzero if the argument is a normalized floating-point number and is - otherwise unspecified) before the decimal-point character244) and the number + otherwise unspecified) before the decimal-point character244) and the number of hexadecimal digits after it is equal to the precision; if the precision is missing and FLT_RADIX is a power of 2, then the precision is sufficient for an exact representation of the value; if the precision is missing and FLT_RADIX is not a power of 2, then the precision is sufficient to - distinguish245) values of type double, except that trailing zeros may be + distinguish245) values of type double, except that trailing zeros may be omitted; if the precision is zero and the # flag is not specified, no decimal- point character appears. The letters abcdef are used for a conversion and the letters ABCDEF for A conversion. The A conversion specifier produces a @@ -11145,18 +11145,18 @@ c If no l length modifier is present, the int argument is converted containing the wint_t argument to the lc conversion specification and the second a null wide character. s If no l length modifier is present, the argument shall be a pointer to the initial - element of an array of character type.246) Characters from the array are + element of an array of character type.246) Characters from the array are -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. +246) No special provisions are made for multibyte characters. -[page 279] (Contents) +[page 279] (Contents) written up to (but not including) the terminating null character. If the precision is specified, no more than that many bytes are written. If the @@ -11174,7 +11174,7 @@ s If no l length modifier is present, the argument shall be a pointe written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the - end of the array. In no case is a partial multibyte character written.247) + end of the array. In no case is a partial multibyte character written.247) p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing characters, in an implementation-defined manner. @@ -11185,7 +11185,7 @@ s If no l length modifier is present, the argument shall be a pointe undefined. % A % character is written. No argument is converted. The complete conversion specification shall be %%. -9 If a conversion specification is invalid, the behavior is undefined.248) If any argument is +9 If a conversion specification is invalid, the behavior is undefined.248) If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined. 10 In no case does a nonexistent or small field width cause truncation of a field; if the result @@ -11195,10 +11195,10 @@ s If no l length modifier is present, the argument shall be a pointe - 247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding. - 248) See ''future library directions'' (7.26.9). + 247) Redundant shift sequences may result if multibyte characters have a state-dependent encoding. + 248) See ''future library directions'' (7.26.9). -[page 280] (Contents) +[page 280] (Contents) 11 For a and A conversions, if FLT_RADIX is a power of 2, the value is correctly rounded to a hexadecimal floating number with the given precision. @@ -11208,14 +11208,14 @@ s If no l length modifier is present, the argument shall be a pointe in hexadecimal floating style with the given precision, with the extra stipulation that the error should have a correct sign for the current rounding direction. 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most - DECIMAL_DIG, then the result should be correctly rounded.249) If the number of + DECIMAL_DIG, then the result should be correctly rounded.249) If the number of significant decimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the result should be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that the error should have a correct sign for the current rounding direction. - Returns + Returns 14 The fprintf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred. Environmental limits @@ -11230,7 +11230,7 @@ s If no l length modifier is present, the argument shall be a pointe int day, hour, min; fprintf(stdout, "%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min); - fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0)); + fprintf(stdout, "pi = %.5f\n", 4 * atan(1.0)); 17 EXAMPLE 2 In this example, multibyte characters do not have a state-dependent encoding, and the members of the extended character set that consist of more than one byte each consist of exactly two bytes, @@ -11239,11 +11239,11 @@ s If no l length modifier is present, the argument shall be a pointe - 249) For binary-to-decimal conversion, the result format's values are the numbers representable with the + 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. -[page 281] (Contents) +[page 281] (Contents) 18 Given the following wide string with length seven, static wchar_t wstr[] = L" X Yabc Z W"; @@ -11266,11 +11266,11 @@ s If no l length modifier is present, the argument shall be a pointe Forward references: conversion state (7.24.6), the wcrtomb function (7.24.6.3.3). 7.19.6.2 The fscanf function - Synopsis + Synopsis 1 #include <stdio.h> int fscanf(FILE * restrict stream, const char * restrict format, ...); - Description + Description 2 The fscanf function reads input from the stream pointed to by stream, under control of the string pointed to by format that specifies the admissible input sequences and how they are to be converted for assignment, using subsequent arguments as pointers to the @@ -11286,7 +11286,7 @@ s If no l length modifier is present, the argument shall be a pointe -- An optional decimal integer greater than zero that specifies the maximum field width (in characters). -[page 282] (Contents) +[page 282] (Contents) -- An optional length modifier that specifies the size of the receiving object. -- A conversion specifier character that specifies the type of conversion to be applied. @@ -11306,10 +11306,10 @@ s If no l length modifier is present, the argument shall be a pointe described below for each specifier. A conversion specification is executed in the following steps: 8 Input white-space characters (as specified by the isspace function) are skipped, unless - the specification includes a [, c, or n specifier.250) + the specification includes a [, c, or n specifier.250) 9 An input item is read from the stream, unless the specification includes an n specifier. An input item is defined as the longest sequence of input characters which does not exceed - any specified field width and which is, or is a prefix of, a matching input sequence.251) + any specified field width and which is, or is a prefix of, a matching input sequence.251) The first character, if any, after the input item remains unread. If the length of the input item is zero, the execution of the directive fails; this condition is a matching failure unless end-of-file, an encoding error, or a read error prevented input from the stream, in which @@ -11323,11 +11323,11 @@ s If no l length modifier is present, the argument shall be a pointe does not have an appropriate type, or if the result of the conversion cannot be represented - 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. -[page 283] (Contents) +[page 283] (Contents) in the object, the behavior is undefined. 11 The length modifiers and their meanings are: @@ -11365,7 +11365,7 @@ s If no l length modifier is present, the argument shall be a pointe for the subject sequence of the strtol function with the value 0 for the base argument. The corresponding argument shall be a pointer to signed integer. -[page 284] (Contents) +[page 284] (Contents) o Matches an optionally signed octal integer, whose format is the same as expected for the subject sequence of the strtoul function with the value 8 @@ -11383,7 +11383,7 @@ a,e,f,g Matches an optionally signed floating-point number, infinity, or NaN, wh format is the same as expected for the subject sequence of the strtod function. The corresponding argument shall be a pointer to floating. c Matches a sequence of characters of exactly the number specified by the field - width (1 if no field width is present in the directive).252) + width (1 if no field width is present in the directive).252) If no l length modifier is present, the corresponding argument shall be a pointer to the initial element of a character array large enough to accept the sequence. No null character is added. @@ -11402,11 +11402,11 @@ s Matches a sequence of non-white-space characters.252) If an l length modifier is present, the input shall be a sequence of multibyte -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. -[page 285] (Contents) +[page 285] (Contents) characters that begins in the initial shift state. Each multibyte character is converted to a wide character as if by a call to the mbrtowc function, with @@ -11448,7 +11448,7 @@ p Matches an implementation-defined set of sequences, which should be the during the same program execution, the pointer that results shall compare equal to that value; otherwise the behavior of the %p conversion is undefined. -[page 286] (Contents) +[page 286] (Contents) n No input is consumed. The corresponding argument shall be a pointer to signed integer into which is to be written the number of characters read from @@ -11459,13 +11459,13 @@ p Matches an implementation-defined set of sequences, which should be the suppressing character or a field width, the behavior is undefined. % Matches a single % character; no conversion or assignment occurs. The complete conversion specification shall be %%. -13 If a conversion specification is invalid, the behavior is undefined.253) +13 If a conversion specification is invalid, the behavior is undefined.253) 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as, respectively, a, e, f, g, and x. 15 Trailing white space (including new-line characters) is left unread unless matched by a directive. The success of literal matches and suppressed assignments is not directly determinable other than via the %n directive. - Returns + Returns 16 The fscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early @@ -11489,9 +11489,9 @@ p Matches an implementation-defined set of sequences, which should be the - 253) See ''future library directions'' (7.26.9). + 253) See ''future library directions'' (7.26.9). -[page 287] (Contents) +[page 287] (Contents) 56789 0123 56a72 will assign to i the value 56 and to x the value 789.0, will skip 0123, and will assign to name the @@ -11541,7 +11541,7 @@ p Matches an implementation-defined set of sequences, which should be the -[page 288] (Contents) +[page 288] (Contents) #include <stdio.h> /* ... */ @@ -11584,36 +11584,36 @@ p Matches an implementation-defined set of sequences, which should be the -[page 289] (Contents) +[page 289] (Contents) 7.19.6.3 The printf function - Synopsis + Synopsis 1 #include <stdio.h> int printf(const char * restrict format, ...); - Description + Description 2 The printf function is equivalent to fprintf with the argument stdout interposed before the arguments to printf. - Returns + Returns 3 The printf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred. 7.19.6.4 The scanf function - Synopsis + Synopsis 1 #include <stdio.h> int scanf(const char * restrict format, ...); - Description + Description 2 The scanf function is equivalent to fscanf with the argument stdin interposed before the arguments to scanf. - Returns + Returns 3 The scanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the scanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.19.6.5 The snprintf function - Synopsis + Synopsis 1 #include <stdio.h> int snprintf(char * restrict s, size_t n, const char * restrict format, ...); - Description + Description 2 The snprintf function is equivalent to fprintf, except that the output is written into an array (specified by argument s) rather than to a stream. If n is zero, nothing is written, and s may be a null pointer. Otherwise, output characters beyond the n-1st are @@ -11621,37 +11621,37 @@ p Matches an implementation-defined set of sequences, which should be the of the characters actually written into the array. If copying takes place between objects that overlap, the behavior is undefined. -[page 290] (Contents) +[page 290] (Contents) - Returns + Returns 3 The snprintf function returns the number of characters that would have been written had n been sufficiently large, not counting the terminating null character, or a negative value if an encoding error occurred. Thus, the null-terminated output has been completely written if and only if the returned value is nonnegative and less than n. 7.19.6.6 The sprintf function - Synopsis + Synopsis 1 #include <stdio.h> int sprintf(char * restrict s, const char * restrict format, ...); - Description + Description 2 The sprintf function is equivalent to fprintf, except that the output is written into an array (specified by the argument s) rather than to a stream. A null character is written at the end of the characters written; it is not counted as part of the returned value. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The sprintf function returns the number of characters written in the array, not counting the terminating null character, or a negative value if an encoding error occurred. 7.19.6.7 The sscanf function - Synopsis + Synopsis 1 #include <stdio.h> int sscanf(const char * restrict s, const char * restrict format, ...); - Description + Description 2 The sscanf function is equivalent to fscanf, except that input is obtained from a string (specified by the argument s) rather than from a stream. Reaching the end of the string is equivalent to encountering end-of-file for the fscanf function. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The sscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the sscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an @@ -11660,21 +11660,21 @@ p Matches an implementation-defined set of sequences, which should be the -[page 291] (Contents) +[page 291] (Contents) 7.19.6.8 The vfprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vfprintf(FILE * restrict stream, const char * restrict format, va_list arg); - Description + Description 2 The vfprintf function is equivalent to fprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfprintf function does not invoke the - va_end macro.254) - Returns + va_end macro.254) + Returns 3 The vfprintf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred. 4 EXAMPLE The following shows the use of the vfprintf function in a general error-reporting routine. @@ -11694,78 +11694,78 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 292] (Contents) +[page 292] (Contents) 7.19.6.9 The vfscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg); - Description + Description 2 The vfscanf function is equivalent to fscanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfscanf function does not invoke the va_end macro.254) - Returns + Returns 3 The vfscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vfscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.19.6.10 The vprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vprintf(const char * restrict format, va_list arg); - Description + Description 2 The vprintf function is equivalent to printf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vprintf function does not invoke the va_end macro.254) - Returns + Returns 3 The vprintf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred. -[page 293] (Contents) +[page 293] (Contents) 7.19.6.11 The vscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vscanf(const char * restrict format, va_list arg); - Description + Description 2 The vscanf function is equivalent to scanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vscanf function does not invoke the va_end macro.254) - Returns + Returns 3 The vscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.19.6.12 The vsnprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vsnprintf(char * restrict s, size_t n, const char * restrict format, va_list arg); - Description + Description 2 The vsnprintf function is equivalent to snprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vsnprintf function does not invoke the va_end macro.254) If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The vsnprintf function returns the number of characters that would have been written had n been sufficiently large, not counting the terminating null character, or a negative value if an encoding error occurred. Thus, the null-terminated output has been @@ -11774,37 +11774,37 @@ p Matches an implementation-defined set of sequences, which should be the -[page 294] (Contents) +[page 294] (Contents) 7.19.6.13 The vsprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vsprintf(char * restrict s, const char * restrict format, va_list arg); - Description + Description 2 The vsprintf function is equivalent to sprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vsprintf function does not invoke the va_end macro.254) If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The vsprintf function returns the number of characters written in the array, not counting the terminating null character, or a negative value if an encoding error occurred. 7.19.6.14 The vsscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> int vsscanf(const char * restrict s, const char * restrict format, va_list arg); - Description + Description 2 The vsscanf function is equivalent to sscanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vsscanf function does not invoke the va_end macro.254) - Returns + Returns 3 The vsscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vsscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an @@ -11813,35 +11813,35 @@ p Matches an implementation-defined set of sequences, which should be the -[page 295] (Contents) +[page 295] (Contents) 7.19.7 Character input/output functions 7.19.7.1 The fgetc function - Synopsis + Synopsis 1 #include <stdio.h> int fgetc(FILE *stream); - Description + Description 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a next character is present, the fgetc function obtains that character as an unsigned char converted to an int and advances the associated file position indicator for the stream (if defined). - Returns + Returns 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end- of-file indicator for the stream is set and the fgetc function returns EOF. Otherwise, the fgetc function returns the next character from the input stream pointed to by stream. If a read error occurs, the error indicator for the stream is set and the fgetc function - returns EOF.255) + returns EOF.255) 7.19.7.2 The fgets function - Synopsis + Synopsis 1 #include <stdio.h> char *fgets(char * restrict s, int n, FILE * restrict stream); - Description + Description 2 The fgets function reads at most one less than the number of characters specified by n from the stream pointed to by stream into the array pointed to by s. No additional characters are read after a new-line character (which is retained) or after end-of-file. A null character is written immediately after the last character read into the array. - Returns + Returns 3 The fgets function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read error occurs during the operation, the array contents are @@ -11850,39 +11850,39 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 296] (Contents) +[page 296] (Contents) 7.19.7.3 The fputc function - Synopsis + Synopsis 1 #include <stdio.h> int fputc(int c, FILE *stream); - Description + Description 2 The fputc function writes the character specified by c (converted to an unsigned char) to the output stream pointed to by stream, at the position indicated by the associated file position indicator for the stream (if defined), and advances the indicator appropriately. If the file cannot support positioning requests, or if the stream was opened with append mode, the character is appended to the output stream. - Returns + Returns 3 The fputc function returns the character written. If a write error occurs, the error indicator for the stream is set and fputc returns EOF. 7.19.7.4 The fputs function - Synopsis + Synopsis 1 #include <stdio.h> int fputs(const char * restrict s, FILE * restrict stream); - Description + Description 2 The fputs function writes the string pointed to by s to the stream pointed to by stream. The terminating null character is not written. - Returns + Returns 3 The fputs function returns EOF if a write error occurs; otherwise it returns a nonnegative value. 7.19.7.5 The getc function - Synopsis + Synopsis 1 #include <stdio.h> int getc(FILE *stream); - Description + Description 2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it may evaluate stream more than once, so the argument should never be an expression with side effects. @@ -11890,34 +11890,34 @@ p Matches an implementation-defined set of sequences, which should be the -[page 297] (Contents) +[page 297] (Contents) - Returns + Returns 3 The getc function returns the next character from the input stream pointed to by stream. If the stream is at end-of-file, the end-of-file indicator for the stream is set and getc returns EOF. If a read error occurs, the error indicator for the stream is set and getc returns EOF. 7.19.7.6 The getchar function - Synopsis + Synopsis 1 #include <stdio.h> int getchar(void); - Description + Description 2 The getchar function is equivalent to getc with the argument stdin. - Returns + Returns 3 The getchar function returns the next character from the input stream pointed to by stdin. If the stream is at end-of-file, the end-of-file indicator for the stream is set and getchar returns EOF. If a read error occurs, the error indicator for the stream is set and getchar returns EOF. 7.19.7.7 The gets function - Synopsis + Synopsis 1 #include <stdio.h> char *gets(char *s); - Description + Description 2 The gets function reads characters from the input stream pointed to by stdin, into the array pointed to by s, until end-of-file is encountered or a new-line character is read. Any new-line character is discarded, and a null character is written immediately after the last character read into the array. - Returns + Returns 3 The gets function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read error occurs during the operation, the array contents are @@ -11927,50 +11927,50 @@ p Matches an implementation-defined set of sequences, which should be the -[page 298] (Contents) +[page 298] (Contents) 7.19.7.8 The putc function - Synopsis + Synopsis 1 #include <stdio.h> int putc(int c, FILE *stream); - Description + Description 2 The putc function is equivalent to fputc, except that if it is implemented as a macro, it may evaluate stream more than once, so that argument should never be an expression with side effects. - Returns + Returns 3 The putc function returns the character written. If a write error occurs, the error indicator for the stream is set and putc returns EOF. 7.19.7.9 The putchar function - Synopsis + Synopsis 1 #include <stdio.h> int putchar(int c); - Description + Description 2 The putchar function is equivalent to putc with the second argument stdout. - Returns + Returns 3 The putchar function returns the character written. If a write error occurs, the error indicator for the stream is set and putchar returns EOF. 7.19.7.10 The puts function - Synopsis + Synopsis 1 #include <stdio.h> int puts(const char *s); - Description + Description 2 The puts function writes the string pointed to by s to the stream pointed to by stdout, and appends a new-line character to the output. The terminating null character is not written. - Returns + Returns 3 The puts function returns EOF if a write error occurs; otherwise it returns a nonnegative value. -[page 299] (Contents) +[page 299] (Contents) 7.19.7.11 The ungetc function - Synopsis + Synopsis 1 #include <stdio.h> int ungetc(int c, FILE *stream); - Description + Description 2 The ungetc function pushes the character specified by c (converted to an unsigned char) back onto the input stream pointed to by stream. Pushed-back characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A @@ -11989,8 +11989,8 @@ p Matches an implementation-defined set of sequences, which should be the ungetc function is unspecified until all pushed-back characters are read or discarded. For a binary stream, its file position indicator is decremented by each successful call to the ungetc function; if its value was zero before a call, it is indeterminate after the - call.256) - Returns + call.256) + Returns 6 The ungetc function returns the character pushed back after conversion, or EOF if the operation fails. Forward references: file positioning functions (7.19.9). @@ -11998,18 +11998,18 @@ p Matches an implementation-defined set of sequences, which should be the - 256) See ''future library directions'' (7.26.9). + 256) See ''future library directions'' (7.26.9). -[page 300] (Contents) +[page 300] (Contents) 7.19.8 Direct input/output functions 7.19.8.1 The fread function - Synopsis + Synopsis 1 #include <stdio.h> size_t fread(void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream); - Description + Description 2 The fread function reads, into the array pointed to by ptr, up to nmemb elements whose size is specified by size, from the stream pointed to by stream. For each object, size calls are made to the fgetc function and the results stored, in the order @@ -12017,18 +12017,18 @@ p Matches an implementation-defined set of sequences, which should be the indicator for the stream (if defined) is advanced by the number of characters successfully read. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. If a partial element is read, its value is indeterminate. - Returns + Returns 3 The fread function returns the number of elements successfully read, which may be less than nmemb if a read error or end-of-file is encountered. If size or nmemb is zero, fread returns zero and the contents of the array and the state of the stream remain unchanged. 7.19.8.2 The fwrite function - Synopsis + Synopsis 1 #include <stdio.h> size_t fwrite(const void * restrict ptr, size_t size, size_t nmemb, FILE * restrict stream); - Description + Description 2 The fwrite function writes, from the array pointed to by ptr, up to nmemb elements whose size is specified by size, to the stream pointed to by stream. For each object, size calls are made to the fputc function, taking the values (in order) from an array of @@ -12040,32 +12040,32 @@ p Matches an implementation-defined set of sequences, which should be the -[page 301] (Contents) +[page 301] (Contents) - Returns + Returns 3 The fwrite function returns the number of elements successfully written, which will be less than nmemb only if a write error is encountered. If size or nmemb is zero, fwrite returns zero and the state of the stream remains unchanged. 7.19.9 File positioning functions 7.19.9.1 The fgetpos function - Synopsis + Synopsis 1 #include <stdio.h> int fgetpos(FILE * restrict stream, fpos_t * restrict pos); - Description + Description 2 The fgetpos function stores the current values of the parse state (if any) and file position indicator for the stream pointed to by stream in the object pointed to by pos. The values stored contain unspecified information usable by the fsetpos function for repositioning the stream to its position at the time of the call to the fgetpos function. - Returns + Returns 3 If successful, the fgetpos function returns zero; on failure, the fgetpos function returns nonzero and stores an implementation-defined positive value in errno. Forward references: the fsetpos function (7.19.9.3). 7.19.9.2 The fseek function - Synopsis + Synopsis 1 #include <stdio.h> int fseek(FILE *stream, long int offset, int whence); - Description + Description 2 The fseek function sets the file position indicator for the stream pointed to by stream. If a read or write error occurs, the error indicator for the stream is set and fseek fails. 3 For a binary stream, the new position, measured in characters from the beginning of the @@ -12077,20 +12077,20 @@ p Matches an implementation-defined set of sequences, which should be the an earlier successful call to the ftell function on a stream associated with the same file and whence shall be SEEK_SET. -[page 302] (Contents) +[page 302] (Contents) 5 After determining the new position, a successful call to the fseek function undoes any effects of the ungetc function on the stream, clears the end-of-file indicator for the stream, and then establishes the new position. After a successful fseek call, the next operation on an update stream may be either input or output. - Returns + Returns 6 The fseek function returns nonzero only for a request that cannot be satisfied. Forward references: the ftell function (7.19.9.4). 7.19.9.3 The fsetpos function - Synopsis + Synopsis 1 #include <stdio.h> int fsetpos(FILE *stream, const fpos_t *pos); - Description + Description 2 The fsetpos function sets the mbstate_t object (if any) and file position indicator for the stream pointed to by stream according to the value of the object pointed to by pos, which shall be a value obtained from an earlier successful call to the fgetpos @@ -12100,14 +12100,14 @@ p Matches an implementation-defined set of sequences, which should be the on the stream, clears the end-of-file indicator for the stream, and then establishes the new parse state and position. After a successful fsetpos call, the next operation on an update stream may be either input or output. - Returns + Returns 4 If successful, the fsetpos function returns zero; on failure, the fsetpos function returns nonzero and stores an implementation-defined positive value in errno. 7.19.9.4 The ftell function - Synopsis + Synopsis 1 #include <stdio.h> long int ftell(FILE *stream); - Description + Description 2 The ftell function obtains the current value of the file position indicator for the stream pointed to by stream. For a binary stream, the value is the number of characters from the beginning of the file. For a text stream, its file position indicator contains unspecified @@ -12115,79 +12115,79 @@ p Matches an implementation-defined set of sequences, which should be the stream to its position at the time of the ftell call; the difference between two such return values is not necessarily a meaningful measure of the number of characters written -[page 303] (Contents) +[page 303] (Contents) or read. - Returns + Returns 3 If successful, the ftell function returns the current value of the file position indicator for the stream. On failure, the ftell function returns -1L and stores an implementation-defined positive value in errno. 7.19.9.5 The rewind function - Synopsis + Synopsis 1 #include <stdio.h> void rewind(FILE *stream); - Description + Description 2 The rewind function sets the file position indicator for the stream pointed to by stream to the beginning of the file. It is equivalent to (void)fseek(stream, 0L, SEEK_SET) except that the error indicator for the stream is also cleared. - Returns + Returns 3 The rewind function returns no value. 7.19.10 Error-handling functions 7.19.10.1 The clearerr function - Synopsis + Synopsis 1 #include <stdio.h> void clearerr(FILE *stream); - Description + Description 2 The clearerr function clears the end-of-file and error indicators for the stream pointed to by stream. - Returns + Returns 3 The clearerr function returns no value. -[page 304] (Contents) +[page 304] (Contents) 7.19.10.2 The feof function - Synopsis + Synopsis 1 #include <stdio.h> int feof(FILE *stream); - Description + Description 2 The feof function tests the end-of-file indicator for the stream pointed to by stream. - Returns + Returns 3 The feof function returns nonzero if and only if the end-of-file indicator is set for stream. 7.19.10.3 The ferror function - Synopsis + Synopsis 1 #include <stdio.h> int ferror(FILE *stream); - Description + Description 2 The ferror function tests the error indicator for the stream pointed to by stream. - Returns + Returns 3 The ferror function returns nonzero if and only if the error indicator is set for stream. 7.19.10.4 The perror function - Synopsis + Synopsis 1 #include <stdio.h> void perror(const char *s); - Description + Description 2 The perror function maps the error number in the integer expression errno to an error message. It writes a sequence of characters to the standard error stream thus: first (if s is not a null pointer and the character pointed to by s is not the null character), the string pointed to by s followed by a colon (:) and a space; then an appropriate error message string followed by a new-line character. The contents of the error message strings are the same as those returned by the strerror function with argument errno. - Returns + Returns 3 The perror function returns no value. Forward references: the strerror function (7.21.6.2). -[page 305] (Contents) +[page 305] (Contents) 7.20 General utilities <stdlib.h> 1 The header <stdlib.h> declares five types and several functions of general utility, and - defines several macros.257) + defines several macros.257) 2 The types declared are size_t and wchar_t (both described in 7.17), div_t which is a structure type that is the type of the value returned by the div function, @@ -12213,49 +12213,49 @@ p Matches an implementation-defined set of sequences, which should be the - 257) See ''future library directions'' (7.26.10). + 257) See ''future library directions'' (7.26.10). -[page 306] (Contents) +[page 306] (Contents) 7.20.1 Numeric conversion functions 1 The functions atof, atoi, atol, and atoll need not affect the value of the integer expression errno on an error. If the value of the result cannot be represented, the behavior is undefined. 7.20.1.1 The atof function - Synopsis + Synopsis 1 #include <stdlib.h> double atof(const char *nptr); - Description + Description 2 The atof function converts the initial portion of the string pointed to by nptr to double representation. Except for the behavior on error, it is equivalent to strtod(nptr, (char **)NULL) - Returns + Returns 3 The atof function returns the converted value. Forward references: the strtod, strtof, and strtold functions (7.20.1.3). 7.20.1.2 The atoi, atol, and atoll functions - Synopsis + Synopsis 1 #include <stdlib.h> int atoi(const char *nptr); long int atol(const char *nptr); long long int atoll(const char *nptr); - Description + Description 2 The atoi, atol, and atoll functions convert the initial portion of the string pointed to by nptr to int, long int, and long long int representation, respectively. Except for the behavior on error, they are equivalent to atoi: (int)strtol(nptr, (char **)NULL, 10) atol: strtol(nptr, (char **)NULL, 10) atoll: strtoll(nptr, (char **)NULL, 10) - Returns + Returns 3 The atoi, atol, and atoll functions return the converted value. Forward references: the strtol, strtoll, strtoul, and strtoull functions (7.20.1.4). -[page 307] (Contents) +[page 307] (Contents) 7.20.1.3 The strtod, strtof, and strtold functions - Synopsis + Synopsis 1 #include <stdlib.h> double strtod(const char * restrict nptr, char ** restrict endptr); @@ -12263,7 +12263,7 @@ p Matches an implementation-defined set of sequences, which should be the char ** restrict endptr); long double strtold(const char * restrict nptr, char ** restrict endptr); - Description + Description 2 The strtod, strtof, and strtold functions convert the initial portion of the string pointed to by nptr to double, float, and long double representation, respectively. First, they decompose the input string into three parts: an initial, possibly @@ -12291,18 +12291,18 @@ p Matches an implementation-defined set of sequences, which should be the 4 If the subject sequence has the expected form for a floating-point number, the sequence of characters starting with the first digit or the decimal-point character (whichever occurs first) is interpreted as a floating constant according to the rules of 6.4.4.2, except that the -[page 308] (Contents) +[page 308] (Contents) decimal-point character is used in place of a period, and that if neither an exponent part nor a decimal-point character appears in a decimal floating point number, or if a binary exponent part does not appear in a hexadecimal floating point number, an exponent part of the appropriate type with value zero is assumed to follow the last digit in the string. If - the subject sequence begins with a minus sign, the sequence is interpreted as negated.258) + the subject sequence begins with a minus sign, the sequence is interpreted as negated.258) A character sequence INF or INFINITY is interpreted as an infinity, if representable in the return type, else like a floating constant that is too large for the range of the return type. A character sequence NAN or NAN(n-char-sequenceopt), is interpreted as a quiet NaN, if supported in the return type, else like a subject sequence part that does not have - the expected form; the meaning of the n-char sequences is implementation-defined.259) A + the expected form; the meaning of the n-char sequences is implementation-defined.259) A pointer to the final string is stored in the object pointed to by endptr, provided that endptr is not a null pointer. 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the @@ -12326,18 +12326,18 @@ p Matches an implementation-defined set of sequences, which should be the The result should be one of the (equal or adjacent) values that would be obtained by correctly rounding L and U according to the current rounding direction, with the extra - 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. -[page 309] (Contents) +[page 309] (Contents) stipulation that the error with respect to D should have a correct sign for the current - rounding direction.260) - Returns + rounding direction.260) + Returns 10 The functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return @@ -12346,7 +12346,7 @@ p Matches an implementation-defined set of sequences, which should be the than the smallest normalized positive number in the return type; whether errno acquires the value ERANGE is implementation-defined. 7.20.1.4 The strtol, strtoll, strtoul, and strtoull functions - Synopsis + Synopsis 1 #include <stdlib.h> long int strtol( const char * restrict nptr, @@ -12364,7 +12364,7 @@ p Matches an implementation-defined set of sequences, which should be the const char * restrict nptr, char ** restrict endptr, int base); - Description + Description 2 The strtol, strtoll, strtoul, and strtoull functions convert the initial portion of the string pointed to by nptr to long int, long long int, unsigned long int, and unsigned long long int representation, respectively. First, @@ -12372,10 +12372,10 @@ p Matches an implementation-defined set of sequences, which should be the white-space characters (as specified by the isspace function), a subject sequence - 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. -[page 310] (Contents) +[page 310] (Contents) resembling an integer represented in some radix determined by the value of base, and a final string of one or more unrecognized characters, including the terminating null @@ -12407,7 +12407,7 @@ p Matches an implementation-defined set of sequences, which should be the 7 If the subject sequence is empty or does not have the expected form, no conversion is performed; the value of nptr is stored in the object pointed to by endptr, provided that endptr is not a null pointer. - Returns + Returns 8 The strtol, strtoll, strtoul, and strtoull functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN, @@ -12417,33 +12417,33 @@ p Matches an implementation-defined set of sequences, which should be the -[page 311] (Contents) +[page 311] (Contents) 7.20.2 Pseudo-random sequence generation functions 7.20.2.1 The rand function - Synopsis + Synopsis 1 #include <stdlib.h> int rand(void); - Description + Description 2 The rand function computes a sequence of pseudo-random integers in the range 0 to RAND_MAX. 3 The implementation shall behave as if no library function calls the rand function. - Returns + Returns 4 The rand function returns a pseudo-random integer. Environmental limits 5 The value of the RAND_MAX macro shall be at least 32767. 7.20.2.2 The srand function - Synopsis + Synopsis 1 #include <stdlib.h> void srand(unsigned int seed); - Description + Description 2 The srand function uses the argument as a seed for a new sequence of pseudo-random numbers to be returned by subsequent calls to rand. If srand is then called with the same seed value, the sequence of pseudo-random numbers shall be repeated. If rand is called before any calls to srand have been made, the same sequence shall be generated as when srand is first called with a seed value of 1. 3 The implementation shall behave as if no library function calls the srand function. - Returns + Returns 4 The srand function returns no value. 5 EXAMPLE The following functions define a portable implementation of rand and srand. static unsigned long int next = 1; @@ -12455,7 +12455,7 @@ p Matches an implementation-defined set of sequences, which should be the -[page 312] (Contents) +[page 312] (Contents) void srand(unsigned int seed) { @@ -12475,47 +12475,47 @@ p Matches an implementation-defined set of sequences, which should be the defined: either a null pointer is returned, or the behavior is as if the size were some nonzero value, except that the returned pointer shall not be used to access an object. 7.20.3.1 The calloc function - Synopsis + Synopsis 1 #include <stdlib.h> void *calloc(size_t nmemb, size_t size); - Description + Description 2 The calloc function allocates space for an array of nmemb objects, each of whose size - is size. The space is initialized to all bits zero.261) - Returns + is size. The space is initialized to all bits zero.261) + Returns 3 The calloc function returns either a null pointer or a pointer to the allocated space. 7.20.3.2 The free function - Synopsis + Synopsis 1 #include <stdlib.h> void free(void *ptr); - Description + Description 2 The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs. Otherwise, if the argument does not match a pointer earlier returned by the calloc, malloc, or - 261) Note that this need not be the same as the representation of floating-point zero or a null pointer + 261) Note that this need not be the same as the representation of floating-point zero or a null pointer constant. -[page 313] (Contents) +[page 313] (Contents) realloc function, or if the space has been deallocated by a call to free or realloc, the behavior is undefined. - Returns + Returns 3 The free function returns no value. 7.20.3.3 The malloc function - Synopsis + Synopsis 1 #include <stdlib.h> void *malloc(size_t size); - Description + Description 2 The malloc function allocates space for an object whose size is specified by size and whose value is indeterminate. - Returns + Returns 3 The malloc function returns either a null pointer or a pointer to the allocated space. 7.20.3.4 The realloc function - Synopsis + Synopsis 1 #include <stdlib.h> void *realloc(void *ptr, size_t size); - Description + Description 2 The realloc function deallocates the old object pointed to by ptr and returns a pointer to a new object that has the size specified by size. The contents of the new object shall be the same as that of the old object prior to deallocation, up to the lesser of @@ -12526,7 +12526,7 @@ p Matches an implementation-defined set of sequences, which should be the calloc, malloc, or realloc function, or if the space has been deallocated by a call to the free or realloc function, the behavior is undefined. If memory for the new object cannot be allocated, the old object is not deallocated and its value is unchanged. - Returns + Returns 4 The realloc function returns a pointer to the new object (which may have the same value as a pointer to the old object), or a null pointer if the new object could not be allocated. @@ -12534,45 +12534,45 @@ p Matches an implementation-defined set of sequences, which should be the -[page 314] (Contents) +[page 314] (Contents) 7.20.4 Communication with the environment 7.20.4.1 The abort function - Synopsis + Synopsis 1 #include <stdlib.h> void abort(void); - Description + Description 2 The abort function causes abnormal program termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return. Whether open streams with unwritten buffered data are flushed, open streams are closed, or temporary files are removed is implementation-defined. An implementation-defined form of the status unsuccessful termination is returned to the host environment by means of the function call raise(SIGABRT). - Returns + Returns 3 The abort function does not return to its caller. 7.20.4.2 The atexit function - Synopsis + Synopsis 1 #include <stdlib.h> int atexit(void (*func)(void)); - Description + Description 2 The atexit function registers the function pointed to by func, to be called without arguments at normal program termination. Environmental limits 3 The implementation shall support the registration of at least 32 functions. - Returns + Returns 4 The atexit function returns zero if the registration succeeds, nonzero if it fails. Forward references: the exit function (7.20.4.3). 7.20.4.3 The exit function - Synopsis + Synopsis 1 #include <stdlib.h> void exit(int status); - Description + Description 2 The exit function causes normal program termination to occur. If more than one call to the exit function is executed by a program, the behavior is undefined. -[page 315] (Contents) +[page 315] (Contents) 3 First, all functions registered by the atexit function are called, in the reverse order of - their registration,262) except that a function is called after any previously registered + their registration,262) except that a function is called after any previously registered functions that had already been called at the time it was registered. If, during the call to any such function, a call to the longjmp function is made that would terminate the call to the registered function, the behavior is undefined. @@ -12583,55 +12583,55 @@ p Matches an implementation-defined set of sequences, which should be the returned. If the value of status is EXIT_FAILURE, an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined. - Returns + Returns 6 The exit function cannot return to its caller. 7.20.4.4 The _Exit function - Synopsis + Synopsis 1 #include <stdlib.h> void _Exit(int status); - Description + Description 2 The _Exit function causes normal program termination to occur and control to be returned to the host environment. No functions registered by the atexit function or signal handlers registered by the signal function are called. The status returned to the host environment is determined in the same way as for the exit function (7.20.4.3). Whether open streams with unwritten buffered data are flushed, open streams are closed, or temporary files are removed is implementation-defined. - Returns + Returns 3 The _Exit function cannot return to its caller. - 262) Each function is called as many times as it was registered, and in the correct order with respect to + 262) Each function is called as many times as it was registered, and in the correct order with respect to other registered functions. -[page 316] (Contents) +[page 316] (Contents) 7.20.4.5 The getenv function - Synopsis + Synopsis 1 #include <stdlib.h> char *getenv(const char *name); - Description + Description 2 The getenv function searches an environment list, provided by the host environment, for a string that matches the string pointed to by name. The set of environment names and the method for altering the environment list are implementation-defined. 3 The implementation shall behave as if no library function calls the getenv function. - Returns + Returns 4 The getenv function returns a pointer to a string associated with the matched list member. The string pointed to shall not be modified by the program, but may be overwritten by a subsequent call to the getenv function. If the specified name cannot be found, a null pointer is returned. 7.20.4.6 The system function - Synopsis + Synopsis 1 #include <stdlib.h> int system(const char *string); - Description + Description 2 If string is a null pointer, the system function determines whether the host environment has a command processor. If string is not a null pointer, the system function passes the string pointed to by string to that command processor to be executed in a manner which the implementation shall document; this might then cause the program calling system to behave in a non-conforming manner or to terminate. - Returns + Returns 3 If the argument is a null pointer, the system function returns nonzero only if a command processor is available. If the argument is not a null pointer, and the system function does return, it returns an implementation-defined value. @@ -12639,7 +12639,7 @@ p Matches an implementation-defined set of sequences, which should be the -[page 317] (Contents) +[page 317] (Contents) 7.20.5 Searching and sorting utilities 1 These utilities make use of a comparison function to search or sort arrays of unspecified @@ -12650,7 +12650,7 @@ p Matches an implementation-defined set of sequences, which should be the in 7.1.4. 2 The implementation shall ensure that the second argument of the comparison function (when called from bsearch), or both arguments (when called from qsort), are - pointers to elements of the array.263) The first argument when called from bsearch + pointers to elements of the array.263) The first argument when called from bsearch shall equal key. 3 The comparison function shall not alter the contents of the array. The implementation may reorder elements of the array between calls to the comparison function, but shall not @@ -12664,23 +12664,23 @@ p Matches an implementation-defined set of sequences, which should be the comparison function, and also between any call to the comparison function and any movement of the objects passed as arguments to that call. 7.20.5.1 The bsearch function - Synopsis + Synopsis 1 #include <stdlib.h> void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); - Description + Description 2 The bsearch function searches an array of nmemb objects, the initial element of which is pointed to by base, for an element that matches the object pointed to by key. The - 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 -[page 318] (Contents) +[page 318] (Contents) size of each element of the array is specified by size. 3 The comparison function pointed to by compar is called with two arguments that point @@ -12688,17 +12688,17 @@ p Matches an implementation-defined set of sequences, which should be the integer less than, equal to, or greater than zero if the key object is considered, respectively, to be less than, to match, or to be greater than the array element. The array shall consist of: all the elements that compare less than, all the elements that compare - equal to, and all the elements that compare greater than the key object, in that order.264) - Returns + equal to, and all the elements that compare greater than the key object, in that order.264) + Returns 4 The bsearch function returns a pointer to a matching element of the array, or a null pointer if no match is found. If two elements compare as equal, which element is matched is unspecified. 7.20.5.2 The qsort function - Synopsis + Synopsis 1 #include <stdlib.h> void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); - Description + Description 2 The qsort function sorts an array of nmemb objects, the initial element of which is pointed to by base. The size of each object is specified by size. 3 The contents of the array are sorted into ascending order according to a comparison @@ -12707,38 +12707,38 @@ p Matches an implementation-defined set of sequences, which should be the greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second. 4 If two elements compare as equal, their order in the resulting sorted array is unspecified. - Returns + Returns 5 The qsort function returns no value. - 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. -[page 319] (Contents) +[page 319] (Contents) 7.20.6 Integer arithmetic functions 7.20.6.1 The abs, labs and llabs functions - Synopsis + Synopsis 1 #include <stdlib.h> int abs(int j); long int labs(long int j); long long int llabs(long long int j); - Description + Description 2 The abs, labs, and llabs functions compute the absolute value of an integer j. If the - result cannot be represented, the behavior is undefined.265) - Returns + result cannot be represented, the behavior is undefined.265) + Returns 3 The abs, labs, and llabs, functions return the absolute value. 7.20.6.2 The div, ldiv, and lldiv functions - Synopsis + Synopsis 1 #include <stdlib.h> div_t div(int numer, int denom); ldiv_t ldiv(long int numer, long int denom); lldiv_t lldiv(long long int numer, long long int denom); - Description + Description 2 The div, ldiv, and lldiv, functions compute numer / denom and numer % denom in a single operation. - Returns + Returns 3 The div, ldiv, and lldiv functions return a structure of type div_t, ldiv_t, and lldiv_t, respectively, comprising both the quotient and the remainder. The structures shall contain (in either order) the members quot (the quotient) and rem (the remainder), @@ -12748,9 +12748,9 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 320] (Contents) +[page 320] (Contents) 7.20.7 Multibyte/wide character conversion functions 1 The behavior of the multibyte character functions is affected by the LC_CTYPE category @@ -12759,19 +12759,19 @@ p Matches an implementation-defined set of sequences, which should be the pointer. Subsequent calls with s as other than a null pointer cause the internal conversion state of the function to be altered as necessary. A call with s as a null pointer causes these functions to return a nonzero value if encodings have state dependency, and zero - otherwise.266) Changing the LC_CTYPE category causes the conversion state of these + otherwise.266) Changing the LC_CTYPE category causes the conversion state of these functions to be indeterminate. 7.20.7.1 The mblen function - Synopsis + Synopsis 1 #include <stdlib.h> int mblen(const char *s, size_t n); - Description + Description 2 If s is not a null pointer, the mblen function determines the number of bytes contained in the multibyte character pointed to by s. Except that the conversion state of the mbtowc function is not affected, it is equivalent to mbtowc((wchar_t *)0, s, n); 3 The implementation shall behave as if no library function calls the mblen function. - Returns + Returns 4 If s is a null pointer, the mblen function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the mblen function either returns 0 (if s points to the null character), @@ -12783,18 +12783,18 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 321] (Contents) +[page 321] (Contents) 7.20.7.2 The mbtowc function - Synopsis + Synopsis 1 #include <stdlib.h> int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n); - Description + Description 2 If s is not a null pointer, the mbtowc function inspects at most n bytes beginning with the byte pointed to by s to determine the number of bytes needed to complete the next multibyte character (including any shift sequences). If the function determines that the @@ -12803,7 +12803,7 @@ p Matches an implementation-defined set of sequences, which should be the the object pointed to by pwc. If the corresponding wide character is the null wide character, the function is left in the initial conversion state. 3 The implementation shall behave as if no library function calls the mbtowc function. - Returns + Returns 4 If s is a null pointer, the mbtowc function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the mbtowc function either returns 0 (if s points to the null character), @@ -12813,10 +12813,10 @@ p Matches an implementation-defined set of sequences, which should be the 5 In no case will the value returned be greater than n or the value of the MB_CUR_MAX macro. 7.20.7.3 The wctomb function - Synopsis + Synopsis 1 #include <stdlib.h> int wctomb(char *s, wchar_t wc); - Description + Description 2 The wctomb function determines the number of bytes needed to represent the multibyte character corresponding to the wide character given by wc (including any shift sequences), and stores the multibyte character representation in the array whose first @@ -12825,10 +12825,10 @@ p Matches an implementation-defined set of sequences, which should be the sequence needed to restore the initial shift state, and the function is left in the initial conversion state. -[page 322] (Contents) +[page 322] (Contents) 3 The implementation shall behave as if no library function calls the wctomb function. - Returns + Returns 4 If s is a null pointer, the wctomb function returns a nonzero or zero value, if multibyte character encodings, respectively, do or do not have state-dependent encodings. If s is not a null pointer, the wctomb function returns -1 if the value of wc does not correspond @@ -12839,12 +12839,12 @@ p Matches an implementation-defined set of sequences, which should be the 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of the current locale. 7.20.8.1 The mbstowcs function - Synopsis + Synopsis 1 #include <stdlib.h> size_t mbstowcs(wchar_t * restrict pwcs, const char * restrict s, size_t n); - Description + Description 2 The mbstowcs function converts a sequence of multibyte characters that begins in the initial shift state from the array pointed to by s into a sequence of corresponding wide characters and stores not more than n wide characters into the array pointed to by pwcs. @@ -12854,25 +12854,25 @@ p Matches an implementation-defined set of sequences, which should be the not affected. 3 No more than n elements will be modified in the array pointed to by pwcs. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 4 If an invalid multibyte character is encountered, the mbstowcs function returns (size_t)(-1). Otherwise, the mbstowcs function returns the number of array - elements modified, not including a terminating null wide character, if any.267) + elements modified, not including a terminating null wide character, if any.267) - 267) The array will not be null-terminated if the value returned is n. + 267) The array will not be null-terminated if the value returned is n. -[page 323] (Contents) +[page 323] (Contents) 7.20.8.2 The wcstombs function - Synopsis + Synopsis 1 #include <stdlib.h> size_t wcstombs(char * restrict s, const wchar_t * restrict pwcs, size_t n); - Description + Description 2 The wcstombs function converts a sequence of wide characters from the array pointed to by pwcs into a sequence of corresponding multibyte characters that begins in the initial shift state, and stores these multibyte characters into the array pointed to by s, @@ -12881,7 +12881,7 @@ p Matches an implementation-defined set of sequences, which should be the function, except that the conversion state of the wctomb function is not affected. 3 No more than n bytes will be modified in the array pointed to by s. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 4 If a wide character is encountered that does not correspond to a valid multibyte character, the wcstombs function returns (size_t)(-1). Otherwise, the wcstombs function returns the number of bytes modified, not including a terminating null character, if @@ -12890,13 +12890,13 @@ p Matches an implementation-defined set of sequences, which should be the -[page 324] (Contents) +[page 324] (Contents) 7.21 String handling <string.h> 7.21.1 String function conventions 1 The header <string.h> declares one type and several functions, and defines one macro useful for manipulating arrays of character type and other objects treated as arrays - of character type.268) The type is size_t and the macro is NULL (both described in + of character type.268) The type is size_t and the macro is NULL (both described in 7.17). Various methods are used for determining the lengths of the arrays, but in all cases a char * or void * argument points to the initial (lowest addressed) character of the array. If an array is accessed beyond the end of an object, the behavior is undefined. @@ -12912,103 +12912,103 @@ p Matches an implementation-defined set of sequences, which should be the different value). 7.21.2 Copying functions 7.21.2.1 The memcpy function - Synopsis + Synopsis 1 #include <string.h> void *memcpy(void * restrict s1, const void * restrict s2, size_t n); - Description + Description 2 The memcpy function copies n characters from the object pointed to by s2 into the object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The memcpy function returns the value of s1. - 268) See ''future library directions'' (7.26.11). + 268) See ''future library directions'' (7.26.11). -[page 325] (Contents) +[page 325] (Contents) 7.21.2.2 The memmove function - Synopsis + Synopsis 1 #include <string.h> void *memmove(void *s1, const void *s2, size_t n); - Description + Description 2 The memmove function copies n characters from the object pointed to by s2 into the object pointed to by s1. Copying takes place as if the n characters from the object pointed to by s2 are first copied into a temporary array of n characters that does not overlap the objects pointed to by s1 and s2, and then the n characters from the temporary array are copied into the object pointed to by s1. - Returns + Returns 3 The memmove function returns the value of s1. 7.21.2.3 The strcpy function - Synopsis + Synopsis 1 #include <string.h> char *strcpy(char * restrict s1, const char * restrict s2); - Description + Description 2 The strcpy function copies the string pointed to by s2 (including the terminating null character) into the array pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The strcpy function returns the value of s1. 7.21.2.4 The strncpy function - Synopsis + Synopsis 1 #include <string.h> char *strncpy(char * restrict s1, const char * restrict s2, size_t n); - Description + Description 2 The strncpy function copies not more than n characters (characters that follow a null character are not copied) from the array pointed to by s2 to the array pointed to by -[page 326] (Contents) +[page 326] (Contents) - s1.269) If copying takes place between objects that overlap, the behavior is undefined. + s1.269) If copying takes place between objects that overlap, the behavior is undefined. 3 If the array pointed to by s2 is a string that is shorter than n characters, null characters are appended to the copy in the array pointed to by s1, until n characters in all have been written. - Returns + Returns 4 The strncpy function returns the value of s1. 7.21.3 Concatenation functions 7.21.3.1 The strcat function - Synopsis + Synopsis 1 #include <string.h> char *strcat(char * restrict s1, const char * restrict s2); - Description + Description 2 The strcat function appends a copy of the string pointed to by s2 (including the terminating null character) to the end of the string pointed to by s1. The initial character of s2 overwrites the null character at the end of s1. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The strcat function returns the value of s1. 7.21.3.2 The strncat function - Synopsis + Synopsis 1 #include <string.h> char *strncat(char * restrict s1, const char * restrict s2, size_t n); - Description + Description 2 The strncat function appends not more than n characters (a null character and characters that follow it are not appended) from the array pointed to by s2 to the end of the string pointed to by s1. The initial character of s2 overwrites the null character at the - end of s1. A terminating null character is always appended to the result.270) If copying + end of s1. A terminating null character is always appended to the result.270) If copying - 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. - 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. -[page 327] (Contents) +[page 327] (Contents) takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The strncat function returns the value of s1. Forward references: the strlen function (7.21.6.3). 7.21.4 Comparison functions @@ -13017,76 +13017,76 @@ p Matches an implementation-defined set of sequences, which should be the pair of characters (both interpreted as unsigned char) that differ in the objects being compared. 7.21.4.1 The memcmp function - Synopsis + Synopsis 1 #include <string.h> int memcmp(const void *s1, const void *s2, size_t n); - Description + Description 2 The memcmp function compares the first n characters of the object pointed to by s1 to - the first n characters of the object pointed to by s2.271) - Returns + the first n characters of the object pointed to by s2.271) + Returns 3 The memcmp function returns an integer greater than, equal to, or less than zero, accordingly as the object pointed to by s1 is greater than, equal to, or less than the object pointed to by s2. 7.21.4.2 The strcmp function - Synopsis + Synopsis 1 #include <string.h> int strcmp(const char *s1, const char *s2); - Description + Description 2 The strcmp function compares the string pointed to by s1 to the string pointed to by s2. - Returns + Returns 3 The strcmp function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string - 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. -[page 328] (Contents) +[page 328] (Contents) pointed to by s2. 7.21.4.3 The strcoll function - Synopsis + Synopsis 1 #include <string.h> int strcoll(const char *s1, const char *s2); - Description + Description 2 The strcoll function compares the string pointed to by s1 to the string pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the current locale. - Returns + Returns 3 The strcoll function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2 when both are interpreted as appropriate to the current locale. 7.21.4.4 The strncmp function - Synopsis + Synopsis 1 #include <string.h> int strncmp(const char *s1, const char *s2, size_t n); - Description + Description 2 The strncmp function compares not more than n characters (characters that follow a null character are not compared) from the array pointed to by s1 to the array pointed to by s2. - Returns + Returns 3 The strncmp function returns an integer greater than, equal to, or less than zero, accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal to, or less than the possibly null-terminated array pointed to by s2. 7.21.4.5 The strxfrm function - Synopsis + Synopsis 1 #include <string.h> size_t strxfrm(char * restrict s1, const char * restrict s2, size_t n); - Description + Description 2 The strxfrm function transforms the string pointed to by s2 and places the resulting string into the array pointed to by s1. The transformation is such that if the strcmp function is applied to two transformed strings, it returns a value greater than, equal to, or -[page 329] (Contents) +[page 329] (Contents) less than zero, corresponding to the result of the strcoll function applied to the same two original strings. No more than n characters are placed into the resulting array pointed to by s1, including the terminating null character. If n is zero, s1 is permitted to be a null pointer. If copying takes place between objects that overlap, the behavior is undefined. - Returns + Returns 3 The strxfrm function returns the length of the transformed string (not including the terminating null character). If the value returned is n or more, the contents of the array pointed to by s1 are indeterminate. @@ -13096,92 +13096,92 @@ p Matches an implementation-defined set of sequences, which should be the 7.21.5 Search functions 7.21.5.1 The memchr function - Synopsis + Synopsis 1 #include <string.h> void *memchr(const void *s, int c, size_t n); - Description + Description 2 The memchr function locates the first occurrence of c (converted to an unsigned char) in the initial n characters (each interpreted as unsigned char) of the object pointed to by s. - Returns + Returns 3 The memchr function returns a pointer to the located character, or a null pointer if the character does not occur in the object. 7.21.5.2 The strchr function - Synopsis + Synopsis 1 #include <string.h> char *strchr(const char *s, int c); - Description + Description 2 The strchr function locates the first occurrence of c (converted to a char) in the string pointed to by s. The terminating null character is considered to be part of the string. - Returns + Returns 3 The strchr function returns a pointer to the located character, or a null pointer if the character does not occur in the string. -[page 330] (Contents) +[page 330] (Contents) 7.21.5.3 The strcspn function - Synopsis + Synopsis 1 #include <string.h> size_t strcspn(const char *s1, const char *s2); - Description + Description 2 The strcspn function computes the length of the maximum initial segment of the string pointed to by s1 which consists entirely of characters not from the string pointed to by s2. - Returns + Returns 3 The strcspn function returns the length of the segment. 7.21.5.4 The strpbrk function - Synopsis + Synopsis 1 #include <string.h> char *strpbrk(const char *s1, const char *s2); - Description + Description 2 The strpbrk function locates the first occurrence in the string pointed to by s1 of any character from the string pointed to by s2. - Returns + Returns 3 The strpbrk function returns a pointer to the character, or a null pointer if no character from s2 occurs in s1. 7.21.5.5 The strrchr function - Synopsis + Synopsis 1 #include <string.h> char *strrchr(const char *s, int c); - Description + Description 2 The strrchr function locates the last occurrence of c (converted to a char) in the string pointed to by s. The terminating null character is considered to be part of the string. - Returns + Returns 3 The strrchr function returns a pointer to the character, or a null pointer if c does not occur in the string. -[page 331] (Contents) +[page 331] (Contents) 7.21.5.6 The strspn function - Synopsis + Synopsis 1 #include <string.h> size_t strspn(const char *s1, const char *s2); - Description + Description 2 The strspn function computes the length of the maximum initial segment of the string pointed to by s1 which consists entirely of characters from the string pointed to by s2. - Returns + Returns 3 The strspn function returns the length of the segment. 7.21.5.7 The strstr function - Synopsis + Synopsis 1 #include <string.h> char *strstr(const char *s1, const char *s2); - Description + Description 2 The strstr function locates the first occurrence in the string pointed to by s1 of the sequence of characters (excluding the terminating null character) in the string pointed to by s2. - Returns + Returns 3 The strstr function returns a pointer to the located string, or a null pointer if the string is not found. If s2 points to a string with zero length, the function returns s1. 7.21.5.8 The strtok function - Synopsis + Synopsis 1 #include <string.h> char *strtok(char * restrict s1, const char * restrict s2); - Description + Description 2 A sequence of calls to the strtok function breaks the string pointed to by s1 into a sequence of tokens, each of which is delimited by a character from the string pointed to by s2. The first call in the sequence has a non-null first argument; subsequent calls in the @@ -13191,7 +13191,7 @@ p Matches an implementation-defined set of sequences, which should be the that is not contained in the current separator string pointed to by s2. If no such character is found, then there are no tokens in the string pointed to by s1 and the strtok function -[page 332] (Contents) +[page 332] (Contents) returns a null pointer. If such a character is found, it is the start of the first token. 4 The strtok function then searches from there for a character that is contained in the @@ -13203,7 +13203,7 @@ p Matches an implementation-defined set of sequences, which should be the 5 Each subsequent call, with a null pointer as the value of the first argument, starts searching from the saved pointer and behaves as described above. 6 The implementation shall behave as if no library function calls the strtok function. - Returns + Returns 7 The strtok function returns a pointer to the first character of a token, or a null pointer if there is no token. 8 EXAMPLE @@ -13217,47 +13217,47 @@ p Matches an implementation-defined set of sequences, which should be the 7.21.6 Miscellaneous functions 7.21.6.1 The memset function - Synopsis + Synopsis 1 #include <string.h> void *memset(void *s, int c, size_t n); - Description + Description 2 The memset function copies the value of c (converted to an unsigned char) into each of the first n characters of the object pointed to by s. - Returns + Returns 3 The memset function returns the value of s. -[page 333] (Contents) +[page 333] (Contents) 7.21.6.2 The strerror function - Synopsis + Synopsis 1 #include <string.h> char *strerror(int errnum); - Description + Description 2 The strerror function maps the number in errnum to a message string. Typically, the values for errnum come from errno, but strerror shall map any value of type int to a message. 3 The implementation shall behave as if no library function calls the strerror function. - Returns + Returns 4 The strerror function returns a pointer to the string, the contents of which are locale- specific. The array pointed to shall not be modified by the program, but may be overwritten by a subsequent call to the strerror function. 7.21.6.3 The strlen function - Synopsis + Synopsis 1 #include <string.h> size_t strlen(const char *s); - Description + Description 2 The strlen function computes the length of the string pointed to by s. - Returns + Returns 3 The strlen function returns the number of characters that precede the terminating null character. -[page 334] (Contents) +[page 334] (Contents) 7.22 Type-generic math <tgmath.h> 1 The header <tgmath.h> includes the headers <math.h> and <complex.h> and @@ -13265,10 +13265,10 @@ p Matches an implementation-defined set of sequences, which should be the 2 Of the <math.h> and <complex.h> functions without an f (float) or l (long double) suffix, several have one or more parameters whose corresponding real type is double. For each such function, except modf, there is a corresponding type-generic - macro.272) The parameters whose corresponding real type is double in the function + macro.272) The parameters whose corresponding real type is double in the function synopsis are generic parameters. Use of the macro invokes a function whose corresponding real type and type domain are determined by the arguments for the generic - parameters.273) + parameters.273) 3 Use of the macro invokes a function whose generic parameters have the corresponding real type determined as follows: -- First, if any argument for generic parameters has type long double, the type @@ -13284,12 +13284,12 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 335] (Contents) +[page 335] (Contents) <math.h> <complex.h> type-generic function function macro @@ -13331,7 +13331,7 @@ p Matches an implementation-defined set of sequences, which should be the function in <math.h>, the corresponding type-generic macro has the same name as the function. These type-generic macros are: -[page 336] (Contents) +[page 336] (Contents) carg conj creal cimag cproj @@ -13372,7 +13372,7 @@ p Matches an implementation-defined set of sequences, which should be the -[page 337] (Contents) +[page 337] (Contents) 7.23 Date and time <time.h> 7.23.1 Components of time @@ -13396,7 +13396,7 @@ p Matches an implementation-defined set of sequences, which should be the 4 The range and precision of times representable in clock_t and time_t are implementation-defined. The tm structure shall contain at least the following members, in any order. The semantics of the members and their normal ranges are expressed in the - comments.274) + comments.274) int tm_sec; // seconds after the minute -- [0, 60] int tm_min; // minutes after the hour -- [0, 59] int tm_hour; // hours since midnight -- [0, 23] @@ -13409,59 +13409,59 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 338] (Contents) +[page 338] (Contents) The value of tm_isdst is positive if Daylight Saving Time is in effect, zero if Daylight Saving Time is not in effect, and negative if the information is not available. 7.23.2 Time manipulation functions 7.23.2.1 The clock function - Synopsis + Synopsis 1 #include <time.h> clock_t clock(void); - Description + Description 2 The clock function determines the processor time used. - Returns + Returns 3 The clock function returns the implementation's best approximation to the processor time used by the program since the beginning of an implementation-defined era related only to the program invocation. To determine the time in seconds, the value returned by the clock function should be divided by the value of the macro CLOCKS_PER_SEC. If the processor time used is not available or its value cannot be represented, the function - returns the value (clock_t)(-1).275) + returns the value (clock_t)(-1).275) 7.23.2.2 The difftime function - Synopsis + Synopsis 1 #include <time.h> double difftime(time_t time1, time_t time0); - Description + Description 2 The difftime function computes the difference between two calendar times: time1 - time0. - Returns + Returns 3 The difftime function returns the difference expressed in seconds as a double. - 275) In order to measure the time spent in a program, the clock function should be called at the start of + 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. -[page 339] (Contents) +[page 339] (Contents) 7.23.2.3 The mktime function - Synopsis + Synopsis 1 #include <time.h> time_t mktime(struct tm *timeptr); - Description + Description 2 The mktime function converts the broken-down time, expressed as local time, in the structure pointed to by timeptr into a calendar time value with the same encoding as that of the values returned by the time function. The original values of the tm_wday and tm_yday components of the structure are ignored, and the original values of the - other components are not restricted to the ranges indicated above.276) On successful + other components are not restricted to the ranges indicated above.276) On successful completion, the values of the tm_wday and tm_yday components of the structure are set appropriately, and the other components are set to represent the specified calendar time, but with their values forced to the ranges indicated above; the final value of tm_mday is not set until tm_mon and tm_year are determined. - Returns + Returns 3 The mktime function returns the specified calendar time encoded as a value of type time_t. If the calendar time cannot be represented, the function returns the value (time_t)(-1). @@ -13478,11 +13478,11 @@ p Matches an implementation-defined set of sequences, which should be the - 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. -[page 340] (Contents) +[page 340] (Contents) time_str.tm_year = 2001 - 1900; time_str.tm_mon = 7 - 1; @@ -13496,13 +13496,13 @@ p Matches an implementation-defined set of sequences, which should be the printf("%s\n", wday[time_str.tm_wday]); 7.23.2.4 The time function - Synopsis + Synopsis 1 #include <time.h> time_t time(time_t *timer); - Description + Description 2 The time function determines the current calendar time. The encoding of the value is unspecified. - Returns + Returns 3 The time function returns the implementation's best approximation to the current calendar time. The value (time_t)(-1) is returned if the calendar time is not available. If timer is not a null pointer, the return value is also assigned to the object it @@ -13515,15 +13515,15 @@ p Matches an implementation-defined set of sequences, which should be the previous call to any of them. The implementation shall behave as if no other library functions call these functions. 7.23.3.1 The asctime function - Synopsis + Synopsis 1 #include <time.h> char *asctime(const struct tm *timeptr); - Description + Description 2 The asctime function converts the broken-down time in the structure pointed to by timeptr into a string in the form Sun Sep 16 01:03:52 1973\n\0 -[page 341] (Contents) +[page 341] (Contents) using the equivalent of the following algorithm. char *asctime(const struct tm *timeptr) @@ -13544,17 +13544,17 @@ p Matches an implementation-defined set of sequences, which should be the 1900 + timeptr->tm_year); return result; } - Returns + Returns 3 The asctime function returns a pointer to the string. 7.23.3.2 The ctime function - Synopsis + Synopsis 1 #include <time.h> char *ctime(const time_t *timer); - Description + Description 2 The ctime function converts the calendar time pointed to by timer to local time in the form of a string. It is equivalent to asctime(localtime(timer)) - Returns + Returns 3 The ctime function returns the pointer returned by the asctime function with that broken-down time as argument. Forward references: the localtime function (7.23.3.4). @@ -13562,36 +13562,36 @@ p Matches an implementation-defined set of sequences, which should be the -[page 342] (Contents) +[page 342] (Contents) 7.23.3.3 The gmtime function - Synopsis + Synopsis 1 #include <time.h> struct tm *gmtime(const time_t *timer); - Description + Description 2 The gmtime function converts the calendar time pointed to by timer into a broken- down time, expressed as UTC. - Returns + Returns 3 The gmtime function returns a pointer to the broken-down time, or a null pointer if the specified time cannot be converted to UTC. 7.23.3.4 The localtime function - Synopsis + Synopsis 1 #include <time.h> struct tm *localtime(const time_t *timer); - Description + Description 2 The localtime function converts the calendar time pointed to by timer into a broken-down time, expressed as local time. - Returns + Returns 3 The localtime function returns a pointer to the broken-down time, or a null pointer if the specified time cannot be converted to local time. 7.23.3.5 The strftime function - Synopsis + Synopsis 1 #include <time.h> size_t strftime(char * restrict s, size_t maxsize, const char * restrict format, const struct tm * restrict timeptr); - Description + Description 2 The strftime function places characters into the array pointed to by s as controlled by the string pointed to by format. The format shall be a multibyte character sequence, beginning and ending in its initial shift state. The format string consists of zero or @@ -13599,7 +13599,7 @@ p Matches an implementation-defined set of sequences, which should be the consists of a % character, possibly followed by an E or O modifier character (described below), followed by a character that determines the behavior of the conversion specifier. All ordinary multibyte characters (including the terminating null character) are copied -[page 343] (Contents) +[page 343] (Contents) unchanged into the array. If copying takes place between objects that overlap, the behavior is undefined. No more than maxsize characters are placed into the array. @@ -13642,12 +13642,12 @@ p Matches an implementation-defined set of sequences, which should be the %T is equivalent to ''%H:%M:%S'' (the ISO 8601 time format). [tm_hour, tm_min, tm_sec] -[page 344] (Contents) +[page 344] (Contents) %u is replaced by the ISO 8601 weekday as a decimal number (1-7), where Monday is 1. [tm_wday] %U is replaced by the week number of the year (the first Sunday as the first day of week - 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday] + 1) as a decimal number (00-53). [tm_year, tm_wday, tm_yday] %V is replaced by the ISO 8601 week number (see below) as a decimal number (01-53). [tm_year, tm_wday, tm_yday] %w is replaced by the weekday as a decimal number (0-6), where Sunday is 0. @@ -13685,7 +13685,7 @@ p Matches an implementation-defined set of sequences, which should be the symbols. -[page 345] (Contents) +[page 345] (Contents) %OI is replaced by the hour (12-hour clock), using the locale's alternative numeric symbols. @@ -13727,9 +13727,9 @@ p Matches an implementation-defined set of sequences, which should be the %Z implementation-defined. -[page 346] (Contents) +[page 346] (Contents) - Returns + Returns 8 If the total number of resulting characters including the terminating null character is not more than maxsize, the strftime function returns the number of characters placed into the array pointed to by s not including the terminating null character. Otherwise, @@ -13738,12 +13738,12 @@ p Matches an implementation-defined set of sequences, which should be the -[page 347] (Contents) +[page 347] (Contents) 7.24 Extended multibyte and wide character utilities <wchar.h> 7.24.1 Introduction 1 The header <wchar.h> declares four data types, one tag, four macros, and many - functions.277) + functions.277) 2 The types declared are wchar_t and size_t (both described in 7.17); mbstate_t which is an object type other than an array type that can hold the conversion state @@ -13753,14 +13753,14 @@ p Matches an implementation-defined set of sequences, which should be the which is an integer type unchanged by default argument promotions that can hold any value corresponding to members of the extended character set, as well as at least one value that does not correspond to any member of the extended character set (see WEOF - below);278) and + below);278) and struct tm which is declared as an incomplete structure type (the contents are described in 7.23.1). 3 The macros defined are NULL (described in 7.17); WCHAR_MIN and WCHAR_MAX (described in 7.18.3); and WEOF which expands to a constant expression of type wint_t whose value does not - correspond to any member of the extended character set.279) It is accepted (and returned) + correspond to any member of the extended character set.279) It is accepted (and returned) by several functions in this subclause to indicate end-of-file, that is, no more input from a stream. It is also used as a wide character value that does not correspond to any member of the extended character set. @@ -13771,11 +13771,11 @@ p Matches an implementation-defined set of sequences, which should be the -- Functions that perform general wide string manipulation; - 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. -[page 348] (Contents) +[page 348] (Contents) -- Functions for wide string date and time conversion; and -- Functions that provide extended capabilities for conversion between multibyte and @@ -13785,14 +13785,14 @@ p Matches an implementation-defined set of sequences, which should be the undefined. 7.24.2 Formatted wide character input/output functions 1 The formatted wide character input/output functions shall behave as if there is a sequence - point after the actions associated with each specifier.280) + point after the actions associated with each specifier.280) 7.24.2.1 The fwprintf function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> int fwprintf(FILE * restrict stream, const wchar_t * restrict format, ...); - Description + Description 2 The fwprintf function writes output to the stream pointed to by stream, under control of the wide string pointed to by format that specifies how subsequent arguments are converted for output. If there are insufficient arguments for the format, the behavior @@ -13812,13 +13812,13 @@ p Matches an implementation-defined set of sequences, which should be the than the field width, it is padded with spaces (by default) on the left (or right, if the - 280) The fwprintf functions perform writes to memory for the %n specifier. + 280) The fwprintf functions perform writes to memory for the %n specifier. -[page 349] (Contents) +[page 349] (Contents) left adjustment flag, described later, has been given) to the field width. The field width takes the form of an asterisk * (described later) or a nonnegative decimal - integer.281) + integer.281) -- An optional precision that gives the minimum number of digits to appear for the d, i, o, u, x, and X conversions, the number of digits to appear after the decimal-point wide character for a, A, e, E, f, and F conversions, the maximum number of @@ -13841,7 +13841,7 @@ p Matches an implementation-defined set of sequences, which should be the this flag is not specified.) + The result of a signed conversion always begins with a plus or minus sign. (It begins with a sign only when a negative value is converted if this flag is not - specified.)282) + specified.)282) space If the first wide character of a signed conversion is not a sign, or if a signed conversion results in no wide characters, a space is prefixed to the result. If the space and + flags both appear, the space flag is ignored. @@ -13850,11 +13850,11 @@ p Matches an implementation-defined set of sequences, which should be the zero (if the value and precision are both 0, a single 0 is printed). For x (or X) conversion, a nonzero result has 0x (or 0X) prefixed to it. For a, A, e, E, f, F, g, - 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. -[page 350] (Contents) +[page 350] (Contents) and G conversions, the result of converting a floating-point number always contains a decimal-point wide character, even if no digits follow it. (Normally, a @@ -13895,7 +13895,7 @@ p Matches an implementation-defined set of sequences, which should be the an intmax_t or uintmax_t argument; or that a following n conversion specifier applies to a pointer to an intmax_t argument. -[page 351] (Contents) +[page 351] (Contents) z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a @@ -13935,9 +13935,9 @@ p Matches an implementation-defined set of sequences, which should be the [-]nan or [-]nan(n-wchar-sequence) -- which style, and the meaning of any n-wchar-sequence, is implementation-defined. The F conversion specifier produces INF, INFINITY, or NAN instead of inf, infinity, or -[page 352] (Contents) +[page 352] (Contents) - nan, respectively.283) + nan, respectively.283) e,E A double argument representing a floating-point number is converted in the style [-]d.ddd e(+-)dd, where there is one digit (which is nonzero if the argument is nonzero) before the decimal-point wide character and the number @@ -13966,21 +13966,21 @@ g,G A double argument representing a floating-point number is converted a,A A double argument representing a floating-point number is converted in the style [-]0xh.hhhh p(+-)d, where there is one hexadecimal digit (which is nonzero if the argument is a normalized floating-point number and is - otherwise unspecified) before the decimal-point wide character284) and the + otherwise unspecified) before the decimal-point wide character284) and the number of hexadecimal digits after it is equal to the precision; if the precision is missing and FLT_RADIX is a power of 2, then the precision is sufficient -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. -[page 353] (Contents) +[page 353] (Contents) for an exact representation of the value; if the precision is missing and FLT_RADIX is not a power of 2, then the precision is sufficient to - distinguish285) values of type double, except that trailing zeros may be + distinguish285) values of type double, except that trailing zeros may be omitted; if the precision is zero and the # flag is not specified, no decimal- point wide character appears. The letters abcdef are used for a conversion and the letters ABCDEF for A conversion. The A conversion specifier @@ -14013,12 +14013,12 @@ s If no l length modifier is present, the argument shall be a pointer p The argument shall be a pointer to void. The value of the pointer is converted to a sequence of printing wide characters, in an implementation- -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. -[page 354] (Contents) +[page 354] (Contents) defined manner. n The argument shall be a pointer to signed integer into which is written the @@ -14028,7 +14028,7 @@ p The argument shall be a pointer to void. The value of the pointer i behavior is undefined. % A % wide character is written. No argument is converted. The complete conversion specification shall be %%. -9 If a conversion specification is invalid, the behavior is undefined.286) If any argument is +9 If a conversion specification is invalid, the behavior is undefined.286) If any argument is not the correct type for the corresponding conversion specification, the behavior is undefined. 10 In no case does a nonexistent or small field width cause truncation of a field; if the result @@ -14042,23 +14042,23 @@ p The argument shall be a pointer to void. The value of the pointer i in hexadecimal floating style with the given precision, with the extra stipulation that the error should have a correct sign for the current rounding direction. 13 For e, E, f, F, g, and G conversions, if the number of significant decimal digits is at most - DECIMAL_DIG, then the result should be correctly rounded.287) If the number of + DECIMAL_DIG, then the result should be correctly rounded.287) If the number of significant decimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the result should be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings L < U, both having DECIMAL_DIG significant digits; the value of the resultant decimal string D should satisfy L <= D <= U, with the extra stipulation that the error should have a correct sign for the current rounding direction. - Returns + Returns 14 The fwprintf function returns the number of wide characters transmitted, or a negative value if an output or encoding error occurred. - 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. -[page 355] (Contents) +[page 355] (Contents) Environmental limits 15 The number of wide characters that can be produced by any single conversion shall be at @@ -14073,17 +14073,17 @@ p The argument shall be a pointer to void. The value of the pointer i int day, hour, min; fwprintf(stdout, L"%ls, %ls %d, %.2d:%.2d\n", weekday, month, day, hour, min); - fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0)); + fwprintf(stdout, L"pi = %.5f\n", 4 * atan(1.0)); Forward references: the btowc function (7.24.6.1.1), the mbrtowc function (7.24.6.3.2). 7.24.2.2 The fwscanf function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> int fwscanf(FILE * restrict stream, const wchar_t * restrict format, ...); - Description + Description 2 The fwscanf function reads input from the stream pointed to by stream, under control of the wide string pointed to by format that specifies the admissible input sequences and how they are to be converted for assignment, using subsequent arguments @@ -14101,7 +14101,7 @@ p The argument shall be a pointer to void. The value of the pointer i -[page 356] (Contents) +[page 356] (Contents) -- An optional length modifier that specifies the size of the receiving object. -- A conversion specifier wide character that specifies the type of conversion to be @@ -14122,11 +14122,11 @@ p The argument shall be a pointer to void. The value of the pointer i described below for each specifier. A conversion specification is executed in the following steps: 8 Input white-space wide characters (as specified by the iswspace function) are skipped, - unless the specification includes a [, c, or n specifier.288) + unless the specification includes a [, c, or n specifier.288) 9 An input item is read from the stream, unless the specification includes an n specifier. An input item is defined as the longest sequence of input wide characters which does not exceed any specified field width and which is, or is a prefix of, a matching input - sequence.289) The first wide character, if any, after the input item remains unread. If the + sequence.289) The first wide character, if any, after the input item remains unread. If the length of the input item is zero, the execution of the directive fails; this condition is a matching failure unless end-of-file, an encoding error, or a read error prevented input from the stream, in which case it is an input failure. @@ -14138,11 +14138,11 @@ p The argument shall be a pointer to void. The value of the pointer i following the format argument that has not already received a conversion result. If this - 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. -[page 357] (Contents) +[page 357] (Contents) object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined. @@ -14180,7 +14180,7 @@ p The argument shall be a pointer to void. The value of the pointer i i Matches an optionally signed integer, whose format is the same as expected for the subject sequence of the wcstol function with the value 0 for the base argument. The corresponding argument shall be a pointer to signed -[page 358] (Contents) +[page 358] (Contents) integer. o Matches an optionally signed octal integer, whose format is the same as @@ -14220,7 +14220,7 @@ s Matches a sequence of non-white-space wide characters. If an l length modifier is present, the corresponding argument shall be a pointer to the initial element of an array of wchar_t large enough to accept -[page 359] (Contents) +[page 359] (Contents) the sequence and the terminating null wide character, which will be added automatically. @@ -14261,20 +14261,20 @@ n No input is consumed. The corresponding argument shall be a pointer to from the input stream so far by this call to the fwscanf function. Execution of a %n directive does not increment the assignment count returned at the completion of execution of the fwscanf function. No argument is -[page 360] (Contents) +[page 360] (Contents) converted, but one is consumed. If the conversion specification includes an assignment-suppressing wide character or a field width, the behavior is undefined. % Matches a single % wide character; no conversion or assignment occurs. The complete conversion specification shall be %%. -13 If a conversion specification is invalid, the behavior is undefined.290) +13 If a conversion specification is invalid, the behavior is undefined.290) 14 The conversion specifiers A, E, F, G, and X are also valid and behave the same as, respectively, a, e, f, g, and x. 15 Trailing white space (including new-line wide characters) is left unread unless matched by a directive. The success of literal matches and suppressed assignments is not directly determinable other than via the %n directive. - Returns + Returns 16 The fwscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early @@ -14302,39 +14302,39 @@ n No input is consumed. The corresponding argument shall be a pointer to 56.0. The next wide character read from the input stream will be a. - 290) See ''future library directions'' (7.26.12). + 290) See ''future library directions'' (7.26.12). -[page 361] (Contents) +[page 361] (Contents) Forward references: the wcstod, wcstof, and wcstold functions (7.24.4.1.1), the wcstol, wcstoll, wcstoul, and wcstoull functions (7.24.4.1.2), the wcrtomb function (7.24.6.3.3). 7.24.2.3 The swprintf function - Synopsis + Synopsis 1 #include <wchar.h> int swprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, ...); - Description + Description 2 The swprintf function is equivalent to fwprintf, except that the argument s specifies an array of wide characters into which the generated output is to be written, rather than written to a stream. No more than n wide characters are written, including a terminating null wide character, which is always added (unless n is zero). - Returns + Returns 3 The swprintf function returns the number of wide characters written in the array, not counting the terminating null wide character, or a negative value if an encoding error occurred or if n or more wide characters were requested to be written. 7.24.2.4 The swscanf function - Synopsis + Synopsis 1 #include <wchar.h> int swscanf(const wchar_t * restrict s, const wchar_t * restrict format, ...); - Description + Description 2 The swscanf function is equivalent to fwscanf, except that the argument s specifies a wide string from which the input is to be obtained, rather than from a stream. Reaching the end of the wide string is equivalent to encountering end-of-file for the fwscanf function. - Returns + Returns 3 The swscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the swscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an @@ -14343,22 +14343,22 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 362] (Contents) +[page 362] (Contents) 7.24.2.5 The vfwprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> #include <wchar.h> int vfwprintf(FILE * restrict stream, const wchar_t * restrict format, va_list arg); - Description + Description 2 The vfwprintf function is equivalent to fwprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfwprintf function does not invoke the - va_end macro.291) - Returns + va_end macro.291) + Returns 3 The vfwprintf function returns the number of wide characters transmitted, or a negative value if an output or encoding error occurred. 4 EXAMPLE The following shows the use of the vfwprintf function in a general error-reporting @@ -14380,274 +14380,274 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 363] (Contents) +[page 363] (Contents) 7.24.2.6 The vfwscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <stdio.h> #include <wchar.h> int vfwscanf(FILE * restrict stream, const wchar_t * restrict format, va_list arg); - Description + Description 2 The vfwscanf function is equivalent to fwscanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfwscanf function does not invoke the va_end macro.291) - Returns + Returns 3 The vfwscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vfwscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.24.2.7 The vswprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <wchar.h> int vswprintf(wchar_t * restrict s, size_t n, const wchar_t * restrict format, va_list arg); - Description + Description 2 The vswprintf function is equivalent to swprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vswprintf function does not invoke the va_end macro.291) - Returns + Returns 3 The vswprintf function returns the number of wide characters written in the array, not counting the terminating null wide character, or a negative value if an encoding error occurred or if n or more wide characters were requested to be generated. -[page 364] (Contents) +[page 364] (Contents) 7.24.2.8 The vswscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <wchar.h> int vswscanf(const wchar_t * restrict s, const wchar_t * restrict format, va_list arg); - Description + Description 2 The vswscanf function is equivalent to swscanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vswscanf function does not invoke the va_end macro.291) - Returns + Returns 3 The vswscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vswscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.24.2.9 The vwprintf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <wchar.h> int vwprintf(const wchar_t * restrict format, va_list arg); - Description + Description 2 The vwprintf function is equivalent to wprintf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vwprintf function does not invoke the va_end macro.291) - Returns + Returns 3 The vwprintf function returns the number of wide characters transmitted, or a negative value if an output or encoding error occurred. -[page 365] (Contents) +[page 365] (Contents) 7.24.2.10 The vwscanf function - Synopsis + Synopsis 1 #include <stdarg.h> #include <wchar.h> int vwscanf(const wchar_t * restrict format, va_list arg); - Description + Description 2 The vwscanf function is equivalent to wscanf, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vwscanf function does not invoke the va_end macro.291) - Returns + Returns 3 The vwscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the vwscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.24.2.11 The wprintf function - Synopsis + Synopsis 1 #include <wchar.h> int wprintf(const wchar_t * restrict format, ...); - Description + Description 2 The wprintf function is equivalent to fwprintf with the argument stdout interposed before the arguments to wprintf. - Returns + Returns 3 The wprintf function returns the number of wide characters transmitted, or a negative value if an output or encoding error occurred. 7.24.2.12 The wscanf function - Synopsis + Synopsis 1 #include <wchar.h> int wscanf(const wchar_t * restrict format, ...); - Description + Description 2 The wscanf function is equivalent to fwscanf with the argument stdin interposed before the arguments to wscanf. -[page 366] (Contents) +[page 366] (Contents) - Returns + Returns 3 The wscanf function returns the value of the macro EOF if an input failure occurs before any conversion. Otherwise, the wscanf function returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure. 7.24.3 Wide character input/output functions 7.24.3.1 The fgetwc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t fgetwc(FILE *stream); - Description + Description 2 If the end-of-file indicator for the input stream pointed to by stream is not set and a next wide character is present, the fgetwc function obtains that wide character as a wchar_t converted to a wint_t and advances the associated file position indicator for the stream (if defined). - Returns + Returns 3 If the end-of-file indicator for the stream is set, or if the stream is at end-of-file, the end- of-file indicator for the stream is set and the fgetwc function returns WEOF. Otherwise, the fgetwc function returns the next wide character from the input stream pointed to by stream. If a read error occurs, the error indicator for the stream is set and the fgetwc function returns WEOF. If an encoding error occurs (including too few bytes), the value of - the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.292) + the macro EILSEQ is stored in errno and the fgetwc function returns WEOF.292) 7.24.3.2 The fgetws function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wchar_t *fgetws(wchar_t * restrict s, int n, FILE * restrict stream); - Description + Description 2 The fgetws function reads at most one less than the number of wide characters specified by n from the stream pointed to by stream into the array pointed to by s. No - 292) An end-of-file and a read error can be distinguished by use of the feof and ferror functions. + 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. -[page 367] (Contents) +[page 367] (Contents) additional wide characters are read after a new-line wide character (which is retained) or after end-of-file. A null wide character is written immediately after the last wide character read into the array. - Returns + Returns 3 The fgetws function returns s if successful. If end-of-file is encountered and no characters have been read into the array, the contents of the array remain unchanged and a null pointer is returned. If a read or encoding error occurs during the operation, the array contents are indeterminate and a null pointer is returned. 7.24.3.3 The fputwc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t fputwc(wchar_t c, FILE *stream); - Description + Description 2 The fputwc function writes the wide character specified by c to the output stream pointed to by stream, at the position indicated by the associated file position indicator for the stream (if defined), and advances the indicator appropriately. If the file cannot support positioning requests, or if the stream was opened with append mode, the character is appended to the output stream. - Returns + Returns 3 The fputwc function returns the wide character written. If a write error occurs, the error indicator for the stream is set and fputwc returns WEOF. If an encoding error occurs, the value of the macro EILSEQ is stored in errno and fputwc returns WEOF. 7.24.3.4 The fputws function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> int fputws(const wchar_t * restrict s, FILE * restrict stream); - Description + Description 2 The fputws function writes the wide string pointed to by s to the stream pointed to by stream. The terminating null wide character is not written. - Returns + Returns 3 The fputws function returns EOF if a write or encoding error occurs; otherwise, it returns a nonnegative value. -[page 368] (Contents) +[page 368] (Contents) 7.24.3.5 The fwide function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> int fwide(FILE *stream, int mode); - Description + Description 2 The fwide function determines the orientation of the stream pointed to by stream. If mode is greater than zero, the function first attempts to make the stream wide oriented. If - mode is less than zero, the function first attempts to make the stream byte oriented.293) + mode is less than zero, the function first attempts to make the stream byte oriented.293) Otherwise, mode is zero and the function does not alter the orientation of the stream. - Returns + Returns 3 The fwide function returns a value greater than zero if, after the call, the stream has wide orientation, a value less than zero if the stream has byte orientation, or zero if the stream has no orientation. 7.24.3.6 The getwc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t getwc(FILE *stream); - Description + Description 2 The getwc function is equivalent to fgetwc, except that if it is implemented as a macro, it may evaluate stream more than once, so the argument should never be an expression with side effects. - Returns + Returns 3 The getwc function returns the next wide character from the input stream pointed to by stream, or WEOF. 7.24.3.7 The getwchar function - Synopsis + Synopsis 1 #include <wchar.h> wint_t getwchar(void); - 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. -[page 369] (Contents) +[page 369] (Contents) - Description + Description 2 The getwchar function is equivalent to getwc with the argument stdin. - Returns + Returns 3 The getwchar function returns the next wide character from the input stream pointed to by stdin, or WEOF. 7.24.3.8 The putwc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t putwc(wchar_t c, FILE *stream); - Description + Description 2 The putwc function is equivalent to fputwc, except that if it is implemented as a macro, it may evaluate stream more than once, so that argument should never be an expression with side effects. - Returns + Returns 3 The putwc function returns the wide character written, or WEOF. 7.24.3.9 The putwchar function - Synopsis + Synopsis 1 #include <wchar.h> wint_t putwchar(wchar_t c); - Description + Description 2 The putwchar function is equivalent to putwc with the second argument stdout. - Returns + Returns 3 The putwchar function returns the character written, or WEOF. 7.24.3.10 The ungetwc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t ungetwc(wint_t c, FILE *stream); - Description + Description 2 The ungetwc function pushes the wide character specified by c back onto the input stream pointed to by stream. Pushed-back wide characters will be returned by subsequent reads on that stream in the reverse order of their pushing. A successful -[page 370] (Contents) +[page 370] (Contents) intervening call (with the stream pointed to by stream) to a file positioning function (fseek, fsetpos, or rewind) discards any pushed-back wide characters for the @@ -14665,7 +14665,7 @@ n No input is consumed. The corresponding argument shall be a pointer to back. For a text or binary stream, the value of its file position indicator after a successful call to the ungetwc function is unspecified until all pushed-back wide characters are read or discarded. - Returns + Returns 6 The ungetwc function returns the wide character pushed back, or WEOF if the operation fails. 7.24.4 General wide string utilities @@ -14684,11 +14684,11 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 371] (Contents) +[page 371] (Contents) 7.24.4.1 Wide string numeric conversion functions 7.24.4.1.1 The wcstod, wcstof, and wcstold functions - Synopsis + Synopsis 1 #include <wchar.h> double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr); @@ -14696,7 +14696,7 @@ n No input is consumed. The corresponding argument shall be a pointer to wchar_t ** restrict endptr); long double wcstold(const wchar_t * restrict nptr, wchar_t ** restrict endptr); - Description + Description 2 The wcstod, wcstof, and wcstold functions convert the initial portion of the wide string pointed to by nptr to double, float, and long double representation, respectively. First, they decompose the input string into three parts: an initial, possibly @@ -14723,7 +14723,7 @@ n No input is consumed. The corresponding argument shall be a pointer to n-wchar-sequence nondigit The subject sequence is defined as the longest initial subsequence of the input wide string, starting with the first non-white-space wide character, that is of the expected form. -[page 372] (Contents) +[page 372] (Contents) The subject sequence contains no wide characters if the input wide string is not of the expected form. @@ -14735,12 +14735,12 @@ n No input is consumed. The corresponding argument shall be a pointer to floating point number, or if a binary exponent part does not appear in a hexadecimal floating point number, an exponent part of the appropriate type with value zero is assumed to follow the last digit in the string. If the subject sequence begins with a minus - sign, the sequence is interpreted as negated.294) A wide character sequence INF or + sign, the sequence is interpreted as negated.294) A wide character sequence INF or INFINITY is interpreted as an infinity, if representable in the return type, else like a floating constant that is too large for the range of the return type. A wide character sequence NAN or NAN(n-wchar-sequenceopt) is interpreted as a quiet NaN, if supported in the return type, else like a subject sequence part that does not have the expected form; - the meaning of the n-wchar sequences is implementation-defined.295) A pointer to the + the meaning of the n-wchar sequences is implementation-defined.295) A pointer to the final wide string is stored in the object pointed to by endptr, provided that endptr is not a null pointer. 5 If the subject sequence has the hexadecimal form and FLT_RADIX is a power of 2, the @@ -14759,14 +14759,14 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 373] (Contents) +[page 373] (Contents) 9 If the subject sequence has the decimal form and at most DECIMAL_DIG (defined in <float.h>) significant digits, the result should be correctly rounded. If the subject @@ -14776,8 +14776,8 @@ n No input is consumed. The corresponding argument shall be a pointer to The result should be one of the (equal or adjacent) values that would be obtained by correctly rounding L and U according to the current rounding direction, with the extra stipulation that the error with respect to D should have a correct sign for the current - rounding direction.296) - Returns + rounding direction.296) + Returns 10 The functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the return @@ -14789,13 +14789,13 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 374] (Contents) +[page 374] (Contents) 7.24.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions - Synopsis + Synopsis 1 #include <wchar.h> long int wcstol( const wchar_t * restrict nptr, @@ -14813,7 +14813,7 @@ n No input is consumed. The corresponding argument shall be a pointer to const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base); - Description + Description 2 The wcstol, wcstoll, wcstoul, and wcstoull functions convert the initial portion of the wide string pointed to by nptr to long int, long long int, unsigned long int, and unsigned long long int representation, @@ -14834,7 +14834,7 @@ n No input is consumed. The corresponding argument shall be a pointer to value of base is 16, the wide characters 0x or 0X may optionally precede the sequence of letters and digits, following the sign if present. -[page 375] (Contents) +[page 375] (Contents) 4 The subject sequence is defined as the longest initial subsequence of the input wide string, starting with the first non-white-space wide character, that is of the expected form. @@ -14854,7 +14854,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 7 If the subject sequence is empty or does not have the expected form, no conversion is performed; the value of nptr is stored in the object pointed to by endptr, provided that endptr is not a null pointer. - Returns + Returns 8 The wcstol, wcstoll, wcstoul, and wcstoull functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value is outside the range of representable values, LONG_MIN, LONG_MAX, LLONG_MIN, @@ -14862,151 +14862,151 @@ n No input is consumed. The corresponding argument shall be a pointer to sign of the value, if any), and the value of the macro ERANGE is stored in errno. 7.24.4.2 Wide string copying functions 7.24.4.2.1 The wcscpy function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcscpy(wchar_t * restrict s1, const wchar_t * restrict s2); - Description + Description 2 The wcscpy function copies the wide string pointed to by s2 (including the terminating null wide character) into the array pointed to by s1. - Returns + Returns 3 The wcscpy function returns the value of s1. -[page 376] (Contents) +[page 376] (Contents) 7.24.4.2.2 The wcsncpy function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcsncpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n); - Description + Description 2 The wcsncpy function copies not more than n wide characters (those that follow a null wide character are not copied) from the array pointed to by s2 to the array pointed to by - s1.297) + s1.297) 3 If the array pointed to by s2 is a wide string that is shorter than n wide characters, null wide characters are appended to the copy in the array pointed to by s1, until n wide characters in all have been written. - Returns + Returns 4 The wcsncpy function returns the value of s1. 7.24.4.2.3 The wmemcpy function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wmemcpy(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n); - Description + Description 2 The wmemcpy function copies n wide characters from the object pointed to by s2 to the object pointed to by s1. - Returns + Returns 3 The wmemcpy function returns the value of s1. - 297) Thus, if there is no null wide character in the first n wide characters of the array pointed to by s2, the + 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. -[page 377] (Contents) +[page 377] (Contents) 7.24.4.2.4 The wmemmove function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n); - Description + Description 2 The wmemmove function copies n wide characters from the object pointed to by s2 to the object pointed to by s1. Copying takes place as if the n wide characters from the object pointed to by s2 are first copied into a temporary array of n wide characters that does not overlap the objects pointed to by s1 or s2, and then the n wide characters from the temporary array are copied into the object pointed to by s1. - Returns + Returns 3 The wmemmove function returns the value of s1. 7.24.4.3 Wide string concatenation functions 7.24.4.3.1 The wcscat function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcscat(wchar_t * restrict s1, const wchar_t * restrict s2); - Description + Description 2 The wcscat function appends a copy of the wide string pointed to by s2 (including the terminating null wide character) to the end of the wide string pointed to by s1. The initial wide character of s2 overwrites the null wide character at the end of s1. - Returns + Returns 3 The wcscat function returns the value of s1. 7.24.4.3.2 The wcsncat function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcsncat(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n); - Description + Description 2 The wcsncat function appends not more than n wide characters (a null wide character and those that follow it are not appended) from the array pointed to by s2 to the end of -[page 378] (Contents) +[page 378] (Contents) the wide string pointed to by s1. The initial wide character of s2 overwrites the null wide character at the end of s1. A terminating null wide character is always appended to - the result.298) - Returns + the result.298) + Returns 3 The wcsncat function returns the value of s1. 7.24.4.4 Wide string comparison functions 1 Unless explicitly stated otherwise, the functions described in this subclause order two wide characters the same way as two integers of the underlying integer type designated by wchar_t. 7.24.4.4.1 The wcscmp function - Synopsis + Synopsis 1 #include <wchar.h> int wcscmp(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcscmp function compares the wide string pointed to by s1 to the wide string pointed to by s2. - Returns + Returns 3 The wcscmp function returns an integer greater than, equal to, or less than zero, accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the wide string pointed to by s2. 7.24.4.4.2 The wcscoll function - Synopsis + Synopsis 1 #include <wchar.h> int wcscoll(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcscoll function compares the wide string pointed to by s1 to the wide string pointed to by s2, both interpreted as appropriate to the LC_COLLATE category of the current locale. - Returns + Returns 3 The wcscoll function returns an integer greater than, equal to, or less than zero, accordingly as the wide string pointed to by s1 is greater than, equal to, or less than the - 298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is + 298) Thus, the maximum number of wide characters that can end up in the array pointed to by s1 is wcslen(s1)+n+1. -[page 379] (Contents) +[page 379] (Contents) wide string pointed to by s2 when both are interpreted as appropriate to the current locale. 7.24.4.4.3 The wcsncmp function - Synopsis + Synopsis 1 #include <wchar.h> int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n); - Description + Description 2 The wcsncmp function compares not more than n wide characters (those that follow a null wide character are not compared) from the array pointed to by s1 to the array pointed to by s2. - Returns + Returns 3 The wcsncmp function returns an integer greater than, equal to, or less than zero, accordingly as the possibly null-terminated array pointed to by s1 is greater than, equal to, or less than the possibly null-terminated array pointed to by s2. 7.24.4.4.4 The wcsxfrm function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcsxfrm(wchar_t * restrict s1, const wchar_t * restrict s2, size_t n); - Description + Description 2 The wcsxfrm function transforms the wide string pointed to by s2 and places the resulting wide string into the array pointed to by s1. The transformation is such that if the wcscmp function is applied to two transformed wide strings, it returns a value greater @@ -15014,7 +15014,7 @@ n No input is consumed. The corresponding argument shall be a pointer to applied to the same two original wide strings. No more than n wide characters are placed into the resulting array pointed to by s1, including the terminating null wide character. If n is zero, s1 is permitted to be a null pointer. - Returns + Returns 3 The wcsxfrm function returns the length of the transformed wide string (not including the terminating null wide character). If the value returned is n or greater, the contents of the array pointed to by s1 are indeterminate. @@ -15022,101 +15022,101 @@ n No input is consumed. The corresponding argument shall be a pointer to transformation of the wide string pointed to by s: -[page 380] (Contents) +[page 380] (Contents) 1 + wcsxfrm(NULL, s, 0) 7.24.4.4.5 The wmemcmp function - Synopsis + Synopsis 1 #include <wchar.h> int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n); - Description + Description 2 The wmemcmp function compares the first n wide characters of the object pointed to by s1 to the first n wide characters of the object pointed to by s2. - Returns + Returns 3 The wmemcmp function returns an integer greater than, equal to, or less than zero, accordingly as the object pointed to by s1 is greater than, equal to, or less than the object pointed to by s2. 7.24.4.5 Wide string search functions 7.24.4.5.1 The wcschr function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcschr(const wchar_t *s, wchar_t c); - Description + Description 2 The wcschr function locates the first occurrence of c in the wide string pointed to by s. The terminating null wide character is considered to be part of the wide string. - Returns + Returns 3 The wcschr function returns a pointer to the located wide character, or a null pointer if the wide character does not occur in the wide string. 7.24.4.5.2 The wcscspn function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcscspn(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcscspn function computes the length of the maximum initial segment of the wide string pointed to by s1 which consists entirely of wide characters not from the wide string pointed to by s2. -[page 381] (Contents) +[page 381] (Contents) - Returns + Returns 3 The wcscspn function returns the length of the segment. 7.24.4.5.3 The wcspbrk function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcspbrk(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcspbrk function locates the first occurrence in the wide string pointed to by s1 of any wide character from the wide string pointed to by s2. - Returns + Returns 3 The wcspbrk function returns a pointer to the wide character in s1, or a null pointer if no wide character from s2 occurs in s1. 7.24.4.5.4 The wcsrchr function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcsrchr(const wchar_t *s, wchar_t c); - Description + Description 2 The wcsrchr function locates the last occurrence of c in the wide string pointed to by s. The terminating null wide character is considered to be part of the wide string. - Returns + Returns 3 The wcsrchr function returns a pointer to the wide character, or a null pointer if c does not occur in the wide string. 7.24.4.5.5 The wcsspn function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcsspn(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcsspn function computes the length of the maximum initial segment of the wide string pointed to by s1 which consists entirely of wide characters from the wide string pointed to by s2. - Returns + Returns 3 The wcsspn function returns the length of the segment. -[page 382] (Contents) +[page 382] (Contents) 7.24.4.5.6 The wcsstr function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2); - Description + Description 2 The wcsstr function locates the first occurrence in the wide string pointed to by s1 of the sequence of wide characters (excluding the terminating null wide character) in the wide string pointed to by s2. - Returns + Returns 3 The wcsstr function returns a pointer to the located wide string, or a null pointer if the wide string is not found. If s2 points to a wide string with zero length, the function returns s1. 7.24.4.5.7 The wcstok function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, wchar_t ** restrict ptr); - Description + Description 2 A sequence of calls to the wcstok function breaks the wide string pointed to by s1 into a sequence of tokens, each of which is delimited by a wide character from the wide string pointed to by s2. The third argument points to a caller-provided wchar_t pointer into @@ -15134,7 +15134,7 @@ n No input is consumed. The corresponding argument shall be a pointer to the start of the first token. 5 The wcstok function then searches from there for a wide character that is contained in the current separator wide string. If no such wide character is found, the current token -[page 383] (Contents) +[page 383] (Contents) extends to the end of the wide string pointed to by s1, and subsequent searches in the same wide string for a token return a null pointer. If such a wide character is found, it is @@ -15143,7 +15143,7 @@ n No input is consumed. The corresponding argument shall be a pointer to by ptr so that subsequent calls, with a null pointer for s1 and the unmodified pointer value for ptr, shall start searching just past the element overwritten by a null wide character (if any). - Returns + Returns 7 The wcstok function returns a pointer to the first wide character of a token, or a null pointer if there is no token. 8 EXAMPLE @@ -15158,63 +15158,63 @@ n No input is consumed. The corresponding argument shall be a pointer to t = wcstok(NULL, L"?", &ptr1); // t is a null pointer 7.24.4.5.8 The wmemchr function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n); - Description + Description 2 The wmemchr function locates the first occurrence of c in the initial n wide characters of the object pointed to by s. - Returns + Returns 3 The wmemchr function returns a pointer to the located wide character, or a null pointer if the wide character does not occur in the object. -[page 384] (Contents) +[page 384] (Contents) 7.24.4.6 Miscellaneous functions 7.24.4.6.1 The wcslen function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcslen(const wchar_t *s); - Description + Description 2 The wcslen function computes the length of the wide string pointed to by s. - Returns + Returns 3 The wcslen function returns the number of wide characters that precede the terminating null wide character. 7.24.4.6.2 The wmemset function - Synopsis + Synopsis 1 #include <wchar.h> wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n); - Description + Description 2 The wmemset function copies the value of c into each of the first n wide characters of the object pointed to by s. - Returns + Returns 3 The wmemset function returns the value of s. 7.24.5 Wide character time conversion functions 7.24.5.1 The wcsftime function - Synopsis + Synopsis 1 #include <time.h> #include <wchar.h> size_t wcsftime(wchar_t * restrict s, size_t maxsize, const wchar_t * restrict format, const struct tm * restrict timeptr); - Description + Description 2 The wcsftime function is equivalent to the strftime function, except that: -- The argument s points to the initial element of an array of wide characters into which the generated output is to be placed. -[page 385] (Contents) +[page 385] (Contents) -- The argument maxsize indicates the limiting number of wide characters. -- The argument format is a wide string and the conversion specifiers are replaced by corresponding sequences of wide characters. -- The return value indicates the number of wide characters. - Returns + Returns 3 If the total number of resulting wide characters including the terminating null wide character is not more than maxsize, the wcsftime function returns the number of wide characters placed into the array pointed to by s not including the terminating null @@ -15236,7 +15236,7 @@ n No input is consumed. The corresponding argument shall be a pointer to been altered by any of the functions described in this subclause, and is then used with a different multibyte character sequence, or in the other conversion direction, or with a different LC_CTYPE category setting than on earlier function calls, the behavior is - undefined.299) + undefined.299) 4 On entry, each function takes the described conversion state (either internal or pointed to by an argument) as current. The conversion state described by the pointed-to object is altered as needed to track the shift state, and the position within a multibyte character, for @@ -15245,49 +15245,49 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 386] (Contents) +[page 386] (Contents) 7.24.6.1 Single-byte/wide character conversion functions 7.24.6.1.1 The btowc function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> wint_t btowc(int c); - Description + Description 2 The btowc function determines whether c constitutes a valid single-byte character in the initial shift state. - Returns + Returns 3 The btowc function returns WEOF if c has the value EOF or if (unsigned char)c does not constitute a valid single-byte character in the initial shift state. Otherwise, it returns the wide character representation of that character. 7.24.6.1.2 The wctob function - Synopsis + Synopsis 1 #include <stdio.h> #include <wchar.h> int wctob(wint_t c); - Description + Description 2 The wctob function determines whether c corresponds to a member of the extended character set whose multibyte character representation is a single byte when in the initial shift state. - Returns + Returns 3 The wctob function returns EOF if c does not correspond to a multibyte character with length one in the initial shift state. Otherwise, it returns the single-byte representation of that character as an unsigned char converted to an int. 7.24.6.2 Conversion state functions 7.24.6.2.1 The mbsinit function - Synopsis + Synopsis 1 #include <wchar.h> int mbsinit(const mbstate_t *ps); - Description + Description 2 If ps is not a null pointer, the mbsinit function determines whether the pointed-to mbstate_t object describes an initial conversion state. -[page 387] (Contents) +[page 387] (Contents) - Returns + Returns 3 The mbsinit function returns nonzero if ps is a null pointer or if the pointed-to object describes an initial conversion state; otherwise, it returns zero. 7.24.6.3 Restartable multibyte/wide character conversion functions @@ -15301,17 +15301,17 @@ n No input is consumed. The corresponding argument shall be a pointer to 2 Also unlike their corresponding functions, the return value does not represent whether the encoding is state-dependent. 7.24.6.3.1 The mbrlen function - Synopsis + Synopsis 1 #include <wchar.h> size_t mbrlen(const char * restrict s, size_t n, mbstate_t * restrict ps); - Description + Description 2 The mbrlen function is equivalent to the call: mbrtowc(NULL, s, n, ps != NULL ? ps : &internal) where internal is the mbstate_t object for the mbrlen function, except that the expression designated by ps is evaluated only once. - Returns + Returns 3 The mbrlen function returns a value between zero and n, inclusive, (size_t)(-2), or (size_t)(-1). Forward references: the mbrtowc function (7.24.6.3.2). @@ -15319,16 +15319,16 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 388] (Contents) +[page 388] (Contents) 7.24.6.3.2 The mbrtowc function - Synopsis + Synopsis 1 #include <wchar.h> size_t mbrtowc(wchar_t * restrict pwc, const char * restrict s, size_t n, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the mbrtowc function is equivalent to the call: mbrtowc(NULL, "", 1, ps) In this case, the values of the parameters pwc and n are ignored. @@ -15339,7 +15339,7 @@ n No input is consumed. The corresponding argument shall be a pointer to corresponding wide character and then, if pwc is not a null pointer, stores that value in the object pointed to by pwc. If the corresponding wide character is the null wide character, the resulting state described is the initial conversion state. - Returns + Returns 4 The mbrtowc function returns the first of the following that applies (given the current conversion state): 0 if the next n or fewer bytes complete the multibyte character that @@ -15349,24 +15349,24 @@ n No input is consumed. The corresponding argument shall be a pointer to of bytes that complete the multibyte character. (size_t)(-2) if the next n bytes contribute to an incomplete (but potentially valid) multibyte character, and all n bytes have been processed (no value is - stored).300) + stored).300) (size_t)(-1) if an encoding error occurs, in which case the next n or fewer bytes do not contribute to a complete and valid multibyte character (no value is stored); the value of the macro EILSEQ is stored in errno, and the conversion state is unspecified. - 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). -[page 389] (Contents) +[page 389] (Contents) 7.24.6.3.3 The wcrtomb function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcrtomb(char * restrict s, wchar_t wc, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the wcrtomb function is equivalent to the call wcrtomb(buf, L'\0', ps) where buf is an internal buffer. @@ -15376,7 +15376,7 @@ n No input is consumed. The corresponding argument shall be a pointer to array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If wc is a null wide character, a null byte is stored, preceded by any shift sequence needed to restore the initial shift state; the resulting state described is the initial conversion state. - Returns + Returns 4 The wcrtomb function returns the number of bytes stored in the array object (including any shift sequences). When wc is not a valid wide character, an encoding error occurs: the function stores the value of the macro EILSEQ in errno and returns @@ -15397,16 +15397,16 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 390] (Contents) +[page 390] (Contents) 7.24.6.4.1 The mbsrtowcs function - Synopsis + Synopsis 1 #include <wchar.h> size_t mbsrtowcs(wchar_t * restrict dst, const char ** restrict src, size_t len, mbstate_t * restrict ps); - Description + Description 2 The mbsrtowcs function converts a sequence of multibyte characters that begins in the conversion state described by the object pointed to by ps, from the array indirectly pointed to by src into a sequence of corresponding wide characters. If dst is not a null @@ -15414,14 +15414,14 @@ n No input is consumed. The corresponding argument shall be a pointer to continues up to and including a terminating null character, which is also stored. Conversion stops earlier in two cases: when a sequence of bytes is encountered that does not form a valid multibyte character, or (if dst is not a null pointer) when len wide - characters have been stored into the array pointed to by dst.301) Each conversion takes + characters have been stored into the array pointed to by dst.301) Each conversion takes place as if by a call to the mbrtowc function. 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null pointer (if conversion stopped due to reaching a terminating null character) or the address just past the last multibyte character converted (if any). If conversion stopped due to reaching a terminating null character and if dst is not a null pointer, the resulting state described is the initial conversion state. - Returns + Returns 4 If the input conversion encounters a sequence of bytes that do not form a valid multibyte character, an encoding error occurs: the mbsrtowcs function stores the value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion state is @@ -15431,18 +15431,18 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 391] (Contents) +[page 391] (Contents) 7.24.6.4.2 The wcsrtombs function - Synopsis + Synopsis 1 #include <wchar.h> size_t wcsrtombs(char * restrict dst, const wchar_t ** restrict src, size_t len, mbstate_t * restrict ps); - Description + Description 2 The wcsrtombs function converts a sequence of wide characters from the array indirectly pointed to by src into a sequence of corresponding multibyte characters that begins in the conversion state described by the object pointed to by ps. If dst is not a @@ -15452,13 +15452,13 @@ n No input is consumed. The corresponding argument shall be a pointer to not correspond to a valid multibyte character, or (if dst is not a null pointer) when the next multibyte character would exceed the limit of len total bytes to be stored into the array pointed to by dst. Each conversion takes place as if by a call to the wcrtomb - function.302) + function.302) 3 If dst is not a null pointer, the pointer object pointed to by src is assigned either a null pointer (if conversion stopped due to reaching a terminating null wide character) or the address just past the last wide character converted (if any). If conversion stopped due to reaching a terminating null wide character, the resulting state described is the initial conversion state. - Returns + Returns 4 If conversion stops because a wide character is reached that does not correspond to a valid multibyte character, an encoding error occurs: the wcsrtombs function stores the value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion @@ -15468,14 +15468,14 @@ n No input is consumed. The corresponding argument shall be a pointer to - 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. -[page 392] (Contents) +[page 392] (Contents) 7.25 Wide character classification and mapping utilities <wctype.h> 7.25.1 Introduction -1 The header <wctype.h> declares three data types, one macro, and many functions.303) +1 The header <wctype.h> declares three data types, one macro, and many functions.303) 2 The types declared are wint_t described in 7.24.1; @@ -15500,9 +15500,9 @@ n No input is consumed. The corresponding argument shall be a pointer to - 303) See ''future library directions'' (7.26.13). + 303) See ''future library directions'' (7.26.13). -[page 393] (Contents) +[page 393] (Contents) 7.25.2 Wide character classification utilities 1 The header <wctype.h> declares several functions useful for classifying wide @@ -15518,123 +15518,123 @@ n No input is consumed. The corresponding argument shall be a pointer to if by a call to the wctob function) to a single-byte character for which the corresponding character classification function from 7.4.1 returns true, except that the iswgraph and iswpunct functions may differ with respect to wide characters other than L' ' that are - both printing and white-space wide characters.304) + both printing and white-space wide characters.304) Forward references: the wctob function (7.24.6.1.2). 7.25.2.1.1 The iswalnum function - Synopsis + Synopsis 1 #include <wctype.h> int iswalnum(wint_t wc); - Description + Description 2 The iswalnum function tests for any wide character for which iswalpha or iswdigit is true. 7.25.2.1.2 The iswalpha function - Synopsis + Synopsis 1 #include <wctype.h> int iswalpha(wint_t wc); - Description + Description 2 The iswalpha function tests for any wide character for which iswupper or iswlower is true, or any wide character that is one of a locale-specific set of alphabetic - 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. -[page 394] (Contents) +[page 394] (Contents) wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace - is true.305) + is true.305) 7.25.2.1.3 The iswblank function - Synopsis + Synopsis 1 #include <wctype.h> int iswblank(wint_t wc); - Description + Description 2 The iswblank function tests for any wide character that is a standard blank wide character or is one of a locale-specific set of wide characters for which iswspace is true and that is used to separate words within a line of text. The standard blank wide characters are the following: space (L' '), and horizontal tab (L'\t'). In the "C" locale, iswblank returns true only for the standard blank characters. 7.25.2.1.4 The iswcntrl function - Synopsis + Synopsis 1 #include <wctype.h> int iswcntrl(wint_t wc); - Description + Description 2 The iswcntrl function tests for any control wide character. 7.25.2.1.5 The iswdigit function - Synopsis + Synopsis 1 #include <wctype.h> int iswdigit(wint_t wc); - Description + Description 2 The iswdigit function tests for any wide character that corresponds to a decimal-digit character (as defined in 5.2.1). 7.25.2.1.6 The iswgraph function - Synopsis + Synopsis 1 #include <wctype.h> int iswgraph(wint_t wc); - 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. -[page 395] (Contents) +[page 395] (Contents) - Description + Description 2 The iswgraph function tests for any wide character for which iswprint is true and - iswspace is false.306) + iswspace is false.306) 7.25.2.1.7 The iswlower function - Synopsis + Synopsis 1 #include <wctype.h> int iswlower(wint_t wc); - Description + Description 2 The iswlower function tests for any wide character that corresponds to a lowercase letter or is one of a locale-specific set of wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace is true. 7.25.2.1.8 The iswprint function - Synopsis + Synopsis 1 #include <wctype.h> int iswprint(wint_t wc); - Description + Description 2 The iswprint function tests for any printing wide character. 7.25.2.1.9 The iswpunct function - Synopsis + Synopsis 1 #include <wctype.h> int iswpunct(wint_t wc); - Description + Description 2 The iswpunct function tests for any printing wide character that is one of a locale- specific set of punctuation wide characters for which neither iswspace nor iswalnum is true.306) 7.25.2.1.10 The iswspace function - Synopsis + Synopsis 1 #include <wctype.h> int iswspace(wint_t wc); - 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 ' '. -[page 396] (Contents) +[page 396] (Contents) - Description + Description 2 The iswspace function tests for any wide character that corresponds to a locale-specific set of white-space wide characters for which none of iswalnum, iswgraph, or iswpunct is true. 7.25.2.1.11 The iswupper function - Synopsis + Synopsis 1 #include <wctype.h> int iswupper(wint_t wc); - Description + Description 2 The iswupper function tests for any wide character that corresponds to an uppercase letter or is one of a locale-specific set of wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace is true. 7.25.2.1.12 The iswxdigit function - Synopsis + Synopsis 1 #include <wctype.h> int iswxdigit(wint_t wc); - Description + Description 2 The iswxdigit function tests for any wide character that corresponds to a hexadecimal-digit character (as defined in 6.4.4.1). 7.25.2.2 Extensible wide character classification functions @@ -15642,10 +15642,10 @@ n No input is consumed. The corresponding argument shall be a pointer to as well as testing equivalent to that performed by the functions described in the previous subclause (7.25.2.1). 7.25.2.2.1 The iswctype function - Synopsis + Synopsis 1 #include <wctype.h> int iswctype(wint_t wc, wctype_t desc); - Description + Description 2 The iswctype function determines whether the wide character wc has the property described by desc. The current setting of the LC_CTYPE category shall be the same as during the call to wctype that returned the value desc. @@ -15653,7 +15653,7 @@ n No input is consumed. The corresponding argument shall be a pointer to character classification function (7.25.2.1) in the comment that follows the expression: -[page 397] (Contents) +[page 397] (Contents) iswctype(wc, wctype("alnum")) // iswalnum(wc) iswctype(wc, wctype("alpha")) // iswalpha(wc) @@ -15667,20 +15667,20 @@ n No input is consumed. The corresponding argument shall be a pointer to iswctype(wc, wctype("space")) // iswspace(wc) iswctype(wc, wctype("upper")) // iswupper(wc) iswctype(wc, wctype("xdigit")) // iswxdigit(wc) - Returns + Returns 4 The iswctype function returns nonzero (true) if and only if the value of the wide character wc has the property described by desc. Forward references: the wctype function (7.25.2.2.2). 7.25.2.2.2 The wctype function - Synopsis + Synopsis 1 #include <wctype.h> wctype_t wctype(const char *property); - Description + Description 2 The wctype function constructs a value with type wctype_t that describes a class of wide characters identified by the string argument property. 3 The strings listed in the description of the iswctype function shall be valid in all locales as property arguments to the wctype function. - Returns + Returns 4 If property identifies a valid class of wide characters according to the LC_CTYPE category of the current locale, the wctype function returns a nonzero value that is valid as the second argument to the iswctype function; otherwise, it returns zero. * @@ -15688,30 +15688,30 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 398] (Contents) +[page 398] (Contents) 7.25.3 Wide character case mapping utilities 1 The header <wctype.h> declares several functions useful for mapping wide characters. 7.25.3.1 Wide character case mapping functions 7.25.3.1.1 The towlower function - Synopsis + Synopsis 1 #include <wctype.h> wint_t towlower(wint_t wc); - Description + Description 2 The towlower function converts an uppercase letter to a corresponding lowercase letter. - Returns + Returns 3 If the argument is a wide character for which iswupper is true and there are one or more corresponding wide characters, as specified by the current locale, for which iswlower is true, the towlower function returns one of the corresponding wide characters (always the same one for any given locale); otherwise, the argument is returned unchanged. 7.25.3.1.2 The towupper function - Synopsis + Synopsis 1 #include <wctype.h> wint_t towupper(wint_t wc); - Description + Description 2 The towupper function converts a lowercase letter to a corresponding uppercase letter. - Returns + Returns 3 If the argument is a wide character for which iswlower is true and there are one or more corresponding wide characters, as specified by the current locale, for which iswupper is true, the towupper function returns one of the corresponding wide @@ -15725,13 +15725,13 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 399] (Contents) +[page 399] (Contents) 7.25.3.2.1 The towctrans function - Synopsis + Synopsis 1 #include <wctype.h> wint_t towctrans(wint_t wc, wctrans_t desc); - Description + Description 2 The towctrans function maps the wide character wc using the mapping described by desc. The current setting of the LC_CTYPE category shall be the same as during the call to wctrans that returned the value desc. @@ -15739,19 +15739,19 @@ n No input is consumed. The corresponding argument shall be a pointer to mapping function (7.25.3.1) in the comment that follows the expression: towctrans(wc, wctrans("tolower")) // towlower(wc) towctrans(wc, wctrans("toupper")) // towupper(wc) - Returns + Returns 4 The towctrans function returns the mapped value of wc using the mapping described by desc. 7.25.3.2.2 The wctrans function - Synopsis + Synopsis 1 #include <wctype.h> wctrans_t wctrans(const char *property); - Description + Description 2 The wctrans function constructs a value with type wctrans_t that describes a mapping between wide characters identified by the string argument property. 3 The strings listed in the description of the towctrans function shall be valid in all locales as property arguments to the wctrans function. - Returns + Returns 4 If property identifies a valid mapping of wide characters according to the LC_CTYPE category of the current locale, the wctrans function returns a nonzero value that is valid as the second argument to the towctrans function; otherwise, it returns zero. @@ -15759,7 +15759,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 400] (Contents) +[page 400] (Contents) 7.26 Future library directions 1 The following names are grouped under individual headers for convenience. All external @@ -15794,7 +15794,7 @@ n No input is consumed. The corresponding argument shall be a pointer to types defined in the <stdint.h> header. Macro names beginning with INT or UINT and ending with _MAX, _MIN, or _C may be added to the macros defined in the <stdint.h> header. -[page 401] (Contents) +[page 401] (Contents) 7.26.9 Input/output <stdio.h> 1 Lowercase letters may be added to the conversion specifiers and length modifiers in @@ -15821,7 +15821,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 402] (Contents) +[page 402] (Contents) Annex A (informative) @@ -15860,7 +15860,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 403] (Contents) +[page 403] (Contents) A.1.3 Identifiers (6.4.2.1) identifier: @@ -15898,7 +15898,7 @@ n No input is consumed. The corresponding argument shall be a pointer to (6.4.4.1) decimal-constant: nonzero-digit decimal-constant digit -[page 404] (Contents) +[page 404] (Contents) (6.4.4.1) octal-constant: 0 @@ -15937,7 +15937,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 405] (Contents) +[page 405] (Contents) (6.4.4.2) hexadecimal-floating-constant: hexadecimal-prefix hexadecimal-fractional-constant @@ -15976,7 +15976,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 406] (Contents) +[page 406] (Contents) (6.4.4.4) c-char-sequence: c-char @@ -16015,7 +16015,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 407] (Contents) +[page 407] (Contents) A.1.7 Punctuators (6.4.6) punctuator: one of @@ -16055,7 +16055,7 @@ n No input is consumed. The corresponding argument shall be a pointer to pp-number . -[page 408] (Contents) +[page 408] (Contents) A.2 Phrase structure grammar A.2.1 Expressions @@ -16095,7 +16095,7 @@ n No input is consumed. The corresponding argument shall be a pointer to multiplicative-expression / cast-expression multiplicative-expression % cast-expression -[page 409] (Contents) +[page 409] (Contents) (6.5.6) additive-expression: multiplicative-expression @@ -16134,7 +16134,7 @@ n No input is consumed. The corresponding argument shall be a pointer to logical-OR-expression logical-OR-expression ? expression : conditional-expression -[page 410] (Contents) +[page 410] (Contents) (6.5.16) assignment-expression: conditional-expression @@ -16170,7 +16170,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 411] (Contents) +[page 411] (Contents) (6.7.2) type-specifier: void @@ -16211,7 +16211,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 412] (Contents) +[page 412] (Contents) (6.7.2.2) enum-specifier: enum identifieropt { enumerator-list } @@ -16250,7 +16250,7 @@ n No input is consumed. The corresponding argument shall be a pointer to parameter-list parameter-list , ... -[page 413] (Contents) +[page 413] (Contents) (6.7.5) parameter-list: parameter-declaration @@ -16290,7 +16290,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 414] (Contents) +[page 414] (Contents) (6.7.8) designator-list: designator @@ -16328,7 +16328,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 415] (Contents) +[page 415] (Contents) (6.8.5) iteration-statement: while ( expression ) statement @@ -16367,7 +16367,7 @@ n No input is consumed. The corresponding argument shall be a pointer to if-group elif-groupsopt else-groupopt endif-line -[page 416] (Contents) +[page 416] (Contents) (6.10) if-group: # if constant-expression new-line groupopt @@ -16407,7 +16407,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 417] (Contents) +[page 417] (Contents) (6.10) pp-tokens: preprocessing-token @@ -16418,7 +16418,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 418] (Contents) +[page 418] (Contents) Annex B (informative) @@ -16457,7 +16457,7 @@ n No input is consumed. The corresponding argument shall be a pointer to double complex catanh(double complex z); float complex catanhf(float complex z); long double complex catanhl(long double complex z); -[page 419] (Contents) +[page 419] (Contents) double complex ccosh(double complex z); float complex ccoshf(float complex z); @@ -16501,7 +16501,7 @@ n No input is consumed. The corresponding argument shall be a pointer to long double creall(long double complex z); -[page 420] (Contents) +[page 420] (Contents) B.3 Character handling <ctype.h> int isalnum(int c); @@ -16542,7 +16542,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 421] (Contents) +[page 421] (Contents) B.6 Characteristics of floating types <float.h> FLT_ROUNDS DBL_MIN_EXP FLT_MAX @@ -16583,7 +16583,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 422] (Contents) +[page 422] (Contents) B.8 Alternative spellings <iso646.h> and bitor not_eq xor @@ -16622,7 +16622,7 @@ n No input is consumed. The corresponding argument shall be a pointer to float asinf(float x); long double asinl(long double x); double atan(double x); -[page 423] (Contents) +[page 423] (Contents) float atanf(float x); long double atanl(long double x); @@ -16666,7 +16666,7 @@ n No input is consumed. The corresponding argument shall be a pointer to float expm1f(float x); long double expm1l(long double x); -[page 424] (Contents) +[page 424] (Contents) double frexp(double value, int *exp); float frexpf(float value, int *exp); @@ -16710,7 +16710,7 @@ n No input is consumed. The corresponding argument shall be a pointer to double hypot(double x, double y); float hypotf(float x, float y); -[page 425] (Contents) +[page 425] (Contents) long double hypotl(long double x, long double y); double pow(double x, double y); @@ -16754,7 +16754,7 @@ n No input is consumed. The corresponding argument shall be a pointer to long double roundl(long double x); long int lround(double x); -[page 426] (Contents) +[page 426] (Contents) long int lroundf(float x); long int lroundl(long double x); @@ -16798,7 +16798,7 @@ n No input is consumed. The corresponding argument shall be a pointer to double fma(double x, double y, double z); float fmaf(float x, float y, float z); -[page 427] (Contents) +[page 427] (Contents) long double fmal(long double x, long double y, long double z); @@ -16833,7 +16833,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 428] (Contents) +[page 428] (Contents) B.16 Common definitions <stddef.h> ptrdiff_t size_t wchar_t NULL @@ -16873,7 +16873,7 @@ n No input is consumed. The corresponding argument shall be a pointer to char * restrict buf); -[page 429] (Contents) +[page 429] (Contents) int setvbuf(FILE * restrict stream, char * restrict buf, @@ -16917,7 +16917,7 @@ n No input is consumed. The corresponding argument shall be a pointer to int ungetc(int c, FILE *stream); -[page 430] (Contents) +[page 430] (Contents) size_t fread(void * restrict ptr, size_t size, size_t nmemb, @@ -16960,7 +16960,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 431] (Contents) +[page 431] (Contents) unsigned long long int strtoull( const char * restrict nptr, @@ -17001,7 +17001,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 432] (Contents) +[page 432] (Contents) B.20 String handling <string.h> size_t @@ -17039,7 +17039,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 433] (Contents) +[page 433] (Contents) B.21 Type-generic math <tgmath.h> acos sqrt fmod nextafter @@ -17076,7 +17076,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 434] (Contents) +[page 434] (Contents) B.23 Extended multibyte/wide character utilities <wchar.h> wchar_t wint_t WCHAR_MAX @@ -17119,7 +17119,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 435] (Contents) +[page 435] (Contents) double wcstod(const wchar_t * restrict nptr, wchar_t ** restrict endptr); @@ -17163,7 +17163,7 @@ n No input is consumed. The corresponding argument shall be a pointer to size_t wcsspn(const wchar_t *s1, const wchar_t *s2); wchar_t *wcsstr(const wchar_t *s1, const wchar_t *s2); -[page 436] (Contents) +[page 436] (Contents) wchar_t *wcstok(wchar_t * restrict s1, const wchar_t * restrict s2, @@ -17205,7 +17205,7 @@ n No input is consumed. The corresponding argument shall be a pointer to int iswupper(wint_t wc); int iswxdigit(wint_t wc); int iswctype(wint_t wc, wctype_t desc); -[page 437] (Contents) +[page 437] (Contents) wctype_t wctype(const char *property); wint_t towlower(wint_t wc); @@ -17216,7 +17216,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 438] (Contents) +[page 438] (Contents) Annex C (informative) @@ -17241,7 +17241,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -[page 439] (Contents) +[page 439] (Contents) Annex D (normative) @@ -17277,7 +17277,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 0AC7-0AC9, 0ACB-0ACD, 0AD0, 0AE0 Oriya: 0B01-0B03, 0B05-0B0C, 0B0F-0B10, 0B13-0B28, 0B2A-0B30, 0B32-0B33, 0B36-0B39, 0B3E-0B43, 0B47-0B48, 0B4B-0B4D, -[page 440] (Contents) +[page 440] (Contents) 0B5C-0B5D, 0B5F-0B61 Tamil: 0B82-0B83, 0B85-0B8A, 0B8E-0B90, 0B92-0B95, 0B99-0B9A, @@ -17315,7 +17315,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 441] (Contents) +[page 441] (Contents) Annex E (informative) @@ -17354,7 +17354,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 4 The values given in the following list shall be replaced by implementation-defined constant expressions that are greater or equal in magnitude (absolute value) to those shown, with the same sign: -[page 442] (Contents) +[page 442] (Contents) #define DBL_DIG 10 #define DBL_MANT_DIG @@ -17393,7 +17393,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 443] (Contents) +[page 443] (Contents) Annex F (normative) @@ -17414,25 +17414,25 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 1 The C floating types match the IEC 60559 formats as follows: -- The float type matches the IEC 60559 single format. -- The double type matches the IEC 60559 double format. - -- The long double type matches an IEC 60559 extended format,307) else a + -- The long double type matches an IEC 60559 extended format,307) else a non-IEC 60559 extended format, else the IEC 60559 double format. Any non-IEC 60559 extended format used for the long double type shall have more - precision than IEC 60559 double and at least the range of IEC 60559 double.308) + precision than IEC 60559 double and at least the range of IEC 60559 double.308) Recommended practice 2 The long double type should match an IEC 60559 extended format. - 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. -[page 444] (Contents) +[page 444] (Contents) F.2.1 Infinities, signed zeros, and NaNs -1 This specification does not define the behavior of signaling NaNs.309) It generally uses +1 This specification does not define the behavior of signaling NaNs.309) It generally uses the term NaN to denote quiet NaNs. The NAN and INFINITY macros and the nan functions in <math.h> provide designations for IEC 60559 NaNs and infinities. F.3 Operators and functions @@ -17465,10 +17465,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, strtold function in <stdlib.h> provides the conv function recommended in the Appendix to ANSI/IEEE 854. - 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. -[page 445] (Contents) +[page 445] (Contents) -- The relational and equality operators provide IEC 60559 comparisons. IEC 60559 identifies a need for additional comparison predicates to facilitate writing code that @@ -17508,7 +17508,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The isnan macro in <math.h> provides the isnan function recommended in the Appendix to IEC 60559. -[page 446] (Contents) +[page 446] (Contents) -- The signbit macro and the fpclassify macro in <math.h>, used in conjunction with the number classification macros (FP_NAN, FP_INFINITE, @@ -17520,10 +17520,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, the range of the integer type, then the ''invalid'' floating-point exception is raised and the resulting value is unspecified. Whether conversion of non-integer floating values whose integral part is within the range of the integer type raises the ''inexact'' floating-point - exception is unspecified.310) + exception is unspecified.310) F.5 Binary-decimal conversion 1 Conversion from the widest supported IEC 60559 format to decimal with - DECIMAL_DIG digits and back is the identity function.311) + DECIMAL_DIG digits and back is the identity function.311) 2 Conversions involving IEC 60559 formats follow all pertinent recommended practice. In particular, conversion between any supported IEC 60559 format and decimal with DECIMAL_DIG or fewer significant digits is correctly rounded (honoring the current @@ -17537,17 +17537,17 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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>. - 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.) -[page 447] (Contents) +[page 447] (Contents) F.6 Contracted expressions 1 A contracted expression treats infinities, NaNs, signed zeros, subnormals, and the @@ -17561,13 +17561,13 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 1 The floating-point environment defined in <fenv.h> includes the IEC 60559 floating- point exception status flags and directed-rounding control modes. It includes also IEC 60559 dynamic rounding precision and trap enablement modes, if the - implementation supports them.312) + implementation supports them.312) F.7.1 Environment management 1 IEC 60559 requires that floating-point operations implicitly raise floating-point exception status flags, and that rounding control modes can be set explicitly to affect result values of floating-point operations. When the state for the FENV_ACCESS pragma (defined in <fenv.h>) is ''on'', these changes to the floating-point state are treated as side effects - which respect sequence points.313) + which respect sequence points.313) F.7.2 Translation 1 During translation the IEC 60559 default modes are in effect: -- The rounding direction mode is rounding to nearest. @@ -17579,14 +17579,14 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 312) This specification does not require dynamic rounding precision nor trap enablement modes. - 313) If the state for the FENV_ACCESS pragma is ''off'', the implementation is free to assume the floating- + 312) This specification does not require dynamic rounding precision nor trap enablement modes. + 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). -[page 448] (Contents) +[page 448] (Contents) - floating-point exception, other than ''inexact'';314) the implementation should then + floating-point exception, other than ''inexact'';314) the implementation should then proceed with the translation of the program. F.7.3 Execution 1 At program startup the floating-point environment is initialized as prescribed by @@ -17601,7 +17601,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, object that has static storage duration, is evaluated (as if) during execution; thus, it is affected by any operative floating-point control modes and raises floating-point exceptions as required by IEC 60559 (provided the state for the FENV_ACCESS pragma - is ''on'').315) + is ''on'').315) 2 EXAMPLE #include <fenv.h> #pragma STDC FENV_ACCESS ON @@ -17617,18 +17617,18 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, point exceptions. On the other hand, for the three automatic initializations the invalid division occurs at - 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. - 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 + 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; + const static double one_third = 1.0/3.0; -[page 449] (Contents) +[page 449] (Contents) execution time. @@ -17655,7 +17655,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, done at translation time. The automatic initialization of u and w require an execution-time conversion to float of the wider value 1.1e75, which raises floating-point exceptions. The automatic initializations of x and y entail execution-time conversion; however, in some expression evaluation methods, the - conversions is not to a narrower format, in which case no floating-point exception is raised.316) The + conversions is not to a narrower format, in which case no floating-point exception is raised.316) The automatic initialization of z entails execution-time conversion, but not to a narrower format, so no floating- point exception is raised. Note that the conversions of the floating constants 1.1e75 and 1.1e75f to their internal representations occur at translation time in all cases. @@ -17663,12 +17663,12 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 450] (Contents) +[page 450] (Contents) F.7.6 Changing the environment 1 Operations defined in 6.5 and functions and macros defined for the standard libraries @@ -17707,7 +17707,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, floating-point exceptions need not be precise: the actual order and number of occurrences of floating-point exceptions (> 1) may vary from what the source code expresses. Thus, the preceding loop could be treated as -[page 451] (Contents) +[page 451] (Contents) if (0 < n) x + 1; F.8.2 Expression transformations @@ -17717,14 +17717,14 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, transformations can be made on IEC 60559 machines and others that round perfectly. 1 * x and x / 1 (->) x The expressions 1 * x, x / 1, and x are equivalent - (on IEC 60559 machines, among others).317) - x / x (->) 1.0 The expressions x / x and 1.0 are not equivalent if x + (on IEC 60559 machines, among others).317) + x / x (->) 1.0 The expressions x / x and 1.0 are not equivalent if x can be zero, infinite, or NaN. x - y (<->) x + (-y) The expressions x - y, x + (-y), and (-y) + x are equivalent (on IEC 60559 machines, among others). x - y (<->) -(y - x) The expressions x - y and -(y - x) are not equivalent because 1 - 1 is +0 but -(1 - 1) is -0 (in the - default rounding direction).318) + default rounding direction).318) x - x (->) 0.0 The expressions x - x and 0.0 are not equivalent if x is a NaN or infinite. 0 * x (->) 0.0 The expressions 0 * x and 0.0 are not equivalent if @@ -17739,16 +17739,16 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, implementation can replace x - 0 by x, even if x - 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: 1/(1/ (+-) (inf)) is (+-) (inf) and conj(csqrt(z)) is csqrt(conj(z)), for complex z. -[page 452] (Contents) +[page 452] (Contents) might be zero. -x (<->) 0 - x The expressions -x and 0 - x are not equivalent if x @@ -17790,7 +17790,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 453] (Contents) +[page 453] (Contents) // calls g without raising ''invalid'' if a and b are unordered if (isless(a,b)) @@ -17809,7 +17809,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, and F.7.5.) An operation on constants that raises no floating-point exception can be folded during translation, except, if the state of the FENV_ACCESS pragma is ''on'', a further check is required to assure that changing the rounding direction to downward does - not alter the sign of the result,319) and implementations that support dynamic rounding + not alter the sign of the result,319) and implementations that support dynamic rounding precision modes shall assure further that the result of the operation raises no floating- point exception when converted to the semantic type of the operation. F.9 Mathematics <math.h> @@ -17831,17 +17831,17 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, rounding direction, a maximal-magnitude finite number -- is returned in lieu of a value - 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. -[page 454] (Contents) +[page 454] (Contents) whose magnitude is too large. 7 The ''underflow'' floating-point exception is raised whenever a result is tiny (essentially - subnormal or zero) and suffers loss of accuracy.320) + subnormal or zero) and suffers loss of accuracy.320) 8 Whether or when library functions raise the ''inexact'' floating-point exception is unspecified, unless explicitly specified otherwise. 9 Whether or when library functions raise an undeserved ''underflow'' floating-point - exception is unspecified.321) Otherwise, as implied by F.7.6, the <math.h> functions do + exception is unspecified.321) Otherwise, as implied by F.7.6, the <math.h> functions do not raise spurious floating-point exceptions (detectable by the user), other than the ''inexact'' floating-point exception. 10 Whether the functions honor the rounding direction mode is implementation-defined, @@ -17865,12 +17865,12 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 455] (Contents) +[page 455] (Contents) F.9.1.2 The asin functions 1 -- asin((+-)0) returns (+-)0. @@ -17880,7 +17880,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 1 -- atan((+-)0) returns (+-)0. -- atan((+-)(inf)) returns (+-)pi /2. F.9.1.4 The atan2 functions -1 -- atan2((+-)0, -0) returns (+-)pi .322) +1 -- atan2((+-)0, -0) returns (+-)pi .322) -- atan2((+-)0, +0) returns (+-)0. -- atan2((+-)0, x) returns (+-)pi for x < 0. -- atan2((+-)0, x) returns (+-)0 for x > 0. @@ -17901,10 +17901,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 456] (Contents) +[page 456] (Contents) F.9.1.7 The tan functions 1 -- tan((+-)0) returns (+-)0. @@ -17935,7 +17935,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 457] (Contents) +[page 457] (Contents) F.9.3 Exponential and logarithmic functions F.9.3.1 The exp functions @@ -17969,7 +17969,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 458] (Contents) +[page 458] (Contents) F.9.3.6 The ldexp functions 1 On a binary system, ldexp(x, exp) is equivalent to scalbn(x, exp). @@ -18001,7 +18001,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 459] (Contents) +[page 459] (Contents) F.9.3.12 The modf functions 1 -- modf((+-)x, iptr) returns a result with the same sign as x. @@ -18037,7 +18037,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 460] (Contents) +[page 460] (Contents) F.9.4.3 The hypot functions 1 -- hypot(x, y), hypot(y, x), and hypot(x, -y) are equivalent. @@ -18069,7 +18069,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 461] (Contents) +[page 461] (Contents) F.9.4.5 The sqrt functions 1 sqrt is fully specified as a basic arithmetic operation in IEC 60559. @@ -18102,7 +18102,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 462] (Contents) +[page 462] (Contents) #include <math.h> #include <fenv.h> @@ -18140,7 +18140,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 463] (Contents) +[page 463] (Contents) F.9.6.6 The round functions 1 -- round((+-)0) returns (+-)0. @@ -18178,7 +18178,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 464] (Contents) +[page 464] (Contents) F.9.7 Remainder functions F.9.7.1 The fmod functions @@ -18212,7 +18212,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 465] (Contents) +[page 465] (Contents) F.9.8.3 The nextafter functions 1 -- nextafter(x, y) raises the ''overflow'' and ''inexact'' floating-point exceptions @@ -18227,7 +18227,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, F.9.9.2 The fmax functions 1 If just one argument is a NaN, the fmax functions return the other argument (if both arguments are NaNs, the functions return a NaN). -2 The body of the fmax function might be323) +2 The body of the fmax function might be323) { return (isgreaterequal(x, y) || isnan(y)) ? x : y; } F.9.9.3 The fmin functions @@ -18245,16 +18245,16 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 466] (Contents) +[page 466] (Contents) Annex G (informative) IEC 60559-compatible complex arithmetic G.1 Introduction -1 This annex supplements annex F to specify complex arithmetic for compatibility with +1 This annex supplements annex F to specify complex arithmetic for compatibility with IEC 60559 real floating-point arithmetic. Although these specifications have been carefully designed, there is little existing practice to validate the design decisions. Therefore, these specifications are not normative, but should be viewed more as @@ -18282,14 +18282,14 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 467] (Contents) +[page 467] (Contents) G.4 Conversions G.4.1 Imaginary types 1 Conversions among imaginary types follow rules analogous to those for real floating types. G.4.2 Real and imaginary -1 When a value of imaginary type is converted to a real type other than _Bool,324) the +1 When a value of imaginary type is converted to a real type other than _Bool,324) the result is a positive zero. 2 When a value of real type is converted to an imaginary type, the result is a positive imaginary zero. @@ -18313,12 +18313,12 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 324) See 6.3.1.2. + 324) See 6.3.1.2. -[page 468] (Contents) +[page 468] (Contents) G.5.1 Multiplicative operators - Semantics + Semantics 1 If one operand has real type and the other operand has imaginary type, then the result has imaginary type. If both operands have imaginary type, then the result has real type. (If either operand has complex type, then the result has complex type.) @@ -18341,7 +18341,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, x + iy (x/u) + i(y/u) (y/v) + i(-x/v) 4 The * and / operators satisfy the following infinity properties for all real, imaginary, and - complex operands:325) + complex operands:325) -- if one operand is an infinity and the other operand is a nonzero finite number or an infinity, then the result of the * operator is an infinity; -- if the first operand is an infinity and the second operand is a finite number, then the @@ -18352,10 +18352,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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''). -[page 469] (Contents) +[page 469] (Contents) -- if the first operand is a nonzero finite number or an infinity and the second operand is a zero, then the result of the / operator is an infinity. @@ -18381,16 +18381,16 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, int recalc = 0; if ( isinf(a) || isinf(b) ) { // z is infinite /* "Box" the infinity and change NaNs in the other factor to 0 */ - a = copysign(isinf(a) ? 1.0 : 0.0, a); - b = copysign(isinf(b) ? 1.0 : 0.0, b); + a = copysign(isinf(a) ? 1.0 : 0.0, a); + b = copysign(isinf(b) ? 1.0 : 0.0, b); if (isnan(c)) c = copysign(0.0, c); if (isnan(d)) d = copysign(0.0, d); recalc = 1; } if ( isinf(c) || isinf(d) ) { // w is infinite /* "Box" the infinity and change NaNs in the other factor to 0 */ - c = copysign(isinf(c) ? 1.0 : 0.0, c); - d = copysign(isinf(d) ? 1.0 : 0.0, d); + c = copysign(isinf(c) ? 1.0 : 0.0, c); + d = copysign(isinf(d) ? 1.0 : 0.0, d); if (isnan(a)) a = copysign(0.0, a); if (isnan(b)) b = copysign(0.0, b); recalc = 1; @@ -18406,7 +18406,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, } if (recalc) { -[page 470] (Contents) +[page 470] (Contents) x = INFINITY * ( a * c - b * d ); y = INFINITY * ( a * d + b * c ); @@ -18446,19 +18446,19 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, } else if ((isinf(a) || isinf(b)) && isfinite(c) && isfinite(d)) { - a = copysign(isinf(a) ? 1.0 : 0.0, a); - b = copysign(isinf(b) ? 1.0 : 0.0, b); + a = copysign(isinf(a) ? 1.0 : 0.0, a); + b = copysign(isinf(b) ? 1.0 : 0.0, b); x = INFINITY * ( a * c + b * d ); y = INFINITY * ( b * c - a * d ); } else if (isinf(logbw) && isfinite(a) && isfinite(b)) { - c = copysign(isinf(c) ? 1.0 : 0.0, c); - d = copysign(isinf(d) ? 1.0 : 0.0, d); + c = copysign(isinf(c) ? 1.0 : 0.0, c); + d = copysign(isinf(d) ? 1.0 : 0.0, d); x = 0.0 * ( a * c + b * d ); y = 0.0 * ( b * c - a * d ); -[page 471] (Contents) +[page 471] (Contents) } } @@ -18470,7 +18470,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, with division, provides better roundoff characteristics. G.5.2 Additive operators - Semantics + Semantics 1 If both operands have imaginary type, then the result has imaginary type. (If one operand has real type and the other operand has imaginary type, or if either operand has complex type, then the result has complex type.) @@ -18498,7 +18498,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, particularly suited to IEC 60559 implementations. For families of functions, the specifications apply to all of the functions even though only the principal function is -[page 472] (Contents) +[page 472] (Contents) shown. Unless otherwise specified, where the symbol ''(+-)'' occurs in both an argument and the result, the result has the same sign as the argument. @@ -18507,12 +18507,12 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 4 Since complex and imaginary values are composed of real values, each function may be regarded as computing real values from real values. Except as noted, the functions treat real infinities, NaNs, signed zeros, subnormals, and the floating-point exception flags in a - manner consistent with the specifications for real functions in F.9.326) + manner consistent with the specifications for real functions in F.9.326) 5 The functions cimag, conj, cproj, and creal are fully specified for all implementations, including IEC 60559 ones, in 7.3.9. These functions raise no floating- point exceptions. 6 Each of the functions cabs and carg is specified by a formula in terms of a real - function (whose special cases are covered in annex F): + function (whose special cases are covered in annex F): cabs(x + iy) = hypot(x, y) carg(x + iy) = atan2(y, x) 7 Each of the functions casin, catan, ccos, csin, and ctan is specified implicitly by @@ -18534,10 +18534,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 473] (Contents) +[page 473] (Contents) G.6.1 Trigonometric functions G.6.1.1 The cacos functions @@ -18571,7 +18571,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- cacosh((+-)(inf) + iNaN) returns +(inf) + iNaN. -[page 474] (Contents) +[page 474] (Contents) -- cacosh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-point exception, for finite y. @@ -18605,7 +18605,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- catanh(+(inf) + i (inf)) returns +0 + ipi /2. -- catanh(+(inf) + iNaN) returns +0 + iNaN. -[page 475] (Contents) +[page 475] (Contents) -- catanh(NaN + iy) returns NaN + iNaN and optionally raises the ''invalid'' floating-point exception, for finite y. @@ -18640,7 +18640,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, unspecified) and raises the ''invalid'' floating-point exception. -- csinh(+0 + iNaN) returns (+-)0 + iNaN (where the sign of the real part of the result is unspecified). -[page 476] (Contents) +[page 476] (Contents) -- csinh(x + i (inf)) returns NaN + iNaN and raises the ''invalid'' floating-point exception, for positive finite x. @@ -18676,7 +18676,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 477] (Contents) +[page 477] (Contents) G.6.3 Exponential and logarithmic functions G.6.3.1 The cexp functions @@ -18711,7 +18711,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- clog(x + iNaN) returns NaN + iNaN and optionally raises the ''invalid'' floating- point exception, for finite x. -[page 478] (Contents) +[page 478] (Contents) -- clog(-(inf) + iy) returns +(inf) + ipi , for finite positive-signed y. -- clog(+(inf) + iy) returns +(inf) + i0, for finite positive-signed y. @@ -18725,7 +18725,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, G.6.4 Power and absolute-value functions G.6.4.1 The cpow functions 1 The cpow functions raise floating-point exceptions if appropriate for the calculation of - the parts of the result, and may raise spurious exceptions.327) + the parts of the result, and may raise spurious exceptions.327) G.6.4.2 The csqrt functions 1 -- csqrt(conj(z)) = conj(csqrt(z)). -- csqrt((+-)0 + i0) returns +0 + i0. @@ -18744,10 +18744,10 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, - 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. -[page 479] (Contents) +[page 479] (Contents) G.7 Type-generic math <tgmath.h> 1 Type-generic macros that accept complex arguments also accept imaginary arguments. If @@ -18773,7 +18773,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 480] (Contents) +[page 480] (Contents) Annex H (informative) @@ -18781,7 +18781,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, H.1 Introduction 1 This annex documents the extent to which the C language supports the ISO/IEC 10967-1 standard for language-independent arithmetic (LIA-1). LIA-1 is more general than - IEC 60559 (annex F) in that it covers integer and diverse floating-point arithmetics. + IEC 60559 (annex F) in that it covers integer and diverse floating-point arithmetics. H.2 Types 1 The relevant C arithmetic types meet the requirements of LIA-1 types if an implementation adds notification of exceptional arithmetic operations and meets the 1 @@ -18807,7 +18807,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 481] (Contents) +[page 481] (Contents) H.2.2.1 Integer operations 1 The integer operations on integer types are the following: @@ -18830,7 +18830,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, LIA-1. If an implementation adds support for the LIA-1 exceptional values ''underflow'', ''floating_overflow'', and ''"undefined'', then those types are conformant with LIA-1. An implementation that uses IEC 60559 floating-point formats and - operations (see annex F) along with IEC 60559 status flags and traps has LIA-1 + operations (see annex F) along with IEC 60559 status flags and traps has LIA-1 conformant types. H.2.3.1 Floating-point parameters 1 The parameters for a floating point data type can be accessed by the following: @@ -18841,7 +18841,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 2 The derived constants for the floating point types are accessed by the following: -[page 482] (Contents) +[page 482] (Contents) fmax FLT_MAX, DBL_MAX, LDBL_MAX fminN FLT_MIN, DBL_MIN, LDBL_MIN @@ -18855,7 +18855,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, divF x / y negF -x absF fabsf(x), fabs(x), fabsl(x) - exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x) + exponentF 1.f+logbf(x), 1.0+logb(x), 1.L+logbl(x) scaleF scalbnf(x, n), scalbn(x, n), scalbnl(x, n), scalblnf(x, li), scalbln(x, li), scalblnl(x, li) intpartF modff(x, &y), modf(x, &y), modfl(x, &y) @@ -18874,7 +18874,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 2 The FLT_ROUNDS parameter can be used to indicate the LIA-1 rounding styles: truncate FLT_ROUNDS == 0 -[page 483] (Contents) +[page 483] (Contents) nearest FLT_ROUNDS == 1 other FLT_ROUNDS != 0 && FLT_ROUNDS != 1 @@ -18912,7 +18912,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 484] (Contents) +[page 484] (Contents) H.3 Notification 1 Notification is the process by which a user or program is informed that an exceptional @@ -18948,7 +18948,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, where i is an expression of type int representing a subset of the LIA-1 indicators. 4 C allows an implementation to provide the following LIA-1 required behavior: at program termination if any indicator is set the implementation shall send an unambiguous -[page 485] (Contents) +[page 485] (Contents) and ''hard to ignore'' message (see LIA-1 subclause 6.1.2) 5 LIA-1 does not make the distinction between floating-point and integer for ''undefined''. @@ -18970,7 +18970,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 486] (Contents) +[page 486] (Contents) Annex I (informative) @@ -19005,7 +19005,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- A statement with no apparent effect is encountered (6.8). -- A constant expression is used as the controlling expression of a selection statement (6.8.4). -[page 487] (Contents) +[page 487] (Contents) -- An incorrectly formed preprocessing group is encountered while skipping a preprocessing group (6.10.1). @@ -19014,7 +19014,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 488] (Contents) +[page 488] (Contents) Annex J (informative) @@ -19048,7 +19048,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The order in which subexpressions are evaluated and the order in which side effects take place, except as specified for the function-call (), &&, ||, ?:, and comma operators (6.5). -[page 489] (Contents) +[page 489] (Contents) -- The order in which the function designator, arguments, and subexpressions within the arguments are evaluated in a function call (6.5.2.2). @@ -19085,7 +19085,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, range of the return type (7.12.6.5, F.9.3.5). -- The result of rounding when the value is out of range (7.12.9.5, 7.12.9.7, F.9.6.5). -[page 490] (Contents) +[page 490] (Contents) -- The value stored by the remquo functions in the object pointed to by quo when y is zero (7.12.10.3). @@ -19123,7 +19123,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 491] (Contents) +[page 491] (Contents) -- Whether or when library functions in <math.h> raise the ''inexact'' floating-point exception in an IEC 60559 conformant implementation (F.9). @@ -19160,7 +19160,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- A trap representation is read by an lvalue expression that does not have character type (6.2.6.1). -[page 492] (Contents) +[page 492] (Contents) -- A trap representation is produced by a side effect that modifies any part of the object using an lvalue expression that does not have character type (6.2.6.1). @@ -19197,7 +19197,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The identifier __func__ is explicitly declared (6.4.2.2). -[page 493] (Contents) +[page 493] (Contents) -- The program attempts to modify a string literal (6.4.5). -- The characters ', \, ", //, or /* occur in the sequence between the < and > @@ -19235,7 +19235,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- Pointers that do not point into, or just beyond, the same array object are subtracted (6.5.6). -[page 494] (Contents) +[page 494] (Contents) -- An array subscript is out of range, even if an object is apparently accessible with the given subscript (as in the lvalue expression a[1][7] given the declaration int @@ -19274,7 +19274,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- A structure or union is defined as containing no named members (6.7.2.1). -[page 495] (Contents) +[page 495] (Contents) -- An attempt is made to access, or generate a pointer to just past, a flexible array member of a structure when the referenced object provides no elements for that array @@ -19312,7 +19312,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, compatible return types, or their parameters disagree in use of the ellipsis terminator or the number and type of parameters (after default argument promotion, when there is no parameter type list or when one type is specified by a function definition with an -[page 496] (Contents) +[page 496] (Contents) identifier list) (6.7.5.3). -- The value of an unnamed member of a structure or union is used (6.7.8). @@ -19349,7 +19349,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The result of the preprocessing operator ## is not a valid preprocessing token (6.10.3.3). -[page 497] (Contents) +[page 497] (Contents) -- The #line preprocessing directive that results after expansion does not match one of the two well-defined forms, or its digit sequence specifies zero or a number greater @@ -19386,7 +19386,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The argument to the assert macro does not have a scalar type (7.2). -- The CX_LIMITED_RANGE, FENV_ACCESS, or FP_CONTRACT pragma is used in any context other than outside all external declarations or preceding all explicit -[page 498] (Contents) +[page 498] (Contents) declarations and statements inside a compound statement (7.3.4, 7.6.1, 7.12.2). -- The value of an argument to a character handling function is neither equal to the value @@ -19424,7 +19424,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, invocation of the corresponding setjmp macro, that was changed between the setjmp invocation and longjmp call (7.13.2.1). -[page 499] (Contents) +[page 499] (Contents) -- The program specifies an invalid pointer to a signal handler function (7.14.1.1). -- A signal handler returns when the signal corresponded to a computational exception @@ -19462,7 +19462,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The parameter parmN of a va_start macro is declared with the register storage class, with a function or array type, or with a type that is not compatible with the type that results after application of the default argument promotions (7.15.1.4). -[page 500] (Contents) +[page 500] (Contents) -- The member designator parameter of an offsetof macro is an invalid right operand of the . operator for the type parameter, or designates a bit-field (7.17). @@ -19501,7 +19501,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, conversion specifier other than those described (7.19.6.1, 7.24.2.1). -[page 501] (Contents) +[page 501] (Contents) -- A conversion specification for one of the formatted input/output functions uses a length modifier with a conversion specifier other than those described (7.19.6.1, @@ -19540,7 +19540,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 7.24.2.5, 7.24.2.6, 7.24.2.7, 7.24.2.8, 7.24.2.9, 7.24.2.10). -- The contents of the array supplied in a call to the fgets, gets, or fgetws function are used after a read error occurred (7.19.7.2, 7.19.7.7, 7.24.3.2). -[page 502] (Contents) +[page 502] (Contents) -- The file position indicator for a binary stream is used after a call to the ungetc function where its value was zero before the call (7.19.7.11). @@ -19578,7 +19578,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, inconsistently (7.20.5). -[page 503] (Contents) +[page 503] (Contents) -- The array being searched by the bsearch function does not have its elements in proper order (7.20.5.1). @@ -19617,7 +19617,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 504] (Contents) +[page 504] (Contents) J.3 Implementation-defined behavior 1 A conforming implementation is required to document its choice of behavior in each of @@ -19651,7 +19651,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 505] (Contents) +[page 505] (Contents) J.3.4 Characters 1 -- The number of bits in a byte (3.6). @@ -19689,7 +19689,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 506] (Contents) +[page 506] (Contents) -- The results of some bitwise operations on signed integers (6.5). J.3.6 Floating point @@ -19723,7 +19723,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 507] (Contents) +[page 507] (Contents) J.3.8 Hints 1 -- The extent to which suggestions made by using the register storage-class @@ -19759,7 +19759,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The method by which preprocessing tokens (possibly resulting from macro expansion) in a #include directive are combined into a header name (6.10.2). -[page 508] (Contents) +[page 508] (Contents) -- The nesting limit for #include processing (6.10.2). -- Whether the # operator inserts a \ character before the \ character that begins a @@ -19797,7 +19797,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 509] (Contents) +[page 509] (Contents) -- Whether a domain error occurs or zero is returned when a remquo function has a second argument of zero (7.12.10.3). @@ -19833,7 +19833,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -- The interpretation of a - character that is neither the first nor the last character, nor the second where a ^ character is the first, in the scanlist for %[ conversion in the fscanf or fwscanf function (7.19.6.2, 7.24.2.1). -[page 510] (Contents) +[page 510] (Contents) -- The set of sequences matched by a %p conversion and the interpretation of the corresponding input item in the fscanf or fwscanf function (7.19.6.2, 7.24.2.2). @@ -19870,7 +19870,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 511] (Contents) +[page 511] (Contents) J.4 Locale-specific behavior 1 The following characteristics of a hosted environment are locale-specific and are required @@ -19901,7 +19901,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 512] (Contents) +[page 512] (Contents) J.5 Common extensions 1 The following extensions are widely used in many systems, but are not portable to all @@ -19935,7 +19935,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 513] (Contents) +[page 513] (Contents) J.5.7 Function pointer casts 1 A pointer to an object or to void may be cast to a pointer to a function, allowing data to @@ -19969,7 +19969,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 514] (Contents) +[page 514] (Contents) J.5.14 Extra arguments for signal handlers 1 Handlers for specific signals are called with extra arguments in addition to the signal @@ -19990,7 +19990,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 515] (Contents) +[page 515] (Contents) Bibliography @@ -20027,7 +20027,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, 18. ISO/IEC 10646-1:1993, Information technology -- Universal Multiple-Octet Coded Character Set (UCS) -- Part 1: Architecture and Basic Multilingual Plane. -[page 516] (Contents) +[page 516] (Contents) 19. ISO/IEC 10646-1/COR1:1996, Technical Corrigendum 1 to ISO/IEC 10646-1:1993. @@ -20059,11 +20059,11 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, -[page 517] (Contents) +[page 517] (Contents) -[page 518] (Contents) +[page 518] (Contents) Index @@ -20117,7 +20117,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, ++ (prefix increment operator), 6.3.2.1, 6.5.3.1 <stdint.h> header, 4, 5.2.4.2, 6.10.1, 7.8, += (addition assignment operator), 6.5.16.2 7.18, 7.26.8 , (comma operator), 6.5.17 -[page 519] (Contents) +[page 519] (Contents) <stdio.h> header, 5.2.4.2.2, 7.19, 7.26.9, F __cplusplus macro, 6.10.8 <stdlib.h> header, 5.2.4.2.2, 7.20, 7.26.10, F __DATE__ macro, 6.10.8 @@ -20171,7 +20171,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, __bool_true_false_are_defined abstract declarator, 6.7.6 macro, 7.16 abstract machine, 5.1.2.3 -[page 520] (Contents) +[page 520] (Contents) access, 3.1, 6.7.3 array accuracy, see floating-point accuracy argument, 6.9.1 @@ -20225,7 +20225,7 @@ arithmetic operators atoll function, < arithmetic types, 6.2.5 basic character set, 3.6, 3.7.2, 5.2.1 arithmetic, pointer, 6.5.6 basic types, 6.2.5 -[page 521] (Contents) +[page 521] (Contents) behavior, 3.4 call by value, 6.5.2.2 binary streams, 7.19.2, 7.19.7.11, 7.19.9.2, calloc function, 7.20.3, 7.20.3.1, 7.20.3.2, @@ -20279,7 +20279,7 @@ cacosh functions, 7.3.6.1, G.6.2.1 calendar time, 7.23.1, 7.23.2.2, 7.23.2.3, 7.23.2.4, extensible, 7.25.2.2 7.23.3.2, 7.23.3.3, 7.23.3.4 character constant, 5.1.1.2, 5.2.1, 6.4.4.4 -[page 522] (Contents) +[page 522] (Contents) character display semantics, 5.2.2 complex.h header, 5.2.4.2.2, 7.3, 7.22, 7.26.1, character handling header, 7.4, 7.11.1.1 G.6, J.5.17 @@ -20333,7 +20333,7 @@ complex type conversion, 6.3.1.6, 6.3. complex type domain, 6.2.5 function, 6.3.2.1 complex types, 6.2.5, 6.7.2, G function argument, 6.5.2.2, 6.9.1 -[page 523] (Contents) +[page 523] (Contents) function designators, 6.3.2.1 type-generic macro for, 7.22 function parameter, 6.9.1 csinh functions, 7.3.6.5, G.6.2.5 @@ -20387,7 +20387,7 @@ creal functions, 7.3.9.5, G.6 creal type-generic macro, 7.22, G.7 function, 6.9.1 csin functions, 7.3.5.5, G.6 derived declarator types, 6.2.5 -[page 524] (Contents) +[page 524] (Contents) derived types, 6.2.5 end-of-file indicator, 7.19.1, 7.19.5.3, 7.19.7.1, designated initializer, 6.7.8 7.19.7.5, 7.19.7.6, 7.19.7.11, 7.19.9.2, @@ -20441,7 +20441,7 @@ encoding error, 7.19.3, 7.24.3.1, 7.24.6.3.2, 7.24.6.3.3, 7.24.6.4.1, 7.24.6.4.2 encoding, see encoding error end-of-file, 7.24.1 range, see range error -[page 525] (Contents) +[page 525] (Contents) error conditions, 7.12.1 extended characters, 5.2.1 error functions, 7.12.8, F.9.5 extended integer types, 6.2.5, 6.3.1.1, 6.4.4.1, @@ -20495,7 +20495,7 @@ expression, 6.5 expression statement, 6.8.3 fetestexcept function, 7.6.2, 7.6.2.5, F.3 extended character set, 3.7.2, 5.2.1, 5.2.1.2 feupdateenv function, 7.6.4.2, 7.6.4.4, F.3 -[page 526] (Contents) +[page 526] (Contents) fexcept_t type, 7.6, F.3 floating-point status flag, 7.6, F.7.6 fflush function, 7.19.5.2, 7.19.5.3 floor functions, 7.12.9.2, F.9.6.2 @@ -20549,7 +20549,7 @@ floating-point exception, 7.6, 7.6.2, 5.2.4.2.2, 6.2.5 fpclassify macro, 7.12.3.1, F.3 floating-point rounding mode, 5.2.4.2.2 fpos_t type, 7.19.1, 7.19.2 -[page 527] (Contents) +[page 527] (Contents) fprintf function, 7.8.1, 7.19.1, 7.19.6.1, language, 6.11 7.19.6.2, 7.19.6.3, 7.19.6.5, 7.19.6.6, library, 7.26 @@ -20603,7 +20603,7 @@ function-call operator (( )), 6.5.2.2 function-like macro, 6.10.3 hypot functions, 7.12.7.3, F.9.4.3 future directions hypot type-generic macro, 7.22 -[page 528] (Contents) +[page 528] (Contents) I macro, 7.3.1, 7.3.9.4, G.6 initial position, 5.2.2 identifier, 6.4.2.1, 6.5.1 initial shift state, 5.2.1.2 @@ -20657,7 +20657,7 @@ indirection operator (*), 6.5.2.1, 6.5 inequality operator (!=), 6.5.9 INTMAX_C macro, 7.18.4.2 INFINITY macro, 7.3.9.4, 7.12, F.2.1 INTMAX_MAX macro, 7.8.2.3, 7.8.2.4, 7.18.2.5 -[page 529] (Contents) +[page 529] (Contents) INTMAX_MIN macro, 7.8.2.3, 7.8.2.4, 7.18.2.5 iswalpha function, 7.25.2.1.1, 7.25.2.1.2, intmax_t type, 7.18.1.5, 7.19.6.1, 7.19.6.2, 7.25.2.2.1 @@ -20689,7 +20689,7 @@ islower function, 7.4.1.2, 7.4.1.7 7.4.2.2 isnan macro, 7.12.3.4, F.3 jmp_buf type, 7.13 isnormal macro, 7.12.3.5 jump statements, 6.8.6 -ISO 31-11, 2, 3 +ISO 31-11, 2, 3 ISO 4217, 2, 7.11.2.1 keywords, 6.4.1, G.2, J.5.9, J.5.10 ISO 8601, 2, 7.23.3.5 known constant size, 6.2.5 ISO/IEC 10646, 2, 6.4.2.1, 6.4.3, 6.10.8 @@ -20711,7 +20711,7 @@ isupper function, 7.4.1.2, 7.4.1.117.25.2.1.1, 7.25.2.1.9, LC_NUMERIC macro, 7.11, 7.11.1.1, 7.11.2.1 7.25.2.1.10, 7.25.2.2.1 LC_TIME macro, 7.11, 7.11.1.1, 7.23.3.5 -[page 530] (Contents) +[page 530] (Contents) lconv structure type, 7.11 llabs function, 7.20.6.1 LDBL_DIG macro, 5.2.4.2.2 lldiv function, 7.20.6.2 @@ -20765,7 +20765,7 @@ lines, 5.1.1.2, 7.19.2 linkage, 6.2.2, 6.7, 6.7.4, 6.7.5.2, 6.9, 6.9.2, long integer suffix, l or L, 6.4.4.1 6.11.2 long long int type, 6.2.5, 6.3.1.1, 6.7.2, -[page 531] (Contents) +[page 531] (Contents) 7.19.6.1, 7.19.6.2, 7.24.2.1, 7.24.2.2 mbsinit function, 7.24.6.2.1 long long int type conversion, 6.3.1.1, mbsrtowcs function, 7.24.6.4.1 @@ -20819,7 +20819,7 @@ mbrtowc function, 7.19.3, 7.19.6.1 7.24.2.1, 7.24.2.2, 7.24.6.3.1, 7.24.6.3.2, file, 7.19.3 7.24.6.4.1 internal, 5.2.4.1, 6.4.2.1 -[page 532] (Contents) +[page 532] (Contents) label, 6.2.3 octal-character escape sequence (\octal digits), structure/union member, 6.2.3 6.4.4.4 @@ -20873,7 +20873,7 @@ obsolescence, 6.11, 7.26 octal constant, 6.4.4.1 parse state, 7.19.2 octal digit, 6.4.4.1, 6.4.4.4 permitted form of initializer, 6.6 -[page 533] (Contents) +[page 533] (Contents) perror function, 7.19.10.4 PRIcPTR macros, 7.8.1 phase angle, complex, 7.3.9.1 primary expression, 6.5.1 @@ -20927,7 +20927,7 @@ PRIcLEASTN macros, 7.8.1 PRIcMAX macros, 7.8.1 7.12.9.5, 7.12.9.7, 7.12.11.3, 7.12.12.1, PRIcN macros, 7.8.1 7.12.13.1 -[page 534] (Contents) +[page 534] (Contents) rank, see integer conversion rank same scope, 6.2.1 real floating type conversion, 6.3.1.4, 6.3.1.5, save calling environment function, 7.13.1 @@ -20981,7 +20981,7 @@ rounding mode, floating point, 5.2.4.2.2 rvalue, 6.3.2.1 SHRT_MAX macro, 5.2.4.2.1 SHRT_MIN macro, 5.2.4.2.1 -[page 535] (Contents) +[page 535] (Contents) side effects, 5.1.2.3, 6.5 source lines, 5.1.1.2 SIG_ATOMIC_MAX macro, 7.18.3 source text, 5.1.1.2 @@ -21035,7 +21035,7 @@ source file, 5.1.1.1 name, 6.10.4, 6.10.8 continue, 6.8.6.2 source file inclusion, 6.10.2 do, 6.8.5.2 -[page 536] (Contents) +[page 536] (Contents) else, 6.8.4.1 strictly conforming program, 4 expression, 6.8.3 string, 7.1.1 @@ -21089,7 +21089,7 @@ strerror function, 7.19.10.4, 7.21. strftime function, 7.11.1.1, 7.23.3, 7.23.3.5, subscripting, 6.5.2.1 7.24.5.1 subtraction assignment operator (-=), 6.5.16.2 -[page 537] (Contents) +[page 537] (Contents) subtraction operator (-), 6.5.6, F.3, G.5.2 tolower function, 7.4.2.1 suffix toupper function, 7.4.2.2 @@ -21143,7 +21143,7 @@ token, 5.1.1.2, 6.4, see also preproce token concatenation, 6.10.3.3 UINTMAX_C macro, 7.18.4.2 token pasting, 6.10.3.3 UINTMAX_MAX macro, 7.8.2.3, 7.8.2.4, 7.18.2.5 -[page 538] (Contents) +[page 538] (Contents) uintmax_t type, 7.18.1.5, 7.19.6.1, 7.19.6.2, USHRT_MAX macro, 5.2.4.2.1 7.24.2.1, 7.24.2.2 usual arithmetic conversions, 6.3.1.8, 6.5.5, 6.5.6, @@ -21197,7 +21197,7 @@ unspecified value, 3.17.3 uppercase letter, 5.2.1 vsprintf function, 7.19.6.8, 7.19.6.13 use of library functions, 7.1.4 vsscanf function, 7.19.6.8, 7.19.6.14 -[page 539] (Contents) +[page 539] (Contents) vswprintf function, 7.24.2.7 wctype.h header, 7.25, 7.26.13 vswscanf function, 7.24.2.8 wctype_t type, 7.25.1, 7.25.2.2.2 @@ -21251,4 +21251,5 @@ wctrans function, 7.25.3.2.1, 7. wctrans_t type, 7.25.1, 7.25.3.2.2 wctype function, 7.25.2.2.1, 7.25.2.2.2 -[page 540] (Contents) +[page 540] (Contents) +