On 21 November 2014 08:34, David Krauss <
pot...@gmail.com> wrote:
> Do you know how pipes and BSD sockets get buffered?
>
>
> I think I do. And I still don't see why there's "no way" to buffer
> them in userspace
> on top of the system buffering.
>
>
> “On top of system buffering” is not “by yourself,” and the buffering scheme
> is not the same as FILE and filebuf.
Well, I don't think anyone has suggested that these streams magically replace
the system buffering. I don't see anyone explaining why this on-top-of buffering
is in any way incorrect, but I see claims stating that it is.
> Well, I have trouble following what you're trying to say.
>
>
> It’s useful to put streambuf or iostreams atop more things, but treating all
> file descriptors alike is an overgeneralization. Treating them all like
> normal local files doubly so.
Nobody has suggested treating them like local files. With regards to
allowing the suggested wrapping of any file descriptor, I'm yet to see
an explanation why it shouldn't be done. All I see is vague statements
that don't seem to provide anything beyond unsubstantiated concerns.
> So, the proposed facility might be split across more than one class, and/or
> it might require the user to specify what kind of descriptor something is.
> At the least, so there’s some kind of contract on whether closing it
> signifies a flush or an abort.
Sure, it's possible that the idea will evolve to cover multiple scenarios
and will lead to more than one class. Nobody has thus far suggested that
it will just magically happen inside the existing filebuf.
> You
> certainly seemed to be
> against the idea of being able to wrap a closing-iostream on top of a
> native handle,
> and I have thus far failed to see your explaining sufficiently well
> why that would be a
> bad idea.
>
>
> Because the user might want to continue using the handle after destroying
> the iostream, as they likely were before before creating it.
The closing-iostream (or a streambuf, rather) doesn't preclude having
a non-closing one,
so that's not a reason not to add a closing-iostream on top of a native handle.