Re: New vs length on dymamic array

2020-11-09 Thread Виталий Фадеев via Digitalmars-d-learn
On Monday, 9 November 2020 at 09:05:58 UTC, Imperatorn wrote: 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; You can check

Re: New vs length on dymamic array

2020-11-09 Thread user1234 via Digitalmars-d-learn
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

Re: New vs length on dymamic array

2020-11-09 Thread Daniel Kozák via Digitalmars-d-learn
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; In theory auto array = new wchar[111]; // or new wchar[](111); should do less

Re: New vs length on dymamic array

2020-11-09 Thread Vladimirs Nordholm via Digitalmars-d-learn
On Monday, 9 November 2020 at 09:05:58 UTC, Imperatorn wrote: 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; You can check

Re: New vs length on dymamic array

2020-11-09 Thread Imperatorn via Digitalmars-d-learn
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; You can check using compiler explorer: https://godbolt.org/

New vs length on dymamic array

2020-11-09 Thread Andrey via Digitalmars-d-learn
Hello, Are here any differences in creation of dynamic array with known size? auto array = new wchar[](111); and wchar[] array; array.length = 111;