Why D is annoying =P
Jonathan M Davis
jmdavisProg at gmx.com
Thu Oct 25 10:19:41 PDT 2012
On Wednesday, October 24, 2012 22:12:48 Jonathan M Davis wrote:
> On Wednesday, October 24, 2012 13:31:14 Walter Bright wrote:
> > The default compare for structs is a bit compare of the contents.
>
> Which definitely seems inherently broken. Doing that only works if the
> struct only contains integral types, character types, or bool. Nothing else
> will compare properly that way.
Actually, slight correction. Pointers are fine too. I'd expect to have to
overload opEquals to get deep comparisons for those (and I expect that the
same happens with arrays), but basically anything which isn't an integral
value of some kind (which pointers essentially are) won't compare properly if
the default opEquals for structs is doing the same as the is operator like it
is right now.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list