From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,MSGID_SHORT autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 14 Nov 91 16:45:46 GMT From: ajpo!dlehman@sei.cmu.edu (Danford Lehman) Subject: Re: 'SIZE attribute of a type Message-ID: <811@ajpo.sei.cmu.edu> List-Id: In article 6171, Robert Parkhill answers Donald Gardner's query re why his compiler's CHARACTER'SIZE = 8 vs. 7; the following excerpt from Commentary AI-00536, which is ARG & WG9 approved, addresses the points raised by the two articles and shows part of Mr. Parkhill's response to be incorrect. Whether there will be any further change to the Ada83 ACVC test suite in order to check for recently resolved representation issues is in question --validation testing for Ada83 implementations might have ceased (i.e., no new ACVC, no successive validation cycle--certificates extended 'til 1994!). Under the current test suite, ACVC 1.11, some implementations indeed did not have BOOLEAN'SIZE = 1 and thus failed some tests (they were advised of the Commentary and not permitted these failures, and so presumably they changed their attribute's value). ---Dan LEHMAN -------------- * ------------------------------------------------------------------------------- The meaning of 'SIZE applied to a type, subtype, or object AI-00536/08 1 90-07-06 BI WA | !standard 13.07.02 (05) 90-07-06 AI-00536/08 !standard 13.02 (05) !class binding interpretation 88-11-08 | !status WG9-approved 90-06-15 !status ARG-approved 89-10-25 (reviewed) !status ARG-approved (8-0-1) 89-06-14 (pending editorial review) !status ARG-approved (10-0-0) 89-02-28 (pending editorial review; ballot) !status work-item 89-01-30 !status received 87-04-13 !references AI-00551, AI-00554, AI-00555, AI-00561, AI-00825, 83-00914, 83-00965, 83-00994, 83-00997, 83-01023, 83-01024 !topic The meaning of 'SIZE applied to a type, subtype, or object !summary 89-07-28 'SIZE applied to an object yields the number of bits allocated for the object. (This number may include padding bits that are part of the stored value.) (See AI-00825 for the value of 'SIZE applied to an object of an unconstrained subtype with discriminants.) If the size of a type or a first named subtype T has been specified by a length clause, then T'SIZE yields the specified size, and the size of every subtype of T is also this value. If the size of a type or a first named subtype has been specified by a length clause, then an object of the type or any of its subtypes is allocated at least the specified number of bits, unless the object is a component of a record and the component's size has been determined by a record component clause (see AI-00551). (Hence, every object of such a type has at least the specified size except when a smaller size has been determined explicitly by a record component clause.) 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. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ An implementation shall describe, in Appendix F, how the value of 'SIZE is determined for objects, types, and subtypes. [...under !discussion ...] In effect, the recommendation requires that 'SIZE for a subtype (other than an unconstrained array subtype or an unconstrained subtype with discriminants) yield a value that is the smallest amount of space allocated for an object of that subtype in a packed array or a packed record. This requirement is consistent with the role of the SIZE attribute when specifying the effect of pragma PACK on arrays and records (see AI-00554 and AI-00555). # Since it is intended that pragma PACK for boolean arrays produce a # representation with no gaps between components (see AI-00555), BOOLEAN'SIZE # is specified to be one. Similarly, since pragma PACK is applied to the # predefined type STRING, CHARACTER'SIZE must at least equal the number of bits # allocated for a component of an object having type STRING. If a component of # type CHARACTER in a packed record can be allocated only seven bits, then # CHARACTER'SIZE would equal seven even if eight bits are used for components # in objects of type STRING (see AI-00555). No size is specified for the # CHARACTER type so an implementation is allowed to decide how closely # components of type CHARACTER are packed in STRINGs. [...] ===============================================================================