Path: utzoo!attcan!telly!eci386!jmm From: jmm@eci386.uucp (John Macdonald) Newsgroups: comp.lang.c Subject: Re: #define DEBUG... (using printf for debugging) Summary: I was wrong Message-ID: <1990May9.131853.26919@eci386.uucp> Date: 9 May 90 13:18:53 GMT References: <11290@hoptoad.uucp> <40628@cornell.UUCP> <2294@awdprime.UUCP> <1990May8.133742.10584@eci386.uucp> Reply-To: jmm@eci386.UUCP (John Macdonald) Organization: Elegant Communications Inc., Toronto, Canada Lines: 28 In article <1990May8.133742.10584@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@eci386