Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Sequence Points, Swapping Vars (Was Re: Is...wrong with the compiler?) Message-ID: <1990Sep29.235218.6689@zoo.toronto.edu> Organization: U of Toronto Zoology References: <884@gtenmc.UUCP> <1990Sep26.175948.8232@zoo.toronto.edu> <189@thor.UUCP> Date: Sat, 29 Sep 90 23:52:18 GMT In article burley@world.std.com (James C Burley) writes: >... the other thread(s) I've seen posting solutions >such as "a^=b^=a^=b" (or some such thing) for the problem of swapping integer >variables. If ^= also is not a sequence point, isn't it valid for a >conforming C compiler to write into a the result of XORing the original values >of a and b, instead of the final value... Yes indeed. Note that most of the really knowledgeable readers in this group have seen the variable-swapping nonsense too many times to pay much attention to the latest round of cutesy solutions to a non-problem. -- Imagine life with OS/360 the standard | Henry Spencer at U of Toronto Zoology operating system. Now think about X. | henry@zoo.toronto.edu utzoo!henry