Does the default opEquals include padding in the comparison? If so, how can the problems that arise with C++ interoperabilty be solved?
Simon van Bernem
simon.vanbernem at yahoo.de
Thu Oct 22 05:45:11 UTC 2020
On Wednesday, 21 October 2020 at 20:10:03 UTC, Paul Backus wrote:
> On Wednesday, 21 October 2020 at 19:23:43 UTC, Simon van Bernem
> wrote:
>> The only explanation I can think of is that D memcmps the
>> entire struct including the padding. Is this correct?
>>
>> If so, what can I do about this? Why doesn't the opEquals get
>> modified appropriately even though the struct is extern(C++)?
>> Can I tell D to only compare the non-padding parts? Or is
>> there a msvc/clang compiler switch to tell them to initialize
>> padding to 0?
>
> https://dlang.org/changelog/2.085.0.html#no-cmpsb
Thanks! Great to see this was already adressed.
More information about the Digitalmars-d-learn
mailing list