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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,da5197b9dca0ed40 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.mixmin.net!news.musoftware.de!wum.musoftware.de!news.doubleslash.org!open-news-network.org!news.tornevall.net!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Processing array subsections, a newbie question. Date: Sat, 12 Jun 2010 23:54:41 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <4c13db30$0$2391$4d3efbfe@news.sover.net> <8739wsottd.fsf@ludovic-brenta.org> <87jc41FftrU1@mid.individual.net> NNTP-Posting-Host: c56e2e4c740264984cc93096f328e413 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 441b7a06b2c345175b0f21f57560bf5c X-Complaints-To: abuse@tornevall.net User-Agent: Thunderbird 2.0.0.24 (X11/20100411) X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <87jc41FftrU1@mid.individual.net> X-Validate-Post: http://news.tornevall.net/validate.php?trace=441b7a06b2c345175b0f21f57560bf5c X-SpeedUI: 1738 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news1.google.com comp.lang.ada:11783 X-Original-Bytes: 2611 Date: 2010-06-12T23:54:41-07:00 List-Id: Niklas Holsti wrote: > > if Index_Fst <= Buffer'Last then > -- Buffer is not empty, something to be done. > loop OK, we get here with Index_Fst < Buffer'Last. > Do_Something(Buffer, Index_Fst, Index_Lst, Ok); And Do_Something set Ok to True. > exit when not Ok; Do_Something doesn't change Index_Fst, so we get past > exit when Index_Fst >= Buffer'Last; to here. Now the OP's concern, IIUC, is that Index_Lst, which Do_Something sets, might be = Buffer'Last = Natural'Last (seems unlikely, but I suspect this is simplified from an example in which the index range is more constrained and Index_Lst is more likely to be = Index_Subtype'Last). In that case > Index_Fst := Index_Lst + 1; will raise an exception. So it looks to me as if the correct test is exit when Index_Lst [>]= Buffer'Last; (Maybe Brenta meant this, and mistyped it; the variable names are very similar. Using _First and _Last might make such an error more obvious.) -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49