Boost logo

Boost :

From: Ed Brey (edbrey_at_[hidden])
Date: 2001-09-10 14:26:42

From: "Beman Dawes" <bdawes_at_[hidden]>

> > [Default to nothrow]
> You are going to have a time convincing the standards committee of that,
> I'd guess. It is a rare function that someone in the LWG can't come up
> with a valid reason for wanting to do memory allocation in. Even if they
> can't, the implementors don't want their hands tied. Notice how few places
> there are in the standard where bad_alloc is prohibited.
> While Boost in general and Boost.Threads in particular doesn't have to
> follow the same approach as the standard, it will be easier in the long run
> if we do so.
> That said, maybe we can be a bit more helpful to users by identifying
> certain functions as meeting more stringent exception safety guarantees.

A starting point is functions that are handy to called in destructors and most constant functions. For example, in the case of Boost.Threads, locking, unlocking, waiting, and removing threads from a group seem like operations that would be useful in a destructor, and so they would be good nothrow candidates.

My expectation was that taken as a whole, over half the functions would be found to be good nothrow candidates, and so making nothrow the default would minimize expository effort. However, your point about keeping in practice of the standard is a good one and is more important than optimizing the documentation for size. The end result of marking key functions as not throwing is the same.

Boost list run by bdawes at, gregod at, cpdaniel at, john at