Article View: comp.std.c
Article #5045Question about regrouping of operands
From: Walter Murray
Date: Wed, 11 May 1988 17:25
Date: Wed, 11 May 1988 17:25
18 lines
1267 bytes
1267 bytes
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
Technical Details
Message-ID:
<16490001@hpcllz2.HP.COM>Path:
arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcupt1!hpcuhb!hpcllla!hpcllz2!walterShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!lll-winken!lll-tis!ames!ucsd!sdcsvax!ucsdhub!hp-sdd!hplabs!hpda!hpcupt1!hpcuhb!hpcllla!hpcllz2!walter From: walter@hpcllz2.HP.COM (Walter Murray) Newsgroups: comp.std.c Subject: Question about regrouping of operands Message-ID: <16490001@hpcllz2.HP.COM> Date: 11 May 88 17:25:10 GMT Organization: HP NSG/ISD Computer Language Lab Lines: 17