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]

in_avail() error. Major compliance problem


There is a problem with in_avail() in libstdc++ 3. I think it is a huge 
problem as lots and lots of existing, compliant code wont work as expected, 
and I suspect an easy fix, although I haven't checked myself.

Example:

#include <iostream>

int main()
{
        std::cout << std::cin.rdbuf()->in_avail() << std::endl;

        return 0;
}

This simple code should write a 0 and exit immediately. This is what happens 
with gcc 2.95.3 and the library that comes with that. With gcc 3.0.2, it is 
hanging blockingly until enter is pressed, and then writes a 1. Code that 
checks the buffer in this way does not expect execution to blocked by input. 
It expects and answer immediately. This is a huge problem, and I can't 
imagine that it hasn't been solved?

Regards,
David


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