4 ms·
The licence of the compiler doesn't affect what you build with it. I expect the reasons are the same most people are switching to clang: * Modern modular desig
by IshKebab 12y ago
The licence of the compiler doesn't affect what you build with it. I expect the reasons are the same most people are switching to clang:
* Modern modular design (everything is libraries)
* Faster compile times
* Nicer error messages
The modular design in particular is a good reason that might not be obvious at first. It lets you do things like debuggers, code formatters and static analysers in a much more sane and robust way than GCC's "no plugins, everything must be separate and flaky" way.
- pjmlp 12y agoClang brought new life into C and C++ eco-systems, specially in the sense that since we cannot get rid of C for the time being, at least we can improve the tooling around it to make it safer. But sometimes I wonder if the license doesn't play a role as well.
- _RPM 12y agoWhy would you want to get rid of C?
- wolf550e 12y agoTo make certain classes of bugs impossible. What will end up hapenning with all code that must be kept is that ever stricter compilers and static analyzers will find the unsafe code and it will be fixed piece by piece.
- DannyBee 12y agoThe license played no role in this switch :)
- deleted 12y ago[deleted]
- deng 12y agoGCC has support for plugins since version 4.5, which is over four years old. Also, the error messages have improved greatly in the last releases.
- bronson 12y agoIf you spend a long time damaging your project's internal organization, expect to spend a long time digging back out.
- DannyBee 12y agoYou really want to have the infrastructure argument about which is a better compiler infrastructure? Even GCC developers (like I was ) don't really question it. The only thing GCC buys you right now, at all, is slightly better performance (it varies depending on your benchmark) and support for a larger variety of odd embedded systems. On the other hand, LLVM is very easy to modify, can be built as a library (as can clang), has a sane, well defined IR, etc.
- deng 12y agoDid I say that gcc has the better infrastructure, the more modern code base, better modularity? I don't think so. That would actually be pretty weird, given that its code base is nearing 30 years of history. But I hope that it is still allowed to say that GCC has made progress the past few years. And I think it is worth refuting claims like "you cannot access the AST in gcc", since this is simply not true anymore. Yes, actually dealing with the AST is baroque, but you can access it nonetheless. There are nice plugins for GCC, like Melt or the python-plugin which make this easier, though. Also, there's the license/freedom thingy, which might not interest you, but others do care about such things.
- DannyBee 12y ago"Did I say that gcc has the better infrastructure, the more modern code base, better modularity? I don't think so. " Your reply certainly implied you thought GCC was fine along the same axises your parent said clang was better. "But I hope that it is still allowed to say that GCC has made progress the past few years." You are talking to a guy who helped make some of this progress (for example, I helped build the tree-ssa project that brought a language independent middle IR and SSA optimizers to GCC). It's certainly made progress, but that progress had been fought about for the 5 years before that. At the same time, GCC lost good developers during these fights due to wanting to get stuff done and not deal with politics. "Also, there's the license/freedom thingy, which might not interest you, but others do care about such things." Actually, it interests me immensely. I helped with things like the libstdc++ exception, etc. Besides being a compiler guy, i'm an open source lawyer. But in the end, I choose stuff based on technical merits first, freedom second. You are of course, welcome to do as you please.
- film42 12y agoI recently heard a google employee come speak at my university about how google's main codebase is compiled using clang, and their janitorial work is done using clang mapreduce [1]. Furthermore, that google employee talked about how google is working with the LLVM team to integrate the toolchain into visual studio for cross-platform compilation [2]. Pretty cool stuff! [1] (similar talk) https://www.youtube.com/watch?v=mVbDzTM21BQ https://www.youtube.com/watch?v=mVbDzTM21BQ [2] http://llvm.org/docs/GettingStartedVS.html http://llvm.org/docs/GettingStartedVS.html
- joelthelion 12y agoNone of these reasons matter at all for production builds. The production build needs to happen only once per release, and the only things that count are performance and reliability. The last time I checked gcc still had better performance than CLang, but things might have changed since then.
- emn13 12y agoI have no idea whether it's true, but on the topic of gcc's inferiority in the matter of error messages, this source claims it's no longer true: https://gcc.gnu.org/wiki/ClangDiagnosticsComparison https://gcc.gnu.org/wiki/ClangDiagnosticsComparison Of course, given the source, apply salt :-).
- Alphasite_ 12y agoI dont know about C++, but for C Clang certainly feels like it has better error messages than the variant of GCC that the distro the Uni defaults to has, If nothing else, because of the colour.
- emn13 12y agoAre the versions you're using up to date, however?