Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Dead Code Detection

Dead Code Detection

Scheduled Pinned Locked Moved C / C++ / MFC
c++toolshelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aaron Schaefer
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • A Aaron Schaefer

      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

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • D 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

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups