This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Strange stream behaviour


On Sun, Oct 07, 2001 at 03:07:38PM -0600, Martin Sebor wrote:
> Nathan Myers wrote:
> > On Sat, Oct 06, 2001 at 06:35:57PM +0400, Roman Belenov wrote:
> > > I've found that simple copy program
> > >   #include <iostream>
> > >   int main()
> > >   { int ch; while( (ch = std::cin.get()) != EOF ) std::cout.put(ch); }
> > >
> > > duplicates pieces from input, first occurence being about
> > > position 3000 in the input stream.
> > 
> > There is no reason to expect the program to work.  
> 
> ... 27.6.1.3, p4 clearly says that the function returns the extracter 
> character if one is available, otherwise traits_type::eof(), which in 
> this case is the same as EOF.

Martin is right, I was wrong.  (This is a bit of streambuf's interface
leaking out to istream.)  If the problem Mr. Belenov reports is 
reproducible, it's a real bug.

Apologies for the confusion.  

Nathan Myers
ncm at cantrip dot org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]