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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,da5197b9dca0ed40 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!transit3.readnews.com!news-xxxfer.readnews.com!transit4.readnews.com!textspool1.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Message-Id: <4c1529b4$0$3623$4d3efbfe@news.sover.net> From: "Peter C. Chapin" Subject: Re: Processing array subsections, a newbie question. Newsgroups: comp.lang.ada Date: Sun, 13 Jun 2010 14:58:45 -0400 References: <4c13db30$0$2391$4d3efbfe@news.sover.net> <8739wsottd.fsf@ludovic-brenta.org> <9e1f3f35-6f49-468f-be89-46d4f51f8193@f17g2000vbl.googlegroups.com> <4c14e3fd$0$2382$4d3efbfe@news.sover.net> User-Agent: KNode/0.10.9 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Organization: SoVerNet (sover.net) NNTP-Posting-Host: bb8e2108.news.sover.net X-Trace: DXC=@N\00C X-Complaints-To: abuse@sover.net Xref: g2news1.google.com comp.lang.ada:11683 Date: 2010-06-13T14:58:45-04:00 List-Id: Phil Thornley wrote: > I don't think the state machine will make any difference, but you > certainly can't exit an enclosing loop when in a case arm - you have > to move the exit(s) to after the 'end case'. > > This is not usually too much of a problem, but in your code it forces > the exit to come after the increment (assuming that this has to stay > in the case arm). Yes that could be a problem for me. On the other hand *most* of the cases do the increment. With a little thought I might be able to make them all do the increment... and then factor that out of the case. > As you suggest elsewhere in this thread, it is a good idea to have > subtype constraints as tight as possible. In the situation you > describe I would define a type (to replace your use of Natural) that > has one extra value at the end (for the Index_Fst variable). Then > define the array index as a subtype that excludes that extra value. > This should allow the increment to stay in the case arm, with the exit > following after the case. That sounds like what I've got at the moment. Maybe I'll just end up sticking with that and see how it plays out. > (BTW, if you haven't tried it yet, you will find that using > unconstrained arrays creates additional work when doing run-time > checks as the VCs generated by any reference to an array element use > the limits for that array object, not just the array index subtype). I'll keep that in mind. I could probably defined a constrained array type instead. In my situation the array sizes should only vary between about 20 and 40 elements. I could probably just define the array to have 40 elements (or whatever I actually need... I'll have to check). My state machine just returns once it is satisfied so it will ignore the extra "junk" if there is any. I think that would be okay. Thanks for your input. Peter