Streaming library

Steven Schveighoffer schveiguy at yahoo.com
Thu Oct 14 06:18:38 PDT 2010


On Wed, 13 Oct 2010 23:01:38 -0400, Denis Koroskin <2korden at gmail.com>  
wrote:

> On Thu, 14 Oct 2010 06:53:57 +0400, Steven Schveighoffer  
> <schveiguy at yahoo.com> wrote:
>
>> Denis Koroskin Wrote:
>>
>>> On Thu, 14 Oct 2010 02:38:11 +0400, Sean Kelly <sean at invisibleduck.org>
>>> wrote:
>>>
>>> > Denis Koroskin Wrote:
>>> >>
>>> >> I prefer ubyte[] because that helps GC (void arrays are scanned for
>>> >> pointers).
>>> >
>>> > To be fair, the only thing that matters here is what the type is when
>>> > the initial "new" occurs.  After that, I think bits are preserved for
>>> > reallocations so if NO_SCAN is set then it will remain.
>>>
>>> It also matter when I dup it. Even if you preallocate void[] with  
>>> NO_SCAN
>>> dup'ing it will reset the flag.
>>
>> Why would you be duping the buffer for reading or writing?
>>
>> -Steve
>
> I could imagine idup'ing once a read is complete.

But you don't *create* the buffer as a void[], you just *pass* it as a  
void[].  When you dup it outside of read, it's back to the type it  
actually is.  As long as read/write don't dup the buffer you are OK.

-Steve


More information about the Digitalmars-d mailing list