Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!bellcore!faline!ulysses!sfmag!sfsup!mpl From: mpl@sfsup.UUCP (M.P.Lindner) Newsgroups: comp.lang.c Subject: Re: typeof isn't enough to define swap correctly Message-ID: <2020@sfsup.UUCP> Date: Wed, 9-Sep-87 20:19:32 EDT Article-I.D.: sfsup.2020 Posted: Wed Sep 9 20:19:32 1987 Date-Received: Sat, 12-Sep-87 00:37:02 EDT References: <557@rocky.STANFORD.EDU> <1880@sol.ARPA> <109@umigw.MIAMI.EDU> <2019@sfsup.UUCP> Organization: AT&T-IS, Summit N.J. USA Lines: 17 Summary: oops OK, as I read further I discovered people were complaining about not handling name clashes, arrays, and register variables. My method won't handle register variables (can't take the address of a register), but it WILL handle arrays, and as for name clashes, might I suggest the following kludge based on a trick used by C++ to avoid name clashes (no, I wouldn't really do this, any more than I would really use that swap routine): #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) ). Mike (feeling sick now) Lindner