Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site petsd.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxj!houxm!vax135!petsd!joe From: joe@petsd.UUCP (Joe Orost) Newsgroups: net.lang.c Subject: Re: Standard extensions (logical exclusive or) Message-ID: <374@petsd.UUCP> Date: Tue, 6-Nov-84 08:38:09 EST Article-I.D.: petsd.374 Posted: Tue Nov 6 08:38:09 1984 Date-Received: Thu, 8-Nov-84 01:21:26 EST References: <> <352@digi-g.UUCP>, <1442@pucc-h> Organization: Perkin-Elmer DSG, Tinton Falls, N.J. Lines: 29 <> David L Stevens says: > The "opop" syntax is for allowing short circuit evaluation of >boolean expressions. Thus && is there so that C can allow the programmer >to optimize, where apropriate. Exclusive Or, on the other hand, requires >that both operands be evaluated, so ^^ has no place. > Since boolean expressions evaluate to 1 or 0, bitwise operations >perform the same function as a non-short-circuit evaluation, and so & >does it all. I don't see where you lose by using just ^. > Of course, tese are all my opinions about the reasoning behind it, >since they didn't ask me. 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 -- Full-Name: Joseph M. Orost UUCP: ..!{decvax,ucbvax,ihnp4}!vax135!petsd!joe US Mail: MS 313; Perkin-Elmer; 106 Apple St; Tinton Falls, NJ 07724 Phone: (201) 870-5844