Holes in structs and opEquals
bearophile
bearophileHUGS at lycos.com
Sun Mar 7 16:14:38 PST 2010
Walter Bright:
> The "holes" are defined to be filled with 0, and are when initialized by
> the compiler. This is specifically so that memcmp can be done to compare
> the struct contents.
Thank you for your answer. I didn't read this important detail in the online documentation, I must have missed it, sorry. It's a detail that D programmers must keep in mind well.
A future lint program for D will need to try to warn the programmer that using the default opEquals among uninitialized structs is wrong.
Bye,
bearophile
More information about the Digitalmars-d
mailing list