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

Dave Eisen dkeisen at Gang-of-Four.Stanford.EDU
Fri May 4 16:39:37 AEST 1990


In article <90123.152729CMH117 at psuvm.psu.edu> CMH117 at psuvm.psu.edu (Charles Hannum) writes:
>
>#ifdef DEBUG
>#define  debug(x)  printf x
>#else
>#define  debug(x)
>#endif
>

On UNIX you might want to do something like:

#ifdef DEBUG
#define debug(x)   	printf x, fflush (stdout)
#else
#define debug(x)
#endif

or put an
#ifdef DEBUG
setbuf (stdout, NULL);
#endif 

near the beginning of main. Otherwise you have no way of knowing
where in the program it crashed.



--
Dave Eisen                      	    Home: (415) 323-9757
dkeisen at Gang-of-Four.Stanford.EDU           Office: (415) 967-5644
"I drive a brand new BMW and I wear an unusually large shoe..."



More information about the Comp.lang.c mailing list