www.digitalmars.com         C & C++   DMDScript  

D - rehash unstability - data.txt

reply kw <kw_member pathlink.com> writes:
import stream;

void main()
{
int[char[]] esdom;
File f = new File("data.txt");

while(!f.eof())  esdom[f.readLine()] = 0;
f.close();
esdom.rehash;
}

DMD 0.71
With the attached data.txt file, rehash never ends (or takes a looong time).  If
you remove/change the last line of data.txt, rehash does its stuff in a blink.
Sep 08 2003
next sibling parent reply "Charles Sanders" <sanders-consulting comcast.net> writes:
Is this on linux ?  I had a bug that when reading in a file using eof(), if
the file did not end in a new line it would seg fault, or just hang forever.

Charles

"kw" <kw_member pathlink.com> wrote in message
news:bjid97$169c$1 digitaldaemon.com...
 import stream;

 void main()
 {
 int[char[]] esdom;
 File f = new File("data.txt");

 while(!f.eof())  esdom[f.readLine()] = 0;
 f.close();
 esdom.rehash;
 }

 DMD 0.71
 With the attached data.txt file, rehash never ends (or takes a looong

 you remove/change the last line of data.txt, rehash does its stuff in a


Sep 08 2003
parent kw <kw_member pathlink.com> writes:
In article <bjikil$1h4t$1 digitaldaemon.com>, Charles Sanders says...
Is this on linux ?  I had a bug that when reading in a file using eof(), if
the file did not end in a new line it would seg fault, or just hang forever.

No, Windows. It also can be reproduced without using files.
Sep 08 2003
prev sibling parent "Walter" <walter digitalmars.com> writes:
I have this fixed now. -Walter
Sep 13 2003