int nan

bearophile bearophileHUGS at lycos.com
Sat Jun 27 04:49:02 PDT 2009


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).


> 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.

Bye,
bearophile



More information about the Digitalmars-d mailing list