Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!gem.mps.ohio-state.edu!ginosko!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: swap(x,y) Summary: Address of register var? Message-ID: <274@crdos1.crd.ge.COM> Date: 6 Sep 89 16:43:34 GMT References: <8350@boring.cwi.nl> <6029@ficc.uu.net> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 22 In article <6029@ficc.uu.net>, peter@ficc.uu.net (Peter da Silva) writes: | In article <1560@l.cc.purdue.edu>, cik@l.cc.purdue.edu (Herman Rubin) writes: | > In article <10790@riks.csl.sony.co.jp>, diamond@csl.sony.co.jp (Norman Diamond) writes: | > > *(int*)&x | | > What if x is in a register? | | What if it is? This is a quality-of-implementation issue. A good optimiser | will cancel out all the extra loads and stores. I'm sure you wouldn't bother | with a compiler with a poor optimiser... I wouldn't bother with a compiler which allowed me to take the address of a register variable, either. On a quality of implementation scale I rate that as zero. This brings to mind a good point, that implementation of a swap should not bypass any internal checking, such as 'const' declarations. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon