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: mheaney@ni.net (Matthew Heaney) Subject: Valid Attribute and Unchecked Conversion Date: 1996/10/01 Message-ID: #1/1 X-Deja-AN: 186621050 references: <1996Sep26.191257.1@eisner> <52hnvh$li0@wdl1.wdl.lmco.com> <1996Oct1.100608.1@eisner> content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-10-01T00:00:00+00:00 List-Id: In article , Samuel Tardieu wrote: >I don't think that the Valid attribute has been put in the language to >be used after an Unchecked_Conversion, but rather to be used after >calls to imported subprograms and calls to Read attributes (data >coming from a stream). That's odd, because RM95, section 13.9.2 states that "The valid attribute can be used to check the validity of data produced by unchecked conversion,..." Note 19 in that section (of the AARM) states that "invalid data" can be created as "the result of unchecked conversion." Note 20 states that since X'Valid is not considered a read of X, it is not an error the check the validity of invalid data. So it's legal to check (using the valid attribute) the value of a (scalar) object with an invalid representation, right? Given the following program: declare type T is range 1 .. 10; function To_T is new Unchecked_Conversion (Integer, T); O : constant T := To_T (0); begin if O'Valid then ... end; I want to know if the program is correct. Is it erroneous, yes or no? -------------------------------------------------------------------- Matthew Heaney Software Development Consultant mheaney@ni.net (818) 985-1271