Re: ClassDef() Increases class size? + a Question to CINT gurus

Pasha Murat (murat@cdfsga.fnal.gov)
Thu, 20 May 1999 21:59:50 -0500 (CDT)


Peter Lipa writes:
> OK, you are right; there's no complier that gives a struct size of 3 but
> the point is that ROOT/CINT (always?) pads structs to multiples of 8
>
a while ago Masa gave a quite exaustive explanation of how CINT does
alignment in the interpreted code - yesm, CINT aligns everything at 8-byte
boundaries - see

http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk97/0648.html

for details. Regarding the original question in this thread

> I seem to be running into a problem with ClassDef (and ClassImp) increasing
> the size of my class's storage area by about 4 bytes. I am *not* deriving
> from TObject, so the extra bytes are not from there.

ClassDef macro should not increase the size of the object because it only adds
several static functions and one static data member. The observation

> The following code will have a "sizeof()" of 56 instead of the expected 52

most probably reflected the way compiler did the alignment of the structure
in memory. I'd guess that is one more integer were added to the structure
described, sizeof() would still return 56.
regards, Pasha