Question about mutable arrays

Ali Cehreli acehreli at yahoo.com
Thu Nov 19 15:00:25 PST 2009


A Bothe Wrote:

> I've found a problem that occurred since DMD 2.034:

I am testing it with 2.036.

> When I've created a dynamic array like
> string[] a;

I like to see it a "slice." Even if we go with "dynamic array," I see it as an empty dynamic array.

> and I want to assign something via the index of this array
> a[0]="Test";

I would expect it to be illegal to access a[0], because a is empty.

> DMD says the array isn't mutable...

2.036 says "Error: null dereference in function _Dmain" and it matches my expectation above.

Ali



More information about the Digitalmars-d-learn mailing list