Allocating structs with new?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jul 12 07:38:31 PDT 2010


On 07/12/2010 07:27 AM, Steven Schveighoffer wrote:
> Also, the example given in the bug report is very simplistic, just to
> demonstrate the problem. Does anyone have a good use case for struct
> dtors being called when allocated by the GC? All of the struct dtors
> I've seen assume they are stack-allocated.

Concrete scenarios of structs ending up on the hap often involve classes 
that have structs as members, but those do end up being accounted for.

Statically disabling new for structs with dtors - that's an interesting 
idea.


Andrei



More information about the Digitalmars-d mailing list