Dead Code Detection
-
Hi All, Does anybody know of any simple tools that can be used to find dead code in Visual C++ code? What I am interested in specificaly is something that could identify things like: Member variables declared in a class that are never referenced. Member functions declared in a class that are never referenced, ie could safely be commented outwith no effect on code. Classes that are defined and implemented, but not referenced in a solution, which could be safely removed. Old code has a tendency to grow by accretion, and it would be good to be able to have some tool that would help to trim dead code. Thanks
-
Hi All, Does anybody know of any simple tools that can be used to find dead code in Visual C++ code? What I am interested in specificaly is something that could identify things like: Member variables declared in a class that are never referenced. Member functions declared in a class that are never referenced, ie could safely be commented outwith no effect on code. Classes that are defined and implemented, but not referenced in a solution, which could be safely removed. Old code has a tendency to grow by accretion, and it would be good to be able to have some tool that would help to trim dead code. Thanks
I'm thinking that lint will do most, if not all, of what you require. It's been over a decade since I've used it but I remember it being a powerful ally.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
-
I'm thinking that lint will do most, if not all, of what you require. It's been over a decade since I've used it but I remember it being a powerful ally.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
My first thought, also. I used to do just this with PC-Lint, and I think they have been keeping up with C++ and handling larger projects. Check here: http://www.gimpel.com I also use manual text file searching... slow but it gets the job done.