H
Hicham Mouline
I have a function f that is called from multiple threads
I have the choice between setting a const int array as a static local in f()
void C::f() {
static const int keys[] = { 0, ...., 15 };
}
or as a private member of C
class C {
private:
static const int keys[] ;
};
const int C::keys[] = { 0....15 };
1 In theory?
Is there a risk that keys are initialized badly because keys is a static
local variable of f (keys init'ed only first time exec enters f)
while no risk when keys is a static member of C (because keys is init'ed
before runtime passes through main even)?
I know c++03 says nothing about threads. Can one still infer anything from
it?
2 In practise, (msvc, g++, intel....)
Do these make sure keys init as function local is ok, and as a member of C
also?
regards,
I have the choice between setting a const int array as a static local in f()
void C::f() {
static const int keys[] = { 0, ...., 15 };
}
or as a private member of C
class C {
private:
static const int keys[] ;
};
const int C::keys[] = { 0....15 };
1 In theory?
Is there a risk that keys are initialized badly because keys is a static
local variable of f (keys init'ed only first time exec enters f)
while no risk when keys is a static member of C (because keys is init'ed
before runtime passes through main even)?
I know c++03 says nothing about threads. Can one still infer anything from
it?
2 In practise, (msvc, g++, intel....)
Do these make sure keys init as function local is ok, and as a member of C
also?
regards,