Context: I am playing around with spline fitting module of Eigen library. The fit works nice enough, but I do get some warnings (in Visual Studio 2013).
The question: Why am I able to disable some warnings whereas other persist even after they should have been supressed?
More context:
The "well behaved" warning I get is
warning C4714: function 'const Eigen::Matrix Eigen::DenseBase::eval(void) const' marked as __forceinline not inlined
After a bit of research I learned that this indeed comes with using eigen code. As I prefer not to produce warnings,
#pragma warning(disable : 4714)
works nicely to suppress it.
The "naughty" warning is
warning C4996: 'std::_Partial_sum2': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'originating in ChordLengths function of eigen. This one, however, does not let itself be suppressed with
#pragma warning(disable : 4996)(and I am quite sure there is no problem in spacing or such as the above 4714 works nicely), neither does work
#define _SCL_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_WARNINGS
or anything from this thread or all the other similar threads.
Why is that? Do I overlook something obvious?
For now I 'solved' the issue in a rather ugly way: I have rewritten the ChordLengths function into my code replacing the problematic line
std::partial_sum(chord_lengths.data(), chord_lengths.data()+n,chord_lengths.data());
with a version of my own. I dislike this approach, but it solves the problem. Still, I would prefer to understand why nothing I tried to suppress the warning worked.
Bonus: How do I actually supress the warning?