C++ has added several new keywords. If you use any of these as identifiers, you get numerous and sometimes bizarre error messages. (It is quite difficult to determine when a programmer has used a keyword as an identifier, and the compiler error messages might not be helpful in such cases.)
Most of the new keywords can be disabled with a compiler option, as shown in the following table. Some are logically related, and get enabled or disabled in a group.
Table 3-1 Keywords in Standard Mode
Keyword |
Compiler option to disable |
---|---|
bool, true, false |
-features=no%bool |
explicit |
-features=no%explicit |
export |
-features=no%export |
mutable |
-features=no%mutable |
namespace, using |
cannot disable |
typename |
cannot disable |
and, and_eq, bitand, compl, not, not_eq, or, bitor, xor, xor_eq |
-features=no%altspell (see note below) |
Alternative spellings for special tokens: The addendum to the ISO C standard introduced the C standard header <iso646.h>, which defined new macros to generate the special tokens. The C++ standard has introduced these spellings directly as reserved words. (When the alternative spellings are enabled, including <iso646.h> in your program has no net effect.) The meaning of these tokens is shown in the following table.
Token |
Spelling |
---|---|
&& |
and |
&&= |
and_eq |
& |
bitand |
~ |
compl |
! |
not |
!= |
not_eq |
|| |
or |
| |
bitor |
~ |
xor |
~= |
xor_eq |