From d31e5dbbb4da27d08e1a4d4faffd77d4ec6ed6a9 Mon Sep 17 00:00:00 2001 From: ddzama Date: Thu, 31 Mar 2022 09:19:35 +0300 Subject: [PATCH] 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)` --- src/QANCollection/QANCollection_Stl.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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;