Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!hp4nl!xelion!gerrit From: gerrit@xelion.UUCP (Gerrit Brouwer) Newsgroups: comp.lang.c Subject: Re: Passing Variable Numbers of Arguments Message-ID: <827@xelion.UUCP> Date: 13 Feb 91 13:39:29 GMT References: <5196@media-lab.MEDIA.MIT.EDU> <1991Feb11.225815.5875@zoo.toronto.edu> <5270@awdprime.UUCP> Organization: XELION bv, Delft, The Netherlands Lines: 33 sanders@peyote.cactus.org (Tony Sanders) writes: >In article <1991Feb11.225815.5875@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >So I do this: >#ifdef NODEBUG >#define DP(level) if (0) /* I hope the optimizer gets rid of this */ >#else >extern DebugPrint(char *,...); >#define DP(level) if (debug&level) DebugPrint >#endif >DP(1)("this fmt string %s\n","sucks rocks"); >Any better ideas??? I do this: #ifdef DO_DEBUG #define PRINT(ARGUMENTS) DebugPrint ARGUMENTS #else #define PRINT(ARGUMENTS) DebugPrint ARGUMENTS #endif DO_DEBUG PRINT(("any number of arguments allowed: %s %d %f\n", "string", 4, 3.14)); -- Gerrit Brouwer domain : gerrit@xelion.UUCP XELION BV uucp : uunet!mcsun!hp4nl!xelion!gerrit Postbus 88 phone : +31 15 622121 2600 AB Delft, The Netherlands fax : +31 15 621760