[ROOT] TButton, static variable

From: Dmitriy Bandourine (bandurin@fnal.gov)
Date: Sat May 19 2001 - 06:18:53 MEST


Hi ROOTers,

I create the TButton object by
TButton *b = new TButton("Summary","gROOT->ProcessLine(\".x nnn.C(1,2)\");",0.1,0.8,0.3,0.9);

and define in "nnn.C" script static variable "count":
 
nnn.C(Int_t, Int_t)
{
  static Int_t count = 0;
  cout << "count =" << ++count << endl;

[... omitted ...]
}

Pressing on the button "b" I get "count = 0" (zero) everytime.
But when I call nnn.C from command line:
root [] .x nnn.C(1,2)
root [] .x nnn.C(2,2)

I receive "1", "2" values for count.

Why "count" does not work properly in first case (through the button)?


 - Dmitriy - 



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:45 MET