Array operations, dynamic arrays and length

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 2 03:48:55 PDT 2015


On 7/1/15 8:36 PM, J Miller wrote:

> Oh, and to make things really confusing, "auto e = a[] - b[]" and "int[]
> e = a[] - b[]" both cause "Error: array operation a[] - b[] without
> destination memory not allowed".
>
> Using dmd 2.067.0.

This is not a bug. You need to allocate memory before you can write to 
it. Automatic allocation doesn't happen in D.

-Steve


More information about the Digitalmars-d-learn mailing list