Some macros of mine are being plagued by this rather awkward problem of which I’ve just recently found the problem.
The following macro works fine
void test()
{
if(0)
{
ntuple->get;
}
else
{
cout << "Success" << endl;
}
}
Run it and ROOT returns “Success”. Everything is good.
But if you imbed this same if statement in a loop,
void test()
{
for(Int_t j = 0; j < 5; j++)
{
if(0)
{
ntuple->get;
}
else
{
cout << "Success" << endl;
}
}
}
ROOT returns
Error: non class,struct,union object $ntuple used with . or -> FILE:test.c LINE:9
*** Interpreter error recovered ***
Why does a for loop cause ROOT to look into the statements that shouldn’t be executed?
I know “ntuple->get” doesn’t make any sense, but if you use a more appropriate construction the same problem occurs.
I’m using 4.04/02 on OS X, but the same problem occurs on a PC running an older version of ROOT.
Thanks for any help!