Liviu Nicoara wrote:
Hi,The following test case fails with the latest dev stdcxx (*): tmp$ cat t.cpp #include <assert.h> #include <iosfwd> #include <strstream> int main () { std::strstreambuf sb; std::ostream os (&sb); os << " "; std::streampos pos = sb.pubseekoff (0, std::ios::end, std::ios::out); assert (pos == 1); return 0; } I ran it in an 11s build on Linux and it asserts - pos is coming back as 128 (coincidentally the size of our implementation's buffer, 16 for gcc, 512 for aCC, 128 for SunPro). The reason for this seems to be D.7.1 p4: "Each object of class strstreambuf has a seekable area, delimited by the pointers seeklow and seekhigh. If gnext is a null pointer, the seekable area is undefined. *Otherwise, seeklow equals gbeg and seekhigh is either pend, if pend is not a null pointer, or gend.*" The specification for seekhi seems to be incorrect - seekhi should be the last initialized character in the controlled sequence.
That's quite possible. There is an open issue about seekoff() in stringbuf which looks related to what you're pointing out: http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#563 Unfortunately the C++ committee has been reluctant to invest time and effort into fixing problems in the deprecated stream classes so it's unlikely that the current requirements will change. Let me raise it on the reflector to see if there's any willingness to fix this. Martin
Liviu (*) The failure is also present in GNU libstdc++ (gcc 4.1.0), SunPro's C++ Standard Library (5.3 through 5.8), HP aCC 3.63's stdlib but not Dinkumware (AIX 5.3 w/ VisualAge for C++ 8.0, Windows XP w/ MSVC 7.1 and 8.0).
