What's the deal with "Warning: explicit element-wise assignment..."

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 09:02:32 PDT 2014


On Tue, 15 Apr 2014 11:59:31 -0400, Steven Schveighoffer  
<schveiguy at yahoo.com> wrote:

> On the left hand side, the [] operator is special *for arrays* in that  
> it denotes you want to do an element-wise copy. On the right hand side,  
> this is not the case, [] is simply an operator. It's a no-op if the rhs  
> is an array, since [] just gets the array again.

Sorry, I had this wrong. The [] on the left hand side is actually part of  
the []= operator. But on the right hand side, it simply is a [] operator,  
not tied to the =. I erroneously thought the arr[] = ... syntax was  
special for arrays, but I forgot that it's simply another operator.

My opinion is still the same.

-Steve


More information about the Digitalmars-d mailing list