TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Content-Type:
TEXT/PLAIN; charset=US-ASCII
Sender:
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Subject:
From:
Jacob Sparre Andersen <[log in to unmask]>
Date:
Fri, 16 Feb 2001 14:31:50 +0100
In-Reply-To:
<"B133ZYWJDSLWO*/R=FBDCVD/R=A1/U=MCCABE JOHN/"@MHS>
MIME-Version:
1.0
Reply-To:
Jacob Sparre Andersen <[log in to unmask]>
Parts/Attachments:
TEXT/PLAIN (44 lines)
John:

If I am not mistaken, then the compilers are allowed to
assume that the result of an unchecked conversion results in
valid data.

> When I run the program, on both Green Hills and
> ObjectAda, with the pragma Suppress commented out, a
> Constraint_Error is raised on the line:
>
>     ZZZ_Control_Data := (Date => (Date, (Month => Control_Data.Month)));

So the problem is:

> begin
>
>     Control_Data     := To_Request_Block (Input_Data);

Ahh, Control_Data is assigned a valid value.

>     ZZZ_Control_Data := (Date => (Date, (Month => Control_Data.Month)));

No problem at all, the subtypes match, so we don't have to
waste time checking for constraint errors.

<looking in the LRM>

13.9(15):

   "The implementation should not generate unnecessary
    run-tme checks to ensure that the representation of S is
    a representation of the target type. ..."

So you might argue that GreenHills and ObjectAda are wrong,
but since they don't check, but just stay aware that the
data may not be a valid representation of the type, the
situation is a bit tricky.

Jacob
--
"There are only two types of data:
                         Data which has been backed up
                         Data which has not been lost - yet"

ATOM RSS1 RSS2