I am (finally) trying to understand why my big macro works in Root 5.12,
5.14, and 5.16, but crashes in Root 5.18. Along the way I found this
problem with a static TString:
test1.C:
Generates a syntax error when loaded or executed.
test2.C:
Loads OK and begins execution, printing "TestIt created" followed by a
crash. Also, loading it twice generates a crash (no execution, just two
.L commands in a row).
test3.C:
Illustrates a workaround -- change xxx to be TString*. Loads multiple
times and runs just fine.
Behavior is the same in Root 5.16 and Root 5.18, on Linux (Fedora Core 8). I installed both binary distributions of Root, using a symbolic link to quickly switch versions.
Tom Roberts
// test1.C
class TestIt {
public:
static TString xxx;
public:
TestIt() { printf("TestIt created\n");
}
void test1() { new TestIt(); }
// test2.C
class TestIt {
public:
static TString xxx;
public:
TestIt() { printf("TestIt created\n"); fflush(stdout); xxx = "."; printf("TestIt xxx='%s'\n",(const char *)xxx); fflush(stdout);
}
void test2() { new TestIt(); }
// test3.C
class TestIt {
public:
static TString *xxx;
public:
TestIt() { printf("TestIt created\n"); fflush(stdout); xxx = new TString("."); printf("TestIt xxx='%s'\n",(const char *)*xxx); fflush(stdout);
}
void test3() { new TestIt(); } Received on Tue Apr 22 2008 - 19:22:01 CEST
This archive was generated by hypermail 2.2.0 : Wed Apr 23 2008 - 17:50:02 CEST