try catch(...)
I am a windows programmer who is porting an app to linux. It is going well so far but I am hitting a seg-fault. My error handing code seems to be at issue.
Code try { ReallyUglyFunction(); //throw lots of std::exceptions plus many others including divide by zero or referencing bad memory } catch (exception e) { // catches what I expect } catch (...) { // never catches anything in linux } In Windows catch(...) is a fail safe that catches everything. In Linux catch(...) doesn't seem to catch anything. What do I need to do to fix this? Thanks |
From what I've seen, errors like division by zero and segmentation violations result in signals being forced on a process by the kernel. You can install signal handlers in your C++ program like so:
Code:
#include <exception> Code:
[mascdman@odin tmp][ :) ]$ ./a.out Code:
[mascdman@odin tmp][ :) ]$ ./a.out --mascdman |
Re: try catch(...)
Quote:
code, including the output you get on screen? Cheers, Tink |
I think I have things back under control.
Thanks for all the help. |
All times are GMT -5. The time now is 12:14 AM. |