With the code below, both clang and gcc called with -std=c11 complain about conflicting types for foo.
int foo();
int main(void) {
return foo(0);
}
int foo(char a) {
return a;
}
According to the answer in https://stackoverflow.com/a/13950800/1078224, in (older?) C standards the type int has been assumed when no variable type was given. However, the C11 standard draft (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf), section 6.7.6.3, $14 says that
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.
From this I conclude that the code above should be actually valid. Or am I missing some other relevant section of the standard?
int
rule was dropped in the 1999 standard. – Keith Thompson