Marshall Clow | 16 Jul 23:48

Re: how can I return a 'null' smart pointer?

  gast128 <gast128 <at> hotmail.com> 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> idio.com>

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.

Gmane