the logical xor operator!

Karl Heuer karl at haddock.ISC.COM
Sat Jun 25 09:29:00 AEST 1988


In article <1310 at ark.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
>This time the question is: why hasn't C got a logical xor operator?

Since you posted the question to comp.std.c, I'll interpret the question as
"Why wasn't logical xor added to ANSI C?".  The answer is that it isn't useful
enough to be worth the change to the language.

>Of course the way to come around the deficiency is: [ !x != !y ]
>but this only works if !0 always evaluates to the same value (viz. 1),

Which it is and always has been.

Of course, if you're dealing with true boolean expressions (and I hold the
opinion that nothing else should be handed to a logical operator), then either
"x != y" or "x ^ y" will do.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.std.c mailing list