I use PC-Lint from
www.gimpel.com and yes, it finds bugs and tightens up
code.
One thing which is often forgotten is that when maintaining a program, it is
useful if things clearly have the minimum coupling. Lint points out when
things can be made static or const or moved out of a header, which is not
the job of a compiler. This helps writers produce the least coupling. As
maintenance is more important and difficult than writing code (and why write
"code", not software), writers should have to produce clean Lint runs before
saying their "code" is done.
Well, that's my opinion.
Bill
PS And yes, I do "really stupid things" but I feel admitting it is a sign of
maturity.
There are versions of lint which can handle C++ (but I'm not
sure that they're called lint---maybe lint++).
There are tools specifically targetted at C++.
alias lint++='g++ -o /dev/null -c -pedantic -Wall -Werror -W'
That doesn't begin to do everything that lint does. Link looks
at the entire program.
In my experience, however, it's not really necessary for C++,
unless you have people doing really stupid things. So g++ does
nore or less do the job (with the appropriate options). But
given that, there's no real reason not to generate code while
you're at it.