Arrays and struct assignment, pt. 2

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Aug 1 19:49:00 PDT 2015


On Sunday, 2 August 2015 at 01:50:50 UTC, David Nadlinger wrote:
> Again, am I missing something obvious here? I can't quite 
> believe that struct lifetime would have been quite as broken 
> for so long.

I suspect that what it comes down to is that opAssign doesn't get 
used all that frequently. Most structs simply don't need it, so 
code which would hit the bug probably isn't all that common. 
Obviously, such code exists, but it requires using both opAssign 
and then putting those structs in arrays - and then catching the 
resulting bug (which you would hope would happen, but if the 
difference is subtle enough, it wouldn't necessarily be caught). 
And if structs with opAssign normally also define a postblit, 
then it's that much less likely that the problem would be hit.

- Jonathan M Davis


More information about the Digitalmars-d mailing list