Question

Throughout the function handleException, the exception encountered is implicit. How does the compiler handle such implicit passing of exceptions? [For e.g. in C++ methods, this pointer is passed to account for the current object. My question is how does a compiler handle exceptions internally - handleException has no arguments.]

 void handleException()
 {
   try {
     throw;
   }
   catch (MyException& e) {
     ...code to handle MyException...
   }
   catch (YourException& e) {
     ...code to handle YourException...
   }
 }

 void f()
 {
   try {
     ...something that might throw...
   }
   catch (...) {
     handleException();
   }
 }

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top