[libstdc++] Proposed patch for fstream.h

Peter Schmid schmid@snake.iap.physik.tu-darmstadt.de
Fri Mar 23 16:03:00 GMT 2001


|hmm. streampos is not actually used:
|
|      pos_type 
|      tellg(void);
|
|      __istream_type& 
|      seekg(pos_type);
|
|      __istream_type& 
|      seekg(off_type, ios_base::seekdir);

According to Josuttis "The C++ Standard Library" page 634 -- 636, 
instead of std::ios::pos_type pos (= file.tellg()), I can also write
std::streampos pos. 

Quote from Josuttis:

"Class fpos<> is used to define types streampos for char and
wstreampos for w_char_t streams. These types are used to define the
pos_type of the corresponding character traits. And the pos_type
member of the traits is used to define pos_type of the corresponding
stream classes. Thus, you could also use streampos as the type of the
stream positions". 

Since old code (using the old iostream implementation, confer e.g.
the version of libstdc++ which is shipped with gcc-2.95.2)
defines streampos as return type for tellg, I propose to expose
streampos to the global namespace, if that makes sense.  
    
Peter Schmid




More information about the Gcc-patches mailing list