What's the point of static arrays ?

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Jul 9 18:25:53 UTC 2020


On Thu, Jul 09, 2020 at 06:02:02PM +0000, IGotD- via Digitalmars-d-learn wrote:
[...]
> Is this the reason that ubyte[arraySize] doesn't create a dynamic
> array with size arraySize?
> 
> Now you need to do.
> 
> ubyte[] arr;
> arr.length = arraySize;

Nah, just do this:

	arr = new ubyte[arraySize];

Mission accomplished. ;-)


T

-- 
I am Ohm of Borg. Resistance is voltage over current.


More information about the Digitalmars-d-learn mailing list