gcc - 为什么在 vim 和 emacs 中使用 clang 进行自动完成?

标签 gcc vim emacs autocomplete clang

为什么不使用 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/

相关文章:

emacs - 在define-generic-mode中匹配正则表达式作为关键字

javascript - 在 Emacs 中使用 js2 模式正确缩进缓冲区

python - 为 emacs 更改 python 解释器

macos - OpenMP 是否可以在 Qt spanwed 线程上运行?

c - 如何通过跳过标签之间的所有值来仅打印(C 代码)XML 标签?

c++ - gcc 4.8 或更早版本是否存在关于正则表达式的问题?

c - 列出 C 常量/宏

function - 两个括号内自动缩进 - Vim

vim - gvim 中的错误 - 在哪里报告?

vim - 无需在 vim 中按回车键即可转到搜索结果