Holes in structs and opEquals

Walter Bright newshound1 at digitalmars.com
Sun Mar 7 12:19:21 PST 2010


bearophile wrote:
> But a correctly implemented opEquals (and opCmp) among structs has to
> ignore the contents of the holes, because they can be filled with
> anything,


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.


> for example if the structs where not initialized (with =void).

If you use =void, or allocate with malloc(), it is your responsibility 
to deal with the holes.



More information about the Digitalmars-d mailing list