Re: Fwd: TFile::Open(): distinguish application level and filesystem level errors

From: Thiemo Nagel <thiemo.nagel_at_tum.de>
Date: Wed, 16 Feb 2011 19:57:13 +0100


Dear Fons,

many thanks for your input!

On 02/16/2011 03:48 PM, Fons Rademakers wrote:
> we cannot change the return value of TFile::Open(), it must be either a
> TFile pointer or 0.

I wouldn't be opposed to returning TFile*, but if I read code+documentation correctly, the current return convention is NULL on error and valid (non-zombie) TFile* on success. Returning zombie TFile* might break existing code, is that why you propose to change the signature?

> However, we could change the signature to:
>
> static TFile *Open(const char *name, Option_t *option = "",
> const char *ftitle = "", Int_t compress = 1,
> Int_t netopt = 0, Int_t *fserr = 0);
>
> Would that work for you?

Initially, I had hoped for something simpler, but your proposed solution would work very well. However I wonder if anybody else would find that feature useful. In the mean time, I've implemented a work-around that I can use in my scripts before calling hadd (cf. attachment), this works well enough for me (albeit at some extra cost). So I'm unsure whether it would be worthwhile to go the extra mile to add this capability to TFile::Open(). What do you think?

Cheers,
Thiemo

-- 
+-----------------------------------+--------------------------+
| Dipl.-Phys. Thiemo Nagel          |                          |
| Technische Universitaet Muenchen  | Room    PH1 3276         |
| Physik-Department E18             |                          |
| James-Franck-Strasse              | Phone  +49 89 289-12379  |
| D-85747 Garching                  | Fax    +49 89 289-12570  |
+-----------------------------------+--------------------------+

Received on Wed Feb 16 2011 - 19:57:49 CET

This archive was generated by hypermail 2.2.0 : Wed Feb 16 2011 - 23:50:01 CET