Re: [ROOT] 0x0 = TFile::Open()

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Dec 08 2003 - 14:55:18 MET


Hi Martin,

 this is a feature. If TFile::Open() returns 0 there was a failure. Note
that a ctor always returns an object hence the need for a check like
IzZombie(), but a static method like Open() already performs this check
and returns 0.

Cheers, Fons.



On Mon, 2003-12-08 at 14:04, Martin Schulte-Wissermann wrote:
> hi all,
>  just installed v3.10.01 and encountered a problem with :
> 
> root [0] TFile* f = TFile::Open("nothere.root")
> Error in <TFile::TFile>: file nothere.root does not exist
> root [1] f
> (class TFile*)0x0  <=====!!
> 
> same behaviour in compiled code.
> is this a feature?
> i wonder, because it prohibits to call IsOpen() or IsZombie.
> 
> ps: if i use f = new TFile(...) everything seems ok.
> 
> cheers,
>  martin
> 
> (v3.10.01, gcc2.9?)
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://www.rademakers.org/fons/      Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:17 MET