From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18474 invoked by alias); 7 May 2004 20:30:20 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 18467 invoked from network); 7 May 2004 20:30:20 -0000 Received: from unknown (HELO smtp-relay-7.sea.adobe.com) (192.150.22.7) by sourceware.org with SMTP; 7 May 2004 20:30:20 -0000 Received: from inner-relay-3.corp.adobe.com (inner-relay-3 [153.32.251.51]) by smtp-relay-7.sea.adobe.com (8.12.10/8.12.10) with ESMTP id i47KUHSP015125; Fri, 7 May 2004 13:30:17 -0700 (PDT) Received: from iplan-mn (iplan-mn.corp.adobe.com [130.248.25.5]) by inner-relay-3.corp.adobe.com (8.12.9/8.12.9) with ESMTP id i47KUBkq027761; Fri, 7 May 2004 13:30:11 -0700 (PDT) Received: from mn-eljayet.adobe.com ([130.248.178.4]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0HXD006832A7WK@iplan-mn.corp.adobe.com>; Fri, 07 May 2004 15:30:09 -0500 (CDT) Date: Fri, 07 May 2004 20:30:00 -0000 From: Eljay Love-Jensen Subject: Re: sizeof with virtual inheritance In-reply-to: X-Sender: eljay@iplan-mn.corp.adobe.com To: Adrian Sandor , gcc-help@gcc.gnu.org Message-id: <6.0.3.0.2.20040507151558.020039d8@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: <6.0.3.0.2.20040427070648.01f97650@iplan-mn.corp.adobe.com> X-SW-Source: 2004-05/txt/msg00081.txt.bz2 Hi Adrian, >Your comments apply generally to multiple inheritance, you didn't say anything about virtual inheritance. No, my comments were specifically about virtual inheritance. Look at the memory layout of c4, which is 8 bytes: c4 : byte[0 ... 3] c4.c1 : byte[4] c4.pad : byte[5 ... 7] Those [0 ... 3] four bytes for the c4 portion (alone) of c4 contains the pointer for the multiple inheritance overhead. - - - - - - Look at the memory layout of c6, which is 2 bytes: c6.c2.c1 : byte[0] c6.c2.c3.c1 : byte[1] Nothing interesting here. Straightforward. - - - - - - Look at the memory layout of c7, which is 12 bytes: c7.c4 : byte[0 ... 3] c7.c5. : byte [4 ... 7] c7.c4.c1 & c7.c5.c1 : byte[8] c7.pad : byte[9 ... 11] The [0 ... 3] four bytes for the c7.c4 portion (alone) contains the c4 pointer for the multiple inheritance. The [4 ... 7] four bytes for the c7.c5 portion contains the c5 pointer for the multiple inheritance. The padding is alignment padding. HTH, --Eljay