Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!trwind!venice!ries From: ries@venice.SEDD.TRW.COM (Marc Ries) Newsgroups: comp.sources.d Subject: Re: #define DEBUG... (using printf for debugging) Message-ID: <565@venice.SEDD.TRW.COM> Date: 3 May 90 20:13:56 GMT References: <11290@hoptoad.uucp> <40628@cornell.UUCP> <4250@tekfdi.FDI.TEK.COM> Reply-To: ries@venice.sedd.trw.com (Marc Ries) Organization: TRW Systems Engineering & Development Division, Redondo Beach, CA Lines: 29 In article <4250@tekfdi.FDI.TEK.COM> wallyk@tekfdi.FDI.TEK.COM (Wally Kramer) writes: > >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": [...] What ever happened to adding an argv Boolean variable "debug", switched on the command line, and just do this in the code?: if (debug) {printf("whatever", what_args);} If you don't want to do it via the command line, then: #ifdef DEBUG debug = True/On/Etc. #else debug = False/Off/Etc. #endif -- Marc Ries ries@venice.sedd.trw.com (ARPA) somewhere!trwind!venice!ries (UUCP) #include