Create class on stack

FoxyBrown via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 5 19:59:38 PDT 2017


On Sunday, 6 August 2017 at 02:32:05 UTC, Adam D. Ruppe wrote:
> On Sunday, 6 August 2017 at 02:19:19 UTC, FoxyBrown wrote:
>> Also, does it do the allocation at compile time(reserve space 
>> on the stack for the variable along with all the others or 
>> does it "allocate" space on the stack at runtime?... which is 
>> slightly slower).
>
> compile time. It works like a static array of the appropriate 
> size.
>
> though the cost if ti was at runtime is small regardless. I 
> think it is just a register subtract.

yeah, I know, but no need for it ;) Still better than the heap 
but was just curious ;) No need to waste cycles if it's not 
necessary.


More information about the Digitalmars-d-learn mailing list