comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcquad@earthlink.net>
Subject: Re: The Incredible Shrinking Type
Date: 2000/11/07
Date: 2000-11-07T00:00:00+00:00	[thread overview]
Message-ID: <3A08092F.E369B323@earthlink.net> (raw)
In-Reply-To: 8u7gte$7ie$1@nnrp1.deja.com

Robert Dewar wrote:
> 
> In article <3A0703F5.9333AE56@earthlink.net>,
>   "Marc A. Criley" <marccriley@earthlink.net> wrote:
> 
> > However, when passing an instance of this type as a parameter
> to a procedure and
> > extracting its 'Size, the result is 64.  What happened to the
> rest of the bits?
> > Granted, they were unused, but still...  Where is this
> behavior addressed by the
> > language (if it is), or is it a freedom granted to compiler
> implementor's?
> 
> You are making the common mistake of confusing the size of
> a type with the size of objects of the type. Specifying the
> size of a type only affects packing and unchecked conversion
> in Ada 95 semantics. It does not determine the size of
> objects of the type, and there is no requirement that the
> size of all objects of the type be the same.

Actually I do understand the distinction between the sizes of a type and
objects of that type. That's been very well beaten into me over the last
couple years.  In my case, I guess there's still been a residual
reluctance to accept that specifying the size of a type only affects
packing and Unchecked_Conversion. Especially since compilers do usually
try to utilize that size (in some way, as demonstrated in the example)
when allocating objects of that type--implying there is a semantic
effect beyond those two areas.

However, today, the last of the residual reluctance has finally been
cleared away...and I do believe! :-)

> 
> So the real issue here is what you have read in the RM that
> implies that the above behavior is expected or not expected.
> Actually asking for more than 64 bits for a scalar type is
> a bit peculiar anyway (and way out of the portable behavior
> required by the RM).
> 

I agree this is a peculiar use.  Fortunately I'm not employing that
technique, I just want to be able to properly and accurately analyze any
such peculiar software that I may come across.

Marc A. Criley
Senior Staff Engineer
Quadrus Corporation




  reply	other threads:[~2000-11-07  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-06  0:00 The Incredible Shrinking Type Marc A. Criley
2000-11-07  0:04 ` Robert Dewar
2000-11-07  0:00   ` Marc A. Criley [this message]
2000-11-07  0:00     ` Robert Dewar
2000-11-07  0:00   ` Nicolas Brunot
2000-11-07  0:00     ` Robert Dewar
2000-11-08  0:00       ` Nicolas Brunot
2000-11-09  5:41         ` Robert Dewar
replies disabled

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