Using C++ for os development
Using C++ for os development
just a small question.
I'm looking to develop a OS in c++ but I don't know where to start and was wondering if there are some links to os development sites in c++.
thx.
I'm looking to develop a OS in c++ but I don't know where to start and was wondering if there are some links to os development sites in c++.
thx.
Re:Using C++ for os development
The FAQ has several pages and links on the subject.guest wrote: just a small question.
I'm looking to develop a OS in c++ but I don't know where to start and was wondering if there are some links to os development sites in c++.
thx.
Every good solution is obvious once you've found it.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Using C++ for os development
you may check invalidsoftware.net, it especially focus at such an attemp ...
Re:Using C++ for os development
I'm working on a c++ kernel too. The c++ ABI is quite complicated to implement efficiently.
Here is an interessant work for c++ in the linux kernel:
http://netlab.ru.is/exception/LinuxCXX.shtml
INeo
Here is an interessant work for c++ in the linux kernel:
http://netlab.ru.is/exception/LinuxCXX.shtml
INeo
Re:Using C++ for os development
That looks like exactly what our FAQ is still missing - what to do to get exceptions and RTTI to run! Many thanks for that!
Every good solution is obvious once you've found it.
Re:Using C++ for os development
I guess ! I was digging the c++ ABI to do the same... now we have a reference that even has the same goal: using c++ in a kernel (ie must be efficient).Solar wrote: That looks like exactly what our FAQ is still missing - what to do to get exceptions and RTTI to run! Many thanks for that!
I read the patch, it's interesting but lacks documentation. I think I'll have completed my implementation in 6 months.
If anyone is working on it too, don't hesitate to give me these precious pointers you find on your way
INeo
Re:Using C++ for os development
I'm just wondering if thats a good idea. Linus himself said its not!
http://kerneltrap.org/node/view/2067
"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel.
3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
http://kerneltrap.org/node/view/2067
"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel.
3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
Re:Using C++ for os development
Linus is a great man for what he did with the linux kernel. However it's not really someone I blindly trustAnonymouse wrote: I'm just wondering if thats a good idea. Linus himself said its not!
How could you believe someone that insults people intelligence ? Do you think you are more stupid because you do things differently from others ?Anonymouse wrote:http://kerneltrap.org/node/view/2067
"In fact, in Linux we did try C++ once already, back in 1992. It sucks. Trust me - writing kernel code in C++ is a BLOODY STUPID IDEA.
It's true that the C++ ABI has changed a lot. C++ compiler have changed, and I believe they are now more stable.Anonymouse wrote:"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
Why is it broken ? It depends on your point of view !Anonymouse wrote:1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
If you look from a kernel point of view, and if you intend to use exceptions, all you have to do is to take it into account while implementing the C++ ABI: it's up to you ! If it's not efficient, it's your fault, it's not a C++ problem !
Does he know C++ ? Nothing is hidden from the programmer. This point is the same for C, the only difference is you use new and delete operators instead of malloc and free... I'll add that it's even more clean because when you destroy an object you destroy it properly because of the destructor.Anonymouse wrote:2) any compiler or language that likes to hide things like memory allocations behind your back just isn't a good choice for a kernel.
Obviously you can ! That's the reason why it'sAnonymouse wrote:3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
to claim that you cannot use C++ to develop a kernel. You could do the same in C, but the code will not be as readable as the C++ one. Why should you stick to C when there are alternatives ? All is a matter of taste. It depends on what you want to do.STUPID
The only thing I lack in C++ is library compatibility, but It's not a problem for coding a kernel, and I'm sure it will be solved in a few time
So go one, and create new thing, use your own path. You may be wrong, but you will learn. So do I.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Using C++ for os development
The guys on the Linux Kernel Mailing List seems to be especially quick to claim that C++ is to be kept out of kernel space. That's their problem, after all.
Yes, doing a kernel in C++ is somehow much more complicated at the very start, but that doesn't seem enough to prevent some geek that loves C++ enough to use it, imho ...
I'd be very happy if we could avoid the traditional (and pointless) debate about whether they're right or wrong ...
Yes, doing a kernel in C++ is somehow much more complicated at the very start, but that doesn't seem enough to prevent some geek that loves C++ enough to use it, imho ...
I'd be very happy if we could avoid the traditional (and pointless) debate about whether they're right or wrong ...
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Using C++ for os development
If linus torvalds,despite him being famous and the Initiator of the Linux Movement - and the granda for most of us regarding dedicatedness concerning kernel hacking, told this to me, I would have told him the following:
Lad, grow up. Learn to discuss without calling names. Then come back.
Such a sentence I"d say to anyone directing insulting and respectless words towards me. Having another opinion is ok. Calling names just for the sake of it is bad. (I don't allow my hankering for a juicy word to take place here)
BTW: has any one noticed that Linus Statement has got any responses in this thread? Oeha, I say, and satchmo takes his trumpet one two three...
BTWII: C or C++ is just a matter of choice and experience I daresay.
Lad, grow up. Learn to discuss without calling names. Then come back.
Such a sentence I"d say to anyone directing insulting and respectless words towards me. Having another opinion is ok. Calling names just for the sake of it is bad. (I don't allow my hankering for a juicy word to take place here)
BTW: has any one noticed that Linus Statement has got any responses in this thread? Oeha, I say, and satchmo takes his trumpet one two three...
BTWII: C or C++ is just a matter of choice and experience I daresay.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Using C++ for os development
Well, im just going to cower and use C for now. maybe later rewrite in c++ to see what will happen (or even switch the working kernel over) proformance wise, etc.
Linus _has_ been hacking for many-a-year, so he's got the know how...
Linus _has_ been hacking for many-a-year, so he's got the know how...
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Using C++ for os development
Being a kernel hacker for but_so_many_years does not entitle him to the usage of insulting language. Period.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Using C++ for os development
I think that coding a kernel with C++ is not a very good idea since the ame of using such languages is reusable modules, but kernels doesn't need such features
in my opinion, the basis of the kernel must be written with C (mm, scheduler, int handlers ...) then we can extend the kernel using C++, to write drivers or filesystem supports.... but ... this is only my opinion
in my opinion, the basis of the kernel must be written with C (mm, scheduler, int handlers ...) then we can extend the kernel using C++, to write drivers or filesystem supports.... but ... this is only my opinion
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re:Using C++ for os development
I had a chance to talk with Scott Meyers last week (author of some C++ books for those more C-inclined). I told him I was writing a kernel in C and he looked at me like I was nuts.
The reason I'm using C is that I'm more interested in learning about kernel implementation details rather than C++ ABI implementation details. However, I'm still designing everything in a very OO fashion (even using UML... perhaps I'm just warped!). There are many features of C++ that I can't see myself using very much in the kernel (inheritance, virtual functions, etc.), but just having basic object syntax would be kind of nice. Maybe in version 2....
The reason I'm using C is that I'm more interested in learning about kernel implementation details rather than C++ ABI implementation details. However, I'm still designing everything in a very OO fashion (even using UML... perhaps I'm just warped!). There are many features of C++ that I can't see myself using very much in the kernel (inheritance, virtual functions, etc.), but just having basic object syntax would be kind of nice. Maybe in version 2....
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager