comp.lang.ada
 help / color / mirror / Atom feed
From: dewarr@my-dejanews.com
Subject: Re: Packing Records Using Size Attribute Definitions Clauses
Date: 1998/11/21
Date: 1998-11-21T00:00:00+00:00	[thread overview]
Message-ID: <73589m$pnj$1@nnrp1.dejanews.com> (raw)
In-Reply-To: F2nEKI.3s6.0.-s@inmet.camb.inmet.com

In article <F2nEKI.3s6.0.-s@inmet.camb.inmet.com>,
  stt@houdini.camb.inmet.com (Tucker Taft) wrote:
> 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).


The yes in Tuck's message is wrong here. There has been no
change in the relevant language features between Ada 83
and Ada 95.

Both language definitions recommend against implementations
allowing implicit packing via the size clause, but do not
prohibit this (highly undesirable) behavior.

The difference is that in Ada 95, this implementation
advice is explicit, in Ada 83 it was implicit (deducible
from the intent of the RM, but not explicit. This was
discussed in one of the Ada 83 AI's).

Unfortunately, some Ada 83 compilers unwisely ignored the
relevant AI and allowed this implicit packing with the
result that in some cases you can get expensive implicit
conversions happening, something that Ada was designed to
avoid (that is indeed how you can deduce the intent in
Ada 83 that such implicit packing should not occur!)

In the Ada 95 world, compilers are behaving in a more
reasonable manner. Use pragma Pack if you want to Pack!

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




  reply	other threads:[~1998-11-21  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
1998-11-21  0:00   ` dewarr [this message]
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