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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2adf79f4e850a932 X-Google-Attributes: gid103376,public From: nobody@REPLAY.COM (Anonymous) Subject: Re: Curious Question Date: 1997/12/09 Message-ID: <199712091633.RAA12253@basement.replay.com>#1/1 X-Deja-AN: 296642082 References: <66757i$mk5$1@swlab1.msd.ray.com> Organization: Replay and Company UnLimited Mail-To-News-Contact: postmaster@nym.alias.net X-001: Replay may or may not approve of the content of this posting X-002: Report misuse of this automated service to X-URL: http://www.replay.com/remailer/ Newsgroups: comp.lang.ada Date: 1997-12-09T00:00:00+00:00 List-Id: On 4 Dec 1997 20:53:06 GMT, car@swl.msd.ray.com (Chad Reichenbach {81726}) wrote: > I have a question I can'f figure out. If I have the following code: > > type My_Type is (obj1, obj2 obj3, obj4, obj5, obj6); > subtype My_Subtype is My_Type range obj1 .. obj4; > > My question is, I need a new subtype that ranges from obj4 to obj1. > Will the declaration > > subtype Second_Subtype is My_Subtype > range My_Subtype'last .. My_Subtype'first > > do that? If not is there a way to do it without defining a new > enumeration? > > The type would be used in a loop that loops through the enumeration > objects using S'succ(S). > Not necessary: for S in reverse My_Subtype loop The first time through the loop, S = My_Subtype'Last; the next time, S = My_Subtype'Pred (My_Subtype'Last); ...; the last time, S = My_Subtype"First. If you need to manually work through the loop, use 'Pred instead of 'Succ: S := My_Subtype'Last; loop -- Do stuff with S exit when S = My_Subtype'First; S := My_Subtype'Pred (S); end loop; Jeff Carter PGP:1024/440FBE21 My real e-mail address: ( carter @ innocon . com ) "We burst our pimples at you." Monty Python & the Holy Grail Posted with Spam Hater - see http://www.compulink.co.uk/~net-services/spam/