I'm an iOS developer, I don't know how compilers work and I want to ask what is the difference between the LLVM GCC 4.2, the Xcode 4 default compiler and the GCC 4.2 compiler, the Xcode 3 default compiler.
1 Answers
Here is my understanding
GCC 4.2 is the (mostly) stock standard open source GNU C compiler that works with C, C++ and Objective-C. Its pretty much the standard compiler used in all open source, and its tried and true tested. But because its old technology, its just a compiler, it has no hooks for other uses. And its quite generic, being CPU and platform agnostic.
LLVM is the next generation of compilation software. It's syntax and semantically aware, compiling to a byte code and then to native, and it provides hooks so IDE's and other tools can use its knowledge. It's this awareness that allows Apple to improve auto-completion, implement fixit and do the build and analyze stuff in Xcode 4. LLVM is the future for Apple, and the future for GCC. LLVM also produces allegedly tighter code, as its optimizations are smarter (not sure about this). LLVM also allows for more dynamic language bindings at some point.
LLVM GCC is the half-way mark, the syntax and semantic preprocessing of LLVM with the old GCC back end compiler.
The way I use them
I use LLVM during development, as it keeps me warned of any and all issues. Really helped when I ran it the first time on legacy code and found some issues.
I use GCC to produce the final executable for iOS 3.1.3 apps, and LLVM for all the iOS 4.0 / Mac 10.6 apps.