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,FREEMAIL_FROM, INVALID_MSGID 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: Mats Weber Subject: Re: 11.6 Date: 1999/11/22 Message-ID: <38393F42.EE13CEE5@mail.com>#1/1 X-Deja-AN: 551610847 Content-Transfer-Encoding: 7bit References: <3836ff5b_1@news1.prserv.net> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sunrise.ch X-Trace: news1.sunrise.ch 943275843 807 195.141.231.162 (22 Nov 1999 13:04:04 GMT) Organization: sunrise communications ag Mime-Version: 1.0 NNTP-Posting-Date: 22 Nov 1999 13:04:04 GMT Newsgroups: comp.lang.ada Date: 1999-11-22T13:04:04+00:00 List-Id: 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;