From: Mats Weber <matsw@mail.com>
Subject: Re: 11.6
Date: 1999/11/22
Date: 1999-11-22T13:04:04+00:00 [thread overview]
Message-ID: <38393F42.EE13CEE5@mail.com> (raw)
In-Reply-To: 3836ff5b_1@news1.prserv.net
Matthew Heaney wrote:
> procedure Push
> (Stack : in out Stack_Type;
> Item : in Item_Type) is
>
> subtype Top_Range is Positive range 1 .. Stack.Size;
>
> Top : Natural renames Stack.Top;
> begin
> Top := Top_Range'(Top + 1); --???
> Stack.Items (Top) := Item;
> end Push;
>
> Is it possible, because of 11.6 permissions, that the explicit range
> check in the marked line can be optimized away?
>
> 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. 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;
next prev parent 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 ` Mats Weber [this message]
1999-11-22 0:00 ` 11.6 Robert Dewar
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