
Steven Watanabe wrote:
AMDG
Andreas Huber <ahd6974-spamgroupstrap <at> yahoo.com> writes:
Steven Watanabe wrote:
GetPodInstance() is probably safe, but the standard does not require it. "A local object of POD type (3.9) with static storage duration initialized with constant-expressions is initialized before its block is first entered." (6.7/4)
Interesting, from the wording above I would have concluded that the standard *does* require it.
To be safe the compiler would have to initialize the object statically. i.e. before any code whatsoever is executed. The wording does not require that.
I guess you are right regarding the wording but in practice such initialization takes place much earlier than the standard requires. Otherwise such a widespread library as pthreads would have a major problem: http://www.codesourcery.com/archives/c++-pthreads/msg00582.html -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.