floating point - nan initializers
    Walter Bright 
    newshound at digitalmars.com
       
    Sun Feb 19 11:06:24 PST 2006
    
    
  
"Ivan Senji" <ivan.senji_REMOVE_ at _THIS__gmail.com> wrote in message 
news:dtadui$2pt4$1 at digitaldaemon.com...
> The policy of D is: initialize things to error states if possible. That 
> unfortunatelly is imposible for int's but is for floats and chars.
That's right. The default initialization is *not* about being convenient or 
a shorthand. It's about being an aid to writing bug free code.
If there was a nan value for ints, that would be the default initialization 
for that, too. I'd love it if you could set a bit for a memory address that 
is cleared when the address is written to, and generates a hardware fault if 
it is read with that bit set. But there is no such thing, and nan is the 
best we can do otherwise. 
    
    
More information about the Digitalmars-d
mailing list