Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!lll-winken!claris!kevin From: kevin@claris.com (Kevin Watts) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <10453@claris.com> Date: 4 Aug 89 11:05:05 GMT References: <3287@ohstpy.mps.ohio-state.edu> Organization: Claris Corporation, Santa Clara CA Lines: 31 From article <3287@ohstpy.mps.ohio-state.edu>, by SMITHJ@ohstpy.mps.ohio-state.edu: > In article <1351@cbnewsl.ATT.COM>, mpl@cbnewsl.ATT.COM (michael.p.lindner) writes: >> ***FLAME ON!*** >> Sigh. RTFM! The comma operator guarantees left to right evaluation, >> and fprintf(...) and exit(...) ARE valid expressions in C. >> sputter sputter - flame off. > > 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. > Hmm, I'll have to check my copy when I get home. If you're right, it's broken. I quote from "Standard C", p.88, by P.J. Plauger & Jim Brodie (the secretary and chairman of X3J11): You write X,Y to first evaluate X as a side-effects context expression and then to evaluate Y. There is a sequence point between the evaluation of the two operands. I hope that settles the matter for everyone. The order IS guaranteed! This book appears to be an excellent reference for the ANSII C language definition. I just got it yesterday. $7.95 from Microsoft Press. And now I know the name of the ISO C committee: JTC1 SC22 WG14 Makes X3J11 seem easy to remember, doesn't it? -- Kevin Watts ! Any opinions expressed here are my own, and are not Claris Corporation ! neccessarily shared by anyone else. Unless they are kevin@claris.com ! patently absurd, in which case they're not mine either.