为什么不使用 gcc 呢?它们之间的区别在哪里,为什么几乎所有自动完成插件都需要 clang?
最佳答案
简单的答案是,clang 旨在支持完成,而 gcc 则不是。
Clang 有一个命令行选项,可以在源文件中的给定点打印出可能的补全,这使得它很容易在脚本中使用:只需 shell 到 clang,解析其输出,就完成了。 Gcc 没有可比性。
至于为什么,看这个list of differences between gcc and clang :
[...]
- Clang is designed as an API from its inception, allowing it to be reused by source analysis tools, refactoring, IDEs (etc) as well as for code generation. GCC is built as a monolithic static compiler, which makes it extremely difficult to use as an API and integrate into other tools. Further, its historic design and current policy makes it difficult to decouple the front-end from the rest of the compiler.
关于gcc - 为什么在 vim 和 emacs 中使用 clang 进行自动完成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38056590/