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


Hi Kristis,

To effect the behavior you want, I'd try to do it this way:

#ifdef FIRST_MACRO
#define some_function some_other_function
#endif

Note:  for simple function substitution, I use just the identifiers.  I don't recommend using a macro function... UNLESS if you need to do something with the parameters, such as change the order around, or remove a parameter, or add a fixed value... well, that's a different can-o'-worms which justifies a macro function.

Now if you are trying to get that to happen *IF-AND-ONLY-IF* the FIRST_MACRO is actually *USED*... then you'll have to go through the code and drop in a #define some_function some_other_function after FIRST_MACRO is used, in each source file.  Since you'd have to do that, you may as well just change the function itself, in my opinion - six of one, versus half-dozen of the other.

HTH,
--Eljay


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