#define DEBUG... (using printf for debugging)

Steve Emmerson steve at groucho.ucar.edu
Thu May 10 04:33:30 AEST 1990


jmm at eci386.uucp (John Macdonald) writes:

>Try the following instead:

>    #ifdef DEBUG_PRINT_ON
>    #   define DEBUG printf
>    #else
>    #   define DEBUG(ignore)
>    #endif

>To insert a DEBUG-conditional printf use:

>    DEBUG( "format", args, ... );

>(no double parens or other funny syntax required, it just looks like
>a function call)

Be aware that some C compilers will have problems with the above due to
an "argument mismatch" between the usage of the macro and its definition.

Steve Emmerson        steve at unidata.ucar.edu        ...!ncar!unidata!steve



More information about the Comp.lang.c mailing list