Array operations, dynamic arrays and length

jmh530 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 4 08:12:02 PDT 2015


On Thursday, 2 July 2015 at 19:27:57 UTC, J Miller wrote:
> I knew that automatic allocation doesn't happen, but I'm 
> confused by the fact if you explicitly declare "c" with "int[] 
> c;" and then assign "c[] = a[] * b[]", versus using "auto c = 
> a[] * b[]", you get two different errors (array length mismatch 
> vs no destination memory).

I find it confusing as well. For me it's about consistency of 
syntax. For instance, auto z = x+y works with numeric types, but 
the equivalent you use for arrays doesn't work. It just means one 
more thing to remember.



More information about the Digitalmars-d-learn mailing list