Evaluation of if's

Dale Worley worley at compass.com
Thu Jun 6 00:26:46 AEST 1991


In article <1991Jun5.014758.10616 at wdl1.wdl.loral.com> bard at cutter.ssd.loral.com (J H Woodyatt) writes:
   |> >		if ( (i=1) == (i=2) )
   |> >Is somebody wrong or is the behavior undefined?
   |> Of course it's undefined.  (It contains two side effects not
   |> separated by a sequence point.)

   Is this really undefined by ANSI? I suppose we need someone with
   the STANDARD to resolve this.

ANSI C Standard, Dec. 88 draft, sec. 3.3, p. 39, l. 5:

    Between the previous and next sequence point an object shall have its
    stored value modified at most once by the evaluation of an expression.

Why don't people out there just go *buy* a copy of the standard?  It
would resolve a lot of these questions!

Dale Worley		Compass, Inc.			worley at compass.com
--
When asked how much money is enough, Nelson Rockefeller replied:
"A little bit more."



More information about the Comp.lang.c mailing list