When comparing Cppcheck vs Doxygen, the Slant community recommends Cppcheck for most people. In the question“What are the best tools to analyze large C++ code bases?” Cppcheck is ranked 1st while Doxygen is ranked 2nd.
Specs
Ranked in these QuestionsQuestion Ranking
Pros
Pro Fast
Pro Updated regularly
With each update comes new checks and a closer opportunity for zero false positives. Updates also include improvements to the algorithms and performance of the analyzer.
Pro Different output formats
Cppcheck allows the user to output the compiled source bugs to in a personalized fashion. It contains the ability to modify the output templates allowing for very simple user analysis. Adjust the output to suit your preferred format, or write your own!
Pro Free
Pro Generates documentation from comments
Doxygen can generate documentation from formatted comments in the source code. This is extremely useful when writing detailed man pages.
Pro Cross-platform
Doxygen is compatible with multiple languages. Including but not limited to: C, Objective-C, C#, C++, Java, Python, PHP etc...
Cons
Con Custom C++ Parser
The custom implementation of the C++ parser has at least the deficiency not to support template template arguments. Furthermore its doesn't make much sense to maintain a custom parsing code which is extremely costly. Instead of this one should use a more elaborate existing AST parser which is maintained by a broader community.
Con Limited ability to find Bugs
Cppcheck is not competitive with other tools like clang static analyzer in order find bugs. E.g. a simple nullpointer access isn't detected by cppcheck if it is function or method return value, whereas clang easily finds such bugs.
Con False Positives
As with any static analyzer it is impossible to get it perfect. Each project may produce errors even though the code behaves correctly. This result will vary different between code checks. All static analyzers are striving to achieve zero false positives.
Con Sole focus on bugs
Cppcheck purely checks for bugs in your code as opposed to other stylistic issues. If you wish to perform checks for that as well you will need to add another tool to your reservoir.
Con i18n support is poor
Cannot work properly with non-ascii paths on Windows
Con PDF output is very problematic
Doxygen PDF output relies on the now broken LaTeX tabu package which was abandoned over a decade ago by its developer.
Con No recursive inclusion
For example, if you specify INCLUDE_PATH=incl
, it doesn't search other folders included in the incl
folder (incl/sub1
or incl/sub2
) and there's no option to turn on recursive inclusion.