🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Chris Quenelle Wed, 07 Sep 1988 17:00
Faking out CPP (was: Variable length arg lists for macros)
#5329
Author: Chris Quenelle
Date: Wed, 07 Sep 1988 17:00
38 lines
1502 bytes
One common thread to this discussion is "ways to 'define out'
a function call with a variable number of parameters".

for instance, you have :

	DEBUG_fprintf(stderr,"error number %d\n", errnumber);

and you would like a define that "disables" it, by making compile
to nothing when a certain define is set.

I have tried 

#define DEBUG_fprintf	1 ? 0 :

and it is guaranteed not to _call_ DEBUG_fprintf, but it MAY generate
code for it.  Actually any decent compiler should throw it away entirely.

The effect is as if you had done something like this:

	statement;
	5;
	other-statement;

	or

	statement;
	1 ? 5 : 7;
	other-statement;

both perfectly legal C.

"works for me."

--chris
-----------------------------|@---@    -=----|---------------------------------
|Chris Quenelle (The Lab Rat)|\. ./ + --==---|   on hold                      |
|ucbvax!voder!polyslo!cquenel| \ /   ---===--|                                |
-----------------------------|==o== ----====-|---------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads