Re: problem updating a root file

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jul 28 1998 - 12:26:38 MEST


Ken Teh wrote:
> 
> On Mon, 13 Jul 1998, Valery Fine wrote:
> 
> > On 13 Jul 98 at 11:27, Alexander Yuryevich Zvyagin wrote:
> >
> >
> > > I've changed your macro (see below).
> > >
> > >
>              .... deleted ....
> 
> Is there a description of the scope rules for Cint?  The html you refer to
> is not very appropriate; it does not address the scope rules directly.
> Basically, I avoid scope problems by structuring my macros appropriately.
> This sometimes creates problems when trying to write modular pieces of
> macros.  It would be nice to have an explanation of the scope rules of Cint,
> so one can proceed with a clear understanding of how it actually works.
> 
> Ken

To be very short:
  - When you execute a macro including one single unnamed function
    {
      // some statements
    }
    this macro is executed in the interpreter global scope. After
    the execution of this macro, all variables created in the macro
are     
    still accessible at the command line. This kind of macro should
    in general starts with the statement
        gROOT->Reset();
    that will reset all CINT variables created since the login stage.

  = When you execute a macro including one or more named functions
    like:
    void example()
    {
      // some statements
    }
    all variables created in example are automatically deleted
    when returning from the function (normal C++ scoping rules).

The first flavour is typical of a short test macro (like a collection
of commands typed at the command line).
The second flavour is recommended for large macros.

Rene Brun



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:35 MET