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,17506301c0751a38 X-Google-Attributes: gid103376,public From: dewar@gnat.com Subject: Re: Need exception despite Machine_Overflows is false Date: 1998/12/19 Message-ID: <75fg9u$d29$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 423846161 References: <36796140.62B2788C@magic.fr> <75cv66$90j$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x6.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Sat Dec 19 06:15:26 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1998-12-19T00:00:00+00:00 List-Id: In article , Matthew Heaney wrote: > `-gnato' > Enable other checks, not normally enabled by > default, including > numeric overflow checking, and access before > elaboration checks. > > Ah, silly me, I assumed that "numeric overflow checking" > meant check for > numeric overflow! Well perhaps silly you for reading only the summary of the switch and not the full documentation :-) The documentation of the -gnato switch in the GNAT users guide says: -gnato Enables overflow checking for integer operations. This causes GNAT to generate slower and larger executable programs by adding code to check for both overflow and division by zero (resulting in raising Constraint_Error as required by Ada semantics). Note that the -gnato switch does not affect the code generated for any floating-point operations; it applies only to integer operations. For floating-point, GNAT has the Machine_Overflows attribute set to False and the normal mode of operation is to generate IEEE NaN and infinite values on overflow or invalid operations (such as dividing 0.0 by 0.0). Clear enough I think! Note that the summary was correct, in that if you have Machine_Overflows set to False, then an out of range floating-point result is *not* an overflow in the sense of the predefined overflow check in the language. But in any case, when looking up the definition of switches, always consult the full documentation, and not just the quick summary! This is a good opportunity to reiterate and once again urge people to read the GNAT documentation if you are using this compiler (and indeed the advice applies to any other compiler I would assume!) There are lots of interesting facilities available, and I am always surprised (and a bit disappointed) to run into both students and hobbyists using the public version of GNAT, and customers using GNAT Professional with support who have not read the manual and are unaware of many features that they might find useful if they knew about them! Robert Dewar Ada Core Technologies -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own