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

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 15 02:18:13 PDT 2014


Andrei Alexandrescu:

> We've just enabled warnings as errors in our build system at 
> work and suddenly:

It's much better to enable warnings since day -1, that means the 
day before you start creating your D project.
That's why I'd like D compilers to have warnings active on 
default and to have a switch to disable them on request (Walter 
has not yet answered about this idea).


> What's the idea?

The idea is to tell well apart the assignment of values (like 
scalars and fixed size arrays) from slice assignments. In general 
if you have a vector operation, use a []. There are corner cases 
(with arrays of arrays, fixed sized arrays of dynamic arrays, 
etc), that if you don't use such strict syntax, lead to undefined 
(ambiguous, weird) situations. The warning helps avoid that 
problem, and the warning will be replaced by a deprecation later.

Bye,
bearophile


More information about the Digitalmars-d mailing list