comp.lang.ada
 help / color / mirror / Atom feed
From: "Stuart Hutchesson" <shutch@innotts.co.uk>
Subject: Re: Renaming Fixed Point Mutiplicative operator in Ada 95
Date: 1998/05/22
Date: 1998-05-22T00:00:00+00:00	[thread overview]
Message-ID: <01bd8589$5fa05a00$440029a1@m00rq900> (raw)
In-Reply-To: dewar.895785693@merv




Robert Dewar <dewar@merv.cs.nyu.edu> wrote in article
<dewar.895785693@merv>...
> 
> 
> Incidentally, in a critical system, I would jolly well hope that EITHER
> 
>  a) you prove that division by zero cannot happen
> 
> or
> 
>  b) you test for it explicitly
> 
>     if z = 0 then
> 	....
>     else
>         a := y /z;
>     end if;
> 
If you are suggesting that all divisions are guarded by a test for
denonimator non-zero - then wouln't the most obvious place for that test be
within the division operator itself! Otherwise you have a massive
review/verification effort to check that all divisions are guarded! If it
is inside the operator then that test is done once.  Also
 there is the question of the code that has to be placed inside the "if"
side of the check.

Plus you have to consider all the other guards that have to be placed
around both multipy and divide operations for overflow of the destination
type etc.  The neatest and most cost-effective solution is to put them
inside an overridden operator.

(BTW - the example you gave in your previous posting of surrounding the
operation with an exception handler is banned by SPARK Ada.....)





  parent reply	other threads:[~1998-05-22  0:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-19  0:00 Renaming Fixed Point Mutiplicative operator in Ada 95 Stuart Hutchesson
1998-05-19  0:00 ` Matthew Heaney
1998-05-20  0:00   ` Robert Dewar
     [not found]     ` <matthew_heaney-ya023680002005981908570001@news.ni.net>
1998-05-21  0:00       ` Robert Dewar
1998-05-22  0:00         ` Robert I. Eachus
1998-05-23  0:00           ` Robert Dewar
     [not found]       ` <01bd84c3$47215d60$440029a1@m00rq900>
1998-05-21  0:00         ` Matthew Heaney
1998-05-21  0:00         ` Robert Dewar
1998-05-21  0:00         ` Robert Dewar
1998-05-21  0:00           ` Simon Pilgrim
1998-05-21  0:00             ` Matthew Heaney
1998-05-22  0:00               ` Robert I. Eachus
1998-05-22  0:00           ` Rod Chapman
1998-05-22  0:00             ` John McCabe
1998-05-22  0:00           ` Stuart Hutchesson [this message]
1998-05-22  0:00             ` Matthew Heaney
1998-05-23  0:00             ` Robert Dewar
1998-05-21  0:00       ` John McCabe
1998-05-21  0:00         ` Matthew Heaney
1998-05-21  0:00         ` 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