public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* solaris inheritance issue
@ 2001-02-16 12:58 Alan Gonzalez
  0 siblings, 0 replies; only message in thread
From: Alan Gonzalez @ 2001-02-16 12:58 UTC (permalink / raw)
  To: gcc-help

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-16 12:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-16 12:58 solaris inheritance issue Alan Gonzalez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).