Nested Macros

Georg Wittig wittig at gmdzi.UUCP
Tue Nov 21 19:17:21 AEST 1989


jb3o+ at andrew.cmu.edu (Jon Allen Boone) writes:
>#define DEBUG 1
>#define DB(X) #ifdef (DEBUG) printf(X)
>does anyone know how he would go about writing a macro that would
>allow him to simply type DB(x) in his code and not have to type #ifdef
>(DEBUG) printf(X) everywhere instead?

#ifdef DEBUG
#	define	DB(X)	(printf(X))
#else
#	define	DB(X)
#endif

-- 
Georg Wittig   GMD-Z1.BI   P.O. Box 1240   D-5205 St. Augustin 1 (West Germany)
email: wittig at gmdzi.uucp   phone: (+49 2241) 14-2294
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Freedom's just another word for nothing left to lose" (Kris Kristofferson)



More information about the Comp.lang.c mailing list