C++ code analysis tools

Posted by: Roger

C++ code analysis tools - 07/08/2008 11:22

Any good ones out there? Preferably integrated with Visual Studio, but something that'll tell me (given a project) that a particular function/variable is never used. Or that a variable could be moved closer to the place where it's used.

Stuff like that.
Posted by: wfaulk

Re: C++ code analysis tools - 07/08/2008 17:19

Doesn't VS come with a profiler?
Posted by: siberia37

Re: C++ code analysis tools - 07/08/2008 19:13

The compiler should tell you if a variable is never used unless you turn that warning off. As far as knowing if a variable has too high a scope, I've never heard of such a tool.
Posted by: peter

Re: C++ code analysis tools - 07/08/2008 19:46

What you want is something like GCC's "-Weffc++" on steroids. In fact, what you really want is a refactoring browser.

http://c2.com/cgi/wiki?ThereIsNoRefactoringBrowserForCpp

although that page title seems to underestimate the actual number by about four: Xrefactory, Slickedit, possibly Ref++ (whose websites seem to have disappeared), and Devexpress Refactor. I haven't used any of them, though.

Peter
Posted by: Roger

Re: C++ code analysis tools - 08/08/2008 05:21

Originally Posted By: wfaulk
Doesn't VS come with a profiler?


That implies that I have to run the program, and go through the entire test suite on six different versions of Windows.

I'd prefer static analysis...
Posted by: Roger

Re: C++ code analysis tools - 08/08/2008 05:30

Originally Posted By: peter
What you want is something like GCC's "-Weffc++" on steroids. In fact, what you really want is a refactoring browser.


-Weffc++ on steroids is pretty much what I'm looking for, yeah.

Quote:
Xrefactory, Slickedit, possibly Ref++ (whose websites seem to have disappeared), and Devexpress Refactor.


I tried Devexpress Refactor and Visual Assist X. On C++, neither of them is up to the standard of ReSharper (although ReSharper gets to play with .NET languages, which is probably easier).

The problem is not so much that I'm refactoring C++. The problem is that I'm refactoring legacy C code, and trying to turn it into C++.

I'll look at the others, thanks.