RE: Defining a CPP macro that defines a macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux