Re: [ROOT] tree->Branch problem

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 26 2001 - 15:44:16 MEST


Hi Jacek,

I have substantially simplified your class.
Untar the tar file, then do
  make.it
  root go.C

In the default constructor, you should not allocate new objects, in particular
if these created objects reference the object being created (your case via the
global). Default constructors should just preset the object pointers
and set default values for the members.

Rene Brun


Jacek M. Holeczek wrote:
> 
> Hi,
> > You do not identify which version you use. I assume the production version
> Sorry. I use 3.00/06 on a RH6.1/i386 machine.
> 
> > The constructor should be called only once. Remember that you must pass the
> I think I observe the following :
>         - if the globalWireInfo is == 0, then the constructor is called once
>         - if the globalWireInfo is != 0 and is a pointer to a WireInfo
>           object, then the constructor is NOT called at all
> Can you guarantee somehow that in case globalWireInfo is != 0 the
> constructor will NEVER be called ?
> 
> > address of a pointer, not the pointer itself. In your case, you should do:
> That was my bug, sorry.
> But it's interesting that in this case the constructor was called TWICE.
> 
> Let me ask the question - why do you need the reference to the pointer ?
> This makes the problem that one cannot use "this" there (often "this" is
> not a variable).
> Jacek.




This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:50 MET