Array void init

"Luís "Luís
Fri Apr 26 08:59:31 PDT 2013


On Friday, 26 April 2013 at 15:45:27 UTC, eles wrote:
> which reminds me about the proposal to allow declaration of 
> static arrays with
> double[$] foo = [1.0, 2.0, void, 3.0, 3.5, void, void, void];

Seems nice.

> double[4] foo = [1.0, 2.0];
> is accepted, which is a bit strange (I think the compiler 
> should give at least a warning if too many elements are 
> reserved for an array).

I just read that as "the other are NaN/.init initialized", which 
seems reasonable. The dollar notation is better than the warning 
here, to say that the array initializer is the authoritative 
source of the array length.


More information about the Digitalmars-d mailing list