prinzdezibel prinzdezibel - 1 year ago 249
C Question

C/C++ Free alternative to Lint?

I'm interested in a free tool that can statically check my C++ code like Lint does.
Any hints?

Answer Source

Try cppcheck, found here:

Here's a sampling of some of the checks it can perform or that I've used it for:

  • Array indices out of bounds
  • Memory/resource leaks
  • Improper new/delete
  • Failure to put virtual destructors on derived classes
  • Mismatching allocation and deallocation
  • Deallocating a deallocated pointer
  • Using variable after it is deallocated / released
  • Size mismatches
  • Invalid radix in call to strtol or strtoul
  • Overlapping data buffers
  • Unsigned division; result may be wrong
  • Unusual pointer arithmetic
  • Returning pointer to local array variable
  • Same iterator is used with two containers
  • Dangerous usage of erase
  • After pushback or pushfront, iterator may be invalid
  • Buffer overruns
  • Dangerous usage of strncat, possible buffer overrun
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download