Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!sri-unix!ubi From: ubi@sri-unix.ARPA (Ron Ueberschaer) Newsgroups: comp.lang.c Subject: Re: More writing readable code Message-ID: <4494@sri-unix.ARPA> Date: Thu, 16-Jul-87 22:08:40 EDT Article-I.D.: sri-unix.4494 Posted: Thu Jul 16 22:08:40 1987 Date-Received: Sat, 18-Jul-87 10:08:11 EDT References: <11128@hi.UUCP> Reply-To: ubi@sri-unix.UUCP (Ron Ueberschaer) Organization: SRI, Menlo Park, CA. Lines: 24 In article <11128@hi.UUCP> kurt@hc.dspo.gov (Kurt Zeilenga) writes: >... to know if A and B are both of the same truth value (zero or non-zero). > > (!A == !B) > >to avoid the case that A and B are both non-zero but no the same integer >value. A more outrageous way to do this, for want of a logical XOR operator, is ((A && B) || !(A || B)) which would reduce to !(A ^^ B) where the ^^ logical XOR binary operator is the analog of the ^ bitwise XOR, if only such an operator existed. ;-) --Ron Ueberschaer SRI International Menlo Park, CA ...!{hplabs,rutgers}!sri-unix!ubi ubi@sri-unix.uucp