Thread overview
Bug: Array.length++
Jul 02, 2003
Andrew Edwards
Jul 02, 2003
Ilya Minkov
Jul 02, 2003
Andrew Edwards
July 02, 2003
Acording to the documentation the following should be a valid statement:

int[] myArray;
myArray[myArray.length++] = 5;

however, it results in the following compile time error:

'array.length' is not an lvalue

Regards,
Andrew


begin 666 Converting C to D.url
M6TEN=&5R;F5T4VAO<G1C=71=#0I54DP]:'1T<#HO+W=W=RYD:6=I=&%L;6%R
M<RYC;VTO9"]C=&]D+FAT;6P-"DUO9&EF:65D/38P-SA$,34X-S4T,$,S,#$W
#00T*
`
end

July 02, 2003
I believe it is an intended limitation, not a bug. I consider it an inconsistency in a language, and thus evil. And if it is done: please document it somewhere.

-i.

In article <bdu5j4$25s7$1@digitaldaemon.com>, Andrew Edwards says...
>
>Acording to the documentation the following should be a valid statement:
>
>int[] myArray;
>myArray[myArray.length++] = 5;
>
>however, it results in the following compile time error:
>
>'array.length' is not an lvalue
>
>Regards,
>Andrew
>
>
>begin 666 Converting C to D.url
>M6TEN=&5R;F5T4VAO<G1C=71=#0I54DP]:'1T<#HO+W=W=RYD:6=I=&%L;6%R
>M<RYC;VTO9"]C=&]D+FAT;6P-"DUO9&EF:65D/38P-SA$,34X-S4T,$,S,#$W
>#00T*
>`
>end
>


July 02, 2003
"Ilya Minkov" <Ilya_member@pathlink.com> wrote...
> I believe it is an intended limitation, not a bug <snip>

It is suggest that the section titled "Creating an array of variable size" on the  "Converting C to D" page be updated to reflect the correct way to do this in D.

Regards,
Andrew