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.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, REPLYTO_WITHOUT_TO_CC 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-7-bit Path: g2news1.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.ett.com.ua!not-for-mail From: anon@att.net Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Tue, 10 Aug 2010 22:50:40 +0000 (UTC) Organization: ETT newsserver Message-ID: References: Reply-To: anon@anon.org NNTP-Posting-Host: dialup-4.225.172.12.dial1.dallas1.level3.net X-Complaints-To: usenet@news.ett.com.ua X-Notice: Filtered by postfilter v. 0.6.1 X-Newsreader: IBM NewsReader/2 2.0 Xref: g2news1.google.com comp.lang.ada:13095 Date: 2010-08-10T22:50:40+00:00 List-Id: In , =?iso-8859-15?Q?Yannick_Duch=EAne_=28Hibou57=29?= writes: >Le Tue, 10 Aug 2010 16:03:13 +0200, Elias Salom=E3o Helou Neto = > > a =E9crit: >> It is a pity that this post became a technical discussion on array >> indexing. >Could I, if you please, talk to Phil without your prior acknowledgment = > >please ? ;) > >While I understand why you reacted (not the way you do... closed = > >parenthesis) > >> A simple question that could be asked in a single line is: >> can Ada access arrays without range checking? >Sorry, due to a recent trouble with my news reader, I've the original po= >st. > >However, on this sentence basis, I would say: if you do not want range = > >check, then just disable it in the compiler option. But be warned you wi= >ll = > >then be unable to catch runtime error. While there is a way to safely dr= >op = > >this compiler option: validation with SPARK checker (just tell if you ne= >ed = > >to learn about it). > >If your matter is just about range checking, the answer is as simple as = > = > >that. > >If you use GNAT, you may insert "-gnatp" in the command line arguments. >http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gnat_ugn_unw/Run_002dTime-Checks= >..html > >If you use GNAT from the GPS environment, you may open the "Project" men= >u, = > >then the "Edit project properties" submenu. Then choose the "Switches" = > >tab, then the "Ada" tab and check the "Suppress all check" check box or = > = > >uncheck the "Overflow check" check box. > >Providing I did not fail to understand what you meant. > >-- = > >There is even better than a pragma Assert: a SPARK --# check. >--# check C and WhoKnowWhat and YouKnowWho; >--# assert Ada; >-- i.e. forget about previous premises which leads to conclusion >-- and start with new conclusion as premise. While the main expression are equal. The code generation by Ada compilers versus C or C++ is less efficient do to a number of factors. 1. Elaboration: Ada compilers can generate run-time elaboration routines that must be executed before starting the main users program. C/C++ compilers do not perform any run-time elaboration, which cause the execution and code generation to be more efficient but cause the less program to be less reliable. 2. Run-Time Checks: The Ada compiler generates inline run-time checks which the C/C++ compiler do not. Using the pragma "suppress" statement can eliminate most checks. The absent of these checks makes C/C++ less reliable. Using the following removes all checks the statement does have other precise options as well. pragma Suppress ( All_Checks ) ; -- removes all checks on the program or that package. pragma Suppress ( All_Checks, ON => , ... ON => ) ; -- removes all checks on that set of names only. -- Names may be an object such as an array or routine -- Also, the "ON =>" symbols are optional 3. GCC backend: Ada as well as any other language besides C or C++ must translate the core language into the C/C++ like tree structure. Which forces the core languages to be limited to C/C++ code generation.