From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45a9122ddf5fcf5 X-Google-Attributes: gid103376,public From: Karl Cooper {46901} Subject: Re: Valid Attribute and Unchecked Conversion Date: 1996/10/04 Message-ID: <32550731.167EB0E7@swl.msd.ray.com>#1/1 X-Deja-AN: 187521050 references: <3252ED6B.1B74@lmco.com> <53151i$ddd@newsbf02.news.aol.com> content-type: text/plain; charset=us-ascii organization: Raytheon Electronic Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0 (X11; I; SunOS 4.1.4 sun4m) Date: 1996-10-04T00:00:00+00:00 List-Id: John Herro wrote: > > I could be wrong, but I thought that Unchecked_Conversion is erroneous in > _any_ case. I heard that the first validated Ada compiler, Ada/Ed, took > advantage of that fact and generated code to raise Program_Error wherever > the program tried to make use of Unchecked_Conversion. > > Is this true, and if so, has any of it changed with Ada 95 and the new > 'Valid attribute? > No, see the Ada83 reference manual 13.10, and the Ada95 reference manual 13.9 and 13.9.1. Unchecked_Conversion leads to erroneous behavior in some cases, but not in others. In my opinion, the Ada95 reference manual is clearer when describing the safe uses of Unchecked_Conversion. What is true is that an implementation is permitted to place restrictions on the use of Unchecked_Conversion. These should be documented in one of the Appendices which describes the implementation-dependent things defined by the implementation, of course. Again, the Ada95 reference manual gives more insight into what sort of restrictions might be expected, as well as what support for Unchecked_Conversion is recommended to implementors. Because of the additional detail provided in the Ada95 LRM about the safe uses of Unchecked_Conversion, I would suspect that a validation suite could be created which would cause the behavior you describe (unconditional Program_Error for each call to Unchecked_Conversion) to be a failure of the valildation. -- Karl T. Cooper Senior Software Engineer Raytheon Electronic Systems ktc@swl.msd.ray.com