4 ms·
C programmers often use the free GCC (GNU compiler collection) to compile their programs. clang is a new open source C compiler that may be better for some peop
by by 17y ago
C programmers often use the free GCC (GNU compiler collection) to compile their programs. clang is a new open source C compiler that may be better for some people because it has a different licence, will be faster in certain circumstances and may give better error messages. The significant milestone the clang project has reached is the ability to sucessfully compile a very large quantity of C code.
(Edit: C++ as well as C)
- utku_karatas2 17y ago> because it has a different licence In which manner does the GCC license restrict the user in a problematic way? (well, except GPL's distribution restrictions I suppose.)
- woodson 17y agoThe changes due to GPLv3 (non-discriminatory patent licence etc.) seem to be incompatible with the interests of BSD people [1] as well as perhaps Apple, who is the main sponsor. [1] http://wiki.freebsd.org/BuildingFreeBSDWithClang http://wiki.freebsd.org/BuildingFreeBSDWithClang
- wtallis 17y agoLLVM is designed to be more than just a compiler. It's different stages can be used separately by other code, making it well suited for building things like static analysis tools. Apple (sponsor and de facto leader of LLVM) has been taking advantage of this to integrate clang-based static analysis into XCode, the proprietary IDE that ships with Mac OS X. Even if GCC had a clean enough architecture to be used this way, the licensing restrictions would force all of XCode to be open-sourced.
- alextgordon 17y agoClang and LLVM take a library based approach. They're designed so that tools that need to work with C/C++/Objective-C can simply link Clang. GCC was never designed to do this, and even if it were, it's under the GPL and not the LGPL, which makes it unsuitable for linking as a library in non-GPL'd code. In contrast LLVM/Clang has a BSD-like licence.
- protomyth 17y agoTo add, the use of the less restrictive license allows the creation of tools using clang like a library. For example, you can now use the same parser the compiler is using to do syntax highlighting or refactoring. This will allow both commercial / non-commercial interests to build tools that do interesting things without having to build a parallel infrastructure.
- jcl 17y agoAs I understand it, one thing LLVM can do that GCC can't is run-time compilation and optimization: generating code on the fly and compiling it to run at native speeds, maybe also profiling several different versions and picking the best. This is only possible if you have significant chunks of a compiler built into your application. If you were to attempt the same with GCC, your application would need to be GPLed.