C history question

Peter Montgomery pmontgom at sonia.math.ucla.edu
Wed Sep 13 07:34:36 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 ?

	I ask why C lacks &&= and ||=.  In FORTRAN, I often write code like

		allok = allok .and. a(i).gt.b(i)

C will let me write 

		allok = allok && a[i] > b[i];

but it seems in the language spirit to avoid repeating "allok"; 
shouldn't we be allowed to abbreviate this to

		allok &&= a[i] > b[i];
--------
        Peter Montgomery
        pmontgom at MATH.UCLA.EDU 



More information about the Comp.lang.c mailing list