From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,85c4b961f840b5ab X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: Zero length Objects Date: Tue, 06 Jul 2004 12:59:04 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de AU/wOHcfL4/ilYpxxZwBagqqnBr0VzKa9sAg+CzBTjY0xZmec= User-Agent: Opera M2/7.51 (Win32, build 3798) Xref: g2news1.google.com comp.lang.ada:2084 Date: 2004-07-06T12:59:04+01:00 List-Id: On Fri, 02 Jul 2004 10:30:18 +0200, Christoph Karl Walter Grein 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