[Boost-bugs] [Boost C++ Libraries] #13276: circular_buffer pulls in exception handling code

Subject: [Boost-bugs] [Boost C++ Libraries] #13276: circular_buffer pulls in exception handling code
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-10-26 19:08:26


#13276: circular_buffer pulls in exception handling code
------------------------------+-----------------------------
 Reporter: anonymous | Owner: Jan Gaspar
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: circular_buffer
  Version: Boost 1.65.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------------
 `circular_buffer` as shipped doesn't work for embedded applications - it
 ends up adding EH (and thus `printf`, etc.), which adds unacceptable bloat
 for devices without much flash. The problem is that, even if you create a
 non-throwing allocator, `circular_buffer::allocate(size_type n)` still
 first checks `n` against the allocator's `max_size()`, and throws if it is
 too large.

 As I understand it, an allocator should throw/assert anyway (depending on
 whether it's using EH or not) if you try to `allocate()` more than
 `max_size()`, so I've been patching by deleting the involved lines:
 {{{
 - if (n > max_size())
 - throw_exception(std::length_error("circular_buffer"));
 }}}

 These lines should at least get excluded from compilation, or replaced
 with an assert, if `BOOST_NOEXCEPT` is defined.

-- 
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13276>
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-10-26 19:14:51 UTC