Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2007-03-23 12:24:45

Mathias Gaunard wrote:
> Marco wrote:
>> (4) decide if we have to use exception handling C++ constructs for
>> arithmetic exceptions ( divide by zero, etc) or simply abort the
>> program; this is essentially a matter of performance;
> I didn't know aborting the program was more efficient than throwing an
> exception.

It's not. Or at least efficiency is irrelevant once the program is dead :-)

> Why not just invoke undefined behaviour if that allows the best
> efficiency?

Why not throw an exception? Any overhead only occurs when an error has
actually happened, not on every operation. Or even better:


And give the user a chance to decide what happens.

Regards, John.

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