Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-11-29 09:02:16


Andrzej Krzemienski wrote:

> I suspect (I am not programming in an embedded system) that rather than
> relying on __builtin_trap() or std::abort(), what you do is start treating
> a `resize()` over `capacity()` as a precondition violation (a bug). And
> this causes a different programming model and the organization of your
> code.

That was exactly why I wrote

> > There's no need to afford exceptions, you just need to be able to afford
> > the potential loss in performance, basically one branch per append if
> > not heroically optimized away.

That is: in order to use the library as presented, you don't need to afford
exceptions, but you will need to basically duplicate the same check op+=
does, in user code; this may decrease performance, but will not allow a
buffer overflow in case you either forgot the check or got it wrong.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk