[Bug c++/14653] New: Semantics of ifstream.bad have changed from gcc 2.95.3 to gcc 3.2.3
saunak dot chakrabarti at gs dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 19 15:44:00 GMT 2004
Linux egnoq01pb01.ny.eq.gs.com 2.4.18-19bigmem #1 SMP Thu Feb 27 14:21:17 EST
2003 i686
In the test program below, the ifstream is not 'bad' when the associated file
does not exist. In gcc 2.95.3, this was not the case. What was the reason for
changing the semantics of ifstream.bad()? Of note, ifstream.fail() detects
when a file does not exist in both cases.
#include <iostream.h>
#include <fstream.h>
int main()
{
ifstream routerIn( "/home/salesoma/router.config");
if ( routerIn.bad() )
{
cerr << "Problem!" << endl;
}
else
cerr << "No Problem " << endl;
return 0;
}
Gcc 2.95.3 says Problem!
But GCC 3.2.3 says NoProblem!
--
Summary: Semantics of ifstream.bad have changed from gcc 2.95.3
to gcc 3.2.3
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: saunak dot chakrabarti at gs dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14653
More information about the Gcc-bugs
mailing list