J
Jens Henrik Goebbert
Hi,
I have some kind of tricky question on the c++ internals.
There must be some rule in what order static members get initialised.
I need to initialise a static member (m_sPropertyInfos) using a static
methode (initStaticPropertyInfos). This static methode uses a static
member staticMetaObject of the superclass.
Will that work with all compilers (it is fine with gcc-4.x)
myfile.cpp:
/*static*/ QList<AXPropertyInfo*> AXData::initStaticPropertyInfos() {
QList<AXPropertyInfo*> propertyInfos;
for(int i=0; i<staticMetaObject.propertyCount(); i++) {
propertyInfos.append(0);
}
return propertyInfos;
}
QList<AXPropertyInfo*> AXData::m_sPropertyInfos = initStaticPropertyInfos();
Greetings
Jens
I have some kind of tricky question on the c++ internals.
There must be some rule in what order static members get initialised.
I need to initialise a static member (m_sPropertyInfos) using a static
methode (initStaticPropertyInfos). This static methode uses a static
member staticMetaObject of the superclass.
Will that work with all compilers (it is fine with gcc-4.x)
myfile.cpp:
/*static*/ QList<AXPropertyInfo*> AXData::initStaticPropertyInfos() {
QList<AXPropertyInfo*> propertyInfos;
for(int i=0; i<staticMetaObject.propertyCount(); i++) {
propertyInfos.append(0);
}
return propertyInfos;
}
QList<AXPropertyInfo*> AXData::m_sPropertyInfos = initStaticPropertyInfos();
Greetings
Jens