comma operator
Kevin Watts
kevin at claris.com
Fri Aug 4 21:05:05 AEST 1989
>From article <3287 at ohstpy.mps.ohio-state.edu>, by SMITHJ at ohstpy.mps.ohio-state.edu:
> In article <1351 at cbnewsl.ATT.COM>, mpl at 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 at claris.com ! patently absurd, in which case they're not mine either.
More information about the Comp.lang.c
mailing list