by MBCook · 14y ago · 0 comments
http://clang.llvm.org/comparison.html#gcc
Outside the license, the main benefit seems to be that in Clang the different stages are less intertwined than GCC. This is supposed to make developing Clang easier (since you don't have to understand so much), allowing optimizations to be tested and added easier.
On the user side, Clang is well known for providing much better error messages. Some error messages will even suggest possible fixes (you might get something like "Can't assign a pointer to a something, did you mean *pointer?").
The GCC guys have been improving their compiler for a long time, and over the last few years they have been working hard to make GCC easier to work on and optimize. I believe that GCC is usually faster or the binaries are smaller by a few percent, but it's not generally a drastic difference.
It's important to note though that it has only been recently (starting with GCC 4.4) that I've started to see some _improvement_ over previous GCC versions. GCC 3.x was known to be bloated, buggy and emit poor code for almost every architecture. Open64 was superior in _all_ regargs up to GCC 4.2/4.3 in my opinion.
Clearly, the whole project greatly benefited from Clang's competition.
Here [0] is an example of Xcode leveraging clang to provide valuable feedback. The second picture speaks volumes.
[0] http://www.macfanatic.net/blog/2009/08/28/xcode-3-2-static-a...
I'm not sure how it works in Clang, but of course, GCC doesn't "see" macros, this is seen by the CPP (C pre processor) and GCC operates in C code only
There's a flag (-E) that makes GCC output the preprocessed code and stop