I discovered something strange in gcc and hoping to get some input whether its a feature or quirk.
Essentially I have a function defined in func.c as
void f(int a, int b, FILE* f)
{
...
...
}
There is no corresponding header file. But gcc doesn’t give any warning when I call f(a,b) and gdb shows me that f is called with three parameters?
Why is this the case?. What is the semantics for filling up the third argument.
If
f()doesn’t have a declaration anywhere and is not defined in the current compilation unit, the compiler assumes thatf()returnsintand can take any number of arguments.I know this is odd, but in the old days this was possibly a way to reduce the number of header files that have to be included, and hence faster compilation.