Why are immutable array literals heap allocated?

Nick Treleaven nick at geany.org
Fri Jul 5 16:25:10 UTC 2019


On Thursday, 4 July 2019 at 11:06:36 UTC, Eugene Wissner wrote:
>     static immutable arr = [1, 2];
>
> You have to spell it out that the data is static.

Yes, I was wondering why the compiler doesn't statically allocate 
it automatically as an optimization.


More information about the Digitalmars-d-learn mailing list