swap(x,y)

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Wed Aug 30 00:47:39 AEST 1989


  At the risk of starting a flamefest the day before I start my
vacation, I will say that the next C standard should *consider* a swap
operator, since there have been so many clever ways posted to sway
regular types, structs, etc.

  My first though is to suggest an operator which will work on two
values of any type. No frills, no extensions. Has to be part of the
language (compiler) to allow generation of fast inline code. I have no
strong objection to using another operator, but would favor making the
sytax swap(x,y) for readability.

  There are lots of ways to do this, but they all seem to lack at least
one of (a) portability to any C machine, (b) speed of execution, or (c)
generality to all data types.

  If you really want to discuss this with me or flame me send mail, my
news might die before I get back.
-- 
bill davidsen	(davidsen at 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



More information about the Comp.lang.c mailing list