<分区>
Possible Duplicate:
What are the rules about using an underscore in a C++ identifier?
我对标准中的相关部分(如果有)感兴趣。
<分区>
Possible Duplicate:
What are the rules about using an underscore in a C++ identifier?
我对标准中的相关部分(如果有)感兴趣。
最佳答案
是的,当下划线后跟另一个下划线或大写字母(即预处理器 #defines 或宏)时,或者如果标识符位于全局命名空间中(§17.6.4.3.2):
Certain sets of names and function signatures are always reserved to the implementation:
— Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase letter (2.12) is reserved to the implementation for any use.
— Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace.
注意,第一点的意思是,如果两个下划线出现在标识符中任何地方,即使是在中间或者末尾,这个名字也是保留的。另外,我要添加(§17.6.4.3.5,强调我的):
Literal suffix identifiers that do not start with an underscore are reserved for future standardization.
关于c++ - 是否根据最新的 C++ 标准保留以下划线开头的标识符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12924243/