Path: utzoo!utgpu!water!watmath!clyde!bellcore!faline!ulysses!allegra!mit-eddie!husc6!ut-sally!ut-emx!dlnash From: dlnash@ut-emx.UUCP Newsgroups: comp.lang.c Subject: Re: "logical" xor Message-ID: <475@ut-emx.UUCP> Date: 11 Jan 88 22:55:15 GMT References: <11207@brl-adm.ARPA> <20153@teknowledge-vaxc.ARPA> Organization: The University of Texas at Austin, Austin, Texas Lines: 20 Posted: Mon Jan 11 17:55:15 1988 In article <20153@teknowledge-vaxc.ARPA>, mkhaw@teknowledge-vaxc.ARPA (Mike Khaw) writes: > 1^0 = 1; 0^0 = 0; 1^1 = 0 => logical xor should mean "does not equal", > for which C has a perfectly good symbol, "!=" > Yes, but "logically" speaking, 1 == 2, since both are non-zero and hence are both true. Therefore 1 ^^ 2 should be false, but 1 != 2 is true. If you are dealing with non-canonical true-false values, this will hurt you. Of course, you can always use !x != !y to translate x and y into canonical true-false values (or !!x != !!y if you want to be picky), but that just makes things a little bit harder to understand. Don Nash UUCP: ...!{ihnp4, allegra, seismo!ut-sally}!ut-emx!dlnash ARPA: dlnash@emx.utexas.edu ^^|^^^ ^^^------------------------------+-- note new address BITNET: CCEU001@UTADNX, DLNASH@UTADNX TEXNET: UTADNX::CCEU001, UTADNX::DLNASH