float init 0 request

pete email at email.com
Mon Aug 17 07:47:09 UTC 2026


There is something I don't understand here. If an uninitialised 
float is an error then why does the compiler not just raise it at 
compile time rather than setting it to a value that is always 
wrong and letting someone *hopefully* find it at runtime?

Even a signalling nan seems like the wrong choice from the start. 
If the compiler already knows where the problem is because it is 
the one that adds the nan then just stop compiling right there 
and let the programmer set it to whatever value they think is 
sensible.

I would be ok with a compiler flag that meant any uninitialised 
floats were treated as compiler errors so that I could fix them 
as soon as possible and not end up with a program that just 
doesn't work as intended.

A compiler that silently produces a binary with bugs in it is 
surely worse isn't it?






More information about the Digitalmars-d mailing list