The warning is inconclusive because there can be situations when a method could technically be const, but for design reasons you would like that it is not.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$ /home/dcb/cppcheck/trunk/cppcheck --enable=all --inconclusive may8e.cc
may8e.cc:14:6: style:inconclusive: Technically the member function 'S::getFred' can be const. [functionConst]
int getFred() { return fred; };
^
may8e.cc:14:0: style: The function 'getFred' is never used. [unusedFunction]
^
$
Fast work. Thanks very much for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For this C++ source code:
class S
{
private:
int fred;
public:
S( int n) : fred( n) { };
~S() {};
};
where the member function body is only a return statement and so the member
function could be made const, cppcheck doesn't detect this situation.
$ /home/dcb/cppcheck/trunk/cppcheck --enable=all may8e.cc
may8e.cc:14:0: style: The function 'getFred' is never used. [unusedFunction]
$
I am not sure if this is a feature request or a bug report.
can you try with
inconclusive
also.The warning is inconclusive because there can be situations when a method could technically be const, but for design reasons you would like that it is not.
It works fine with --inconclusive flag.
$ /home/dcb/cppcheck/trunk/cppcheck --enable=all --inconclusive may8e.cc
may8e.cc:14:6: style:inconclusive: Technically the member function 'S::getFred' can be const. [functionConst]
int getFred() { return fred; };
^
may8e.cc:14:0: style: The function 'getFred' is never used. [unusedFunction]
^
$
Fast work. Thanks very much for your help.