except - small OS exceptions library
This library will transform system exceptions – SEH on Windows, SIGNALs on POSIX, in C++ exceptions.
This repository contains code for the NullPointerException in C++ article.
Structured Exceptions Handling (SEH)
eh.h in cooperation with
/EHa compiler flag.
CMake build option:
Library can use both
sigaction in cooperation with
-fnon-call-exceptions compiler flag.
sigaction works as expected only with GCC on Linux.
signal partially works only on... Windows.
CMake build options:
Tested Compilers / Platforms
results for more information.
Library uses CMake. Have a look at
build.cmd for adjustments.
Since this code was done for testing purposes, you should not use it as it is in production. Make sure to select only the exeptions you can handle (null pointer, division by zero), and for the rest just call std::abort.
Also you should be careful about allocations in POSIX signals, std::ostringstream will allocate memory. See the list of POSIX async-sygnal-safe functions.