In general, I tend to use try/catch for code which has multiple failure points for which the failures have a common handler.
In my experience, this is typically co
In C++ you shouldn't use try/catch blocks to perform cleanup. Instead, you might want to use templates to perform resource aquisition.
auto_ptr's are one [bad] example
Synchronization locks, where you store a mutex as a state variable, and use local variable (templates or regular classes) to perform the .acquire()/.release() methods.
The more of this you do, the less you have to worry about manually releasing objects in exceptional conditions. The C++ compiler will do it for you.
In most languages entering and exiting a try/catch block via the normal methods is free, it's only when an exception is thrown that the exception handler looks up where to handle the exception.
I find the C++ FAQs site and corresponding book has an enlightening discussion on the matter.
http://www.parashift.com/c++-faq-lite/exceptions.html
To your second question: general guidelines are here, Herb Sutter also gives pretty good advise here.
In my experience the biggest problem with try/catch blocks are we often try to catch exceptions too generically. For instance, if I wrap my main function with a try/catch block that catches (...) I am basically trying to not allow my program to crash b/c of a thrown exception.
The problem with this approach as I see it is two fold. 1) While I'm testing and debugging I don't see any errors and I don't get the opportunity to fix them. 2) It's really kind of taking the lazy way out. Instead of thinking through the problems that may come up and figuring out what the edge cases are I'm just trying not to fail. Trying not to fail is a lot different than trying to succeed.
In c++, the cost depends on the implementation. In general, there are two ways to implement exceptions:
The first is the "table" approach. The compiler builds a set of tables to look up, at the point where the exception is thrown, where to go. When the exception is thrown, it has to search through each table up the call stack until it finds something that will catch this exception. Since this is all runtime based, entering or exiting a try catch produces no penalty (good) but throwing an exception involves potentially many lookups, producing a much slower throw. I personally prefer the not-having-to-pay for try catch blocks, because exceptions should be a very rare circumstance. This also would make executables larger, if they have to store the tables.
The seconds is the "code" approach. Each time the code enters a try catch block, conceptually, the location of the block is pushed onto a stack. This produces a cost during entering and exiting a try-catch block, however, when an exception is thrown, the runtime mechanism can quickly pop off the stack to find where to go. So, throwing exceptions is (much?) faster, but entering a block now has a cost. Putting a try catch block in a tight low level loop could produce significant overhead.
You would have to check your specific compiler to see which one they use.