On 09.09.2011 21:53, Walter Bright wrote:
On 9/9/2011 11:48 AM, bearophile wrote:
It seems Pull 375 also turns this program in a compile-time error:

int[3] arr = [1, 2];
void main() {}

Walter told me that this code used to work as designed, this means
it's not a bug.
Despite not being a bug, I think accepting that kind of code is a
bug-prone anti-feature.

The point of that working is that it isn't unusual to have a large array
with only the front of it initialized.

Do you have an example?

The best I could come up with with was:
char [80] buff = "Hello, world!\n";
but that generates a "lengths don't match for array copy" error at runtime. So I find it hard to invent a use case.

But I have been bitten by getting the lengths wrong on numerous occasions, eg it happened several times in std.mathspecial.

Reply via email to