C Standard - Is function definition a function prototype?

The standard (latest version: WG14 / N1256) states (6.2.1 Β§2):

A function prototype is a declaration of a function declaring the types of its parameters.

In the immediate vicinity of this statement, we also find evidence that the declaration of an identifier consists of a declarator or type specifier (Β§4):

Each other identifier has a scope determined by the placement of its declaration (in the declarator or type specifier).

Thus, it would seem that knowing whether a function definition is a prototype of a function reduces to understanding whether a function definition is a declarator. It?

I need a verified answer that conforms to the C standard. I don’t care about the usual meaning, or what Wikipedia says or your favorite book C.

Here is the statement in the standard that led me to the idea that function definitions can indeed be function prototypes (Β§4):

If a declarator or type specifier declaring an identifier appears in the list of parameter declarations in the function prototype (is not part of the function definition), ...

+3
source share
1 answer

Yes, see 6.9.1 for function definitions, clause 7:

If the declarator includes the type list parameter, the types of all parameters are also indicated in the list; such declarator also serves as a prototype function for subsequent calls to the same function in the same translation unit.

+6
source

Source: https://habr.com/ru/post/1789328/


All Articles