C++ code analysis tools

后端 未结 8 2073
误落风尘
误落风尘 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:36

    Tool support for C++ is quite bad compared to Java, C#, etc. because it does not have a context-free grammar. In fact, there are parts of the C++ grammar that are undecidable. Basically, that means that understanding C++ code at the syntactic level requires implementing pretty much a compiler front end with semantic analysis. C++ cannot be parsed into an AST independently of semantic analysis, and most code analysis tools in IDEs, etc. work at the AST level. This is part of the tradeoff you make in exchange for the flexibility and backwards compatibility of C++.

提交回复
热议问题