The case for NaN

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sun Jul 5 08:37:41 UTC 2026


On 05/07/2026 8:26 PM, Alexandru Ermicioi wrote:
> On Sunday, 5 July 2026 at 08:11:31 UTC, Walter Bright wrote:
>> It still applies. People will still write:
>> ```d
>> float f;
>> ```
> 
> Maybe D should drop default initialization completely?
> Then this issue will disappear.

Absolutely not.

It doesn't just affect variables in a function, it also affects fields, 
globals; all allocations.

It makes all variables uninitialized, which opens the door to a 
significant number of CVE's that C has.

Walter got this right, making the default type state initialized.

What we are able to do here though is throw static analysis at the 
problem: 
https://github.com/dlang/dmd/blob/master/changelog/dmd.fastdfa.uninitialized.dd



More information about the Digitalmars-d mailing list