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 06:35:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!newspeer1.nwr.nac.net!newspeer.monmouth.com!newsfeed!btnet-peer0!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks Date: Fri, 13 Jun 2003 13:34:17 +0000 (UTC) Organization: BT Openworld Message-ID: References: NNTP-Posting-Host: host81-132-7-222.in-addr.btopenworld.com X-Trace: hercules.btinternet.com 1055511257 22093 81.132.7.222 (13 Jun 2003 13:34:17 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Fri, 13 Jun 2003 13:34:17 +0000 (UTC) X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MSMail-Priority: Normal X-Priority: 3 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:39109 Date: 2003-06-13T13:34:17+00:00 List-Id: "Preben Randhol" wrote in message news:slrnbejegn.in.randhol+abuse@kiuk0152.chembio.ntnu.no... > After reading some posts here lately I have understood that the compiler > can optimise out boundary checks on say arrays if you do this: Keyword in the last line is 'can'. I've run across compilers that will do no optimization (i.e. leave checks in) on code such as: for I in My_Type loop Make_Call(My_Array (I)); end loop; but would take them out if written: for I in My_Array'Range loop Make_Call(My_Array(I)); end loop; Not sure if the checks in the first example would have disappeared if we'd been allowed to switch compiler optimizations on... I guess the you just have to get that assembler listing and check what each compiler you use does!