Path: utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!pacbell!ames!husc6!panda!teddy!jee From: jee@teddy.UUCP (John E Elsbree) Newsgroups: comp.lang.c++ Subject: Re: C++ releases from AT&T? Summary: Debugging macro cleans up code. Keywords: debugging, macros Message-ID: <4690@teddy.UUCP> Date: 31 Mar 88 20:54:30 GMT References: <254@piring.cwi.nl> <1517@dataio.Data-IO.COM> <257@piring.cwi.nl> Reply-To: jee@teddy.UUCP (John E Elsbree) Followup-To: comp.lang.c++ Organization: GenRad, Inc., Concord, Mass. Lines: 34 In article <257@piring.cwi.nl> guido@cwi.nl (Guido van Rossum) writes: >This is the crux. I want it to be a language issue, so I can replace >90% of the occurrences of > > #ifdef DEBUG > printf("We did it!!!!!!!!!!\n"); > #endif > >by > > if (debug) printf("Did it...\n"); > >which is much less disturbing for the reader of the code. You can accomplish this in another way that is equally undisturbing... #ifdef DEBUG #define DBG(x) x #else #define DBG(x) #endif . . . DBG(printf("We did it!!!\n")); If you use this method, the preprocessor throws away all your debugging code if you don't define DEBUG. -- John E Elsbree GenRad, Inc. ...!mit-eddie!genrad!jee 300 Baker Avenue (617)369-4400 ext 2935 Concord, MA 01742, USA