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

Jonathan M Davis jmdavisProg at gmx.com
Sat Dec 10 11:44:55 PST 2011


On Saturday, December 10, 2011 20:37:13 Don Clugston wrote:
> On 10 December 2011 09:11, Walter Bright <walter at digitalmars.com> 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.
> 
> The IEEE decision that x != x when x is NaN was probably the wrong
> decision, but it's too late now. I think it has the effect that X.init
> is dangerous. It's one of those terrible things that nearly always
> works, but is broken beyond repair in the last 0.1% of cases.
> 
> Honestly, I don't get the point of X.init where by default X is
> uninitialized. If it's an error to access variable x, why isn't it an
> error to access x.init?
> 
> double x = x.init;
> // is x initialized now?

That doesn't compile. Maybe it did before (I don't know), but when I just 
tried it, it failed.

- Jonathan M Davis


More information about the dmd-beta mailing list