Arises from my answer to a Dynamic Array of Objects in C ++ and according to What are the rules for using the underscore in a C ++ identifier? : Apparently, names starting with _followed by an uppercase letter are reserved in the global namespace.
_
17.4.3.2.1 Global Names [ lib.global.names]Certain sets of names and function signatures are always reserved for implementation:Each name that contains a double underscore ( __) or begins with an underscore followed by an uppercase letter (2.11) is reserved for implementation for any use.Each name starting with an underscore is reserved for implementation for use as a name in the global namespace. 165165) Such names are also reserved in the namespace ::std(17.4.3.1).
lib.global.names
Certain sets of names and function signatures are always reserved for implementation:
__
165) Such names are also reserved in the namespace ::std(17.4.3.1).
::std
In my answer to the first question, I had a class similar to this
class A { private: vector<int> _Ints; }
In the comments, they told me that the identifier _Intscauses undefined behavior, since this is a reserved name. However, according to a recent draft of the standard, the search for the name of a member variable occurs according to the following rule:
_Ints
3.4.3.1 Members of the class [ class.qual], , , (10.2), , .
class.qual
, , , (10.2), , .
, - , .
, - , ? , - ?
_Int : " , (_ _) , (2.11) "." " , : - , - , . , , , undefined ( ).
_Int
, , , , , , . , . (, , . , linux 1. , ... , , .)
linux
1
, .
, , , , , , . - _Ints .
, , , . , , , - _Ints, _Ints, .
-, _ ( Upercase) .
No. It is reserved everywhere . Read 17.4.3.2.1 again:
Each name that contains a double underscore (_ _) or begins with an underscore followed by an uppercase letter (2.11) is reserved for implementation for any use.
This does not mention the โglobal namespaceโ at all (the global namespace is applicable only in the next rule).