This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14653] New: Semantics of ifstream.bad have changed from gcc 2.95.3 to gcc 3.2.3
- From: "saunak dot chakrabarti at gs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Mar 2004 15:44:55 -0000
- Subject: [Bug c++/14653] New: Semantics of ifstream.bad have changed from gcc 2.95.3 to gcc 3.2.3
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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