The C Preprocessor: C++ Named Operators

Previous: System-specific Predefined Macros, Up: Predefined Macros [Contents][Index]

#### 3.7.4 C++ Named Operators

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` | `^=`