» Sign in
  

Throwing exceptions from a signal handler is undefined by the ANSI C++ Standard. aC++ does not expect you to able to do this and only expects throws to be done on calls, not in the middle of blocks of code where a signal may occur. (Also, the try block starts at the first call.) In general, there may be other issues with assembly code generation in system libraries that makes it unwindable, if you get a signal.

If you care about your code being maintainable in the long term, you should not throw exceptions from a signal handler. For example, throwing out of a signal handler will definitely not work on Itanium. The best thing that could happen is that your program gets terminated. The reason is that we cannot both maintain correct optimizations in the non-exception case and assume that any instruction can throw an exception. All optimizations, therefore, consider that an exception can be thrown only out of a call.

Thanks to Dennis Handly and Christophe de Dinechin.



Manage My AllianceOne Membership

 
 » Sign in
 » Join AllianceOne
 » Contact us