Re: Exceptions - should I use them?
mad-crapper <madcrapper@toilet.com> writes:
At the risk of starting a flame war, I think the "cost of exceptions"
argument is promulgated by old-farts who don't know or understand
exceptions.
Some questions about C++ exceptions, so that readers can
find out whether they ?know and understand? exceptions:
how many execution paths could there be in the following
code?
String EvaluateSalaryAndReturnName( Employee e )
{
if( e.Title() == "CEO" || e.Salary() > 100000 )
{
cout << e.First() << " " << e.Last()
<< " is overpaid" << endl;
}
return e.First() + " " + e.Last();
}
(IIRC, Question by Herb Sutter)
What is
the no-throw guarantee?
strong exception safety?
basic exception safety?
How are these accomplished in code?
Which kinds of exception specifications for function
definitions are recommended in C++ and which kinds are
deprecated?
How do smart pointers help to make C++ code
exception-safe? Which kind of smart pointer is
recommended for which scenario and how is it to be used?
How many persons who have learned ?C++ programming? as a
part of some kind of education (school, college, ...)
are able to correctly answer the above questions and
thus use exceptions in C++ in the safe and recommandable way?