Boost logo

Boost Users :

From: Marshall Clow (marshall_at_[hidden])
Date: 2008-07-16 17:48:28


  gast128 <gast128_at_[hidden]> wrote:

>Sutter has made a guideline for when to use exceptions and when not ("When and
>How to Use Exceptions", http://www.ddj.org/cpp/184401836). By using this
>guideline, programmers actually have to deal with two strategies instead of
>one, not to mention that writing excpetion safe code (without leaks) is very
>hard. If you get stuck you can always buy his books :)

Actually, having read all of Bruce's books, and having talked to him
at a couple of conferences, I find that writing exception safe code
is quite simple - once you have embraced RAII everywhere. You do have
to think about exception safety, but for most routines that thinking
boils down to "What happens if something throws here? Um, ....
nothing bad.", since RAII ensures that no locals leak, and I can look
at the global/parameter cases quickly.

I find it also leads to simple, easy to write (and understand code).

-- 
-- Marshall
Marshall Clow     Idio Software   <mailto:marshall_at_[hidden]>
It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.

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