This particular problem was discovered by cppcheck :
$ cppcheck --enable = all this-minus-bool.cxx
Checking this-minus-bool.cxx ...
[this-minus-bool.cxx: 7]: (warning) Suspicious pointer subtraction. Did you intend to write '->'?
(information) Cppcheck cannot find all the include files (use --check-config for details)
It was without a path. If I add -I /usr/include/c++/4.8/ , the problem will still be detected:
Checking this-minus-bool.cxx ...
[this-minus-bool.cxx]: (information) Too many #ifdef configurations - cppcheck only checks 12 of 45 configurations. Use --force to check all configurations.
[this-minus-bool.cxx: 7]: (warning) Suspicious pointer subtraction. Did you intend to write '->'?
[/usr/include/c++/4.8/bits/ostream.tcchaps35]: (style) Struct '__ptr_guard' has a constructor with 1 argument that is not explicit.
[/usr/include/c++/4.8/bits/locale_classes.tcc:248]: (error) Deallocating a deallocated pointer: __c
and then cppcheck runs slowly through the above #ifdef configurations.
(As a side note, the error in local_classes.tcc is a false position, but it is very difficult to say for an automated tool, since you need to know that the catch on this site should not be if the __EXCEPTIONS macro __EXCEPTIONS not installed.)
Disclaimer: I have no other experience with cppcheck.
Arne Vogel Sep 20 '17 at 11:19 on 2017-09-20 11:19
source share