Keywords have fixed meaning defined by the C++ standard and cannot be used as identifiers. It is illegal to redefine keywords using the preprocessor in any translation unit that includes a standard library header. However, keywords lose their special meaning inside attributes.
The full list of keywords is as follows:
auto: since C++11, before C++11
deletefor memory management, for functions (since C++11)
externas declaration specifier, in linkage specification, for templates
inlinefor functions, for namespaces (since C++11), for variables (since C++17)
usingto redeclare a name, to alias a namespace, to alias a type
virtualfor functions, for base classes
override are not keywords. They may be used as identifiers and have special meaning only in certain contexts.
xor_eq are alternative spellings of
^=, respectively. The standard does not treat them as keywords, but they are keywords for all intents and purposes, since it is impossible to redefine them or use them to mean anything other than the operators they represent.
The following topics contain detailed explanations of many of the keywords in C++, which serve fundamental purposes such as naming basic types or controlling the flow of execution.
- Basic Type Keywords
- Flow Control
- Literal Keywords
- Type Keywords
- Variable Declaration Keywords
- Storage class specifiers