initial tellp from different streams.

Lars Gullik Bjønnes larsbj@lyx.org
Mon Mar 4 09:14:00 GMT 2002


I have been planning to raise this question again for a long time. I
first raised it about ~2 years ago.

For different newly initialized streams I have these results:

Testing tellp.
ostringstream.tellp() = -1
   ostrstream.tellp() = 0
     ofstream.tellp() = 0
              ftell() = 0

I do not get why ostringstream is special. If I recall correctly, last
time I brought this up the conclusion was that the standard does not
say what exactly should be returned. So IMHO it was an QoI issue wheter
to return '-1' or '0'. I think Nathan agrred with me?

However, I tried to create a patch that made all the streams behave
equally (returning '0'). I got a response that the patch was wrong, I
then realized that I would not be able to get it right. The issue died
after that.

Anyway this is the prog I use to show inital values:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: stringstreamtest.C
Type: application/octet-stream
Size: 6636 bytes
Desc: test tellp on init streams
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20020304/085fe7ba/attachment.obj>
-------------- next part --------------



-- 
	Lgb


More information about the Libstdc++ mailing list