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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4c1892715ffb825c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-02 13:37:11 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!netnews.com!xfer02.netnews.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!59ce1190!not-for-mail Message-ID: <3CFA8223.DC131896@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Exceptions in GNAT References: <3CF9FB01.2070101@yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sun, 02 Jun 2002 20:37:10 GMT NNTP-Posting-Host: 63.184.12.231 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1023050230 63.184.12.231 (Sun, 02 Jun 2002 13:37:10 PDT) NNTP-Posting-Date: Sun, 02 Jun 2002 13:37:10 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:25216 Date: 2002-06-02T20:37:10+00:00 List-Id: David Rasmussen wrote: > > I am learning Ada, and in one exercise I am told to find out how large > and integer I can use on my system, before it overflows. The exercise > just tells me to add two larger and larger numbers and see when an > exception occurs. I have just compiled my program with gnatmake with no > options, and I am using gcc 3.1 . When the numbers get large enough, the > result is just a negative number because of wrap-around. Shouldn't I get > an exception, unless I turn it off? How do I compile for with most > checks for debug builds, and how do I compile with everything turned off > for performance intensive release builds? By now you've learned that overflow checking is off in GNAT by default, and how to turn it on. But your program won't tell you how large an integer you can use on your system. That information is given by the constant System.Max_Int. Your program will tell you the largest value of type Integer you can use on your system, but that can be determined faster from Integer'Last. The point is that the range of type Integer need not be as large as the range of the largest possible integer type, System.Min_Int .. System.Max_Int. For every version of GNAT that I've used, type Integer is 32 bits, but the largest possible integer type is 64 bits. -- Jeff Carter "Son of a window-dresser." Monty Python & the Holy Grail