Question about regrouping of operands
Walter Murray
walter at hpcllz2.HP.COM
Thu May 12 03:25:10 AEST 1988
Under the proposed C standard, a conforming implementation is
no longer free to disregard parentheses in evaluating an
expression. At least, the results must be _as_if_ parentheses
were honored. The Rationale explains that this brings C into
accord with FORTRAN and other languages.
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.
Any thoughts? Am I interpreting the proposed standard correctly?
-- Walter Murray
More information about the Comp.std.c
mailing list