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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT 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!news4.google.com!proxad.net!feeder1-2.proxad.net!u-picardie.fr!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Tue, 10 Aug 2010 17:26:45 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <8349c981-4dca-49dc-9189-8ea726234de3@f42g2000yqn.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1281479210 3815 69.95.181.76 (10 Aug 2010 22:26:50 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 10 Aug 2010 22:26:50 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5843 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Original Xref: g2news1.google.com comp.lang.ada:13093 Date: 2010-08-10T17:26:45-05:00 List-Id: "Elias Salom�o Helou Neto" wrote in message news:8349c981-4dca-49dc-9189-8ea726234de3@f42g2000yqn.googlegroups.com... ... > Yes, I know that. I am, however, writing code within that 1% of > applications that would be tremendously affected if there is no way to > access arrays with no range checking. So I am asking very precisely: > does Ada allow me to do non range-checked access to arrays? Several people have already answered your exact question, so I won't bother to repeat that. But I'd like to point out that Ada compilers spend a lot of effort in eliminating unnecessary range checks. So that if your code is well-written, there will be few if any range checks when you access arrays. (Dmitry showed you one way that can be accomplished; another is to ensure that temporaries have appropriate subtypes.) So I'm suggesting that you try to avoid premature optimization. I can believe that there will be cases where you'll need to suppress range checks, but I'd also suggest that those will be far rarer than you are thinking. And, of course, the problem is that suppressing range checks is essentially the same as not wearing seat belts when driving. Just remember how many "security patches" have been caused by buffer overflows, all of which would have been detected and prevented by having range checking. Randy.