comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Are there any automatic tools to convert ada83 source into ada95?
Date: 1998/12/30
Date: 1998-12-30T00:00:00+00:00	[thread overview]
Message-ID: <wccogolwoj1.fsf@world.std.com> (raw)
In-Reply-To: 87n247z2yk.fsf@mihalis.ix.netcom.com

Chris Morgan <mihalis@ix.netcom.com> writes:

> robert_dewar@my-dejanews.com writes:
> > To be clear on this point, this was highly dubious code
> > in Ada 83, since Ada 83 compilers were allowed to raise
> > Constraint_Error instead of Numeric_Error in any situation.
> 
> Right, but ours didn't.

To clarify Robert's point: there are many situations in Ada 83 where
something can raise either Constraint_Error or Numeric_Error.  It's not
that some compilers might be sloppy, and fail to distinguish two
different situations.  It's that the different situations are genuinely
indistinguishable.

You gave one example:

> Yep, you guessed it, someone did an abs() of -32768

    type T is range -32768..-32767;
    X: T := -32768;
    ...
    X := abs(X);

According to the Ada 83 RM, the above statement might raise either C_E
or P_E.  Any code that tries to distinguish the two is, as Robert said,
"dubious".

In Ada 95, it raises C_E (and P_E is just a renaming of C_E).

A good style in Ada 83 was to always pair the two: "when C_E | P_E =>
...".  The Ada 95 rules are carefully crafted to make that idiom
still be legal.

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1998-12-30  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-28  0:00 Are there any automatic tools to convert ada83 source into ada95? changweimin
1998-12-28  0:00 ` Tucker Taft
1998-12-28  0:00   ` Chris Morgan
1998-12-29  0:00     ` robert_dewar
1998-12-29  0:00       ` Chris Morgan
1998-12-30  0:00         ` Robert A Duff [this message]
1998-12-31  0:00           ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1998-12-28  0:00 changweimin
replies disabled

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