Home >Backend Development >C++ >Why Was the 'static' Keyword Deprecated in C and Then Undeprecated?
In C , the 'static' keyword could be used to control the visibility of symbols within a translation unit. However, in n3092, its usage within namespace scope was deprecated. This deprecation has since been removed in n3225.
The removal of the deprecation is explained in C Standard Core Language Defect Reports and Accepted Issues, Revision 94:
1012. Undeprecating static
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.
In essence, the deprecation was acknowledged to be nonsensical. 'static' will likely remain a part of C due to its utility in declaring functions and objects with internal linkage without the need for unnecessary boilerplate code in unnamed namespaces.
The above is the detailed content of Why Was the 'static' Keyword Deprecated in C and Then Undeprecated?. For more information, please follow other related articles on the PHP Chinese website!