Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (jp)

...

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

...

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

...

Wiki Markup
\[[Meyers 96|AA. C++ References#Meyers 96]\] Item 9: ""Use destructors to prevent resource leaks".".

...

RES37-C. Release resources that require paired acquire and release in the object's destructor      08. Memory Management (MEM)      09. Input Output (FIO)