Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!feeder.news.tin.it!spool.news.tin.it!not-for-mail From: "io_x" Newsgroups: comp.lang.java.programmer,comp.lang.c 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> Subject: Re: Arithmetic overflow checking Date: Tue, 12 Jul 2011 11:34:01 +0200 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original Lines: 26 Message-ID: <4e1c149b$0$15663$4fafbaef@reader2.news.tin.it> Organization: TIN.IT (http://www.tin.it) X-Comments: Please send technical notifications to newsmaster@tin.it NNTP-Posting-Host: 213.45.245.236 X-Trace: 1310463132 reader2.news.tin.it 15663 213.45.245.236:13813 X-Complaints-To: Please send abuse reports to abuse@retail.telecomitalia.it Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6106 comp.lang.c:8161 "tm" ha scritto nel messaggio news:e7b7711c-93d5-477e-a470-21386854ff6f@j15g2000yqf.googlegroups.com... On 12 Jul., 09:05, "io_x" wrote: > > I think there are two things: > > > 1. range checks (like value fits in [0,18]). > > 2. check if an 32-bit (or 8-bit, 16-bit, 64-bit, ...) > > computation overflows. > > the carry flag for 2^n word is ok for detect overflow >Yes, but it must be checked after every operation. >A hardware that triggers an interrupt, would save this >extra checks. #in how i see that #i like extra checks #if hardware 'triggers' an interrupt all you lost the prog #or lost the control of the program; and this is not good. #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