Movement against float.init being nan

Walter Bright newshound2 at digitalmars.com
Fri Aug 26 01:01:24 UTC 2022


On 8/25/2022 10:38 AM, Steven Schveighoffer wrote:
> 0 is no better here *but also no worse*.

0 is equal or worse than NaN. It is true that sometimes 0 is equal. But it is 
*never* better.

BTW, hex data doesn't have a NaN value. But a popular thing we'd do is 
initialize it to:

   0xDEADBEEF

which is pretty unlikely to occur in the wild. So when dumping hex data, and 
DEADBEEF is in there, you're very likely looking at uninitialized data getting 
into the output.

I'd use it for both initializing malloc'd data before returning it to the 
caller, and setting free'd data to it. It was pretty effective at flushing out 
uninitialized allocated data, and use-after-free bugs.

Using 0x00 was nowhere near as effective.



More information about the Digitalmars-d mailing list