jacob said:
Ian Collins a écrit :
Surely not ideal
1) Exception handling in the kernel is a NO-NO... Many programs
in C++ rely on that however.
Exception handling is not forced upon C++ programmers. Presumably,
kernel code would avoid it.
2) The OO paradigm is not adapted to OS writing, but an event
oriented program looks more promising... as it is now.
FWIW, significant amounts of Windows NT and MacOSX are written in
object oriented C++. Things like the filesystem and device drivers do
lend themselves to object oriented design, though that may not always
be the best choice.
3) The performance of C++ is not better than C, and mostly
worst. In an OS context this is not really a plus
No. Only some portions of C++ are slower than C, and it so happens
that those are the portions that are likely to be of least use to
system programming.
High performance microkernels like L4 disprove your assertion that C++
is bad for writing operating systems. It's being increasingly used in
this domain.
C is used because, often it so happens that high quality compilers are
available for it, and C++, until recently suffered in this area. For
example, when Linux was started, in 1990, gcc was already a very good
C compiler, but it's C++ version was buggy to say the least. It's
taken much longer to write good C++ compilers, but it's nearly done,
and hence you see more and more system code being done in C++.
Personally, I still like C's simplicity over C++, and if I were to
write an OS, I would probably favour it over C++, but that a personal
preference. It doesn't mean that one is definitively better than the
other.