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

/32767 tif at commlab1..austin.ibm.com
Sat May 5 04:14:26 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.
>	DEBUG ("debugging information");
>but then how do I turn DEBUG off?

Actually it's easier than you thought:
	#define DEBUG
will turn it off although the string will still be put in your
executable (unless your optimizer is better than mine).  ("xx")
is a parenthesised pointer expression which is a valid C statement.

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)

Paul Chamberlain
tif at doorstop.austin.ibm.com
tif at commlab1.austin.ibm.com
sc30661 at ausvm6



More information about the Alt.sources mailing list