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-Thread: 103376,c4cb2c432feebd9d X-Google-Thread: 1094ba,c4cb2c432feebd9d X-Google-Thread: 101deb,15c6ed4b761968e6 X-Google-Attributes: gid103376,gid1094ba,gid101deb,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Tom LINDEN" Newsgroups: comp.lang.ada,comp.lang.fortran,comp.lang.pl1 Subject: Re: Bounds Check Overhead Date: Sat, 27 May 2006 10:52:03 -0700 Organization: Kednos Message-ID: References: <0ugu4e.4i7.ln@hunter.axlog.fr> <%P_cg.155733$eR6.26337@bgtnsc04-news.ops.worldnet.att.net> <6H9dg.10258$S7.9150@news-server.bigpond.net.au> <1hfv5wb.1x4ab1tbdzk7eN%nospam@see.signature> <4475DA61.3080001@comcast.net> <87fyivh5xh.fsf@ludovic-brenta.org> <1q4rxn8ktn7dt.1wjrxfwrlt6yk.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 Content-Transfer-Encoding: Quoted-Printable X-Trace: individual.net a9VrfUoUaFQE598sO+Sx3wZsdC3ifOsXDeYYdMnZc+EKWOReu6 User-Agent: Opera Mail(BETA2)/9.00 (Win32) Xref: g2news2.google.com comp.lang.ada:4553 comp.lang.fortran:10363 comp.lang.pl1:1777 Date: 2006-05-27T10:52:03-07:00 List-Id: WHY NOT STOP CROSS POSTING TO COMP.LANG.PL1, PLEASE? On Sat, 27 May 2006 08:59:42 -0700, Dmitry A. Kazakov = wrote: > On Sat, 27 May 2006 16:56:58 +0200, Ludovic Brenta wrote: > >> "robin" writes: >>> "Simon Wright" writes: >>>> In Ada one should where possible use the 'Range attribute: >>> >>> Ideally yes, but in practice, such as in sorting and averaging, >>> the loop is often one or two short of the number of elements in the = = >>> array. >> >> No problem: >> >> type Some_Array_Type is array (Positive range <>) of Something; >> >> procedure Walk (A : in Some_Array_Type) is >> begin >> for J in A'First .. A'Last - 1 loop >> ... >> end loop; >> end Walk; > > I don't think it is same. A range expression of A'First and A'Last is = not > statically required to be a subrange of A'Range (or maybe empty). So t= he > compiler had to prove that, if it would wish to omit checks. In your > example it is trivially provable (if nobody had played with "-"), thou= gh = > I > am not sure if, say, GNAT really does it. > > Somebody had mentioned OCaml, I really doubt that inference is the = > answer. > The programmer knows far more than the compiler (or pier viewer) could= > infer. If J has to be in A'Range, I prefer that it could be specified > rather than deduced. > -- = Using Opera's revolutionary e-mail client: http://www.opera.com/mail/