short circuit evaluation

chris at mimsy.UUCP chris at mimsy.UUCP
Thu Feb 12 14:34:27 AEST 1987


Concerning guarantees as to evalutions, in article <4391 at brl-adm.ARPA>
I wrote:
>	a = 0 * *p++ * *q++;
>
>Should we also say that the memory references in the third expression
>must occur? ... if so, must the compiler also do the multiply?  (It might
>overflow, which could be important.)

Bad example; the compiler is certainly allowed (0 * *p++) giving
0 giving * *q++ giving 0, which does not overflow.  Suppose instead
we have

	double *p, r;
	...
	r = *p++ / 1.0;

Must this do the divide, possibly causing (e.g.) a reserved operand
fault on a Vax due to an invalid float value at *p?
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.lang.c mailing list