comp.lang.ada
 help / color / mirror / Atom feed
From: Keith Thompson <kst-u@mib.org>
Subject: Re: Ada checks suppression thanks to compilation options and Ada conformity
Date: Sat, 10 Nov 2007 14:00:05 -0800
Date: 2007-11-10T14:00:05-08:00	[thread overview]
Message-ID: <lntzntoj6i.fsf@nuthaus.mib.org> (raw)
In-Reply-To: 13j8b1oon6rvncd@corp.supernews.com

Dennis Lee Bieber <wlfraed@ix.netcom.com> 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  <http://www.ghoti.net/~kst>
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"



      parent reply	other threads:[~2007-11-10 22:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-08 23:09 Ada checks suppression thanks to compilation options and Ada conformity Christophe TRAVERS
2007-11-08 23:52 ` Ludovic Brenta
2007-11-09  0:15 ` Jeffrey Creem
2007-11-09  0:25 ` Adam Beneschan
2007-11-09  6:07 ` anon
     [not found]   ` <13j8b1pjln94ce@corp.supernews.com>
2007-11-10 20:21     ` Christophe TRAVERS
     [not found] ` <13j8b1oon6rvncd@corp.supernews.com>
2007-11-10 20:54   ` Christophe TRAVERS
2007-11-10 22:00   ` Keith Thompson [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox