Possible Duplicate:
What is the lifetime of a static variable in a C++ function?
Say we have a code like this:
Some class {
Some() { // the ctor code }
};
Some& globalFunction()
{
static Some gSome;
return gSome;
}
When exactly 'the ctor code' is executed? As for normal static variables before main() or at the moment we first call to 'globalFunction()'?
How is it on different platforms and different compilers (cl, gcc, ...) ?
Thanks
-hb-