Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ll-xn!ames!hc!hi!kurt From: kurt@hi.UUCP (Kurt Zeilenga) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: need cpp macros to concatenate names Message-ID: <6129@hi.UUCP> Date: Tue, 5-May-87 05:38:17 EDT Article-I.D.: hi.6129 Posted: Tue May 5 05:38:17 1987 Date-Received: Wed, 6-May-87 05:01:46 EDT References: <634@calma.UUCP> Reply-To: kurt@hi.UUCP (Kurt Zeilenga) Distribution: na Organization: U. of New Mexico, Albuquerque Lines: 48 Xref: mnetor comp.unix.wizards:2152 comp.unix.questions:2144 In article <634@calma.UUCP> clark@calma.UUCP (Al Clark) writes: >Has anyone had any success using a macro to concatenate two words; eg: >concat(one, word) to generate the the single word 'oneword', as in the >following code segment. Yes. >#define prefix my This makes it very hard! >#define concat(x,y) x\ >y > >main() >{ > long *concat(prefix,file); >} > I've used in the pass (on a SUN3/160C with Rel. 3.3): #define cat(x,y) x/**/y cat(a,b); You get: ab But if you try to #define a or b, it don't work. A friend (bret@hi.uucp) showed me: #define prefix my #define zz ** #define concat(x,y) x/zz/y long *concat(prefix,file) So, what does your compiler do with "long * my/**/file;"? Ours turns comments into "white space" . . . as in K&R. Doesn't do you any good, but it has its (ab)uses. Well, I tried.... -- Kurt Zeilenga (zeilenga@hc.dspo.gov) I want my talk.flame! "So long, Mom, I'm off to drop the bomb..."