What should happen here?

Steven Schveighoffer schveiguy at gmail.com
Wed Sep 22 12:29:46 UTC 2021


On 9/22/21 8:12 AM, Kagamin wrote:
> On Monday, 20 September 2021 at 18:49:12 UTC, Steven Schveighoffer wrote:
>> This to me seems like "leaving a pointer to it on the stack". I'm not 
>> sure how else I would do that specifically? Plus, this option is the 
>> only "free" one -- the others all require much more complication. 
>> Adding a pointer to the stack is free. It's just, I don't know how to 
>> tell the compiler to do that besides declaring it.
> 
> If you use the pointer after the call, that's an easy way to ensure that 
> the pointer is kept around long enough.

The point is, you may only use it via functions/mechanisms that are not 
visible to the GC (like C libraries). In which case you have to pin it 
somehow.

Having to "fake" usage is annoying, but I think we should at least 
provide foolproof guidance on how to do this.

-Steve


More information about the Digitalmars-d mailing list