I wrote a Linux program based on the open source crimson library. This library sometimes calls segfaults which I cannot control. And, of course, after segfault happens in the library, the whole program dies. However, I have to make sure that my program continues to work, even if the library has segfaults. This is due to the fact that my kind of program serves as a “server”, and it needs to at least tell clients that something bad has happened and fix the errors, not the chicken ... Is there a way to do this?
I understand that in Java you just need to catch the exception. But how does C ++ handle this?
[UPDATE] I understand that C ++ has exception handling, but Segfault is not an exception, is it? I do not think that something is thrown when segfault happens. You must explicitly throw something to use try .... catch ... as far as I know.
Thanks a lot, I'm pretty new to C ++.
c ++ segmentation-fault exception exception-handling signals
CodeNoob
source share