Re: Contracted exceptions for Ada



On Tue, 11 Dec 2007 20:50:07 +0000, Simon Wright wrote:

"Dmitry A. Kazakov" <mailbox@xxxxxxxxxxxxxxxxx> writes:

On Mon, 10 Dec 2007 20:25:34 +0000, Simon Wright wrote:

The Ariane IV system engineers said to themselves, and probably in
the design documentation, "The maximum horizontal velocity is
X. Therefore the conversion to the fixed-point type _Whatever_
cannot overflow. Therefore we do not need to handle exceptions for
this conversion, so (given we are short of CPU power) we will not
do any extra processing to avoid exceptions."

Not sure they would have recognised "contract" in that context.

Yes, my premise was that the type of H_Input changed from Ariane IV
to Ariane V. In this case translation of the conversion function
H_Input_To_Whatever could refute the second "therefore" because X
would not be the maximal possible value of H_Input anymore.

X was *never* the maximum possible value of H_Input!

In that case with contracted exceptions, the code without an exception
handler were illegal from the beginning.

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
.



Relevant Pages

  • Re: Contracted exceptions for Ada
    ... the conversion to the fixed-point type _Whatever_ cannot ... Therefore we do not need to handle exceptions for this ... conversion, so we will not do any ... would not make the same mistake while porting the compiler... ...
    (comp.lang.ada)
  • Re: Contracted exceptions for Ada
    ... "The maximum horizontal velocity is ... Therefore the conversion to the fixed-point type _Whatever_ ... do any extra processing to avoid exceptions." ...
    (comp.lang.ada)
  • Re: Is this the Right way TO release COM interface ?
    ... COM compiler support wrappers actually preserve ... It's not so clean to undo the conversion. ... changing the retval parameter to the return type and adding exceptions, then absolutely use the wrapper classes. ... Are you saying that there's an option to request #import to generate code that doesn't translate HRESULTs into exceptions? ...
    (microsoft.public.vc.language)
  • Re: pre-check for string-to-number conversion
    ... > I am reading an ASCII data file and converting some of the strings to ... I know that I can us exceptions, ... > conversion, but I can't figure out how to do it. ... but note that this won't except valid floats like '1e10'. ...
    (comp.lang.python)