Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!udel!haven!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Question with cpp and token pasting Message-ID: <15030@smoke.brl.mil> Date: 31 Jan 91 18:47:07 GMT References: <1991Jan30.232740.1697267@locus.com> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 21 In article <1991Jan30.232740.1697267@locus.com> bringo@locus.com (Bob Ringo) writes: >Hi, this is probably a simple task, but I haven't figured it out. >I'd like to do the following: >#define A "Good" >#define B "Morning" >#define C /* the concatenation of A and B */ This is an ill-defined requirement.. >--I tried the following, but it didn't work. >#define paste(x,y) x ## y >#define A "Good" >#deifne B "Morning" >#define C paste(A,B) I suppose for your purposes the following would suffice: #define A "Good" #define B "Morning" #define C (A B) Note that string-literal splicing is a new feature with ANSI C and that it occurs AFTER the preprocessing phases.