Live data from Hacker News

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

android.googlesource.com

161–170 of 259 posts

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

#161

Earlier quoted context omitted.

POSIX printf allows a translator to write a conversion spec like "%1$d" that says which arg to print. This lets you do stuff like put currency before or after the amount depending on what's idiomatic for the locale, without recompiling (if you lookup your format strings at runtime).

Sure, but that's l10n, which is a different -but related- thing. :) printf format strings are well thought-out. I was demonstrating that the same ideas can easily be used with io*stream.

For the downvoters: Here's a lib that accomplishes this task that's had a fair bit more than 10 seconds of thought put into it: [0]. Examples [1][2].

:)

[0] http://www.boost.org/doc/libs/1_60_0/libs/locale/doc/html/in...

[1] http://www.boost.org/doc/libs/1_60_0/libs/locale/doc/html/he...

[2] http://www.boost.org/doc/libs/1_60_0/libs/locale/doc/html/me...

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

#162

Earlier quoted context omitted.

The same way you'd do it in printf? Stringize data and insert it in the middle of static text? (Pardon my inelegant code, I've been away from C++ and doing Erlang for quite a while now.) void printStuff(ostream Os, string WarningPart, string SizePart, string EndPart, int Size) { //The English version might look like: //"Warning: Size too big (200). Get smaller." Os I expect that if I thought about the problem for a f…

That solution is good, but it assumes you can break the message up into those parts for every language and use the same iostream sequence for every language. With printf, we have gettext. I don't really see how there's any analogy for gettext in iosream-world.

> With printf, we have gettext. I don't really see how there's any analogy for gettext in iosream-world.

Funny thing. Boost more-or-less uses gettext, too! https://news.ycombinator.com/item?id=10774941

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

#163
post #38

Earlier quoted context omitted.

Going to fun when the developers take Clang closed sourced and add DRM support to it.

What does DRM support in a compiler tool chain even mean? The ability to develop DRM is available by the nature of the tool, but that is also true of GCC.

Means you won't be able to generate code that runs on other machines without it being signed a trusted third party.

You watch.

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

#164

Earlier quoted context omitted.

With printf, you do have to look at the docs to see what the string conversion function is. With iostream, you still have to look at the docs to see if the ostream operator is implemented for the class, it's certainly not universal.

I never said io*stream support was universal, [0] I said that it provided a _consistent_ mechanism. :) [0] I mean, it's obvious that anything that you don't get for free out of the box is bound to _not_ be universal. Edit: Actually, the thing you get out of the box when you present an instance of a non-trivial user-defined class to both printf and ostream is equally useless... unless you're debugging and are interest…

Right, I'm just questioning whether this consistency buys you anything. Either way you're checking the docs to see how to print an object.

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

#165
post #158

Earlier quoted context omitted.

It's a pain to format text. Things like: printing an int in hex, printing a zero-padded int of a specific length, printing a float to two decimal places. And having those formatting changes be stored silently as global state leads to unexpected behavior.

FWIW, most of these options revert back to default as soon as you format something; but I agree that I would have preferred iomanip to generally be a wrapper around values rather than a silent modifier of the stream.

Which is worse than none of them reverting back to default..

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

#166

Earlier quoted context omitted.

> How is iostream any better than [ ]printf? What consistent mechanism do you use to printf an instance of an arbitrary user-defined type? With ostream, you implement ostream& operator and you're done. with printf, you have to have a convention and remember to stick to it. (Do I call .toString(), .stringize(), .getString()... ??) For one-off things, printf is great . You take it from me when you pry it from my goddam…

With printf, you do have to look at the docs to see what the string conversion function is. With iostream, you still have to look at the docs to see if the ostream operator is implemented for the class, it's certainly not universal.

> look at the docs to see if the ostream operator is implemented for the class

Or give it a go and see if the ide/compiler complains.

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

#167

Earlier quoted context omitted.

I never said io*stream support was universal, [0] I said that it provided a _consistent_ mechanism. :) [0] I mean, it's obvious that anything that you don't get for free out of the box is bound to _not_ be universal. Edit: Actually, the thing you get out of the box when you present an instance of a non-trivial user-defined class to both printf and ostream is equally useless... unless you're debugging and are interest…

Right, I'm just questioning whether this consistency buys you anything. Either way you're checking the docs to see how to print an object.

> ...I'm just questioning whether this consistency buys you anything.

It buys you the same thing that API consistency always buys you: reduced cognitive overhead when dealing with a given API. :)

Edit: As GFK_of_xmaspast mentions [0] instances of non-trivial classes are not compatible with the default implementations of "operator know that operator So, no need to check the docs... just ask the compiler. :)

[0] https://news.ycombinator.com/item?id=10775022

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

#168

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…

It's unreasonable to expect commercial software companies to do all the work to build a free software ecosystem, since that's not what they're about. Still, they've made some substantial contributions. F-droid might not be good enough yet, but they're still a lot further along than they would be starting from scratch, without Android.

So although it hasn't succeeded for phones yet, building on top of tech stacks contributed by others (who haven't fully bought in to the same goals, but are sympathetic in some ways) still seems like a great strategy. The free software community needs to finish the job.

On the other hand, going fully independent and building stuff separately without those contributions (which seems to be what some free software folks want to do with commercial-unfriendly licenses) doesn't make a whole lot of sense to me. If you can't succeed even with substantial help, how do you succeed without help?

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

#169
post #91

Earlier quoted context omitted.

> C already has rock-solid string formatting options Don't troll.

Do you have an actual response? How is iostream any better than *printf? At least you can read the format of the former without needing to google un-googleable operators.

In addition to the already-mentioned type safety and user-defined operator<< /etc overloading, it's very liberating to read into a std::string and not have to do a bunch of memory management and worry about null-termination or buffer overflows.

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

#170

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'm not the big android user, but having used cyanogenmod with fdroid and free apps exclusively for a bit, i'm quite impressed with the free software userland, especially offline maps and puredata-patch runner, pddroidparty.

pity about the drivers though. at a speech in copenhagen stallman was encouraging people to start reverse engineer these.

it's nice that at least some of the phones are somehow open.

Post reply on HN