Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!linus!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c Subject: Re: typeof isn't enough to define swap correctly Message-ID: <2371@mmintl.UUCP> Date: Mon, 14-Sep-87 19:13:00 EDT Article-I.D.: mmintl.2371 Posted: Mon Sep 14 19:13:00 1987 Date-Received: Fri, 18-Sep-87 05:46:59 EDT References: <557@rocky.STANFORD.EDU> <1880@sol.ARPA> <109@umigw.MIAMI.EDU> <2019@sfsup.UUCP> <2020@sfsup.UUCP> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Multimate International, E. Hartford, CT. Lines: 18 In article <2020@sfsup.UUCP> mpl@sfsup.UUCP (M.P.Lindner) writes: >and as for name clashes, might I suggest the following kludge based on a trick >used by C++ to avoid name clashes: > >#define swap(a,b) { \ > int _unlikely_string_/**/a/**/b; \ > etc. > >blech, I have a bad taste in my mouth. Note that this scheme (and much of >C++) fails if the arguments to the macro have space around them (ie >swap(x, y) instead of swap(x,y) ). This also doesn't work if x and y anything other than simple variables. I *don't* expect swap(a[i++],b[j++]) to work, but swap(a[i],b[j]) *should*. -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108