Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is important that resources are reclaimed when exceptions are thrown. Throwing an exception may result in cleanup code being bypassed. As a result, it is the responsibility of the exception handler to properly cleanupclean up. This may be problematic if the exception is to be caught in a different function or module. Instead, it is preferable if resources are reclaimed automatically when objects go out of scope.

...

In this code, the exception handler recovers the resources accociated associated with the object pointed to by pst.

It might be better to replace the pointer pst with an auto_ptr which that automatically cleans up itself.

...