Umair Ahmed
Umair Ahmed

Reputation: 11694

Tool to remove hanging code

This question is in continuation to Is there a decent tool for automatically cleaning the crap out of VS solution directories?. 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).

Upvotes: 2

Views: 228

Answers (5)

Chris Arguin
Chris Arguin

Reputation: 11998

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.

Upvotes: 0

Rune FS
Rune FS

Reputation: 21742

JetBrains Resharper can do that (and much more)

Upvotes: 0

Cody C
Cody C

Reputation: 4807

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

Upvotes: 0

Kekoa
Kekoa

Reputation: 28250

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).

Upvotes: 0

womp
womp

Reputation: 116977

ReSharper does this.

Upvotes: 4

Related Questions