为什么不使用clang呢? [英] Why is clang not used more?

查看:117
本文介绍了为什么不使用clang呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以前,我已经使用C / C ++进行了大量的编程,但是如今,它仅占我所编写程序的一小部分(脚本语言更适合我所做的许多工作)。最近几天我从事一些C编程项目,感到惊讶的是我忘记了多少语法细节。更糟糕的是, cc / gcc 通常具有有关这些问题的隐秘或非信息性错误消息(抱歉,我可以记得任何具体的示例。)

I've done a fair amount of programming in C/C++ before, but nowadays it only accounts for a small percentage of the programming I do (scripting languages are much better suited for a lot of the work I do). I worked on some C programming projects the last few days and was surprised how many little syntactical details I kept forgetting. What's worse is that cc/gcc typically had cryptic or non-informative error messages about these issues (sorry I can't remember any specific examples).

不久前我了解了 clang 编译器,并决定尝试使用。错误消息更加清晰,可以帮助我识别并修复语法中的问题。我的问题是为什么不使用/提及这个工具呢?与通常的嫌疑人( cc / gcc )相比,它是如此新,还是它没有不支持他们支持的功能,还是很难获得?我很难相信最后一个,因为它是随iMac上的dev工具安装的,并且需要一个命令( sudo apt-get install clang )安装在我的Ubuntu盒子。

I learned about the clang compiler not too long ago and decided to try that. The error messages were much clearer and helped me identify and fix the problems in my syntax. My question is why this tool is not used/mentioned more than it is? Is it that it is so new compared to the usual suspects (cc/gcc), or is it that it doesn't support features that they support, or is it just harder to obtain? I have a hard time believing that last one, since it was installed with the dev tools on my iMac and required a single command (sudo apt-get install clang) to install on my Ubuntu box.

推荐答案


我的问题是,为什么不使用此工具/提及的次数多于此?是?

My question is why this tool is not used/mentioned more than it is?

这可能是因为历史以及人类的行为习惯。

It's probably because of history, and because how we humans generally behave.

传统上,gcc是唯一可以真正用于编译至少所有免费* nix克隆的C程序的真正(免费)编译器。几乎所有的Linux,* BSD(现在可能是OSX,以及其他)基本系统和内核都可以使用此编译器。

Traditionally gcc has been the only real (free) compiler that can be practically used to compile C programs on atleast all the free *nix clones out there. It's what virtually all the base system and kernel of linux, *BSD, now probably OSX, and others are compiled with.

虽然存在漏洞,但实际上这意味着: gcc有效。如果它没有损坏,请不要修复它。因此,您现在拥有庞大的用户群,很容易获得有关gcc的帮助,有很多人使用过gcc,正在从事gcc本身等工作。

While flaws are here and there, basically this means: gcc works. And if it isn't broken, don't fix it. Out of this, you now have a huge user base, it's easy to get help with gcc, there's a lot of people that have used gcc, that are working on gcc itself etc.

通常,如果您想将庞大的社区从他们习惯的地方切换到其他地方,则其他地方必须显着更好。仅仅更好通常是不够的。您可以在社会的许多领域找到这样的例子。

Generally, if you want to switch a huge community from something they're used to, to something else, that "something else" have to be *significantly" better. Just "better" is often not reason enough. I think you can find examples of this in many areas of society.

clang是较新的,有些人会怀疑它是否可以完成任务,是否有错误,它会产生较慢的代码,等等。-在人性中似乎是可疑的-新事物令人恐惧。许多人甚至不了解clang,许多人不在乎,因为他们对gcc感到满意。

clang is newer, some people will just be suspicious if it's up to the task, if it has bugs, if it produces slower code etc. - it seems to be in the human nature to be suspicious - new things are scary. Many don't even know about clang, many don't care because they're happy with gcc.

尽管,如果想要使用clang,请继续使用-错误消息的确更好,并且比gcc更容易理解。

Though, if you rather want to use clang, go for it - error messages are indeed "better" and easier to understand vs gcc.

这篇关于为什么不使用clang呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆