This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Different Object Model in g++-2.95 and g++-3.3.5?
- From: holderlin <holderlinzhang at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 2 Dec 2005 18:52:49 +0800
- Subject: Different Object Model in g++-2.95 and g++-3.3.5?
Hi, all:
I compiled the following code using g++-2.95:
---------------------------------------------------------------------
#include <iostream>
using namespace std;
class A {
public:
virtual void echo () {};
};
class B: public virtual A {
public:
int b;
virtual void echo () {};
};
int
main()
{
cout << sizeof(A) << endl;
cout << sizeof(B) << endl;
return 0;
}
--------------------------------------------------------------------
The result is:
4
12
If I compile it using g++-3.3.5, the result is:
4
8
So I am wondering whether g++-3.3.5 changes its object model.
-------------------
Holderlin Zhang
Department of Applied Math., Nankai University