swap() macro
Daniel R. Levy
levy at ttrdc.UUCP
Mon Jun 23 13:43:58 AEST 1986
In article <370 at anasazi.UUCP>, steve at 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
More information about the Comp.lang.c
mailing list