This is the mail archive of the
mailing list for the GCC project.
RE: Defining a CPP macro that defines a macro
- From: Kristis Makris <kristis dot makris at asu dot edu>
- To: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 07 Nov 2006 14:06:44 -0700
- Subject: RE: Defining a CPP macro that defines a macro
- References: <firstname.lastname@example.org> <EDC8DDD212FEB34C884CBB0EE8EC2D91216611@namailgen.corp.adobe.com>
I'm trying to do something like:
#define FIRST_MACRO(a,b) \
int some_global_var = a; \
int some_other_global_var = b; \
extern int some_variable; \
\#define some_function() some_other_function()
And some_other_function will use the variables some_global_var and
some_other_global_var in it's body.
There's an implementation of some_function _already_ compiled in
library. But in some cases, if FIRST_MACRO is defined, I want a source
program to use some_other_function (from that same library) instead of
And the source program already contains calls to some_function. Hence I
want to develop FIRST_MACRO so that if this macro is defined in the
source program, then this change happens. I don't want the author of the
source program to have to manually write that huge body (there's more in
the body) defined by FIRST_MACRO.
On Tue, 2006-11-07 at 12:01 -0800, John (Eljay) Love-Jensen wrote:
> Hi Kristis,
> Could you provide an example of what you are trying to do?
> Is it something like this...
> #define FOO #define BAR QUUX
> ...or something like this...
> #define MAKE_ID(x, y) x ## y