Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!dptg!ulysses!andante!alice!ark From: ark@alice.UUCP (Andrew Koenig) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <9741@alice.UUCP> Date: 4 Aug 89 17:36:24 GMT References: <10099@mpx2.mpx.com> <93@microsoft.UUCP> <10100@mpx2.mpx.com> <3287@ohstpy.mps.ohio-state.edu> Organization: AT&T Bell Laboratories, Liberty Corner NJ Lines: 23 In article <3287@ohstpy.mps.ohio-state.edu>, SMITHJ@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@europa.att.com