float init 0 request

Indraj Gandham newsgroups at indraj.net
Fri Aug 14 08:17:41 UTC 2026


On Friday, 14 August 2026 at 06:38:02 UTC, Walter Bright wrote:
> It's similar to pointers being default initialized to null. 
> Trying to use a null pointer will result in a seg fault.

It's not similar at all. There is no sensible init value for a 
pointer but there is for a float. This change would bring more 
consistency within D with regard to the behaviour of numeric 
types. It would also bring D in line with what other languages do 
(and what most programmers likely expect).

> Most people decry this, but it's actually a great feature. If 
> there's a bug in the code, it's better to find it sooner rather 
> than after you ship.

It's better to find it at compile time and emit a warning, as in 
Rust. The NaN value silently propagates and is therefore the 
worst possible choice.


More information about the Digitalmars-d mailing list