swap(x,y)

Peter da Silva peter at ficc.uu.net
Tue Sep 5 22:07:58 AEST 1989


In article <1560 at l.cc.purdue.edu>, cik at l.cc.purdue.edu (Herman Rubin) writes:
> In article <10790 at riks.csl.sony.co.jp>, diamond at 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...
-- 
Peter da Silva, *NIX support guy @ Ferranti International Controls Corporation.
Biz: peter at ficc.uu.net, +1 713 274 5180. Fun: peter at sugar.hackercorp.com. `-_-'
"The Distribution: field on the header has been modified so as not to      'U`
 violate Information Export laws." -- eugene miya, NASA Ames Research Center.



More information about the Comp.lang.c mailing list