comp.lang.ada
 help / color / mirror / Atom feed
* Packing Records Using Size Attribute Definitions Clauses
@ 1998-11-18  0:00 Charles H. Sampson
  1998-11-19  0:00 ` Tucker Taft
  0 siblings, 1 reply; 5+ messages in thread
From: Charles H. Sampson @ 1998-11-18  0:00 UTC (permalink / raw)


     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.

     Here are the details.  The components of the record are numeric 
(integer and fixed-point), with one exception.  The types of the numeric 
components have size attribute clauses specifying either 16 bits or 32 
bits, with two exceptions.  The two exceptional numeric component types 
have size attribute clauses specifying 7 and 9 bits and the correspond-
ing components are consecutive in the source.  The non-numeric component 
is of a record type and this type has a representation specification and 
a size attribute clause that specifies it as 16 bits.  The minimum size 
for the big record type (the one I'm having a problem with) is 464 bits.  
It has a size attribute clause for this size.  Everything sails through 
our Ada 83 compiler.

     GNAT, ObjectAda, and Green Hills are all unhappy with this, claim-
ing that 464 bits is not enough, although they don't agree on how many 
bits are needed.  However, when I throw in a record representation 
specification that maps the components in the obvious fashion (leaving 
in the size attribute clause), all three compilers are happy.

     Maybe I'm being naive, but if the representation is legal 
shouldn't at least one of the compilers have found it on its own?  At 
the very least, why should they be telling me that 464 bits are not 
enough when all you have to do is add up the lengths of the components?

     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.)

				Charlie
--
******

     For an email response, my user name is "sampson" and my host
is "spawar.navy.mil".




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-11-30  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-18  0:00 Packing Records Using Size Attribute Definitions Clauses Charles H. Sampson
1998-11-19  0:00 ` Tucker Taft
1998-11-21  0:00   ` dewarr
1998-11-21  0:00     ` bob
1998-11-30  0:00       ` Charles H. Sampson

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