TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Content-Type: text/plain
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: "Taylor, Bill - UK" <[log in to unmask]>
Date: Mon, 19 Feb 2001 10:53:47 +0100
MIME-Version: 1.0
X-To: "W. Wesley Groleau x4923" <[log in to unmask]>
Reply-To: "Taylor, Bill - UK" <[log in to unmask]>
Parts/Attachments: text/plain (57 lines)
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
pessimistic.

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.


regards
Bill Taylor ( [log in to unmask] <mailto:[log in to unmask]> )
Technical Consultant, Aerospace & Defence Sector
Rational Software Ltd.
Romsey, UK
tel: +44 1794 514388
fax: +44 1794 514448

Visit our web site on www.rational.com <http://www.rational.com>



-----Original Message-----
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
were necessary.

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)

--
Wes Groleau
http://freepages.rootsweb.com/~wgroleau

ATOM RSS1 RSS2