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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,bc7813b85b027ce5 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: 11.6 Date: 1999/11/22 Message-ID: <81bnik$2or$1@nnrp1.deja.com>#1/1 X-Deja-AN: 551637368 References: <3836ff5b_1@news1.prserv.net> <38393F42.EE13CEE5@mail.com> X-Http-Proxy: 1.0 x43.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Mon Nov 22 15:30:26 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-11-22T00:00:00+00:00 List-Id: In article <38393F42.EE13CEE5@mail.com>, Mats Weber wrote: > > Another question: if I compile this (or the instantiation?) > > with checks off, then will that cause the explicit range > > check to be omitted? > Yes, it will That's a misleading response. There is no requirement that suppressing checks will cause checks to be omitted, that is not what the pragma requires. in particular, on a machine where the checks are free (e.g. integer overflow on a MIPS 3000) then it is entirely reasonable for the compiler to leave in the checks. The idea of suppress is to get rid of checking code, not necessarily to get rid of checks. > As a rule, I never handle Constraint_Error, but use an if > statement instead in places I know overflow could happen, e.g. > > if Top >= Stack.Size then > raise Overflow; > end if; > Top := Top + 1; Of course some checks are pretty painful to test for explicitly. In GNAT we have added the pragma Unsuppress, precisely so that you can have a region of code where you KNOW the tests will be turned on, even if they are turned off at some higher level. FOr example, we expect the GNAT runtime to be compiled with checks off (-gnatp), but in some cases (e.g. look in a-calend.adb) we need the check and we use an explicit pragma Unsuppress. Sent via Deja.com http://www.deja.com/ Before you buy.