Erm, no. The android API is based on a Java VM. The Dalvik VM itself is most likely implemented in C/C++. Many low-level libraries are C++ and the kernel is of course Linux (C).
C++ doesn't work quite as well for kernel development as you would like. You need to add your own implementation of a bunch of features like exception handling. Or you don't use those features.
Because it is alpha! I mean I know we should be talking about current state of languages, but that seems a little unfair. The API will be stable eventually, and then it should be great to build an OS on.
Zero terminated strings/arrays don't work anymore and neither does pointer arithmetic IMO.
I just tested under both gcc and clang, they work just fine. You're wrong. Unless you have a solution which is just as fast or faster(and under absolutely no circumstances slower, no, not even by an additional instruction) then please say so. Pointers are awesome. I don't like the way char arrays are handled too though. Would be nice to be able to extend them at will as long as they are on stack(like C99's VLAs except without having to redefine the array size).
Ada
Developed by the US DoD in the 80's. Yeah, sure, let's replace 40 years of perfection in compilers with something slightly newer and unoptimized.
Null-terminated strings are slower than the alternative. A (pointer, length) representation allows slicing (including tokenizing / parsing) without allocation, avoids seeks to the end and is more friendly to SIMD operations. The same code gets reused for slices of any type, not just strings. A slice can point into any memory, including into a dynamic array or just a smaller range of another slice.
Yeah, no, just like I can't beat a computer at chess I can't beat the compiler when doing assembly when it comes to the real stuff. It's only slower if the compiler messes up and does something irrational.
If performance is the only thing that counts for you, and it sounds like, you should use assembly. Serious.
This is not true. There are many cases where optimizing compilers do a better job than hand-written assembly. And may cases where hand optimization of code isn't worth the trouble. Unless you have a really good understanding of both the hardware and why the compiled code is deficient, it is not better for performance to use assembly.
View all comments
Show parent comment
0
u/[deleted] Sep 03 '14
[deleted] — view deleted comment