views:

1395

answers:

9

Hi!

Does anyone know an open-source and/or free code-scanner for automated code analysis in C#, C or C++?

I know for Java there's some brilliant stuff like FindBugs (Eclipse integrated), PMD, or Hammurapi.

Is there anything similar for the C-languages?

wishi

+6  A: 

FxCop is a free scanner for .Net.

http://msdn.microsoft.com/en-us/library/bb429476(vs.80).aspx

Steven Behnke
+3  A: 

StyleCop does source level analysis.

leppie
+1  A: 

NDepend has a two-week trial license.

Ian Nelson
+6  A: 

For .NET languages, you can look at Reflector CodeMetrics which provides some code analysis and design metrics. Also take a look at all of the Reflector addins.

I also second the recommendation for FxCop and StyleCop.

Ryan
A: 

You may be able to get some value out of running VC++ with /analyze switch. Although, this particular switch is not available with every edition. Get the compiler which ships with Windows SDK.

Tanveer Badar
A: 

Through the comments here and some google magic I came to splint: http://splint.org/

  • Seems to be quite helpful for C.
  • easy to use
  • not Visual Studio dependent

The FxCop and StyleCop extensions look very sophisticated for VisualStudio and .Net.

Thanks so far, wishi

wishi
+1  A: 

Resharper does some code analysis especially for pointing out redundant code and logic faults.

Chris Marisic
A: 

You'll find a list of free and not so free static analysis tools here.

Richard Corden
+2  A: 

For C code, you may take a look at Coccinelle. It is already used to find and fix bugs in the Linux kernel.

Nico