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: Re: Rules for Representation of Subtypes Date: 1996/09/26 Message-ID: #1/1 X-Deja-AN: 185592825 references: <01bba947$d8990620$188371a5@dhoossr.iquest.com> content-type: text/plain; charset=ISO-8859-1 organization: Estormza Software mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-09-26T00:00:00+00:00 List-Id: In article , kst@thomsoft.com (Keith Thompson) wrote: >The Ada 83 reference manual's description of the 'Size attribute is >rather vague. AI-00536 was an attempt to clarify this description. >Among other things, it says: > > If the size of a type or a subtype S has not been determined by > a length clause and S is either a scalar subtype, a constrained > array subtype, a constrained subtype with discriminants, an > access type, a task type, or a private type whose full type is > one of these types, then S'SIZE yields the smallest number of > bits that an implementation will allocate for an object declared > with the subtype indication S; objects whose size is determined > by a record component clause are not considered in determining > the value of S'SIZE. > > For the predefined type BOOLEAN, BOOLEAN'SIZE is one. > >In other words, the 'Size for a subtype is the smallest size that can be >allocated for an object of that subtype, including standalone objects >and components of (possibly packed) arrays and records, but excluding >components affected by record component clauses. Yes, but what's even more interesting is a preceding paragraph of that AI which states: "If the size of a type of a first named subtype T has been specified by a length clause, the T'Size yields the specified size, AND THE SIZE OF EVERY SUBTYPE OF T IS ALSO THIS VALUE [my emphasis]." If my interpretation is correct (I'm waiting for an opinion, Bob...), then this would solve my original problem, which was type Integer_32 is ...; for Integer_32'Size use 32; subtype T is Integer_32 range 0 .. 255; O : T; According to the AI, object O should occupy 32 bits, not 8. Right? >Keith Thompson (The_Other_Keith) kst@thomsoft.com matt -------------------------------------------------------------------- Matthew Heaney Software Development Consultant mheaney@ni.net (818) 985-1271