views:

118

answers:

5

This question is in continuation to http://stackoverflow.com/questions/979129/. It would be great if there is some tool that would allow to remove the hanging code (code not being used). Examples would be unused variables,references,functions or even class (old code or code only written for experimentation).

+3  A: 

ReSharper does this.

womp
A: 

Good linkers will remove unused code from an executable. It is an optimization option. This likely will not work for public functions on shared libraries, but internal code will get trimmed if there are no ways into it.

Check your linker though(or maybe compiler-- depending on language).

Kekoa
Oops I realize you are probably talking about the source code, not machine code.
Kekoa
A: 

Certain versions of Visual Studio 2008 (development edition for sure) have a code analysis tool that can help.

Cody C
A: 

JetBrains Resharper can do that (and much more)

Rune FS
A: 

Klocwork had some capabilities to point out legacy code hanging around.

Also, GCC has warnings that can be enabled that will catch a lot of trivial things like unused varaibles or static functions.

Chris Arguin