Should struct destructors be required to be @nogc?
Steven Schveighoffer
schveiguy at gmail.com
Thu Sep 14 08:31:05 UTC 2023
On Thursday, 14 September 2023 at 01:39:25 UTC, bachmeier wrote:
> 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.
Since 2.102 you should get a stack trace now. Did that not happen
for you?
-Steve
More information about the Digitalmars-d
mailing list