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. The Lounge
  3. Do you know any good static code analysis tools for c/c++?

Do you know any good static code analysis tools for c/c++?

Scheduled Pinned Locked Moved The Lounge
c++toolshelpquestion
21 Posts 12 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 Stefan Bogdan

    Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

    D Offline
    D Offline
    Dr Walt Fair PE
    wrote on last edited by
    #5

    Stefan Bogdan wrote:

    Trying to keep the bug count as low as possible ...

    Me too. I stopped counting.

    Stefan Bogdan wrote:

    ... i thought i'd use a tool that performs static code analysis on my c/c++ projects.

    Isn't that called a compiler?

    Stefan Bogdan wrote:

    I already use one that performs runtime verifications and analysis

    I thought that's what users are for. :doh: ;P

    CQ de W5ALT

    Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software

    1 Reply Last reply
    0
    • R realJSOP

      I use a handy garbage recepticle for code analysis. :) Seriously though, I think there's a free tool that calculates the complexity of your code, and things like that, but I dont remember the name of it.

      .45 ACP - because shooting twice is just silly
      -----
      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

      A Offline
      A Offline
      Anna Jayne Metcalfe
      wrote on last edited by
      #6

      SourceMonitor[^] :)

      Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

      modified on Friday, June 4, 2010 2:39 PM

      1 Reply Last reply
      0
      • R Rama Krishna Vavilala

        PC Lint[^] It is also worth to look at: Visual Lint[^]

        A Offline
        A Offline
        Anna Jayne Metcalfe
        wrote on last edited by
        #7

        Thanks for the plug! We now owe you :beer: if ever you're down our way. ;) FWIW we've Eclipse/CDT (initially for Windows, Linux in time hopefully) and command line (for build server use) versions of Visual Lint on the way. We had the Eclipse plug-in on our stand at ACCU this year, and it seemed to get quite a bit of interest. Once they are out of the way the plan is to look at adding support for other analysis tools (we already have a derived product for the Tiobe TICS framework[^]) and possibly a plug-in for Borland/Codegear C++.

        Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

        L 1 Reply Last reply
        0
        • S Stefan Bogdan

          Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

          A Offline
          A Offline
          Anna Jayne Metcalfe
          wrote on last edited by
          #8

          I'll declare an interest here as I'm responsible for Visual Lint[^] (a PC-lint integration plug-in for Visual Studio). :-\ If you decide to go with PC-lint, feel free to drop me a line and I'll do what I can to assist you in setting it up. SourceMonitor[^] is also worth knowing about - it's a metrics tool rather than a static analysis tool, but in our experience examining the cyclomatic complexity metrics of a project can yield a lot of intelligence about where the trouble spots are likely to be. Comparing the average complexity of your entire codebase between builds is also a great way of determining whether your code is getting better (lower complexity) or worse (higher complexity).

          Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

          S 1 Reply Last reply
          0
          • A Anna Jayne Metcalfe

            I'll declare an interest here as I'm responsible for Visual Lint[^] (a PC-lint integration plug-in for Visual Studio). :-\ If you decide to go with PC-lint, feel free to drop me a line and I'll do what I can to assist you in setting it up. SourceMonitor[^] is also worth knowing about - it's a metrics tool rather than a static analysis tool, but in our experience examining the cyclomatic complexity metrics of a project can yield a lot of intelligence about where the trouble spots are likely to be. Comparing the average complexity of your entire codebase between builds is also a great way of determining whether your code is getting better (lower complexity) or worse (higher complexity).

            Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

            S Offline
            S Offline
            Stefan Bogdan
            wrote on last edited by
            #9

            I came across PC-Lint myself a few days ago... Now that it has been recommended to me by 2 out of 4 people that replied to my message i have to say i'm getting quite interested. The only problem is PC-Lint does not offer a trial version... It would be nice if I could give it a try for a few days...

            M A 3 Replies Last reply
            0
            • S Stefan Bogdan

              Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

              M Offline
              M Offline
              Mike Diack
              wrote on last edited by
              #10

              Let me also endorse PC Lint. Incredibly good value compared to most of the very expensive static code analysis tools out there. (PC-Lint is a few hundred pounds a seat, whereas most other tools are several thousand!). It's very full featured and enormously capable. I've been using it since Version 6 in 1993 and for me it's the most essential tool after Visual Studio itself. Riverblade's Visual Lint is a great enhancement to it that integrates it near seamlessly into Visual Studio. However there are also some free tools: Cppcheck: http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page[^] Splint (C only): http://www.splint.org/[^] and on high end versions of Visual Studio (from 2005 onwards). There's the /analyze switch Which runs a static analysis (ish) level of checking in Visual Studio - but it's not nearly as capable as the independant tools. In summary: If you can afford to spend, I'd recommend going with PC-Lint (and Visual Lint, if you've a bit more money too). Mike

              A 1 Reply Last reply
              0
              • A Anna Jayne Metcalfe

                Thanks for the plug! We now owe you :beer: if ever you're down our way. ;) FWIW we've Eclipse/CDT (initially for Windows, Linux in time hopefully) and command line (for build server use) versions of Visual Lint on the way. We had the Eclipse plug-in on our stand at ACCU this year, and it seemed to get quite a bit of interest. Once they are out of the way the plan is to look at adding support for other analysis tools (we already have a derived product for the Tiobe TICS framework[^]) and possibly a plug-in for Borland/Codegear C++.

                Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #11

                Write a Visual Lint plugin for Qt Creator next. I'd test it for you. :)

                Blogging about Qt Creator

                A 1 Reply Last reply
                0
                • S Stefan Bogdan

                  I came across PC-Lint myself a few days ago... Now that it has been recommended to me by 2 out of 4 people that replied to my message i have to say i'm getting quite interested. The only problem is PC-Lint does not offer a trial version... It would be nice if I could give it a try for a few days...

                  M Offline
                  M Offline
                  Mike Diack
                  wrote on last edited by
                  #12

                  It's true that Gimpel don't do a trial version BUT (and do check this) I believe they offer a 30 day money back guarantee if not pleased with the product. Trust me you'll be delighted. It's a great product, and they're a great firm.

                  A 1 Reply Last reply
                  0
                  • S Stefan Bogdan

                    I came across PC-Lint myself a few days ago... Now that it has been recommended to me by 2 out of 4 people that replied to my message i have to say i'm getting quite interested. The only problem is PC-Lint does not offer a trial version... It would be nice if I could give it a try for a few days...

                    M Offline
                    M Offline
                    Mike Diack
                    wrote on last edited by
                    #13

                    Also, if you'd like to see PC-Lint in action, you can post excerpts of code into their online demo webpage and have it analyse them - you'll be impressed: See: (and especially the "Do It Yourself" links at the end of the web page:) http://www.gimpel-online.com/OnlineTesting.html[^] eg. http://gimpel-online.com//cgi-bin/genPage.py?srcFile=diy.cpp&cgiScript=analyseCode.py&title=Do-It-Yourself+Example+%28C%2B%2B%29&intro=This+example+allows+you+to+specify+your+own+C%2B%2B+code.&compilerOption=online32.lnt&includeOption={{quotedIncludeOption}}[^]

                    1 Reply Last reply
                    0
                    • L Lost User

                      Write a Visual Lint plugin for Qt Creator next. I'd test it for you. :)

                      Blogging about Qt Creator

                      A Offline
                      A Offline
                      Anna Jayne Metcalfe
                      wrote on last edited by
                      #14

                      Now I just knew you were going to say that! :-\ Shame there are only 24 hours in the day. :doh:

                      Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                      1 Reply Last reply
                      0
                      • S Stefan Bogdan

                        I came across PC-Lint myself a few days ago... Now that it has been recommended to me by 2 out of 4 people that replied to my message i have to say i'm getting quite interested. The only problem is PC-Lint does not offer a trial version... It would be nice if I could give it a try for a few days...

                        A Offline
                        A Offline
                        Anna Jayne Metcalfe
                        wrote on last edited by
                        #15

                        That's true sadly (we'd love them to do a trial version of PC-lint, as then we could produce a combined installer for both products), but there is an interactive demonstrator[^] on Gimpel's website which lets you try it out "live" - and that goes some way towards making up for the omission.

                        Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                        1 Reply Last reply
                        0
                        • M Mike Diack

                          Let me also endorse PC Lint. Incredibly good value compared to most of the very expensive static code analysis tools out there. (PC-Lint is a few hundred pounds a seat, whereas most other tools are several thousand!). It's very full featured and enormously capable. I've been using it since Version 6 in 1993 and for me it's the most essential tool after Visual Studio itself. Riverblade's Visual Lint is a great enhancement to it that integrates it near seamlessly into Visual Studio. However there are also some free tools: Cppcheck: http://sourceforge.net/apps/mediawiki/cppcheck/index.php?title=Main_Page[^] Splint (C only): http://www.splint.org/[^] and on high end versions of Visual Studio (from 2005 onwards). There's the /analyze switch Which runs a static analysis (ish) level of checking in Visual Studio - but it's not nearly as capable as the independant tools. In summary: If you can afford to spend, I'd recommend going with PC-Lint (and Visual Lint, if you've a bit more money too). Mike

                          A Offline
                          A Offline
                          Anna Jayne Metcalfe
                          wrote on last edited by
                          #16

                          I've not found CppCheck to be much cop, quite frankly (though maybe our code is just too clean...), but Splint is on our radar now that we're doing an Eclipse/CDT plug in (the reasoning being that Eclipse is often used for embedded development, and many embedded projects are C only). Lots to do, as ever. :)

                          Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                          1 Reply Last reply
                          0
                          • M Mike Diack

                            It's true that Gimpel don't do a trial version BUT (and do check this) I believe they offer a 30 day money back guarantee if not pleased with the product. Trust me you'll be delighted. It's a great product, and they're a great firm.

                            A Offline
                            A Offline
                            Anna Jayne Metcalfe
                            wrote on last edited by
                            #17

                            They do. :)

                            Anna :rose: Tech Blog | Visual Lint "Why would anyone prefer to wield a weapon that takes both hands at once, when they could use a lighter (and obviously superior) weapon that allows you to wield multiple ones at a time, and thus supports multi-paradigm carnage?"

                            1 Reply Last reply
                            0
                            • S Stefan Bogdan

                              Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

                              D Offline
                              D Offline
                              dazfuller
                              wrote on last edited by
                              #18

                              We use CPPCheck[^] highlights a number of very good issues and warns where it thinks there may be potential memory leaks and other useful information. I've looked at a number of others but keep coming back to this one.

                              1 Reply Last reply
                              0
                              • S Stefan Bogdan

                                Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

                                V Offline
                                V Offline
                                vtorri
                                wrote on last edited by
                                #19

                                clang/llvm

                                1 Reply Last reply
                                0
                                • S Stefan Bogdan

                                  Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

                                  J Offline
                                  J Offline
                                  Javier Miranda
                                  wrote on last edited by
                                  #20

                                  Klocwork www.klocwork.com[^]

                                  1 Reply Last reply
                                  0
                                  • S Stefan Bogdan

                                    Hy all, Trying to keep the bug count as low as possible i thought i'd use a tool that performs static code analysis on my c/c++ projects. I already use one that performs runtime verifications and analysis but i have a feeling there's room for improvement. There are a lot of tools out there and i simply have a hard time choosing one. What do you recommend? It can be proprietary or not...

                                    E Offline
                                    E Offline
                                    ENOTTY
                                    wrote on last edited by
                                    #21

                                    Understand from SCITools: http://scitools.com/download RSM from Msquared: http://msquaredtechnologies.com

                                    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