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

Wally Kramer wallyk at tekfdi.FDI.TEK.COM
Fri May 4 05:22:28 AEST 1990


In article <40628 at cornell.UUCP> gordon at cs.cornell.edu (Jeffrey Adam Gordon)
writes:

>I want to have a DEBUG flag which controls whether diagnostic printfs
>are executed or not.

How about writing your diagnostic statements "thusly":

	DEBUG (("informative message #1: j = %d, k = %d", j, k));
		/* note extra parens surrounding normal printf parameters */

To enable debugging statements:

	#define	DEBUG(x)	printf x

To disable:

	#define	DEBUG(x)

Lint note:  you should define debug on when you run this through lint.

wallyk at tekfdi.fdi.tek.com (Wally Kramer)
Contractor to Tektronix from Step Technology, Inc.  503 244 1239



More information about the Comp.lang.c mailing list