[dmd-beta] Struct Comparision WTF: Is the new or old behavior right?

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 10 11:32:56 PST 2011


On Saturday, December 10, 2011 00:11:55 Walter Bright wrote:
> On 12/10/2011 12:01 AM, Jonathan M Davis wrote:
> > Part of me thinks that NaN should be equal to NaN, but it's likely too
> > late for that at this point, even if it were determined to be a good
> > idea.
> That issue was decided at least 25 years ago.

So it pre-dates D by a fair chunk huh. Well, as I said, I figured that it was 
probably too late to change it. I guess that I'll just have to make sure that 
I unit test whether an init value equals itself for every struct type that I 
use so that I can catch this sort of situation. I'd say that this definitely 
falls in one of those "forced faults" that Andrei has talked about, where one 
language design forces a suboptimal design decision elsewhere. It's annoying 
but not hard to deal with if you know about it. Just one more thing to be 
careful about I guess.

- Jonathan M Davis


More information about the dmd-beta mailing list