is it bug?

drug drug2004 at bk.ru
Mon Sep 25 17:59:42 UTC 2017


25.09.2017 20:47, Adam D. Ruppe пишет:
> On Monday, 25 September 2017 at 17:44:54 UTC, drug wrote:
>> https://run.dlang.io/is/uk0CMC
> 
> You didn't initialize it. It's not null, but it also isn't a valid 
> character.
but exception is caused by using `get` on null Foo instance, not by 
invalid character as I can see
> 
> D initializes chars to 0xff, which is an invalid char.
> 
Yes, if I initialize Nullable one it works, but it means that Nullable 
can be constructed incorrectly by default and manual initialization is 
needed always?
> 
> Perhaps the Nullable one should have initialized to null but otherwise 
> it looks ok.
Shouldn't Nullable one be initialized as a null by default?



More information about the Digitalmars-d-learn mailing list