Path: utzoo!attcan!uunet!husc6!mailrus!ames!pacbell!att!cuuxb!mmengel From: mmengel@cuuxb.ATT.COM (~XT4103000~Marc Mengel~C25~G25~6184~) Newsgroups: comp.std.c Subject: Re: the logical xor operator! (John F. Haugh II, Karl W. Z. Heuer) Message-ID: <1894@cuuxb.ATT.COM> Date: 1 Jul 88 19:45:52 GMT References: <1719@ogcvax.ogc.edu> <1309@ark.cs.vu.nl> <1310@ark.cs.vu.nl> <3254@rpp386.UUCP> <1312@ark.cs.vu.nl> Reply-To: mmengel@cuuxb.UUCP (Marc Mengel) Organization: AT&T, Data Systems Group, Lisle, IL Lines: 19 >>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. >Come on Karl, what's so terrible about the following common practice? > if (some_pointer && ...) { > ... > } Ah, but fortunately C gave us a cheap and easy way to convert to "Boolean" -- so "!!x ^ !!y" does pretty well. I think the short circuit evaluation is the real reason -- after all, you could short circuit evaluate "x & y" if x is 0, and "x | y" if x is ~0, but you *don't* because then you would have to use explicit temp variables to evaluate both sides of the bitwise operator. -- Marc Mengel attmail!mmengel {lll-crg|mtune|ihnp4}!cuuxb!mmengel