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

From: Pasha Murat (murat@cdfsga.fnal.gov)
Date: Fri May 21 1999 - 04:59:50 MEST


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



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:33 MET