Static keyword in function declaration can be missing in function definition?

后端 未结 5 2051
深忆病人
深忆病人 2021-01-02 03:36

I want to have a static function which I declare in my .c file before defining it:

//file a.c version 1
static int foo();
...
static int foo()
{
...
}
         


        
5条回答
  •  一向
    一向 (楼主)
    2021-01-02 04:30

    Yes 7.1.1/6

    A name declared in a namespace scope without a storage-class-specifier has external linkage unless it has internal linkage because of a previous declaration and provided it is not declared const.

    See also the examples of 7.1.1/7

提交回复
热议问题