What should happen here?

Steven Schveighoffer schveiguy at gmail.com
Thu Sep 23 21:11:25 UTC 2021


On 9/23/21 4:43 PM, Daniel N wrote:
> On Thursday, 23 September 2021 at 19:54:56 UTC, Steven Schveighoffer wrote:
>>
>> You can. But wouldn't you prefer just pushing something on the stack?
>>
>> I don't know, it sort of bugs me and fascinates me that there isn't a 
>> way to do this easily. The stack is pretty much free to use, adding 
>> something to some allocated tree inside the GC (and then later 
>> removing it) isn't.
>>
>> The use cases are exceedingly small though...
>>
> 
> I would expect this to work on all platforms and compilers...
> scope c = new C;
> 

This isn't quite the same. This puts c's guts on the stack, which is 
much less @safe than just putting a reference on the stack.

-Steve


More information about the Digitalmars-d mailing list