#define DEBUG... (using printf for debugging)
John Macdonald
jmm at eci386.uucp
Tue May 8 23:37:42 AEST 1990
In article <2294 at awdprime.UUCP> tif at awdprime.austin.ibm.com.UUCP (/32767) writes:
|Most people I know of do
| #define DEBUG(xx) printf xx
|and then
| DEBUG(("the flag is %d\n", flag));
|The whole thing is completely removed with
| #define DEBUG(xx)
The same sequence has been suggested numerous times in previous
messages.
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, ... );
(no double parens or other funny syntax required, it just looks like
a function call)
If you prefer, you can comment out one of the defines rather than
controlling it with an ifdef.
--
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