cannot resize a dynamic array of int[int]

Jarrett Billingsley jarrett.billingsley at gmail.com
Tue Oct 21 11:53:00 PDT 2008


On Tue, Oct 21, 2008 at 1:31 PM, Denis Koroskin <2korden at gmail.com> wrote:
> On Tue, 21 Oct 2008 21:24:28 +0400, Ran <saotome.ran at googlemail.com> wrote:
>
>> It should be a stupid question. But I still hope for any response. Could
>> anyone tell me pls why the following code doesn't work ?
>>
>> uint numberOfSubsets(uint n) {
>>        return (1 << n) - 1;
>> }
>>
>> void main(char[][] args) {
>>        int[int] a[];
>>        a.length = numberOfSubsets(3);
>> }
>> The generated program runs endlessly. I'm using D2.
>> Ran
>
> This is a bug, try wrapping the assoc. array in a struct so that you make
> array of structs instead of array of maps. It should help.
>

It's a bug that's been around for way too fucking long, excuse the
language.  It's apparently a one-character change in the typeinfo for
AAs.



More information about the Digitalmars-d mailing list