If you've ever wondered why someone might throw an exception from a destructor, this article provides a legitimate example:
A C Error Handling Style that Plays Nice with C++ Exceptions
by Stefanus Du Toit
From the article:
By choosing a particular convention for a C API's error handling, we were able to very conveniently translate errors from the C API to C++ exceptions. ... Every experienced C++ programmer I know has opinions on how errors should be handled. I've found this style to be quite useful when layering C++ on top of C, and I think there's some beauty in the interplay between C and C++ here.
Add a Comment
Comments are closed.