Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2020-09-10 15:44:27


On Thu, Sep 10, 2020 at 8:15 AM Alexander Grund via Boost
<boost_at_[hidden]> wrote:
> > s.read( buf ) writes data to the buffer you supply
> I get the rationale. But reading that code I would expect that "s" reads
> from "buf". So to me the behavior is confusing and hence error prone.
> Could you explore alternatives?

I agree that there is some confusion, but I believe that confusion is
unavoidable. In other words no matter what the verb, it will always be
subject to interpretation both ways. The way I "break the tie" is
simply to follow the convention used in networking. You read from a
socket into your mutable buffer. You write to a socket from your const
buffer. We could explore alternatives, but then there would be a lack
of consistency. While I am usually not one to prioritize consistency
over every other consideration, in this particular case it does make
sense.

Regards


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk