"Honour Parens" Rule (was: Re: Should I convert FORTRAN code to C?)

Dr. T. Andrews tanner at ki4pv.uucp
Wed Jun 22 21:01:17 AEST 1988


In article <8130 at brl-smoke.ARPA>, gwyn at brl-smoke.ARPA (Doug Gwyn ) writes:
) ...  There was so much public objection to [unary plus], and so much
) clamor for parentheses forcing order of evaluation, ....
) parentheses order forcing was adopted instead.

While the unary plus was something of a stomach-turner, it seems that
the C group got confused into thinking it was the fortran group.  Would
it not have been better to codify the existing practice of stuffing
results into a variable named "tmp" if evaluation order was incredibly
important?

That's how users of "existing technology" compilers do it.  A clever
"-O" option might come by and eliminate the actual store to "tmp" if
it wasn't used later, but (considering the "as if actually done"
rule) couldn't re-arrange the expression further if it would be
unsafe.

It is probably a good idea for code which really cares to continue to
stuff the intermediate results into "tmp" for some years, until X3J11
compilers become moderately universal.
-- 
rutgers!bpa!cdin-1!cdis-1!ki4pv!tanner  (better than it looks!)
or...  {allegra codas killer decvax!ucf-cs}!ki4pv!tanner



More information about the Comp.lang.c mailing list