[net.lang.c] slight bug in call-by-name expression

rgenter@BBN-LABS-B.ARPA (Rick Genter) (07/03/86)

In article <2225@ucmp-cs.UUCP> chris@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@labs-b.bbn.COM  (Internet new)	Cambridge, MA   02238
rgenter@bbn-labs-b.ARPA (Internet old)	linus!rgenter%BBN-LABS-B.ARPA (UUCP)