Token Pasting
Fraser Orr
orr at cs.glasgow.ac.uk
Fri Nov 10 01:44:43 AEST 1989
I would like to define a cpp macro along the lines of
#define list(name,type) \
typedef _${name} { \
struct _${name} _${name}_Link \
${type} _${name}_Data } ${name} ;
(where I've emphasised where I want param expansion with ${...})
The problem is joining up the bits. "_name" does not expand, because it
is a whole token. Ideally what is required is something to join together
the tokens - perhaps PASTE(_,name). I seem to remember seeing this
somewhere but I've forgotten where. Any ideas? (e-mail => summary).
==Fraser Orr ( Dept C.S., Univ. Glasgow, Glasgow, G12 8QQ, UK)
UseNet: {uk}!cs.glasgow.ac.uk!orr JANET: orr at uk.ac.glasgow.cs
ARPANet(preferred xAtlantic): orr%cs.glasgow.ac.uk at nsfnet-relay.ac.uk
More information about the Comp.lang.c
mailing list