slight bug in call-by-name expression
Rick Genter
rgenter at BBN-LABS-B.ARPA
Fri Jul 4 00:01:00 AEST 1986
In article <2225 at ucmp-cs.UUCP> chris at ucmp-cs.uucp (Chris Torek) writes:
> /*
> * Incidentally, `swap' can be passed a thunk that names an expression;
> * here is what a call-by-name compiler might generate for `a+b':
> *
> * int *
> * addr_aplusb()
> * {
> * int t = a + b;
> *
> * return (&t);
> * }
> */
Uh, not quite. I think you actually meant something like:
int *
addr_aplusb ()
{
/* either t is static, or we are
in big trouble */
static int t = a + b;
return (& t);
}
--------
Rick Genter BBN Laboratories Inc.
(617) 497-3848 10 Moulton St. 6/512
rgenter at labs-b.bbn.COM (Internet new) Cambridge, MA 02238
rgenter at bbn-labs-b.ARPA (Internet old) linus!rgenter%BBN-LABS-B.ARPA (UUCP)
More information about the Comp.lang.c
mailing list