C history question

Blair P. Houghton bph at buengc.BU.EDU
Fri Sep 15 11:18:21 AEST 1989


In article <10839 at riks.csl.sony.co.jp> diamond at riks. (Norman Diamond) writes:
>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?
>
>In A && B, if A is false (0) then B is not evaluated.
>In A || B, if A is true (non-0) then B is not evaluated.
>In A ^^ B, for which value(s) of A do you skip B?

You never do.  So what?  So it's a boolean xor, instead of a
short-circuiting operator.  It returns 1 or 0 depending on the
result of the boolean comparison.  Try getting that out of (A ^ B)
every time.  Without doing (!!(A ^ B)), I mean.

I mean, what's the biggie about having &&?  We _could_ just do
(A ? !!B : 0), but would you want to?

				--Blair
				  "I mean, I suh-wear.."



More information about the Comp.lang.c mailing list