Liste des Groupes | Revenir à cl c++ |
Am 31.03.2025 um 10:56 schrieb Paavo Helde:No, I seem to remember that static FUNCTION LOCAL variables have always been initialize at the moment the function is first entered, after all, the constructor can take arguments that might not be known till then, so it can't be constructed before, and it needs to be constructed before you pass the decleration.
Before C++11 one had to just add their own synchronization for thread safety (assuming multi-threaded access was needed, which was not so often in the past).That's not that easy since it is undefined when a static local variable
C++11 just made coding of a Meyer's singleton easier, that's all.
is initialized before C++11. You'd have to wrap it in a union and leave
only member which is the object uninitialized. That's possible, but
that's not Meyer's singleton.
Les messages affichés proviennent d'usenet.