Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!purdue!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: C history question Message-ID: <4153@buengc.BU.EDU> Date: 15 Sep 89 01:18:21 GMT References: <575@calmasd.Prime.COM> <10839@riks.csl.sony.co.jp> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 20 In article <10839@riks.csl.sony.co.jp> diamond@riks. (Norman Diamond) writes: >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? > >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.."