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,2a34b7ad6c6a0774 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 13 Aug 2010 20:01:53 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers References: <1jn1a4o.1dfllwo1uin3imN%csampson@inetworld.net> <1jn36d6.se2f0g1edjjnyN%csampson@inetworld.net> <61f149b9-00ff-40cd-9698-01e69fdc5c0f@v15g2000yqe.googlegroups.com> <12ce49e6-169e-4e35-b82f-27de0d9b1ceb@t20g2000yqa.googlegroups.com> In-Reply-To: <12ce49e6-169e-4e35-b82f-27de0d9b1ceb@t20g2000yqa.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <4c658892$0$6766$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 13 Aug 2010 20:01:54 CEST NNTP-Posting-Host: c6184e39.newsspool3.arcor-online.net X-Trace: DXC=mZLh>_cHTX3j]:o8:K1 On 13.08.10 17:10, Elias Salom�o Helou Neto wrote: >> 1) You can, in more than one way, tell the compiler to suppress most >> (any?) checks, but people do not advise to do so. Even if I say that I >> do need that :( Don't worry. A rule frequently heard is that if your requirements, either directly or by implication, include highest possible speed, lowest possible overhead, or whatever, then these are requirements and Ada (designed to be usable also in hard real-time environments, as might be mentioned...), must provide for meeting the requirements. If the LRM did not address absence of checks, Unchecked_Conversion etc., this goal would not be met, nor Ada's, see below. Some here have been involved in an almost insane effort to achieve highest possible speeds, very much at the cost of a clear, obvious algorithm. And of course we couldn't tolerate any checks in a program that we knew wouldn't need them! A nice result is that the programs still do not need to resort to CPU-specific macros, say, to achieve highest speed. They use plain Ada and the compiler produces good code. (BTW, one can use standard Ada facilities to have the compiler "try" different object code, via representation clauses, or suitably defined (and sized) types.) >> 2) It is not necessary for the compiler to actually suppress any >> checking! It seems that the LRM demands the compiler to allow you to >> misunderstood something here. > ask for the suppression, but it does NOT mandate the compiler to > actually > skip such checks. Well, this is, to say the least, funny - unless I 1. An authoritative comment from an ARG member has been (more than once) that the LRM never requires anything stupid, or funny, as you have put it. Range checking can be turned off. (In fact, the SPARK effort can be understood to mean that a SPARK program can run without checks because it has been analyzed and found to be without need for any checks.) 2. By the AS-IF rule, a compiler need not even introduce checks where it can show at compile time that none are needed. I think Dmitry has hinted at this. 3. Even though pedantically one might insist on what seems written in the LRM and dismiss the implications of equally dependable 1. and 2., it helps remembering that you cannot do so in the real world: >From the outset Ada was made by and for customers. This is documented in the archives. If the LRM had mandated funny things, like precluding perfectly normal compiler pragmatics, there would have been little support (and the whole thing wouldn't be consistent with Ada language requirements). 4. The description (however obsolescent) of pragma Suppress mentions "permission"; an indication that programmer allows compiler to suppress. Consequently, and consistent with what is usually the case with many other language AFAIK, suppressing checks is a compiler thing, and the LRM even expressly mentions this. In fact, documents have been more explicit. This is from the June 1978 Requirements "1D. Efficiency. The language design should aid the production of efficient object programs. Constructs that have unexpectedly expensive implementations should be easily recognizable by translators and by users. Features should be chosen to have a simple and efficient implementation in many object machines, to avoid execution costs for available generality where it is not needed, to maximize the number of safe optimizations available to translators, and to ensure that unused and constant portions of programs will not add to execution costs. Execution time support packages of the language shall not be included in object code unless they are called." http://archive.adaic.com/docs/reports/steelman/steelman.txt I think you can rely on programmer control over checks. Georg