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

John Macdonald jmm at eci386.uucp
Wed May 9 23:18:53 AEST 1990


In article <1990May8.133742.10584 at eci386.uucp> I wrote:
|
|The double parentheses in this solution are annoying, and error-prone,
|and not really required.
|
|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, ... );

without checking whether it worked.  Well it used to work back when
I was running on an old system, with an older preprocessor, but
nowadays on many preprocessors you get an error message about a
mismatch in the number of arguments when you have debugging turned
off.

Here I go, crawling into a cave and pulling the opening in after me...
-- 
Algol 60 was an improvment on most           | John Macdonald
of its successors - C.A.R. Hoare             |   jmm at eci386



More information about the Comp.lang.c mailing list