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,df40d0d1975a16a6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-13 05:21:08 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!not-for-mail Date: Fri, 13 Jun 2003 14:03:24 +0200 From: Erlo Haugen <_elh_@_terma_._com_> Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks Message-ID: <20030613140324.0000372e._elh_@_terma_._com_> References: Organization: Terma A/S X-Newsreader: Sylpheed version 0.9.0claws (GTK+ 1.3.0; Win32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 62.242.55.242 X-Trace: 1055505834 dread11.news.tele.dk 5190 62.242.55.242 X-Complaints-To: abuse@post.tele.dk Xref: archiver1.google.com comp.lang.ada:39097 Date: 2003-06-13T14:03:24+02:00 List-Id: On Fri, 13 Jun 2003 11:49:03 +0000 (UTC) Preben Randhol wrote: > After reading some posts here lately I have understood that the compiler > can optimise out boundary checks on say arrays if you do this: > > type Index_Range is range 1 .. 10; > type Items is array (Index_Range) of Natural; > > But if you write: > > type Items is array (1 .. 10) of Natural; > > is boundary checks then on? Yes, but in this case (principally) every acces to the array has to be checked, whereas in the former case, the index is guaranteed to be within range. -- Remove the underscores