Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!ltuxa!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: net.lang.c Subject: Re: swap() macro Message-ID: <1007@ttrdc.UUCP> Date: Sun, 22-Jun-86 23:43:58 EDT Article-I.D.: ttrdc.1007 Posted: Sun Jun 22 23:43:58 1986 Date-Received: Wed, 25-Jun-86 03:09:40 EDT References: <1201@brl-smoke.ARPA> <370@anasazi.UUCP> Organization: AT&T, Computer Systems Division, Skokie, IL Lines: 30 In article <370@anasazi.UUCP>, steve@anasazi.UUCP (Steve Villee) writes: >> Can someone construct a version that makes >> >> int *a, *b; >> swap (*a++,*b++); >> >> work right? >> Paul Schauble at MIT-Multics.arpa > >#define swap(x, y) \ > if (1) \ > { \ > register int *xp, *yp, t; \ > xp = &(x); \ > yp = &(y); \ > ... >--- Steve Villee (ihnp4!mot!anasazi!steve) CAUTION. This will fail on: register int i, j; swap(i,j); -- ------------------------------- Disclaimer: The views contained herein are | dan levy | yvel nad | my own and are not at all those of my em- | an engihacker @ | ployer or the administrator of any computer | at&t computer systems division | upon which I may hack. | skokie, illinois | -------------------------------- Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, vax135}!ttrdc!levy