Should this be correct behaviour?

Derek Parnell derek at nomail.afraid.org
Thu Nov 29 15:32:00 PST 2007


On Thu, 29 Nov 2007 13:29:00 -0800, Sean Kelly wrote:

> Steven Schveighoffer wrote:
>> my guess is the function to compare arrays of any type does a bit for bit 
>> compare?
> 
> Nope.  It calls _adEq, which in turn calls TypeInfo_Af.equals, which 
> then calls TypeInfo_f.equals for each element.  The problem is that 
> TypeInfo_f.equals is implemented to return true if either a and b are 
> equal *or* if a and b are both NaN.  I have no idea why it does this.

I don't know which is better either as I can see arguments for both.

(1) If (a[n] != b[n]) is true then (a == b) should be false.

  however ...

(2) If .dup is designed to make an exact copy of an array then the
resulting array should be equal to the original array.

I'm tending to think that I prefer the existing D behaviour because it
allows easier generic code for templates and just 'feels' right.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
30/11/2007 10:25:36 AM



More information about the Digitalmars-d mailing list