seek bug in stringstream?

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


        ostringstream ost;
        cout << ost.tellp() << endl;


Take a look at 27.7.1.3, in particular the bits about seekoff.

p 11: "for a sequence to be positioned, if it's next pointer is a null
pinter the position operation fails." This is effectively true for a
stringstream object that is constructed by default, ie, all that have
_M_buf_size == 0.

p 13: "if the position operation fails, ..., the object stores an
invalid stream position" 

27.4.3.2 fpos requirements, p 2
"stream operations that return a value of traits::pos_type return
P(O(-1)) as an invalid value to signal an error."


Nathan, your patch looks fine. Thanks!

-benjamin


More information about the Libstdc++ mailing list