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

Charles Hannum CMH117 at psuvm.psu.edu
Fri May 4 05:27:29 AEST 1990


#ifdef DEBUG
#define  debug(x)  printf x
#else
#define  debug(x)
#endif


Then, you can just use something like:

  debug(("%s\n","This is a test."));      (<===  This is an EXAMPLE; it's not
                                                 meant to be efficient, just
                                                 to emphasize the syntax!!!!)

in your code.  Just like printf(), except you need *two* parentheses around
the argument list.

I've been using this trick for years.


Virtually,
- Charles Martin Hannum II         PennMUD Design Team - (Resident) Programmer
    (That's Charles to you!)       "Those who say a thing cannot be done should
  Please send mail to:              under no circumstances stand in the way of
  hannum at haydn.psu.edu              he who is doing it." - a misquote



More information about the Alt.sources mailing list