comp.lang.ada
 help / color / mirror / Atom feed
From: "bob" <bklungle@junque.com>
Subject: Re: Packing Records Using Size Attribute Definitions Clauses
Date: 1998/11/21
Date: 1998-11-21T14:37:52-06:00	[thread overview]
Message-ID: <01be158e$fc0e7da0$0e2915c0@w95> (raw)
In-Reply-To: 73589m$pnj$1@nnrp1.dejanews.com

To augment this a little, what Mr. Dewar says is correct. In generating
records for TCP/IP transfer, the VERDIX (Now Rational) Ada83 compiler very
often does implicit compaction both on types and subtypes (surprise). This
led us to quite a few hours of debugging data streams which started one way
and ended up at the other end quite differently.
Thanks for the predictability of the Ada95 implementations, some of these
were found by rebuilding with GNAT and checking the results. Why didn't we
use GNAT in the first place? It didn't exist when we started, but we are
working on this right now.

cheers...bob

dewarr@my-dejanews.com wrote in article
<73589m$pnj$1@nnrp1.dejanews.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
1998-11-21  0:00     ` bob [this message]
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