On Friday, 26 April 2013 at 14:58:35 UTC, Luís Marques wrote:
Should this be supported?

double[8] foo = [1.0, 2.0, void, 3.0, 3.5, void, void, void];

(it's not supported at the moment)

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];

which is more convenient since one discovers a counting error only when compiles.

Has a decision been reached for this issue?

Currently in gdc:

double[$] foo = [1.0, 2.0];

fails with

main.d:18: Error: undefined identifier __dollar

double[1] foo = [1.0, 2.0];

fails with

main.d:18: Error: array initializer has 2 elements, but array length is 1

but

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).

Reply via email to