Possible Duplicate:
What are the rules about using an underscore in a C++ identifier?
I'm interested in the relevant sections from the standard (if any).
Possible Duplicate:
What are the rules about using an underscore in a C++ identifier?
I'm interested in the relevant sections from the standard (if any).
Yes, when the underscore is followed by another underscore or an uppercase letter (i.e. for preprocessor #defines or macros), or if the identifier is in the global namespace (§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.
Note that the first point means that if two underscores appear anywhere in the identifier, even in the middle or at the end, the name is reserved. Also, I would add (§17.6.4.3.5, emphasis mine):
Literal suffix identifiers that do not start with an underscore are reserved for future standardization.
They are not reserved like for
but you should not use them, since compiler developers may use them to name their own functions, so it may conflict with your function. So if you use my_class::_function
then there should be no error, but write a global function like void _function()
may generate a duplicate with one compiler!