Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!decwrl!labrea!csli!gandalf From: gandalf@csli.STANFORD.EDU (Juergen Wagner) Newsgroups: comp.unix.wizards Subject: Re: #defines with variable # arguments Message-ID: <3913@csli.STANFORD.EDU> Date: 16 May 88 19:47:49 GMT References: <2855@phoenix.Princeton.EDU+ <2633@tekcrl.TEK.COM> <979@cresswell.quintus.UUCP> <980@cresswell.quintus.UUCP> <2918@phoenix.Princeton.EDU> Reply-To: gandalf@csli.UUCP (Juergen Wagner) Organization: Center for the Study of Language and Information, Stanford U. Lines: 19 To put my five cents into this discussion: I prefer to use a simple macro like # ifdef DEBUG # define DBG do_debug # else !DEBUG # define DBG if (0) do_debug # endif DEBUG This will expand the lines of the form DBG(flag, "sorry, the flag is %d", flag); into a line which calls my function do_debug only if DEBUG is set. Of course, do_debug is a function with a variable number of arguments. I know, there are applications where this is not suffifient, and I know one can use double parens, ... This posting is a comment and not a dogma! -- Juergen "Gandalf" Wagner, gandalf@csli.stanford.edu Center for the Study of Language and Information (CSLI), Stanford CA