I recall reading about how exceptions could be caught without the use of try/catch. Basically when an exception is thrown such as “Unhandled exception” via derefencing a null pointer, there would be a process that is triggered even when a try/catch is not coded for the exception. I believe it had something to do with a top level library that you write then include in your code. Unfortunately documentation on such a method seems to be non-existent but I have seen/heard of such a method being done before. Could someone please explain how this is done?
I recall reading about how exceptions could be caught without the use of try/catch.
Share
In C++, dereferencing a null pointer causes undefined behavior, which does not necessarily imply that an exception is thrown. On Unix systems, for example, a SIGSEGV signal is raised instead.
On Windows, access violations raise a SEH exception. SEH exceptions are not the same as C++ exception; they are handled using
__try/__exceptstatements (as opposed totry/catchstatements). An unhandled SEH exception invokes unhandled exception filter, which you can set usingSetUnhandledExceptionFilter.