Bizaare non-constant class sizes.
Mike Stump
mrs@windriver.com
Fri May 12 11:46:00 GMT 2000
> Date: Thu, 11 May 2000 21:41:43 -0700
> From: Andrew Over <ajo@acm.org>
> I have a situation in which sizeof(class foo) is 200 bytes in one
> source file, whilst the SAME CLASS is only 192 bytes in a second.
> Nothing internal to the class is of anything other than an intrinsic
> type. Inspection of the preprocessor output of both files shows that
> the classes _ARE_ the same.
I'd bet money you're confused. :-)
Smash the source together (say b is the class def):
file 1:
a
b
c
file 2:
d
b
e
to:
a
d
b
c
e
get rid of unnecessary stuff at the end:
a
d
b
and compile... You will get exactly one size, I am sure of it. In
fact, since you don't need a or d, since you said the whole class
definition only uses intrinsic types, get rid of them first, then get
rid of c and e, as they don't matter, then you are left with two files
with b in them, and they will either not compare to be the same file,
or the resulting output will be the same.
I'm dying of curiosity what the problem was, let me know. I like
understanding these types of issues.
More information about the Gcc-bugs
mailing list