short circuit evaluation

Henry Spencer henry at utzoo.UUCP
Tue Feb 3 13:49:26 AEST 1987


> I did ask Dennis about [short-circuiting of multiplies with a 0 operand]
> ... His reply, as I recall it, was
> roughly "I think it is defensible in principle, but it caused so many
> complaints that newer versions of the compiler don't do it".

I should add that X3J11 has come down quite firmly on the pragmatic side
of this issue.  With the obvious exceptions of && and friends, which are
explicitly short-circuited, the compiler is not permitted to leave out
side effects of expressions.  (Personally, as you might have gathered from
my earlier posting, I like the purist approach to this one, but I realize
how much havoc it could cause...)
-- 
Legalize			Henry Spencer @ U of Toronto Zoology
freedom!			{allegra,ihnp4,decvax,pyramid}!utzoo!henry



More information about the Comp.lang.c mailing list