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,26a8192d4bd74b0f,start X-Google-Attributes: gid103376,public From: stt@spock.camb.inmet.com (Tucker Taft) Subject: Re: Size Rep clauses on Ada83 vs. Ada95 Date: 1995/03/29 Message-ID: #1/1 X-Deja-AN: 100540689 sender: news@inmet.camb.inmet.com references: organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1995-03-29T00:00:00+00:00 List-Id: Bill Priest (bpriest@ti.com) wrote: : Per 13.2 of Ada Programming Language Reference Manual (MIL-STD-1815a-1983) : " Size specification: T'SIZE : The expression must be a static expression of some integer type. The value : of the expression specifies an upper bound for the number of bits to be : allocated to objects of the type or first named subtype T. This last sentence was effectively overruled by AI-536, even before Ada 9X hit the scene. The official "Ada 83+AIs" rule is now that a size clause specifies a *lower* bound for the number of bits to be allocated to objects of the subtype T. This was for good reason, since the 'size for Standard.Boolean was also specified to be 1 by the same AI, but we all know that it is desirable to give a stand-alone Boolean variable at least a byte on most machines, and probably a whole word on many RISC machines. Since the early days of Ada, there has been a fair amount of disagreement about the proper interpretation of the size clause. Hence, if you want to really control the representation of a record, use a record representation clause, rather than relying on size clauses to do your "dirty" work. We have tried to clarify things a bit in Ada 95, but there is still some controversy about whether a subtype size clause should have a direct effect on stand-alone objects, if the specified size is "relatively" efficient to use. The final Ada 95 reference manual says: If the Size of a subtype is specified, and allows for efficient independent addressibility on the target architecture, then the Size of the folllowing objects of the subtype should equal the Size of the subtype: - Aliased objects (including components) - Unaliased components, unless the Size of the component is determined by a component_clause or Component_Size clause. We believe this wording corresponds pretty closely to the intent of "Ada 83 + AIs," if you ignore the mention of "aliased" (which isn't trivial to do ;-), though well-informed people still differ a bit on that... Hence, the recommendation still stands that to be in complete control, use a record representation clause. Note also that the word "should" rather than "shall" appears in the above citation from RM95, whereas in the rules on record representation clauses, there is no such implementation variability allowed. : Bill -Tucker Taft stt@inmet.com Intermetrics, Inc.