Order of evaluation

Doug Pardee doug at terak.UUCP
Sat Aug 31 04:01:29 AEST 1985


> >OK, I understand that order of evaluation is not guaranteed.  I assume that
> >was done to make compilers easier to write.  Is there any other reason?  Does
> >it really make compilers easier to write?
> 
> Also, allowing the compiler to reorder the expression within certain
> limits allows it to do some optimizations. Most code is not affected by
> order of evaluation, and C does allow an order to be forced (by assigning
> an explicit temporary), so I think this is very reasonable.

What drives me up a wall is that C does *not* allow an order to be
forced by using parentheses!  The compiler is at liberty to ignore
parens which group operators of the same precedence.  <e.g. a+(b+c)>

I don't think much of the notion of having to store intermediate results
just to get the correct answer.
-- 
Doug Pardee -- CalComp -- {seismo!noao,decvax!noao,ihnp4}!terak!doug



More information about the Comp.lang.c mailing list