9 Sep
2015
9 Sep
'15
8:26 a.m.
On 09.09.2015 08:04, Tim Song wrote:
On Tue, Sep 8, 2015 at 7:57 AM, Ion GaztaƱaga
wrote: Good point. The specification says they return:
"A pointer to a static-duration object of a type"
Both classes are empty but we need to initialize the virtual function pointer. We could make some lazy initialization via placement new as the destructor is trivial and just avoid the explicit placement destruction. Could this be acceptable?
Best,
Ion
Maybe I'm missing something obvious, but why can't they use function-local statics?
1. It is not thread-safe in C++03. 2. It doesn't solve the problem for global destructors. Function-local static variables can be destroyed before being used in destructors.