This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
solaris inheritance issue
- To: gcc-help at gcc dot gnu dot org
- Subject: solaris inheritance issue
- From: Alan Gonzalez <agonzalez at yahoo dot com>
- Date: Fri, 16 Feb 2001 12:57:58 -0800 (PST)
- Reply-To: alan_gonzalez at iname dot com
Hi, I just recently happened upon an oddity in gcc when compiling a simple
inheritance tree.
I had been using gcc version 2.95.2 19991024 (release) and just tried gcc
version 2.95.3 20010125 (prerelease) to see if anything has changed, but same
situation occurs.
Say we have test.cc file:
#include <stdio.h>
class foo {
};
class mefoo : foo {
double foo;
};
int main() {
mefoo tmp;
printf("%d",sizeof(tmp));
}
on linux with gcc-2.95.2 i get a size of 8
on solaris with sunsoft 5.0 compilers i get a size of 8.
This is what i expect. but...
on solaris with gcc-2.95.2 i get a size of 16 ??
If i get rid of the inheritance of mefoo from foo, then gcc on solaris reports
the size as being 8. So i'm confused. For some reason the inheritance makes
the size go from 8 to 16. I tried poking around and seeing what was going on,
but didn't really know what i was looking for.
Has anyone see this or has a theory? It's strange since the sunsoft 5.0
compiler deals with this the way i expect. Thanks.
Alan
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/