TRACEF
NAME
tracef - a simple tracing facility
SYNOPSIS
#define ENABLE_TRACEF
#include <ipd.h>
void
tracef( const char * format, ... );
DESCRIPTION
This macro provides a simple tracing facility that is easily turned on and off without removing the tracing statements. The arguments to tracef() are the same as the arguments to printf(3), but there are two main differences:
-
tracef() prints to stderr(4), not stdout(4).
-
tracef() only produces output if the C preprocessor macro ENABLE_TRACEF is #defined before the <ipd.h> header is #included. Thus, to turn on tracing, put the #define above the #include; to disable it, remove or comment out the #define.
Essentially, this means you can do "printf"-style debugging to see what's going on, and then disable the output without having to remove the all the calls to tracef().
EXAMPLE
/* Comment out next line to suppress output: */
#define ENABLE_TRACEF
#include <ipd.h>
int main( void )
{
int x = 3, y = 4;
tracef("%d + %d == %d\n", x, y, x + y);
}
AUTHOR
Jesse Tov <jesse@cs.northwestern.edu>
SEE ALSO
fprintf(3), printf(3), stderr(4)