public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-07  6:26 Carlo Wood
  0 siblings, 0 replies; 6+ messages in thread
From: Carlo Wood @ 2002-01-07  6:26 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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

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

 On Mon, Jan 07, 2002 at 01:41:41PM -0000, us@ooc.de wrote:
 >     fstream afile(MYNAME, ios::in|ios::out|ios::app);
 >     assert(afile);
 
 Did you mean:  assert(!afile);  ?
 
 -- 
 Carlo Wood <carlo@alinoe.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-08  8:16 Paolo Carlini
  0 siblings, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2002-01-08  8:16 UTC (permalink / raw)
  To: paolo; +Cc: gcc-prs

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

From: Paolo Carlini <pcarlini@unitus.it>
To: us@ooc.de, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	gcc-bugs@gcc.gnu.org, paolo@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/5297: operator!() const incorrect for fstream class
Date: Tue, 08 Jan 2002 17:12:18 +0100

 Hi Uwe,
 
 regarding that example, unfortunately there are many typos in the, 
 otherwise excellent, book by Langer/Kreft: please refer to 
 http://www.langer.camelot.de/IOStreams/errata.htm for a complete list. 
 The table in pag. 44 and the specific paragraph at the end od pag. 43 
 are clear, as the standard or Josuttis are, by the way...
 
 Thanks,
 Paolo.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5297 
 
 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-08  6:36 Uwe Seimet
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Seimet @ 2002-01-08  6:36 UTC (permalink / raw)
  To: paolo; +Cc: gcc-prs

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

From: Uwe Seimet <us@orbacus.com>
To: paolo@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	nobody@gcc.gnu.org, us@ooc.de, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/5297: operator!() const incorrect for fstream class
Date: Tue, 8 Jan 2002 15:31:25 +0100

 Hello,
 
 >     This has nothing to do with operator!().
 >     More simply, the open mode in|out|app is *not* allowed: see,
 >     f.i. Josuttis p. 632 or Langer/Kreft p. 43.
 >     Therefore, conformly to what prescribed by the standard, the
 >     open fails and !afile is in any case true.
 
 Hmm. "Standard C++ IOStreams and Locales" by Langer and Kreft, Addison
 Wesley says in|out|app is allowed. They use it in their example in 1.4.2.
 What now? :)
 
 Best regards,   Uwe
 
 -- 
 ----------------------------------------------------------------------------
  Dr. Uwe Seimet                                    mailto:us@orbacus.com
  IONA - END 2 ANYWHERE                             http://www.orbacus.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-07 13:46 paolo
  0 siblings, 0 replies; 6+ messages in thread
From: paolo @ 2002-01-07 13:46 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, us

Synopsis: operator!() const incorrect for fstream class

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Mon Jan  7 13:46:37 2002
Responsible-Changed-Why:
    Analyzed.	
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Mon Jan  7 13:46:37 2002
State-Changed-Why:
    This has nothing to do with operator!().
    More simply, the open mode in|out|app is *not* allowed: see,
    f.i. Josuttis p. 632 or Langer/Kreft p. 43.
    Therefore, conformly to what prescribed by the standard, the
    open fails and !afile is in any case true.
    
    Thanks for your report,
    Paolo.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5297


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-07  6:36 Uwe Seimet
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Seimet @ 2002-01-07  6:36 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* libstdc++/5297: operator!() const incorrect for fstream class
@ 2002-01-07  5:46 us
  0 siblings, 0 replies; 6+ messages in thread
From: us @ 2002-01-07  5:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5297
>Category:       libstdc++
>Synopsis:       operator!() const incorrect for fstream class
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 07 05:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Uwe Seimet
>Release:        gcc version 3.0.3
>Organization:
>Environment:
Linux duplo 2.4.17 #1 SMP Thu Dec 27 09:22:23 MET 2001 i686 unknown
>Description:
operator!() const does not seem to call fail(), as mandated
by the ISO C++ standard, 27.4.4.3. This code fragment:

    fstream afile(MYNAME, ios::in|ios::out|ios::app);
    assert(afile);

always leads to an assertion, even when the stream could be
opened correctly. Looks as if fail() is not called at all,
at least operator!() always seems to return false.
 
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-01-08 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-07  6:26 libstdc++/5297: operator!() const incorrect for fstream class Carlo Wood
  -- strict thread matches above, loose matches on Subject: below --
2002-01-08  8:16 Paolo Carlini
2002-01-08  6:36 Uwe Seimet
2002-01-07 13:46 paolo
2002-01-07  6:36 Uwe Seimet
2002-01-07  5:46 us

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).