Boost logo

Boost Users :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-09-19 12:59:46


Here's what went on in my head when I thought about this issue:

Performance
===========
Throw
   +main execution path of algorithm is fast
   -have to leave exception handling turned on
Return flag
   -insert if's throughout main execution path, causes slowdowns
   +can turn off exception handling

I haven't done any experiments to compare the above, but since people
shouldn't be turning off exception handling anyways, and some compilers
do a decent job w.r.t. performance with exception handling, I think this
is in favor of throwing.

Code Clarity
============
Throw
    + algorithm code is uncluttered
Return flag
    - if's in the algorithm code add clutter to sometimes already
       complicated algorithm.

Here, the adv. is cleary for throw.

So I went with throw.

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net