Re: Array of TObjArrays

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Mar 16 2000 - 14:35:46 MET


There is a default TObjArray ctor. Look good :-)
(Hint: a ctor where all arguments have defaults is a default ctor).

Why not try gcc 2.9x instead of 2.8.x

Cheers, Fons.


On Thu, Mar 16, 2000 at 08:45:27AM +0100, Damir Buskulic wrote:
> Hi Victor,
> 
> My example worked perfectly until a few days ago when I tried to port it
> to gcc2.8.1.
> I do not see why there is no default constructor in the TObjArray class.
> I thought this was necessary for streaming.
> 
> Damir
> 
> Victor Perevoztchikov wrote:
> > 
> > Hi Damir,
> > I do not see anything wrong in your example.
> > But if you will use TObjArray of TObjArray's then you will not need
> > special Streamer at all.
> > 
> > Victor
> > 
> > Damir Buskulic wrote:
> > >
> > > Hi,
> > >
> > > I have an array of TObjArrays that I want to stream. When I read the
> > > objects back, I have an error :
> > >
> > > Error in <TClass::New>: no default ctor for class TObjArray
> > > Error in <TBuffer::ReadObject>: could not create object of class
> > > TObjArray
> > > Warning in <TExMap::Remove>: key 2560 not found at 45
> > > Warning in <TBuffer::CheckObject>: reference to object of unavailable
> > > class TObjArray, pointer will be 0
> > >
> > > Program received signal SIGSEGV, Segmentation fault.
> > >
> > > This happens in the streamer of a class, here is the excerpt of the
> > > Streamer that does the job :
> > >
> > >       mFDNames = new TObjArray* [mCapacity];
> > >       memset(mFDNames, 0, mCapacity*sizeof(TObjArray*));
> > >       TObjArray* obj;
> > >       for (Int_t i=0; i<mCapacity;i++) {
> > >          R__b >> obj;
> > >          if (obj) mFDNames[i] = obj;
> > >       }
> > >
> > > It happens only on Alpha with gcc 2.8.1, but works fine on Alpha/egcs
> > > and LinuxPPC/egcs. What does this mean ? Should I do something special
> > > before R__b>>obj ?
> > >
> > > Cheers
> > >
> > > Damir
> > > --
> > > =====================================================================
> > > | Damir Buskulic                  | Universite de Savoie/LAPP       |
> > > |                                 | Chemin de Bellevue, B.P. 110    |
> > > | Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
> > > | e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
> > > =====================================================================
> > > mailto:buskulic@lapp.in2p3.fr
> > 
> > --
> > Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch
> > Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
> > tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690
> 
> -- 
> =====================================================================
> | Damir Buskulic                  | Universite de Savoie/LAPP       |
> |                                 | Chemin de Bellevue, B.P. 110    |
> | Tel : +33 (0)450091600          | F-74941 Annecy-le-Vieux Cedex   |
> | e-mail: buskulic@lapp.in2p3.fr  | FRANCE                          |
> =====================================================================
> mailto:buskulic@lapp.in2p3.fr

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET