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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,76c4b4e5caa63729,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-27 16:47:30 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: dick_rumsfeld@yahoo.com (Dick Rumsfeld) Newsgroups: comp.lang.ada Subject: Getting started with Ada: Runtime exceptions? Date: 27 Nov 2001 16:47:30 -0800 Organization: http://groups.google.com/ Message-ID: <3e076d85.0111271647.338f33d@posting.google.com> NNTP-Posting-Host: 24.176.241.133 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1006908450 25890 127.0.0.1 (28 Nov 2001 00:47:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 28 Nov 2001 00:47:30 GMT Xref: archiver1.google.com comp.lang.ada:17074 Date: 2001-11-28T00:47:30+00:00 List-Id: Hello all, I've just today started to learn Ada. In Section 1.4 of the online tutorial I am learning from, http://www.adahome.com/Tutorials/Lovelace/s1sf.htm it is stated that the below program, when run, will print 2^n for each n starting with n=0, until an overflow occurs, at which time the program will automatically halt with a message stating an exception occured. Well, when I compiled and ran the below program using "gnatmake" (which I've just downloaded for my Linux distribution), it gives the following output: 1 2 4 8 [...output elided...] 536870912 1073741824 -2147483648 0 0 0 ... This looks more like the behavior I would expect from C. So then, what do I need to do to get what I presume from the tutorial to be the proper exception generating behavior? Here is the program: -- Demonstrate a trivial procedure, with another nested inside. with Ada.Text_IO, Ada.Integer_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO; procedure Compute is procedure Double(Item : in out Integer) is begin -- procedure Double. Item := Item * 2; end Double; X : Integer := 1; -- Local variable X of type Integer. begin -- procedure Compute loop Put(X); New_Line; Double(X); end loop; end Compute;