As already reported yesterday, you cannot make the assumption that the size of a structure is equal to the sum of the sizes of its components when the components have different lengths. Rene Brun On Wed, 2 Apr 2003, Huang Xingtao wrote: > For example: > void main() { > struct A{ > unsigned int a; > unsigned int b; > short int c; > }; > cout<<"Size of A:"<<sizeof(A)<<endl; > } > > ----- Original Message ----- > From: "Rene Brun" <Rene.Brun@cern.ch> > To: "Huang Xingtao" <huangxt@hepg.sdu.edu.cn> > Cc: <roottalk@pcroot.cern.ch> > Sent: Tuesday, April 01, 2003 4:47 PM > Subject: Re: [ROOT] About the size of struct in ROOT > > > > Hi, > > > > This may happen because of type alignment. > > Please give an example. > > > > Rene Brun > > > > Huang Xingtao wrote: > > > > > > Part 1.1 Type: Plain Text (text/plain) > > > Encoding: base64 > > I use the Root (3.01/06) package. I meet the following problem. The size of the > > struct gived by ROOT is greater than the sum of size of all the type in the > > struct. I don't know how to calculat it in the ROOT. >
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET