Because in C ++, anonymous namespaces should be preferred, which basically offer the same functionality.
I think that static in this context is not approved because of double values ββand the fact that the two values ββare completely opposite - if inside a class or struct it represents a global state, while outside it gives an internal binding and provides a copy of the variable or method for each translation unit.
Moreso, static can only be applied to functions and variables, while inside an anonymous namespace you can have type declarations.
namespace //OK { class X {}; } static class X //syntactically correct, but does nothing { };
Note that the standard considers using static to specify bindings as deprecated.
source share