Reputation: 1608
Section 6.11.2 of the C standard states one of the features that may be deprecated in future versions:
Declaring an identifier with internal linkage at file scope without the static storage-class specifier is an obsolescent feature.
How is it even possible to declare a file scope identifier to have internal linkage without the static storage-class specifier?
Upvotes: 12
Views: 261
Reputation: 64
There is a specific example for this issue in the C++ standard. In [dcl.stc]:
static int b; // b has internal linkage
extern int b; // b still has internal linkage
So in the second line, b is declared as a file scope identifier with internal linkage without the keyword static. The example is also true for C, as C11:6.2.2 says:
For an identifier declared with the storage-class specifier extern in a scope in which a prior declaration of that identifier is visible, if the prior declaration specifies internal or external linkage, the linkage of the identifier at the later declaration is the same as the linkage specified at the prior declaration. If no prior declaration is visible, or if the prior declaration specifies no linkage, then the identifier has external linkage.
see this question for more detail
Upvotes: 2