Re: static declaration not working in macro

From: Benjamin Bannier <bbannier_at_gmail.com>
Date: Mon, 16 May 2011 11:10:57 -0400


Hi Adrian,

> Error: Symbol count is not defined in current scope ex.C:7:

CINT is right, `count` is not defined in the scope of `ex()`.

This work like expected:

    Int_t blah ()
    {

      static Int_t count = 0;
      count++;
      cout << count << endl;
      return count;

    }

    void ex ()
    {

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

      cout << result << endl;

    }

Benjamin

Received on Mon May 16 2011 - 17:11:16 CEST

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