floats default to NaN... why?
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sat Apr 14 05:47:51 PDT 2012
On 4/14/12, bearophile <bearophileHUGS at lycos.com> wrote:
> Having a variable not initialized is a common source of bugs.
I'm going to argue that this was true for C/C++ but is much less true
for D. One benefit of having integrals initialized to 0 is that you
now have a defined default that you can rely on (just as you can rely
on pointers being null by default). Personally I find this to be a big
win in productivity. If the language/runtime does something defined
for me then I can focus on more important things.
But NaN might be a good thing for all I know.. I rarely use
floating-point so I'll stay out of that, but I'd like to have this
fixed: http://d.puremagic.com/issues/show_bug.cgi?id=6303
More information about the Digitalmars-d-learn
mailing list