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,adbfb5b65308687 X-Google-Attributes: gid103376,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: for-loop parameters Date: 1997/09/25 Message-ID: #1/1 X-Deja-AN: 275596441 References: Organization: Estormza Software Newsgroups: comp.lang.ada Date: 1997-09-25T00:00:00+00:00 List-Id: In article , stt@houdini.camb.inmet.com (Tucker Taft) wrote: >The syntax for a "for" loop includes the ability to specify explicitly >the type of the loop parameter. By default, it is determined by the >type of the low and high bound, and if both are "universal" integers, >then it uses Standard.Integer as a fallback. > >For example: > > for I in 1..10 loop -- uses Standard.Integer > > for MI in My_Integer range 1..10 loop -- uses My_Integer I like the latter formulation - always try to assert the type of the index explicitly. For example, a better way to formulate the former would be for I in Integer range 1 .. 10 loop If I is used to index an array, then asserting the array index subtype directly is better still (this can also turn some constraint checks off). Matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271