Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!lll-winken!unixhub!ditka!comeau From: comeau@ditka.Chicago.COM (Greg Comeau) Newsgroups: comp.sys.amiga.programmer Subject: Re: Side Effects == Rattlesnakes -- watch out for them Re: Compiler code (was a flame fest) (now a lesser flame fest) Message-ID: <38214@ditka.Chicago.COM> Date: 4 May 91 23:27:36 GMT References: <24503@well.sf.ca.us> <1991May4.061257.14959@zorch.SF-Bay.ORG> Sender: comeau@ditka.Chicago.COM (Greg Comeau) Reply-To: comeau@csanta.attmail.com (Greg Comeau) Organization: Comeau Computing Lines: 28 In article <1991May4.061257.14959@zorch.SF-Bay.ORG> xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) writes: >> jsmoller@jsmami.UUCP (Jesper Steen Moller) writes: >>> Oh, by the way: func(a++) Is "a" increased before or after the >>> function call. I think I once read in K&R that it was undefined, but >>> I might be mistaken. >> Nope, not undefined. a is evaluated, and passed to the function when >> it is called, and then is incremented. This *is* guaranteed. >Which still leaves the wide open "gotcha" that if func() modifies "a" >by a side effect during execution, all bets are off as to whether the >pre-call or the post-call value is what gets incremented and stored >back in "a". Not quite wide open in this situation. I believe a message passed through here a few days ago which correctly stated that although evaluation orders are still not dictated, that there is a sequence point generated at function call time. >Best rule for C side effects -- don't. ... although that rule is most always a good one! - Greg -- Comeau Computing, 91-34 120th Street, Richmond Hill, NY, 11418 Producers of Comeau C++ 2.1 Here:attmail.com!csanta!comeau / BIX:comeau / CIS:72331,3421 Voice:718-945-0009 / Fax:718-441-2310