Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joshua Cranmer Newsgroups: comp.lang.java.programmer Subject: Re: Arithmetic overflow checking Date: Thu, 21 Jul 2011 12:00:17 -0700 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <1f9c17dltrhlmhifuigoa914477r4rg1e1@4ax.com> <09fe171s46ilvq9qmn254dctunm6noh0ps@4ax.com> <4e262731$0$314$14726298@news.sunsite.dk> <4e26300b$0$309$14726298@news.sunsite.dk> <4e26b4ed$0$2501$db0fefd9@news.zen.co.uk> <4e28097f$0$2533$da0feed9@news.zen.co.uk> <7a23c9d2-508f-4dbd-af91-8cdf2a9764e1@p29g2000pre.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 21 Jul 2011 19:00:23 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Q8HyEFb0j2lB0WC1MU3ArQ"; logging-data="4472"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19eKElXp10ph2tXSa14BhKv6Nd0ZMWV5eY=" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: <7a23c9d2-508f-4dbd-af91-8cdf2a9764e1@p29g2000pre.googlegroups.com> Cancel-Lock: sha1:IYCYZie8rSdfZC7DBSarF4GYfMs= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6346 On 7/21/2011 9:03 AM, lewbloch wrote: > On Jul 21, 8:38 am, Andreas Leitgeb > wrote: >> lewbloch wrote: >>> And what about the suggestion to write a CheckedInteger type that does >>> what you need? >> >> That has been answered already, but you may have missed it, or maybe >> blocked the one who answered this seriously and (imho) agreeably. >> >> Due to Java's lack of operator overloading, doing Math with >> non-primitive types is just painful. >> > > I saw that suggestion, but painful != impossible. And how freaking > "painful" is it to read method calls anyway? "Painful" is digging > ditches, tarring roofs, smelting steel, even working the floor at your > neighborhood mall anchor store. All a programmer has to do is read > method calls and do some typing. People need to get over themselves. No, painful is realizing that your attempts to make something work all fail because you need to put together two libraries that need different versions of the same library. Next step, writing a script to extract the necessary symbols from library v2 but not in v1, dump those out as assembly, and copy them over. I'd love to have the pain that comes with "I need to write out `+' as `plus'" right now. -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth