Analyze Your C++ Code Using CppDepend
CppDepend is a tool that you can use to analyze your C/C++ code. I gave it a try and it’s pretty powerful. CppDepends has support for 60 different code metrics. It has something called Code Query Language (CQL) that allows you to perform queries on your code like the following:
- Which public methods have more than 30 lines of code?
SELECT METHODS WHERE NbLinesOfCode > 30 AND IsPublic - Which classes derive From CBase?
SELECT TYPES WHERE IsClass AND DeriveFrom “CBase” - Which methods have been refactored recently ?
SELECT METHODS WHERE CodeWasChanged
It can generate several different kind of graphical representations of your code, for example:
I think this tool will help a lot when working on a new code base to understand the structure of the code.
Here is a description from the vendor:
Improve your code base quality.
CppDepend is a tool that simplifies managing a complex C/C++ (Native,Mixed and COM) code base. Architects and developers can analyze code structure, specify design rules, do effective code reviews and master evolution by comparing different versions of the code.
Refactor and Improve your design and architecture.
CppDepend provides useful graphs to analyze your design and architecture. CQL language gives you a flexibility to create your custom queries and have a deep view of your code base.
Assist your migration.
Understanding the existing code base is primordial before any migration. CppDepend helps you in your migration process.
jschroedl said,
Wrote on November 10, 2010 @ 3:55 pm
Nice, thanks for the tip. I hope it handles C++/CLI keywords too. I’m off to check them out.