Page 1 of 2
Using C++ for os development
Posted: Fri Oct 22, 2004 4:42 pm
by guest
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.
Re:Using C++ for os development
Posted: Sat Oct 23, 2004 6:46 am
by Solar
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.
The
FAQ has several pages and links on the subject.
Re:Using C++ for os development
Posted: Mon Oct 25, 2004 1:44 am
by Pype.Clicker
you may check invalidsoftware.net, it especially focus at such an attemp ...
Re:Using C++ for os development
Posted: Wed Oct 27, 2004 9:40 am
by guest replies
thanks! this really helps
Re:Using C++ for os development
Posted: Thu Oct 28, 2004 2:37 am
by ineo
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
Re:Using C++ for os development
Posted: Thu Oct 28, 2004 4:06 am
by Solar
That looks like exactly what our FAQ is still missing - what to do to get exceptions and RTTI to run! Many thanks for that!
Re:Using C++ for os development
Posted: Thu Oct 28, 2004 10:27 am
by ineo
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 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).
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
Posted: Fri Oct 29, 2004 10:02 am
by Anonymouse
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++."
Re:Using C++ for os development
Posted: Fri Oct 29, 2004 12:59 pm
by ineo
Anonymouse wrote:
I'm just wondering if thats a good idea. Linus himself said its not!
Linus is a great man for what he did with the linux kernel. However it's not really someone I blindly trust
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.
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:"The fact is, C++ compilers are not trustworthy. They were even worse in 1992, but some fundamental facts haven't changed:
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:1) the whole C++ exception handling thing is fundamentally broken. It's _especially_ broken for kernels.
Why is it broken ? It depends on your point of view !
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 !
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.
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:3) you can write object-oriented code (useful for filesystems etc) in C, _without_ the crap that is C++."
Obviously you can ! That's the reason why it's
STUPID
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.
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.
Re:Using C++ for os development
Posted: Mon Nov 01, 2004 3:21 pm
by Pype.Clicker
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 ...
Re:Using C++ for os development
Posted: Tue Nov 02, 2004 9:22 am
by distantvoices
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.
Re:Using C++ for os development
Posted: Tue Nov 02, 2004 10:37 am
by guest
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...
Re:Using C++ for os development
Posted: Tue Nov 02, 2004 1:49 pm
by distantvoices
Being a kernel hacker for but_so_many_years does not entitle him to the usage of insulting language. Period.
Re:Using C++ for os development
Posted: Tue Nov 02, 2004 5:54 pm
by aladdin
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
Re:Using C++ for os development
Posted: Tue Nov 02, 2004 7:11 pm
by Colonel Kernel
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....