Xref: utzoo comp.lang.c:28422 comp.unix.wizards:21786 alt.sources:1832 comp.sources.d:5259 misc.misc:9663 Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!ub4b!kulcs!blekul11!nnearn!psuvm!cmh117 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 References: <11290@hoptoad.uucp> <40628@cornell.UUCP> Organization: Penn State University Lines: 25 #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