This is a list of reserved keywords in C++. Since they are used by the language, these keywords are not available for re-definition (or overloading) by programmers.
| Keyword | Description |
|---|---|
| and | alternative to && operator |
| and_eq | alternative to &= operator |
| asm | insert an assembly instruction |
| auto | (C++0x) automatically detect variable type from initializer expression (meaningless declare a local variable in pre-C++0x) |
| bitand | alternative to bitwise & operator |
| bitor | alternative to | operator |
| bool | name of builtin boolean type |
| break | break out of a loop |
| case | in switch statement, defines a value label |
| catch | handles exceptions from throw |
| char | name of builtin character type (also 8-bit integer type) |
| class | declare a class |
| compl | alternative to ~ operator |
| const | modifier for a variable, a pointer to, or a reference to, which states that the variable cannot be modified |
| const_cast | cast that only allows to strip 'const' or 'volatile' modifiers |
| continue | bypass iterations of a loop |
| default | default handler in a case statement (in C++0x also force default implementation of a method) |
| delete | make dynamic memory available (in C++0x also remove a method that would be provided by default otherwise) |
| do | begin of a 'do-while' looping construct |
| double | name of a builtin double precision floating-point type |
| dynamic_cast | cast a pointer/reference from base (polymorphic) class to derived class, with runtime error reporting, if cast is not correct |
| else | alternate case for an if statement |
| enum | declare an enumeration type |
| explicit | make a class's one-argument constructor not allowed to be used for implicit conversions |
| export | states that the following template declaration will be defined in another compilation unit |
| extern | declares an external linkage for a variable (if not initialized, provides only forwarding declaration for a variable to be declared either later or in another compilation unit) or (extern āCā) declares C linkage for a function |
| false | a constant representing the boolean false value |
| float | name of a single precision floating-point type |
| for | looping construct |
| friend | grant non-member function access to private data |
| goto | jump to a label (within the same function) |
| if | execute code based on the result of a test |
| inline | declare that a function is to be expanded in place when called (or to undergo vague linkage, if expanding is not possible) |
| int | name of a builtin default integer type |
| long | name of a builtin long integer variable |
| mutable | wipe constness from a class's field, when whole object is const |
| namespace | partition the global namespace by defining a scope |
| new | create an object, allocating memory from dynamic pool |
| not | alternative to ! operator |
| not_eq | alternative to != operator |
| operator | create overloaded operator functions |
| or | alternative to || operator |
| or_eq | alternative to |= operator |
| private | declare private members of a class |
| protected | declare protected members of a class |
| public | declare public members of a class |
| register | request that a variable be implemented by machine's register rather than on function's stack |
| reinterpret_cast | cast between any pointers or any integer with no change, which does not strip const or volatile modifiers |
| return | return from a function |
| short | declare a short integer variable |
| signed | modify variable type declarations |
| sizeof | return the size of a variable or type |
| static | create permanent storage for a variable |
| static_cast | cast that can be done implicitly in reverse, with changing the pointer for derived class, if required |
| struct | define a new structure |
| switch | execute code based on different possible values for a variable |
| template | create generic functions or classes |
| this | a pointer to the current object inside a class's method |
| throw | throws an exception |
| true | a constant representing the boolean true value |
| try | execute code that can throw an exception |
| typedef | create a new type name from an existing type |
| typeid | describes an object |
| typename | declare that the identifier next to this word must be always interpreted as type (and not a variable or function), also declares type parameter for template |
| union | a structure that assigns multiple variables to the same memory location |
| unsigned | modifier for integer types that makes them only positive range |
| using | import complete or partial namespaces into the current scope |
| virtual | create a function that can be overridden by a derived class |
| void | name of a builtin void type or declare no return value in function |
| volatile | warn the compiler about variables that can be modified unexpectedly |
| wchar_t | name of a builtin wide-character type |
| while | begin of 'while' or end of 'do-while' looping constructs |
| xor | alternative to ^ operator |
| xor_eq | alternative to ^= operator |