Tuesday, August 21, 2012

Debugging magic numbers

I came across a magic number today: -0.00132704

I was seeing a whole bunch of values initialized to this number in an automated test, and thought it must mean something. It turns out it is used by Microsoft "to mark uninitialised allocated heap memory" - hex 0xBAADF00D coverts to -0.00132704 as a floating-point value.

Searching for -0.00132704 turns up a number of interesting examples in other people's projects. :)