From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4287 invoked by alias); 27 Apr 2004 12:13:33 -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 4274 invoked from network); 27 Apr 2004 12:13:31 -0000 Received: from unknown (HELO smtp-relay-8.adobe.com) (192.150.22.8) by sources.redhat.com with SMTP; 27 Apr 2004 12:13:31 -0000 Received: from inner-relay-3.corp.adobe.com (inner-relay-3 [153.32.251.51]) by smtp-relay-8.adobe.com (8.12.10/8.12.10) with ESMTP id i3RCD86P000091; Tue, 27 Apr 2004 05:13:14 -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 i3RCD3kq003553; Tue, 27 Apr 2004 05:13:04 -0700 (PDT) Received: from mn-eljayet.adobe.com (b-25-196.corp.adobe.com [130.248.25.196]) by iplan-mn.corp.adobe.com (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTP id <0HWT00FYFWLQX3@iplan-mn.corp.adobe.com>; Tue, 27 Apr 2004 07:13:02 -0500 (CDT) Date: Tue, 27 Apr 2004 12:13: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.20040427070648.01f97650@iplan-mn.corp.adobe.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT References: X-SW-Source: 2004-04/txt/msg00350.txt.bz2 Hi Adrian, >I would like to know why the size of class objects grows when virtual inheritance is involved. The structure has extra bookkeeping information to keep track. For example, if you have multiple inheritance of: foo : bar baz : bar quux : foo, baz The memory layout of quux is going to be: bar foo baz quux If you pass a quux to something that expects a baz, that routine would expect: bar baz ...it wouldn't expect a "foo" stuck in the middle. The extra "behind the scenes" bookkeeping information is used to take care of that situation. I do not think that it is a "onevtable" (whatever that is) related issue. HTH, --Eljay