Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!rutgers!husc6!panda!genrad!decvax!tektronix!reed!psu-cs!omepd!mcg From: mcg@omepd.UUCP Newsgroups: net.lang.c Subject: Re: Disappearing function call Message-ID: <162@omepd> Date: Sun, 12-Oct-86 18:22:57 EDT Article-I.D.: omepd.162 Posted: Sun Oct 12 18:22:57 1986 Date-Received: Tue, 14-Oct-86 05:21:24 EDT References: <357@cullvax.UUCP> Reply-To: mcg@omepd.UUCP (Steven McGeady) Organization: Intel Corp. Hillsboro, Oregon Lines: 29 Summary: you're thinking too hard You guys are all thinking too hard. Even the venerable Chris Torek has proposed a solution more complex than needed. On any compiler likely to be used for production code, the optimizer will generate no code whatsoever for the following fragment: #define DEBUG 0 /* set to 1 to turn debugging on */ ... if (DEBUG) debug(...); Similarly, in the case of '#define DEBUG 1', the unneccesary test will be elided. In the idiom of the original posting, the example is: #define debug if(DEBUG) debug debug(x,y,z); Though care must be taken in using this form in un-braced if statements that have else clauses. The preprocessor solutions have the intoxicating air of complexity about them, but, in my experience, this solution proves easiest and most effective. Why look for trouble? Trouble will find you. S. McGeady