Xref: utzoo comp.lang.c:28398 comp.sources.d:5249 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!zephyr.ens.tek.com!tekfdi!wallyk From: wallyk@tekfdi.FDI.TEK.COM (Wally Kramer) Newsgroups: comp.lang.c,comp.sources.d Subject: Re: #define DEBUG... (using printf for debugging) Message-ID: <4250@tekfdi.FDI.TEK.COM> Date: 3 May 90 19:22:28 GMT References: <11290@hoptoad.uucp> <40628@cornell.UUCP> Reply-To: wallyk@tekfdi.FDI.TEK.COM (Wally Kramer) Followup-To: comp.sources.d Organization: Microwave & RF Instruments, Tektronix, Beaverton, Oregon Lines: 24 In article <40628@cornell.UUCP> gordon@cs.cornell.edu (Jeffrey Adam Gordon) writes: >I want to have a DEBUG flag which controls whether diagnostic printfs >are executed or not. How about writing your diagnostic statements "thusly": DEBUG (("informative message #1: j = %d, k = %d", j, k)); /* note extra parens surrounding normal printf parameters */ To enable debugging statements: #define DEBUG(x) printf x To disable: #define DEBUG(x) Lint note: you should define debug on when you run this through lint. wallyk@tekfdi.fdi.tek.com (Wally Kramer) Contractor to Tektronix from Step Technology, Inc. 503 244 1239