streaming redux

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Dec 30 14:17:30 PST 2010


On 12/30/10 3:59 PM, Dmitry Olshansky wrote:
> On 28.12.2010 16:08, Daniel Gibson wrote:
> [snip]
>> ## UnbufferedInputTransport:
>>
>> I'd like "void readFully(ubyte[] buffer)" which reads buffer.length
>> bytes or throws an exception if that is not possible
>> This would also fix busy-waiting (it'd block until buffer.length bytes
>> are available).
>>
>> Also "size_t read(void* buffer, size_t length)" (and the same for
>> readFully()) would be nice, so one can read from the stream to buffers
>> of arbitrary type without too much casting. Is probably especially
>> handy when used with (data from) extern(C) functions and such.
>>
>> Also, for convenience: "ubyte[] read(size_t length)" (does something
>> like "return read(new ubyte[length]);"
>> and "ubyte[] readFully(size_t length)"
>
> This, I guess, would be provided by free functions in the same module,
> there is no point in requiring to implement them inside the stream itself.
>>
>> ## UnbufferedOutputTransport:
>>
>> I'd like "void write(void *buffer, size_t length)" - for the same
>> reason as read(void* buffer, size_t length).
>
> Ditto

What's wrong with void[]?

Andrei


More information about the Digitalmars-d mailing list