suppose I have a .cpp
file:
static Foo aFoo;
Foo& staticFoo(){
return aFoo;
}
Foo& singletonFoo(){ // not thread safe in c++-03
static Foo staticFoo;
return staticFoo;
}
and a .h
file that exposes these functions (but not aFoo
directly).
- Am I certain that
aFoo
is initialized prior tostaticFoo
? - Am I certain that
staticFoo
is destroyed afteraFoo
? - Am I certain that
aFoo
is destroyed after any automatic storage duration variables in my program?