> I've changed your macro (see below).
>
> The corrections were that:
> 1. Each section with TFile declaration was enclosed in the {}.
> It is bad that CINT doesn't print error message 'second
> declaration' for the code {
> TFile file("test.root","recreate");
> TFile file("test.root","update");
> }
> 2. file->ls() is correct only if 'file' is declared as pointer:
> TFile *file = new TFile(...)
> Use file.ls() in the case of TFile file(...)
> Unfortunately CINT doesn't print error message for the code
> {
> TFile file("test.root","recreate");
> file->Close();
> }
> 3. gDirectory->ls() was replaced by file.ls()
> 4. gDirectory->cd() was replaced by file.cd()
> 5. gDirectory->mkdir(...) was replaced by file.mkdir(...)
>
I'd like to mention we are speaking not about but some bugs but
about known features of CINT.
Since CINT knows how the object was created it may treat either
"character" (I mean "." or "->") the proper way according the real
definition of the object /pointer (By the way it would be better all
C++ compiler make users free of this headache too).
I'd like to mention that there is difference between CINT language
and C++ (scope rules, object / pointers id's etc) otherwise
C++ is useless as an "interactive" script language.
See: http://root.cern.ch/root/CintInterpreter.html
"ROOT/CINT Extensions to C++"
Valery
=================================================================
Dr. Valeri Faine (Fine)
------------------- Phone: +1 516 344 7806
Brookhaven National Laboratory FAX : +1 516 344 4206
Bldg. 510A /STAR mailto:fine@bnl.gov
Upton, New York, 11973-5000 http://nicewww.cern.ch/~fine
USA
Dr. Valery Fine Telex : 911621 dubna su
-----------
LCTA/Joint Inst.for Nuclear Res. Phone : +7 09621 6 40 80
141980 Dubna, Moscow region Fax : +7 09621 6 51 45
Russia mailto:fine@main1.jinr.dubna.su