Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!watmath!datanguay
From: datanguay@watmath.waterloo.edu (David Adrien Tanguay)
Newsgroups: comp.lang.c
Subject: Re: Concatenating with a compile-time definition in "ANSI" CPP
Message-ID: <29351@watmath.waterloo.edu>
Date: 24 Sep 89 15:56:44 GMT
References: <470004@gore.com>
Reply-To: datanguay@watmath.waterloo.edu (David Adrien Tanguay)
Organization: U. of Waterloo, Ontario
Lines: 21

In article <470004@gore.com> jacob@gore.com (Jacob Gore) writes:
>Can the following be achieved with "ANSI" cpp:
>
>	MtaInit()
>
>expands to
>
>	SomeNameInit()
>
>where Mta=SomeName is specified at compile-time, WITHOUT enumerating every
>possible value of Mta in an #ifdef?

#define join(a,b)  a ## b
#define join2(a,b) join( a, b )
#define MtaInit    join2( Mta, Init )

Mta can then be defined with -DMta=something. Init must not be a macro.
The join2 is there so that the Mta will get expanded.
The standard's at work, I'm not; caveat emptor.

David Tanguay