the variants we are interested in. clang's support for C++ in\r
particular is nowhere near what GCC supports.</li>\r
<li>GCC is popular and widely adopted.</li>\r
+ <li>GCC does not require a C++ compiler to build it.</li>\r
</ul>\r
\r
<p>Pros of clang vs GCC:</p>\r
\r
<ul>\r
- <li>GCC has a very old codebase which presents a steep learning curve to new\r
- developers. The Clang ASTs and design are intended to be easily\r
- understandable to anyone who is familiar with the languages involved\r
- and have a basic understanding of how a compiler works.</li>\r
- <li>GCC is built as a monolithic static compiler, which makes it extremely\r
- difficult to use as an API and integrate into other tools (e.g. an IDE).\r
- Its historic design and <a \r
+ <li>The Clang ASTs and design are intended to be easily understandable to\r
+ anyone who is familiar with the languages involved and who have a basic\r
+ understanding of how a compiler works. GCC has a very old codebase\r
+ which presents a steep learning curve to new developers.</li>\r
+ <li>Clang is designed as an API from its inception, allowing it to be reused\r
+ by source analysis tools, refactoring, IDEs (etc) as well as for code\r
+ generation. GCC is built as a monolithic static compiler, which makes\r
+ it extremely difficult to use as an API and integrate into other tools.\r
+ Further, its historic design and <a \r
href="http://gcc.gnu.org/ml/gcc/2007-11/msg00460.html">current</a>\r
<a href="http://gcc.gnu.org/ml/gcc/2004-12/msg00888.html">policy</a> \r
- makes it difficult to decouple the front-end from\r
- the rest of the compiler. Clang is designed as an API from its\r
- inception.</li>\r
+ makes it difficult to decouple the front-end from the rest of the\r
+ compiler. </li>\r
<li>Various GCC design decisions make it very difficult to reuse: its build\r
system is difficult to modify, you can't link multiple targets into one\r
binary, you can't link multiple front-ends into one binary, it uses a\r
<li>GCC simplifies code as it parses it. As one simple example, if you\r
write "x-x" in your source code, the GCC AST will contain "0", with no\r
mention of x. This is extremely bad for a refactoring tool that wants\r
- to rename 'x' for example.</li>\r
+ to rename 'x'.</li>\r
<li>GCC does not have a way to serialize the AST of a file out to disk and \r
read it back into another program. Its PCH mechanism is architecturally\r
- only able to read the dump back into the exact same binary.</li>\r
- <li>GCC is <a href="features.html#performance">very slow and uses a large \r
- amount of memory</a>.</li>\r
- <li>The diagnostics produced by GCC are acceptable, but are often confusing\r
- and it does not support <a \r
- href="features.html#expressivediags">expressive diagnostics</a>.</li>\r
+ only able to read the dump back into the exact same executable as the\r
+ one that produced it.</li>\r
+ <li>Clang is <a href="features.html#performance">much faster and uses far\r
+ less memory</a> than GCC.</li>\r
+ <li>Clang aims to provide extremely clear and concise diagnostics (error and\r
+ warning messages), and includes support for <a\r
+ href="features.html#expressivediags">expressive diagnostics</a>. GCC's\r
+ warnings are acceptable, but are often confusing and it does not support\r
+ expressive diagnostics. Clang also preserves typedefs in diagnostics\r
+ consistently.</li>\r
<li>GCC is licensed under the GPL license. clang uses a BSD license, which\r
allows it to be used by projects that do not themselves want to be\r
GPL.</li>\r
+ <li>Clang inherits a number of features from its use of LLVM as a backend,\r
+ including support for a bytecode representation for intermediate code,\r
+ pluggable optimizers, link-time optimization support, Just-In-Time\r
+ compilation, etc.</li>\r
</ul>\r
\r
<!--=====================================================================-->\r
<ul>\r
<li>PCC dates from the 1970's and has been dormant for most of that time.\r
The clang + llvm community are very active.</li>\r
- <li>PCC doesn't support Objective-C and doesn't aim to support C++.</li>\r
+ <li>PCC doesn't support C99, Objective-C, and doesn't aim to support\r
+ C++.</li>\r
<li>PCC's code generation is very limited compared to LLVM, it produces very\r
inefficient code and does not support many important targets.</li>\r
<li>PCC's does not have an integrated preprocessor, so it is extremely\r