LLVM vs. GCC for iOS开发 [英] LLVM vs. GCC for iOS development

查看:150
本文介绍了LLVM vs. GCC for iOS开发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在最新的iOS SDK中,Apple提供了三种编译器选项:GCC,带有Clang的LLVM和LLVM-GCC。我或多或少地理解这3个意思,什么是LLVM和Clang,等等。我不知道这是什么意思在iPhone开发人员的实践。自2011年1月起,我应该在这一点上使用以下哪些? LLVM是否成熟,我可以安全使用它,而不经常在bug中绊倒?切换到LLVM有其他任何缺点吗?如果是,那么速度优势胜过他们吗?除了速度之外还有其他原因吗?

In latest iOS SDK, Apple provides three compiler options: GCC, LLVM with Clang and LLVM-GCC. I understand more or less what these 3 mean, what LLVM and Clang are, and so on. What I don't know is what this means in practice for iPhone developers. Which of these should I use at this point, as of January 2011? Is LLVM mature enough that I can use it safely without stumbling on bugs in it too often? Does switching to LLVM have any other disadvantages? If it does, then does the speed advantage outweigh them? Are there any other reasons to switch except speed?

推荐答案

更新:回答,我觉得我应该提供适当的更新。现在,我希望清楚的是,Clang是编程时绝对的方式,Clang是新版本Xcode中的默认编译器,支持ARC和新的和即将到来的语言结构(数组和字典下标,字面量等) 。几乎绝对没有理由使用GCC编译,对于使用ARC和新特性的代码库,使用纯GCC不再相关或不可能(LLVM-GCC可能支持这些功能,但它不提供Clang的优势,现在Clang是完全稳定)。

Update: Because people are still finding this answer, I feel like I should provide a suitable update. By now, I hope it's clear that Clang is absolutely the way to go when programming, with Clang being the default compiler in the newer versions of Xcode and supporting ARC and new and upcoming language constructs (array and dictionary subscripting, literals, etc.). There's almost absolutely no reason to compile with GCC anymore, and for codebases using ARC and new features, using plain GCC is no longer relevant or possible (LLVM-GCC may support these features, but it provides no advantage over Clang now that Clang is completely stable).

现在(在Xcode 4.0测试版中包含LLVM-2.0),LLVM已经足够成熟代码使用。它编译比GCC快一点,并生成更快的代码,所以使用它,无论何时(几乎,如果有更好的可用,试图避免GCC)。标准Xcode 3.2.5安装包含LLVM-1.6(不是最新的),所以我建议运行一些速度测试,以查看GCC和LLVM之间是否有明显的差异,或从源代码编译Clang并获取最新版本。

By now (with LLVM-2.0 included in the Xcode 4.0 beta), LLVM is mature enough for production code use. It compiles a little quicker than GCC, and produces faster code, so use it whenever you can (pretty much, try to avoid GCC if something better is available). The standard Xcode 3.2.5 install contains LLVM-1.6 (not the latest), so I'd recommend either running some speed tests to see if there's a noticeable difference between GCC and LLVM, or compiling Clang from source and getting the latest version.

基本上,GCC不再需要了,LLVM + Clang就够了。

Essentially, there's no need for GCC any more, LLVM + Clang is more than enough.

这篇关于LLVM vs. GCC for iOS开发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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