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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,32b8be7d0d9988ed X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-29 12:18:45 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.telusplanet.net!ps01-chi1!newsfeeds-atl2!news.webusenet.com!pc01.webusenet.com!e3500-atl2.usenetserver.com.POSTED!not-for-mail From: "gilrain" Newsgroups: comp.lang.ada References: <3D974B39.6000800@acm.org> Subject: Re: "In reverse" in for loop acting weird. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <2iIl9.81565$5M3.3572108@e3500-atl2.usenetserver.com> X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Sun, 29 Sep 2002 15:14:06 EDT Organization: WEBUSENET.com Date: Sun, 29 Sep 2002 14:19:51 -0500 Xref: archiver1.google.com comp.lang.ada:29418 Date: 2002-09-29T14:19:51-05:00 List-Id: Thanks for the tips! I'm still learning proper style, so I found these quite useful. I should have remembered 'range! John Thile "Jeffrey Carter" wrote: > ... > If the range of Coefficients is -15 .. 15, then your for loop would be > better written as > > for J in [reverse] Coefficients'range loop > > In general, when working with arrays, it is rarely necessary to mention > a magic number more than once. Once the magic number is used to define > the range of the type or object, attributes, such as 'range above, > eliminate the need to mention it again. > > When you do need to mention a magic number more than once, it's a good > idea to make it a named number or constant. For example, the 16 in your > code is a good candidate for this. I suspect it may be > > (Result'Length + 1) / 2. > ...