6 ms·
> Java FTW on Android This made me smile. Need I point out that Android runs on top of Linux? Or that you can still use C/C++ on Android? http://developer.andr
by IgorPartola 11y ago
> Java FTW on Android
This made me smile. Need I point out that Android runs on top of Linux? Or that you can still use C/C++ on Android? http://developer.android.com/tools/sdk/ndk/index.html http://developer.android.com/tools/sdk/ndk/index.html
- pjmlp 11y agoYes and I use it. I also feel the pains that Android teams imposes on the NDK users to use it as little as possible. If you bothered to read the contents of the link that you pushed. "Notably, using native code on Android generally does not result in a noticable performance improvement, but it always increases your app complexity. In general, you should only use the NDK if it is essential to your app—never because you simply prefer to program in C/C++. When examining whether or not you should develop in native code, think about your requirements and see if the Android framework APIs provide the functionality that you need" Also Android Java is nowadays AOT compiled to native code. So whatever C and C++ dependencies there are, could certainly eventually be replaced if there were willingness to do so. Besides, have you ever tried to implement libc in ANSI C, without language extensions and a sprinkle of Assembly?
- IgorPartola 11y agoNonetheless, it's something that is available to you as a developer. I am firmly in the "right tool for the job" camp, and I can see situations where C is the better tool. I don't see why mobile app development would benefit from it, but I almost never have the opportunity to work with Android. I have never attempted to put together a full libc in ANSI C, no. My experience there is limited to putting together parts of it for various microcontrollers, where I was more or less bound to ANSI C and chose to use no assembly. That's a long way of saying, what's your point? And why do you feel the need to get personal?
- pjmlp 11y agoExcuse me if it felt personal it wasn't my intention, just the way I write. Non native speaker here. As I mentioned in the reply and in another thread, I do use the NDK, but I wouldn't if there were better alternatives. 30 years ago those microcontrollers would probably be programmable in Assembly and Forth, Pascal, Basic and C dialects. At least when I think about Z80 like ones.
- tosseraccount 11y ago... and apple runs of top of BSD. C popularity pre-dates workstations. DEC (Digital Equipment Corporation ) , maker of popular mini computers, used it extensively.
- pjmlp 11y agoI only bothered to use C when forced into UNIX world via Xenix. Yes Apple runs on top of BSD, because they weren't able to write a new OS and had to buy one, which happened to be built on top of BSD. Once upon a time they had their OS written in Object Pascal, but then they decided to rewrite it in C to welcome those UNIX devs. Nothing prevents them to rewrite parts of the OS in Swift after the language gets more mature. It is only a question of willingness, political will and money.
- mikeash 11y agoWhat Apple OS was written in Object Pascal? It looks like they had an app framework written in that language, but the OS never was. I believe the Mac OS at the time was predominantly written in assembly, possibly with some (non-object) Pascal parts.
- pjmlp 11y agoMac OS, the initial versions. It was a mix of Object Pascal and Assembly. The Pascal extensions that Borland later adopted in TP 5.5.
- mikeash 11y agoThe initial versions were pure assembly. There was no room for any high-level code. As time went on and more storage was available, that became a possibility, but much of the OS remained assembly. This was a big part of why so much of the OS ran under emulation when the PowerPC Macs were introduced.
- pjmlp 11y ago
- lmm 11y agoJust because it's not perfect doesn't mean it's not better. Yes Android runs x000 lines of C and that's x000 lines too many, but it's still a substantial improvement over desktop systems.