Page 2 of 2
Re:Perl for OS Development?
Posted: Wed Sep 24, 2003 11:27 am
by sanders
I've moved my OS project to C++ (i'm finding C++ easier).
What are your opinions on using C++ for OS development. BeOS was written in C++ (as i'm sure you are all aware) and it's probably the best OS i ever found (based on the fact it runs faster than linux and win98 on my comp and with better graphics).
Your thoughts???
Martin Sanders
Software Developer
www.publiclinux.net
Re:Perl for OS Development?
Posted: Thu Sep 25, 2003 12:07 am
by Solar
The language used is only marginally related to the quality of the OS.
I'm writing my kernel in C++, too. It has some advantages, but:
* you have to learn C anyway;
* you have to implement all you need for C support anyway;
* you have to know the gory details of C anyway.
C++ is, as the name implies, not a language in its own, but a "C plus some more stuff".
Add to this that virtually all the docs, tutorials, and how-to's you'll find assume you are using C, using C++ adds much complexity to your project.
Re:Perl for OS Development?
Posted: Thu Sep 25, 2003 11:04 am
by sanders
Interesting, i'll probably mix-n-match and use C++ for whenever possible, and C when necessary!
There is something comforting about C++ that I don't feel when using C.
C++ almost feels i'm using Perl.
Re:Perl for OS Development?
Posted: Fri Sep 26, 2003 12:26 am
by Solar
I fear I haven't made myself clear.
C++ is a superset of C. If you are using C++, you are automatically using C, too. Everything that's C++ is build on top of C. Any well-written C programm should - with minimal adjustments - compile in a C++ compiler just as well.
If you go to the extra effort of providing a C++ environment for your OS kernel, you don't have to "mix-n-match" anything.
The thing is, you have to learn C and C++, and you have to impement the environment for C and C++. I'm rather experienced with C++, and I still find it to be very hard to implement the C++ environment.
Re:Perl for OS Development?
Posted: Fri Sep 26, 2003 11:25 am
by sanders
Hmmm odd, my C++ book (Sams teach yourself C++ for Linux in 21 days) warns against learning C and says "not only is it uneccessary to learn C first, it may be advantageous not to do so".
Re:Perl for OS Development?
Posted: Fri Sep 26, 2003 4:29 pm
by bkilgore
I think their point is that, by learning C++ you learn all of the C syntax as well, and if you try to learn C first, then when you go to learn the new C++ stuff you might be confused because there are ways you learned to do things in C that you can do differently in C++.
But by learning C++ you basically automatically learn C, you just wouldn't know which stuff comes from C and which is new to C++.
Re:Perl for OS Development?
Posted: Sat Sep 27, 2003 1:15 pm
by Solar
Not quite. The book is, basically, correct. There are some things you are "forced" to do in C, which are completely unneccessary in C++. You use vectors instead of arrays, you use <string> instead of char[], you use exceptions instead of setjmp / longjmp, you are using new() instead of malloc().
But we are not speaking about merely using C++. We are speaking about enabling the C++ environment. And this environment, by definition of the standard, includes a complete C environment. Even if you don't use arrays, char[], setjmp / longjmp and malloc(), you still have to enable them, in addition to vectors, <string>, exceptions and new().
Re:Perl for OS Development?
Posted: Sat Sep 27, 2003 2:47 pm
by sanders
Oh ok, Cool