Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: net.lang.c Subject: Re: More extensions to C (was: Boolean Operators Slighted in C) Message-ID: <1483@mmintl.UUCP> Date: Tue, 20-May-86 18:54:02 EDT Article-I.D.: mmintl.1483 Posted: Tue May 20 18:54:02 1986 Date-Received: Fri, 23-May-86 23:56:24 EDT References: <2741@utcsri.UUCP> <826@bentley.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT Lines: 21 In article <826@bentley.UUCP> kwh@bentley.UUCP writes: >In article <2741@utcsri.UUCP> greg@utcsri.UUCP writes: >>In article <602@brl-smoke.ARPA> rbj@icst-cmr (Root Boy Jim) writes: >>>3) Exchange operator. ... >> >>Good stuff. Even machines without an EXG can use a scratch register, which >>is better than using a user-supplied temp. > >This could be considered a special case of my ",," operator: to exchange x >and y, write "x = (y ,, (y = x))". I would prefer a syntax like "{x, y} = {y, x};" It's more readable. (BTW, a really good optimizing compiler can optimize out the temporary. I'm not fully up on what optimizers are doing these days, but I doubt that there are many compilers which do this. Optimizing it out is easier if it is declared locally ("{int temp = x; x = y; y = temp;}") instead of being declared at the top of the routine.) Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Multimate International 52 Oakland Ave North E. Hartford, CT 06108