Effects of the `extern` keyword on C functions
- by Elazar Leibovich
In C I did not notice any effect of the extern keyword used before function declaration.
At first I thougth that when defining extern int f(); in a single file forces you to implement it outside of the files scope, however I found out that both
extern int f();
int f() {return 0;}
And
extern int f() {return 0;}
Compiles just fine, with no warnings from gcc. I used gcc -Wall -ansi, he wouldn't even accept // comments.
Are there any effects for using extern before function definitions? Or is it just an optional keyword with no side effects for functions.
In the latter case I don't understand why did the standard designers chose to litter the grammar with superfluous keywords.
EDIT: to clarify, I know there's usage for extern in variables, but I'm only asking about extern in functions.