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:50:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!fu-berlin.de!uni-berlin.de!213.200.246.247!not-for-mail From: Vinzent Hoefler Newsgroups: comp.lang.ada Subject: Re: Optimizing Boundary Checks Date: Fri, 13 Jun 2003 15:48:32 +0200 Organization: JeLlyFish software Message-ID: References: NNTP-Posting-Host: 213.200.246.247 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: fu-berlin.de 1055512200 19078481 213.200.246.247 (16 [175126]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:39114 Date: 2003-06-13T15:48:32+02:00 List-Id: Martin Dowie wrote: >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; This I find interesting. (Of course, assuming that My_Type is the Index type of My_Array). >Not sure if the checks in the first example would have >disappeared if we'd been allowed to switch compiler >optimizations on... I'd guess so. >I guess the you just have to get that assembler listing and >check what each compiler you use does! Yes. I'd say, the only thing we know is where the compiler is required to do range checks, not where it is permitted to suppress them. Vinzent.