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. Listing Unused Variables

Listing Unused Variables

Scheduled Pinned Locked Moved C / C++ / MFC
csharpvisual-studiotoolsquestion
8 Posts 5 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.
  • S Offline
    S Offline
    softwaremonkey
    wrote on last edited by
    #1

    HI, Does anyone know of any free tools or Visual Studio add-in that will check the source files in a project for unused variables and/or functions? :thumbsup: Tony

    M C Y 3 Replies Last reply
    0
    • S softwaremonkey

      HI, Does anyone know of any free tools or Visual Studio add-in that will check the source files in a project for unused variables and/or functions? :thumbsup: Tony

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      Set the compiler warning level to 4.

      Watched code never compiles.

      L 1 Reply Last reply
      0
      • S softwaremonkey

        HI, Does anyone know of any free tools or Visual Studio add-in that will check the source files in a project for unused variables and/or functions? :thumbsup: Tony

        C Offline
        C Offline
        Cool_Dev
        wrote on last edited by
        #3

        can't you compile with warning Level 4 in Project->Properties->C/C++->General->Warning Level -> Level 4 (/W4) ?

        S 1 Reply Last reply
        0
        • C Cool_Dev

          can't you compile with warning Level 4 in Project->Properties->C/C++->General->Warning Level -> Level 4 (/W4) ?

          S Offline
          S Offline
          softwaremonkey
          wrote on last edited by
          #4

          Thanks for the reply. Yea, I have used warning level 4 to identify any unused local variables but I was thinking of something on a bigger scale i.e. something that would identify class members and methods which are not referenced in the project. Of couse I could right click every method in the class view and show where it is called but that could drive a man insane! Thanks again for the reply. :thumbsup: :thumbsup:

          1 Reply Last reply
          0
          • M Maximilien

            Set the compiler warning level to 4.

            Watched code never compiles.

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            AFAIK that works well for local variables, but not for class level variables or methods. :)

            Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

            M 1 Reply Last reply
            0
            • S softwaremonkey

              HI, Does anyone know of any free tools or Visual Studio add-in that will check the source files in a project for unused variables and/or functions? :thumbsup: Tony

              Y Offline
              Y Offline
              Yusuf
              wrote on last edited by
              #6

              Check Doxygen. It has been very long since I used it, but it may help dig out something. I know there is something with unused function, but not sure for unused variables. I could be way off the mark, it has been very long since I used it.

              Yusuf May I help you?

              1 Reply Last reply
              0
              • L Luc Pattyn

                AFAIK that works well for local variables, but not for class level variables or methods. :)

                Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                M Offline
                M Offline
                Maximilien
                wrote on last edited by
                #7

                I still don't understand why people write unused code!! :rolleyes:

                Watched code never compiles.

                L 1 Reply Last reply
                0
                • M Maximilien

                  I still don't understand why people write unused code!! :rolleyes:

                  Watched code never compiles.

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  Don't blame the programmers. Blame the users, they tend to avoid those pieces of an app that contain most of the bugs. :)

                  Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum

                  Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

                  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