Is [] mandatory for array operations?

Trass3r un at known.com
Tue May 4 05:59:17 PDT 2010


> int[3] x, y;
> x[] = y * 2; // should work, but currently fails

Don't know if this would cause any compiler problems but y could also be a  
scalar value.
So requiring the [] would at least be unambiguous to the programmer.

Hmm, maybe if you have two variables named very similarly and you mistype  
one.

int[3] xx, x;
int    xy;

x[] = xy * 2; // where xx * 2 was intended


More information about the Digitalmars-d mailing list