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,be97e82d84e1ded9 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Packing Records Using Size Attribute Definitions Clauses Date: 1998/11/19 Message-ID: #1/1 X-Deja-AN: 413366466 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <1998Nov18.230626.16278@nosc.mil> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-11-19T00:00:00+00:00 List-Id: Charles H. Sampson (claveman@fern.mil) wrote: : Did something happen between Ada 83 and Ada 95 affecting the abil- : ity to pack a record by using a Size attribute definition clause? This : is not one of the advertised incompatibilities, but I've tried my code : on three Ada 95 compilers and they all reject it. Yes. A size clause is not the way to cause a record to be packed in Ada 95. The pragma "pack" is for that. A size clause is a way to effectively "confirm" that the record is the size you think it should be, or perhaps to pad it out, but it is not the way to shrink it. See RM95 13.3(53). A size clause had an indirect effect of causing packing on some, but not all, Ada 83 compilers. In Ada 95, the pragma Pack is for packing. : ... : But I don't want this post to be a compiler gripe. Would somebody : please point me to the part of the LRM that explains this behavior. If : the issue has already been discussed to death, then a pointer to the : thread on Deja News would be fine. (I've already searched c.l.a using : (size & (attribute | specification | spec)) and haven't found anything.) As mentioned above, RM95 13.3(53) makes it clear that a Size clause is not designed to alter the internal layout of a composite type. If you have the annotated RM, you will find that paragraph 53a suggests the use of pragma Pack, a record_representation_clause for a record, or a component_size clause for an array, to control the internal layout. : Charlie : -- : ****** : For an email response, my user name is "sampson" and my host : is "spawar.navy.mil". -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company