I have a simple question hopefully - how does one free memory which was allocated in the try block when the exception occurs? Consider the following code:
I have to agree with all those that said RAII, however, I'd use Boost's shared_array instead of an auto_ptr. Auto pointer calls delete and not 'delete []' which will cause leaks with an array.