Possible Duplicate:
Does C++ call destructors for global and class static variables?
What is the lifetime of
- global
MyClass myclass; - global
static MyClass myclass; - global
const MyClass myclass; - global
static const MyClass myclass; - function local
static MyClass myclass;when its initialization actually occured - global
static constexpr MyClass myclass;in C++11
and especially will they be destroyed on regular program end (i.e. main is left without an error)? Where does the standard states so.
I noticed that a private destructor prevents the creation of all those variables. But if I remember correctly it was explicitly mentioned somewhere that some static data may be put into a static data section and loaded pre-constructed, already. This would imply for me that no destructor would be called. And this would imply I am allowed to define such a variable...