
on Thu Nov 03 2011, Krzysztof Czainski <1czajnik-AT-gmail.com> wrote:
2011/11/3 Stewart, Robert <Robert.Stewart@sig.com>
Krzysztof Czainski wrote:
struct void_ {};
namespace aux { inline void_& void_reference() { static void_ instance; // (1) return instance; }
[snip]
My question is: is it allowed to use an instance of an uninitialized empty struct?
That uses the implicit default constructor provided by the compiler which, of course, does nothing. instance is not uninitialized.
Oh, makes sense, thanks.
So then, don't you think it's better to use static initialization? Or maybe it doesn't matter?
Yes, it would be better if these things followed the pattern used in proto for terminals, with static initialization. -- Dave Abrahams BoostPro Computing http://www.boostpro.com