chimes_calculator
chimes_calculator copied to clipboard
Calling exit in library code / error handling
In several places in the library code exit
is used to handle (fatal) errors. This is problematic since the whole process is terminated without a chance to take care of the error in the calling code (e.g. calling from within IPython kills the kernel without a peep).
For a pure C++ library, probably the most elegant way would be to use exceptions. Of course interfacing with "non exceptional code" would require some care. I think using exceptions would be least invasive for the current library code. Alternatively, one could use the "good old" return error code approach and set a global error message. This would have the advantage to be consistent across different wrappers/bindings.