comma operator
Andrew Koenig
ark at alice.UUCP
Sat Aug 5 03:36:24 AEST 1989
In article <3287 at ohstpy.mps.ohio-state.edu>, SMITHJ at ohstpy.mps.ohio-state.edu writes:
> Maybe I'm mistaken, but I'm sure that all the documentation I've read warns
> that the *comma* operator ----does not----- guarantee evaluation in any order.
> Specifically, the Microsoft 5.0 manual mentions this.
You're mistaken.
K&R, second edition, page 209:
A pair of expressions separated by a comma is evaluated
left-to-right, and the value of the left expression is
discarded. The type and value of the result are the type
and value of the right operand. All side effects from the
evaluation of the left operand are completed before
beginning evaluation of the right operand.
Perhaps you should check your Microsoft manual again; if it really
says that evaluation order of comma is undefined, I suggest a letter
to Microsoft [and hope their compiler doesn't get it wrong too!]
--
--Andrew Koenig
ark at europa.att.com
More information about the Comp.lang.c
mailing list