Re: [Boost-bugs] [Boost C++ Libraries] #8966: No exception thrown (e.g. std::bad_alloc) on allocation failure in lexical_cast

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #8966: No exception thrown (e.g. std::bad_alloc) on allocation failure in lexical_cast
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-06 15:29:17


#8966: No exception thrown (e.g. std::bad_alloc) on allocation failure in
lexical_cast
---------------------------------------+--------------------------
  Reporter: Martin <martin.raiber@…> | Owner: apolukhin
      Type: Bugs | Status: new
 Milestone: To Be Determined | Component: lexical_cast
   Version: Boost Development Trunk | Severity: Cosmetic
Resolution: | Keywords:
---------------------------------------+--------------------------

Comment (by Martin <martin.raiber@…>):

 True.

 To add arguments to the other side:

 1. Allocation failure is something completely different from a
 bad_lexical_cast and one would probably want to handle them differently.
 For example we have code which returns a standard value if the input is
 not numeric. On allocation failure it should not continue processing, but
 stop with an error.
 2. std::bad_alloc is thrown by most of the STL and new and is therefore
 the standard way to inform callers of allocation failures. That the
 streams do not throw exceptions can fortunately be changed. Personally, if
 I did not know about the unusual behavior of streams with regard to
 exceptions, I would have expected lexical_cast to throw bad_alloc.
 3. I looked at the MSVCRT and libc++ and both have a catch-all which
 either sets the bad-bit or rethrows the exception.

 That said. This is clearly cosmetic, because allocation failures are hard
 to produce on modern overcomitting operating systems.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8966#comment:2>
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:13 UTC