Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!emory!att!att!drutx!druwy!kvt From: kvt@druwy.ATT.COM (TranKV) Newsgroups: comp.lang.c++ Subject: Re: #define Message-ID: <8866@drutx.ATT.COM> Date: 30 May 91 19:14:59 GMT References: Sender: news@drutx.ATT.COM Reply-To: kvt@druwy.ATT.COM (TranKV) Distribution: comp Organization: AT&T, Denver, CO Lines: 21 In article dgorton@jupiter.newcastle.edu.au (David Mark Gorton) writes: >Is there a simple way to have #defines with a variable length parameter list? Yes. And you had it without knowing it: >#define DEBUG_PRINT(a) if (debug) cout << a endl With the above, you can do: DEBUG_PRINT(a); DEBUG_PRINT(a << b); DEBUG_PRINT(a << b << c); DEBUG_PRINT(a << b << c << ...); I think you can do this because cpp doesn't recognize '<<' as special token. It treats the whole thing in parens as a single parameter. BTW, at least in cfront 2.X, endl is predefined as '\n'. Kim Tran AT&T Bell Labs kvt@druwy.att.com