[comp.lang.c] Faking out CPP

cquenel@pyrglass (Chris Quenelle) (09/08/88)

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== ----====-|---------------------------------