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: Ken Garlington Subject: Re: Rules for Representation of Subtypes Date: 1996/10/01 Message-ID: <32515744.3B83@lmtas.lmco.com>#1/1 X-Deja-AN: 186558385 references: <1996Sep26.191257.1@eisner> <52hnvh$li0@wdl1.wdl.lmco.com> <1996Oct1.100608.1@eisner> content-type: text/plain; charset=us-ascii organization: Lockheed Martin Tactical Aircraft Systems mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.02 (Macintosh; I; 68K) Date: 1996-10-01T00:00:00+00:00 List-Id: Samuel Tardieu wrote: > > >>>>> "Larry" == Larry Kilgallen writes: > > Larry> So can someone give an example of how Z'Valid _might_ be useful > Larry> after an unchecked conversion, as seems to be indicated by the > Larry> Reference Manual. > > 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). I don't know much, but I do know this: I specifically wrote a revision request to Ada 83 to handle the following situation: type Foo is range 1 .. 10; X: Foo; -- assume that this takes up a storage unit with a range -- greater than 1 .. 10 ... Read(X); -- some I/O operation, unchecked conversion, whatever -- that might put a bit pattern in X that is not in 1 .. 10 if X in Foo then raise Some_Exception; -- rarely works in Ada 83 due to optimization end if; I thought one of the important uses of X'Valid was to be able to test for a legal bit pattern, and never mind the optimizations. If it doesn't work, then why did I go to all the trouble to write the RR? -- LMTAS - "Our Brand Means Quality"