THe C and C++ languages reserve certain categories of names for the implementation, which means that you cannot use them in your own code. You can’t use them for variable names, parameter names, classes, methods, macros, whatever.
The rules for C++ are collected in the [lex.name] chapter. The rules for C happen to match the C++ rules, so that makes things easier to remember.
Pattern | Conditions |
---|---|
Begins with two underscores | Reserved |
Begins with underscore and uppercase letter | Reserved |
Begins with underscore and something else | Reserved in global scope (includes macros) |
Note that a popular convention of prefixing private members with an underscore runs afoul of these rules if the member name begins with an uppercase letter.
class Widget { public: Widget(); private: int _size; // okay void _Toggle(); // not okay };
The C language does not have namespaces, so it also must reserve names in the global namespace for future expansion. Some names may not be used by symbols with external linkage. You can use them for type names, e
!-->