extern declaration and function definition both in the same file

前端 未结 5 1803
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 09:08

I was just browsing through gcc source files. In gcc.c, I found something like

extern int main (int, char **);

int
main (int argc, cha         


        
5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-20 09:33

    In a function declaration, extern simply declares that the function has external linkage, which is the default; the extern keyword is utterly useless in this context, and the effect is identical to a normal declaration/prototype without the extern keyword.

提交回复
热议问题