cppcheck 2.6.3, 2.7.5, and current main (8d1fd19cc66d4a15ecb62253e0cb84e9854e6b86), all report the following style error:
style: Parameter 'a' can be declared with const [constParameter]
foo(s a, int f)
^
I think this is a false positive since s const* a would not compile, and s* const a has dubious value. Moreover there is no reason to expect the latter syntax for a and not for f. Note that both modifications prevent the error.
Version 2.3 does not report the error, and I could not check versions in-between.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
On the following code:
cppcheck 2.6.3, 2.7.5, and current main (8d1fd19cc66d4a15ecb62253e0cb84e9854e6b86), all report the following style error:
I think this is a false positive since
s const* a
would not compile, ands* const a
has dubious value. Moreover there is no reason to expect the latter syntax fora
and not forf
. Note that both modifications prevent the error.Version 2.3 does not report the error, and I could not check versions in-between.
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/11095