Article View: comp.std.c
Article #4269Re: token pasting after macro expansion
From: Jim Hill
Date: Tue, 24 Oct 1995 06:36
Date: Tue, 24 Oct 1995 06:36
24 lines
1243 bytes
1243 bytes
In article <1995Oct21.233622.11972@news.wrc.xerox.com>, leisner@sdsp.mc.xerox.com wrote: >I want to token paste after macro expansion...any strategies? #define A tokenA #define B tokenB #define PASTEX(X,Y) PASTE(X,Y) #define PASTE(X,Y) X ## Y PASTEX(A,B) You need PASTEX because ## disables further replacement for the surrounding pp-tokens, so you have to bury it to let argument subsitution in PASTEX do the expansions first. That might seem strange at first, but you're constructing tokens out of bits and pieces - this avoids accidents with the pieces, or at least it avoids the ones you don't ask for by doing something like this... Jim -- Jim Hill Contents public domain and worth $.02 more than you paid. jthill@netcom.com PGPrint: 6B 85 76 D1 EF BA 2C 78 12 25 8A 5A BF F3 37 7E
Technical Details
Message-ID:
<jthill-2310952236570001@jthill.slip.netcom.com>Path:
arc1-ca.pugleaf.net!jthill.slip.netcom.com!userReferences:
<1995Oct21.233622.11972@news.wrc.xerox.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!jthill.slip.netcom.com!user From: jthill@netcom.com (Jim Hill) Subject: Re: token pasting after macro expansion Message-ID: <jthill-2310952236570001@jthill.slip.netcom.com> Sender: jthill@netcom18.netcom.com Organization: biological <-- hey! a one-word oxymoron! References: <1995Oct21.233622.11972@news.wrc.xerox.com> Date: Tue, 24 Oct 1995 06:36:57 GMT