Path: utzoo!utgpu!watmath!att!dptg!rutgers!bellcore!decvax!ima!cfisun!lakart!dg From: dg@lakart.UUCP (David Goodenough) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <648@lakart.UUCP> Date: 7 Aug 89 19:42:59 GMT References: <3287@ohstpy.mps.ohio-state.edu> Organization: Lakart Corporation, Newton, MA Lines: 33 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. In that case, MS C 5.0 is broken. if I say: int a; a = (blurfl(), stug(), zorch()); and get _ANY_ other order of evaluation than blurfl() first, then stug(), and finally zorch(), then I'm gonna deep six that compiler. The confusion _MAY_ be arising due to the overloading of the comma operator: as a separator in expressions it _DOES_ guarantee l->r order of eval, when separating arguments to a function - as in: a = zap ( blurfl(), stug(), zorch() ); it definitely guarantees _NOTHING_. -- dg@lakart.UUCP - David Goodenough +---+ IHS | +-+-+ ....... !harvard!xait!lakart!dg +-+-+ | AKA: dg%lakart.uucp@xait.xerox.com +---+