Streaming library

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 13 14:57:56 PDT 2010


On 10/13/10 16:32 CDT, Steven Schveighoffer wrote:
[snip]

All good points.

>> interface InputStream
>> {
>> // reads up to buffer.length bytes from a stream
>> // returns number of bytes read
>> // throws on error
>> size_t read(ubyte[] buffer);
>>
>> // reads from current position
>> AsyncReadRequest readAsync(ubyte[] buffer, Mailbox* mailbox = null);
>> }
>
> I'd say void[] is better here, since you aren't creating the buffer,
> you're accepting it. Using ubyte makes for awkward casts when you are
> reading binary data into specific structures.
>
> ditto for OutputStream.

Well casting from void[] is equally awkward isn't it? I'm still 
undecided on which is better.


Andrei


More information about the Digitalmars-d mailing list