On 2014-03-14 12:14 PM, Etienne wrote:
On 2014-03-14 12:10 PM, Adam D. Ruppe wrote:
On Friday, 14 March 2014 at 16:06:17 UTC, bearophile wrote:
And double.init is a NaN.
Yes, and the reason for this is NaN is similar to null - an invalid
state, so it can help you to catch uninitialized variables.
You should explicitly initialize the variables normally and for the
cache case, either keep a separate variable to tell if it is initialized
(since NaN might be a valid cache state, like how an int may
legitimately be 0) or compare using std.math.isNaN.
Ok isNaN works on the deserialized values and simple comparisons works
on the serialized values in the cache store. Struct.init is unreliable
now in my books. Thanks!