Nested Macros

Jon Allen Boone jb3o+ at andrew.cmu.edu
Tue Nov 21 02:26:32 AEST 1989


A friend is attempting to write a macro along the following lines:

#define DEBUG 1

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

however, this results in an error when he attempts to compile it.

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? Any help would be greatly
appreciated.  Please carbon copy your reply to pg0p at andrew.cmu.edu, as
well as to jb3o at andrew.cmu.edu and the board.

thank you...



More information about the Comp.lang.c mailing list