Deprecation of the static keyword… no more?

In C++ Standard Core Language Defect Reports and Accepted Issues, Revision 94 under 1012. Undeprecating static they note:

Although 7.3.1.1 [namespace.unnamed] states that the use of the static keyword for declaring variables in namespace scope is deprecated because the unnamed namespace provides a superior alternative, it is unlikely that the feature will be removed at any point in the foreseeable future.

Basically this is saying that the deprecation of static doesn’t really make sense. It won’t ever be removed from C++. It’s still useful because you don’t need the boilerplate code you would need with unnamed namespace‘s if you just want to declare a function or object with internal linkage.

Leave a Comment