Cppcheck result:
component_projects\bab_shared\unittest\filters\FilterTest.cpp:44:16: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
result = median.update(sample);
^
component_projects\bab_shared\unittest\filters\FilterTest.cpp:36:30: style: Variable 'window_size' is assigned a value that is never used. [unreadVariable]
const size_t window_size = 3; // Odd number
^
window_size IS used in the template of FILTER template. and the for loop is not accumulating, we are just running update and effectively ignoring the result value.
When I bring the (void)result inside the loop, the notification of std::accumulate is gone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using CppCheck 2.14 and implementing a performance measuring unittest, I seem to be getting 2 different false positives.
Cppcheck result:
component_projects\bab_shared\unittest\filters\FilterTest.cpp:44:16: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
result = median.update(sample);
^
component_projects\bab_shared\unittest\filters\FilterTest.cpp:36:30: style: Variable 'window_size' is assigned a value that is never used. [unreadVariable]
const size_t window_size = 3; // Odd number
^
window_size IS used in the template of FILTER template. and the for loop is not accumulating, we are just running update and effectively ignoring the result value.
When I bring the (void)result inside the loop, the notification of std::accumulate is gone.
Thanks for reporting, I have created https://trac.cppcheck.net/ticket/12900 for the first case.
The second case is covered by https://trac.cppcheck.net/ticket/10233