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/07 Message-ID: #1/1 X-Deja-AN: 187328776 references: <1996Oct1.100608.1@eisner> organization: New York University newsgroups: comp.lang.ada Date: 1996-10-07T00:00:00+00:00 List-Id: iKeith says " A call to an imported function or an instance of Unchecked_Conversion is erroneous if the result is scalar, and the result object has an invalid representation. (To answer someone else's question, applying 'Valid directly to the result of the Unchecked_Conversion is still erroneous. (Note that function results are considered (constant) objects in Ada 95, unlike in Ada 83 where they're just values; one ramification is that you can now rename a function result. (But I digress.)))" Keith is right, this is in the RM, but I think the RM is definitely wrong here. I take part of the blame, I simply did not notice this particular mistake. Obviously for scalar types, unchecked conversion (where the sizes are the same) should not result in erroneous behavior, and a subsequent call to 'Valid should also be non-erroneous. I simply missed this because it is in the wrong section (not under UC). Anyway, certainly GNAT behaves in a sensible manner here, and hopefully all other Ada 95 compilers will too, so this mistake should have only very limited impact.