Re: Cint

Fons Rademakers (Fons.Rademakers@cern.ch)
Fri, 07 Mar 1997 18:28:09 +0100


everything you type which does not belong to a function ends
up un the global scope. Also, each single line you type
assumes the { } and are placed in the same global scope. Therefore:
TFile f
is the same as
{TFile f}
and ends up in the same global scope as
{ TFile *f=...; delete f;}

Just like macros, that start and end with { }.
Therefore start a macro with gROOT->Reset()
to reset the global scope (actually it exits
and enters the global scope. This means that
the destructors of objects are properly called,
but delete is not called (just like in "real"
C++).

Cheers, Fons.

Jarek Grebieszkow wrote:
>
> On Fri, 7 Mar 1997, Fons Rademakers wrote:
>
> > Hi Jarek,
> >
> > formally what you do is not correct C++. f is first defined as
> > a pointer to a TFile and then in the same scope it is redefined
>
> sure but Cint doesn't obey C++ standards as well. Name scope in Cint
> is not quite clear for me, i.e I can do in C++
> {
> TFile *f=...
>
> delete f;
> }
> TFile f;
> but Cint crashes when I try to do the same thing. That was my point,
> may be my previous example wasn't exactly correct.
>
> Jarek

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7822601