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,FREEMAIL_FROM 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,UTF8 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.mixmin.net!aioe.org!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Efficiency of code generated by Ada compilers Date: Wed, 11 Aug 2010 01:28:25 +0200 Organization: Ada At Home Message-ID: References: NNTP-Posting-Host: anOtUalzMUZHasssFqT+2w.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.60 (Win32) Xref: g2news1.google.com comp.lang.ada:13097 Date: 2010-08-11T01:28:25+02:00 List-Id: Le Wed, 11 Aug 2010 00:50:40 +0200, a =C3=A9crit: > While the main expression are equal. The code generation by Ada compil= ers > 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 check= s > which the C/C++ compiler do not. Using the prag= ma > "suppress" statement can eliminate most checks. = The > absent of these checks makes C/C++ less reliable= . Yes. You have the choice (with the former) > pragma Suppress ( All_Checks, ON =3D> , > ... > ON =3D> ) ; > -- removes all checks on that set of names only. > -- Names may be an object such as an array or routine > -- Also, the "ON =3D>" symbols are optional Interesting point. Is that GNAT or other compiler specific ? I do not th= is = variant in the reference. In =E2=80=9C11.5 Suppressing Checks=E2=80=9D: > 3/2 The forms of checking pragmas are of a pragma Suppress is as = > follows:4/2 pragma Suppress(identifier [, [On =3D>] name]); > 4.1/2 pragma Unsuppress(identifier); Standard or not, this seems nice. This may be better for centralized = management of runtime-checks. -- = 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.