[Exceptional C++ Style] Item 12: Exception Safety: Is itWorth it?

Falcon, Pablo (IT) Pablo.Falcon at morganstanley.com
Thu Dec 2 17:54:32 EST 2004


As a disclaimer I must say that this impression I talked about in my
last email does not apply to my current job, in which I am quite new and
thus unable to judge at the moment. In fact initially it looks like
these guys do know what they're doing... so I may even change my
pessimistic view of the world ;-)

Regards, 

Pablo
 

> -----Original Message-----
> From: effective-cpp-bounces at accu.org 
> [mailto:effective-cpp-bounces at accu.org] On Behalf Of Ric Parkin
> Sent: 02 December 2004 14:50
> To: effective-cpp at accu.org
> Subject: Re: Re: [Exceptional C++ Style] Item 12: Exception 
> Safety: Is itWorth it?
> 
> From: "Paul Grenyer" <paul at paulgrenyer.co.uk>
> > >  This is my summary for item 12. Not a very complex item to 
> > > summarize but I guess one that could generate some controversy.
> > 
> > Another excellent summary! Anyone got any comments. Is there anyone 
> > here who doesn't think it is worth writing exception safe code?
> 
> 
> In general I think you ought to as a matter of course, as it 
> often leads to "better" code (even if no exceptions occur.)
> 
> 
> 
> Except...
> 
> - If there's no need.
> 
> Eg, you use no language/library features that can throw 
> (recently spotted that the Exceptions and RTTI have been 
> turned off in our code base....)
> 
> - your team is proficient in non-exception code
> 
> It can cost in time, money, and quality to learn how to do it 
> in a new way, and if the code wasn't going to be any more 
> reliable, you have to consider not doing it.
> 
> - it would cost too much to add
> 
> eg an old exception-unsafe codebase that would get ripped to 
> shreds if an exception propagated. You're stuck with it.
> 
> - performance issues preclude it
> 
> Compilers might not have zero-overhead stack unwinding; 
> copy-and-swap might add too much even in cases where there is 
> little or no gain in safety; and measurements have shown that 
> these are an issue
> 
> In these cases, it is quite rational to decide to not do it.
> 
[ *** too many quoted lines.  automatically truncated *** ]

--------------------------------------------------------
 
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited. 
 




More information about the Effective-cpp mailing list