Why are immutable array literals heap allocated?

Era Scarecrow rtcvb32 at yahoo.com
Sat Jul 6 03:31:03 UTC 2019


On Friday, 5 July 2019 at 16:25:10 UTC, Nick Treleaven wrote:
> Yes, I was wondering why the compiler doesn't statically 
> allocate it automatically as an optimization.

  Which i would think it could, but silently adds .dup to the end 
as it points to a unnamed memory block of N size. Or if it's 
immutable i would point to the same shared data.


More information about the Digitalmars-d-learn mailing list