On Sun, 14 Oct 2012 09:16:28 +0200 "Tommi" <tommitiss...@hotmail.com> wrote:
> On Sunday, 14 October 2012 at 06:51:48 UTC, Jonathan M Davis > wrote: > > And honestly, declaring a specific init value for an enum is a > > stupid idea. > > I think that declaring a specific *valid* init value for an enum > has no purpose. But declaring a specific *invalid* init value, to > which the enum initializes to by default, is a very good idea. > The reason for why it's a good idea, is exactly the same as why > default-initializing floating point variables to NaN is a good > idea. Others have reasoned about that enough, thus I don't have > to. > Yes, but it still has to be taken into account in things like "final switch". You can't just pretend that nothing will ever have that value, because by making it the init value, you've *made* it an actual possible value, one that just happens to indicate "uninitialized".