dynamically allocating on the stack

Adam D. Ruppe destructionator at gmail.com
Sun Apr 22 01:49:44 UTC 2018


On Sunday, 22 April 2018 at 01:26:09 UTC, Uknown wrote:
> Its a special case for classes. Makes them usable without the 
> GC.

The intention was actually just to have deterministic destruction 
- a scope class ctor runs at the end of scope (and it used to be 
you could force a class to always be scope too). The stack 
allocation is simply an optimization enabled by the scope 
lifetime. That optimization can apply elsewhere too.


More information about the Digitalmars-d-learn mailing list