Hello Frank,
On Tue, 1 Aug 2006 09:30:08 UTC, "Frank Neuhaus" <fn******@uni-koblenz.dewrote:
Visual Studio >=7.0 with warning level set to "scream-at-me(tm)(c)(R)"
Thanks for your reply. I just tried that. It already helped a bit - it
reports unreachable code inside functions, unused parameters and unused
global functions. But unfortunately it doesnt report unused member
functions/variables :(
You might also try one of the "lint for C++" or static analysis tools
(Klockwork 7?). In general, unused variables and methods in classes
would be very hard to suggest that they weren't used. The linker
could perform such a step if there wasn't a chance that the code/vars
wouldn't be found by other means. Classes do much more than just
group together values and functions that may be unused.
Classes are abstractions of objects that your application may use.
The fact that you don't make use of a particular method doesn't
necessarily mean that it should be removed. You might be planning
on using that component later. The class is a building block for
others to build on. Hopefully the abstraction was valid.
Static analysis tools can find such items to remove. These tools
aren't cheap though. I've not read why you want to remove the
unused components from your code.
I generally review my legacy classes as I work with them to
understand if the abstractions are valid. There are times that
they get rewritten. Certainly if you think a method or value
isn't used -- comment it out, compile, link, and look for the
errors. With less common value/method names you might be able
to get away with a search on the source code.
David