Article View: net.lang.c
Article #9659Re: Disappearing function call
From: Lawrence W. McVoy
Date: Mon, 27 Oct 1986 06:38
Date: Mon, 27 Oct 1986 06:38
37 lines
1396 bytes
1396 bytes
In article <162@omepd> mcg@omepd.UUCP (Steven McGeady) writes:
>
>You guys are all thinking too hard.
>
> #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);
I came into this late, so you might already know this, but try this on for
size anyway:
# ifdef DEBUG
# define debug(x) fprintf x
# else
# define debug(x)
# endif
.....
debug((stderr, "Control string", arg1, arg2, ... argn));
Cute, isn't it? I stole it out of the src to enscript (adobe something or
other).
--
Larry McVoy mcvoy@rsch.wisc.edu,
{seismo, topaz, harvard, ihnp4, etc}!uwvax!mcvoy
"They're coming soon! Quad-stated guru-gates!"
Technical Details
Message-ID:
<2865@rsch.WISC.EDU>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!uwvax!mcvoyReferences:
<357@cullvax.UUCP> <162@omepd>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!columbia!rutgers!uwvax!mcvoy From: mcvoy@rsch.WISC.EDU (Lawrence W. McVoy) Newsgroups: net.lang.c Subject: Re: Disappearing function call Message-ID: <2865@rsch.WISC.EDU> Date: Mon, 27-Oct-86 01:38:48 EST Article-I.D.: rsch.2865 Posted: Mon Oct 27 01:38:48 1986 Date-Received: Mon, 27-Oct-86 20:45:49 EST References: <357@cullvax.UUCP> <162@omepd> Organization: U of Wisconsin CS Dept Lines: 37