Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is namespace-`static` still deprecated in C++11? [duplicate]

Tags:

Possible Duplicate:
Deprecation of the static keyword… no more?

In C++2003, namespace-static is deprecated:

[C++03: 7.3.1.1/2]: The use of the static keyword is deprecated when declaring objects in a namespace scope (see annex D); the unnamed-namespace provides a superior alternative.

I can't find where any such clause exists in C++2011 (suggesting undeprecation), and 7.1.1 doesn't seem to prohibit namespace-static (and if it had, this would suggest that the feature had been finally removed from the language); however, neither case is listed in C.2 (which itemises significant differences between 2003 and 2011).

Was namespace-static undeprecated or not?

like image 891
Lightness Races in Orbit Avatar asked Dec 10 '11 21:12

Lightness Races in Orbit


1 Answers

Undeprecating namespace-static was proposed and accepted for n3296:

ID: FI 6
Ref: D.2 [depr.static] ¶ Paragraph 1
Comment: The use of static in namespace scope should not be deprecated. Anonymous namespaces are not a sufficient replacement for the functionality.
Proposed Resolution: Strike [depr.static] completely.
Owner: CWG
Issue: 1012
Disposition: ACCEPTED

In fact, clause C (on compatibility) does not list any changes made to clause D (on deprecation), so it's hard to tell "at a glance". But, no, namespace-static is no longer deprecated in C++11.

like image 52
Lightness Races in Orbit Avatar answered Oct 02 '22 21:10

Lightness Races in Orbit