comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: 11.6
Date: 1999/11/22
Date: 1999-11-22T00:00:00+00:00	[thread overview]
Message-ID: <81bnik$2or$1@nnrp1.deja.com> (raw)
In-Reply-To: 38393F42.EE13CEE5@mail.com

In article <38393F42.EE13CEE5@mail.com>,
  Mats Weber <matsw@mail.com> 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.




  reply	other threads:[~1999-11-22  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-20  0:00 11.6 Matthew Heaney
1999-11-22  0:00 ` 11.6 Mats Weber
1999-11-22  0:00   ` Robert Dewar [this message]
1999-11-22  0:00 ` 11.6 Robert A Duff
1999-11-22  0:00   ` 11.6 Matthew Heaney
1999-11-23  0:00     ` 11.6 Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox