Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

David d at dav1d.de
Mon Jun 24 07:07:19 PDT 2013


I am getting lots of errors when compiling with -w:

// https://github.com/Dav1dde/gl3n/blob/master/gl3n/linalg.d#L144
    this(T)(T vec) if(is_vector!T && is(T.vt : vt) && (T.dimension >=
dimension)) {
        vector = vec.vector[0..dimension];
    }

this line produces following warning:

gl3n/linalg.d(144): Warning: explicit element-wise assignment
(this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension] is
better than this.vector = vec.vector[cast(ulong)0..cast(ulong)dimension]



Why does dmd produce this warning? (this is new in 2.063) Why is
assigning elementwise better?


More information about the Digitalmars-d-learn mailing list