Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pucc-h Path: utzoo!linus!decvax!tektronix!uw-beaver!cornell!vax135!houxm!mhuxj!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:abv From: abv@pucc-h (David Stevens) Newsgroups: net.lang.c Subject: Re: Standard extensions (logical exclusive or) Message-ID: <1461@pucc-h> Date: Thu, 8-Nov-84 18:03:40 EST Article-I.D.: pucc-h.1461 Posted: Thu Nov 8 18:03:40 1984 Date-Received: Sun, 11-Nov-84 20:26:44 EST References: <> <352@digi-g.UUCP>, <1442@pucc-h> <374@petsd.UUCP> Organization: Purdue University Computing Center Lines: 32 Joe Orost says: >I disagree. The bitwise operators operate on every bit of their arguments, >whereas the logical operators operate on zero -vs- non-zero. Therefore, i^j >is not the same as i^^j. i^^j is equivalent to: > i?(j?0:1):(j?1:0) >which is only the same as i^j when i and j are 0 or 1. > >Therefore, I vote for the ^^ operator. > > regards, > joe > I disagree with you. The two important features of && over & are that 1) it is logical (not bitwise), and 2) it is short-circuit. Boolean expressions evaluate to 0 or 1, so ^==^^ in this case, and since both expressions must be evaluated, you gain nothing by adding ^^. If you are checking for "nonzeroness", then neither "a!=b" (as someone else suggested) nor "a^b" is equivalent to a^^b, but the question here is whether, for "nonzeroness", "(a!=0) != (b!=0)", or "(a!=0) ^ (b!=0)" is so ugly that an extension to include ^^ is reasonable. If a and b are not *really* logical expressions, then I say that what you want is "!=0", and not some magic to make them be treated like logcial expressions. I vote no for ^^. ---------- David L Stevens {decvax|harpo|ihnp4|inuxc|seismo|ucbvax}!pur-ee!pucc-h:abv DISCLAIMER: The opinions expressed above are not necessarily my own, or anyone else's.