Path: utzoo!utgpu!water!watmath!clyde!cbosgd!ihnp4!ihuxv!rck From: rck@ihuxv.ATT.COM (R. C. Kukuk) Newsgroups: comp.lang.c Subject: Re: comma operator Summary: comma operator and the (in)famous swap Message-ID: <2382@ihuxv.ATT.COM> Date: 20 Jan 88 17:38:59 GMT References: <3819@sigi.Colorado.EDU> <5080013@hpfcdc.HP.COM> <7120@brl-smoke.ARPA> <7137@brl-smoke.ARPA> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 14 In article <7137@brl-smoke.ARPA>, gwyn@brl-smoke.ARPA (Doug Gwyn ) writes: > In article <3887@sigi.Colorado.EDU> swarbric@tramp.Colorado.EDU (SWARBRICK FRANCIS JOHN) writes: > >#define swap(a,b) ((a) = ((b) = ((a) = (a) ^ (b)) ^ (b)) ^ (a)) > >He says it will work for anything (int, char *, etc.). > This oldie fails when a == b. Why? Think about it. Re: Another discussion in this news group -- Note that I said "a == b"; not "a = b". :-) Ron Kukuk AT&T Bell Labs