Ensuring Proper Cleanup in the Case of an Uncaught Exception

It is implementation-dependent whether the destructors of local objects are invoked when an uncaught exception occurs. To ensure that destructors of local objects are invoked in this case, you can add a catch-all statement in main() like this.

 int main(){  try  {    //

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: