Passing Variable Numbers of Arguments

Dave Corcoran dave at aspect.UUCP
Thu Feb 14 13:28:37 AEST 1991


In article <5270 at awdprime.UUCP>, sanders at peyote.cactus.org (Tony Sanders) writes:
> But I can't do this:
> #ifdef NODEBUG
> #define DP(fmt,...) /* sigh */
> #else
> #define DP(fmt,...) fprintf(stderr,fmt,...);
> #endif
> 
> Any better ideas???

yet another posible m4 solution:
------------------8<----------------------------
define(DBP,`ifdef(`DEBUG',fprintf(stderr,$*))')

DBP("not printed %d",1); 
                      ^ unfortunately this "gets through" in both cases
define(`DEBUG')

DBP("printed %d%d%d",1,23,4);
DBP("so is this %s\n","string");
------------------8<----------------------------
-- 
David Corcoran		      -@@
uunet!aspect!dave	        ~
In a society where anything goes eventually everything will.



More information about the Comp.lang.c mailing list