Path: utzoo!attcan!uunet!mcvax!botter!ark.cs.vu.nl!maart
From: maart@cs.vu.nl (Maarten Litmaath)
Newsgroups: comp.std.c
Subject: the logical xor operator!
Message-ID: <1310@ark.cs.vu.nl>
Date: 23 Jun 88 21:48:38 GMT
References:  <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl>
Reply-To: maart@cs.vu.nl (Maarten Litmaath)
Organization: VU Informatica, Amsterdam
Lines: 19

Hello, it's me again.
This time the question is: why hasn't C got a logical xor operator?

	logical and: &&
	logical or:  ||
	logical xor: ^^		<- fits nicely!

Of course the way to come around the deficiency is:

	if (!(expr1) != !(expr2)) {
		...
	}

but this only works if !0 always evaluates to the same value (viz. 1), that is,
the optimizer is not allowed to f*ck around with the comparison.
!0 is indeed a constant, isn't it?
-- 
I'd rather live in Russia             |Maarten Litmaath @ Free U Amsterdam:
              than in South-Africa... |maart@cs.vu.nl, mcvax!botter!ark!maart