Why no logical XOR operator
Henry Spencer
henry at zoo.toronto.edu
Fri Sep 14 01:54:24 AEST 1990
In article <1990Sep12.154515.18460 at druid.uucp> darcy at druid.uucp (D'Arcy J.M. Cain) writes:
> if (x ^^ (y & z))
>
>If there was such a thing as a '^^' operator. Does anyone know why C left
>out the logical XOR operator?
Try `!x != !(y & z)', which gets the same results; if the operands are
booleans to begin with, you can leave out the unary !s.
"^^" is a perennial suggestion which really has very little to recommend
it. It can't short-circuit like && and ||, because XOR has to evaluate
both operands. And it would be useful rather rarely.
--
TCP/IP: handling tomorrow's loads today| Henry Spencer at U of Toronto Zoology
OSI: handling yesterday's loads someday| henry at zoo.toronto.edu utzoo!henry
More information about the Comp.std.c
mailing list