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@cs.nyu.edu (Robert Dewar) Subject: Re: Rules for Representation of Subtypes Date: 1996/09/24 Message-ID: #1/1 X-Deja-AN: 185162583 references: <01bba947$d8990620$188371a5@dhoossr.iquest.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-09-24T00:00:00+00:00 List-Id: I meant to add more on the issue of Size, but accidentally termianted transmission early! One thing we have done in GNAT is the following: First, objects of a subtype by default have the same size as the size of the first subtype, even though Ada 95 does NOT require this, and in fact makes an implementation suggestion to the contrary: 50 If the Size of a subtype is specified, and allows for efficient independent addressability (see 9.10) on the target architecture, then the Size of the following objects of the subtype should equal the Size of the subtype: 51 Aliased objects (including components). 52 Unaliased components, unless the Size of the component is determined by a component_clause or Component_Size clause. We at first followed this advice and found it caused compatibility chaos! So, that's the first point, David's guess as the the behavior of subtypes is in fact corect WITH RESPECT TO OBJECTS in GNAT. This is of course in the absence of a specific attribute representation clause. Second, we have provided two new attributes Value_Size is just like Size in the RM, except that it can be applied to subtypes other than the first subtype. Object_Size is the size that will be used by default for objects of the type or subtype. It need not be the same as Value_Size. The default value of Object_Size is close to what most Ada 83 compilers provided for Size. It can be specified for subtypes other than the first subtype. Value_Size, like Size in the RM, is used for packing and for unchecked conversion, but not much else.