Should struct destructors be required to be @nogc?
bachmeier
no at spam.net
Thu Sep 14 01:39:25 UTC 2023
I recently had an invalid memory operation error, and given how
vague that message is, I had no idea where to look for the
problem. The problem was string concatenation in a struct
destructor. My feeling is that destructors should always be
@nogc, because if it's not, you've done something wrong and your
program might unexpectedly crash.
After solving the problem, I came upon [this
page](https://wiki.dlang.org/InvalidMemoryOperationError). If the
error message had at least included a link to that page, it would
have saved me a lot of time.
More information about the Digitalmars-d
mailing list