#define in a macro definition
Brian Dessent
brian@dessent.net
Sun Dec 18 08:43:00 GMT 2005
bill wrote:
> I was trying to do exactly this type of thing just last night! My
> reason is I've got
> a bunch of code that reads:
> #ifdef FOO
> debug("FOO\n");
> #endif
> It's printing to a debug file to help track down what options were
> defined. This is
> several hundred lines of code, and it's a bit ugly. It would be nice to
> be able to
> write "PRINT_MACRO(FOO)" and have it expand to the 3 lines above.
But why in the world would PRINT_MACRO need to include the #ifdef? Why
not just do this once:
#ifdef FOO
# define PRINT_MACRO(x) debug(x)
#else
# define PRINT_MACRO(x)
#endif
Brian
More information about the Gcc-help
mailing list