Can somebone please TELL MY WHY I SHOULD ***NOT*** USE C++ FOR KERNEL DEVELOPMENT . what are the pros and cons of it?
I have a C kernel up and running , it is for i586+, has features such as user mode tasks with preemptive multitasking, rudimentary device driver support, paging etc. and some basic obvious things.
I know C++ language well. I won't be using exceptions. i also have coded basic functions to support some other C++ features such as global object construction etc., and the code for operators new/delete won't be much bigger [i have kmalloc()]. the test kernel with iostream and cout-cin works well.
Thanx.
[edit by Candy]Don't shout in your topic title[/edit]
Why not use C++?
Re:WHY NOT USE C++
I don't see why not, C++ operates at around the same level as C except that a lot of it's OOP features require runtime support. I'm writing a bootloader in C++ and have prototyped several kernels in C++, as long as you avoid things like virtuals and exceptions you shouldn't have much trouble.
Re:WHY NOT USE C++
Thankx
then how do i go for it. can you please draw an example overview of the design? i had thought of one, but was not satisfactory.
then how do i go for it. can you please draw an example overview of the design? i had thought of one, but was not satisfactory.
Re:WHY NOT USE C++
Example design of a kernel? The structure is up to you but I like to divide the features into logical units and group them in namespaces, I rarely use classes to avoid the runtime support problems but you can use classes if you want just don't put in any virtual functions [If you want virtuals you'll have to look up the hidden dependencies in libsupc++ and implement them].
I'm currently working on the bootloader though, my kernel's design will depend on what features the loader provides.
I'm currently working on the bootloader though, my kernel's design will depend on what features the loader provides.
Re:WHY NOT USE C++
http://www.osdev.org/osfaq2/prashant wrote: Thankx
then how do i go for it. can you please draw an example overview of the design? i had thought of one, but was not satisfactory.
Only Human
Re:WHY NOT USE C++
do virtual calls really need something extra? i had written a test kernel with an abstract base class and 3 derived classes, and the vcalls worked very well , i had to fake the __cxa_pure_virtual for the gcc.
Re:WHY NOT USE C++
I've just had problems with dependencies on _Z... things that pop up occasionally, sometimes they do sometimes they don't and I just haven't bothered to look up how to resolve them yet.