Before being able to use some features of C++ for kernel development, some work has to be done. For example, to be able to use classes effectively, routines must be made to call constructors and destructors property.
Other features that aren't needed can be disabled, for example RTTI (run-time type information).
Is any additional work needed to be done to be able to use templates, assuming that classes are working properly?
I think the main problem is writing the runtime code to walk the stack for exception handling. The kernel and the compiler need to agree on details of the calling convention, like the structure of the stack, and how destructors get registered, discovered and invoked.
And if you want to support exception handling, then you (essentially) have to enable RTTI, because the C++ catch semantics do dynamic type matching.
Another problem might be memory allocation. new maps to malloc quite naturally, but if you have a weird kmalloc with extra parameters (like Linux does) then it might require some thought.
Templates, and placement of calls to constructors and destructors (aside from exception handling) are dealt with entirely by the compiler, so should "just work."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With