When you talk about kernels for Unix-y like Linux, Solaris, Mac OS X, NetBSD, FreeBSD, etc. - they are usually all C. And I'm also not sure what you mean by default or overloading variables - of course, not in kernel calls.
I was surprised when DigitalRoss stated that Mac OS X has Objective-C in the kernel source files, so I downloaded the xvu kernel version for MacOS X 10.6.2, and there really wasn’t target C. I was, however, slightly shocked to discover a bit of C ++.
In any case, many things on which "user" (non-kernel) programs are based, such as virtual memory, exception handling, device I / O, etc., are performed by the kernel. But the core cannot use itself for these things, just as you cannot raise yourself in the air by lifting your shoes with your hands.
Object-oriented languages such as C ++ and Objective-C make extensive use of what kernels cannot do for themselves. This is why the kernels are mostly written in C. In the case of C ++, which I saw in xnu sources, I am sure that it is very, very carefully written to avoid actions that are unsafe in the kernel.
As for user-space programs written in C or C ++, I think that this is mainly a tradition, personal preferences and what people are used to. As a person who speaks both languages, I think this is pretty stupid.
source share