ISO646 Operator Keywords

Provided that Microsoft’s so-called language extensions are disabled, as with the /Za option, the compiler defines various keywords that each map to the token for some operator.

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

Each keyword gets tokenised as the corresponding operator. For all practical purposes, the compiler proceeds as if the operator had been specified through the usual representation of that operator. Indeed, if the particular circumstances in which the keyword is used cause an error or warning, the message text will typically cite the corresponding operator, not the keyword. Even when the keyword is given as the argument to __identifier, it is already tokenised as the operator, such that the attempted conversion to an identifier is an error (C2745).

With /Ze active, the items listed above as keywords do not get defined as keywords. They are tokenised as identifiers and are available for naming code or data. Should these text names be wanted as alternative representations of these operators, they can be defined as macros (as done, indeed, in the header file, ISO646.H, that ships as standard with the compiler). Though this is certainly not the same as their being keywords, the practical difference is surely negligible.