Ordering comparisons

Stefan Koch via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 7 11:53:37 PST 2017

On Tuesday, 7 March 2017 at 19:40:53 UTC, Andrei Alexandrescu 
> On 03/07/2017 12:54 PM, H. S. Teoh via Digitalmars-d wrote:
>> (1) I may be remembering wrong, but I thought structs had 
>> always been
>> intended to be compared field-wise?  I remember when working 
>> on AA's
>> that the compiler would emit a default implementation of 
>> opEquals that
>> did member-wise comparisons. I had always assumed that 
>> something
>> similar was done with inequalities... or was that just 
>> unfounded
>> extrapolation?
> We currently do memcmp.
> Equality by memberwise comparison is almost always meaningful; 
> ordering by lexicographic comparison of members is not.
> Andrei

We should deprecate that array comparison behavior immediately.
It should not break much code, otherwise the issue would have 
popped up before.

More information about the Digitalmars-d mailing list