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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b53c5375e9445ca X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: GNAT and Ariane 5 crash Date: 1996/08/02 Message-ID: #1/1 X-Deja-AN: 171800325 references: <32020E13.41C6@MSMAIL3.HAC.COM> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-08-02T00:00:00+00:00 List-Id: Pascal said "with Text_IO; use Text_IO; procedure test is F : Float; I : Integer; begin F := 1.0e31; I := Integer( F ); Put_Line( Integer'Image(I) ); end;" should display Numeric_Error. That is incorrect, there is no such exception in Ada 95, the exception raised by the above program is Constraint_Error. Ada 83 compilers should also raise Constraint_Error rather than Numeric_Error, but some old Ada 83 compilers were never fixed to give the recommended behavior (Numeric_Error is not wrong in Ada 83, just not recommended, but would be wrong in Ada 95). Assuming you enable overflow checking (using the -gnato switch as documented in the GNAT documentation -- worth reading!) then you get the expected result Constraint_Error from GNAT. Probably your incorrect result was a r result of not reading the documentation and hence not knowing you should set the -gnato switch. P.S. Before anyone starts a thread on this switch in GNAT, please consult the comp.lang.ada archives for long discussion threads on this switch and don't post unless you have something new to say :-)