Mon, 19 Feb 2001 10:53:47 +0100
If you have two variables of the same subtype, would you expect an
assignment of one to the other to cause a range check? If a range check is
performed, then there will be a run-time penalty. A careful coder will
ensure that such a situation can never occur, by initialising every variable
and forcing checks after unchecked conversion (via the 'Valid attribute).
For optimization purposes, an implementation is allowed to assume that the
value of a variable is within the range of its subtype. Of course, an
implementation is free to ignore this freedom, or offer a mode in which it
is ignored. It is generally not practical for performance reasons to be so
In Ada83, the execution of such a program would be deemed erroneous and
(legally) anything could happen. In Ada95 a bounded error occurs, because
there are a limited number of sensible behaviours.
Bill Taylor ( [log in to unmask] <mailto:[log in to unmask]> )
Technical Consultant, Aerospace & Defence Sector
Rational Software Ltd.
tel: +44 1794 514388
fax: +44 1794 514448
Visit our web site on www.rational.com <http://www.rational.com>
From: W. Wesley Groleau x4923 [mailto:[log in to unmask]]
Sent: 16 February 2001 16:01
To: [log in to unmask]
Subject: Re: Technical Question
> >I think the relevant section is the LRM section 13.9.1
Just curious. Long, long ago, in a company far, far away,
we were NOT getting constraint error that we thought we
should at an assignment statement.
The vendor's argument was that if you traced back the origin of the right
side far enough, you'd find an unchecked conversion, therefore no checks
Our argument was that the compiler could not trace back that far, since
that would require all the bodies to be compiled at the same time as the
specs, therefore the compiler had no business skipping checks at the
various calls along the way.
Opinions? (not that it matters now)