Serving the Quantitative Finance Community

 
User avatar
Jim
Posts: 1
Joined: February 1st, 2002, 5:20 pm

Error Handling in C++

June 23rd, 2002, 2:54 pm

For anyone who is interested, attached is a .zip file containing a Windows structured exception handler which translates O/S generated exceptions (like divide by zero, access violation, etc.) and rethrows them as STL exceptions which can be caught in the usually way (i.e., catch (...)). To have your Windows program use this handler, insert the following line at the start of the program: _set_se_translator(SystemUtils::StructuredExceptionHandler);Note that in my app the code resides in a SystemUtils directory with a SystemUtils namespace. You'll probably need to modify that to work with your setup.Regards,Jim Murphy
Attachments
SEHandler.zip
(1.32 KiB) Downloaded 83 times
 
User avatar
jamesbattle
Posts: 0
Joined: May 12th, 2002, 8:28 pm

Error Handling in C++

June 26th, 2002, 11:52 pm

Withouth getting boring, it's actually possible to do the same thing on POSIX, through signal handlers.THis is the basis of object databasaes such as ObjectStore that 'fault' objects into the address space....Quite scary when stepping through the debugger and seeing all the access violations happeningON PURPOSE....Don't believe most of the crap about performance... the best strategy is always to use an efficientalgorithm, coded reasonably carefully and to hook highly optimized libraries such as BLAS in assemblerAFTER profiling with a tool like Quantify. Hook up with highly optimized BLAS, hand-coded, unrolledblah and you won't be worrying about the performanmce of unrolling the stack on an error paththat occurs once in a 100 calls.Except for rediculous excesses, unfortunately that DO occur when using Java for numeric work, thisis not the worry you'd think. Hardware is cheap, getting cheaper. Check out the employment page -quants are costing 6 figures .....