Static Storage-Class Specifiers
|Can static |
|Can extern |
|Function declarations within a block||No||Yes|
|Formal arguments to a function||No||No|
|Objects in a block||Yes||Yes|
|Objects outside a block||Yes||Yes|
|Class member functions||Yes||No|
|Class member data||Yes||No|
A name specified using the static keyword has internal linkage except for the static members of a class that have external linkage. That is, it is not visible outside the current translation unit. A name specified using the extern keyword has external linkage unless previously defined as having internal linkage. For more information about the visibility of names, see Scope and Program and Linkage.
Note Functions that are declared as inline and that are not class member functions are given the same linkage characteristics as functions declared as static.
A class name whose declaration has not yet been encountered by the compiler can be used in an extern declaration. The name introduced with such a declaration cannot be used until the class declaration has been encountered.