In fact, in Linux we did try C++ once already, back in 1992.
It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel.
you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++.
In general, I'd say that anybody who designs his kernel modules for C++ is either
(a) looking for problems
(b) a C++ bigot that can't see what he is writing is really just C anyway
(c) was given an assignment in CS class to do so.
Feel free to make up (d).
# Pour le C++
Posté par Croweye . En réponse au journal GNU/Hurd c'est quoi au fait ?. Évalué à 8.
[Why don't we rewrite the Linux kernel in C++? ]
In fact, in Linux we did try C++ once already, back in 1992.
It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel.
you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++.
In general, I'd say that anybody who designs his kernel modules for C++ is either
(a) looking for problems
(b) a C++ bigot that can't see what he is writing is really just C anyway
(c) was given an assignment in CS class to do so.
Feel free to make up (d).
Linus