RE:CINT bug in 2.22/09 (constructors for me

Masaharu Goto (MXJ02154@nifty.ne.jp)
Fri, 16 Jul 1999 21:51:39 +0900


Dear Rooters,

Jonathan M. Gilligan reported a const data member related bug.
In my previous response, I thought I fixed this. But it tuned out that
there is more story here. There are 2 conflicting needs.

class A {
public:
const char* str; // 1. const that is initialized for each object
A() : str("abc") { }
const int N = 5; // 2. static const
f() {
int ary[N];
}
};

Unfortunately, I can not support both cases. I'd like to take case 1.
over 2. If you want to do something like this, you have to explicitly
declara N as static.

class A {
public:
const char* str; // 1. const that is initialized for each object
A() : str("abc") { }
static const int N = 5; // 2. static const
f() {
int ary[N];
}
};

This change will be done in cint5.14.9 which goes back to cint5.14.1
in this regard.

Thank you
Masaharu Goto

======================= begin code snippet ===================================
// file: test.cpp
static const char *default_string = "default";

class foo
{
public:
foo();
protected:
const char *str;
};

foo::foo() : str(default_string)
{
printf("foo::foo() : default_string = \"%s\", "
"str = \"%s\"\n",default_string,str);
if (str == NULL)
printf("str = NULL\n");
}

void test()
{
foo * pFoo = new foo();
}
======================= end code snippet ===================================