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++/9533


On Tue, Mar 04, 2003 at 10:36:03AM +0100, Paolo Carlini wrote:
> Nathan Myers wrote:
> 
> >Ideally showmanyc() should try to do an fstat64() on the file 
> >descriptor and report the result, if any.
> >
> ...
> 
> >It also ought to try 
> >
> > ::recv(this->fd(), 0, 0, (MSG_DONTWAIT|MSG_PEEK|MSG_NOSIGNAL))
> >
> >in case it's a socket or pipe.
> >
> Another observation which comes to my mind: that this approach is
> really low level wrt the underflow (hack, indeed) can be seen clearly
> from the fact that in this way we get the size in bytes, not the
> number of chars in the internal representation.
> Therefore, it seems to me, showmanyc will have to use also the
> codecvt information.

No.  If there is a codecvt<> involved (is there? I didn't look, 
I thought that was a filebuf<> thing) then showmanyc() should divide 
the number of bytes by the maximum character size, 
std::codecvt<>::max_length().  Remember it's returning an estimate,
a lower bound, and shouldn't be doing too much work.

Nathan Myers
ncm-nospam at cantrip dot org


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