On Monday, 9 November 2020 at 08:06:54 UTC, Andrey wrote:
Hello,

Are here any differences in creation of dynamic array with known size?

auto array = new wchar[](111);

and

wchar[] array;
array.length = 111;

It's the same. If the two are valid then you are in a function. So it's an alloca for the dynamic array payload (8+8 bytes on x86_64) then a LengthExpression that will lead to a GC.malloc, and finally a memset for all the elements default values.

Reply via email to