Question about regrouping of operands
The Invisible Man
jsb at actnyc.UUCP
Fri May 13 22:30:40 AEST 1988
In article <16490001 at hpcllz2.HP.COM> walter at hpcllz2.HP.COM (Walter Murray) writes:
)Actually, as I read the proposed standard, ANSI C would seem to
)be _more_strict_ than FORTRAN. For example, FORTRAN requires the
)expression X+Y+Z to be _interpreted_ as (X+Y)+Z, but explicitly
)permits it to be _evaluated_ as X+(Y+Z), even though the results could
)be different. The proposed C standard seems to require that, in
)the absence of parentheses, both the interpretation and the
)evaluation be done left-to-right. Thus, in C, the expression
)X+Y+Z would have to be evaluated as (X+Y)+Z.
In the absence of parens, X+Y+Z can be evaluated in any order, including
(Z+X)+Y. Furthermore, if the results are the same, (X+Y)+Z can be
evaluated as X+(Y+Z). (unless they changed this at the April meeting :-)
--
"Notitiae gratia notitiarum"
jim (uunet!actnyc!jsb)
More information about the Comp.std.c
mailing list