Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: C history question Message-ID: <1989Sep11.154351.28749@utzoo.uucp> Organization: U of Toronto Zoology References: <575@calmasd.Prime.COM> Date: Mon, 11 Sep 89 15:43:51 GMT In article <575@calmasd.Prime.COM> wlp@calmasd.Prime.COM (Walter Peterson) writes: >C has bitwise operators for AND (&), OR (|) and XOR (^) and boolean >operator for AND (&&) and OR (||), but not for XOR (^^). Why? >What happened to the boolean XOR operator ? ... Groan. This comes up regularly. The ^^ operator would in fact be of very limited use. The big point of && and || is their sequencing properties, e.g. the second operand of && is evaluated only if the first is true. This cannot be done with ^^, which would inherently need to evaluate both operands. >(a || b) && (!(a && b)) when a ^^ b is so much "cleaner". Try "!a != !b", which has the same effect with not many more symbols. Or if your operands are boolean (0 or 1) to begin with, "a ^ b" or "a != b". >Can anyone tell me why this was left out of the language ? Because nobody considered it useful enough to put it in. >Is there any chance that some future version of ANSI-C will have it ? It's very unlikely. -- V7 /bin/mail source: 554 lines.| Henry Spencer at U of Toronto Zoology 1989 X.400 specs: 2200+ pages. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu