Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!mcnc!ncsu!uvacs!edison!steinmetz!davidsen From: davidsen@steinmetz.UUCP (Davidsen) Newsgroups: net.lang.c Subject: Re: Boolean Operators Slighted in C Message-ID: <732@steinmetz.UUCP> Date: Fri, 9-May-86 15:59:39 EDT Article-I.D.: steinmet.732 Posted: Fri May 9 15:59:39 1986 Date-Received: Mon, 12-May-86 00:18:08 EDT References: <838@ihwpt.UUCP> <778@bentley.UUCP> <210@sdchema.sdchem.UUCP> Reply-To: davidsen@kbsvax.UUCP (Davidsen) Organization: GE CRD, Schenectady, NY Lines: 33 In article <210@sdchema.sdchem.UUCP> tps@sdchema.UUCP (Tom Stockfisch) writes: >In article <778@bentley.UUCP> kwh@bentley.UUCP writes: >>In article <838@ihwpt.UUCP> ihwpt!knudsen writes: >>>(2) There isn't any ^^ (XOR) operator either, as in >> >>There is, but it's spelled "!=". (Presumably more efficient than "^", though >>I think either one should work with a smart compiler.) >> > >Not quite the same. > 3 ^^ 4 >would evaluate as 0, > 3 != 4 >evaluates as 1. > >-- Tom Stockfisch, UCSD Chemistry XOR can be defined as an (ugly) macro, I believe. #define XOR(a,b) (((a) != 0) != ((b) != 0) /* or if you like small better than readable */ #define XOR(a,b) (!!(a) != !!(b)) -- -bill davidsen seismo!rochester!steinmetz!--\ / \ ihnp4! unirot ------------->---> crdos1!davidsen \ / chinet! ---------------------/ (davidsen@ge-crd.ARPA) "Stupidity, like virtue, is its own reward"