Movement against float.init being nan
Dukc
ajieskola at gmail.com
Sat Aug 20 22:28:12 UTC 2022
On Saturday, 20 August 2022 at 05:18:20 UTC, Walter Bright wrote:
> Because I've seen what happens with that. The compiler
> complains about no initializer, and the programmer just puts in
> "0" to shut up the compiler. He does not make the effort to
> figure out what it should be initialized to. The reviewer
> wastes time trying to figure why it is uselessly initialized to
> zero.
On the other hand, the programmer could explicitly initialise the
variable to `float.nan`. The problem is that so few people coming
from other languages know that trick. D educates us, making me
annoyed when other languages use zero as the default and force me
to explicitly initialise to NaN :).
More information about the Digitalmars-d
mailing list