C++ code analysis tools

后端 未结 8 2066
误落风尘
误落风尘 2021-02-06 07:49

I\'m currently in the process of learning C++, and because I\'m still learning, I keep making mistakes.
With a language as permissive as C++, it often takes a long time to f

8条回答
  •  独厮守ぢ
    2021-02-06 08:32

    There is as list of static code analysis tools at wikipedia.

    But warnings are generally good but one problem with enabling all warnings with pedantic and Wall is the number of warnings you might get from including headers that you have no control over, this can create a lot of noise. I prefer to compile my own software with all warnings enabled though. As I program in linux I usually do like this:

    Put the external headers I need to include in a separate file, and in the beginning of that file before the includes put:

    #pragma GCC system_header
    

    And then include this file from your code. This enables you to see all warnings from your own code without it being drowned in warnings from external code. The downside is that it's a gcc specific solution, I am not aware of any platform independent solution to this.

提交回复
热议问题