TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
"Taylor, Bill - UK" <[log in to unmask]>
Reply To:
Taylor, Bill - UK
Fri, 16 Feb 2001 16:11:18 +0100
text/plain (67 lines)

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".

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 <>

-----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
> place to discuss technical problems, but I'd appreciate any comment on
> one).
> The program below is a modified snippet of something I have to use. The
> 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]
Chief Technology Officer, AverCom Corporation (A Titan Company)
Burlington, MA  USA (AverCom was formerly the Commercial Division of