From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.200.202 with SMTP id ex10mr8271774qab.8.1371473726963; Mon, 17 Jun 2013 05:55:26 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.49.6.201 with SMTP id d9mr347832qea.12.1371473726906; Mon, 17 Jun 2013 05:55:26 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!mx05.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!bw2no1976974qab.0!news-out.google.com!y6ni2993qax.0!nntp.google.com!j2no485214qak.0!postnews.google.com!q8g2000vbl.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 Jun 2013 05:55:26 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: q8g2000vbl.googlegroups.com; posting-host=105.236.184.29; posting-account=p-xPhAkAAADjHQWEO7sFME2XBdF1P_2H NNTP-Posting-Host: 105.236.184.29 References: <7f33982d-3bcf-452e-a3b3-3a0a28505ff1@x20g2000vbe.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1,gzip(gfe) Message-ID: Subject: Re: Range check for type 'Integer' From: Peter Brooks Injection-Date: Mon, 17 Jun 2013 12:55:26 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2598 Xref: news.eternal-september.org comp.lang.ada:15776 Date: 2013-06-17T05:55:26-07:00 List-Id: On Jun 17, 1:23=A0pm, Simon Clubley wrote: > On 2013-06-17, Peter Brooks wrote: > > > > > So the 'Integer' has rolled over to negative and then rolled back to 0 > > - but with no run-time error. > > > Why is there no range check error on type Integer? > > Because GNAT does not enable integer overflow detection by default; this > is a design decision which was a major mistake. You need to compile your > program using the switch to enable integer overflow detection. > > BTW, this same program was posted a few days ago with the same problem > description. Is this a problem posed as part of a class you are taking ? > Thank you for the answer. Yes, in a way, I am taking a class. I last looked at Ada about thirty years ago, and I'm trying to get myself back up to speed because I've a problem to solve. I couldn't find any books on Kindle - all the Ada books are hard copy and old. So I'm going through all the on-line tutorials that I can find, particularly those on Ada 2012. This example is from an on-line tutorial. I couldn't work out why range-checking wasn't working and changing the type from Integer got it going - with your answer it now all makes sense and I can go on to the next tutorial.