float init 0 request

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Aug 17 13:57:47 UTC 2026


On 17/08/2026 10:14 PM, Guillaume Piolat wrote:
> On Monday, 17 August 2026 at 07:47:09 UTC, pete wrote:
>> There is something I don't understand here. If an uninitialised float 
>> is an error then why does the compiler not just raise it at compile 
>> time rather than setting it to a value that is always wrong and 
>> letting someone *hopefully* find it at runtime?
>>
> 
> Change NaN with null and you'll see how that argument doesn't stand. Why 
> would the compiler compile a pointer initialized to null?

But it does stand.

```d
int* ptr;

int val = *ptr;
```

Why should this clearly bad code compile?

It shouldn't, and won't with clang or gcc if you turn on warnings.

It also won't if you turn on the fast dfa engine. Nullability was first 
thing to get checked.

Default! init floats were like second (it may not be in the next release 
but it is in ~master).

It also has gained a borrow checker to protect reference counting types 
but Walter is not being helpful in getting it merged.



More information about the Digitalmars-d mailing list