🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9515

Re: Disappearing function call

#9515
From: Frank Adams
Date: Mon, 06 Oct 1986 00:17
26 lines
1380 bytes
In article <357@cullvax.UUCP> drw@cullvax.UUCP writes:
>What I want to do is to write a function call of a variable number of
>arguments:
>
>	debug(x, y, z, ...)
>
>that will generate no code when the symbol DEBUG is not defined, but
>generate a call of some function (say, debug_()) when it is.

Here's a possibility which is slightly ugly, as all the others are, but the
ugliness is in a different place.  Write:

#ifdef DEBUG
#define debug(a) debug_ a
#else
#define debug(a)
#endif

Now, write your debug statements with an extra pair of parentheses:

   debug((x, y, z, ...));

I'm not necessarily recommending this; it's just an idea.

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Multimate International    52 Oakland Ave North    E. Hartford, CT 06108
Technical Details
Message-ID: <1844@mmintl.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!ll-xn!adelie!axiom!linus!philabs!pwa-b!mmintl!franka
References: <357@cullvax.UUCP>

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!lll-crg!nike!ll-xn!adelie!axiom!linus!philabs!pwa-b!mmintl!franka
From: franka@mmintl.UUCP (Frank Adams)
Newsgroups: net.lang.c
Subject: Re: Disappearing function call
Message-ID: <1844@mmintl.UUCP>
Date: Sun, 5-Oct-86 20:17:35 EDT
Article-I.D.: mmintl.1844
Posted: Sun Oct  5 20:17:35 1986
Date-Received: Wed, 8-Oct-86 07:34:33 EDT
References: <357@cullvax.UUCP>
Reply-To: franka@mmintl.UUCP (Frank Adams)
Organization: Multimate International, E. Hartford, CT
Lines: 26