Path: utzoo!attcan!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!orr From: orr@cs.glasgow.ac.uk (Fraser Orr) Newsgroups: comp.lang.c Subject: Token Pasting Message-ID: <3721@tahiti.cs.glasgow.ac.uk> Date: 9 Nov 89 14:44:43 GMT References: <897daiyingshi@yvax.byu.edu> Reply-To: orr@cs.glasgow.ac.uk (Fraser Orr) Organization: Comp Sci, Glasgow Univ, Scotland Lines: 17 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@uk.ac.glasgow.cs ARPANet(preferred xAtlantic): orr%cs.glasgow.ac.uk@nsfnet-relay.ac.uk