Change of behaviour, or something broke in cin/streambuf behaviour between 3.3.4 and 3.4.1?
Andrew Walrond
andrew@walrond.org
Wed Sep 22 11:42:00 GMT 2004
My application broke between gcc 3.3.4 and gcc 3.4.1 and I don't know quite
what to make of it.
The code:
#include <iostream>
int main(int argc,char* argv[])
{
using namespace std;
std::streamsize a = std::cin.rdbuf()->in_avail();
cout << " in_avail " << a << endl;
return 0;
}
compile with
gcc -lstdc++ test.cpp
run with
echo hello | ./a.out
When compiled with gcc 3.3.4 produces
in_avail 6
but when compiled with gcc 3.4.1 produces
in_avail 0
Is the code using some undefined behaviour, or did something break?
Andrew Walrond
More information about the Gcc
mailing list