This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Defining a CPP macro that defines a macro


   #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()

As Ian Lance Taylor noted, this is not possible.  I suggest you do:

| #define FIRST_MACRO(a,b)          \
|    int some_global_var = a;       \
|    int some_other_global_var = b; \
|    extern int some_variable;

And then right after calling the macro, do your define:

| FIRST_MACRO(a, b);
| #define some_function() some_other_function()


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]