Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!mit-eddie!genrad!decvax!decwrl!labrea!Shasta!andy From: andy@Shasta.UUCP Newsgroups: net.lang.c Subject: Re: Disappearing function call Message-ID: <947@Shasta.STANFORD.EDU> Date: Tue, 28-Oct-86 03:11:23 EST Article-I.D.: Shasta.947 Posted: Tue Oct 28 03:11:23 1986 Date-Received: Tue, 28-Oct-86 21:17:36 EST References: <357@cullvax.UUCP> <162@omepd> <2865@rsch.WISC.EDU> Reply-To: andy@Shasta.UUCP (Andy Freeman) Organization: Stanford University Lines: 31 #define DEBUG 1 /* or 0 as appropriate */ #define debug if( DEBUG ) fprintf (Replace fprintf with the appropriate function.) Then you can write: debug( stderr, "wrong args %d, %s, %p\n", d, s, p ); /* %p is bogus */ Either your compiler eliminates dead code or it doesn't. If it doesn't, other dead code and missed opportunities to generate good code will swamp the overhead of checking if 0 is still 0 and skipping the fprintf. If it does, the fprintf (and its args) will be removed. -andy ps - Yes, I know my debug will pick up a following "else". I use "extra" {}'s and debug( ) shouldn't be followed by an "else" anyway; I'll document that feature and let it slide. It is difficult to handle all possible constraints with something as limited as cpp; "debug( () )" grates on me. I'd rather write "if( DEBUG ) " directly than "debug( )" because it doesn't restrict . -- Andy Freeman UUCP: ...!decwrl!shasta!andy forwards to ARPA: andy@sushi.stanford.edu (415) 329-1718/723-3088 home/cubicle