Xref: utzoo comp.std.c:270 comp.lang.c:11868 Path: utzoo!attcan!uunet!mcvax!ukc!reading!onion!bru-cc!cssrccb From: cssrccb@cc.brunel.ac.uk (Cornelia Boldyreff) Newsgroups: comp.std.c,comp.lang.c Subject: Re: Concatenating tokens that aren't parameters to macros in ANSI C Keywords: paste operator cpp preprocess Message-ID: <453@Terra.cc.brunel.ac.uk> Date: 15 Aug 88 17:26:25 GMT Organization: Brunel University, Uxbridge, UK Lines: 28 Regarding item on this subject from: gnu@hoptoad.uucp (John Gilmore) Under pcc: >#define LFD 6 >#define LHIGH 1.0e+LFD which expanded LHIGH to >1.0e+6 and the problems he's had getting this to work in ANSI C with gcc. There is a simple solution given below: #define paste(a,b) a ## b #define xpaste(a,b) paste(a,b) #define LFD 6 #define LHIGH xpaste(1.0e+, LFD) main(){printf("%f\n", LHIGH);} and it works correctly with gcc. The point is that the paste macro if called through another macro will work on macro replaced operands. I've explained this more fully in an article which appeared in the EUUG newsletter: Macro Expansion as Defined by the ANSI/ISO Draft Standard, Volume 8, No 2, Summer 1988. Cornelia Boldyreff Department of Computer Science Brunel University Uxbridge UB8 3PH, ENGLAND.