rdos wrote:Assembler and C++ is the optimal combination. C is useless "middle-ground". You can do everything faster in assembler than i C, and object-oriented interfaces are much easier constructed in C++ than in C. Therefore, C has no real advantage anywhere.
Hand-written asm is not always faster than the code produced by a good C optimizing compiler. The OO features of C++ help, if OO is what you need. On the other hand,
C++ is a ridiculously complex language and I would hate to try porting a C++ compiler to a new platform!
After fighting with the evils of cross-platform C++ code for the better part of 10 years, I'm happy to go back to the simplicity of C for low-level stuff (my hobby) and the convenience of C# for high-level stuff (my day job). Different strokes for different folks, I guess.
rdos wrote:Isolation is done by using handles in kernel code, and only exporting those to user-mode. This concept is 100% safe and doesn't need any compiler support. Isolation within the kernel is best achieved with hardware mechanisms (paging, segmentation, and whatever else is present).
There is no 100% safe.
I was not actually discussing the trade-offs between software and hardware isolation. I was just trying to clear up what it means for a language to be "safe" since this seems to cause people a lot of confusion. But if you're interested in learning more about the trade-offs, there are
plenty of research papers to read! Specifically, take a look at "Deconstructing process isolation" which has a lot of interesting benchmarks comparing various mixes of hardware and software isolation. To summarize: MMU overhead is non-trivial!
rdos wrote:No language that support pointers can be considered "safe".
Strictly speaking, you're correct. C# as a whole is not safe. However, its unsafe features are all limited by the type system such that they can only be used in methods or blocks of code that are specifically marked with the
unsafe keyword. This means that if you write a C# program that uses pointers, the system will know about it when it verifies your IL and can refuse to run your code. This
cannot be spoofed as it is a fundamental property of the IL being verified -- either it violates type-safety, or it doesn't.
rdos wrote:It is easy to break any type-safe language with assembler code.
What do you mean exactly? That allowing inline asm makes a language unsafe? That's true. Do you mean that you can write arbitrary unsafe code that can run in the same memory space as a program written in a "safe" language and write all over its memory? If so, that defeats the purpose of using safe languages in the first place. Singularity does not allow arbitrary unsafe code to run. It verifies the code first, and refuses to run it if it is unsafe.