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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y11g2000yqm.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Tue, 10 Aug 2010 07:31:17 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <1jmwhfp.roo31ybayx2bN%csampson@inetworld.net> <049ff595-3a53-48f3-8001-0d5cf1db0d2a@l6g2000yqb.googlegroups.com> <76de1822-f4cf-423a-8260-4b1cfac94172@f6g2000yqa.googlegroups.com> NNTP-Posting-Host: 174.28.232.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1281450677 3389 127.0.0.1 (10 Aug 2010 14:31:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 10 Aug 2010 14:31:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y11g2000yqm.googlegroups.com; posting-host=174.28.232.29; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729; .NET CLR 4.0.20506),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13068 Date: 2010-08-10T07:31:17-07:00 List-Id: On Aug 10, 8:03=A0am, Elias Salom=E3o Helou Neto wrote: > On Aug 10, 9:57=A0am, Yannick Duch=EAne (Hibou57) > > > > wrote: > > Le Tue, 10 Aug 2010 14:26:25 +0200, Phil Clayton =A0 > > a =E9crit: > > > > =A0 A(A'Length - I - 1) > > > > (not valid Ada, of course.) > > > A(A'Last - (I - A'First)) > > > > Perhaps "reverse" would be a better name for the operator "not" when > > > the modulus is not a power of two? > > > Or "wrapped" ? But this would only make sens on an array instance basis= , =A0 > > not on type basis. If the array actual range is not the same as the ind= ex =A0 > > type range, it fails. So this could not be a type primitive (operator).= =A0 > > May be an array attribute ? A'From_Last ? A'Last_Based ? > > > "reverse" is already there for loop statements. I feel this makes for s= ens =A0 > > for loop, as what is reverse, is not the array index: this is the =A0 > > iteration which goes reversed order. > > > -- > > There is even better than a pragma Assert: a SPARK --# check. > > --# check C and WhoKnowWhat and YouKnowWho; > > --# assert Ada; > > -- =A0i.e. forget about previous premises which leads to conclusion > > -- =A0and start with new conclusion as premise. > > It is a pity that this post became a technical discussion on array > indexing. A simple question that could be asked in a single line is: > can Ada access arrays without range checking? My algorithm needs not > wrapping, neither it needs range checking! > > Please, try avoiding pointless discussions on wrapped/non-wrapped > types. Recall that I do not even know Ada's syntax, let alone its > sophisticated type system. Your discussion can only possibly confuse > me. > > Elias. Yes, you can turn off run-time checking of array indecies. Pragma Suppress is what you want; http://en.wikibooks.org/wiki/Ada_Programm= ing/Pragmas/Suppress The example given exactly answers your question: My_Array : Array ( 1 .. 100 ) of Integer; pragma Suppress( Index_Check ); ... Some_Variable :=3D My_Array( 1000 ); -- Erroneous execution, here we come!