I am including a third party header file. It has functions that may/may not throw exceptions. In my source code, how do I determine which exceptions could possibly be thrown from that file? It was an interview question. My reply was go through the function declarations and look for exception specification. That could give us some hint. Is there any other way with which we can predict exceptions that could be thrown?
This has several aspects:
std::exception
, so assuming that or a derived type is thrown is a good approach.std::bad_alloc
from any function allocating memory.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With