static declaration not working in macro

From: Adrian Sevcenco <Adrian.Sevcenco_at_cern.ch>
Date: Mon, 16 May 2011 17:58:54 +0300


Hi! I try to use a static int to count the number of times a function is called. The example is below:

void ex ()
{

Int_t result = -1;
result = blah();

cout << result << endl;
cout << count << endl;
}

Int_t blah ()
{

static Int_t count = 0;
count++;
return count;
}

root [0]
Processing ex.C...
1
Error: Symbol count is not defined in current scope ex.C:7: (class G__CINT_ENDL)34877216
*** Interpreter error recovered ***

AFAIK count should have been known and printed .. is it something that i am missing? (v5-28-00d)
Thanks,
Adrian

Received on Mon May 16 2011 - 16:59:00 CEST

This archive was generated by hypermail 2.2.0 : Mon May 16 2011 - 17:50:01 CEST