Unmatched static array size assignment
bearophile
bearophileHUGS at lycos.com
Wed Apr 13 15:26:42 PDT 2011
Andrej Mitrovic:
> We'll either get a compiler with a better warning system
In that bug report I ask for an error, not a warning.
> or we'll make some kind of Lint tool for D.
Eventually some lint tools will surely be written for D, but lot of people don't use lints. What I am looking here is a little change in the language. The full proposal has three parts:
Refuse array lengths that don't match:
int[2] a = [1]; // compile-time error
main() {}
Introduce [$] to infer the array length at the definition point:
int[$] a = [1]; // OK
main() {}
And introduce a syntax like "..." for the uncommon partial specification situations:
int[4] a = [1, 2, ...]; // OK
main() {}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list