I have always been fond of the idea of having an operating system kernel written entirely in C++ so that it had a clean class hierarchy, exception-based error control, etc. I know this is very difficult to achieve due to the inherent complexity of C++ and its runtime, but not impossible if appropriate care is taken.
C++ for Kernel Mode Drivers is an article I just found that talks about using C++ in driver code for the Windows OS. It explains in great detail why using C++ is difficult and discouraged in such scenario. Without paying much attention to Windows-specific details, it is a good read no matter which OS you develop for.
There's no way to do such thing ! C++ execution time WAY too long to be able to run an OS !
ReplyDeleteFind another idea for tomorrow.
PS: Sparky, don't be gay :)
Apple is using Embedded C++ for I/O-Kit, which
ReplyDeleteI like very much.
You mean that C++ is slower than C and therefore it cannot be used to code an OS?
ReplyDeleteIf so, I disagree. C++ may introduce a constant performance penalty (depending on how you use it) over similar code done in C. This can be easily mitigated with faster machines (which could not be if the penalty was, e.g., exponential).
Using C++ appropriately can make the code far more readable and better structured than what might be done in C. (Of course, due to C++'s complexity, you can also write messy code very easily.)
But, more importantly, C++ lets you code faster, much faster assuming that you have a good base class set (that allows managing collections and basic system resources, for example).
Of course, this is only my point of view ;-)