From: ddzama Date: Thu, 31 Mar 2022 06:19:35 +0000 (+0300) Subject: 0032916: Coding Rules - eliminate MSVS warning C26451 on VS2019/C++20 (Arithmetic... X-Git-Tag: V7_7_0_beta~132 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=d31e5dbbb4da27d08e1a4d4faffd77d4ec6ed6a9;p=occt.git 0032916: Coding Rules - eliminate MSVS warning C26451 on VS2019/C++20 (Arithmetic overflow: Using operator '+' on a 4 byte value...) Microsoft Visual Studio Professional 2019 Version 16.11.11 std=c++20 Get rid of `Warning C26451 Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2)` --- diff --git a/src/QANCollection/QANCollection_Stl.cxx b/src/QANCollection/QANCollection_Stl.cxx index c40c421e8d..656fbbfdbd 100644 --- a/src/QANCollection/QANCollection_Stl.cxx +++ b/src/QANCollection/QANCollection_Stl.cxx @@ -1115,7 +1115,7 @@ void TestPerformanceMapAccess(Draw_Interpretor& di) aTimer.Reset(); aTimer.Start(); { - for (Standard_Integer anIdx = 0; anIdx < 10000; ++anIdx) + for (size_t anIdx = 0; anIdx < 10000; ++anIdx) { if (aSet.find (aVec[anIdx + 1000]) == aSet.end()) aResult = Standard_False; @@ -1136,7 +1136,7 @@ void TestPerformanceMapAccess(Draw_Interpretor& di) aTimer.Reset(); aTimer.Start(); { - for (Standard_Integer anIdx = 0; anIdx < 10000; ++anIdx) + for (size_t anIdx = 0; anIdx < 10000; ++anIdx) { if (!aCollec->Contains (aVec[anIdx + 1000])) aResult = Standard_False;