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

Steven Ryan smryan at garth.UUCP
Sat Jun 25 08:37:50 AEST 1988


>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.

This issue is messier than it appears on the surface. In doing common
subexpression a compiler may skip over the store and replace tmp with the right
hand side.

Parenthesised are used to override precedence as well to indicate associating.
Some compilers will ignore the parenthesis and reassociate the expression as
the see best (keep those pipes busy).

In some case the users expect the compiler to recognise tmp is just a
shorthand for a longer expression and expect the compiler to use the
right hand side. (In some (fortran) loops, the subscript expression is
computed in a separate assignment with the same loop, and then used as
a subscript. A vectoriser which can't patch this up is a walking wounded.)

It would preferable to use some kind special bracket or special operator
form in order to tell the compiler don't-you-dare-touch-this.



More information about the Comp.lang.c mailing list