Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!mit-eddie!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.UUCP Newsgroups: comp.lang.c Subject: Re: "logical" xor Message-ID: <7046@brl-smoke.ARPA> Date: 12 Jan 88 00:08:01 GMT References: <11207@brl-adm.ARPA> <20153@teknowledge-vaxc.ARPA> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 13 Posted: Mon Jan 11 19:08:01 1988 In article <20153@teknowledge-vaxc.ARPA> mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes: >1^0 = 1; 0^0 = 0; 1^1 = 0 => logical xor should mean "does not equal", >for which C has a perfectly good symbol, "!=" Although C doesn't enforce it, it is good style to maintain a careful distinction between Boolean expressions and arithmetic expressions. != would best be considered an arithmetic operator. This apart from the fact that 2 XOR 1 would be 3 arithmetically but 0 as a Boolean (not that I think one should be treating 2 as a Boolean value!). By the way, I don't think a logical XOR is important enough to bother adding to C. It should be in the next conventional language you design, however (Ada++?).