Prev: inheriting a main method
Next: Adding int to a float
From: Dave Searles on 18 Sep 2009 13:38 Arne Vajh�j wrote: > Dave Searles wrote: >> markspace wrote: >>> rossum wrote: >>>> >>>> I am talking about local variables, not member variables. >>> >>> I was just re-reading in Java Concurrency in Practice that some >>> modifiers are important, because the JIT/javac will hoist variables >>> out of loops: >>> >>> volatile boolean done = false; >>> >>> while(!done) >>> processData(); >>> >>> "done" will be hoist out of the loop with out the volatile modifier, >>> resulting in an infinite loop. >> >> Since that loop cannot set "done" the loop is infinite anyway (barring >> an uncaught exception or System.exit() call beneath processData() >> somewhere). > > Nothing is preventing processData from setting done to true. It's a local variable. Either processData is not in an inner class in that method, and therefore cannot see it, or it is in an inner class in that method, and therefore cannot modify it (local variables have to be "final" to be accessible to inner classes).
From: Dave Searles on 18 Sep 2009 13:40 Arne Vajh�j wrote: > Dave Searles wrote: >> Here is the original context: >> >>> rossum wrote: >>>> >>>> I am talking about local variables, not member variables. >>> >> The discussion is clearly about local variables. > > It is clearly not Rossum explicitly said that it was. Are you calling Rossum a liar?
From: rossum on 18 Sep 2009 16:58 On Fri, 18 Sep 2009 13:40:02 -0400, Dave Searles <searles(a)hoombah.nurt.bt.uk> wrote: >Arne Vajhøj wrote: >> Dave Searles wrote: >>> Here is the original context: >>> >>>> rossum wrote: >>>>> >>>>> I am talking about local variables, not member variables. >>>> >>> The discussion is clearly about local variables. >> >> It is clearly not > >Rossum explicitly said that it was. Are you calling Rossum a liar? "Liar" is unparliamentary language, and will get you censured by the speaker. The correct term is "terminological inexatitude". My OP was indeed about local variables, however this subthread of the discussion seems to have wandered further afield. rossum
From: Dave Searles on 19 Sep 2009 08:54 rossum wrote: > On Fri, 18 Sep 2009 13:40:02 -0400, Dave Searles > <searles(a)hoombah.nurt.bt.uk> wrote: > >> Arne Vajhøj wrote: >>> Dave Searles wrote: >>>> Here is the original context: >>>> >>>>> rossum wrote: >>>>>> I am talking about local variables, not member variables. >>>> The discussion is clearly about local variables. >>> It is clearly not >> Rossum explicitly said that it was. Are you calling Rossum a liar? > [attack] Er ... you're the one I was defending.
From: Arne Vajhøj on 20 Sep 2009 19:26
Dave Searles wrote: > Arne Vajh�j wrote: >> Dave Searles wrote: >>> Scott A. Hightower wrote: >>>> rossum wrote: >>>>> >>>>> I am talking about local variables, not member variables. >>>> I was just re-reading in Java Concurrency in Practice that some >>>> modifiers are important, because the JIT/javac will hoist variables >>>> out of loops: >>>> >>>> volatile boolean done = false; >>>> >>>> while(!done) >>>> processData(); >>>> >>> The discussion is clearly about local variables. >> >> It is clearly not > > Rossum explicitly said that it was. Are you calling Rossum a liar? No you are. Rossum did not post about volatile. Scott did. Rossum did not even reply to the topic of volatile until he replied to you. Rossum knows Java, so he will never claim that a volatile variable is a local variable. Arne |