假设代码:
extern int foo(void);
static int foo(void)
{
return 0;
}
尝试用 GCC 编译
$ gcc -Wall -std=c99 1.c
1.c:3:12: error: static declaration of ‘foo’ follows non-static declaration
1.c:1:12: note: previous declaration of ‘foo’ was here
1.c:3:12: warning: ‘foo’ defined but not used [-Wunused-function]
那么,如何声明静态函数呢?