On Monday, 14 November 2016 at 07:57:20 UTC, Stefan Koch wrote:
On Monday, 14 November 2016 at 05:27:15 UTC, Stefan Koch wrote:
Assignment to Array.length works now :)
the following code :
uint[] makeArr()
{
uint[] arr;
arr.length = 5;
return arr;
}
pragma(msg, makeArr());
results in :
CTFE_DEBUG_MESSAGE : building Array of Length 5
[0u, 0u, 0u, 0u, 0u]
Assignment now also works :)
uint[] MakeAndInitArr(uint length)
{
uint[] arr;
arr.length = length;
foreach(i;0 .. length)
{
arr[i] = i + 3;
}
return arr;
}
pragma(msg, MakeAndInitArr(12));
Output :
[3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
This for a length values in the range of short.max/4.
Which is the maximal heapSize for now.
This is up to 1.5 times faster then the old engine.
Once the heap-limit is lifted you can see this rock :)