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: dewar@schonberg.cs.nyu.edu (Robert Dewar) Subject: Re: Valid Attribute and Unchecked Conversion Date: 1996/10/05 Message-ID: #1/1 X-Deja-AN: 187743672 references: <3252ED6B.1B74@lmco.com> <53151i$ddd@newsbf02.news.aol.com> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-05T00:00:00+00:00 List-Id: John Herror said "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." This is completely wrong. In both Ada 83 and Ada 95, there is nothing erroneous about unchecked conversion unless an invalid result is produced. The wording from the Ada 83 RM for section 13.10.2 mentions erroneousness only in one place: "Whenever unchecked conversions are used, it is the programmers responsibility to ensure that these conversions maintain the properties that are guaranteed by the language for objects of the target type. Programs that violate these properties by means of unchecked conversions are erroneous." The ACVC 1.11 suite contains a number of uses of unchecked conversion that are required to work on all compilers and are not only NOT erroneous, but are not even implementation dependent. Now it is certainly the case that UC is implementation dependent, and an implementation is allowed to place restrictions. In the case of Ada/Ed, which is what you referred to, unchecked conversion made no sense in the virtual machine used for the implementation, so all UC's were rejected. Later on, Ada/Ed did implement many UC's, including those required by the ACVC suite. Never use the word erroneous casually, it is not a blanket term meaning {undefined, implementation defined, wrong, illegal, inadvisable etc ..} Only a few things in Ada 83 or Ada 95 are erroneous (fewer in Ada 95), and the RM is very careful to document exactly what is and what is not erroneous, so don't go by "I thought" here, read the RM carefully! Note that in Ada 95, more uses of unchecked conversion are non-erroneous, since a program can generate an abnormal value using UC, and then stay non-erroneous as long as only 'Valid is used to query the result. Indeed the Ada 95 section on unchecked conversion (section 13.9) does not mention the word erroneous at all, so an unchecked conversoin BY ITS SELF never makes a program execution erroneous in Ada 95.