www.digitalmars.com         C & C++   DMDScript  

D - Bug: Array.length++

reply "Andrew Edwards" <edwardsac spamfreeusa.com> writes:
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



`
end
Jul 02 2003
parent reply Ilya Minkov <Ilya_member pathlink.com> writes:
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



`
end
Jul 02 2003
parent "Andrew Edwards" <edwardsac spamfreeusa.com> writes:
"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
Jul 02 2003