Identifiers that appear as a token or preprocessing token (i.e., not in user-defined-string-literal like operator ""id)(since C++11) of one of the following forms are reserved:
identifiers with a double underscore anywhere;
identifiers that begin with an underscore followed by an uppercase letter;
in the global namespace, identifiers that begin with an underscore.
In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names.
When compiling code with Clang, the -Wreserved-identifier flag will warn about this name.
I noticed this when attempting to reduce transitive header includes in a project I was working on. I had tried to replace an include for SDL_mixer.h and a forward declare for Mix_Music, which required that I also use the name _Mix_Music. I occasionally compile my project with Clang's -Weverything flag and see what comes up.
The following type definition uses a reserved identifier
_Mix_Music
:According to: https://en.cppreference.com/w/cpp/language/identifiers
Similarly, the GNU documentation states: https://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
When compiling code with Clang, the
-Wreserved-identifier
flag will warn about this name.I noticed this when attempting to reduce transitive header includes in a project I was working on. I had tried to replace an include for
SDL_mixer.h
and a forward declare forMix_Music
, which required that I also use the name_Mix_Music
. I occasionally compile my project with Clang's-Weverything
flag and see what comes up.