TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Why Apple Chose Clang (2008)

162 pointsby datalusover 4 years ago

13 comments

mhh__over 4 years ago
- Licence<p>- Not designed to be difficult to extend<p>Everything else is basically irrelevant because as Clang has aged it&#x27;s both slowed down and reached parity in both compile and execution speed. Phoronix even have GCC <i>faster</i> than Clang at building the Linux Kernel, even in an (according to a comment) biased sample where GCC wasn&#x27;t built with lto enabled. GCC also (last time I tried) does better debug info.<p>LLVM is <i>much</i> easier to hack on, though, although some parts are more similar than you might expect.<p><a href="https:&#x2F;&#x2F;www.phoronix.com&#x2F;scan.php?page=news_item&amp;px=GCC-Faster-Kernel-Builds-Clang" rel="nofollow">https:&#x2F;&#x2F;www.phoronix.com&#x2F;scan.php?page=news_item&amp;px=GCC-Fast...</a><p>You should try and fettle with both to see what works best for your project.
评论 #25755731 未加载
评论 #25757581 未加载
评论 #25756985 未加载
评论 #25756707 未加载
评论 #25756096 未加载
Lammyover 4 years ago
I imagine this page&#x27;s creative process to be something like:<p>- Okay, we need to think of some reasons besides &quot;It&#x27;s not GPLv3&quot;.<p>- In fact, let&#x27;s list that one last so it looks like an afterthought that doesn&#x27;t concern us so much.<p>- Hmm, no, too conspicuous. Make it next-to-last.
评论 #25756221 未加载
评论 #25757688 未加载
gen220over 4 years ago
This is a cool repository! fairly old, as others have noted.<p>There&#x27;s a directory [1] containing some &quot;historical notes&quot; written by the creators of llvm: Chris Lattner and Vikram Adve. One of them is the original clang readme [2].<p>[1]: <a href="https:&#x2F;&#x2F;opensource.apple.com&#x2F;source&#x2F;clang&#x2F;clang-800.0.42.1&#x2F;src&#x2F;docs&#x2F;HistoricalNotes&#x2F;" rel="nofollow">https:&#x2F;&#x2F;opensource.apple.com&#x2F;source&#x2F;clang&#x2F;clang-800.0.42.1&#x2F;s...</a><p>[2]: <a href="https:&#x2F;&#x2F;opensource.apple.com&#x2F;source&#x2F;clang&#x2F;clang-800.0.42.1&#x2F;src&#x2F;docs&#x2F;HistoricalNotes&#x2F;2007-OriginalClangReadme.txt.auto.html" rel="nofollow">https:&#x2F;&#x2F;opensource.apple.com&#x2F;source&#x2F;clang&#x2F;clang-800.0.42.1&#x2F;s...</a>
ehvatumover 4 years ago
&gt; GCC does not require a C++ compiler to build it &gt; GCC front-ends are very mature and already support C++. clang&#x27;s support for C++ is nowhere near what GCC supports.<p>These things were true when Apple first went with Clang, and this document must date from that time.<p>GCC is now implemented in C++, and Clang’s C++ support is excellent. The only issue I have with my c++17 code in Clang is I can’t yet rely on recursive template parameter pack deduction.
评论 #25761899 未加载
colejohnson66over 4 years ago
&gt; Clang does not implicitly simplify code as it parses it like GCC does. Doing so causes many problems for source analysis tools: as one simple example, if you write &quot;x-x&quot; in your source code, the GCC AST will contain &quot;0&quot;, with no mention of &#x27;x&#x27;. This is extremely bad for a refactoring tool that wants to rename &#x27;x&#x27;.<p>Can someone explain this Clang “pro”? If a refactoring tool wants to rename “x”, it does it to the <i>source</i>, not the AST, no? And if “x-x” is turned into 0 by the parser, why does it matter? Assuming “x” isn’t volatile, “x-x” is <i>indeed</i> 0!
评论 #25756432 未加载
评论 #25756451 未加载
评论 #25756356 未加载
评论 #25756870 未加载
评论 #25759156 未加载
sanxiynover 4 years ago
This is a very old comparison, circa 2008 (when Clang was started). It&#x27;s mostly irrelevant today.
评论 #25755977 未加载
leerunsover 4 years ago
Can&#x27;t talk about superiority of one compared to the other without viewing the landscape of the develop, it needs to run fast, be easy to debug, compile fast. There are trade offs for all. Most serious devs likey run several ide and build chains, ea h offering its own value. For example if you want clean template debugging clang lldb is pretty nice
dilyevskyover 4 years ago
Slight offtopic: anyone else annoyed by the darwins crappy support for static linking and general <i>extreme</i> lack of documentation? E.g lack of -Bstatic option and similar?
评论 #25760285 未加载
评论 #25758783 未加载
j16sdizover 4 years ago
I think this came from clang source code tar ball, not apple.
marviioover 4 years ago
I wonder if Swift would have happened if they went with gcc? No Lattner.
pvgover 4 years ago
retitled dupe of <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22284397" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=22284397</a>
CalChrisover 4 years ago
TL;DR<p>&quot;GCC is licensed under the GPL license. clang uses a BSD license, which allows it to be used by projects that do not themselves want to be GPL.&quot;<p>For example, Apple can keep their internal backends (GPU, some ARMv8 details) proprietary.
评论 #25755665 未加载
评论 #25757272 未加载
评论 #25759268 未加载
chunsjover 4 years ago
I&#x27;m sure on the part of &quot;License to Steal&quot;. I&#x27;m not sure on the part of &quot;Technical Pros&quot;.