comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <nick.roberts@acm.org>
Subject: Re: Zero length Objects
Date: Tue, 06 Jul 2004 12:59:04 +0100
Date: 2004-07-06T12:59:04+01:00	[thread overview]
Message-ID: <opsapswqnop4pfvb@bram-2> (raw)
In-Reply-To: mailman.7.1089111829.416.comp.lang.ada@ada-france.org

On Fri, 02 Jul 2004 10:30:18 +0200, Christoph Karl Walter Grein  
<AdaMagica@web.de> wrote:

> There are types needing no space, but objects cannot have zero size.

I don't want to go round in circles, but I think the situation can be  
summarised thus:

* In C and C++, a member of a struct or class can be of zero size, but  
otherwise an object (variable or constant) cannot be of zero size  
(allocated no space in memory).

* In Ada, any object can be of zero size (allocated no space), except that  
if an aliased object has zero size, and there is an access value  
referencing it, either the access value might not be distinguishable from  
an access value referencing another object, or the compiler must implement  
special code to enable such access values to be distinguished.

Some Ada compilers avoid the above problem by making all aliased objects  
of a zero size subtype have a nonzero (allocated) size. I'm in favour of  
the special code.

Some Ada compilers simply ignore the problem (permitting access values to  
be indistinguishable). It is my contention (and I think I have some  
support for it :-) that this contravenes the RM 95, although this is being  
pedantic.

I think the majority of the ARG are going to fix the wording in the RM  
2005 to allow an implementation's access values to compare equal if they  
designate different objects one of which is of zero size (or both are),  
provided neither access value is null (they /must/ compare equal if they  
are both null). Personally, I disagree with this fix.

-- 
Nick Roberts



  reply	other threads:[~2004-07-06 11:59 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02  8:30 Zero length Objects Christoph Karl Walter Grein
2004-07-06 11:59 ` Nick Roberts [this message]
2004-07-06 22:14   ` Randy Brukardt
2004-07-06 22:28     ` Nick Roberts
  -- strict thread matches above, loose matches on Subject: below --
2004-06-30  5:55 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
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
replies disabled

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