[comp.lang.c] Spiffy macros, was Unnecessary Macros

johnl@ima.ima.isc.com (John R. Levine) (10/02/88)

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