函数声明中的静态关键字在函数定义中可能会丢失吗?

Arr*_*kis 11 c c++ static declaration function

我希望有一个静态函数,我在定义之前在我的.c文件中声明:

//file a.c version 1
static int foo();
...
static int foo()
{
...
}
Run Code Online (Sandbox Code Playgroud)

但是,似乎我可以将static关键字从函数定义中删除,并且我没有得到编译器警告......例如

//file a.c version 2
static int foo();
...
int foo()
{
...
}
Run Code Online (Sandbox Code Playgroud)

假设这两种形式完全相同,我是否正确?
如果是这样,为什么允许这种差异,我应该使用哪种形式?

APr*_*mer 10

是7.1.1/6

在没有存储类说明符的命名空间范围内声明的名称具有外部链接,除非由于之前的声明而具有内部链接,并且未声明它const.

另见7.1.1/7的示例