Home The C Preprocessor www.imodulo.com · 2003-11-10

C++ Named Operators

[ Up: Predefined Macros ]
[ Previous: System-specific Predefined Macros ]

In C++, there are eleven keywords which are simply alternate spellings of operators normally written with punctuation. These keywords are treated as such even in the preprocessor. They function as operators in #if, and they cannot be defined as macros or poisoned. In C, you can request that those keywords take their C++ meaning by including iso646.h. That header defines each one as a normal object-like macro expanding to the appropriate punctuator.

These are the named operators and their corresponding punctuators:

Named Operator Punctuator
and &&
and_eq &=
bitand &
bitor |
compl ~
not !
not_eq !=
or ||
or_eq |=
xor ^
xor_eq ^=