From 70a342f44a71d27f51890178917da317c1ccee3f Mon Sep 17 00:00:00 2001 From: Lukas-Buricin <36853188+Lukas-Buricin@users.noreply.github.com> Date: Mon, 23 Jul 2018 14:20:54 +0100 Subject: [PATCH] Fix for "warning C4724: potential mod by 0" in matrix.h (#1424) --- dlib/matrix/matrix.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlib/matrix/matrix.h b/dlib/matrix/matrix.h index 5f9583482..224affb64 100644 --- a/dlib/matrix/matrix.h +++ b/dlib/matrix/matrix.h @@ -39,6 +39,12 @@ // is not possible because the division operation is inside "if (NR!=0)" block. #pragma warning(disable : 4723) +// "warning C4724: potential mod by 0" - This warning is triggered in +// matrix(const std::initializer_list& l) where the compiler can see that +// matrix<> was templated in a way making NR ending up 0, but mod by 0 at runtime +// is not possible because the mod operation is inside "if (NR!=0)" block. +#pragma warning(disable : 4724) + #endif namespace dlib @@ -2162,6 +2168,7 @@ namespace dlib // put warnings back to their default settings #pragma warning(default : 4355) #pragma warning(default : 4723) +#pragma warning(default : 4724) #endif #endif // DLIB_MATRIx_