Path: utzoo!attcan!uunet!lll-winken!lll-lcc!unisoft!mtxinu!rtech!llama!daveb From: daveb@llama.rtech.UUCP (It takes a clear mind to make it) Newsgroups: comp.unix.wizards Subject: Re: #defines with variable # arguments Message-ID: <2097@rtech.UUCP> Date: 17 May 88 04:49:09 GMT References: <2855@phoenix.Princeton.EDU> <52949@sun.uucp> <152@hropus.UUCP> Sender: news@rtech.UUCP Reply-To: daveb@rtech.UUCP (It takes a clear mind to make it) Distribution: na Organization: Relational Technology, Inc. Alameda, CA Lines: 20 In article <152@hropus.UUCP> jgy@hropus.UUCP (John Young) writes: >> > Are there any versions of cpp which allow one to define macros which >> > accept variable numbers of arguments? >I think that some of the AT&T CPLU compilers(cpp's) allow this, >you just overdeclare the arguments: > >#define Dprintf(a,b,c,d,e,f,g,h,i) {if (Debug) printf(a,b,c,d,e,f,g,h,i);} > >and compile. You will get a warning about each source line which uses >the wrong number of arguments. If you do #define Dprintf if(Debug) printf you don't get any warnings; you do get possible dangling else problems. This has rarely been a problem on the occasions I've usedthis technique. -dB {amdahl, cpsc6a, mtxinu, sun, hoptoad}!rtech!daveb daveb@rtech.uucp