Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]
David
d at dav1d.de
Mon Jun 24 12:17:30 PDT 2013
Am 24.06.2013 16:30, schrieb bearophile:
> David:
>
>> Why does dmd produce this warning? (this is new in 2.063) Why is
>> assigning elementwise better?
>
> The short answer is: do as the compiler suggests you, and be very happy
> the compiler avoids you some bugs.
The problem is, I wrote this code on purpose and I *want* it to work
like that, and I evenn need it to work like that (a few lines above in
"construct"), but this currently blocks gl3n from beeing updated for Fedora.
> The explanation is longer. In brief, it's much better to avoid some bugs
> and to make the D semantics more clear, to denote all vector ops,
> including the assignment with a [].
What kind of bugs does it avoid?
I can't think of a single bug which could happen...
(Ranges/Lengths are checked at runtime...)
More information about the Digitalmars-d-learn
mailing list