Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.lang.c Subject: Re: swap(x,y) Summary: swap operator Message-ID: <227@crdos1.crd.ge.COM> Date: 29 Aug 89 14:47:39 GMT References: <3785@ncsuvx.ncsu.edu> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 23 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@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