What should happen here?
Kagamin
spam at here.lot
Wed Sep 22 20:48:46 UTC 2021
On Wednesday, 22 September 2021 at 12:31:48 UTC, Steven
Schveighoffer wrote:
> And by the way I tried naive usage, and the compiler saw right
> through that:
>
> ```d
> auto c = new C;
> scope(exit) auto fake = c; // still collected early
> ```
That just means you don't properly use it. It's so in this case,
but it isn't always the case. For an example how D interoperates
with the C heap see the Array container:
https://github.com/dlang/phobos/blob/master/std/container/array.d#L604
Another option is to allocate objects in the C heap, then they
won't have this problem.
More information about the Digitalmars-d
mailing list