Newsgroups: comp.sys.amiga.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!csn!kessner!david From: david@kessner.denver.co.us (David Kessner) Subject: Re: Compiler code (was a flame fest) Message-ID: <1991Apr18.212939.3461@kessner.denver.co.us> Organization: Kessner, Inc. References: <1991Apr16.183638.12808@cs.cornell.edu> <1991Apr17.180342.25312@engin.umich.edu> <1991Apr18.122054.13695@athena.mit.edu> Date: Thu, 18 Apr 91 21:29:39 GMT In article <1991Apr18.122054.13695@athena.mit.edu> amgreene@athena.mit.edu (Andrew Marc Greene) writes: >Oh, but it *is* useful! What is the value of the following code >fragment? > > int n = 4; > > (++n) * (--n); > >If the first operand to * is treated first, the answer is 20. If the >second operand to * is treated first, the answer is 12. > >-- Andrew | .sigs are for people with bandwidth to burn Humph. The answer is 16. The pre-operators (--n ++n) mean "evaluate these expressions before anything else". So the above statement is the same as: n=n+1; n=n-1; ?? = n * n; Try it. -- David Kessner - david@kessner.denver.co.us | do { 1135 Fairfax, Denver CO 80220 (303) 377-1801 (p.m.) | . . . If you cant flame MS-DOS, who can you flame? | } while( jones);