seek bug in stringstream?

Benjamin Kosnik bkoz@cygnus.com
Sat Apr 1 00:00:00 GMT 2000


> gives:
> 
> -1
> 5
> 12

this is correct. if gptr() is not valid, pos_type(-1) is returned. 

> 0
> 5
> 12
> 0
> 5
> 12          

... these should be -1 not 0. 

> --- /home/larsbj/Development/libstdc++/bits/sstream.tcc Fri Mar 24 01:41:56 2000
> +++ /local/larsbj/egcs/libstdc++-v3/bits/sstream.tcc    Fri Mar 24 04:11:01 2000
> @@ -123,8 +123,7 @@
>        bool __testout = __mode & ios_base::out && _M_mode & ios_base::out;
>        bool __testboth = __testin && __testout && __way != ios_base::cur;
> 
> -      if (((__testin && !__testout) || (__testout && !__testin) || __testboth)
> -         && _M_buf_size)
> +      if (((__testin && !__testout) || (__testout && !__testin) || __testboth))
>         {
>           char_type* __beg = _M_buf;
>           char_type* __curi = NULL;       

nope. This is incorrect. 

I believe CVS libstdc++ is correct now.

-benjamin


More information about the Libstdc++ mailing list