[Boost-bugs] [Boost C++ Libraries] #2932: iostreams file_descriptor: possible throw of exception in call to destructor

Subject: [Boost-bugs] [Boost C++ Libraries] #2932: iostreams file_descriptor: possible throw of exception in call to destructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-04-09 18:34:13


#2932: iostreams file_descriptor: possible throw of exception in call to
destructor
--------------------------------------------+-------------------------------
 Reporter: Robert Hunger <rhunger_at_[hidden]> | Owner: turkanis
     Type: Bugs | Status: new
Milestone: Boost 1.39.0 | Component: iostreams
  Version: Boost Development Trunk | Severity: Problem
 Keywords: |
--------------------------------------------+-------------------------------
 The implementation "struct file_descriptor_impl" used by "class
 file_descriptor" possibly throws an exception in its destructor.

 The following code snippets come from:
 [http://svn.boost.org/svn/boost/trunk/libs/iostreams/src/file_descriptor.cpp]

 line 77:
 {{{
 file_descriptor_impl::~file_descriptor_impl()
 { if (flags_ & close_on_exit) close(); }
 }}}

 line 194:
 {{{
 void file_descriptor_impl::close()
 ...
         if (!success)
             throw_system_failure("failed closing file");
 ...
 }}}

 IMHO throwing exceptions in destructors should be avoided.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2932>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC