Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!husc6!mit-eddie!apollo!arnold From: arnold@apollo.uucp (Ken Arnold) Newsgroups: comp.lang.c Subject: Re: "logical" xor Message-ID: <39a83409.ae48@apollo.uucp> Date: 13 Jan 88 22:27:00 GMT References: <2946@zeus.TEK.COM> <170@illusion.UUCP> Reply-To: arnold@apollo.UUCP (Ken Arnold) Organization: Apollo Computer, Chelmsford, MA Lines: 15 In article <170@illusion.UUCP> Marcus Hall writes: >((a != 0) ^ (b != 0)) gives (1) ^ (1) == 0, which is false. Not even true yet. All (a != 0) is guaranteed to generate (if a is not 0) is a non-zero value, *any* non-zero value, which just *usually* is 1. It could be 7. So you *could* have ((a != 0) ^ (b != 0)) giving ((7) ^ (5)) or something. There is no guarantee, therefore, that ^ will even solve the problem this way. To be *sure*, you have to write ((a != 0 ? 1 : 0) ^ (b != 0 ? 1 : 0)) Do you wonder why some of us have always wanted a ^^ operator? Not often, mind you, but when I need one, I *really* need it, Ken Arnold