comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: 'Size of an object
Date: Tue, 11 Sep 2012 11:11:44 -0700 (PDT)
Date: 2012-09-11T11:11:44-07:00	[thread overview]
Message-ID: <b8a1224d-df77-4dae-83f2-b1382508011c@googlegroups.com> (raw)
In-Reply-To: <97ff13ad-308a-416f-a300-6c7d9da3d71b@googlegroups.com>

On Tuesday, September 11, 2012 5:52:03 PM UTC+2, Adam Beneschan wrote:
> The question has to do with X'Size where X is an object.  RM 13.3(40)
> says this "denotes the size in bits of the representation of the
> object".  Maybe I'm being dense, but this doesn't seem to clarify
> things.
> 
> Suppose you have an enumeration type with eight literals, and no other
> representation or aspect clauses apply to the type:
> 
>    type Enum is (E0, E1, E2, E3, E4, E5, E6, E7);
> 
> I think Enum'Size should be 3 in most or all implementations.
It must be 3.
Take Integer, for instance. For the subtype Natural'Size = Integer'Size -1,
because it doesn't need the sign bit. This was a much disputed decision during
the Ada9X process (Ada 83 compilers had different values for 'Size, and Ada9X
fixed this - it was on Tucker Taft's vote IIRM). GNAT implemented therefore the
'Object_Size attribute.

Now stand-alone objects normally have a size fitting in a standard word
depending on the OS. The RM says, T'Size is used for objects in packed records
and Unchecked_Conversion only.



  parent reply	other threads:[~2012-09-11 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 15:52 'Size of an object Adam Beneschan
2012-09-11 16:20 ` Micronian Coder
2012-09-11 16:21 ` Vasiliy Molostov
2012-09-11 16:27 ` Dmitry A. Kazakov
2012-09-11 16:28 ` björn lundin
2012-09-11 17:07 ` Shark8
2012-09-11 18:11 ` AdaMagica [this message]
2012-09-11 22:21   ` Adam Beneschan
replies disabled

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