libstdc++/10093: Regression: Setting failbit in exceptions doesn't work

Martin Sebor sebor@roguewave.com
Sun Mar 23 20:30:00 GMT 2003


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

From: Martin Sebor <sebor@roguewave.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/10093: Regression: Setting failbit in exceptions doesn't
 work
Date: Sun, 23 Mar 2003 13:18:57 -0700

 Pétur Runólfsson wrote:
 ...
 > 
 > Note the "during input". I read that as meaning that this refers only
 > to exceptions thrown by the call to num_get::get(), not to exceptions
 > thrown from other functions the extractors may call.
 
 The general requirements on what causes exceptions to be caught
 and rethrown are buried in 27.6.1.1, p1-4. According to the text
 only calls to members of streambuf are supposed to be checked
 for exceptions. But because it's not possible to distinguish
 between an exception thrown by, say, a (virtual) member function
 of ctype called from num_get::get() and one thrown by a (virtual)
 streambuf member called (indirectly, via an istreambuf_iterator
 member) from num_get::get(), the requirement cannot realistically
 be taken to mean just exceptions thrown during a call to num_get
 ::get() and not, for instance, ctype::is() called by the istream
 ::sentry ctor. IMO, stream members should consistently catch all
 exceptions from any functions they may call.
 
 > 
 ...
 > The whole text about the meaning of exceptions() and the handling of
 > exceptions thrown during calls to I/O functions seems rather messy.
 > Perhaps someone more familiar with the standard cares to comment?
 
 I agree that error handling in iostreams (and locale) in general
 and exception handling in particular is less than perfect. I have
 filed a number of issues(*) in an attempt to clean up this area
 but I have a feeling there is more work to be done.
 
 (*) A number of them aren't listed yet (they should be in Revision
 25 of the issues list), but this one is
 
 http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#309
 
 Regards
 Martin
 



More information about the Gcc-prs mailing list