Hello,.. correct me, if I am wrong,.. but as far as I remember a struct is nothing else than a class with public members?!?... so the struct is a class,.. or do you refer to "root classes" (ClassDef, ClassImp)? Cheerio, Selim Rene Brun wrote: > > Hi Selim, > This is an alignment problem and it is machine dependent. > When you use a class instead of a struct, rootcint can generate the > appropriate code (class::ShowMembers) to compute the relative offsets of > data members with respect to the pointer to the object. > With struct, the only thing that we can do is to assume that the > compiler > will store in memory the struct items serialy like in the struct > definition. > However, most compilers, for performance reasons, will do the alignment > to a 4 or even 8 bytes boundary (the longest element in the struct). > You SHOULD NOT use a struct as input for a branch if the struct contains > members of different sizes. > Use a class instead. This has the additional advantage that the element > names and types are known and the branch definition will be simpler. > > Rene Brun > -- Selim Issever | Tel: 040 8998-2843 +- C++ -- The language in which - DESY-F15 | Fax: 040 8998-4033 +- only friends can access your - Notkestr. 85 | selim.issever@desy.de +- private members. -- Anon. ---- 22603 Hamburg/Germany | http://www.physik.uni-dortmund.de/~issevers
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:42 MET