Why isn't == used to compare structs

Pelle Månsson pelle.mansson at gmail.com
Mon Feb 8 05:58:39 PST 2010


On 02/08/2010 01:48 PM, Trass3r wrote:
>> Why isn't == used to compare the struct members in the code above? I
>> mean, if I compare the structs with == it could also use == to compare
>> the members. If I use "is" to compare the structs it could use "is" to
>> compare them members.
>
> Structs are compared *bitwise*!
> When you dup your pointer is different and thus the structs are different.

I believe the question was *why* things are this way. I think it's weird.


More information about the Digitalmars-d-learn mailing list