This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] Fix libstdc++/11722


Nathan Myers wrote:

Indeed, somehow I misread *this->gptr() as this->sgetc().

But I do think that the most common case must be __avail == 0, so maybe

if (__avail != 0)
{
if (__avail == 1)
*__s = *this->gptr();
else
traits_type::copy(__s, this->gptr(), __avail);
__s += __avail;
this->gbump(__avail);
__ret += __avail;
__n -= __avail;
}


Agreed, thanks. I will test and commit this improvement.

No. When the user hands over a buffer via setbuf, the streambuf owns
it, and the user cannot assume anything about what's in it. We might
want to document extensions, e.g. guarantees when the buffer is an anonymously-mmapped page sequence, but nothing that allows games like this. (For example, there might be advantages to putting characters
at a position in the buffer that matches their position, modulo page
size, in the file.)


Again, agreed, thanks (the above already ackowledges this too)

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]