Subject: | |
From: | |
Reply To: | |
Date: | Fri, 16 Feb 2001 14:31:50 +0100 |
Content-Type: | TEXT/PLAIN |
Parts/Attachments: |
|
|
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"
|
|
|