N 2719: No function declarators without prototypes

Submitter: Philipp Klaus Krause
Submission Date: 2021-05-09

Summary:

No function declarators without prototypes

This removes the obsolescent support for function declarators without prototypes.

Justification:

Function declarators without prototypes have been an obsolescent feature since the very first ISO C standard. 33 years of advance warning should be enough.

Do we want to remove function declarators without prototypes?

Proposed change: In N2596:

§6.7.6.3: replace the paragraph
"For a function declarator without a parameter type list: if it is part of a definition of that function the function has no parameters and the effect is as if it were declared with a parameter type list consisting of the keyword void ; otherwise it specifies that no information about the number or types of the parameters is supplied.157) A function declarator provides a prototype for the function if it includes a parameter type list.158) Otherwise, a function declaration is said to have no prototype."
by
"For a function declarator without a parameter type list: if it is part of a definition of that function the function has no parameters and the effect is as if it were declared with a parameter type list consisting of the keyword void ; otherwise it is a constraint violation. A function declarator provides a prototype for the function.158)"
and remove footnote 157.

§6.7.6.3: replace the paragraph
"For two function types to be compatible, both shall specify compatible return types. Moreover, the parameter type lists, if both are present, shall agree in the number of parameters and in use of the ellipsis terminator; corresponding parameters shall have compatible types. If one type has a parameter type list and the other type has none and is not part of a function definition, the parameter list shall not have an ellipsis terminator. In the determination of type compatibility and of a composite type, each parameter declared with function or array type is taken as having the adjusted type and each parameter declared with qualified type is taken as having the unqualified version of its declared type."
by
"For two function types to be compatible, both shall specify compatible return types. Moreover, the parameter type lists shall agree in the number of parameters and in use of the ellipsis terminator; corresponding parameters shall have compatible types. In the determination of type compatibility and of a composite type, each parameter declared with function or array type is taken as having the adjusted type and each parameter declared with qualified type is taken as having the unqualified version of its declared type."

Remove §6.11.6.

§6.5.2.2: replace the paragraph
"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."
by
"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."

Annex I: remove "— A function is called but no prototype has been supplied (6.5.2.2)."