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.42.141 with SMTP id s13mr5093871qae.3.1371369351273; Sun, 16 Jun 2013 00:55:51 -0700 (PDT) X-Received: by 10.49.35.109 with SMTP id g13mr254054qej.1.1371369351260; Sun, 16 Jun 2013 00:55:51 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!bw2no1858344qab.0!news-out.google.com!y6ni2993qax.0!nntp.google.com!j2no360005qak.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 16 Jun 2013 00:55:51 -0700 (PDT) In-Reply-To: <10f60bd4-cb71-4d77-88cb-46781a3f6194@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=68.113.176.20; posting-account=MynaUQoAAABLIabAWk436qZGCp4jiL1_ NNTP-Posting-Host: 68.113.176.20 References: <5788c60d-fb8c-4058-9ae9-414dd77a3dc4@googlegroups.com> <93769622-5341-472e-8f08-c0121c38de5d@googlegroups.com> <1xwjeszj238ws.1x4a0ywxkq0ol.dlg@40tude.net> <10f60bd4-cb71-4d77-88cb-46781a3f6194@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <663b17b5-e151-4be0-8270-6120212c5105@googlegroups.com> Subject: Re: Beginner issue.. From: Marcus F Injection-Date: Sun, 16 Jun 2013 07:55:51 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 4229 Xref: number.nntp.dca.giganews.com comp.lang.ada:181864 Date: 2013-06-16T00:55:51-07:00 List-Id: On Sunday, June 16, 2013 2:52:57 AM UTC-5, Marcus F wrote: > On Sunday, June 16, 2013 2:21:55 AM UTC-5, Dmitry A. Kazakov wrote: > > > On Sun, 16 Jun 2013 00:00:33 -0700 (PDT), Marcus F wrote: > > > > > > > > > > > > > On Sunday, June 16, 2013 1:54:29 AM UTC-5, Marcus F wrote: > > > > > > >> > > > > > > >> I'm looking at a simple tutorial guide to pick up some basics of ADA, but > > > > > > >> I ran into an issue that I don't understand. > > > > > > > > > > > > OK, this is a GNAT Ada compiler pitfall almost anybody runs into. > > > > > > > > > > > > When you compile an Ada program with GNAT, NEVER EVER forget to turn the > > > > > > run-time integer overflow checks on. E.g. in your case, you should compile > > > > > > your program as follows: > > > > > > > > > > > > gnatmake -gnato compute.adb > > > > > > > > > > > > The switch -gnato instructs GNAT to check integer overflows, which is what > > > > > > happens. After that the output would look like: > > > > > > > > > > > > 1 > > > > > > 2 > > > > > > 4 > > > > > > 8 > > > > > > 16 > > > > > > 32 > > > > > > 64 > > > > > > 128 > > > > > > 256 > > > > > > 512 > > > > > > 1024 > > > > > > 2048 > > > > > > 4096 > > > > > > 8192 > > > > > > 16384 > > > > > > 32768 > > > > > > 65536 > > > > > > 131072 > > > > > > 262144 > > > > > > 524288 > > > > > > 1048576 > > > > > > 2097152 > > > > > > 4194304 > > > > > > 8388608 > > > > > > 16777216 > > > > > > 33554432 > > > > > > 67108864 > > > > > > 134217728 > > > > > > 268435456 > > > > > > 536870912 > > > > > > 1073741824 > > > > > > > > > > > > raised CONSTRAINT_ERROR : compute.adb:8 overflow check failed > > > > > > > > > > > > Without checks on, you get an overflow. For a number of power of two the > > > > > > overflow results in 0. 0*2=0, which is what you observe on the screen. > > > > > > > > > > > > -- > > > > > > Regards, > > > > > > Dmitry A. Kazakov > > > > > > http://www.dmitry-kazakov.de > > > > Thank you Dmitry! > > > > Now I just need to figure out how to turn on the Integer Overflow checks.. > > (I'm using AdaGIDE, just hitting save, build, run) I just looked around the settings, and the box for Integer Overflow Checks, is checked for the Debug setting, and I'm using Debug mode.