int nan
Nick Sabalausky
a at a.a
Sat Jun 27 13:41:41 PDT 2009
"bearophile" <bearophileHUGS at lycos.com> wrote in message
news:h250ve$1dvr$1 at digitalmars.com...
> Nick Sabalausky:
>> Ie, Default initing to NaN is certainly better than
>> default-initing to a commonly-used value, but it still isn't the right
>> long-term solution.
>
> Having a nan has other purposes beside initialization values. You can
> represent missing values, like C# nullable ints (that are bigger in size,
> 8 bytes, I think).
>
Yes, I know. I only said that "default initing to nan" was a sub-optimal
approach, not having nans. But I may have misunderstood you, I thought
default init values was what you were talking about?
>
>> So yea, either int.min, or 0x69696969 or 0xB00BB00B, etc, ie
>> something that will actually stand out and scream "Hey! Double-check
>> this!
>> It might not be right!".
>
> The good thing of using int.min (and short.min, etc) is that then the
> numbers become symmetric, you have a positive number for each negative
> one, and abs() works in all cases.
>
Good point.
More information about the Digitalmars-d
mailing list