Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: Java puzzler Date: Sun, 15 May 2011 13:11:51 -0400 Organization: albasani.net Lines: 25 Message-ID: References: <4db69c13-878f-4806-adb2-a3c5adb1c48c@glegroupsg2000goo.googlegroups.com> <-8mdnSRPEIdA21HQnZ2dnUVZ_j2dnZ2d@earthlink.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.albasani.net V+B/lYn+bpJ8zBquYnU4LhXJhjo/B3yyt/o44FcbHQLFD5Dv4LY0/5zg62E2iRUuEdh1u5OqCxGqqzZQ9HyUHkUVsY+E1mPcDuzKRywnBW2btQ2IDdxlM36W7riqGPSy NNTP-Posting-Date: Sun, 15 May 2011 17:11:52 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="R8lWV+MvK1Eg1e89xg0yrizwLNf+RQZWPfx/sPfMzwiHAX/tuQrkivfD12j+ZJGEFYyFQVKkK0oKr4KFQxwMAwuHb30uQMFN0EeFi19Izo4hMfxE+Tgk7U5t1LbwafIx"; mail-complaints-to="abuse@albasani.net" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 In-Reply-To: Cancel-Lock: sha1:fHwaITt1qCPVQALHYwli4mqj48U= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4129 On 05/15/2011 10:35 AM, Patricia Shanahan wrote: > On 5/15/2011 3:16 AM, Tom Anderson wrote: > ... >> Fair enough. I suppose my position is that this hardware ability has to >> be used in the service of some solidly well-defined software semantics. >> Throwing exceptions at random from arithmetic expressions is not what i >> think of as solidly well-defined. > ... > > I agree. Throwing an exception if *any* expression evaluation results in > a value that is not representable in the type of the expression would > not be "at random". It would be well-defined through the existing > specification of how to evaluate arithmetic expressions. > > Making the throw dependent on whether and how the expression had been > optimized would make it unpredictable, and varying from compiler version > to compiler version, a very bad thing. In the presence of runtime optimization such as done by HotSpot, it could result in different results within execution of the same loop, unpredictably. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg