still problems with ?:

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jun 17 07:25:33 AEST 1989


In article <568 at lakart.UUCP> dg at lakart.UUCP (David Goodenough) writes:
>gwyn at smoke.BRL.MIL (Doug Gwyn) sez:
>> In article <4675 at alvin.mcnc.org> spl at mcnc.org.UUCP (Steve Lamont) writes:
>>>>((a = *p++) && e2 ) || (!a && e3)
>> There has never been any ambiguity about the correct sequence of
>> operations during evaluation of such an expression (except when
>> `p' is used in `e2' or `e3').
>... Of course if your going to tell me that the standard
>says that the a = *p and the p++ may happen at different times (i.e. the
>p++ after e2), then I'm going to say the standard is broken.

No, the Standard specifies that there is a sequence point after the
evaluation of the first operand of && (also ||).

However, we were discussing pre-Standard C and what were universally
understood to be the rules back then versus what was considered not
clearly specified.  In K&R1, the sequencing of side effects was not
clearly specified, and consequently some C implementations deferred
the side effects in surprising ways, which is the point of my
parenthetical comment above.  X3J11 came up with the concept of
"sequence points" to permit accurate constraint specification in
this area.



More information about the Comp.lang.c mailing list