D
Damien Cymbal
Sorry, don't have a copy of the standard handy anywhere. Given this:
// header
class Test
{
public:
Test() {}
~Test() {}
private:
static const string strings[];
static const string STR1;
static const string STR2;
};
// impl
const string Test::STR1("String #1");
const string Test::STR2("String #2");
const string Test::strings[] =
{
STR1,
STR2
};
Is the initialization of the static members guaranteed to proceed in
the order in which they are encountered? The 2 compilers I have tried
work fine given the above and have problems if I flip-flop the inits
of the strings and the array, so that was my *assumption*. But is
this safe/portable?
Thanks.
dc
// header
class Test
{
public:
Test() {}
~Test() {}
private:
static const string strings[];
static const string STR1;
static const string STR2;
};
// impl
const string Test::STR1("String #1");
const string Test::STR2("String #2");
const string Test::strings[] =
{
STR1,
STR2
};
Is the initialization of the static members guaranteed to proceed in
the order in which they are encountered? The 2 compilers I have tried
work fine given the above and have problems if I flip-flop the inits
of the strings and the array, so that was my *assumption*. But is
this safe/portable?
Thanks.
dc