From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18971 invoked by alias); 27 Jan 2002 07:52:48 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 18938 invoked from network); 27 Jan 2002 07:52:46 -0000 Received: from unknown (HELO dberlin.org) (64.246.6.106) by sources.redhat.com with SMTP; 27 Jan 2002 07:52:46 -0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by dberlin.org (8.11.6/8.11.6) with ESMTP id g0R7qbn07125; Sun, 27 Jan 2002 02:52:37 -0500 Date: Sun, 27 Jan 2002 05:34:00 -0000 From: Daniel Berlin To: Mark Mitchell cc: Joe Buck , Neil Booth , Paolo Carlini , "gcc@gcc.gnu.org" Subject: Re: g++ and aliasing bools In-Reply-To: <60320000.1012111268@gandalf.codesourcery.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2002-01/txt/msg01747.txt.bz2 On Sat, 26 Jan 2002, Mark Mitchell wrote: > > The argument can be extended to handle non-virtual single or multiple > > inheritance: from the C point of view, > > This isn't obvious yet. > > You have to at least discuss zero-sized base classes and whether or not > GNU C handles them in the same way -- including cases like this: > > struct A {}; > struct B : public A {}; > struct C : public A {}; > struct D : public B, C {}; > > Here, D has size two to avoid having two A's at the same address. > If C did not derive from A, D would have size one. In GNU C, does: > > struct A {}; > struct B { struct A __base1; }; > struct C { struct A __base1; }; > struct D { > struct B __base1; > struct C __base2; > }; > > have size two? > No, it has size 0. > Does the variant where C is empty have size 1? Nope. However, this will just cause us to be more conservative than necessary. We'll think they have the same address, and thus, alias, rather than say they *don't* alias. Right? --Dan