Hi Robert, In your default constructor (automatically called by ROOT I/O when reading an object), you must preset to 0 all pointers. See several discussions on this subject in roottalk in the past few days. Rene Brun On Fri, 26 Jan 2001, Robert Hatcher wrote: > Rootcint currently completely ignores data members when they have > a trailing comment "//!" which is to indicate that they are temporary > state variables. I think this is a potential problem if this data member > is a pointer and the automagically generated Streamer does *not* fill > this data member and it is left with whatever value happened to be > at that memory location. In the case of pointers the value "0" is > indicative that it points at nothing and the presence of garbage > is generally disasterous. > > Under Unix with the use of libNew this might not be a problem as I > think the memory space may get cleared. (Could someone alleviate my > worries here?) But I would feel much more comfortable if the rootcint > generated streamer explicitly set this field in the case of > R__b.IsReading(). I'd like to propose that rootcint be expanded to: > > //! ignore field on write, zero on read (safety) > //!! ignore field in all cases (speed) > > -robert > > Robert W. Hatcher | rhatcher@slac.stanford.edu > Research Associate | 650.926.3171 [FAX 4001 or 3587] > Stanford University | PO Box 4349, MS #63, Stanford CA 94309 >
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:34 MET