3 ms·
That is of course the C11 (draft) spec, not C++. Interesting find there. The wording is also in the C99 draft; it is not new. It is in fact saying that the em
by kazinator 8y ago
That is of course the C11 (draft) spec, not C++.
Interesting find there. The wording is also in the C99 draft; it is not new.
It is in fact saying that the empty list in a definition is a special case and does declare that the function takes no parameters. To "specify" here can be understood to mean as inserting information about type into the declaration scope; that which a declaration does.
So that's a bit of a bug in GCC there; it should be treating this the same as (void) and therefore diagnosing that way. If not by default, then at least when -pedantic is applied. But nope:
$ gcc -Wall -W -std=c11 -pedantic proto.c
$
- nezirus 8y agoMy understanding is that, unless you have a function prototype, you will lose type info about the parameters: "The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied." i.e. the most important is the end of that sentence, so GCC behavior should be right.
- kazinator 8y agoNote the: "that is not part of a definition". This is about declarations only.