libstdc++/4703: filebuf::in_avail() not correct
David Rasmussen
pinkfloydhomer@yahoo.com
Fri Oct 26 13:16:00 GMT 2001
>Number: 4703
>Category: libstdc++
>Synopsis: filebuf::in_avail() not correct
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 26 13:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: David Rasmussen <pinkfloydhomer at yahoo dot com>
>Release: gcc-3.x
>Organization:
>Environment:
linux
>Description:
http://gcc.gnu.org/ml/libstdc++/2001-10/msg00172.html
#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?
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list