Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!uunet!hsi!stpstn!lerman From: lerman@stpstn.UUCP (Ken Lerman) Newsgroups: comp.lang.c Subject: Re: ANSI Parsing/Preproc questions Message-ID: <5689@stpstn.UUCP> Date: 16 Oct 90 11:44:42 GMT References: <383@goya.dit.upm.es> Reply-To: lerman@stpstn.UUCP (Ken Lerman) Organization: The Stepstone Corporation, Sandy Hook, CT 06482 Lines: 28 In article <383@goya.dit.upm.es> esink@turia.dit.upm.es (Eric Wayne Sink) writes: [...] >#define macro(X) variX >/* obviously, some operator is needed above, if this is legal at all >*/ > >macro(5) = 3; /* expands to: vari5 = 3 */ > [...] >Eric W. Sink >esink@turia.dit.upm.es Another post showed (I love it when I get to see the answers before I see the questions) the use of the ANSI ## operator to do this. Prior to ANSI, many compilers accepted: #define macro(X) vari/**/X to expand: macro(5) = 3; as: vari5 = 3; I don't know if this is "official" K&R or not, but it worked on a lot of machines. (Note that the comment must be of zero length for this to work.) Ken