DMD 1.001 release

Tomas Lindquist Olsen tomas at famolsen.dk
Tue Jan 23 21:17:57 PST 2007


Tomas Lindquist Olsen wrote:

> Walter Bright wrote:
> 
> > Tomas Lindquist Olsen wrote:
> > > Fx: If I used std.file.read to read a file I get a GC allocated
> > > void[].  It's not that unlikely that some of the data could look
> > > like a pointer. But the GC will handle the block as if it could
> > > all be pointers as it is void[]. Is this correct?
> > 
> > Take a look at the source to std.file.read() <g>.
> 
> LOL
> 
> *hides in shame*

buuuuuut ;)

std.zlib is not doing this correctly.

which also makes me think about how to handle this case properly:

void[] dst = new void[1024];
dst.length = dst.length + 1024;
dst.length = dst.length + 1024;
dst.length = dst.length + 1024;
dst.length = dst.length + 1024;
dst.length = dst.length + 1024;

assuming one of these calls have to relocate how would I be sure that I
inform the GC properly?
A call to the GC in the end would obviously do, but what if you want to
make sure the GC doesn't scan the array while it's still being resized?

While I'm at it I have been wondering why we can't have:

void[1024] sa;

when

void[] da = new void[1024];

is perfectly fine.



More information about the Digitalmars-d-announce mailing list