www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bug with .length property?

reply Mike <vertex gmx.at> writes:
I've got an array of dictionaries ...

char[][char[]][] temp;

If I now set the length to pre-allocate 4 entries ...

temp.length = 4;

... the program goes into an infinite loop. It doesn't allocate, just uses 50%
CPU (one entire core) and doesn't respond anymore. Is this a bug or is there
something else wrong?

-Mike
Dec 03 2007
parent reply downs <default_357-line yahoo.de> writes:
Mike wrote:
 I've got an array of dictionaries ...
 
 char[][char[]][] temp;
 
 If I now set the length to pre-allocate 4 entries ...
 
 temp.length = 4;
 
 ... the program goes into an infinite loop. It doesn't allocate, just uses 50%
CPU (one entire core) and doesn't respond anymore. Is this a bug or is there
something else wrong?
 
 -Mike
It's a bug. I've encountered it before, way back. It is caused by AA.init.length being 0, throwing the initialization code into an infinite loop. --downs
Dec 03 2007
parent Mike <vertex gmx.at> writes:
downs Wrote:

 It's a bug. I've encountered it before, way back. It is caused by
AA.init.length being 0, throwing the initialization code into an infinite loop.
  --downs
I see. Good to know that.
Dec 04 2007