cannot resize a dynamic array of int[int]

Denis Koroskin 2korden at gmail.com
Tue Oct 21 10:31:06 PDT 2008


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.



More information about the Digitalmars-d mailing list