Debug C++ code: Catch first NaN appearance

c++, debugging, nan

Solution

The answer is given here: https://stackoverflow.com/a/5394095/1326595

Just include

#include <fenv.h>

and than add the following line to the code:

feenableexcept(FE_INVALID | FE_OVERFLOW);

The debugger is than able to capture the signal and shows the very first occurrence of a NaN.

Problem

Is there a simple way to check a C++ code in a debugger for the very first appearance of a NaN value?

Original source

Related problems