Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: "Nasser M. Abbasi" Newsgroups: comp.lang.java.programmer Subject: Re: Arithmetic overflow checking Date: Fri, 08 Jul 2011 21:57:56 -0700 Organization: Aioe.org NNTP Server Lines: 31 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> Reply-To: nma@12000.org NNTP-Posting-Host: TUXTYYqX1yG7hs3zxUg7ng.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6009 On 7/8/2011 9:27 PM, Nasser M. Abbasi wrote: > On 7/6/2011 8:35 AM, rop rop wrote: >> Hi, >> >> If I want to have arithmetic-overflow checking in all parts of an >> application, >> what is the most practical, simple, efficient way to achieve this? >> Id like to clutter the code as little a possible... >> Is there any way to instruct the JVM to include it? > > What? You mean you guys do not have this in Java?? > > It is a compiler option in Ada GNAT/gcc compiler: > > http://gcc.gnu.org/onlinedocs/gcc-4.3.5/gnat_ugn_unw/Run_002dTime-Checks.html > > "`-gnato' > Enables overflow checking for integer operations. This causes > GNAT to generate slower and larger executable programs by adding > code to check for overflow (resulting in raising Constraint_Error as > required by standard Ada semantics)." > > This is something that should be there in Java. > > --Nasser sorry, I see now this is mentioned in this thread. I replied before reading the full thread. --Nasser