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 |
^= |
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-4.9.3/cpp/C_002b_002b-Named-Operators.html