home *** CD-ROM | disk | FTP | other *** search
- From: CMH117@psuvm.psu.edu (Charles Hannum)
- Newsgroups: comp.lang.c,comp.unix.wizards,alt.sources,comp.sources.d,misc.misc
- Subject: Re: #define DEBUG... (using printf for debugging)
- Message-ID: <90123.152729CMH117@psuvm.psu.edu>
- Date: 3 May 90 19:27:29 GMT
-
-
- #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@haydn.psu.edu he who is doing it." - a misquote
-