This is named slicing. You can also slice a global/static/__gshared buffer.
alloca returns a void*, then you can cast it to the pointer type you want, and then you slice the pointer:auto ptr = cast(wchar*)alloca(wchar.sizeof * len); if (ptr == null) throw new Error("..."); auto mySlice = ptr[0 .. len];
Is the slice going to be allocated on the stack? (I imagine the answer is yes)
Thanks for your help Mr Bear.