On 12/9/2011 10:36 PM, David Simcha wrote:
Using DMD 2.057 beta: // test2.d: import std.stdio; struct S { double d; // NaN } void main() { S s; writeln(s == S.init); } $ dmd test2.d -m32 $ ./test2 true $ dmd test2.d -m64 $ ./test2 falseSomehow I think it's a bad idea to have the result of this comparison change depending on whether you're compiling in 32- or 64-bit mode. I just spent a few hours debugging Plot2kill because this behavior changed between releases in 64-bit mode, and I was comparing font structs to their .init values to determine whether they had already been initialized. Everything worked in 32-bit mode but failed in 64-bit mode. In 64-bit mode it looked like the structs had already been initialized (e.g. titleFont == Font.init is false) so they never got initialized. Needless to say, GTK does weird things when you pass in a NaN as a font size.
The 32 bit code is wrong (please file a bug report). Comparisons should always yield false if one or both operands is a nan.
_______________________________________________ dmd-beta mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-beta
