This one might be debatable but when the parameter type is already a const iterator does it make sense to also want it to be const?
style: constParameter - Parameter 'it' can be declared with const
#include <list> void constParameterCallbackFalsePositiveExample(std::list<long>::const_iterator& it) { if(*it) { } }
imho this is a true positive. This code is also compilable and will change the iterator:
#include <list> std::list<long> globalList; void f(std::list<long>::const_iterator& it) { it = globalList.cend(); }
OK, I can go along with that explanation, thanks.
Log in to post a comment.
This one might be debatable but when the parameter type is already a const iterator does it make sense to also want it to be const?
style: constParameter - Parameter 'it' can be declared with const
imho this is a true positive. This code is also compilable and will change the iterator:
Last edit: Daniel Marjamäki 2021-09-23
OK, I can go along with that explanation, thanks.