@nogc destroy

Steven Schveighoffer schveiguy at gmail.com
Sat Jan 15 15:59:02 UTC 2022

On 1/15/22 12:03 AM, Elronnd wrote:
> On Friday, 14 January 2022 at 23:28:44 UTC, Adam Ruppe wrote:
>> Currently calling .destroy(class_object) fails the @nogc tests.
> Practical Q: how many people are using classes without gc?  And how many 
> of those people are actually using @nogc vs just not linking the gc in 
> the first place?

Destructors can't allocate if running inside the GC. This makes them 
perfect candidates for @nogc.

So even if you use classes, and allocate them on the heap, running the 
destructors really should be tagged as @nogc (and who are we to say why 
anyone should or shouldn't be using the GC in any specific spot?)


More information about the Digitalmars-d mailing list