Path: utzoo!utgpu!water!watmath!clyde!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: "logical" xor Message-ID: <2268@haddock.ISC.COM> Date: 14 Jan 88 20:02:49 GMT References: <2946@zeus.TEK.COM> <195@fxgrp.UUCP> <2800@killer.UUCP> <2237@haddock.ISC.COM> <1459@dataio.Data-IO.COM> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 13 In article <2237@haddock.ISC.COM> karl@haddock.ima.isc.com (Karl Heuer) writes: >Conclusion 2: If the compiler knows that both operands are normalized >booleans, then "x^y" and "x!=y" can generate the same code. I should mention that the situation I was considering was the logical xor of two "boolean expressions", a boolean expression being one in which the last operator is one which is guaranteed to return 0 or 1 ("==", "!", "&&", etc.). I sometimes find myself wanting to say "if ((x0 < y0) XOR (x1 < y1))", and there's that moment of hesitation while I decide whether XOR should be written "^" or "!=". If I knew that the compiler would generate the same code either way, this would be as much a non-issue as whether to write "*p" or "p[0]". Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.ima.com), The Walking Lint