Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uwm.edu!wuarchive!sdd.hp.com!samsung!olivea!mintaka!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!harrier.ukc.ac.uk!mr3 From: mr3@ukc.ac.uk (M.Rizzo) Newsgroups: comp.sys.amiga.programmer Subject: Re: Compiler code (was a flame fest) Message-ID: <7370@harrier.ukc.ac.uk> Date: 20 Apr 91 10:20:01 GMT References: <1991Apr16.183638.12808@cs.cornell.edu> <1991Apr17.180342.25312@engin.umich.edu> <1991Apr18.122054.13695@athena.mit.edu> Reply-To: mr3@ukc.ac.uk (M.Rizzo) Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 35 In article <1991Apr18.122054.13695@athena.mit.edu> amgreene@athena.mit.edu (Andrew Marc Greene) writes: >In article <1991Apr17.180342.25312@engin.umich.edu> milamber@caen.engin.umich.edu (Daryl Cantrell) writes: >> ...However, there >> is no way to know whether a * b or c * d will be evaluated first ... >> >> ... Personally, I would find such a definition about as useful as computed >>gotos... (Not at all) > >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. What you show in the above example is true - but I can't see why you consider it to be useful. In fact the example you give is highly redundant as you don't really want to change the value of n, yet you are incrementing and decrementing it (not very useful). I know its only meant to be an example but how about (n+1) * n to give 20 and (n-1) * n to give 12 :-) The point that I am trying to make is that using the increment/decrement operators as mentioned above is very ugly and there is always a neater way of expressing one's intentions. Michael Rizzo