Previous Table of Contents "New C Standard" commentary
The expression that denotes the called function78) shall
have type pointer to function returning
998 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.
999 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.
A postfix expression followed by parentheses
1001 The postfix expression denotes the called function.
1002 The list of expressions specifies the arguments to the function.
1003 An argument may be an expression of any object type.
1004 In preparing for the call to a function, the arguments are evaluated, and each parameter is assigned the value of the corresponding argument.79)
1005 If the expression that denotes the called function has type pointer to function returning an object type, the function call expression has the same type as that object type, and has the value determined as specified in 22.214.171.124.
Otherwise, the function call has type
1007 If an attempt is made to modify the result of a function call or to access it after the next sequence point, the behavior is undefined.
If the expression that denotes the called function has a type that
does not include a prototype, the integer promotions are performed on
each argument, and arguments that have type
1009 These are called the default argument promotions.
1010 If the number of arguments does not equal the number of parameters, the behavior is undefined.
If the function is defined with a type that includes a prototype, and
either the prototype ends with an ellipsis (
1012 If the function is defined with a type that does not include a prototype, and the types of the arguments after promotion are not compatible with those of the parameters after promotion, the behavior is undefined, except for the following cases:
1013 78) Most often, this is the result of converting an identifier that is a function designator.
1014 79) A function may change the values of its parameters, but these changes cannot affect the values of the arguments.
1015 On the other hand, it is possible to pass a pointer to an object, and the function may change the value of the object pointed to.
1016 A parameter declared to have array or function type is adjusted to have a pointer type as described in 6.9.1.
1017 one promoted type is a signed integer type, the other promoted type is the corresponding unsigned integer type, and the value is representable in both types;
both types are pointers to qualified or unqualified versions
of a character type or
1019 If the expression that denotes the called function has a type that does include a prototype, the arguments are implicitly converted, as if by assignment, to the types of the corresponding parameters, taking the type of each parameter to be the unqualified version of its declared type.
1020 The ellipsis notation in a function prototype declarator causes argument type conversion to stop after the last declared parameter.
1021 The default argument promotions are performed on trailing arguments.
1022 No other conversions are performed implicitly;
1023 in particular, the number and types of arguments are not compared with those of the parameters in a function definition that does not include a function prototype declarator.
1024 If the function is defined with a type that is not compatible with the type (of the expression) pointed to by the expression that denotes the called function, the behavior is undefined.
1025 The order of evaluation of the function designator, the actual arguments, and subexpressions within the actual arguments is unspecified, but there is a sequence point before the actual call.
1026 Recursive function calls shall be permitted, both directly and indirectly through any chain of other functions.
1027 EXAMPLE In the function call
(*pf[f1()]) (f2(), f3() + f4())
function declarators (including prototypes) (126.96.36.199), function
definitions (6.9.1), the
Created at: 2008-01-30 02:39:42
The text from WG14/N1256 is copyright © ISO
Created at: 2008-01-30 02:39:42 The text from WG14/N1256 is copyright © ISO