#define DEBUG... (using printf for debugging)
Tim Snider
tsnider at enprt.Wichita.NCR.COM
Mon May 7 22:55:44 AEST 1990
I was reading the stuff about DEBUG and here's what we do:
#define DEB(n,a) if ( ldebug > n ) prt a
The debugs can be turned on and off interactively by setting n to the desired
value. You don't have to take old debug statements out just turn up the value
for n so they won't print. The prt function is just a shell for the appropriate
printf or fprintf statements depending on where/how the code is being executed.
A typical DEBUG statment looks like:
DEB (0, (" glorp %x glob %x splat %x", glorp, glob, splat));
The only negative thing about this method is that braces must be used
around ifs etc.
-------------------------------------------------------------------------
Tim Snider
NCR Peripherial Products Div.
Wichita Ks.
tsnider at wichita.NCR.COM
More information about the Comp.lang.c
mailing list