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: Fri, 16 Feb 2001 16:11:18 +0100
MIME-Version: 1.0
Reply-To: "Taylor, Bill - UK" <[log in to unmask]>
Parts/Attachments: text/plain (67 lines)
John

You could always look at the value of Control_Data.Month'Valid to check that
Unchecked_Conversion has yielded a valid value. The attribute was added in
Ada95 precisely becuase you couldn't rely on compilers to perform a range
check. If they did, then the Unchecked_Conversion wouldn't be "unchecked".


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: Tucker Taft [mailto:[log in to unmask]]
Sent: 16 February 2001 14:02
To: [log in to unmask]
Subject: Re: Technical Question


[log in to unmask] wrote:
>
> I have a bit of a dilemma that I was hoping some of you may be able to
shed some
> light on. It is in relation to the program below (I know this isn't really
the
> place to discuss technical problems, but I'd appreciate any comment on
this
> one).
>
> The program below is a modified snippet of something I have to use. The
problem
> I have is that I have access to 4 compilers, namely Apex, Green Hills,
GNAT and
> ObjectAda that I have used to compile the code. All of them are quite
happy to
> compile the program, but I need to know whether I should be reporting this
as a
> bug to the supplier of the code, or the compiler vendors!

The unchecked conversion has produced a record whose Month component
has an "invalid representation" (see RM95 13.9.1(9)).
Evaluating the value of that component is a bounded error,
and Program_Error or Constraint_Error can be raised, or the
execution can continue using this invalid representation.

So the compilers you have are conforming to the standard, but
they happen to be choosing different alternatives among the 3 mentioned
in 13.9.1(9).  So this program has a bounded error, and
should be fixed unless you like the current implementation-dependent
behavior  ;-).


--
-Tucker Taft   [log in to unmask]   http://www.averstar.com/~stt/
Chief Technology Officer, AverCom Corporation (A Titan Company)
Burlington, MA  USA (AverCom was formerly the Commercial Division of
AverStar:
http://www.averstar.com/services/ebusiness_applications.html)

ATOM RSS1 RSS2