Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.42!gegeweb.eu!nntpfeed.proxad.net!feeder2-2.proxad.net!proxad.net!feeder1-2.proxad.net!74.125.46.80.MISMATCH!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: jgk@panix.com (Joe keane) Newsgroups: comp.compilers Subject: Re: Looking for volunteers for XL Date: Tue, 13 Dec 2011 00:08:53 +0000 (UTC) Organization: Public Access Networks Corp. Lines: 48 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <11-12-017@comp.compilers> References: <11-11-048@comp.compilers> <11-11-061@comp.compilers> <11-11-064@comp.compilers> <11-12-002@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1323738928 66618 64.57.183.58 (13 Dec 2011 01:15:28 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Tue, 13 Dec 2011 01:15:28 +0000 (UTC) Keywords: design, syntax,macros Posted-Date: 12 Dec 2011 20:15:28 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: x330-a1.tempe.blueboxinc.net comp.compilers:389 Kaz Kylheku wrote: >For one thing, any syntactic unit that contains declarations cannot be >an expression that returns a value. Macros that need to generate >complex code that requires hidden variables automatically have a >difficulty in returning a value in a function-call-like way, because >only expressions do that. That is valid, but it's not not-difficulty work-around-ed. #2. Don't use function-like macros. Make the result one of the parameters (unless it is really simple, then some day in the future your 'really simple' macro is not so really simple). e.g. #define GET_FORDO_BIT(FOP) \ ... int f(int x) { ... if (GETFORDO_BIT(fop)) { ... } ... } versus #define GET_FORDO_BIT(FOP, FOB) \ ... int f(int x) { ... GET_FORDO_BIT(fop, fob); if (fob) { ... } ... } How hard is that?