Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2001-03-16 18:46:48

That cost can be handled by writing a dedicated function for throwing a
particular exception type, and calling that function instead of throwing
directly each time.


----- Original Message -----
From: "Jesse Jones" <jesjones_at_[hidden]>

I think exceptions are more expensive than you realize. For example, I just
disassembled a simple function in release with CodeWarrior 6. It comes out
to 44 bytes. If I add a line that reads "if (!block) throw
std::logic_error("bad param");" it balloons to 192 bytes (not counting the
extra space needed for the string literal). If I add a second line that
reads "if (block) throw std::logic_error("bad param2");" it grows to 308
bytes. This is not a pretty picture, especially if you use asserts heavily
as I do.

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