Streaming library

Steven Schveighoffer schveiguy at yahoo.com
Wed Oct 13 19:49:22 PDT 2010


Andrei Alexandrescu Wrote:

> 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.

Except the parameters are all inputs -- there is no casting from void[].

-Steve


More information about the Digitalmars-d mailing list