/*SetFPEnv set FP environment to crash on div by zero */ #include #include "setfpenv.h" void SetFPEnv( void ) { /* there is no command line option on MS Visual Studio to force crash */ # ifdef _MSC_VER unsigned int NewMask; /* | is a bitwise inclusive or, turns on bits * 0|0 = 0 * 0|1 = 1|0 = 1|1 = 1 */ NewMask = _EM_ZERODIVIDE | _EM_OVERFLOW | _EM_INVALID; /* ~ is the unary bitwise complement - all bits flip */ NewMask = ~NewMask; /*lint -e534 ignore value returned by function (nothing to do with it)*/ _controlfp( NewMask , _MCW_EM ); /*lint +e534 ignore value returned by function (nothing to do with it)*/ # endif return ; }