On 6/3/13, Jonathan M Davis <[email protected]> wrote:
> Machine machine;
>
> if(something)
> {
>     // do a bunch of stuff
>     machine = Machine.x86;
> }
> else
> {
>     //do a bunch of other stuff
>     machine = Machine.x86_64;
> }
>
> you'd be forcing people to directly initialize the machine variable even if
> they didn't intend to use the value.

I'd hope in that case the compiler would be smart enough to realize
the variable is indeed initialized before use, and would avoid the
compiler error.

On 6/3/13, Jonathan M Davis <[email protected]> wrote:
> This is like how Java forces you to directly initialize things when it doesn't
> think that you've initialized them elsewhere. D did _not_ take that route. It
> when with have an init value for every type and initializing with that.

Yes, but we do have float.init which is NaN. We don't have the
equivalent for enums.

Reply via email to