Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!ginosko!husc6!spdcc!ftp!wjr From: wjr@ftp.COM (Bill Rust) Newsgroups: comp.lang.c Subject: Re: comma operator Message-ID: <692@ftp.COM> Date: 4 Aug 89 13:20:19 GMT References: <3287@ohstpy.mps.ohio-state.edu> <10453@claris.com> Reply-To: wjr@ftp.UUCP (Bill Rust) Organization: FTP Software, Inc. Lines: 25 |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. || Sorry, but you are mistaken. Quoting MSC Language Ref p 130 v5.1 (5.0 is identical), "The sequential-evaluation operator evaluates its two operands sequentially from left to right. There is a sequence point after the first operand. The result of the operation has the same value and type as the right operand. Each operand can be of any type. ... The sequential-evaluation operator, also called the "comma operator," is typically used to evaluate two or more expressions in contexts where only one expression is allowed." In short, MS has it right in their definition and, even though I have lots of experience with MSC, I find it hard to believe that this point doesn't work right. Bill Rust (wjr@ftp.com)