Can someone tell me why should I write my kernel in c++?
IMHO, I don't think C++ features such as classes, virtual functions or overloading are really needed in a kernel that initializes devices, setups memory management and load an init script.
I think C++ will do on a GUI system.
Why C++? (simple, idiot pool)
RE:Why C++? (simple, idiot pool)
I wouldn't write one in C++ myself. It isn't necessary to use it to get the system going. Whether you use it or not, is a personal preference. I personally find C to be more enjoyable than C++.
Yes, I am bias.
Yes, I am bias.
RE:Why C++? (simple, idiot pool)
Who told you that you SHOULD write your kernel in C++? Write it in whatever language you want. I prefer C++, but most people prefer plain old ordinary C.
By the way, such features such as classes, virtual functions, and overloading are NEVER really NEEDED. They just sometimes make things more convenient. For example, Personally though, I think it's more convenient to make the segment and gate descriptors classes (as well as a few other things in the kernel), because that makes sure that everything I do directly to the descriptors is all in the descriptor's methods, so I can find any mistakes MUCH more easily, and accidentally triple faulting will be much less common, because anytime I want to add or modify a descriptor, I use its methods instead of accessing it directly (YUCK!). And also it just makes sense to me to put related functions and data together into a class.
But everyone has their own preferences and style, so use whatever language you want. If you're like most people, you'll use plain C, because it's usually faster than C++, which is VERY good for a kernel. And if you do use C++, I would recommend that you don't use much inheritance and virtual functions if you use them at all.
By the way, such features such as classes, virtual functions, and overloading are NEVER really NEEDED. They just sometimes make things more convenient. For example, Personally though, I think it's more convenient to make the segment and gate descriptors classes (as well as a few other things in the kernel), because that makes sure that everything I do directly to the descriptors is all in the descriptor's methods, so I can find any mistakes MUCH more easily, and accidentally triple faulting will be much less common, because anytime I want to add or modify a descriptor, I use its methods instead of accessing it directly (YUCK!). And also it just makes sense to me to put related functions and data together into a class.
But everyone has their own preferences and style, so use whatever language you want. If you're like most people, you'll use plain C, because it's usually faster than C++, which is VERY good for a kernel. And if you do use C++, I would recommend that you don't use much inheritance and virtual functions if you use them at all.
RE:Why C++? (simple, idiot pool)
Hey, I need help on getting started with c++ I know that if you want to use c++ you have to make your own ways of dealing with new and destroy. So since you prefer writing your code in c++, xSadar, could you give me some pointers? Thanx ^_^
about new and delete
Yes, you have to overload new and delete if you're going to use them. And with C, you have to make your own malloc and free if you're going to use them. You can implement new and delete the same as you would malloc and free. I can give you some pointers if you tell me exactly what you want to know.