comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <condicma@bogon.pwfl.com>
Subject: Re: Assertions
Date: 1999/05/10
Date: 1999-05-10T00:00:00+00:00	[thread overview]
Message-ID: <3736F549.E3DDCDEB@pwfl.com> (raw)
In-Reply-To: 3736D243.1EEBF1AB@globalnet.co.uk

J & A Richardson wrote:
> 
> I have looked through the RM and can not find any refference to
> assertions, pre conditions, or post conditions.
> 
> It was my understanding that Ada 95 used assertions.
> 
> I have also looked through a couple of webpages.
> 
> Does Ada 95 use exceptions to work as assertions?  Or am I missing
> something?
> 
That depends on exactly what will count as an "assertion". If parameters
to a procedure are of data types that have meaningful constraints
(ranges for which the subprogram is valid) then this counts as a kind of
primitive assertion. Violation of the assertion will raise an exception.

But I don't think that is what you mean. The sort of assertions that
would allow you to check for, say, relationships between parameters as
well as valid ranges, etc., are not a standard part of Ada. However, the
GNAT compiler for Ada95 has the pragma Assert which allows you to
include logical expressions which can be turned on and off with compiler
directives. This lets you accomplish the same thing as a direct language
feature in creating preconditions, postconditions, etc. I won't swear to
it, but I think the "pragma Assert" got enough attention that other
compiler vendors have implemented it as well, so it is becoming a common
- if not standard - feature of the language. I'd expect to see it in
some future revision of the ARM.

MDC
-- 
Marin David Condic
Real Time & Embedded Systems, Propulsion Systems Analysis
United Technologies, Pratt & Whitney, Large Military Engines
M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600
***To reply, remove "bogon" from the domain name.***

Visit my web page at: http://www.flipag.net/mcondic




  reply	other threads:[~1999-05-10  0:00 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-10  0:00 Assertions J & A Richardson
1999-05-10  0:00 ` Marin David Condic [this message]
1999-05-11  0:00   ` Assertions Robert Dewar
1999-05-11  0:00     ` Assertions Nick Roberts
1999-05-11  0:00       ` Assertions Robert Dewar
1999-05-12  0:00         ` Assertions Dale Stanbrough
1999-05-12  0:00           ` Assertions Robert Dewar
1999-05-12  0:00     ` Assertions Tucker Taft
1999-05-12  0:00       ` Assertions Marin David Condic
1999-05-12  0:00       ` Assertions Larry Kilgallen
1999-05-12  0:00         ` Assertions Tucker Taft
1999-05-13  0:00         ` Assertions Nick Roberts
1999-05-17  0:00           ` Assertions Dale Stanbrough
1999-05-19  0:00             ` Assertions Nick Roberts
1999-05-22  0:00               ` Assertions Dale Stanbrough
1999-05-22  0:00                 ` Assertions Robert Dewar
1999-05-22  0:00                 ` Assertions Ray Blaak
1999-05-22  0:00                   ` Assertions Robert Dewar
1999-05-23  0:00                     ` Assertions Nick Roberts
1999-05-24  0:00                       ` Assertions Ray Blaak
1999-05-24  0:00                       ` Assertions Dale Stanbrough
1999-05-23  0:00                 ` Assertions Nick Roberts
1999-05-18  0:00       ` Assertions Richard D Riehle
1999-05-19  0:00         ` Assertions Nick Roberts
1999-05-19  0:00           ` Assertions Richard D Riehle
1999-05-20  0:00             ` Assertions stimuli
1999-05-21  0:00               ` Assertions Richard D Riehle
1999-05-21  0:00                 ` Assertions Robert Dewar
1999-05-20  0:00             ` Assertions Ehud Lamm
1999-05-21  0:00               ` Assertions Robert Dewar
1999-05-21  0:00                 ` Assertions Ehud Lamm
1999-05-21  0:00                   ` Assertions Tucker Taft
1999-05-20  0:00           ` Assertions stimuli
1999-05-12  0:00 ` Assertions Peter Amey
1999-05-12  0:00   ` Assertions Robert Dewar
replies disabled

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