Movement against float.init being nan

jordan4ibanez jordan4ibanez002 at gmail.com
Sat Aug 20 23:00:16 UTC 2022


We could make it the worst of both worlds. We could have it so 
sometimes an unitialized float or double is NaN and make it be 
the garbage data that was the memory address depending on if a 
random number is below 0.5 or not.

I'm kidding.

I would actually prefer it to throw an error if you did not 
initialize a variable. :) This would make programming more 
explicit upfront but prevent you from tearing out your hair in a 
few months where a part of a library you're using suddenly starts 
throwing weird errors out and you are left with a cup full of 
tears. This goes for all variables of primitive type to use Java 
speak. This would not only solve the issue of "OI IT SHOULD BE 
ZERO!!" and "OI IT SHOULD BE NAN!!!". No way Jose, it should be 
what you tell it to be because the computer should do what you 
told it to do when creating those values, not guess. Because it 
can only tell how you're trying to do it, not what you're trying 
to do. It's not a soothsayer, it's a glorified calculator.


More information about the Digitalmars-d mailing list