Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!news-out.readnews.com!transit3.readnews.com!postnews.google.com!gh5g2000vbb.googlegroups.com!not-for-mail From: Malcolm McLean Newsgroups: comp.lang.java.programmer,comp.lang.c Subject: Re: Arithmetic overflow checking Date: Tue, 12 Jul 2011 03:04:30 -0700 (PDT) Organization: http://groups.google.com Lines: 14 Message-ID: <26b58d46-d638-4a6c-bd5e-97b809ab5907@gh5g2000vbb.googlegroups.com> References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <9LWdnZH2hdfmyYvTnZ2dnUVZ_vidnZ2d@posted.palinacquisition> <3797038f-22d1-40b2-8c12-60db5a0976b8@t5g2000yqj.googlegroups.com> <4e1bf1bc$0$15671$4fafbaef@reader2.news.tin.it> <4e1c149b$0$15663$4fafbaef@reader2.news.tin.it> NNTP-Posting-Host: 132.77.4.129 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1310465184 5030 127.0.0.1 (12 Jul 2011 10:06:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 12 Jul 2011 10:06:24 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: gh5g2000vbb.googlegroups.com; posting-host=132.77.4.129; posting-account=Dz2zqgkAAADlK5MFu78bw3ab-BRFV4Qn User-Agent: G2/1.0 X-HTTP-Via: 1.1 wisweb2-out (NetCache NetApp/6.0.6) X-Google-Web-Client: true X-Google-Header-Order: HCUALESRFV X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6109 comp.lang.c:8162 On Jul 12, 12:34=A0pm, "io_x" wrote: > > #but the checks can be done one time for all, in the input > #data for the function for impose arg has to be in a > #numeric range good for not overflow > It's too fiddly, at least in C. You can overflow check if you really have to, but it's not a viable strategy to insert checking code for every single arithmetical operation that could conceivably overflow. You need a different language for that. -- Check out MiniBasic http://www.malcolmmclean.site11.com/www