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,d901a50a5adfec3c X-Google-Attributes: gid103376,public X-Google-Thread: 1094ba,9f0bf354542633fd X-Google-Attributes: gid1094ba,public From: Toon Moene Subject: Re: Fortran or Ada? Date: 1998/10/03 Message-ID: <6v5116$hr4$1@newnews.nl.uu.net>#1/1 X-Deja-AN: 397324800 References: <36068E73.F0398C54@meca.polymtl.ca> <6u8r5o$aa4$1@nnrp1.dejanews.com> <360A3446.8AD84137@lmco.com> <6udre0$ha1$1@nnrp1.dejanews.com> <19980925.185359.250@yktvmv.watson.ibm.com> <6uifdr$dog$1@nnrp1.dejanews.com> <19980928.184428.604@yktvmv.watson.ibm.com> <19980929.214309.386@yktvmv.watson.ibm.com> <3615E297.57D3ED15@icon.fi> Organization: Moene Computational Physics, Maartensdijk, The Netherlands Newsgroups: comp.lang.fortran,comp.lang.ada Date: 1998-10-03T00:00:00+00:00 List-Id: Niklas Holsti wrote: > As I understand it (without having seen the Ada code, though), what > occurred was that the Ada code called for a type conversion from float > to integer, I := integer(F); the Ada compiler translated this into a > machine instruction; the machine instruction caused a machine trap since > the floating operand was too large; the trap handler (in this > application) > assumed a hardware error and shut down the computer. The trap would > as well have occurred in a Fortran program, assuming that the Fortran > compiler used the same machine instruction, as seems likely. The trap would have occurred; however, because Fortran doesn't define a trap handling mechanism (and certainly not one specifiable by the programmer), it would just have result in a software error. > If the interpretation is wrong, and Ada exceptions were used, in my view > the fault was in the poor specification and careless reuse rather than > in the Ada exception mechanism, which did what it was asked to do. No. The problem is in the expectation of Ada programmers that software errors should be handled the same as hardware errors, by trapping them via a software trap handler specified by the programmer. Software errors should be handled by careful, defensive programming, not CYA. I believe I even recall that a remark like this is in the report. -- Toon Moene (mailto:toon@moene.indiv.nluug.nl) Saturnushof 14, 3738 XG Maartensdijk, The Netherlands Phone: +31 346 214290; Fax: +31 346 214286 g77 Support: mailto:fortran@gnu.org; egcs: mailto:egcs-bugs@cygnus.com