floating point - nan initializers

Anders F Björklund afb at algonet.se
Sun Feb 19 12:35:37 PST 2006


Walter Bright wrote:

>>I thought it was "OK" to assume they all started at zero...
>>You know, like in: http://www.digitalmars.com/d/wc.html ;-)
> 
> Sometimes I get lazy. :-) I'll say it's poor style, and yes, I'm guilty of 
> it.

As long as it is clear... (In some other languages, it's stylish)
But in D, the .init values are a debugging aid and not a shortcut.

>>Guess this means to start using an "= 0;" explicit init value.
> 
> I think it's good style to let the maintainer know that one intended it to 
> be 0. 

Yeah, I usually do this anyway - just to avoid warnings in C:
"warning: `sum' might be used uninitialized in this function"

--anders



More information about the Digitalmars-d mailing list