Why no logical XOR operator

D'Arcy J.M. Cain darcy at druid.uucp
Thu Sep 13 01:45:15 AEST 1990


Recently I had occasion to write something like the following code:

	if ((!x && (y & z)) || (x && !(y & z))
		something();

Which would have been simpler as:

	if (x ^^ (y & z))
		something();

If there was such a thing as a '^^' operator.  Does anyone know why C left
out the logical XOR operator?

-- 
D'Arcy J.M. Cain (darcy at druid)     |
D'Arcy Cain Consulting             |   MS-DOS:  The Andrew Dice Clay
West Hill, Ontario, Canada         |   of operating systems.
+ 416 281 6094                     |



More information about the Comp.std.c mailing list