C history question

Doug Gwyn gwyn at smoke.BRL.MIL
Tue Sep 12 13:01:50 AEST 1989


In article <575 at calmasd.Prime.COM> wlp at 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 ?  If && makes sense for the
>boolean AND and || makes sense for the boolean OR, why doesn't ^^ make
>sense for the boolean XOR ?

There is no need for ^^.  The only reason for && and || is for the short-
circuit property, which obviously ^^ could not have.

For Boolean values a and b, a!=b is equivalent to a^^b and takes no more
characters to code, besides being more readble for most people.
For arbitrary values a and b (which I do NOT recommend in Boolean contexts),
!a!=!b is one of many equivalent ways to express a^^b.

>Is there any chance that some future version of ANSI-C will have it ?

I hope not.



More information about the Comp.lang.c mailing list