XSharpPublic
XSharpPublic copied to clipboard
Implement DIM array with StackAlloc in the background
At this moment, DIM arrays are allocated in the heap. They should be allocated on the stack This code:
VAR x := StackAlloc<DWORD>(10)
LOCAL dim y[10] as DWORD
Now produces (in C#)
uint* x = stackalloc uint[10];
uint[] y = new uint[10];
It would be nice if the DIM array is also on the stack. The only problem with that is that this is only allowed in .Net Core or later, or with the compiler option /unsafe enabled.