From 533cb8614abf721fa173e6e75aee12a277a71af2 Mon Sep 17 00:00:00 2001 From: nsz Date: Mon, 4 Jul 2011 15:10:19 +0200 Subject: [PATCH] bold common headings Syntax|Synopsis|.. --- n1256.html | 2178 +++++++++++++++++++-------------------- n1548.html | 2886 ++++++++++++++++++++++++++-------------------------- tohtml.sh | 5 + 3 files changed, 2537 insertions(+), 2532 deletions(-) diff --git a/n1256.html b/n1256.html index 7235654..d15733a 100644 --- a/n1256.html +++ b/n1256.html @@ -2307,7 +2307,7 @@ Forward references: conditional inclusion (6.10.1), [page 48] (Contents) 6.4 Lexical elements - Syntax + Syntax 1 token: keyword identifier @@ -2322,10 +2322,10 @@ 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 @@ -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,7 +2382,7 @@ 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) @@ -2395,7 +2395,7 @@ Forward references: conditional inclusion (6.10.1), 6.4.2 Identifiers 6.4.2.1 General - Syntax + Syntax 1 identifier: identifier-nondigit identifier identifier-nondigit @@ -2411,7 +2411,7 @@ 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. @@ -2444,7 +2444,7 @@ 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"; @@ -2473,21 +2473,21 @@ Forward references: conditional inclusion (6.10.1), [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 + 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 character name \unnnn designates the character whose four-digit short identifier is nnnn @@ -2504,19 +2504,19 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -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 @@ -2617,7 +2617,7 @@ Forward references: conditional inclusion (6.10.1), [page 56] (Contents) 6.4.4.2 Floating constants - Syntax + Syntax 1 floating-constant: decimal-floating-constant hexadecimal-floating-constant @@ -2655,7 +2655,7 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -2697,14 +2697,14 @@ Forward references: conditional inclusion (6.10.1), [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 ' @@ -2735,7 +2735,7 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -2777,11 +2777,11 @@ Forward references: conditional inclusion (6.10.1), [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. @@ -2826,7 +2826,7 @@ Forward references: conditional inclusion (6.10.1), [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,7 +2846,7 @@ 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 @@ -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) @@ -2909,7 +2909,7 @@ Forward references: conditional inclusion (6.10.1), 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, @@ -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,12 +2966,12 @@ 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. @@ -3093,13 +3093,13 @@ Forward references: conditional inclusion (6.10.1), [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) @@ -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 ] @@ -3135,10 +3135,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -3171,14 +3171,14 @@ Forward references: conditional inclusion (6.10.1), [page 70] (Contents) 6.5.2.2 Function calls - Constraints + 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. @@ -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 @@ -3253,7 +3253,7 @@ Forward references: conditional inclusion (6.10.1), [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 the first expression is an lvalue. If the first expression has qualified type, the result has @@ -3346,10 +3346,10 @@ Forward references: conditional inclusion (6.10.1), [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,14 +3361,14 @@ 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) @@ -3474,7 +3474,7 @@ Forward references: conditional inclusion (6.10.1), [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,12 +3497,12 @@ 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 @@ -3522,10 +3522,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -3553,11 +3553,11 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -3607,16 +3607,16 @@ 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 no conversion has no effect on the type or value of an expression. @@ -3635,16 +3635,16 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -3654,12 +3654,12 @@ Forward references: conditional inclusion (6.10.1), 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.) @@ -3676,7 +3676,7 @@ Forward references: conditional inclusion (6.10.1), 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. @@ -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. @@ -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 @@ -3805,19 +3805,19 @@ Forward references: conditional inclusion (6.10.1), (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 specified relation is true and 0 if it is false. The result has type int. For any pair of @@ -3849,13 +3849,13 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -3873,25 +3873,25 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -3903,26 +3903,26 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -3935,11 +3935,11 @@ Forward references: conditional inclusion (6.10.1), [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,7 +3949,7 @@ 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 @@ -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 @@ -4016,7 +4016,7 @@ Forward references: conditional inclusion (6.10.1), [page 91] (Contents) 6.5.16.1 Simple assignment - Constraints + Constraints 1 One of the following shall hold:96) -- the left operand has qualified or unqualified arithmetic type and the right has arithmetic 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. @@ -4080,13 +4080,13 @@ 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. @@ -4096,11 +4096,11 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -4122,19 +4122,19 @@ Forward references: conditional inclusion (6.10.1), [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) 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 @@ -4190,7 +4190,7 @@ Forward references: conditional inclusion (6.10.1), [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,7 +4212,7 @@ 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; @@ -4236,17 +4236,17 @@ 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 + 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. @@ -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 @@ -4325,7 +4325,7 @@ Forward references: conditional inclusion (6.10.1), -- typedef name 3 The type specifier _Complex shall not be used if the implementation does not provide complex types.104) - Semantics + 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. @@ -4343,7 +4343,7 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -4381,7 +4381,7 @@ Forward references: conditional inclusion (6.10.1), [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. @@ -4509,7 +4509,7 @@ Forward references: conditional inclusion (6.10.1), [page 104] (Contents) 6.7.2.2 Enumeration specifiers - Syntax + Syntax 1 enum-specifier: enum identifieropt { enumerator-list } enum identifieropt { enumerator-list , } @@ -4520,10 +4520,10 @@ 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 enumeration constant as the value of the constant expression. If the first enumerator has @@ -4560,14 +4560,14 @@ 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 of the list defining the content, and complete thereafter. @@ -4652,15 +4652,15 @@ 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) 4 If the same qualifier appears more than once in the same specifier-qualifier-list, either @@ -4838,17 +4838,17 @@ 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 @@ -4907,7 +4907,7 @@ Forward references: conditional inclusion (6.10.1), [page 113] (Contents) 6.7.5 Declarators - Syntax + Syntax 1 declarator: pointeropt direct-declarator direct-declarator: @@ -4937,7 +4937,7 @@ 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. @@ -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 @@ -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,7 +5007,7 @@ 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 ] @@ -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,7 +5106,7 @@ 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 @@ -5239,7 +5239,7 @@ Forward references: conditional inclusion (6.10.1), [page 121] (Contents) 6.7.6 Type names - Syntax + Syntax 1 type-name: specifier-qualifier-list abstract-declaratoropt abstract-declarator: @@ -5255,7 +5255,7 @@ 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) @@ -5284,12 +5284,12 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -5374,7 +5374,7 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -5410,7 +5410,7 @@ Forward references: conditional inclusion (6.10.1), identifier shall be the name of a member of that type. [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. @@ -5632,7 +5632,7 @@ Forward references: conditional inclusion (6.10.1), [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,12 +5658,12 @@ 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. @@ -5671,13 +5671,13 @@ Forward references: conditional inclusion (6.10.1), [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,13 +5686,13 @@ 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) 3 A null statement (consisting of just a semicolon) performs no operations. @@ -5732,21 +5732,21 @@ 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 @@ -5757,7 +5757,7 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -5768,7 +5768,7 @@ Forward references: conditional inclusion (6.10.1), (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 @@ -5808,17 +5808,17 @@ 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) @@ -5853,13 +5853,13 @@ Forward references: conditional inclusion (6.10.1), 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. @@ -5873,11 +5873,11 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -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 @@ -5939,9 +5939,9 @@ Forward references: conditional inclusion (6.10.1), 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) 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. @@ -5952,11 +5952,11 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -5995,14 +5995,14 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -6032,13 +6032,13 @@ Forward references: conditional inclusion (6.10.1), [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) 3 The return type of a function shall be void or an object type other than array type. @@ -6074,7 +6074,7 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -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 @@ -6187,7 +6187,7 @@ Forward references: conditional inclusion (6.10.1), [page 144] (Contents) 6.10 Preprocessing directives - Syntax + Syntax 1 preprocessing-file: groupopt group: @@ -6245,7 +6245,7 @@ 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 @@ -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,7 +6286,7 @@ 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 @@ -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 @@ -6358,10 +6358,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -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,7 +6456,7 @@ 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 @@ -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 @@ -6545,10 +6545,10 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -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. @@ -6764,13 +6764,13 @@ Forward references: conditional inclusion (6.10.1), [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 @@ -6803,7 +6803,7 @@ Forward references: conditional inclusion (6.10.1), [page 159] (Contents) 6.10.7 Null directive - Semantics + Semantics 1 A preprocessing directive of the form # new-line has no effect. @@ -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 @@ -7129,10 +7129,10 @@ 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 @@ -7141,7 +7141,7 @@ replacement, as in: the preprocessing macros __FILE__ and __LINE__ and of the identifier __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). @@ -7211,10 +7211,10 @@ 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 @@ -7241,28 +7241,28 @@ 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. @@ -7270,107 +7270,107 @@ replacement, as in: [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) 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) - 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); @@ -7379,33 +7379,33 @@ replacement, as in: [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); @@ -7415,36 +7415,36 @@ replacement, as in: [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. @@ -7453,31 +7453,31 @@ replacement, as in: [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); @@ -7488,34 +7488,34 @@ replacement, as in: [page 178] (Contents) - Description + Description 2 The cimag functions compute the imaginary part of z.170) - Returns + 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. @@ -7526,14 +7526,14 @@ replacement, as in: [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 + Description 2 The creal functions compute the real part of z.171) - Returns + Returns 3 The creal functions return the real part value. @@ -7559,16 +7559,16 @@ replacement, as in: 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 @@ -7584,29 +7584,29 @@ replacement, as in: 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); @@ -7618,37 +7618,37 @@ replacement, as in: [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 @@ -7658,28 +7658,28 @@ replacement, as in: ('\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 @@ -7691,12 +7691,12 @@ replacement, as in: [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 @@ -7830,10 +7830,10 @@ 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 @@ -7886,13 +7886,13 @@ replacement, as in: 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. @@ -7909,28 +7909,28 @@ replacement, as in: [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 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. @@ -7944,30 +7944,30 @@ replacement, as in: [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 + 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. @@ -7997,24 +7997,24 @@ 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. @@ -8042,20 +8042,20 @@ 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 @@ -8063,33 +8063,33 @@ replacement, as in: [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. @@ -8203,10 +8203,10 @@ 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) @@ -8216,32 +8216,32 @@ replacement, as in: [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 @@ -8255,18 +8255,18 @@ replacement, as in: [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 @@ -8362,10 +8362,10 @@ replacement, as in: 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 @@ -8393,7 +8393,7 @@ replacement, as in: 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 @@ -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. @@ -8547,7 +8547,7 @@ char int_p_sep_by_space 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 @@ -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 @@ -8782,15 +8782,15 @@ char int_p_sep_by_space 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 + 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 @@ -8818,32 +8818,32 @@ char int_p_sep_by_space [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 + 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); @@ -8855,34 +8855,34 @@ char int_p_sep_by_space [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 + Description 2 The signbit macro determines whether the sign of its argument value is negative.207) - Returns + 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. @@ -8894,71 +8894,71 @@ char int_p_sep_by_space [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) 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. @@ -8968,33 +8968,33 @@ char int_p_sep_by_space 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. @@ -9003,70 +9003,70 @@ char int_p_sep_by_space [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) - 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); @@ -9077,31 +9077,31 @@ char int_p_sep_by_space [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 + 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 @@ -9116,33 +9116,33 @@ char int_p_sep_by_space [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); @@ -9153,33 +9153,33 @@ char int_p_sep_by_space [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 + 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. @@ -9190,30 +9190,30 @@ char int_p_sep_by_space [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. @@ -9222,7 +9222,7 @@ char int_p_sep_by_space [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) - 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); @@ -9298,23 +9298,23 @@ char int_p_sep_by_space [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 @@ -9353,82 +9353,82 @@ char int_p_sep_by_space [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) - 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) - 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,24 +9436,24 @@ 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. @@ -9462,7 +9462,7 @@ char int_p_sep_by_space [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,23 +9470,23 @@ 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. @@ -9496,27 +9496,27 @@ char int_p_sep_by_space 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 + Description 2 The remainder functions compute the remainder x REM y required by IEC 60559.210) - Returns + 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. @@ -9531,34 +9531,34 @@ char int_p_sep_by_space [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. @@ -9567,35 +9567,35 @@ char int_p_sep_by_space [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 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. @@ -9606,32 +9606,32 @@ char int_p_sep_by_space [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) 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); @@ -9644,33 +9644,33 @@ char int_p_sep_by_space [page 238] (Contents) - Description + Description 2 The fmax functions determine the maximum numeric value of their arguments.213) - Returns + 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 + Description 2 The fmin functions determine the minimum numeric value of their arguments.214) - Returns + 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. @@ -9694,21 +9694,21 @@ char int_p_sep_by_space 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 @@ -9722,35 +9722,35 @@ char int_p_sep_by_space [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 @@ -9758,15 +9758,15 @@ char int_p_sep_by_space and y twice). [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. @@ -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. @@ -9819,10 +9819,10 @@ 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 @@ -9835,7 +9835,7 @@ char int_p_sep_by_space 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, @@ -9920,10 +9920,10 @@ char int_p_sep_by_space 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. @@ -9963,7 +9963,7 @@ char int_p_sep_by_space 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,14 +9971,14 @@ 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. @@ -10012,10 +10012,10 @@ 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 @@ -10035,27 +10035,27 @@ 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 @@ -10066,13 +10066,13 @@ char int_p_sep_by_space 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 @@ -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 @@ -10718,14 +10718,14 @@ char int_p_sep_by_space [page 268] (Contents) - Returns + 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,15 +10735,15 @@ 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 @@ -10761,7 +10761,7 @@ char int_p_sep_by_space 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,21 +10772,21 @@ 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); @@ -10795,23 +10795,23 @@ char int_p_sep_by_space [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 @@ -10856,17 +10856,17 @@ 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 @@ -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, @@ -10914,7 +10914,7 @@ char int_p_sep_by_space [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 @@ -10925,18 +10925,18 @@ char int_p_sep_by_space 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) 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 @@ -11215,7 +11215,7 @@ s If no l length modifier is present, the argument shall be a pointe 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 @@ -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 @@ -11465,7 +11465,7 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -11587,33 +11587,33 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11623,35 +11623,35 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11663,18 +11663,18 @@ p Matches an implementation-defined set of sequences, which should be the [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 + 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. @@ -11700,34 +11700,34 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -11737,35 +11737,35 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11777,34 +11777,34 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11817,31 +11817,31 @@ p Matches an implementation-defined set of sequences, which should be the 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) 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 @@ -11855,34 +11855,34 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -11892,32 +11892,32 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11930,34 +11930,34 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -11967,10 +11967,10 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -11990,7 +11990,7 @@ p Matches an implementation-defined set of sequences, which should be the For a binary stream, its file position indicator is decremented by each successful call to the ungetc function; if its value was zero before a call, it is indeterminate after the call.256) - Returns + 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). @@ -12004,12 +12004,12 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -12042,30 +12042,30 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -12083,14 +12083,14 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -12118,30 +12118,30 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -12150,35 +12150,35 @@ p Matches an implementation-defined set of sequences, which should be the [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). @@ -12222,30 +12222,30 @@ p Matches an implementation-defined set of sequences, which should be the 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). @@ -12255,7 +12255,7 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -12337,7 +12337,7 @@ p Matches an implementation-defined set of sequences, which should be the stipulation that the error with respect to D should have a correct sign for the current rounding direction.260) - Returns + 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, @@ -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, @@ -12421,29 +12421,29 @@ p Matches an implementation-defined set of sequences, which should be the 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; @@ -12475,19 +12475,19 @@ 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 + 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 @@ -12500,22 +12500,22 @@ p Matches an implementation-defined set of sequences, which should be the 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. @@ -12538,35 +12538,35 @@ p Matches an implementation-defined set of sequences, which should be the 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) @@ -12583,20 +12583,20 @@ 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. @@ -12608,30 +12608,30 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -12664,12 +12664,12 @@ 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 @@ -12689,16 +12689,16 @@ p Matches an implementation-defined set of sequences, which should be the 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 + 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,7 +12707,7 @@ 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. @@ -12719,26 +12719,26 @@ p Matches an implementation-defined set of sequences, which should be the 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 + 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), @@ -12762,16 +12762,16 @@ p Matches an implementation-defined set of sequences, which should be the 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), @@ -12789,12 +12789,12 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -12828,7 +12828,7 @@ p Matches an implementation-defined set of sequences, which should be the [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,7 +12854,7 @@ 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) @@ -12867,12 +12867,12 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -12912,16 +12912,16 @@ 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. @@ -12932,35 +12932,35 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -12973,28 +12973,28 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -13008,7 +13008,7 @@ p Matches an implementation-defined set of sequences, which should be the [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,24 +13017,24 @@ 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 + 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 @@ -13046,35 +13046,35 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -13086,7 +13086,7 @@ p Matches an implementation-defined set of sequences, which should be the 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,58 +13096,58 @@ 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) 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. @@ -13157,31 +13157,31 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -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,13 +13217,13 @@ 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. @@ -13232,25 +13232,25 @@ p Matches an implementation-defined set of sequences, which should be the [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. @@ -13417,12 +13417,12 @@ p Matches an implementation-defined set of sequences, which should be the 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 @@ -13430,13 +13430,13 @@ p Matches an implementation-defined set of sequences, which should be the the processor time used is not available or its value cannot be represented, the function 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. @@ -13448,10 +13448,10 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -13461,7 +13461,7 @@ p Matches an implementation-defined set of sequences, which should be the 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). @@ -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,10 +13515,10 @@ 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 @@ -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). @@ -13565,33 +13565,33 @@ p Matches an implementation-defined set of sequences, which should be the [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 @@ -13729,7 +13729,7 @@ p Matches an implementation-defined set of sequences, which should be the [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, @@ -13787,12 +13787,12 @@ p Matches an implementation-defined set of sequences, which should be the 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) 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 @@ -14049,7 +14049,7 @@ p The argument shall be a pointer to void. The value of the pointer i 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. @@ -14078,12 +14078,12 @@ p The argument shall be a pointer to void. The value of the pointer i 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 @@ -14274,7 +14274,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -14310,31 +14310,31 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -14346,19 +14346,19 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 + 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 @@ -14386,37 +14386,37 @@ n No input is consumed. The corresponding argument shall be a pointer to [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. @@ -14425,34 +14425,34 @@ n No input is consumed. The corresponding argument shall be a pointer to [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. @@ -14462,59 +14462,59 @@ n No input is consumed. The corresponding argument shall be a pointer to [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) - 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 @@ -14522,12 +14522,12 @@ n No input is consumed. The corresponding argument shall be a pointer to 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) 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 @@ -14540,69 +14540,69 @@ n No input is consumed. The corresponding argument shall be a pointer to 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) 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) 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); @@ -14613,36 +14613,36 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -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 @@ -14688,7 +14688,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -14777,7 +14777,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 + 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 @@ -14795,7 +14795,7 @@ n No input is consumed. The corresponding argument shall be a pointer to [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, @@ -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,44 +14862,44 @@ 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) 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) 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. @@ -14911,37 +14911,37 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -14950,32 +14950,32 @@ n No input is consumed. The corresponding argument shall be a pointer to the wide string pointed to by s1. The initial wide character of s2 overwrites the null wide character at the end of s1. A terminating null wide character is always appended to the result.298) - Returns + 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 @@ -14988,25 +14988,25 @@ n No input is consumed. The corresponding argument shall be a pointer to 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. @@ -15027,33 +15027,33 @@ n No input is consumed. The corresponding argument shall be a pointer to 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. @@ -15062,61 +15062,61 @@ n No input is consumed. The corresponding argument shall be a pointer to [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) 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 @@ -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,14 +15158,14 @@ 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. @@ -15176,33 +15176,33 @@ n No input is consumed. The corresponding argument shall be a pointer to 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. @@ -15214,7 +15214,7 @@ n No input is consumed. The corresponding argument shall be a pointer to -- 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 @@ -15253,41 +15253,41 @@ n No input is consumed. The corresponding argument shall be a pointer to 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) - 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). @@ -15322,13 +15322,13 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -15361,12 +15361,12 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -15400,13 +15400,13 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -15421,7 +15421,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -15436,13 +15436,13 @@ n No input is consumed. The corresponding argument shall be a pointer to [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 @@ -15458,7 +15458,7 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -15521,17 +15521,17 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -15545,30 +15545,30 @@ n No input is consumed. The corresponding argument shall be a pointer to wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace 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); @@ -15580,33 +15580,33 @@ n No input is consumed. The corresponding argument shall be a pointer to [page 395] (Contents) - Description + Description 2 The iswgraph function tests for any wide character for which iswprint is true and 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); @@ -15618,23 +15618,23 @@ n No input is consumed. The corresponding argument shall be a pointer to [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. @@ -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. * @@ -15694,24 +15694,24 @@ n No input is consumed. The corresponding argument shall be a pointer to 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 @@ -15728,10 +15728,10 @@ n No input is consumed. The corresponding argument shall be a pointer to [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. @@ -18318,7 +18318,7 @@ Special characters: 00B5, 00B7, 02B0-02B8, 02BB, 02BD-02C1, 02D0-02D1, [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.) @@ -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.) diff --git a/n1548.html b/n1548.html index d09b7a6..03cda3f 100644 --- a/n1548.html +++ b/n1548.html @@ -2887,7 +2887,7 @@ Forward references: conditional inclusion (6.10.1), [page 56] (Contents) 6.4 Lexical elements - Syntax + Syntax 1 token: keyword identifier @@ -2902,10 +2902,10 @@ 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 @@ -2950,7 +2950,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 alignof goto union auto if unsigned @@ -2967,7 +2967,7 @@ Forward references: conditional inclusion (6.10.1), extern struct _Static_assert float switch _Thread_local for typedef - 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 [page 58] (Contents) @@ -2975,7 +2975,7 @@ Forward references: conditional inclusion (6.10.1), specifying imaginary types.70) 6.4.2 Identifiers 6.4.2.1 General - Syntax + Syntax 1 identifier: identifier-nondigit identifier identifier-nondigit @@ -2991,7 +2991,7 @@ 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. @@ -3026,7 +3026,7 @@ 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"; @@ -3055,21 +3055,21 @@ Forward references: conditional inclusion (6.10.1), [page 60] (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.73) - Description + 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.74) Similarly, the universal character name \unnnn designates the character whose four-digit short identifier is nnnn @@ -3087,19 +3087,19 @@ Forward references: conditional inclusion (6.10.1), [page 61] (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 @@ -3140,7 +3140,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 @@ -3148,7 +3148,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 @@ -3200,7 +3200,7 @@ Forward references: conditional inclusion (6.10.1), [page 64] (Contents) 6.4.4.2 Floating constants - Syntax + Syntax 1 floating-constant: decimal-floating-constant hexadecimal-floating-constant @@ -3238,7 +3238,7 @@ Forward references: conditional inclusion (6.10.1), [page 65] (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 @@ -3246,7 +3246,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 @@ -3280,14 +3280,14 @@ Forward references: conditional inclusion (6.10.1), [page 66] (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 ' @@ -3321,7 +3321,7 @@ Forward references: conditional inclusion (6.10.1), hexadecimal-escape-sequence: \x hexadecimal-digit hexadecimal-escape-sequence hexadecimal-digit - 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, u, or U. With a few exceptions detailed later, the elements of the sequence are @@ -3359,7 +3359,7 @@ Forward references: conditional inclusion (6.10.1), [page 68] (Contents) - Constraints + Constraints 9 The value of an octal or hexadecimal escape sequence shall be in the range of representable values for the corresponding type: Prefix Corresponding Type @@ -3367,7 +3367,7 @@ Forward references: conditional inclusion (6.10.1), L the unsigned type corresponding to wchar_t u char16_t U char32_t - 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. @@ -3418,7 +3418,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: common definitions <stddef.h> (7.19), the mbtowc function (7.22.7.2), Unicode utilities <uchar.h> (7.27). 6.4.5 String literals - Syntax + Syntax 1 string-literal: encoding-prefixopt " s-char-sequenceopt " encoding-prefix: @@ -3433,10 +3433,10 @@ 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 - Constraints + Constraints 2 A sequence of adjacent string literal tokens shall not include both a wide string literal and a UTF-8 string literal. - Description + Description 3 A character string literal is a sequence of zero or more multibyte characters enclosed in double-quotes, as in "xyz". A UTF-8 string literal is the same, except prefixed by u8. A wide string literal is the same, except prefixed by the letter L, u, or U. @@ -3447,7 +3447,7 @@ Forward references: conditional inclusion (6.10.1), [page 70] (Contents) be represented by the escape sequence \". - Semantics + Semantics 5 In translation phase 6, the multibyte character sequences specified by any sequence of adjacent character and identically-prefixed string literal tokens are concatenated into a single multibyte character sequence. If any of the tokens has an encoding prefix, the @@ -3507,7 +3507,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: common definitions <stddef.h> (7.19), the mbstowcs function (7.22.8.1), Unicode utilities <uchar.h> (7.27). 6.4.6 Punctuators - Syntax + Syntax 1 punctuator: one of [ ] ( ) { } . -> ++ -- & * + - ~ ! @@ -3516,7 +3516,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) @@ -3536,7 +3536,7 @@ Forward references: conditional inclusion (6.10.1), 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 " @@ -3552,7 +3552,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, @@ -3582,7 +3582,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 @@ -3593,12 +3593,12 @@ 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. @@ -3725,14 +3725,14 @@ Forward references: conditional inclusion (6.10.1), [page 77] (Contents) 6.5.1 Primary expressions - Syntax + Syntax 1 primary-expression: identifier constant string-literal ( expression ) generic-selection - 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).91) @@ -3745,7 +3745,7 @@ Forward references: conditional inclusion (6.10.1), designator, or a void expression. Forward references: declarations (6.7). 6.5.1.1 Generic selection - Syntax + Syntax 1 generic-selection: _Generic ( assignment-expression , generic-assoc-list ) generic-assoc-list: @@ -3754,7 +3754,7 @@ Forward references: conditional inclusion (6.10.1), generic-association: type-name : assignment-expression default : assignment-expression - Constraints + Constraints 2 A generic selection shall have no more than one default generic association. The type name in a generic association shall specify a complete object type other than a variably @@ -3767,7 +3767,7 @@ Forward references: conditional inclusion (6.10.1), compatible with at most one of the types named in its generic association list. If a generic selection has no default generic association, its controlling expression shall have type compatible with exactly one of the types named in its generic association list. - Semantics + Semantics 3 The controlling expression of a generic selection is not evaluated. If a generic selection has a generic association with a type name that is compatible with the type of the controlling expression, then the result expression of the generic selection is the @@ -3785,7 +3785,7 @@ Forward references: conditional inclusion (6.10.1), )(X) 6.5.2 Postfix operators - Syntax + Syntax 1 postfix-expression: primary-expression postfix-expression [ expression ] @@ -3806,10 +3806,10 @@ Forward references: conditional inclusion (6.10.1), [page 79] (Contents) 6.5.2.1 Array subscripting - Constraints + Constraints 1 One of the expressions shall have type ''pointer to complete 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 @@ -3836,7 +3836,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: additive operators (6.5.6), address and indirection operators (6.5.3.2), array declarators (6.7.6.2). 6.5.2.2 Function calls - Constraints + Constraints 1 The expression that denotes the called function92) shall have type pointer to function returning void or returning a complete object type other than an array type. 2 If the expression that denotes the called function has a type that includes a prototype, the @@ -3849,7 +3849,7 @@ Forward references: conditional inclusion (6.10.1), 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. @@ -3910,13 +3910,13 @@ Forward references: conditional inclusion (6.10.1), Forward references: function declarators (including prototypes) (6.7.6.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 an atomic, 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 atomic, qualified, or unqualified structure'' or ''pointer to atomic, qualified, or unqualified union'', and the second operand shall name a member of the type pointed to. - 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,95) and is an lvalue if the first expression is an lvalue. If the first expression has qualified type, the result has @@ -4019,10 +4019,10 @@ Forward references: conditional inclusion (6.10.1), [page 84] (Contents) 6.5.2.4 Postfix increment and decrement operators - Constraints + Constraints 1 The operand of the postfix increment or decrement operator shall have atomic, 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. As a side effect, the value of the operand object is incremented (that is, the value 1 of the appropriate type is added to it). See the discussions of additive operators and compound assignment for @@ -4037,11 +4037,11 @@ 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 a complete object type or an array of unknown size, but not a variable length array type. 2 All the constraints for initializer lists in 6.7.9 also apply to compound literals. - Semantics + Semantics 3 A postfix expression that consists of a parenthesized type name followed by a brace- enclosed list of initializers is a compound literal. It provides an unnamed object whose value is given by the initializer list.99) @@ -4154,7 +4154,7 @@ Forward references: conditional inclusion (6.10.1), [page 87] (Contents) 6.5.3 Unary operators - Syntax + Syntax 1 unary-expression: postfix-expression ++ unary-expression @@ -4166,10 +4166,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 atomic, 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 @@ -4178,12 +4178,12 @@ 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 @@ -4203,10 +4203,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -4233,12 +4233,12 @@ Forward references: conditional inclusion (6.10.1), [page 89] (Contents) 6.5.3.4 The sizeof and alignof operators - 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. The alignof operator shall not be applied to a function type or an incomplete type. - 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 @@ -4291,18 +4291,18 @@ Forward references: conditional inclusion (6.10.1), Forward references: common definitions <stddef.h> (7.19), declarations (6.7), structure and union specifiers (6.7.2.1), type names (6.7.7), array declarators (6.7.6.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 atomic, 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. 4 A pointer type shall not be converted to any floating type. A floating type shall not be converted to any pointer type. - Semantics + Semantics 5 Preceding an expression by a parenthesized type name converts the value of the expression to the named type. This construction is called a cast.104) A cast that specifies no conversion has no effect on the type or value of an expression. @@ -4319,16 +4319,16 @@ Forward references: conditional inclusion (6.10.1), [page 91] (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 @@ -4339,12 +4339,12 @@ Forward references: conditional inclusion (6.10.1), (a/b)*b + a%b shall equal a; otherwise, the behavior of both a/b and a%b is undefined. 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 a complete object type and the other shall have integer type. (Incrementing is equivalent to adding 1.) @@ -4363,7 +4363,7 @@ Forward references: conditional inclusion (6.10.1), -- the left operand is a pointer to a complete 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. @@ -4419,14 +4419,14 @@ Forward references: conditional inclusion (6.10.1), Forward references: array declarators (6.7.6.2), common definitions <stddef.h> (7.19). 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 @@ -4452,19 +4452,19 @@ 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; or * -- both operands are pointers to qualified or unqualified versions of compatible object 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 @@ -4488,19 +4488,19 @@ Forward references: conditional inclusion (6.10.1), (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false.107) 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 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.108) 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 @@ -4533,13 +4533,13 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -4557,25 +4557,25 @@ Forward references: conditional inclusion (6.10.1), [page 97] (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 @@ -4587,13 +4587,13 @@ Forward references: conditional inclusion (6.10.1), [page 98] (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; @@ -4601,13 +4601,13 @@ Forward references: conditional inclusion (6.10.1), the first and second operands. 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; if the @@ -4621,11 +4621,11 @@ Forward references: conditional inclusion (6.10.1), [page 99] (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; @@ -4635,7 +4635,7 @@ 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 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 between its evaluation and the evaluation of the second or third operand (whichever is evaluated). The second operand is evaluated only if the first compares unequal to 0; the third operand is evaluated only if @@ -4678,15 +4678,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,111) but is not an lvalue. The type of an assignment expression is the type the left operand would have @@ -4703,7 +4703,7 @@ Forward references: conditional inclusion (6.10.1), [page 101] (Contents) 6.5.16.1 Simple assignment - Constraints + Constraints 1 One of the following shall hold:112) -- the left operand has atomic, qualified, or unqualified arithmetic type, and the right has arithmetic type; @@ -4722,7 +4722,7 @@ Forward references: conditional inclusion (6.10.1), pointer constant; or -- the left operand has type atomic, qualified, or unqualified _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. @@ -4773,7 +4773,7 @@ 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 an atomic, qualified, or unqualified pointer to a complete object type, and the right shall have integer type; or the left operand shall have atomic, qualified, or unqualified arithmetic type, and the right @@ -4782,7 +4782,7 @@ Forward references: conditional inclusion (6.10.1), arithmetic type, and (considering the type the left operand would have after lvalue conversion) 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 is equivalent to the simple assignment expression E1 = E1 op (E2), except that the lvalue E1 is evaluated only once, and with respect to an indeterminately-sequenced function call, the operation of a compound @@ -4792,11 +4792,11 @@ Forward references: conditional inclusion (6.10.1), read-modify-write operation with memory_order_seq_cst memory order semantics.113) 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 between its evaluation and that of the right operand. Then the right operand is evaluated; the result has its type and value.114) * @@ -4825,19 +4825,19 @@ Forward references: conditional inclusion (6.10.1), [page 104] (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.115) 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 @@ -4895,7 +4895,7 @@ Forward references: conditional inclusion (6.10.1), [page 106] (Contents) 6.7 Declarations - Syntax + Syntax 1 declaration: declaration-specifiers init-declarator-listopt ; static_assert-declaration @@ -4911,7 +4911,7 @@ Forward references: conditional inclusion (6.10.1), init-declarator: declarator declarator = initializer - Constraints + Constraints 2 A declaration other than a static_assert 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. @@ -4921,7 +4921,7 @@ Forward references: conditional inclusion (6.10.1), may be redeclared 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; @@ -4947,7 +4947,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: declarators (6.7.6), enumeration specifiers (6.7.2.2), initialization (6.7.9), type names (6.7.7), type qualifiers (6.7.3). 6.7.1 Storage-class specifiers - Syntax + Syntax 1 storage-class-specifier: typedef extern @@ -4955,14 +4955,14 @@ Forward references: conditional inclusion (6.10.1), _Thread_local auto register - Constraints + Constraints 2 At most, one storage-class specifier may be given in the declaration specifiers in a declaration, except that _Thread_local may appear with static or extern.120) 3 In the declaration of an object with block scope, if the declaration specifiers include _Thread_local, they shall also include either static or extern. If _Thread_local appears in any declaration of an object, it shall be present in every declaration of that object. - Semantics + Semantics 4 The typedef specifier is called a ''storage-class specifier'' for syntactic convenience only; it is discussed in 6.7.8. The meanings of the various linkages and storage durations were discussed in 6.2.2 and 6.2.4. @@ -4984,7 +4984,7 @@ Forward references: conditional inclusion (6.10.1), or union member objects. Forward references: type definitions (6.7.8). 6.7.2 Type specifiers - Syntax + Syntax 1 type-specifier: void char @@ -5001,7 +5001,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 @@ -5050,7 +5050,7 @@ Forward references: conditional inclusion (6.10.1), [page 110] (Contents) - Semantics + Semantics 4 Specifiers for structures, unions, enumerations, and atomic types are discussed in 6.7.2.1 through 6.7.2.4. Declarations of typedef names are discussed in 6.7.8. The characteristics of the other types are discussed in 6.2.5. @@ -5060,7 +5060,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: atomic type specifiers (6.7.2.4), enumeration specifiers (6.7.2.2), structure and union specifiers (6.7.2.1), tags (6.7.2.3), type definitions (6.7.8). 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 @@ -5082,7 +5082,7 @@ Forward references: conditional inclusion (6.10.1), struct-declarator: declarator declaratoropt : constant-expression - Constraints + Constraints 2 A struct-declaration that does not declare an anonymous structure or anonymous union shall contain a struct-declarator-list. @@ -5102,7 +5102,7 @@ Forward references: conditional inclusion (6.10.1), 5 A bit-field shall have a type that is a qualified or unqualified version of _Bool, signed int, unsigned int, or some other implementation-defined type. It is implementation-defined whether atomic types are permitted. - Semantics + Semantics 6 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. @@ -5255,7 +5255,7 @@ Forward references: conditional inclusion (6.10.1), [page 115] (Contents) 6.7.2.2 Enumeration specifiers - Syntax + Syntax 1 enum-specifier: enum identifieropt { enumerator-list } enum identifieropt { enumerator-list , } @@ -5266,10 +5266,10 @@ 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.127) An enumerator with = defines its enumeration constant as the value of the constant expression. If the first enumerator has @@ -5306,14 +5306,14 @@ 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. Irrespective of whether there is a tag or what other declarations of the type are in the same translation unit, the type is incomplete129) @@ -5402,15 +5402,15 @@ Forward references: conditional inclusion (6.10.1), Forward references: declarators (6.7.6), type definitions (6.7.8). 6.7.2.4 Atomic type specifiers - Syntax + Syntax 1 atomic-type-specifier: _Atomic ( type-name ) - Constraints + Constraints 2 Atomic type specifiers shall not be used if the implementation does not support atomic types (see 6.10.8.3). 3 The type name in an atomic type specifier shall not refer to an array type, a function type, an atomic type, or a qualified type. - Semantics + Semantics 4 The properties associated with atomic types are meaningful only for expressions that are lvalues. If the _Atomic keyword is immediately followed by a left parenthesis, it is interpreted as a type specifier (with a type name), not as a type qualifier. @@ -5421,18 +5421,18 @@ Forward references: conditional inclusion (6.10.1), [page 119] (Contents) 6.7.3 Type qualifiers - Syntax + Syntax 1 type-qualifier: const restrict volatile _Atomic - Constraints + Constraints 2 Types other than pointer types whose referenced type is an object type shall not be restrict-qualified. 3 The type modified by the _Atomic qualifier shall not be an array type or a function type. - Semantics + Semantics 4 The properties associated with qualified types are meaningful only for expressions that are lvalues.132) 5 If the same qualifier appears more than once in the same specifier-qualifier-list, either @@ -5614,17 +5614,17 @@ Forward references: conditional inclusion (6.10.1), } 6.7.4 Function specifiers - Syntax + Syntax 1 function-specifier: inline _Noreturn - 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 or thread storage duration, and shall not contain a reference to an identifier with internal linkage. 4 In a hosted environment, no function specifier(s) shall appear in a declaration of main. - Semantics + Semantics 5 A function specifier may appear more than once; the behavior is the same as if it appeared only once. 6 A function declared with an inline function specifier is an inline function. Making a * @@ -5702,11 +5702,11 @@ Forward references: conditional inclusion (6.10.1), Forward references: function definitions (6.9.1). 6.7.5 Alignment specifier - Syntax + Syntax 1 alignment-specifier: _Alignas ( type-name ) _Alignas ( constant-expression ) - Constraints + Constraints 2 An alignment attribute shall not be specified in a declaration of a typedef, or a bit-field, or a function, or a parameter, or an object declared with the register storage-class specifier. @@ -5716,7 +5716,7 @@ Forward references: conditional inclusion (6.10.1), 4 The combined effect of all alignment attributes in a declaration shall not specify an alignment that is less strict than the alignment that would otherwise be required for the type of the object or member being declared. - Semantics + Semantics 5 The first form is equivalent to _Alignas(alignof(type-name)). 6 The alignment requirement of the declared object or member is taken to be the specified alignment. An alignment specification of zero has no effect.141) When multiple @@ -5736,7 +5736,7 @@ Forward references: conditional inclusion (6.10.1), [page 126] (Contents) 6.7.6 Declarators - Syntax + Syntax 1 declarator: pointeropt direct-declarator direct-declarator: @@ -5766,7 +5766,7 @@ 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. @@ -5796,7 +5796,7 @@ Forward references: conditional inclusion (6.10.1), directly or via one or more typedefs. Forward references: array declarators (6.7.6.2), type definitions (6.7.8). 6.7.6.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 @@ -5825,7 +5825,7 @@ Forward references: conditional inclusion (6.10.1), declares constant_ptr as an object that has type ''const-qualified pointer to int''. 6.7.6.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 @@ -5837,7 +5837,7 @@ Forward references: conditional inclusion (6.10.1), identifier (as defined in 6.2.3), have no linkage, and have either block scope or function prototype scope. If an identifier is declared to be an object with static or thread 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 ] @@ -5930,7 +5930,7 @@ Forward references: conditional inclusion (6.10.1), Forward references: function declarators (6.7.6.3), function definitions (6.9.1), initialization (6.7.9). 6.7.6.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. @@ -5938,7 +5938,7 @@ 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 @@ -6075,7 +6075,7 @@ Forward references: conditional inclusion (6.10.1), [page 134] (Contents) 6.7.7 Type names - Syntax + Syntax 1 type-name: specifier-qualifier-list abstract-declaratoropt abstract-declarator: @@ -6091,7 +6091,7 @@ 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.147) @@ -6120,12 +6120,12 @@ Forward references: conditional inclusion (6.10.1), [page 135] (Contents) 6.7.8 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.6. Any array size expressions associated with variable length array @@ -6210,7 +6210,7 @@ Forward references: conditional inclusion (6.10.1), [page 137] (Contents) 6.7.9 Initialization - Syntax + Syntax 1 initializer: assignment-expression { initializer-list } @@ -6226,7 +6226,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 a complete @@ -6246,7 +6246,7 @@ Forward references: conditional inclusion (6.10.1), identifier shall be the name of a member of that type. [page 138] (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. @@ -6471,12 +6471,12 @@ Forward references: conditional inclusion (6.10.1), [page 143] (Contents) 6.7.10 Static assertions - Syntax + Syntax 1 static_assert-declaration: _Static_assert ( constant-expression , string-literal ) ; - Constraints + Constraints 2 The constant expression shall compare unequal to 0. - Semantics + Semantics 3 The constant expression shall be an integer constant expression. If the value of the constant expression compares unequal to 0, the declaration has no effect. Otherwise, the constraint is violated and the implementation shall produce a diagnostic message that @@ -6490,7 +6490,7 @@ Forward references: conditional inclusion (6.10.1), [page 144] (Contents) 6.8 Statements and blocks - Syntax + Syntax 1 statement: labeled-statement compound-statement @@ -6498,7 +6498,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. @@ -6517,25 +6517,25 @@ 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 145] (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: @@ -6544,13 +6544,13 @@ 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.153) 3 A null statement (consisting of just a semicolon) performs no operations. @@ -6590,21 +6590,21 @@ 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 @@ -6616,7 +6616,7 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -6627,7 +6627,7 @@ Forward references: conditional inclusion (6.10.1), (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 @@ -6667,17 +6667,17 @@ 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.155) @@ -6715,7 +6715,7 @@ Forward references: conditional inclusion (6.10.1), 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 ; @@ -6734,14 +6734,14 @@ Forward references: conditional inclusion (6.10.1), [page 150] (Contents) - Semantics + Semantics 2 A jump statement causes an unconditional jump to another place. 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 @@ -6788,9 +6788,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 @@ -6803,9 +6803,9 @@ Forward references: conditional inclusion (6.10.1), 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;.159) 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. @@ -6816,11 +6816,11 @@ Forward references: conditional inclusion (6.10.1), [page 152] (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 @@ -6858,14 +6858,14 @@ Forward references: conditional inclusion (6.10.1), [page 153] (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 @@ -6873,7 +6873,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 @@ -6895,13 +6895,13 @@ Forward references: conditional inclusion (6.10.1), [page 154] (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.162) 3 The return type of a function shall be void or a complete object type other than array @@ -6937,7 +6937,7 @@ Forward references: conditional inclusion (6.10.1), [page 155] (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 @@ -7004,7 +7004,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 @@ -7050,7 +7050,7 @@ Forward references: conditional inclusion (6.10.1), [page 158] (Contents) 6.10 Preprocessing directives - Syntax + Syntax 1 preprocessing-file: groupopt group: @@ -7108,7 +7108,7 @@ 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 @@ -7129,13 +7129,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. @@ -7149,7 +7149,7 @@ 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: identifiers (including those lexically identical to keywords) are interpreted as * described below;166) and it may contain unary operator expressions of the form @@ -7169,7 +7169,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 @@ -7224,10 +7224,10 @@ Forward references: conditional inclusion (6.10.1), Forward references: macro replacement (6.10.3), source file inclusion (6.10.2), largest integer types (7.20.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 @@ -7292,7 +7292,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. @@ -7315,7 +7315,7 @@ 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 @@ -7378,10 +7378,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 @@ -7404,10 +7404,10 @@ Forward references: conditional inclusion (6.10.1), [page 167] (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 @@ -7593,9 +7593,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. @@ -7623,13 +7623,13 @@ Forward references: conditional inclusion (6.10.1), [page 172] (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 @@ -7662,7 +7662,7 @@ Forward references: conditional inclusion (6.10.1), [page 173] (Contents) 6.10.7 Null directive - Semantics + Semantics 1 A preprocessing directive of the form # new-line has no effect. @@ -7763,7 +7763,7 @@ Forward references: conditional inclusion (6.10.1), 2 An implementation that defines __STDC_NO_COMPLEX__ shall not define __STDC_IEC_559_COMPLEX__. 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 @@ -8062,10 +8062,10 @@ Forward references: conditional inclusion (6.10.1), expands to _Static_assert. 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 @@ -8083,7 +8083,7 @@ Forward references: conditional inclusion (6.10.1), [page 185] (Contents) - Returns + Returns 3 The assert macro returns no value. Forward references: the abort function (7.22.4.1). @@ -8149,10 +8149,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -8172,28 +8172,28 @@ Forward references: conditional inclusion (6.10.1), 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] @@ -8208,69 +8208,69 @@ Forward references: conditional inclusion (6.10.1), along the real axis. 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. [page 190] (Contents) - Returns + Returns 3 The csin functions return the complex sine value. 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 nonnegative 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); @@ -8280,35 +8280,35 @@ Forward references: conditional inclusion (6.10.1), [page 191] (Contents) - 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. - 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. @@ -8317,35 +8317,35 @@ Forward references: conditional inclusion (6.10.1), [page 192] (Contents) 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); - 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. @@ -8353,32 +8353,32 @@ Forward references: conditional inclusion (6.10.1), [page 193] (Contents) 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); long double complex clogl(long double complex z); - 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); @@ -8390,34 +8390,34 @@ Forward references: conditional inclusion (6.10.1), [page 194] (Contents) - 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. 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 ]. @@ -8426,29 +8426,29 @@ Forward references: conditional inclusion (6.10.1), [page 195] (Contents) 7.3.9.2 The cimag functions - Synopsis + Synopsis 1 #include <complex.h> double cimag(double complex z); float cimagf(float complex z); long double cimagl(long double complex z); - Description + Description 2 The cimag functions compute the imaginary part of z.196) - Returns + Returns 3 The cimag functions return the imaginary part value (as a real). 7.3.9.3 The CMPLX macros - Synopsis + Synopsis 1 #include <complex.h> double complex CMPLX(double x, double y); float complex CMPLXF(float x, float y); long double complex CMPLXL(long double x, long double y); - Description + Description 2 The CMPLX macros expand to an expression of the specified complex type, with the real part having the (converted) value of x and the imaginary part having the (converted) value of y. Recommended practice 3 The resulting expression should be suitable for use as an initializer for an object with static or thread storage duration, provided both arguments are likewise suitable. - Returns + Returns 4 The CMPLX macros return the complex value x + i y. 5 NOTE These macros act as if the implementation supported imaginary types and the definitions were: #define CMPLX(x, y) ((double complex)((double)(x) + \ @@ -8466,43 +8466,43 @@ Forward references: conditional inclusion (6.10.1), [page 196] (Contents) 7.3.9.4 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.5 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. 7.3.9.6 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 + Description 2 The creal functions compute the real part of z.197) [page 197] (Contents) - Returns + Returns 3 The creal functions return the real part value. @@ -8528,16 +8528,16 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -8553,29 +8553,29 @@ Forward references: conditional inclusion (6.10.1), none of iscntrl, isdigit, ispunct, or isspace is true.200) 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); @@ -8587,37 +8587,37 @@ Forward references: conditional inclusion (6.10.1), [page 200] (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 @@ -8627,28 +8627,28 @@ Forward references: conditional inclusion (6.10.1), ('\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 @@ -8660,12 +8660,12 @@ Forward references: conditional inclusion (6.10.1), [page 202] (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 @@ -8800,10 +8800,10 @@ Forward references: conditional inclusion (6.10.1), 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.210) The pragma shall occur either @@ -8856,13 +8856,13 @@ Forward references: conditional inclusion (6.10.1), 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. @@ -8879,28 +8879,28 @@ Forward references: conditional inclusion (6.10.1), [page 208] (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.213) The order in which these floating-point exceptions are raised is unspecified, except as stated in F.8.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. @@ -8914,30 +8914,30 @@ Forward references: conditional inclusion (6.10.1), [page 209] (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.214) - Returns + 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. @@ -8967,24 +8967,24 @@ Forward references: conditional inclusion (6.10.1), 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. @@ -9012,20 +9012,20 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -9033,33 +9033,33 @@ Forward references: conditional inclusion (6.10.1), [page 212] (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. @@ -9170,13 +9170,13 @@ Forward references: conditional inclusion (6.10.1), 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.218) - Returns + Returns 3 The imaxabs function returns the absolute value. @@ -9187,29 +9187,29 @@ Forward references: conditional inclusion (6.10.1), [page 217] (Contents) 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 @@ -9224,18 +9224,18 @@ Forward references: conditional inclusion (6.10.1), [page 218] (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 @@ -9331,10 +9331,10 @@ Forward references: conditional inclusion (6.10.1), 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 @@ -9364,7 +9364,7 @@ Forward references: conditional inclusion (6.10.1), 5 A call to the setlocale function may introduce a data race with other calls to the setlocale function or with calls to functions that are affected by the current locale. 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 @@ -9382,10 +9382,10 @@ Forward references: conditional inclusion (6.10.1), strftime function (7.26.3.5), the strxfrm function (7.23.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. @@ -9517,7 +9517,7 @@ char int_p_sep_by_space 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 @@ -9745,10 +9745,10 @@ char int_p_sep_by_space [page 233] (Contents) 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 @@ -9765,15 +9765,15 @@ char int_p_sep_by_space 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.231) - Returns + Returns 3 The fpclassify macro returns the value of the number classification macro appropriate to the value of its argument. * @@ -9785,33 +9785,33 @@ char int_p_sep_by_space [page 234] (Contents) 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 is based on the type of the argument. - 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.232) @@ -9822,27 +9822,27 @@ char int_p_sep_by_space [page 235] (Contents) - Returns + 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); - 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 + Description 2 The signbit macro determines whether the sign of its argument value is negative.233) - Returns + Returns 3 The signbit macro returns a nonzero value if and only if the sign of its argument value is negative. @@ -9856,34 +9856,34 @@ char int_p_sep_by_space 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. 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. @@ -9891,174 +9891,174 @@ char int_p_sep_by_space [page 237] (Contents) - 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. 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). [page 238] (Contents) - 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. 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. [page 239] (Contents) - 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 pole error may occur if the argument equals -1 or +1. - 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. [page 240] (Contents) - 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. - 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. [page 241] (Contents) - 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); long double expm1l(long double x); - 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.234) - Returns + 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 or if the integral power of 2 is outside the range of int, the results are unspecified. Otherwise, the frexp functions return the value x, such that x has a magnitude in the interval [1/2, 1) or zero, and value equals x x 2*exp . @@ -10072,34 +10072,34 @@ char int_p_sep_by_space [page 242] (Contents) 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 the corresponding logb function and casting the returned value to type int. A domain error or range error may occur if x is zero, infinite, or NaN. If the correct value is outside the range of the return type, the numeric result is unspecified. - 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); @@ -10109,33 +10109,33 @@ char int_p_sep_by_space [page 243] (Contents) - Description + Description 2 The log functions compute the base-e (natural) logarithm of x. A domain error occurs if the argument is negative. A pole 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); long double log10l(long double x); - Description + Description 2 The log10 functions compute the base-10 (common) logarithm of x. A domain error occurs if the argument is negative. A pole 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 + Description 2 The log1p functions compute the base-e (natural) logarithm of 1 plus the argument.235) A domain error occurs if the argument is less than -1. A pole error may occur if the argument equals -1. - Returns + Returns 3 The log1p functions return loge (1 + x). @@ -10146,46 +10146,46 @@ char int_p_sep_by_space [page 244] (Contents) 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 pole error may occur if the argument is zero. - Returns + Returns 3 The log2 functions return log2 x. 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 pole 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 [page 245] (Contents) floating-point format) in the object pointed to by iptr. - Returns + Returns 3 The modf functions return the signed fractional part of value. 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); @@ -10193,21 +10193,21 @@ 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 . @@ -10216,22 +10216,22 @@ char int_p_sep_by_space [page 246] (Contents) 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. - 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 @@ -10239,12 +10239,12 @@ 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 pole error may occur if x is @@ -10255,31 +10255,31 @@ char int_p_sep_by_space [page 247] (Contents) - 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); long double sqrtl(long double x); - 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 3 2 x (integral) e-t dt. 2 @@ -10289,17 +10289,17 @@ 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. [page 248] (Contents) - Returns + Returns 3 2 (inf) (integral) e-t dt. 2 @@ -10309,28 +10309,28 @@ char int_p_sep_by_space - x 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 pole 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 pole error may occur if x is a negative integer or zero. A range error occurs if the magnitude of x is too large and may occur if the magnitude of x is too small. - Returns + Returns 3 The tgamma functions return (Gamma)(x). @@ -10340,32 +10340,32 @@ char int_p_sep_by_space 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. - 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. @@ -10375,22 +10375,22 @@ char int_p_sep_by_space [page 250] (Contents) - 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. - 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); @@ -10398,12 +10398,12 @@ 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. @@ -10412,19 +10412,19 @@ char int_p_sep_by_space [page 251] (Contents) 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. 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); @@ -10432,15 +10432,15 @@ 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); @@ -10449,32 +10449,32 @@ char int_p_sep_by_space [page 252] (Contents) - 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. 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 + Description 2 The remainder functions compute the remainder x REM y required by IEC 60559.236) @@ -10487,38 +10487,38 @@ char int_p_sep_by_space [page 253] (Contents) - Returns + 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. 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. @@ -10526,35 +10526,35 @@ char int_p_sep_by_space [page 254] (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.22.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.237) 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. @@ -10565,32 +10565,32 @@ char int_p_sep_by_space [page 255] (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.238) 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); @@ -10603,33 +10603,33 @@ char int_p_sep_by_space [page 256] (Contents) - Description + Description 2 The fmax functions determine the maximum numeric value of their arguments.239) - Returns + 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 + Description 2 The fmin functions determine the minimum numeric value of their arguments.240) - Returns + 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. @@ -10653,18 +10653,18 @@ char int_p_sep_by_space the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type242) (both arguments need not have the same type).243) 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); @@ -10681,34 +10681,34 @@ char int_p_sep_by_space [page 258] (Contents) - 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 not raise the ''invalid'' floating-point exception when x and y are unordered. - 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). @@ -10717,24 +10717,24 @@ char int_p_sep_by_space [page 259] (Contents) 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). - 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. @@ -10758,13 +10758,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. @@ -10787,10 +10787,10 @@ 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> _Noreturn 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 @@ -10803,7 +10803,7 @@ char int_p_sep_by_space 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, @@ -10888,10 +10888,10 @@ char int_p_sep_by_space 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. @@ -10934,7 +10934,7 @@ char int_p_sep_by_space 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. @@ -10942,14 +10942,14 @@ char int_p_sep_by_space _Exit function (7.22.4.5), the quick_exit function (7.22.4.7). 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. @@ -10997,10 +10997,10 @@ char int_p_sep_by_space shall be matched by a corresponding invocation of the va_end macro in the same function. 7.16.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 @@ -11020,27 +11020,27 @@ 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.16.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.16.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 @@ -11051,13 +11051,13 @@ char int_p_sep_by_space 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.16.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 @@ -11067,7 +11067,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 @@ -11179,10 +11179,10 @@ char int_p_sep_by_space 7.17.2 Initialization 7.17.2.1 The ATOMIC_VAR_INIT macro - Synopsis + Synopsis 1 #include <stdatomic.h> #define ATOMIC_VAR_INIT(C value) - Description + Description 2 The ATOMIC_VAR_INIT macro expands to a token sequence suitable for initializing an atomic object of a type that is initialization-compatible with value. An atomic object with automatic storage duration that is not explicitly initialized using @@ -11195,10 +11195,10 @@ char int_p_sep_by_space atomic_int guide = ATOMIC_VAR_INIT(42); 7.17.2.2 The atomic_init generic function - Synopsis + Synopsis 1 #include <stdatomic.h> void atomic_init(volatile A *obj, C value); - Description + Description 2 The atomic_init generic function initializes the atomic object pointed to by obj to the value value, while also initializing any additional state that the implementation might need to carry for the atomic object. @@ -11210,7 +11210,7 @@ char int_p_sep_by_space 3 Although this function initializes an atomic object, it does not avoid data races; concurrent access to the variable being initialized, even via an atomic operation, constitutes a data race. - Returns + Returns 4 The atomic_init generic function returns no value. 5 EXAMPLE atomic_int guide; @@ -11324,10 +11324,10 @@ char int_p_sep_by_space 16 Implementations should make atomic stores visible to atomic loads within a reasonable amount of time. 7.17.3.1 The kill_dependency macro - Synopsis + Synopsis 1 #include <stdatomic.h> type kill_dependency(type y); - Description + Description 2 The kill_dependency macro terminates a dependency chain; the argument does not carry a dependency to the return value. @@ -11335,7 +11335,7 @@ char int_p_sep_by_space [page 276] (Contents) - Returns + Returns 3 The kill_dependency macro returns the value of y. 7.17.4 Fences 1 This subclause introduces synchronization primitives called fences. Fences can have @@ -11356,10 +11356,10 @@ char int_p_sep_by_space sequenced before B and reads the value written by A or a value written by any side effect in the release sequence headed by A. 7.17.4.1 The atomic_thread_fence function - Synopsis + Synopsis 1 #include <stdatomic.h> void atomic_thread_fence(memory_order order); - Description + Description 2 Depending on the value of order, this operation: -- has no effects, if order == memory_order_relaxed; -- is an acquire fence, if order == memory_order_acquire or order == @@ -11373,13 +11373,13 @@ char int_p_sep_by_space [page 277] (Contents) - Returns + Returns 3 The atomic_thread_fence function returns no value. 7.17.4.2 The atomic_signal_fence function - Synopsis + Synopsis 1 #include <stdatomic.h> void atomic_signal_fence(memory_order order); - Description + Description 2 Equivalent to atomic_thread_fence(order), except that ''synchronizes with'' relationships are established only between a thread and a signal handler executed in the same thread. @@ -11390,7 +11390,7 @@ char int_p_sep_by_space atomic_thread_fence, but the hardware fence instructions that atomic_thread_fence would have inserted are not emitted. - Returns + Returns 5 The atomic_signal_fence function returns no value. 7.17.5 Lock-free property 1 The atomic lock-free macros indicate the lock-free property of integer and address atomic @@ -11402,13 +11402,13 @@ char int_p_sep_by_space process more than once and memory shared between two processes. 7.17.5.1 The atomic_is_lock_free generic function - Synopsis + Synopsis 1 #include <stdatomic.h> _Bool atomic_is_lock_free(atomic_type const volatile *obj); - Description + Description 2 The atomic_is_lock_free generic function indicates whether or not the object pointed to by obj is lock-free. atomic_type can be any atomic type. - Returns + Returns 3 The atomic_is_lock_free generic function returns nonzero (true) if and only if the object's operations are lock-free. The result of a lock-free query on one object cannot be @@ -11477,28 +11477,28 @@ char int_p_sep_by_space 1 There are only a few kinds of operations on atomic types, though there are many instances of those kinds. This subclause specifies each general kind. 7.17.7.1 The atomic_store generic functions - Synopsis + Synopsis 1 #include <stdatomic.h> void atomic_store(volatile A *object, C desired); void atomic_store_explicit(volatile A *object, C desired, memory_order order); - Description + Description 2 The order argument shall not be memory_order_acquire, memory_order_consume, nor memory_order_acq_rel. Atomically replace the value pointed to by object with the value of desired. Memory is affected according to the value of order. - Returns + Returns 3 The atomic_store generic functions return no value. 7.17.7.2 The atomic_load generic functions - Synopsis + Synopsis 1 #include <stdatomic.h> C atomic_load(volatile A *object); C atomic_load_explicit(volatile A *object, memory_order order); - Description + Description 2 The order argument shall not be memory_order_release nor memory_order_acq_rel. Memory is affected according to the value of order. - Returns + Returns Atomically returns the value pointed to by object. @@ -11507,19 +11507,19 @@ char int_p_sep_by_space [page 281] (Contents) 7.17.7.3 The atomic_exchange generic functions - Synopsis + Synopsis 1 #include <stdatomic.h> C atomic_exchange(volatile A *object, C desired); C atomic_exchange_explicit(volatile A *object, C desired, memory_order order); - Description + Description 2 Atomically replace the value pointed to by object with desired. Memory is affected according to the value of order. These operations are read-modify-write operations (5.1.2.4). - Returns + Returns 3 Atomically returns the value pointed to by object immediately before the effects. 7.17.7.4 The atomic_compare_exchange generic functions - Synopsis + Synopsis 1 #include <stdatomic.h> _Bool atomic_compare_exchange_strong(volatile A *object, C *expected, C desired); @@ -11531,7 +11531,7 @@ char int_p_sep_by_space _Bool atomic_compare_exchange_weak_explicit( volatile A *object, C *expected, C desired, memory_order success, memory_order failure); - Description + Description 2 The failure argument shall not be memory_order_release nor memory_order_acq_rel. The failure argument shall be no stronger than the success argument. Atomically, compares the value pointed to by object for equality @@ -11567,7 +11567,7 @@ char int_p_sep_by_space platforms. When a weak compare-and-exchange would require a loop and a strong one would not, the strong one is preferable. - Returns + Returns 7 The result of the comparison. 7.17.7.5 The atomic_fetch and modify generic functions 1 The following operations perform arithmetic and bitwise computations. All of these @@ -11580,12 +11580,12 @@ char int_p_sep_by_space or | bitwise inclusive or xor ^ bitwise exclusive or and & bitwise and - Synopsis + Synopsis 2 #include <stdatomic.h> C atomic_fetch_key(volatile A *object, M operand); C atomic_fetch_key_explicit(volatile A *object, M operand, memory_order order); - Description + Description 3 Atomically replaces the value pointed to by object with the result of the computation applied to the value pointed to by object and the given operand. Memory is affected according to the value of order. These operations are atomic read-modify-write @@ -11595,7 +11595,7 @@ char int_p_sep_by_space complement representation with silent wrap-around on overflow; there are no undefined results. For address types, the result may be an undefined address, but the operations otherwise have no undefined behavior. - Returns + Returns 4 Atomically, the value pointed to by object immediately before the effects. 5 NOTE The operation of the atomic_fetch and modify generic functions are nearly equivalent to the operation of the corresponding op= compound assignment operators. The only differences are that the @@ -11619,13 +11619,13 @@ char int_p_sep_by_space atomic_flag guard = ATOMIC_FLAG_INIT; 7.17.8.1 The atomic_flag_test_and_set functions - Synopsis + Synopsis 1 #include <stdatomic.h> bool atomic_flag_test_and_set( volatile atomic_flag *object); bool atomic_flag_test_and_set_explicit( volatile atomic_flag *object, memory_order order); - Description + Description 2 Atomically sets the value pointed to by object to true. Memory is affected according to the value of order. These operations are atomic read-modify-write operations (5.1.2.4). @@ -11635,19 +11635,19 @@ char int_p_sep_by_space [page 284] (Contents) - Returns + Returns 3 Atomically, the value of the object immediately before the effects. 7.17.8.2 The atomic_flag_clear functions - Synopsis + Synopsis 1 #include <stdatomic.h> void atomic_flag_clear(volatile atomic_flag *object); void atomic_flag_clear_explicit( volatile atomic_flag *object, memory_order order); - Description + Description 2 The order argument shall not be memory_order_acquire nor memory_order_acq_rel. Atomically sets the value pointed to by object to false. Memory is affected according to the value of order. - Returns + Returns 3 The atomic_flag_clear functions return no value. @@ -12203,21 +12203,21 @@ Forward references: localization (7.11). (7.28.6.3.2), the wcrtomb function (7.28.6.3.3). 7.21.4 Operations on files 7.21.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.21.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 @@ -12228,14 +12228,14 @@ Forward references: localization (7.11). [page 302] (Contents) - Returns + Returns 3 The rename function returns zero if the operation succeeds, nonzero if it fails,262) in which case if the file existed previously it is still known by its original name. 7.21.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 @@ -12245,15 +12245,15 @@ Forward references: localization (7.11). 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.21.5.3). 7.21.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.263) The function is potentially capable of generating at @@ -12273,7 +12273,7 @@ Forward references: localization (7.11). 4 Calls to the tmpnam function with a null pointer argument may introduce data races with each other. 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 @@ -12284,17 +12284,17 @@ Forward references: localization (7.11). 6 The value of the macro TMP_MAX shall be at least 25. 7.21.5 File access functions 7.21.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. @@ -12304,26 +12304,26 @@ Forward references: localization (7.11). [page 304] (Contents) 7.21.5.2 The fflush function - Synopsis + Synopsis 1 #include <stdio.h> int fflush(FILE *stream); - 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.21.5.3). 7.21.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 @@ -12374,7 +12374,7 @@ Forward references: localization (7.11). binary stream in some implementations. 8 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 9 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.21.9). @@ -12384,12 +12384,12 @@ Forward references: localization (7.11). [page 306] (Contents) 7.21.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 as in the fopen function.265) @@ -12400,15 +12400,15 @@ Forward references: localization (7.11). 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.21.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. @@ -12422,16 +12422,16 @@ Forward references: localization (7.11). [page 307] (Contents) - Returns + Returns 3 The setbuf function returns no value. Forward references: the setvbuf function (7.21.5.6). 7.21.5.6 The setvbuf function - Synopsis + Synopsis 1 #include <stdio.h> int setvbuf(FILE * restrict stream, char * restrict buf, int mode, size_t size); - 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 @@ -12442,7 +12442,7 @@ Forward references: localization (7.11). 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. @@ -12458,11 +12458,11 @@ Forward references: localization (7.11). 1 The formatted input/output functions shall behave as if there is a sequence point after the actions associated with each specifier.267) 7.21.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 @@ -12741,7 +12741,7 @@ s If no l length modifier is present, the argument shall be a pointe 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 @@ -12787,11 +12787,11 @@ s If no l length modifier is present, the argument shall be a pointe [page 316] (Contents) 7.21.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 @@ -12992,7 +12992,7 @@ s Matches a sequence of non-white-space characters.279) 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 the first conversion (if any) has completed. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in @@ -13104,20 +13104,20 @@ s Matches a sequence of non-white-space characters.279) strtol, strtoll, strtoul, and strtoull functions (7.22.1.4), conversion state (7.28.6), the wcrtomb function (7.28.6.3.3). 7.21.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.21.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. @@ -13125,72 +13125,72 @@ s Matches a sequence of non-white-space characters.279) [page 324] (Contents) - Returns + Returns 3 The scanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.21.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 discarded rather than being written to the array, and a null character is written at the end of the characters actually written into the array. If copying takes place between objects that overlap, the behavior is undefined. - 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.21.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. [page 325] (Contents) 7.21.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 the first conversion (if any) has completed. 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 early matching failure. 7.21.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.281) - Returns + 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. @@ -13217,29 +13217,29 @@ s Matches a sequence of non-white-space characters.279) } 7.21.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.281) - Returns + Returns 3 The vfscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.21.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 @@ -13247,33 +13247,33 @@ s Matches a sequence of non-white-space characters.279) possibly subsequent va_arg calls). The vprintf function does not invoke the va_end macro.281) - Returns + Returns 3 The vprintf function returns the number of characters transmitted, or a negative value if an output or encoding error occurred. 7.21.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.281) - Returns + Returns 3 The vscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.21.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 @@ -13284,40 +13284,40 @@ s Matches a sequence of non-white-space characters.279) [page 328] (Contents) - 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 completely written if and only if the returned value is nonnegative and less than n. 7.21.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.281) 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.21.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.281) - Returns + Returns 3 The vsscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. Otherwise, the vsscanf function [page 329] (Contents) @@ -13326,31 +13326,31 @@ s Matches a sequence of non-white-space characters.279) zero, in the event of an early matching failure. 7.21.7 Character input/output functions 7.21.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.282) 7.21.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 @@ -13361,34 +13361,34 @@ s Matches a sequence of non-white-space characters.279) [page 330] (Contents) 7.21.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.21.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.21.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. @@ -13398,62 +13398,62 @@ s Matches a sequence of non-white-space characters.279) [page 331] (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.21.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.21.7.7 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.21.7.8 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. [page 332] (Contents) - 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.21.7.9 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. 7.21.7.10 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 @@ -13476,18 +13476,18 @@ s Matches a sequence of non-white-space characters.279) 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.283) - Returns + Returns 6 The ungetc function returns the character pushed back after conversion, or EOF if the operation fails. Forward references: file positioning functions (7.21.9). 7.21.8 Direct input/output functions 7.21.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 @@ -13495,7 +13495,7 @@ s Matches a sequence of non-white-space characters.279) 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 @@ -13509,12 +13509,12 @@ s Matches a sequence of non-white-space characters.279) [page 334] (Contents) 7.21.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 @@ -13522,22 +13522,22 @@ s Matches a sequence of non-white-space characters.279) stream (if defined) is advanced by the number of characters successfully written. If an error occurs, the resulting value of the file position indicator for the stream is indeterminate. - 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.21.9 File positioning functions 7.21.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.21.9.3). @@ -13548,10 +13548,10 @@ s Matches a sequence of non-white-space characters.279) [page 335] (Contents) 7.21.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 @@ -13566,14 +13566,14 @@ s Matches a sequence of non-white-space characters.279) 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.21.9.4). 7.21.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 @@ -13586,14 +13586,14 @@ s Matches a sequence of non-white-space characters.279) [page 336] (Contents) 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.21.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 @@ -13601,20 +13601,20 @@ s Matches a sequence of non-white-space characters.279) 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 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.21.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. @@ -13624,30 +13624,30 @@ s Matches a sequence of non-white-space characters.279) 7.21.10 Error-handling functions 7.21.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. 7.21.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.21.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. @@ -13657,17 +13657,17 @@ s Matches a sequence of non-white-space characters.279) [page 338] (Contents) 7.21.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.23.6.2). @@ -13713,30 +13713,30 @@ s Matches a sequence of non-white-space characters.279) expression errno on an error. If the value of the result cannot be represented, the behavior is undefined. 7.22.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.22.1.3). 7.22.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.22.1.4). @@ -13746,7 +13746,7 @@ s Matches a sequence of non-white-space characters.279) [page 341] (Contents) 7.22.1.3 The strtod, strtof, and strtold functions - Synopsis + Synopsis 1 #include <stdlib.h> double strtod(const char * restrict nptr, char ** restrict endptr); @@ -13754,7 +13754,7 @@ s Matches a sequence of non-white-space characters.279) 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 @@ -13828,7 +13828,7 @@ s Matches a sequence of non-white-space characters.279) stipulation that the error with respect to D should have a correct sign for the current rounding direction.287) - Returns + Returns 10 The functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value overflows and default rounding is in effect (7.12.1), plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the @@ -13837,7 +13837,7 @@ s Matches a sequence of non-white-space characters.279) no greater than the smallest normalized positive number in the return type; whether errno acquires the value ERANGE is implementation-defined. 7.22.1.4 The strtol, strtoll, strtoul, and strtoull functions - Synopsis + Synopsis 1 #include <stdlib.h> long int strtol( const char * restrict nptr, @@ -13855,7 +13855,7 @@ s Matches a sequence of non-white-space characters.279) 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, @@ -13898,7 +13898,7 @@ s Matches a sequence of non-white-space characters.279) 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, @@ -13912,30 +13912,30 @@ s Matches a sequence of non-white-space characters.279) 7.22.2 Pseudo-random sequence generation functions 7.22.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.288) 3 The rand function is not required to avoid data races. 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.22.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. @@ -13973,15 +13973,15 @@ s Matches a sequence of non-white-space characters.279) 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.22.3.1 The aligned_alloc function - Synopsis + Synopsis 1 #include <stdlib.h> void *aligned_alloc(size_t alignment, size_t size); - Description + Description 2 The aligned_alloc function allocates space for an object whose alignment is specified by alignment, whose size is specified by size, and whose value is indeterminate. The value of alignment shall be a valid alignment supported by the implementation and the value of size shall be an integral multiple of alignment. - Returns + Returns 3 The aligned_alloc function returns either a null pointer or a pointer to the allocated space. @@ -13991,31 +13991,31 @@ s Matches a sequence of non-white-space characters.279) [page 347] (Contents) 7.22.3.2 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.289) - Returns + Returns 3 The calloc function returns either a null pointer or a pointer to the allocated space. 7.22.3.3 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 a memory management 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.22.3.4 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. @@ -14027,13 +14027,13 @@ s Matches a sequence of non-white-space characters.279) [page 348] (Contents) - Returns + Returns 3 The malloc function returns either a null pointer or a pointer to the allocated space. 7.22.3.5 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 @@ -14044,16 +14044,16 @@ s Matches a sequence of non-white-space characters.279) management 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. 7.22.4 Communication with the environment 7.22.4.1 The abort function - Synopsis + Synopsis 1 #include <stdlib.h> _Noreturn 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 @@ -14066,31 +14066,31 @@ s Matches a sequence of non-white-space characters.279) [page 349] (Contents) - Returns + Returns 3 The abort function does not return to its caller. 7.22.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.290) 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 at_quick_exit function (7.22.4.3), the exit function (7.22.4.4). 7.22.4.3 The at_quick_exit function - Synopsis + Synopsis 1 #include <stdlib.h> int at_quick_exit(void (*func)(void)); - Description + Description 2 The at_quick_exit function registers the function pointed to by func, to be called without arguments should quick_exit be called.291) Environmental limits 3 The implementation shall support the registration of at least 32 functions. - Returns + Returns 4 The at_quick_exit function returns zero if the registration succeeds, nonzero if it fails. Forward references: the quick_exit function (7.22.4.7). @@ -14104,10 +14104,10 @@ s Matches a sequence of non-white-space characters.279) [page 350] (Contents) 7.22.4.4 The exit function - Synopsis + Synopsis 1 #include <stdlib.h> _Noreturn void exit(int status); - Description + Description 2 The exit function causes normal program termination to occur. No functions registered by the at_quick_exit function are called. If a program calls the exit function more than once, or calls the quick_exit function in addition to the exit function, the @@ -14124,13 +14124,13 @@ s Matches a sequence of non-white-space characters.279) 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.22.4.5 The _Exit function - Synopsis + Synopsis 1 #include <stdlib.h> _Noreturn 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, the at_quick_exit function, or signal handlers registered by the signal function are @@ -14145,29 +14145,29 @@ s Matches a sequence of non-white-space characters.279) the exit function (7.22.4.4). 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. 7.22.4.6 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. The getenv function need not avoid data races with other threads of execution that modify the environment list.293) 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.22.4.7 The quick_exit function - Synopsis + Synopsis 1 #include <stdlib.h> _Noreturn void quick_exit(int status); - Description + Description 2 The quick_exit function causes normal program termination to occur. No functions registered by the atexit function or signal handlers registered by the signal function are called. If a program calls the quick_exit function more than once, or calls the @@ -14185,19 +14185,19 @@ s Matches a sequence of non-white-space characters.279) made that would terminate the call to the registered function, the behavior is undefined. 4 Then control is returned to the host environment by means of the function call _Exit(status). - Returns + Returns 5 The quick_exit function cannot return to its caller. 7.22.4.8 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. @@ -14232,12 +14232,12 @@ s Matches a sequence of non-white-space characters.279) comparison function, and also between any call to the comparison function and any movement of the objects passed as arguments to that call. 7.22.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 size of each element of the array is specified by size. @@ -14247,7 +14247,7 @@ s Matches a sequence of non-white-space characters.279) respectively, to be less than, to match, or to be greater than the array element. The array shall consist of: all the elements that compare less than, all the elements that compare equal to, and all the elements that compare greater than the key object, in that order.296) - Returns + 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 @@ -14263,11 +14263,11 @@ s Matches a sequence of non-white-space characters.279) matched is unspecified. 7.22.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 @@ -14276,19 +14276,19 @@ s Matches a sequence of non-white-space characters.279) 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. 7.22.6 Integer arithmetic functions 7.22.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.297) - Returns + Returns 3 The abs, labs, and llabs, functions return the absolute value. @@ -14299,15 +14299,15 @@ s Matches a sequence of non-white-space characters.279) [page 355] (Contents) 7.22.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), @@ -14323,10 +14323,10 @@ s Matches a sequence of non-white-space characters.279) if encodings have state dependency, and zero otherwise.298) Changing the LC_CTYPE category causes the conversion state of these functions to be indeterminate. 7.22.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 @@ -14341,7 +14341,7 @@ s Matches a sequence of non-white-space characters.279) mbtowc((wchar_t *)0, (const char *)0, 0); 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), @@ -14350,12 +14350,12 @@ s Matches a sequence of non-white-space characters.279) multibyte character). Forward references: the mbtowc function (7.22.7.2). 7.22.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 @@ -14364,7 +14364,7 @@ s Matches a sequence of non-white-space characters.279) 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), @@ -14378,10 +14378,10 @@ s Matches a sequence of non-white-space characters.279) [page 357] (Contents) 7.22.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 @@ -14390,7 +14390,7 @@ s Matches a sequence of non-white-space characters.279) sequence needed to restore the initial shift state, and the function is left in the initial conversion state. 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 @@ -14401,12 +14401,12 @@ s Matches a sequence of non-white-space characters.279) 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of the current locale. 7.22.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. @@ -14418,17 +14418,17 @@ s Matches a sequence of non-white-space characters.279) 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.299) 7.22.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, @@ -14437,7 +14437,7 @@ s Matches a sequence of non-white-space characters.279) 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 @@ -14470,16 +14470,16 @@ s Matches a sequence of non-white-space characters.279) different value). 7.23.2 Copying functions 7.23.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. @@ -14490,35 +14490,35 @@ s Matches a sequence of non-white-space characters.279) [page 360] (Contents) 7.23.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.23.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.23.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 @@ -14531,28 +14531,28 @@ s Matches a sequence of non-white-space characters.279) 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.23.3 Concatenation functions 7.23.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.23.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 @@ -14566,7 +14566,7 @@ s Matches a sequence of non-white-space characters.279) [page 362] (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.23.6.3). 7.23.4 Comparison functions @@ -14575,24 +14575,24 @@ s Matches a sequence of non-white-space characters.279) pair of characters (both interpreted as unsigned char) that differ in the objects being compared. 7.23.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.303) - Returns + 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.23.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 @@ -14604,35 +14604,35 @@ s Matches a sequence of non-white-space characters.279) pointed to by s2. 7.23.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.23.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.23.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 @@ -14644,7 +14644,7 @@ s Matches a sequence of non-white-space characters.279) 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. @@ -14654,22 +14654,22 @@ s Matches a sequence of non-white-space characters.279) 7.23.5 Search functions 7.23.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. The implementation shall behave as if it reads the characters sequentially and stops as soon as a matching character is found. - 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.23.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. @@ -14678,34 +14678,34 @@ s Matches a sequence of non-white-space characters.279) [page 365] (Contents) - 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. 7.23.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.23.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.23.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. @@ -14715,35 +14715,35 @@ s Matches a sequence of non-white-space characters.279) [page 366] (Contents) - Returns + Returns 3 The strrchr function returns a pointer to the character, or a null pointer if c does not occur in the string. 7.23.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.23.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.23.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 @@ -14765,7 +14765,7 @@ s Matches a sequence of non-white-space characters.279) searching from the saved pointer and behaves as described above. 6 The strtok function is not required to avoid data races. 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 @@ -14779,13 +14779,13 @@ s Matches a sequence of non-white-space characters.279) 7.23.6 Miscellaneous functions 7.23.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. @@ -14793,26 +14793,26 @@ s Matches a sequence of non-white-space characters.279) [page 368] (Contents) 7.23.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 strerror function is not required to avoid data races. 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.23.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. @@ -15010,69 +15010,69 @@ s Matches a sequence of non-white-space characters.279) 7.25.2 Initialization functions 7.25.2.1 The call_once function - Synopsis + Synopsis 1 #include <threads.h> void call_once(once_flag *flag, void (*func)(void)); - Description + Description 2 The call_once function uses the once_flag pointed to by flag to ensure that func is called exactly once, the first time the call_once function is called with that value of flag. Completion of an effective call to the call_once function synchronizes with all subsequent calls to the call_once function with the same value of flag. - Returns + Returns 3 The call_once function returns no value. 7.25.3 Condition variable functions 7.25.3.1 The cnd_broadcast function - Synopsis + Synopsis 1 #include <threads.h> int cnd_broadcast(cnd_t *cond); - Description + Description 2 The cnd_broadcast function unblocks all of the threads that are blocked on the condition variable pointed to by cond at the time of the call. If no threads are blocked on the condition variable pointed to by cond at the time of the call, the function does nothing. - Returns + Returns 3 The cnd_broadcast function returns thrd_success on success, or thrd_error if the request could not be honored. 7.25.3.2 The cnd_destroy function - Synopsis + Synopsis 1 #include <threads.h> void cnd_destroy(cnd_t *cond); - Description + Description 2 The cnd_destroy function releases all resources used by the condition variable pointed to by cond. The cnd_destroy function requires that no threads be blocked waiting for the condition variable pointed to by cond. [page 375] (Contents) - Returns + Returns 3 The cnd_destroy function returns no value. 7.25.3.3 The cnd_init function - Synopsis + Synopsis 1 #include <threads.h> int cnd_init(cnd_t *cond); - Description + Description 2 The cnd_init function creates a condition variable. If it succeeds it sets the variable pointed to by cond to a value that uniquely identifies the newly created condition variable. A thread that calls cnd_wait on a newly created condition variable will block. - Returns + Returns 3 The cnd_init function returns thrd_success on success, or thrd_nomem if no memory could be allocated for the newly created condition, or thrd_error if the request could not be honored. 7.25.3.4 The cnd_signal function - Synopsis + Synopsis 1 #include <threads.h> int cnd_signal(cnd_t *cond); - Description + Description 2 The cnd_signal function unblocks one of the threads that are blocked on the condition variable pointed to by cond at the time of the call. If no threads are blocked on the condition variable at the time of the call, the function does nothing and return success. - Returns + Returns 3 The cnd_signal function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.3.5 The cnd_timedwait function - Synopsis + Synopsis 1 #include <threads.h> int cnd_timedwait(cnd_t *cond, mtx_t *mtx, const xtime *xt); @@ -15082,37 +15082,37 @@ s Matches a sequence of non-white-space characters.279) [page 376] (Contents) - Description + Description 2 The cnd_timedwait function atomically unlocks the mutex pointed to by mtx and endeavors to block until the condition variable pointed to by cond is signaled by a call to cnd_signal or to cnd_broadcast, or until after the time specified by the xtime object pointed to by xt. When the calling thread becomes unblocked it locks the variable pointed to by mtx before it returns. The cnd_timedwait function requires that the mutex pointed to by mtx be locked by the calling thread. - Returns + Returns 3 The cnd_timedwait function returns thrd_success upon success, or thrd_timeout if the time specified in the call was reached without acquiring the requested resource, or thrd_error if the request could not be honored. 7.25.3.6 The cnd_wait function - Synopsis + Synopsis 1 #include <threads.h> int cnd_wait(cnd_t *cond, mtx_t *mtx); - Description + Description 2 The cnd_wait function atomically unlocks the mutex pointed to by mtx and endeavors to block until the condition variable pointed to by cond is signaled by a call to cnd_signal or to cnd_broadcast. When the calling thread becomes unblocked it locks the mutex pointed to by mtx before it returns. If the mutex pointed to by mtx is not locked by the calling thread, the cnd_wait function will act as if the abort function is called. - Returns + Returns 3 The cnd_wait function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.4 Mutex functions 7.25.4.1 The mtx_destroy function - Synopsis + Synopsis 1 #include <threads.h> void mtx_destroy(mtx_t *mtx); - Description + Description 2 The mtx_destroy function releases any resources used by the mutex pointed to by mtx. No threads can be blocked waiting for the mutex pointed to by mtx. @@ -15120,13 +15120,13 @@ s Matches a sequence of non-white-space characters.279) [page 377] (Contents) - Returns + Returns 3 The mtx_destroy function returns no value. 7.25.4.2 The mtx_init function - Synopsis + Synopsis 1 #include <threads.h> int mtx_init(mtx_t *mtx, int type); - Description + Description 2 The mtx_init function creates a mutex object with properties indicated by type, which must have one of the six values: mtx_plain for a simple non-recursive mutex, @@ -15137,18 +15137,18 @@ s Matches a sequence of non-white-space characters.279) mtx_try | mtx_recursive for a recursive mutex that supports test and return. 3 If the mtx_init function succeeds, it sets the mutex pointed to by mtx to a value that uniquely identifies the newly created mutex. - Returns + Returns 4 The mtx_init function returns thrd_success on success, or thrd_error if the request could not be honored. 7.25.4.3 The mtx_lock function - Synopsis + Synopsis 1 #include <threads.h> int mtx_lock(mtx_t *mtx); - Description + Description 2 The mtx_lock function blocks until it locks the mutex pointed to by mtx. If the mutex is non-recursive, it shall not be locked by the calling thread. Prior calls to mtx_unlock on the same mutex shall synchronize with this operation. - Returns + Returns 3 The mtx_lock function returns thrd_success on success, or thrd_busy if the resource requested is already in use, or thrd_error if the request could not be honored. @@ -15159,72 +15159,72 @@ s Matches a sequence of non-white-space characters.279) [page 378] (Contents) 7.25.4.4 The mtx_timedlock function - Synopsis + Synopsis 1 #include <threads.h> int mtx_timedlock(mtx_t *mtx, const xtime *xt); - Description + Description 2 The mtx_timedlock function endeavors to block until it locks the mutex pointed to by mtx or until the time specified by the xtime object xt has passed. The specified mutex shall support timeout. If the operation succeeds, prior calls to mtx_unlock on the same mutex shall synchronize with this operation. - Returns + Returns 3 The mtx_timedlock function returns thrd_success on success, or thrd_busy if the resource requested is already in use, or thrd_timeout if the time specified was reached without acquiring the requested resource, or thrd_error if the request could not be honored. 7.25.4.5 The mtx_trylock function - Synopsis + Synopsis 1 #include <threads.h> int mtx_trylock(mtx_t *mtx); - Description + Description 2 The mtx_trylock function endeavors to lock the mutex pointed to by mtx. The specified mutex shall support either test and return or timeout. If the mutex is already locked, the function returns without blocking. If the operation succeeds, prior calls to mtx_unlock on the same mutex shall synchronize with this operation. - Returns + Returns 3 The mtx_trylock function returns thrd_success on success, or thrd_busy if the resource requested is already in use, or thrd_error if the request could not be honored. 7.25.4.6 The mtx_unlock function - Synopsis + Synopsis 1 #include <threads.h> int mtx_unlock(mtx_t *mtx); - Description + Description 2 The mtx_unlock function unlocks the mutex pointed to by mtx. The mutex pointed to by mtx shall be locked by the calling thread. [page 379] (Contents) - Returns + Returns 3 The mtx_unlock function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.5 Thread functions 7.25.5.1 The thrd_create function - Synopsis + Synopsis 1 #include <threads.h> int thrd_create(thrd_t *thr, thrd_start_t func, void *arg); - Description + Description 2 The thrd_create function creates a new thread executing func(arg). If the thrd_create function succeeds, it sets the object pointed to by thr to the identifier of the newly created thread. (A thread's identifier may be reused for a different thread once the original thread has exited and either been detached or joined to another thread.) The completion of the thrd_create function synchronizes with the beginning of the execution of the new thread. - Returns + Returns 3 The thrd_create function returns thrd_success on success, or thrd_nomem if no memory could be allocated for the thread requested, or thrd_error if the request could not be honored. 7.25.5.2 The thrd_current function - Synopsis + Synopsis 1 #include <threads.h> thrd_t thrd_current(void); - Description + Description 2 The thrd_current function identifies the thread that called it. - Returns + Returns 3 The thrd_current function returns the identifier of the thread that called it. 7.25.5.3 The thrd_detach function - Synopsis + Synopsis 1 #include <threads.h> int thrd_detach(thrd_t thr); @@ -15232,37 +15232,37 @@ s Matches a sequence of non-white-space characters.279) [page 380] (Contents) - Description + Description 2 The thrd_detach function tells the operating system to dispose of any resources allocated to the thread identified by thr when that thread terminates. The thread identified by thr shall not have been previously detached or joined with another thread. - Returns + Returns 3 The thrd_detach function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.5.4 The thrd_equal function - Synopsis + Synopsis 1 #include <threads.h> int thrd_equal(thrd_t thr0, thrd_t thr1); - Description + Description 2 The thrd_equal function will determine whether the thread identified by thr0 refers to the thread identified by thr1. - Returns + Returns 3 The thrd_equal function returns zero if the thread thr0 and the thread thr1 refer to different threads. Otherwise the thrd_equal function returns a nonzero value. 7.25.5.5 The thrd_exit function - Synopsis + Synopsis 1 #include <threads.h> void thrd_exit(int res); - Description + Description 2 The thrd_exit function terminates execution of the calling thread and sets its result code to res. - Returns + Returns 3 The thrd_exit function returns no value. 7.25.5.6 The thrd_join function - Synopsis + Synopsis 1 #include <threads.h> int thrd_join(thrd_t thr, int *res); - Description + Description 2 The thrd_join function joins the thread identified by thr with the current thread by blocking until the other thread has terminated. If the parameter res is not a null pointer, @@ -15271,68 +15271,68 @@ s Matches a sequence of non-white-space characters.279) it stores the thread's result code in the integer pointed to by res. The termination of the other thread synchronizes with the completion of the thrd_join function. The thread identified by thr shall not have been previously detached or joined with another thread. - Returns + Returns 3 The thrd_join function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.5.7 The thrd_sleep function - Synopsis + Synopsis 1 #include <threads.h> void thrd_sleep(const xtime *xt); - Description + Description 2 The thrd_sleep function suspends execution of the calling thread until after the time specified by the xtime object pointed to by xt. - Returns + Returns 3 The thrd_sleep function returns no value. 7.25.5.8 The thrd_yield function - Synopsis + Synopsis 1 #include <threads.h> void thrd_yield(void); - Description + Description 2 The thrd_yield function endeavors to permit other threads to run, even if the current thread would ordinarily continue to run. - Returns + Returns 3 The thrd_yield function returns no value. 7.25.6 Thread-specific storage functions 7.25.6.1 The tss_create function - Synopsis + Synopsis 1 #include <threads.h> int tss_create(tss_t *key, tss_dtor_t dtor); - Description + Description 2 The tss_create function creates a thread-specific storage pointer with destructor dtor, which may be null. [page 382] (Contents) - Returns + Returns 3 If the tss_create function is successful, it sets the thread-specific storage pointed to by key to a value that uniquely identifies the newly created pointer and returns thrd_success; otherwise, thrd_error is returned and the thread-specific storage pointed to by key is set to an undefined value. 7.25.6.2 The tss_delete function - Synopsis + Synopsis 1 #include <threads.h> void tss_delete(tss_t key); - Description + Description 2 The tss_delete function releases any resources used by the thread-specific storage identified by key. - Returns + Returns 3 The tss_delete function returns no value. 7.25.6.3 The tss_get function - Synopsis + Synopsis 1 #include <threads.h> void *tss_get(tss_t key); - Description + Description 2 The tss_get function returns the value for the current thread held in the thread-specific storage identified by key. - Returns + Returns 3 The tss_get function returns the value for the current thread if successful, or zero if unsuccessful. 7.25.6.4 The tss_set function - Synopsis + Synopsis 1 #include <threads.h> int tss_set(tss_t key, void *val); - Description + Description 2 The tss_set function sets the value for the current thread held in the thread-specific storage identified by key to val. @@ -15341,18 +15341,18 @@ s Matches a sequence of non-white-space characters.279) [page 383] (Contents) - Returns + Returns 3 The tss_set function returns thrd_success on success or thrd_error if the request could not be honored. 7.25.7 Time functions 7.25.7.1 The xtime_get function - Synopsis + Synopsis 1 #include <threads.h> int xtime_get(xtime *xt, int base); - Description + Description 2 The xtime_get function sets the xtime object pointed to by xt to hold the current time based on the time base base. - Returns + Returns 3 If the xtime_get function is successful it returns the nonzero value base, which must be TIME_UTC; otherwise, it returns zero.306) @@ -15407,12 +15407,12 @@ s Matches a sequence of non-white-space characters.279) Saving Time is not in effect, and negative if the information is not available. 7.26.2 Time manipulation functions 7.26.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 @@ -15420,13 +15420,13 @@ s Matches a sequence of non-white-space characters.279) the processor time used is not available or its value cannot be represented, the function returns the value (clock_t)(-1).308) 7.26.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. @@ -15438,10 +15438,10 @@ s Matches a sequence of non-white-space characters.279) [page 386] (Contents) 7.26.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 @@ -15451,7 +15451,7 @@ s Matches a sequence of non-white-space characters.279) 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). @@ -15486,13 +15486,13 @@ s Matches a sequence of non-white-space characters.279) printf("%s\n", wday[time_str.tm_wday]); 7.26.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 @@ -15505,10 +15505,10 @@ s Matches a sequence of non-white-space characters.279) previous call to any of them and the functions are not required to avoid data races. The implementation shall behave as if no other library functions call these functions. 7.26.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 @@ -15538,13 +15538,13 @@ s Matches a sequence of non-white-space characters.279) ranges,310) the behavior of the asctime function is undefined. Likewise, if the calculated year exceeds four digits or is less than the year 1000, the behavior is undefined. - Returns + Returns 4 The asctime function returns a pointer to the string. 7.26.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)) @@ -15555,32 +15555,32 @@ s Matches a sequence of non-white-space characters.279) [page 389] (Contents) - 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.26.3.4). 7.26.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.26.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.26.3.5 The strftime function - Synopsis + Synopsis 1 #include <time.h> size_t strftime(char * restrict s, size_t maxsize, @@ -15592,7 +15592,7 @@ s Matches a sequence of non-white-space characters.279) [page 390] (Contents) - 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 @@ -15725,7 +15725,7 @@ s Matches a sequence of non-white-space characters.279) %x equivalent to ''%m/%d/%y''. %X equivalent to %T. %Z implementation-defined. - 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, @@ -15756,12 +15756,12 @@ s Matches a sequence of non-white-space characters.279) to avoid data races in this case. The implementation behaves as if no library function calls these functions with a null pointer for ps. 7.27.1.1 The mbrtoc16 function - Synopsis + Synopsis 1 #include <uchar.h> size_t mbrtoc16(char16_t * restrict pc16, const char * restrict s, size_t n, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the mbrtoc16 function is equivalent to the call: mbrtoc16(NULL, "", 1, ps) In this case, the values of the parameters pc16 and n are ignored. @@ -15776,7 +15776,7 @@ s Matches a sequence of non-white-space characters.279) store successive wide characters without consuming any additional input until all the characters have been stored. If the corresponding wide character is the null wide character, the resulting state described is the initial conversion state. - Returns + Returns 4 The mbrtoc16 function returns the first of the following that applies (given the current conversion state): 0 if the next n or fewer bytes complete the multibyte character that @@ -15794,11 +15794,11 @@ s Matches a sequence of non-white-space characters.279) value is stored); the value of the macro EILSEQ is stored in errno, and the conversion state is unspecified. 7.27.1.2 The c16rtomb function - Synopsis + Synopsis 1 #include <uchar.h> size_t c16rtomb(char * restrict s, char16_t c16, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the c16rtomb function is equivalent to the call c16rtomb(buf, L'\0', ps) where buf is an internal buffer. @@ -15815,18 +15815,18 @@ s Matches a sequence of non-white-space characters.279) array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If c16 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 c16rtomb function returns the number of bytes stored in the array object (including any shift sequences). When c16 is not a valid wide character, an encoding error occurs: the function stores the value of the macro EILSEQ in errno and returns (size_t)(-1); the conversion state is unspecified. 7.27.1.3 The mbrtoc32 function - Synopsis + Synopsis 1 #include <uchar.h> size_t mbrtoc32(char32_t * restrict pc32, const char * restrict s, size_t n, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the mbrtoc32 function is equivalent to the call: mbrtoc32(NULL, "", 1, ps) In this case, the values of the parameters pc32 and n are ignored. @@ -15839,7 +15839,7 @@ s Matches a sequence of non-white-space characters.279) store successive wide characters without consuming any additional input until all the characters have been stored. If the corresponding wide character is the null wide character, the resulting state described is the initial conversion state. - Returns + Returns 4 The mbrtoc32 function returns the first of the following that applies (given the current conversion state): 0 if the next n or fewer bytes complete the multibyte character that @@ -15861,11 +15861,11 @@ s Matches a sequence of non-white-space characters.279) value is stored); the value of the macro EILSEQ is stored in errno, and the conversion state is unspecified. 7.27.1.4 The c32rtomb function - Synopsis + Synopsis 1 #include <uchar.h> size_t c32rtomb(char * restrict s, char32_t c32, mbstate_t * restrict ps); - Description + Description 2 If s is a null pointer, the c32rtomb function is equivalent to the call c32rtomb(buf, L'\0', ps) where buf is an internal buffer. @@ -15875,7 +15875,7 @@ s Matches a sequence of non-white-space characters.279) array whose first element is pointed to by s. At most MB_CUR_MAX bytes are stored. If c32 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 c32rtomb function returns the number of bytes stored in the array object (including any shift sequences). When c32 is not a valid wide character, an encoding error occurs: the function stores the value of the macro EILSEQ in errno and returns @@ -15936,12 +15936,12 @@ s Matches a sequence of non-white-space characters.279) 1 The formatted wide character input/output functions shall behave as if there is a sequence point after the actions associated with each specifier.316) 7.28.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 @@ -16200,7 +16200,7 @@ p The argument shall be a pointer to void. The value of the pointer i 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. @@ -16229,12 +16229,12 @@ p The argument shall be a pointer to void. The value of the pointer i Forward references: the btowc function (7.28.6.1.1), the mbrtowc function (7.28.6.3.2). 7.28.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 @@ -16426,7 +16426,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 the first conversion (if any) has completed. Otherwise, the function returns the number of input items assigned, which can be fewer than provided for, or even zero, in @@ -16462,31 +16462,31 @@ n No input is consumed. The corresponding argument shall be a pointer wcstol, wcstoll, wcstoul, and wcstoull functions (7.28.4.1.2), the wcrtomb function (7.28.6.3.3). 7.28.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.28.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 the first conversion (if any) has completed. Otherwise, the swscanf function returns the number of input items assigned, which can be fewer than provided for, or even @@ -16498,19 +16498,19 @@ n No input is consumed. The corresponding argument shall be a pointer [page 413] (Contents) 7.28.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.327) - Returns + 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 @@ -16538,37 +16538,37 @@ n No input is consumed. The corresponding argument shall be a pointer [page 414] (Contents) 7.28.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.327) - Returns + Returns 3 The vfwscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.28.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.327) - 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. @@ -16577,34 +16577,34 @@ n No input is consumed. The corresponding argument shall be a pointer [page 415] (Contents) 7.28.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.327) - Returns + Returns 3 The vswscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.28.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.327) - Returns + Returns 3 The vwprintf function returns the number of wide characters transmitted, or a negative value if an output or encoding error occurred. @@ -16614,59 +16614,59 @@ n No input is consumed. The corresponding argument shall be a pointer [page 416] (Contents) 7.28.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.327) - Returns + Returns 3 The vwscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.28.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.28.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 417] (Contents) - Returns + Returns 3 The wscanf function returns the value of the macro EOF if an input failure occurs before the first conversion (if any) has completed. 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.28.3 Wide character input/output functions 7.28.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 @@ -16674,12 +16674,12 @@ n No input is consumed. The corresponding argument shall be a pointer 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.328) 7.28.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 @@ -16692,69 +16692,69 @@ n No input is consumed. The corresponding argument shall be a pointer 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.28.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.28.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 419] (Contents) 7.28.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.329) 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.28.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.28.3.7 The getwchar function - Synopsis + Synopsis 1 #include <wchar.h> wint_t getwchar(void); @@ -16765,36 +16765,36 @@ n No input is consumed. The corresponding argument shall be a pointer [page 420] (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.28.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.28.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.28.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 @@ -16817,7 +16817,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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.28.4 General wide string utilities @@ -16840,7 +16840,7 @@ n No input is consumed. The corresponding argument shall be a pointer 7.28.4.1 Wide string numeric conversion functions 7.28.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); @@ -16848,7 +16848,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -16929,7 +16929,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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.332) - Returns + Returns 10 The functions return the converted value, if any. If no conversion could be performed, zero is returned. If the correct value overflows and default rounding is in effect (7.12.1), plus or minus HUGE_VAL, HUGE_VALF, or HUGE_VALL is returned (according to the @@ -16947,7 +16947,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 425] (Contents) 7.28.4.1.2 The wcstol, wcstoll, wcstoul, and wcstoull functions - Synopsis + Synopsis 1 #include <wchar.h> long int wcstol( const wchar_t * restrict nptr, @@ -16965,7 +16965,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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, @@ -17006,7 +17006,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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, @@ -17014,44 +17014,44 @@ n No input is consumed. The corresponding argument shall be a pointer sign of the value, if any), and the value of the macro ERANGE is stored in errno. 7.28.4.2 Wide string copying functions 7.28.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 427] (Contents) 7.28.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.333) 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.28.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. @@ -17063,37 +17063,37 @@ n No input is consumed. The corresponding argument shall be a pointer [page 428] (Contents) 7.28.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.28.4.3 Wide string concatenation functions 7.28.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.28.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 @@ -17102,32 +17102,32 @@ n No input is consumed. The corresponding argument shall be a pointer 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.334) - Returns + Returns 3 The wcsncat function returns the value of s1. 7.28.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.28.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.28.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 @@ -17140,25 +17140,25 @@ n No input is consumed. The corresponding argument shall be a pointer wide string pointed to by s2 when both are interpreted as appropriate to the current locale. 7.28.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.28.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 @@ -17166,7 +17166,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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. @@ -17179,33 +17179,33 @@ n No input is consumed. The corresponding argument shall be a pointer 1 + wcsxfrm(NULL, s, 0) 7.28.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.28.4.5 Wide string search functions 7.28.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.28.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. @@ -17214,61 +17214,61 @@ n No input is consumed. The corresponding argument shall be a pointer [page 432] (Contents) - Returns + Returns 3 The wcscspn function returns the length of the segment. 7.28.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.28.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.28.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 433] (Contents) 7.28.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.28.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 @@ -17295,7 +17295,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -17310,14 +17310,14 @@ n No input is consumed. The corresponding argument shall be a pointer t = wcstok(NULL, L"?", &ptr1); // t is a null pointer 7.28.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. @@ -17328,33 +17328,33 @@ n No input is consumed. The corresponding argument shall be a pointer 7.28.4.6 Miscellaneous functions 7.28.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.28.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.28.5 Wide character time conversion functions 7.28.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. @@ -17366,7 +17366,7 @@ n No input is consumed. The corresponding argument shall be a pointer -- 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 @@ -17405,34 +17405,34 @@ n No input is consumed. The corresponding argument shall be a pointer 7.28.6.1 Single-byte/wide character conversion functions 7.28.6.1.1 The btowc function - Synopsis + Synopsis 1 #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.28.6.1.2 The wctob function - Synopsis + Synopsis 1 #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.28.6.2 Conversion state functions 7.28.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 referenced mbstate_t object describes an initial conversion state. @@ -17440,7 +17440,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 438] (Contents) - Returns + Returns 3 The mbsinit function returns nonzero if ps is a null pointer or if the referenced object describes an initial conversion state; otherwise, it returns zero. 7.28.6.3 Restartable multibyte/wide character conversion functions @@ -17455,17 +17455,17 @@ n No input is consumed. The corresponding argument shall be a pointer 2 Also unlike their corresponding functions, the return value does not represent whether the encoding is state-dependent. 7.28.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.28.6.3.2). @@ -17476,13 +17476,13 @@ n No input is consumed. The corresponding argument shall be a pointer [page 439] (Contents) 7.28.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. @@ -17493,7 +17493,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -17515,12 +17515,12 @@ n No input is consumed. The corresponding argument shall be a pointer [page 440] (Contents) 7.28.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. @@ -17530,7 +17530,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -17555,13 +17555,13 @@ n No input is consumed. The corresponding argument shall be a pointer [page 441] (Contents) 7.28.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 @@ -17576,7 +17576,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -17591,13 +17591,13 @@ n No input is consumed. The corresponding argument shall be a pointer [page 442] (Contents) 7.28.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 @@ -17613,7 +17613,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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 @@ -17677,17 +17677,17 @@ n No input is consumed. The corresponding argument shall be a pointer both printing and white-space wide characters.340) Forward references: the wctob function (7.28.6.1.2). 7.29.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.29.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 @@ -17701,30 +17701,30 @@ n No input is consumed. The corresponding argument shall be a pointer wide characters for which none of iswcntrl, iswdigit, iswpunct, or iswspace is true.341) 7.29.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.29.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.29.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.29.2.1.6 The iswgraph function - Synopsis + Synopsis 1 #include <wctype.h> int iswgraph(wint_t wc); @@ -17736,33 +17736,33 @@ n No input is consumed. The corresponding argument shall be a pointer [page 446] (Contents) - Description + Description 2 The iswgraph function tests for any wide character for which iswprint is true and iswspace is false.342) 7.29.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.29.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.29.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.342) 7.29.2.1.10 The iswspace function - Synopsis + Synopsis 1 #include <wctype.h> int iswspace(wint_t wc); @@ -17774,23 +17774,23 @@ n No input is consumed. The corresponding argument shall be a pointer [page 447] (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.29.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.29.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.29.2.2 Extensible wide character classification functions @@ -17798,10 +17798,10 @@ n No input is consumed. The corresponding argument shall be a pointer as well as testing equivalent to that performed by the functions described in the previous subclause (7.29.2.1). 7.29.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. @@ -17823,21 +17823,21 @@ n No input is consumed. The corresponding argument shall be a pointer 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. If desc is zero, the iswctype function returns zero (false). Forward references: the wctype function (7.29.2.2.2). 7.29.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. @@ -17851,24 +17851,24 @@ n No input is consumed. The corresponding argument shall be a pointer 1 The header <wctype.h> declares several functions useful for mapping wide characters. 7.29.3.1 Wide character case mapping functions 7.29.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.29.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 @@ -17885,10 +17885,10 @@ n No input is consumed. The corresponding argument shall be a pointer [page 450] (Contents) 7.29.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. @@ -17896,19 +17896,19 @@ n No input is consumed. The corresponding argument shall be a pointer mapping function (7.29.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. If desc is zero, the towctrans function returns the value of wc. 7.29.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. @@ -20896,7 +20896,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 529] (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.) @@ -21048,7 +21048,7 @@ n No input is consumed. The corresponding argument shall be a pointer 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.) @@ -22790,14 +22790,14 @@ n No input is consumed. The corresponding argument shall be a pointer which is the type size_t. K.3.5.1 Operations on files K.3.5.1.1 The tmpfile_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> errno_t tmpfile_s(FILE * restrict * restrict streamptr); Runtime-constraints 2 streamptr shall not be a null pointer. 3 If there is a runtime-constraint violation, tmpfile_s does not attempt to create a file. - Description + Description 4 The tmpfile_s 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 @@ -22816,18 +22816,18 @@ n No input is consumed. The corresponding argument shall be a pointer the program (this limit may be shared with tmpnam_s) 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 6 The tmpfile_s function returns zero if it created the file. If it did not create the file or there was a runtime-constraint violation, tmpfile_s returns a nonzero value. K.3.5.1.2 The tmpnam_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> errno_t tmpnam_s(char *s, rsize_t maxsize); Runtime-constraints 2 s shall not be a null pointer. maxsize shall be less than or equal to RSIZE_MAX. maxsize shall be greater than the length of the generated file name string. - Description + Description 3 The tmpnam_s function generates a string that is a valid file name and that is not the same as the name of an existing file.374) The function is potentially capable of generating TMP_MAX_S different strings, but any or all of them may already be in use by existing @@ -22858,7 +22858,7 @@ n No input is consumed. The corresponding argument shall be a pointer should be used instead of tmpnam_s when possible. One situation that requires the use of the tmpnam_s function is when the program needs to create a temporary directory rather than a temporary file. - Returns + Returns 8 If no suitable string can be generated, or if there is a runtime-constraint violation, the tmpnam_s function writes a null character to s[0] (only if s is not null and maxsize is greater than zero) and returns a nonzero value. @@ -22868,7 +22868,7 @@ n No input is consumed. The corresponding argument shall be a pointer 10 The value of the macro TMP_MAX_S shall be at least 25. K.3.5.2 File access functions K.3.5.2.1 The fopen_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> errno_t fopen_s(FILE * restrict * restrict streamptr, @@ -22888,7 +22888,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 584] (Contents) - Description + Description 4 The fopen_s function opens the file whose name is the string pointed to by filename, and associates a stream with it. 5 The mode string shall be as described for fopen, with the addition that modes starting @@ -22931,11 +22931,11 @@ n No input is consumed. The corresponding argument shall be a pointer [page 585] (Contents) to FILE pointed to by streamptr will be set to a null pointer. - Returns + Returns 9 The fopen_s function returns zero if it opened the file. If it did not open the file or if there was a runtime-constraint violation, fopen_s returns a nonzero value. K.3.5.2.2 The freopen_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> errno_t freopen_s(FILE * restrict * restrict newstreamptr, @@ -22947,7 +22947,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, freopen_s neither attempts to close any file associated with stream nor attempts to open a file. Furthermore, if newstreamptr is not a null pointer, fopen_s sets *newstreamptr to the null pointer. - Description + Description 4 The freopen_s 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 has the same meaning as in the fopen_s function (including the mode's effect @@ -22962,7 +22962,7 @@ n No input is consumed. The corresponding argument shall be a pointer 7 If the file was opened successfully, then the pointer to FILE pointed to by newstreamptr will be set to the value of stream. Otherwise, the pointer to FILE pointed to by newstreamptr will be set to a null pointer. - Returns + Returns 8 The freopen_s function returns zero if it opened the file. If it did not open the file or there was a runtime-constraint violation, freopen_s returns a nonzero value. @@ -22973,7 +22973,7 @@ n No input is consumed. The corresponding argument shall be a pointer subclause causes copying to take place between objects that overlap, the objects take on unspecified values. K.3.5.3.1 The fprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int fprintf_s(FILE * restrict stream, @@ -22986,10 +22986,10 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation,378) the fprintf_s function does not attempt to produce further output, and it is unspecified to what extent fprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The fprintf_s function is equivalent to the fprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The fprintf_s function returns the number of characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. @@ -23006,7 +23006,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 587] (Contents) K.3.5.3.2 The fscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int fscanf_s(FILE * restrict stream, @@ -23017,7 +23017,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation,379) the fscanf_s function does not attempt to perform further input, and it is unspecified to what extent fscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The fscanf_s function is equivalent to fscanf except that the c, s, and [ conversion specifiers apply to a pair of arguments (unless assignment suppression is indicated by a *). The first of these arguments is the same as for fscanf. That argument is @@ -23027,7 +23027,7 @@ n No input is consumed. The corresponding argument shall be a pointer one element.380) 5 A matching failure occurs if the number of elements in a receiving object is insufficient to hold the converted input (including any trailing null character). - Returns + Returns 6 The fscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the @@ -23072,7 +23072,7 @@ n No input is consumed. The corresponding argument shall be a pointer array of six characters to store it. K.3.5.3.3 The printf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int printf_s(const char * restrict format, ...); @@ -23091,14 +23091,14 @@ n No input is consumed. The corresponding argument shall be a pointer [page 589] (Contents) - Description + Description 4 The printf_s function is equivalent to the printf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The printf_s function returns the number of characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.5.3.4 The scanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int scanf_s(const char * restrict format, ...); @@ -23108,16 +23108,16 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the scanf_s function does not attempt to perform further input, and it is unspecified to what extent scanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The scanf_s function is equivalent to fscanf_s with the argument stdin interposed before the arguments to scanf_s. - Returns + Returns 5 The scanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the scanf_s 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. K.3.5.3.5 The snprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int snprintf_s(char * restrict s, rsize_t n, @@ -23133,19 +23133,19 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the snprintf_s function sets s[0] to the null character. - Description + Description 4 The snprintf_s function is equivalent to the snprintf function except for the explicit runtime-constraints listed above. 5 The snprintf_s function, unlike sprintf_s, will truncate the result to fit within the array pointed to by s. - Returns + Returns 6 The snprintf_s 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 a runtime-constraint violation occurred. Thus, the null-terminated output has been completely written if and only if the returned value is nonnegative and less than n. K.3.5.3.6 The sprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int sprintf_s(char * restrict s, rsize_t n, @@ -23172,18 +23172,18 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the sprintf_s function sets s[0] to the null character. - Description + Description 4 The sprintf_s function is equivalent to the sprintf function except for the parameter n and the explicit runtime-constraints listed above. 5 The sprintf_s function, unlike snprintf_s, treats a result too big for the array pointed to by s as a runtime-constraint violation. - Returns + Returns 6 If no runtime-constraint violation occurred, the sprintf_s function returns the number of characters written in the array, not counting the terminating null character. If an encoding error occurred, sprintf_s returns a negative value. If any other runtime- constraint violation occurred, sprintf_s returns zero. K.3.5.3.7 The sscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> int sscanf_s(const char * restrict s, @@ -23194,12 +23194,12 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the sscanf_s function does not attempt to perform further input, and it is unspecified to what extent sscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The sscanf_s function is equivalent to fscanf_s, 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_s function. If copying takes place between objects that overlap, the objects take on unspecified values. - Returns + Returns 5 The sscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the sscanf_s function returns the number of input items assigned, which can be fewer than @@ -23208,7 +23208,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 592] (Contents) K.3.5.3.8 The vfprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23223,14 +23223,14 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vfprintf_s function does not attempt to produce further output, and it is unspecified to what extent vfprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The vfprintf_s function is equivalent to the vfprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The vfprintf_s function returns the number of characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.5.3.9 The vfscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23253,18 +23253,18 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vfscanf_s function does not attempt to perform further input, and it is unspecified to what extent vfscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vfscanf_s function is equivalent to fscanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfscanf_s function does not invoke the va_end macro.385) - Returns + Returns 5 The vfscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vfscanf_s 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. K.3.5.3.10 The vprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23287,14 +23287,14 @@ n No input is consumed. The corresponding argument shall be a pointer [page 594] (Contents) - Description + Description 4 The vprintf_s function is equivalent to the vprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The vprintf_s function returns the number of characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.5.3.11 The vscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23306,12 +23306,12 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vscanf_s function does not attempt to perform further input, and it is unspecified to what extent vscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vscanf_s function is equivalent to scanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vscanf_s function does not invoke the va_end macro.387) - Returns + Returns 5 The vscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vscanf_s function returns the number of input items assigned, which can be fewer than @@ -23327,7 +23327,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 595] (Contents) K.3.5.3.12 The vsnprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23343,12 +23343,12 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the vsnprintf_s function sets s[0] to the null character. - Description + Description 4 The vsnprintf_s function is equivalent to the vsnprintf function except for the explicit runtime-constraints listed above. 5 The vsnprintf_s function, unlike vsprintf_s, will truncate the result to fit within the array pointed to by s. - Returns + Returns 6 The vsnprintf_s 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 a runtime-constraint violation occurred. Thus, the null-terminated @@ -23365,7 +23365,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 596] (Contents) K.3.5.3.13 The vsprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23382,12 +23382,12 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the vsprintf_s function sets s[0] to the null character. - Description + Description 4 The vsprintf_s function is equivalent to the vsprintf function except for the parameter n and the explicit runtime-constraints listed above. 5 The vsprintf_s function, unlike vsnprintf_s, treats a result too big for the array pointed to by s as a runtime-constraint violation. - Returns + Returns 6 If no runtime-constraint violation occurred, the vsprintf_s function returns the number of characters written in the array, not counting the terminating null character. If an encoding error occurred, vsprintf_s returns a negative value. If any other @@ -23403,7 +23403,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 597] (Contents) K.3.5.3.14 The vsscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -23416,19 +23416,19 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vsscanf_s function does not attempt to perform further input, and it is unspecified to what extent vsscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vsscanf_s function is equivalent to sscanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vsscanf_s function does not invoke the va_end macro.390) - Returns + Returns 5 The vsscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vscanf_s 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. K.3.5.4 Character input/output functions K.3.5.4.1 The gets_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> char *gets_s(char *s, rsize_t n); @@ -23449,7 +23449,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, s[0] is set to the null character, and characters are read and discarded from stdin until a new-line character is read, or end-of-file or a read error occurs. - Description + Description 4 The gets_s function reads at most one less than the number of characters specified by n from the stream pointed to by stdin, into the array pointed to by s. No additional characters are read after a new-line character (which is discarded) or after end-of-file. @@ -23464,7 +23464,7 @@ n No input is consumed. The corresponding argument shall be a pointer attention to the presence or absence of a new-line character in the result array. Consider using fgets (along with any needed processing based on new-line characters) instead of gets_s. - Returns + Returns 7 The gets_s function returns s if successful. If there was a runtime-constraint violation, or if end-of-file is encountered and no characters have been read into the array, or if a read error occurs during the operation, then a null pointer is returned. @@ -23494,12 +23494,12 @@ n No input is consumed. The corresponding argument shall be a pointer errno_t error); K.3.6.1 Runtime-constraint handling K.3.6.1.1 The set_constraint_handler_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> constraint_handler_t set_constraint_handler_s( constraint_handler_t handler); - Description + Description 2 The set_constraint_handler_s function sets the runtime-constraint handler to be handler. The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint violation. Only the most recent handler registered @@ -23521,24 +23521,24 @@ n No input is consumed. The corresponding argument shall be a pointer default handler is implementation-defined, and it may cause the program to exit or abort. 5 If the handler argument to set_constraint_handler_s is a null pointer, the implementation default handler becomes the current constraint handler. - Returns + Returns 6 The set_constraint_handler_s function returns a pointer to the previously registered handler.392) K.3.6.1.2 The abort_handler_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> void abort_handler_s( const char * restrict msg, void * restrict ptr, errno_t error); - Description + Description 2 A pointer to the abort_handler_s function shall be a suitable argument to the set_constraint_handler_s function. 3 The abort_handler_s function writes a message on the standard error stream in an implementation-defined format. The message shall include the string pointed to by msg. The abort_handler_s function then calls the abort function.393) - Returns + Returns 4 The abort_handler_s function does not return to its caller. @@ -23551,22 +23551,22 @@ n No input is consumed. The corresponding argument shall be a pointer [page 601] (Contents) K.3.6.1.3 The ignore_handler_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> void ignore_handler_s( const char * restrict msg, void * restrict ptr, errno_t error); - Description + Description 2 A pointer to the ignore_handler_s function shall be a suitable argument to the set_constraint_handler_s function. 3 The ignore_handler_s function simply returns to its caller.394) - Returns + Returns 4 The ignore_handler_s function returns no value. K.3.6.2 Communication with the environment K.3.6.2.1 The getenv_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> errno_t getenv_s(size_t * restrict len, @@ -23577,7 +23577,7 @@ n No input is consumed. The corresponding argument shall be a pointer RSIZE_MAX. If maxsize is not equal to zero, then value shall not be a null pointer. 3 If there is a runtime-constraint violation, the integer pointed to by len is set to 0 (if len is not null), and the environment list is not searched. - Description + Description 4 The getenv_s function searches an environment list, provided by the host environment, for a string that matches the string pointed to by name. @@ -23598,7 +23598,7 @@ n No input is consumed. The corresponding argument shall be a pointer zero, then value[0] is set to the null character. 7 The set of environment names and the method for altering the environment list are implementation-defined. - Returns + Returns 8 The getenv_s function returns zero if the specified name is found and the associated string was successfully stored in value. Otherwise, a nonzero value is returned. K.3.6.3 Searching and sorting utilities @@ -23635,7 +23635,7 @@ n No input is consumed. The corresponding argument shall be a pointer comparison function, and also between any call to the comparison function and any movement of the objects passed as arguments to that call. K.3.6.3.1 The bsearch_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> void *bsearch_s(const void *key, const void *base, @@ -23648,7 +23648,7 @@ n No input is consumed. The corresponding argument shall be a pointer zero, then none of key, base, or compar shall be a null pointer. 3 If there is a runtime-constraint violation, the bsearch_s function does not search the array. - Description + Description 4 The bsearch_s 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 size of each element of the array is specified by size. @@ -23671,12 +23671,12 @@ n No input is consumed. The corresponding argument shall be a pointer [page 604] (Contents) - Returns + Returns 6 The bsearch_s function returns a pointer to a matching element of the array, or a null pointer if no match is found or there is a runtime-constraint violation. If two elements compare as equal, which element is matched is unspecified. K.3.6.3.2 The qsort_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> errno_t qsort_s(void *base, rsize_t nmemb, rsize_t size, @@ -23687,7 +23687,7 @@ n No input is consumed. The corresponding argument shall be a pointer 2 Neither nmemb nor size shall be greater than RSIZE_MAX. If nmemb is not equal to zero, then neither base nor compar shall be a null pointer. 3 If there is a runtime-constraint violation, the qsort_s function does not sort the array. - Description + Description 4 The qsort_s 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. 5 The contents of the array are sorted into ascending order according to a comparison @@ -23699,7 +23699,7 @@ n No input is consumed. The corresponding argument shall be a pointer pass it to the comparison function.398) 6 If two elements compare as equal, their relative order in the resulting sorted array is unspecified. - Returns + Returns 7 The qsort_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. @@ -23721,7 +23721,7 @@ n No input is consumed. The corresponding argument shall be a pointer encodings have state dependency, and zero otherwise.399) Changing the LC_CTYPE category causes the conversion state of these functions to be indeterminate. K.3.6.4.1 The wctomb_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdlib.h> errno_t wctomb_s(int * restrict status, @@ -23736,7 +23736,7 @@ n No input is consumed. The corresponding argument shall be a pointer 4 If there is a runtime-constraint violation, wctomb_s does not modify the int pointed to by status, and if s is not a null pointer, no more than smax elements in the array pointed to by s will be accessed. - Description + Description 5 The wctomb_s function determines n and stores the multibyte character representation of wc in the array whose first element is pointed to by s (if s is not a null pointer). The number of characters stored never exceeds MB_CUR_MAX or smax. If wc is a null wide @@ -23760,14 +23760,14 @@ n No input is consumed. The corresponding argument shall be a pointer multibyte character. 9 In no case will the int pointed to by status be set to a value greater than the MB_CUR_MAX macro. - Returns + Returns 10 The wctomb_s function returns zero if successful, and a nonzero value if there was a runtime-constraint violation or wc did not correspond to a valid multibyte character. K.3.6.5 Multibyte/wide string conversion functions 1 The behavior of the multibyte string functions is affected by the LC_CTYPE category of the current locale. K.3.6.5.1 The mbstowcs_s function - Synopsis + Synopsis 1 #include <stdlib.h> errno_t mbstowcs_s(size_t * restrict retval, wchar_t * restrict dst, rsize_t dstmax, @@ -23782,7 +23782,7 @@ n No input is consumed. The corresponding argument shall be a pointer retval is not a null pointer, then mbstowcs_s sets *retval to (size_t)(-1). If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX, then mbstowcs_s sets dst[0] to the null wide character. - Description + Description 4 The mbstowcs_s function converts a sequence of multibyte characters that begins in the initial shift state from the array pointed to by src into a sequence of corresponding wide characters. If dst is not a null pointer, the converted characters are stored into the @@ -23805,11 +23805,11 @@ n No input is consumed. The corresponding argument shall be a pointer unspecified values when mbstowcs_s returns.401) 7 If copying takes place between objects that overlap, the objects take on unspecified values. - Returns + Returns 8 The mbstowcs_s function returns zero if no runtime-constraint violation and no encoding error occurred. Otherwise, a nonzero value is returned. K.3.6.5.2 The wcstombs_s function - Synopsis + Synopsis 1 #include <stdlib.h> errno_t wcstombs_s(size_t * restrict retval, char * restrict dst, rsize_t dstmax, @@ -23835,7 +23835,7 @@ n No input is consumed. The corresponding argument shall be a pointer retval is not a null pointer, then wcstombs_s sets *retval to (size_t)(-1). If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX, then wcstombs_s sets dst[0] to the null character. - Description + Description 4 The wcstombs_s function converts a sequence of wide characters from the array pointed to by src into a sequence of corresponding multibyte characters that begins in the initial shift state. If dst is not a null pointer, the converted characters are then stored @@ -23873,7 +23873,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 609] (Contents) - Returns + Returns 8 The wcstombs_s function returns zero if no runtime-constraint violation and no encoding error occurred. Otherwise, a nonzero value is returned. K.3.7 String handling <string.h> @@ -23885,7 +23885,7 @@ n No input is consumed. The corresponding argument shall be a pointer which is the type size_t. K.3.7.1 Copying functions K.3.7.1.1 The memcpy_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t memcpy_s(void * restrict s1, rsize_t s1max, @@ -23897,10 +23897,10 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the memcpy_s function stores zeros in the first s1max characters of the object pointed to by s1 if s1 is not a null pointer and s1max is not greater than RSIZE_MAX. - Description + Description 4 The memcpy_s function copies n characters from the object pointed to by s2 into the object pointed to by s1. - Returns + Returns 5 The memcpy_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. @@ -23910,7 +23910,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 610] (Contents) K.3.7.1.2 The memmove_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t memmove_s(void *s1, rsize_t s1max, @@ -23921,17 +23921,17 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the memmove_s function stores zeros in the first s1max characters of the object pointed to by s1 if s1 is not a null pointer and s1max is not greater than RSIZE_MAX. - Description + Description 4 The memmove_s function copies n characters from the object pointed to by s2 into the object pointed to by s1. This 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 or s2, and then the n characters from the temporary array are copied into the object pointed to by s1. - Returns + Returns 5 The memmove_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.7.1.3 The strcpy_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t strcpy_s(char * restrict s1, @@ -23947,17 +23947,17 @@ n No input is consumed. The corresponding argument shall be a pointer [page 611] (Contents) - Description + Description 4 The strcpy_s function copies the string pointed to by s2 (including the terminating null character) into the array pointed to by s1. 5 All elements following the terminating null character (if any) written by strcpy_s in the array of s1max characters pointed to by s1 take unspecified values when strcpy_s returns.404) - Returns + Returns 6 The strcpy_s function returns zero405) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.7.1.4 The strncpy_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t strncpy_s(char * restrict s1, @@ -23972,7 +23972,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then strncpy_s sets s1[0] to the null character. - Description + Description 4 The strncpy_s function copies not more than n successive characters (characters that follow a null character are not copied) from the array pointed to by s2 to the array pointed to by s1. If no null character was copied from s2, then s1[n] is set to a null @@ -23990,7 +23990,7 @@ n No input is consumed. The corresponding argument shall be a pointer 5 All elements following the terminating null character (if any) written by strncpy_s in the array of s1max characters pointed to by s1 take unspecified values when strncpy_s returns.406) - Returns + Returns 6 The strncpy_s function returns zero407) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. 7 EXAMPLE 1 The strncpy_s function can be used to copy a string without the danger that the result @@ -24011,7 +24011,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.7.2 Concatenation functions K.3.7.2.1 The strcat_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t strcat_s(char * restrict s1, @@ -24038,18 +24038,18 @@ n No input is consumed. The corresponding argument shall be a pointer 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then strcat_s sets s1[0] to the null character. - Description + Description 5 The strcat_s 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 from s2 overwrites the null character at the end of s1. 6 All elements following the terminating null character (if any) written by strcat_s in the array of s1max characters pointed to by s1 take unspecified values when strcat_s returns.409) - Returns + Returns 7 The strcat_s function returns zero410) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.7.2.2 The strncat_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t strncat_s(char * restrict s1, @@ -24077,7 +24077,7 @@ n No input is consumed. The corresponding argument shall be a pointer 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then strncat_s sets s1[0] to the null character. - Description + Description 5 The strncat_s function appends not more than n successive characters (characters that follow a null character are not copied) from the array pointed to by s2 to the end of the string pointed to by s1. The initial character from s2 overwrites the null character at @@ -24086,7 +24086,7 @@ n No input is consumed. The corresponding argument shall be a pointer 6 All elements following the terminating null character (if any) written by strncat_s in the array of s1max characters pointed to by s1 take unspecified values when strncat_s returns.412) - Returns + Returns 7 The strncat_s function returns zero413) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. 8 EXAMPLE 1 The strncat_s function can be used to copy a string without the danger that the result @@ -24123,7 +24123,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.7.3 Search functions K.3.7.3.1 The strtok_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> char *strtok_s(char * restrict s1, @@ -24138,7 +24138,7 @@ n No input is consumed. The corresponding argument shall be a pointer on subsequent calls. 3 If there is a runtime-constraint violation, the strtok_s function does not indirect through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr. - Description + Description 4 A sequence of calls to the strtok_s 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 fourth argument points to a caller-provided char pointer into which the @@ -24167,7 +24167,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 character (if any). - Returns + Returns 9 The strtok_s function returns a pointer to the first character of a token, or a null pointer if there is no token or there is a runtime-constraint violation. 10 EXAMPLE @@ -24186,7 +24186,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.7.4 Miscellaneous functions K.3.7.4.1 The memset_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t memset_s(void *s, rsize_t smax, int c, rsize_t n) @@ -24201,18 +24201,18 @@ n No input is consumed. The corresponding argument shall be a pointer [page 617] (Contents) - Description + Description 4 The memset_s 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. Unlike memset, any call to the memset_s function shall be evaluated strictly according to the rules of the abstract machine as described in (5.1.2.3). That is, any call to the memset_s function shall assume that the memory indicated by s and n may be accessible in the future and thus must contain the values indicated by c. - Returns + Returns 5 The memset_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.7.4.2 The strerror_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> errno_t strerror_s(char *s, rsize_t maxsize, @@ -24222,7 +24222,7 @@ n No input is consumed. The corresponding argument shall be a pointer maxsize shall not equal zero. 3 If there is a runtime-constraint violation, then the array (if any) pointed to by s is not modified. - Description + Description 4 The strerror_s function maps the number in errnum to a locale-specific message string. Typically, the values for errnum come from errno, but strerror_s shall map any value of type int to a message. @@ -24232,7 +24232,7 @@ n No input is consumed. The corresponding argument shall be a pointer from the string to the array pointed to by s and then s[maxsize-1] is set to the null character. Then, if maxsize is greater than 3, then s[maxsize-2], s[maxsize-3], and s[maxsize-4] are set to the character period (.). - Returns + Returns 7 The strerror_s function returns zero if the length of the desired string was less than maxsize and there was no runtime-constraint violation. Otherwise, the strerror_s function returns a nonzero value. @@ -24240,24 +24240,24 @@ n No input is consumed. The corresponding argument shall be a pointer [page 618] (Contents) K.3.7.4.3 The strerrorlen_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> size_t strerrorlen_s(errno_t errnum); - Description + Description 2 The strerrorlen_s function calculates the length of the (untruncated) locale-specific message string that the strerror_s function maps to errnum. - Returns + Returns 3 The strerrorlen_s function returns the number of characters (not including the null character) in the full message string. K.3.7.4.4 The strnlen_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <string.h> size_t strnlen_s(const char *s, size_t maxsize); - Description + Description 2 The strnlen_s function computes the length of the string pointed to by s. - Returns + Returns 3 If s is a null pointer,414) then the strnlen_s function returns zero. 4 Otherwise, the strnlen_s function returns the number of characters that precede the terminating null character. If there is no null character in the first maxsize characters of @@ -24287,7 +24287,7 @@ n No input is consumed. The corresponding argument shall be a pointer 1 Like the strftime function, the asctime_s and ctime_s functions do not return a pointer to a static object, and other library functions are permitted to call them. K.3.8.2.1 The asctime_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> errno_t asctime_s(char *s, rsize_t maxsize, @@ -24301,7 +24301,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, there is no attempt to convert the time, and s[0] is set to a null character if s is not a null pointer and maxsize is not zero and is not greater than RSIZE_MAX. - Description + Description 4 The asctime_s function converts the normalized broken-down time in the structure pointed to by timeptr into a 26 character (including the null character) string in the @@ -24340,13 +24340,13 @@ n No input is consumed. The corresponding argument shall be a pointer The strftime function allows more flexible formatting and supports locale-specific behavior. If you do not require the exact form of the result string produced by the asctime_s function, consider using the strftime function instead. - Returns + Returns 5 The asctime_s function returns zero if the time was successfully converted and stored into the array pointed to by s. Otherwise, it returns a nonzero value. [page 621] (Contents) K.3.8.2.2 The ctime_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> errno_t ctime_s(char *s, rsize_t maxsize, @@ -24356,7 +24356,7 @@ n No input is consumed. The corresponding argument shall be a pointer shall not be greater than RSIZE_MAX. 3 If there is a runtime-constraint violation, s[0] is set to a null character if s is not a null pointer and maxsize is not equal zero and is not greater than RSIZE_MAX. - Description + Description 4 The ctime_s function converts the calendar time pointed to by timer to local time in the form of a string. It is equivalent to asctime_s(s, maxsize, localtime_s(timer)) @@ -24364,11 +24364,11 @@ n No input is consumed. The corresponding argument shall be a pointer The strftime function allows more flexible formatting and supports locale-specific behavior. If you do not require the exact form of the result string produced by the ctime_s function, consider using the strftime function instead. - Returns + Returns 5 The ctime_s function returns zero if the time was successfully converted and stored into the array pointed to by s. Otherwise, it returns a nonzero value. K.3.8.2.3 The gmtime_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> struct tm *gmtime_s(const time_t * restrict timer, @@ -24376,17 +24376,17 @@ n No input is consumed. The corresponding argument shall be a pointer Runtime-constraints 2 Neither timer nor result shall be a null pointer. 3 If there is a runtime-constraint violation, there is no attempt to convert the time. - Description + Description 4 The gmtime_s function converts the calendar time pointed to by timer into a broken- down time, expressed as UTC. The broken-down time is stored in the structure pointed [page 622] (Contents) to by result. - Returns + Returns 5 The gmtime_s function returns result, or a null pointer if the specified time cannot be converted to UTC or there is a runtime-constraint violation. K.3.8.2.4 The localtime_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <time.h> struct tm *localtime_s(const time_t * restrict timer, @@ -24394,11 +24394,11 @@ n No input is consumed. The corresponding argument shall be a pointer Runtime-constraints 2 Neither timer nor result shall be a null pointer. 3 If there is a runtime-constraint violation, there is no attempt to convert the time. - Description + Description 4 The localtime_s function converts the calendar time pointed to by timer into a broken-down time, expressed as local time. The broken-down time is stored in the structure pointed to by result. - Returns + Returns 5 The localtime_s function returns result, or a null pointer if the specified time cannot be converted to local time or there is a runtime-constraint violation. K.3.9 Extended multibyte and wide character utilities <wchar.h> @@ -24419,7 +24419,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.9.1 Formatted wide character input/output functions K.3.9.1.1 The fwprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int fwprintf_s(FILE * restrict stream, @@ -24432,14 +24432,14 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the fwprintf_s function does not attempt to produce further output, and it is unspecified to what extent fwprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The fwprintf_s function is equivalent to the fwprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The fwprintf_s function returns the number of wide characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.9.1.2 The fwscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> #include <wchar.h> @@ -24459,7 +24459,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the fwscanf_s function does not attempt to perform further input, and it is unspecified to what extent fwscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The fwscanf_s function is equivalent to fwscanf except that the c, s, and [ conversion specifiers apply to a pair of arguments (unless assignment suppression is indicated by a *). The first of these arguments is the same as for fwscanf. That @@ -24469,13 +24469,13 @@ n No input is consumed. The corresponding argument shall be a pointer an array of one element.417) 5 A matching failure occurs if the number of elements in a receiving object is insufficient to hold the converted input (including any trailing null character). - Returns + Returns 6 The fwscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the fwscanf_s 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. K.3.9.1.3 The snwprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int snwprintf_s(wchar_t * restrict s, @@ -24504,19 +24504,19 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the snwprintf_s function sets s[0] to the null wide character. - Description + Description 4 The snwprintf_s function is equivalent to the swprintf function except for the explicit runtime-constraints listed above. 5 The snwprintf_s function, unlike swprintf_s, will truncate the result to fit within the array pointed to by s. - Returns + Returns 6 The snwprintf_s function returns the number of wide characters that would have been written had n been sufficiently large, not counting the terminating wide null character, or a negative value if a runtime-constraint violation occurred. Thus, the null- terminated output has been completely written if and only if the returned value is nonnegative and less than n. K.3.9.1.4 The swprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int swprintf_s(wchar_t * restrict s, rsize_t n, @@ -24542,19 +24542,19 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the swprintf_s function sets s[0] to the null wide character. - Description + Description 4 The swprintf_s function is equivalent to the swprintf function except for the explicit runtime-constraints listed above. 5 The swprintf_s function, unlike snwprintf_s, treats a result too big for the array pointed to by s as a runtime-constraint violation. - Returns + Returns 6 If no runtime-constraint violation occurred, the swprintf_s function returns the number of wide characters written in the array, not counting the terminating null wide character. If an encoding error occurred or if n or more wide characters are requested to be written, swprintf_s returns a negative value. If any other runtime-constraint violation occurred, swprintf_s returns zero. K.3.9.1.5 The swscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int swscanf_s(const wchar_t * restrict s, @@ -24565,12 +24565,12 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the swscanf_s function does not attempt to perform further input, and it is unspecified to what extent swscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The swscanf_s function is equivalent to fwscanf_s, 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_s function. - Returns + Returns 5 The swscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the swscanf_s function returns the number of input items assigned, which can be fewer @@ -24578,7 +24578,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 627] (Contents) K.3.9.1.6 The vfwprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -24594,14 +24594,14 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vfwprintf_s function does not attempt to produce further output, and it is unspecified to what extent vfwprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The vfwprintf_s function is equivalent to the vfwprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The vfwprintf_s function returns the number of wide characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.9.1.7 The vfwscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <stdio.h> @@ -24623,18 +24623,18 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vfwscanf_s function does not attempt to perform further input, and it is unspecified to what extent vfwscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vfwscanf_s function is equivalent to fwscanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vfwscanf_s function does not invoke the va_end macro.421) - Returns + Returns 5 The vfwscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vfwscanf_s 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. K.3.9.1.8 The vsnwprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <wchar.h> @@ -24660,19 +24660,19 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s is not a null pointer and n is greater than zero and less than RSIZE_MAX, then the vsnwprintf_s function sets s[0] to the null wide character. - Description + Description 4 The vsnwprintf_s function is equivalent to the vswprintf function except for the explicit runtime-constraints listed above. 5 The vsnwprintf_s function, unlike vswprintf_s, will truncate the result to fit within the array pointed to by s. - Returns + Returns 6 The vsnwprintf_s function returns the number of wide characters that would have been written had n been sufficiently large, not counting the terminating null character, or a negative value if a runtime-constraint violation occurred. Thus, the null-terminated output has been completely written if and only if the returned value is nonnegative and less than n. K.3.9.1.9 The vswprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <wchar.h> @@ -24697,19 +24697,19 @@ n No input is consumed. The corresponding argument shall be a pointer [page 630] (Contents) - Description + Description 4 The vswprintf_s function is equivalent to the vswprintf function except for the explicit runtime-constraints listed above. 5 The vswprintf_s function, unlike vsnwprintf_s, treats a result too big for the array pointed to by s as a runtime-constraint violation. - Returns + Returns 6 If no runtime-constraint violation occurred, the vswprintf_s function returns the number of wide characters written in the array, not counting the terminating null wide character. If an encoding error occurred or if n or more wide characters are requested to be written, vswprintf_s returns a negative value. If any other runtime-constraint violation occurred, vswprintf_s returns zero. K.3.9.1.10 The vswscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <wchar.h> @@ -24722,7 +24722,7 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vswscanf_s function does not attempt to perform further input, and it is unspecified to what extent vswscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vswscanf_s function is equivalent to swscanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vswscanf_s function does not invoke the @@ -24736,13 +24736,13 @@ n No input is consumed. The corresponding argument shall be a pointer [page 631] (Contents) - Returns + Returns 5 The vswscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vswscanf_s 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. K.3.9.1.11 The vwprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <wchar.h> @@ -24755,10 +24755,10 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vwprintf_s function does not attempt to produce further output, and it is unspecified to what extent vwprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The vwprintf_s function is equivalent to the vwprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The vwprintf_s function returns the number of wide characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. @@ -24772,7 +24772,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 632] (Contents) K.3.9.1.12 The vwscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <stdarg.h> #include <wchar.h> @@ -24784,18 +24784,18 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the vwscanf_s function does not attempt to perform further input, and it is unspecified to what extent vwscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The vwscanf_s function is equivalent to wscanf_s, with the variable argument list replaced by arg, which shall have been initialized by the va_start macro (and possibly subsequent va_arg calls). The vwscanf_s function does not invoke the va_end macro.426) - Returns + Returns 5 The vwscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the vwscanf_s 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. K.3.9.1.13 The wprintf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int wprintf_s(const wchar_t * restrict format, ...); @@ -24815,14 +24815,14 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the wprintf_s function does not attempt to produce further output, and it is unspecified to what extent wprintf_s produced output before discovering the runtime-constraint violation. - Description + Description 4 The wprintf_s function is equivalent to the wprintf function except for the explicit runtime-constraints listed above. - Returns + Returns 5 The wprintf_s function returns the number of wide characters transmitted, or a negative value if an output error, encoding error, or runtime-constraint violation occurred. K.3.9.1.14 The wscanf_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> int wscanf_s(const wchar_t * restrict format, ...); @@ -24832,10 +24832,10 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, the wscanf_s function does not attempt to perform further input, and it is unspecified to what extent wscanf_s performed input before discovering the runtime-constraint violation. - Description + Description 4 The wscanf_s function is equivalent to fwscanf_s with the argument stdin interposed before the arguments to wscanf_s. - Returns + Returns 5 The wscanf_s function returns the value of the macro EOF if an input failure occurs before any conversion or if there is a runtime-constraint violation. Otherwise, the wscanf_s function returns the number of input items assigned, which can be fewer than @@ -24849,7 +24849,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.9.2 General wide string utilities K.3.9.2.1 Wide string copying functions K.3.9.2.1.1 The wcscpy_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wcscpy_s(wchar_t * restrict s1, @@ -24862,13 +24862,13 @@ n No input is consumed. The corresponding argument shall be a pointer 3 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then wcscpy_s sets s1[0] to the null wide character. - Description + Description 4 The wcscpy_s function copies the wide string pointed to by s2 (including the terminating null wide character) into the array pointed to by s1. 5 All elements following the terminating null wide character (if any) written by wcscpy_s in the array of s1max wide characters pointed to by s1 take unspecified values when wcscpy_s returns.428) - Returns + Returns 6 The wcscpy_s function returns zero429) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. @@ -24884,7 +24884,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 635] (Contents) K.3.9.2.1.2 The wcsncpy_s function - Synopsis + Synopsis 7 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wcsncpy_s(wchar_t * restrict s1, @@ -24899,7 +24899,7 @@ n No input is consumed. The corresponding argument shall be a pointer 9 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then wcsncpy_s sets s1[0] to the null wide character. - Description + Description 10 The wcsncpy_s function copies not more than n successive wide characters (wide characters that follow a null wide character are not copied) from the array pointed to by s2 to the array pointed to by s1. If no null wide character was copied from s2, then @@ -24907,7 +24907,7 @@ n No input is consumed. The corresponding argument shall be a pointer 11 All elements following the terminating null wide character (if any) written by wcsncpy_s in the array of s1max wide characters pointed to by s1 take unspecified values when wcsncpy_s returns.430) - Returns + Returns 12 The wcsncpy_s function returns zero431) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. 13 EXAMPLE 1 The wcsncpy_s function can be used to copy a wide string without the danger that the @@ -24940,7 +24940,7 @@ n No input is consumed. The corresponding argument shall be a pointer The third call will assign to r3 the value zero and to dst3 the sequence of wide characters good\0. K.3.9.2.1.3 The wmemcpy_s function - Synopsis + Synopsis 14 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wmemcpy_s(wchar_t * restrict s1, @@ -24954,10 +24954,10 @@ n No input is consumed. The corresponding argument shall be a pointer 16 If there is a runtime-constraint violation, the wmemcpy_s function stores zeros in the first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and s1max is not greater than RSIZE_MAX. - Description + Description 17 The wmemcpy_s function copies n successive wide characters from the object pointed to by s2 into the object pointed to by s1. - Returns + Returns 18 The wmemcpy_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. @@ -24967,7 +24967,7 @@ n No input is consumed. The corresponding argument shall be a pointer [page 637] (Contents) K.3.9.2.1.4 The wmemmove_s function - Synopsis + Synopsis 19 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wmemmove_s(wchar_t *s1, rsize_t s1max, @@ -24978,18 +24978,18 @@ n No input is consumed. The corresponding argument shall be a pointer 21 If there is a runtime-constraint violation, the wmemmove_s function stores zeros in the first s1max wide characters of the object pointed to by s1 if s1 is not a null pointer and s1max is not greater than RSIZE_MAX. - Description + Description 22 The wmemmove_s function copies n successive wide characters from the object pointed to by s2 into the object pointed to by s1. This 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 23 The wmemmove_s function returns zero if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.9.2.2 Wide string concatenation functions K.3.9.2.2.1 The wcscat_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wcscat_s(wchar_t * restrict s1, @@ -25007,18 +25007,18 @@ n No input is consumed. The corresponding argument shall be a pointer 4 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then wcscat_s sets s1[0] to the null wide character. - Description + Description 5 The wcscat_s 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 from s2 overwrites the null wide character at the end of s1. 6 All elements following the terminating null wide character (if any) written by wcscat_s in the array of s1max wide characters pointed to by s1 take unspecified values when wcscat_s returns.433) - Returns + Returns 7 The wcscat_s function returns zero434) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. K.3.9.2.2.2 The wcsncat_s function - Synopsis + Synopsis 8 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> errno_t wcsncat_s(wchar_t * restrict s1, @@ -25047,7 +25047,7 @@ n No input is consumed. The corresponding argument shall be a pointer 11 If there is a runtime-constraint violation, then if s1 is not a null pointer and s1max is greater than zero and not greater than RSIZE_MAX, then wcsncat_s sets s1[0] to the null wide character. - Description + Description 12 The wcsncat_s function appends not more than n successive wide characters (wide characters that follow a null wide character are not copied) from the array pointed to by s2 to the end of the wide string pointed to by s1. The initial wide character from s2 @@ -25056,7 +25056,7 @@ n No input is consumed. The corresponding argument shall be a pointer 13 All elements following the terminating null wide character (if any) written by wcsncat_s in the array of s1max wide characters pointed to by s1 take unspecified values when wcsncat_s returns.436) - Returns + Returns 14 The wcsncat_s function returns zero437) if there was no runtime-constraint violation. Otherwise, a nonzero value is returned. 15 EXAMPLE 1 The wcsncat_s function can be used to copy a wide string without the danger that the @@ -25093,7 +25093,7 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.9.2.3 Wide string search functions K.3.9.2.3.1 The wcstok_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> wchar_t *wcstok_s(wchar_t * restrict s1, @@ -25108,7 +25108,7 @@ n No input is consumed. The corresponding argument shall be a pointer resumes on subsequent calls. 3 If there is a runtime-constraint violation, the wcstok_s function does not indirect through the s1 or s2 pointers, and does not store a value in the object pointed to by ptr. - Description + Description 4 A sequence of calls to the wcstok_s 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 fourth argument points to a caller-provided wchar_t @@ -25140,7 +25140,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 9 The wcstok_s function returns a pointer to the first wide character of a token, or a null pointer if there is no token or there is a runtime-constraint violation. 10 EXAMPLE @@ -25159,13 +25159,13 @@ n No input is consumed. The corresponding argument shall be a pointer K.3.9.2.4 Miscellaneous functions K.3.9.2.4.1 The wcsnlen_s function - Synopsis + Synopsis 1 #define __STDC_WANT_LIB_EXT1__ 1 #include <wchar.h> size_t wcsnlen_s(const wchar_t *s, size_t maxsize); - Description + Description 2 The wcsnlen_s function computes the length of the wide string pointed to by s. - Returns + Returns 3 If s is a null pointer,438) then the wcsnlen_s function returns zero. 4 Otherwise, the wcsnlen_s function returns the number of wide characters that precede the terminating null wide character. If there is no null wide character in the first @@ -25179,7 +25179,7 @@ n No input is consumed. The corresponding argument shall be a pointer 1 Unlike wcrtomb, wcrtomb_s does not permit the ps parameter (the pointer to the conversion state) to be a null pointer. K.3.9.3.1.1 The wcrtomb_s function - Synopsis + Synopsis 2 #include <wchar.h> errno_t wcrtomb_s(size_t * restrict retval, char * restrict s, rsize_t smax, @@ -25193,7 +25193,7 @@ n No input is consumed. The corresponding argument shall be a pointer not a null pointer and smax is greater than zero and not greater than RSIZE_MAX, then wcrtomb_s sets s[0] to the null character. If retval is not a null pointer, then wcrtomb_s sets *retval to (size_t)(-1). - Description + Description 5 If s is a null pointer, the wcrtomb_s function is equivalent to the call wcrtomb_s(&retval, buf, sizeof buf, L'\0', ps) where retval and buf are internal variables of the appropriate types, and the size of @@ -25217,14 +25217,14 @@ n No input is consumed. The corresponding argument shall be a pointer conversion state is unspecified. Otherwise, the wcrtomb_s function stores into *retval the number of bytes (including any shift sequences) stored in the array pointed to by s. - Returns + Returns 8 The wcrtomb_s function returns zero if no runtime-constraint violation and no encoding error occurred. Otherwise, a nonzero value is returned. K.3.9.3.2 Restartable multibyte/wide string conversion functions 1 Unlike mbsrtowcs and wcsrtombs, mbsrtowcs_s and wcsrtombs_s do not permit the ps parameter (the pointer to the conversion state) to be a null pointer. K.3.9.3.2.1 The mbsrtowcs_s function - Synopsis + Synopsis 2 #include <wchar.h> errno_t mbsrtowcs_s(size_t * restrict retval, wchar_t * restrict dst, rsize_t dstmax, @@ -25241,7 +25241,7 @@ n No input is consumed. The corresponding argument shall be a pointer retval is not a null pointer, then mbsrtowcs_s sets *retval to (size_t)(-1). If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX, then mbsrtowcs_s sets dst[0] to the null wide character. - Description + Description 5 The mbsrtowcs_s 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 @@ -25271,11 +25271,11 @@ n No input is consumed. The corresponding argument shall be a pointer unspecified values when mbsrtowcs_s returns.440) 9 If copying takes place between objects that overlap, the objects take on unspecified values. - Returns + Returns 10 The mbsrtowcs_s function returns zero if no runtime-constraint violation and no encoding error occurred. Otherwise, a nonzero value is returned. K.3.9.3.2.2 The wcsrtombs_s function - Synopsis + Synopsis 11 #include <wchar.h> errno_t wcsrtombs_s(size_t * restrict retval, char * restrict dst, rsize_t dstmax, @@ -25302,7 +25302,7 @@ n No input is consumed. The corresponding argument shall be a pointer retval is not a null pointer, then wcsrtombs_s sets *retval to (size_t)(-1). If dst is not a null pointer and dstmax is greater than zero and less than RSIZE_MAX, then wcsrtombs_s sets dst[0] to the null character. - Description + Description 14 The wcsrtombs_s 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 @@ -25344,7 +25344,7 @@ n No input is consumed. The corresponding argument shall be a pointer wcsrtombs_s returns.442) 18 If copying takes place between objects that overlap, the objects take on unspecified values. - Returns + Returns 19 The wcsrtombs_s function returns zero if no runtime-constraint violation and no encoding error occurred. Otherwise, a nonzero value is returned. diff --git a/tohtml.sh b/tohtml.sh index b764269..504d92a 100755 --- a/tohtml.sh +++ b/tohtml.sh @@ -63,6 +63,11 @@ BEGIN { next } +/^ *(Syntax|Semantics|Description|Constraints|Synopsis|Returns)$/ { + print "" $0 "" + next +} + { s = $0 p = "" -- 2.20.1