This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libstdc++/5297: operator!() const incorrect for fstream class


The following reply was made to PR libstdc++/5297; it has been noted by GNATS.

From: Uwe Seimet <us@orbacus.com>
To: Carlo Wood <carlo@alinoe.com>
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/5297: operator!() const incorrect for fstream class
Date: Mon, 7 Jan 2002 15:29:39 +0100

 Hello Carlo,
 
 > >     fstream afile(MYNAME, ios::in|ios::out|ios::app);
 > >     assert(afile);
 > 
 > Did you mean:  assert(!afile);  ?
 
 Actually our code looks like this:
 
     fstream afile(m_asset_file, ios::in|ios::out|ios::app);
     if (!afile) {
         cerr << "Cannot open " << m_asset_file << endl;
         throw 0;
     }
 
 Even if the stream could be created I get the "Cannot open" message with gcc
 3.0.3. With other C++ compiler and also with gcc 2.95.3 everything is fine.
 !afile should evaluate to false, not to true, because operator!() const
 should return the result of fail(), as mandated by ISO C++, 27.4.4.3.
 
 Best regards,  Uwe
 
 -- 
 ----------------------------------------------------------------------------
  Dr. Uwe Seimet                                    mailto:us@orbacus.com
  IONA - END 2 ANYWHERE                             http://www.orbacus.com


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