Boost logo

Boost :

From: Ed Brey (edbrey_at_[hidden])
Date: 2001-09-10 09:17:15

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

> * There are many functions where a reasonable implementation may wish to
> allocate memory. These should be documented as potentially throwing
> std::bad_alloc. Like the standard library, it seems to me this can best be
> done with a blanket "any function may throw std::bad_alloc" statement
> rather than try to guess which functions an implementation may wish to do
> dynamic memory allocation.

No-throw guarantees for low-level libraries can make writing code that uses the library a lot easier. I'd hate to give this up just to avoid having to predict which functions will and won't allocate, since doing so doesn’t seem too hard. IMHO, the blanket statement should probably be nothrow, with bad_alloc listed among the exceptions for the appropriate functions.

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