Xref: utzoo comp.lang.c:28448 comp.unix.wizards:21806 alt.sources:1839 comp.sources.d:5265 misc.misc:9670 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!cs.dal.ca!silvert From: silvert@cs.dal.ca (Bill Silvert) Newsgroups: comp.lang.c,comp.unix.wizards,alt.sources,comp.sources.d,misc.misc Subject: Re: #define DEBUG... (using printf for debugging) Summary: What about stderr? Message-ID: <1990May4.122648.904@cs.dal.ca> Date: 4 May 90 12:26:48 GMT References: <40628@cornell.UUCP> <1990May3.192347.12973@cs.umn.edu> <8060@goofy.Apple.COM> Sender: silvert@cs.dal.ca.UUCP (Bill Silvert) Reply-To: bill@biomel.UUCP Organization: Habitat Ecology Div., Bedford Inst. of Oceanography Lines: 29 In the recent postings there were a number of solutions to the problem of defining a function DEBUG which optionally works like printf. Only one addresses the fact that debugging information should preferably go to stderr: In article <8060@goofy.Apple.COM> escher@Apple.COM (Michael Crawford) writes: >more elegant still: > >#ifdef DEBUG >#define fDebug( x ) fprintf x >#define Debug( x ) printf x >#else >#define fDebug( x ) >#define Debug( x ) >#endif > >fDebug(( stderr, "debugging info" )); >Debug(( "debugging info" )); Is there a way to define Debug so that Debug(x, y, z,...) can optionally either do nothing or generate fprintf(stderr, x, y, z,...) with an arbitrary number of arguments? Crawford's method still requires specific mention of stderr in each debug line. -- William Silvert, Habitat Ecology Division, Bedford Inst. of Oceanography P. O. Box 1006, Dartmouth, Nova Scotia, CANADA B2Y 4A2. Tel. (902)426-1577 UUCP=..!{uunet|watmath}!dalcs!biomel!bill BITNET=bill%biomel%dalcs@dalac InterNet=bill%biomel@cs.dal.ca