Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!mailrus!cornell!rochester!bbn!spdcc!ima!johnl From: johnl@ima.ima.isc.com (John R. Levine) Newsgroups: comp.lang.c Subject: Spiffy macros, was Unnecessary Macros Message-ID: <2727@ima.ima.isc.com> Date: 2 Oct 88 04:03:06 GMT References: <2089@ssc-vax.UUCP> <441@kaon.uchicago.edu> <1401@devsys.oakhill.UUCP> <1851@loral.UUCP> <956@l.cc.purdue.edu> <60009@ti-csl.CS Reply-To: johnl@ima.UUCP (John R. Levine) Organization: Not much Lines: 20 In article <60009@ti-csl.CSNET> gateley@mips.UUCP (John Gateley) writes: >In article <956@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes: >>What is needed is something like >>#define fc(x,y) (LOCAL tmp1,tmp2; tmp1=x; tmp2=y; fc(x,y)=tmp1*tmp1+tmp2*tmp2) > >The ONLY place I have heard of this being done for macros is in the >programming language Scheme: ... This sort of thing is quite simple in languages like Algol-68 and Bliss that treat expressions and statements the same, which means that you can put a declaration after pretty much any open paren. C not being one of those languages, you're out of luck. Maybe it would be nice if C were an expression language, and it would certainly make heavily macro-ized code easier to write, but it sure wouldn't be much like the C that we use now. -- John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869 { bbn | think | decvax | harvard | yale }!ima!johnl, Levine@YALE.something Rome fell, Babylon fell, Scarsdale will have its turn. -G. B. Shaw