Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sjuvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!sjuvax!jss From: jss@sjuvax.UUCP (J. Shapiro) Newsgroups: net.lang.c Subject: Re: <=> and obfuscation Message-ID: <837@sjuvax.UUCP> Date: Mon, 11-Feb-85 20:00:10 EST Article-I.D.: sjuvax.837 Posted: Mon Feb 11 20:00:10 1985 Date-Received: Wed, 13-Feb-85 05:01:43 EST References: <7699@brl-tgr.ARPA> <1293@bbncca.ARPA> <7853@brl-tgr.ARPA> <805@sjuvax.UUCP> <11927@gatech.UUCP> Organization: Saint Josephs Univ. Phila., Pa. Lines: 30 [Aren't you hungry...] b ^= a ^= b ^= a > However, if a == b when you start out, you end up with a == 0 && b == 0. > > Arnold Robbins... will work even if A = B. Suppose a = b = 1011 0100. a = 1011 0100 b ^= a = 0000 0000 now b is 0000 0000 a ^= b ^= a = XOR of 1011 0100 and 0000 0000 == 1011 0100 now b is 0000 0000, and a is 1011 0100 b ^= a ^= b ^= a == 0000 0000 ^= 1011 0100 = 1011 0100 I believe that this works on *any* lvalues. If it doesn't work on your system, make sure it isn't the system at fault. I could see it not working for arrays of different sizes. "There are a number of assignment operators... All require an lvalue as their left operand." K&R p 191. And if you don't believe me, go read Rob Pike's paper on Multiwindow bitmapped graphics. It is how he says the bitmap swap should be implemented, and I have *seen* it work with my own eyes. Jon Shapiro Haverford College