Choosing a static code analysis tool *

Question

I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use ? Preferably a tool that is free.

Answer

Don't overlook the compiler itself.

Read the compiler's documentation and find all the warnings and errors it can provide, and then enable as many as make sense for you.

Also make sure to tell your compiler to treat warnings like errors so you're forced to fix them right away. ("-Werror" on gcc)

Also: "-Wall" on gcc does not enable all warnings, don't be fooled.

Also also: check out valgrind (free!) - it "automatically detect[s] many memory management and threading bugs, and profile[s] your programs in detail."

Valgrind isn't a static checker, but it's a great tool! http://valgrind.org

< br > via < a class="StackLink" href=" http://stackoverflow.com/questions/2873/" >Choosing a static code analysis tool< /a>
Share on Google Plus

About Cinema Guy

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment