comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Packing Records Using Size Attribute Definitions Clauses
Date: 1998/11/19
Date: 1998-11-19T00:00:00+00:00	[thread overview]
Message-ID: <F2nEKI.3s6.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 1998Nov18.230626.16278@nosc.mil

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




  reply	other threads:[~1998-11-19  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-11-18  0:00 Packing Records Using Size Attribute Definitions Clauses Charles H. Sampson
1998-11-19  0:00 ` Tucker Taft [this message]
1998-11-21  0:00   ` dewarr
1998-11-21  0:00     ` bob
1998-11-30  0:00       ` Charles H. Sampson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox