c++ - Stopping the debugger when a NaN floating point number is produced without a code change -


i read this , this. quintessence 1 can throw sigfpe if nan produced including fenv.h , enabling floating point exceptions fe_inexact feenableexcept(fe_all_except & ~fe_inexact);

thus, code changes form

int main () {    double dirty = 0.0;    double nanvalue = 0.0/dirty;    return 0;  } 

to

 #include <fenv.h>  int main () {      feenableexcept(fe_all_except & ~fe_inexact);  // enable floating point exceptions fe_inexact      double dirty = 0.0;      double nanvalue = 0.0/dirty;      return 0;  } 

this works fine, have change code. have problem, in huge c , c++ code base, somewhere nan produced , don't know where. not option apply above change hunderts of files , track error.

is there way enable floating point exceptions, without code change? there compile option not aware of?

we use intel icc version 15.0.3 compiler.

no matter how many files code spans, need add feenableexcept(fe_all_except & ~fe_inexact) once only, @ first line of main() function.

it enable exceptions whole program until disable exceptions calling function such fedisableexcept().


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -