Originally Posted by
c99
6.11.4 Function declarators
The use of function declarators with empty parentheses (not prototype-format parameter
type declarators) is an obsolescent feature.
6.11.5 Function definitions
The use of function definitions with separate parameter identifier and declaration lists
(not prototype-format parameter type and identifier declarators) is an obsolescent feature.
Code:
/* Old style function declarator */
void foo();
/* Old style function definition */
void foo()
int a;
{
/* do stuff */
}
In particular, there were NO checks on calling foo().
You could do
foo();
foo(123);
foo("I'm a banana");
without any compile time consequence.
As the standard says, these are obsolete syntax.
You should be doing
Code:
void foo(int a);
void foo(int a) {
/* do stuff */
}