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 16:27:55
#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 apolukhin):
I'd love to apply that change if it does not break user code. I do not
argue that it is better to throw `std::bad_alloc` than `bad_lexical_cast`
in case of memory error. But the part that breaks user code is
`basic_ios::failure` exceptions. There is a big chance that instead of
`bad_lexical_cast` user will get `basic_ios::failure` and won't catch it.
But a trivial thought popped in my head: "Do catch the
`basic_ios::failure` exceptions and convert them to the `bad_lexical_cast`
exceptions!". I'll look through the tests and if after setting
`stream.exceptions(std::ios::badbit);` the `basic_ios::failure` exceptions
are rare, then I'll apply the patch.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/8966#comment:3> 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