[RFC] So, which is the correct type of _M_*_end - _M_*_cur?

Paolo Carlini pcarlini@unitus.it
Tue Apr 29 17:45:00 GMT 2003


Hi,

reading and re-reading this code I noticed another minor
inconsistency.

In streambuf.tcc we can find two very neat and symmetric
implementations of basic_streambuf::xsgetn and
basic_streambuf::xsputn, but, in the former:

//
  while (__ret < __n)
    {
      size_t __buf_len = _M_in_end - _M_in_cur;
      if (__buf_len > 0)
        {
          size_t __remaining = __n - __ret;
          size_t __len = std::min(__buf_len, __remaining);
//

whereas, in the latter:

//
  while (__ret < __n)
    {
      off_type __buf_len = _M_out_end - _M_out_cur;
      if (__buf_len > 0)
        {
          off_type __remaining = __n - __ret;
          off_type __len = std::min(__buf_len, __remaining);
//


Which one is right???

Paolo.



More information about the Libstdc++ mailing list