You are Kind of mixing up C and C++. The keyword static
in C has the intention to narrow the scope of a variable down to the translation unit. You could define it globally in the translation unit, but it was not visible to other translation-units.
Bjarne Stroustrup recommends to use anonymous namespaces
in C++ instead of using static
like in C.
From this post it says
The C++ Standard reads in section 7.3.1.1 Unnamed namespaces, paragraph 2:
The use of the static keyword is deprecated when declaring objects
in a namespace scope, the unnamed-namespace provides a superior alternative.
Static only applies to names of objects, functions, and anonymous unions, not to type declarations.