This is the mail archive of the gcc-bugs@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++/10132: filebuf destructor throws exceptions


Synopsis: filebuf destructor throws exceptions

State-Changed-From-To: analyzed->feedback
State-Changed-By: bkoz
State-Changed-When: Wed Apr 23 03:47:05 2003
State-Changed-Why:
    This is in violation of 17.4.4.8.
    
    I'm thinking about adding throw() exception specifications to codecvt member funtions. This could be considered a tightening of exception specs, which is allowed in 17.4.4.8 p1 (although I remember some noise when the proposal to add throw() to dtors was suggested.) That should at least make the locale::facet policy on error reporting (22.2 - Standard locale categories p 2) clear, even though it won't necessarily remove the issue.
    
    To remove it completely, I'd have to do a try around the close() call in basic_filebuf::~basic_filebuf(). And what should happen in the catch? 
    
    I believe the theory of error handling in the design of the io classes is that basic_ios/basic_istream/basic_ostream throw, catch, and propogate exceptions. The streambuf classes just return eof/-1 (showmanyc, pbackfail, seekoff, seekpos) or NULL (open, close) to report errors. 
    
    The problem is the intersection of std::locale, which can throw on construction (locale(const char*), combine) and whenever a use_facet is used. Facets, as above, in practice use iostate or some other mechanism to report errors. Although, nothing (except exception-saftey paradoxes) keeps derived/user-defined classes from doing this.
    
    -benjamin

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


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