Re: #define in a macro definition

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

 



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

[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