Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!overload!dillon From: dillon@overload.Berkeley.CA.US (Matthew Dillon) Newsgroups: comp.sys.amiga.programmer Subject: Re: Compiler code (was a flame fest) (now a lesser flame fest) Message-ID: Date: 26 Apr 91 21:42:39 GMT References: <1991Apr17.180342.25312@engin.umich.edu> Organization: Not an Organization Lines: 41 In article mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) writes: >In article dillon@overload.Berkeley.CA.US (Matthew Dillon) writes: > The ONLY three C operators that guarentee evaluation order are &&, ||, > and the comma as an operator (when not used in a subroutine call, where > it doesn't act as the comma operator). > >Don't forget ?:. It is (they are?) a trinary operator, and guarantees I *knew* I forgot something! But people get the point... > ++a + ++a > > If a is 1, the result can be 2 + 2 or 2 + 3 or 3 + 2 and at the end 'a' > can be either 3 or 4 depending on how the compiler was designed. > >Actually, ANSI says the result is "undefined". Normally, you'll get >one of the things you mentioned or 3 + 3, but there are oddball >compilers out there that completely unexpected things. > >The bottom line is still the same - you don't want to do this kind of thing. > > -- >Tried to amend my carnivorous habits Mike Meyer >Made it nearly seventy days mwm@pa.dec.com >Loosing weight without speed decwrl!mwm >Eatin' sunflower seeds -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA