Live data from Hacker News

Android NDK: GCC is now deprecated, everyone should be switching to Clang

android.googlesource.com

101–110 of 259 posts

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#101

I'm not sure if this will stoke a flamewar, because I've never seen a discussion here on this (might just be hanging around different articles). Is there any technical reason to prefer clang over gcc other than ideological reasons? I get the modular nature of llvm is useful, but is the android NDK using this feature? Quick google search shows clang lagging gcc in all but one test[0] at least on Intel Broadwell. Again…

Clang had a number of benefits over GCC such as better error messages and integration points for IDEs (syntax checking/etc) which caused Apple to switch to it (on top of licensing). It may have been faster, not sure, but the internals were supposed to be MUCH cleaner and easier to work with.

I know a number of these issues have been improved/fixed in GCC over the last few years. Outside friendliness to internal tinkering and non-GPL software I'm not sure if one as serious technical superiority. I believe clang is written in C++ instead of C, for whatever that's worth.

GCC has always had a much bigger set of supported platforms and processors.

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#102

Earlier quoted context omitted.

It's a somewhat artificial distinction, since the user of a piece of software becomes a developer to modify it. And to preclude modifications which prevent him from effectively monetizing his labour is to infringe on his freedom. Prehaps it would not be if money (etc.) didnt exist. It's always the way, however, with idealists to prescribe policies that make people free in their utopia but cause chaos in our reality.

> And to preclude modifications which prevent him from effectively monetizing his labour is to infringe on his freedom. This sounds a lot like the people saying that adblocker software is infringing the freedom of people trying to monetize their websites (or maybe even "stealing" from them). And I think the same response applies: the fact that your business model isn't compatible with adblocker software, or with my c…

> Plus it seems extra presumptuous to claim some kind of inherent right to profit off derivative works of my software. You can only distribute derivative works of it at all because I've granted you a license.

Sure, but one's choice of the GPL has signalled that one wishes that others be permitted the freedom to build upon the work and do as they wish [0] with their additions -as well as the original work- just so long as they -upon request- distribute the original and their additions to folks who have received the binaries.

[0] This includes charging for access to compiled versions of the software, access to support and documentation, etc. etc. etc. [1]

[1] http://www.gnu.org/philosophy/selling.en.html

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#103

I'm not sure if this will stoke a flamewar, because I've never seen a discussion here on this (might just be hanging around different articles). Is there any technical reason to prefer clang over gcc other than ideological reasons? I get the modular nature of llvm is useful, but is the android NDK using this feature? Quick google search shows clang lagging gcc in all but one test[0] at least on Intel Broadwell. Again…

It's an entirely subjective argument - but I've felt the warning and error messages from clang were so much better than those from GCC that developing under clang became a no-brainer.

Also, I believe ASAN started with clang.

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#104

I'm not sure if this will stoke a flamewar, because I've never seen a discussion here on this (might just be hanging around different articles). Is there any technical reason to prefer clang over gcc other than ideological reasons? I get the modular nature of llvm is useful, but is the android NDK using this feature? Quick google search shows clang lagging gcc in all but one test[0] at least on Intel Broadwell. Again…

I don't know much about Android NDK, but in general, people use clang because:

- Clear and readable diagnostics -- especially useful when debugging nasty C++ template stuff where the type signature is a page long. (GCC is catching up in this area)

- Modular design -- if an IDE wants to have syntax highlighting or an Xcode/Eclipse/IntelliJ like "fix it" feature, they can use the clang frontend to parse the code. Also, GCC's "big ball of mud" design (iirc they do some optimizations like constant folding in the parser) makes it harder to hack on unless you're already pretty familiar with the codebase.

- Less hostile community -- people have tried to clean up GCC but their patches were rejected (see the RMS email link below)

- Helps you with standards compliance -- clang will still compile code with compiler-specific extensions but it has an option to output a warning. There are some codebases that have come to rely on these behaviors so clang's warnings can help make sure you don't end up tied to one specific compiler.

- Personally, I like AddressSanitizer (ASan). It does similar checks as Valgrind, but using compile-time instrumentation -- just pass in an additional flag. Gets rid of a dependency.

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#105

Earlier quoted context omitted.

I feel like you're missing the point of the GNU GPL. The original idea behind the FSFs idea of open source was an ecosystem where every new development resulted in more open and free code. We're talking about people who truly believed in getting away from commercial software entirely. There were people who felt that one day, Linux desktops could replace Windows and even high end tools like Photoshop and Final Cut wou…

Some people will never admit they are wrong...

Richard Stallman, however, is correct.

(I'm going to get that on a t-shirt, printed in block letters: "Stallman is correct.")

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#106
post #48
post #10

Earlier quoted context omitted.

I'm curious, what's wrong with iostream?

How do you internationalize strings built up from multiple string fragments?

Link for those who need more context: http://yosefk.com/c++fqa/web-vs-c++.html#misfeature-4

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#107
post #3

waits for RMS to get mad https://gcc.gnu.org/ml/gcc/2014-01/msg00247.html

> The Clang and LLVM developers reach different conclusions from ours because they do not share our values and goals. It's hard for me to trust the values of a man who thinks sex with children should be legalized. Not ad hominem'ing here, just saying that if his bigger-picture idea of "freedom" includes freedom to have sex with children, he and I have different ideas of what freedom mean, and I can't really say I tru…

> It's hard for me to trust the values of a man who thinks sex with children should be legalized.

[citation needed]

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#108

I'm not sure if this will stoke a flamewar, because I've never seen a discussion here on this (might just be hanging around different articles). Is there any technical reason to prefer clang over gcc other than ideological reasons? I get the modular nature of llvm is useful, but is the android NDK using this feature? Quick google search shows clang lagging gcc in all but one test[0] at least on Intel Broadwell. Again…

Here's one incredibly awesome feature of Clang: Windows support (thanks to Google, actually).

No Cygwin/msys required -- it implements the Windows calling conventions, exception handling, etc. You can link modules compiled with Clang using the Microsoft linker.

https://www.youtube.com/watch?v=dr0eY9c23i8

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#109

The sad thing is that "easy to link and embed" and "permissive license" really didn't have to go together like they did in LLVM. GCC could have provided a library that made it easy to do code generation or compiler development. That library could still have used the GPL, so that only Free Software could use it. Some of the work that has happened around LLVM wouldn't have happened around such a library, but some of it…

I feel like you're missing the point of the GNU GPL. The original idea behind the FSFs idea of open source was an ecosystem where every new development resulted in more open and free code. We're talking about people who truly believed in getting away from commercial software entirely. There were people who felt that one day, Linux desktops could replace Windows and even high end tools like Photoshop and Final Cut wou…

> I feel like you're missing the point of the GNU GPL. The original idea behind the FSFs idea of open source was an ecosystem where every new development resulted in more open and free code.

First of all, "FSF's idea of open source"? They'd rather vigorously object to that phrasing. :)

But no, that was exactly my point: I'd argue that intentionally choosing to not allow the development of a library version of GCC, even under the GPL, caused a net reduction in the amount of Free Software in general, and copyleft-licensed Free Software in particular, that would otherwise have been developed.

Re: Android NDK: GCC is now deprecated, everyone should be switching to Clang

#110
post #46

Earlier quoted context omitted.

>By pretty close you mean no where near a usable system then you'd be correct. If you're not a hardware person, as I'm not, I don't think I could go from blank fpga and parts to a working laptop with a keyboard, trackpoint, and lcd screen in any reasonable amount of time, nor with any certainty that it would work and not be error-prone. The exact same argument can be made about the operating system.

I can and have patched bugs in my operating system. I have no clue where I'd even start to patch a bug in my hardware.

If you're lucky it's off-chip and your soldering iron and a very sharp knife will come in handy.

The problem with 'patching' hardware these days (oh, I'm that old) is that most of the time you'll find your problem is located inside a chip, and it isn't the traces are in planes that you can't access (if you're lucky they might run in a spot where you can dremel through and then cut and solder two small wires to the buried trace). Via's don't help either (especially not in layers that start and end under BGAs).

Patching hardware was never easy, but with todays degree of integration of components and SOCs it is harder than ever and frequently downright impossible.

Lots of things have gotten easier since the hole-through era, but hardware fixes aren't one of those.

Post reply on HN