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,1f0967a619e5d83e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!post01.iad01!roadrunner.com!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Ada checks suppression thanks to compilation options and Ada conformity References: <4733972C.C7E7BCE@free.fr> <13j8b1oon6rvncd@corp.supernews.com> From: Keith Thompson Organization: None to speak of Date: Sat, 10 Nov 2007 14:00:05 -0800 Message-ID: User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:IX4LbyS1/asgvuzLDOcDoI+gvZ4= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 75.80.183.54 X-Complaints-To: abuse@rr.com Xref: g2news1.google.com comp.lang.ada:18255 Date: 2007-11-10T14:00:05-08:00 List-Id: Dennis Lee Bieber writes: [...] > Well... from my lowly perspective... > > 1) One text book describes "pragma" as a "directive to the > compiler"... Compilation options can also be considered "directives to > the compiler" Sure, but pragmas are defined by the language; compilation options are not. > 2) Many of my Ada texts tend to treat "pragma" as a "suggestion" for > the compiler -- and indicate that compilers are allowed to ignore > pragmas for which they are not coded Implementations are allowed to define their own pragmas. If a compiler doesn't recognize the name of a pragma, it must issue a warning, and the pragma has no effect. But this doens't apply to pragma Suppress, which is defined by the language; for that, you have to look at what the standard specifically says about pragma Suppress. A pragma Suppress gives the compiler permission to omit the specified check(s). It doesn't require it to do so, and a conforming compiler could ignore pragma Suppress altogether. The purpose is not to allow operations that would raise exceptions; it's to allow faster code to be generated, based on the assumption that the exceptions would not have been raised. In other words, using pragma Suppress means that the burden of avoiding overflows and other errors is on the programmer rather than on the compiler. > 3) The absence of a "pragma X" does not imply "pragma NOT-X" (eg, > absence of "pragma Suppress" does not imply "pragma Suppress NONE" Yes, it does. The language standard requires certain checks to be performed. This requirement applies *unless* pragma Suppress is used. If you don't use pragma Suppress (or some implementation-defined pragma with similar semantics) and a required check is not performed, then the implementation is failing to conform to the standard. This isn't necessarily a bad thing. If a compiler provides a command-line option to suppress all checks, that can be quite useful; it's easier than modifying the source every time you want to disable or enable checks. But a compiler with such an option specified is not a standard-conforming Ada compiler. There is a counter-argument to this. The input to the compiler is one or more compilation units; the standard doesn't specify how a compilation unit is represented. It could be argued that, if you specify a compiler command-line option to suppress all checks, it causes the compilation unit to consist of the specified source file *plus* a "pragma Suppress(All_Checks);" at the top. > Conclusion: Always read the documentation for the compiler in use. Absolutely. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Looking for software development work in the San Diego area. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"