comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Zero length Objects
Date: Fri, 02 Jul 2004 01:06:58 GMT
Date: 2004-07-02T01:06:58+00:00	[thread overview]
Message-ID: <Sy2Fc.1723$oD3.638@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <2kioovF2rj2qU1@uni-berlin.de>

Nick Roberts wrote:

> As far as I am aware, the Ada standard permits types, subtypes, and
> objects of zero size. I think that X'Size must return 0 if it has
> been set to 0 (by a representation clause) for any subtype or object
> X, but there is nothing in the standard to prevent objects of zero
> size being allocated more than zero bits when they are allocated in
> memory (and I gather this is what many compilers actually do).

The 'Size of an object need not be the same as the subtype 'Size. For
example, on many systems, Integer'Size = 32, Natural'Size = 31. For

N : Natural;

N'Size is usually 32. 31 comes into play in situations such as packed types.

Similarly, for

type Size_2 is (One, Two, Three, Four);
for Size_2'Size use 2;

S : Size_2;

S'Size is usually 8.

-- 
Jeff Carter
"I'm a lumberjack and I'm OK."
Monty Python's Flying Circus
54




  reply	other threads:[~2004-07-02  1:06 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-30  5:55 Zero length Objects Robert C. Leif
2004-06-30 20:32 ` Jacob Sparre Andersen
2004-06-30 21:01 ` Frank J. Lhota
2004-07-01  0:02   ` Nick Roberts
2004-07-01  1:28     ` Georg Bauhaus
2004-07-01 10:37       ` Björn Persson
2004-07-01 11:25     ` Larry Kilgallen
2004-07-01 14:11       ` Nick Roberts
2004-07-01 15:42         ` Larry Kilgallen
2004-07-01 14:06     ` Xenos
2004-07-01 15:26       ` Nick Roberts
2004-07-02  1:06         ` Jeffrey Carter [this message]
2004-07-01  0:47   ` Brian May
2004-07-01 13:32     ` Frank J. Lhota
2004-07-01 14:52       ` Nick Roberts
2004-07-01 15:03         ` Xenos
2004-07-01 15:57           ` Hyman Rosen
2004-07-01 16:05             ` Xenos
2004-07-02 15:02               ` Frank J. Lhota
2004-07-02 15:11                 ` Adrian Knoth
2004-07-02 15:43                   ` Frank J. Lhota
2004-07-02 19:01                     ` Vinzent 'Gadget' Hoefler
2004-07-02 19:07                       ` Adrian Knoth
2004-07-02 19:25                         ` Vinzent 'Gadget' Hoefler
2004-07-02 21:06                           ` Xenos
2004-07-02 21:56                             ` Vinzent 'Gadget' Hoefler
  -- strict thread matches above, loose matches on Subject: below --
2004-07-02  8:30 Christoph Karl Walter Grein
2004-07-06 11:59 ` Nick Roberts
2004-07-06 22:14   ` Randy Brukardt
2004-07-06 22:28     ` Nick Roberts
replies disabled

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