Movement against float.init being nan

IGotD- nise at nise.com
Tue Aug 23 08:07:22 UTC 2022


On Tuesday, 23 August 2022 at 01:19:35 UTC, Steven Schveighoffer 
wrote:
>
> Agreed that C/C++ initializing with garbage is the worst option.
>
> C# (as also mentioned) uses 0.
>
> I'm curious what all languages do that actually use an initial 
> value?
>
> -Steve

C++11 default value initialization exist. Meaning this

```c++
double x{};
```

is going to be initialized to zero. D is really an outlier here 
with default initialization to NaN. I would rephrase you initial 
question to a challenge, find a language other than D that 
default initializes floats to NaN.



More information about the Digitalmars-d mailing list