Home > Articles > Programming > C/C++

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Conclusion

Conclusion

The use of exceptions is a standard part of languages such as Java. Exceptions are also available in both Python and C++. The major merit of exception handlers is that they help to solve the problems that occur when resource allocations need to be reversed in a clean fashion. This is another way of saying that exception handlers help in avoiding the problem of resource leakage. If exception handlers were used exclusively for this purpose, I think that would make for cleaner and more robust code in general.

Exception handlers are an example of a kind of Separation of Concerns design pattern. In this context, your exception handlers do what they can with a defined set of exception conditions, and then they hand off responsibility for other exceptions.

My advice is to use exceptions wherever you feel it's appropriate and beneficial—even in situations where two programming languages are in use, such as C++ and Python.

  • + Share This
  • 🔖 Save To Your Account