Versions Compared

Key

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

...

Code Block
bgColor#FFcccc
while (moreToDo) {
   SomeType *pst = getNextItem();
   try {
      pst->processItem();
   }
   catch (...) {
      // deal with exception
      throw;
   }
   delete pst;
}

The code above of the Non-Compliant Code Example does not recover the resources associated with the object pointed to by pst in the event that processItem throws an exception, thereby potentially causing a resource leak.

...