OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Apr 16, 2024 7:46 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: How many C++ kernels?
PostPosted: Thu Jun 07, 2007 10:48 pm 
Offline
Member
Member

Joined: Mon Jun 04, 2007 6:29 pm
Posts: 40
Just out of curiosity how many people here have made there kernel in C++ instead of C?And if so how did it change the design of the kernel aposed to a C kernel?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 3:01 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
I have a c++ kernel which I have converted from my previous C kernel.

The memory management is pretty much C compiled with gpp. For the rest, I have switched over to classes, including a few global classes, such as 'Debug', 'Interrupt', 'DeviceManager'.

My hope is that when I am editing code and adding bits and pieces to the kernel, c++ will make a neater job of it.

The main reason I actually prefer my c++ kernel over my C kernel is that I like classes. They seem to make everything so much neater [ducksandruns]. *This is purely personal preference*[raisesheadoverparapet].

I have often heard the sentence 'C++ is not suitable for OS dev'. I have yet to find why that is. Once you have written some basic runtime support, there's no reason why C++ should be any less suitable for OS dev than C [ducksagain].

Oh - if you are interested in c++ kernels, I wouldn't start by reading any of my source code. Although my c++ kernel is (IMHO) less messy than my C kernel, it still needs a lot of work from the point of view of tree organisation, some standardisation of function names etc...

Cheers,
Adam


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 4:09 am 
Offline
Member
Member

Joined: Sun Jan 14, 2007 9:15 pm
Posts: 2566
Location: Sydney, Australia (I come from a land down under!)
I have to say, I agree with AJ.

Although, ATM I'm in the middle of converting from C to C++ so I'm not adding in classes unless they can really be used (my CLinkedList template class comes to mind).

I learnt C++ first, and find classes a natural way of creating a modular kernel. I'm going to get flamed for saying this, but it's so much easier to write linked list code in C++ than it is in C. In C you have to write complex wrappers and cross your fingers (while manipulating large amounts of data). As I said earlier, in C++ I use one template class everywhere I need a linked list (CLinkedList). It saves so much time and means I don't have to worry about dud implementations.

I still think writing a kernel in C is a good learning experience, and I wrote mine in C to start with. But I prefer the OOP features, so I use C++ now.

_________________
Pedigree | GitHub | Twitter | LinkedIn


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 11:07 am 
Offline
Member
Member

Joined: Sat Dec 30, 2006 2:31 pm
Posts: 729
Location: East Coast, USA
I started out with c and then quickly switched to c++ for a lot of the more complex stuff. I just love classes, especially virtual ones. Most of the really low level stuff like paging, memory management, and task switching is in c, but almost everything else is in c++ ie. the screen, file access and disk access are all in c++.

_________________
My OS: Fuzzy Logic


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 12:51 pm 
Offline
Member
Member

Joined: Sat May 12, 2007 8:24 am
Posts: 29
i am also writing my kernel in c++ becaus i find it "nicer" than C it's easier too.
Of course my memory manager is entirely writen in C but compiled by g++. no .c file in my code.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 2:48 pm 
Offline
Member
Member

Joined: Thu Jul 07, 2005 11:00 pm
Posts: 1546
I think it'd be pretty cool to make one in C++, though I just haven't...btw, anyone ever seen like a framework C++ kernel, that doesn't have anything, but comes with an OS freidnly crt, and what ever else would be needed?

_________________
My new NEW blag


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 3:11 pm 
Offline
Member
Member

Joined: Mon Jun 04, 2007 6:29 pm
Posts: 40
Thank you for all the the input :D
That put a lot of stuff I have heard about C++ kernels to rest.Some of the things I have read from the linux kernel developers and linus makes it seem like hell to make it in C++.And one thing I want AJ to ask is how much trouble is getting runtime support up on your OS?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 3:16 pm 
Offline
Member
Member
User avatar

Joined: Thu Jan 04, 2007 3:29 pm
Posts: 1466
Location: Noricum and Pannonia
Twitch wrote:
Thank you for all the the input :D
That put a lot of stuff I have heard about C++ kernels to rest.Some of the things I have read from the linux kernel developers and linus makes it seem like hell to make it in C++.And one thing I want to ask is how much trouble is getting runtime support up on your OS?

It's matter of preference. None is better than the other.

To me it's as if C is pure unaltered greatness, something like just plain tea.
Then, you have C++, which is tea with sugar, honey, milk, and other flavorings.

I prefer just plain tea. :)

_________________
C8H10N4O2 | #446691 | Trust the nodes.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 3:36 pm 
Offline
Member
Member

Joined: Thu Jul 07, 2005 11:00 pm
Posts: 1546
And then there is ASM that is like beer...you'll eventually kill yourself with it

my personal preference is Dr. Pepper...the best pop ever..(that's more like what C is, and hten that dieat cherry vanilla kind is C++...though that's not really very true..)

_________________
My new NEW blag


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 5:45 pm 
Offline
Member
Member

Joined: Tue Nov 07, 2006 7:37 am
Posts: 514
Location: York, England
Alboin wrote:
I prefer just plain tea. :)


Don't you even have milk? I couldn't stand that, would be far too overwhelming. Though i agree it is best without all the other extra's.

I've never been a fan of C++ because the linker support always made it seem really dirty like any amount of programming in it was a quick hack. I prefer to stick to plain old ASM.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 5:49 pm 
Offline
Member
Member

Joined: Mon Jun 04, 2007 6:29 pm
Posts: 40
hckr83 wrote:
And then there is ASM that is like beer...you'll eventually kill yourself with it

my personal preference is Dr. Pepper...the best pop ever..(that's more like what C is, and hten that dieat cherry vanilla kind is C++...though that's not really very true..)
LOL


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 6:58 pm 
Offline
Member
Member

Joined: Tue Nov 07, 2006 7:37 am
Posts: 514
Location: York, England
hckr83 wrote:
And then there is ASM that is like beer...you'll eventually kill yourself with it

my personal preference is Dr. Pepper...the best pop ever..(that's more like what C is, and hten that dieat cherry vanilla kind is C++...though that's not really very true..)


I reserve a word for times like this... a word that the times have driven me to use on about 20 occasions a day as a flip through Music Channels and Kids Viewing on TV... Dumbass

Despite the obvious childlike attitude of saying alcohol is some kind of murderer, which is on that same level as the numerous comments i hear about Marijuana being somekind of mind altering chemical beyond that of the other numerous mind altering chemicals humans intake everyday...

You also seem to be under the impression that Dr. Pepper is good for you. I assure you that beer in the same quantity as an okish amount of Dr Pepper is far better for you physically, mentally and in the sense of causing you to crash and kill someone. I hate to even think about the chemicals in Drinks like that and Coke... hence the reason i live off Water, Tea and the occasinal wine just in case they were right about it being good for your heart.

In conclusion... they are not good for you, also they are far more expensive than tap water.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 7:05 pm 
Offline
Member
Member
User avatar

Joined: Thu Jan 04, 2007 3:29 pm
Posts: 1466
Location: Noricum and Pannonia
Actually, from what I've read, alcohol in moderation extends your lifespan. Not so much with pop.

_________________
C8H10N4O2 | #446691 | Trust the nodes.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 7:44 pm 
Offline
Member
Member
User avatar

Joined: Tue Nov 09, 2004 12:00 am
Posts: 843
Location: United States
Tyler wrote:
hckr83 wrote:
And then there is ASM that is like beer...you'll eventually kill yourself with it

my personal preference is Dr. Pepper...the best pop ever..(that's more like what C is, and hten that dieat cherry vanilla kind is C++...though that's not really very true..)


I reserve a word for times like this... a word that the times have driven me to use on about 20 occasions a day as a flip through Music Channels and Kids Viewing on TV... Dumbass

Despite the obvious childlike attitude of saying alcohol is some kind of murderer, which is on that same level as the numerous comments i hear about Marijuana being somekind of mind altering chemical beyond that of the other numerous mind altering chemicals humans intake everyday...

You also seem to be under the impression that Dr. Pepper is good for you. I assure you that beer in the same quantity as an okish amount of Dr Pepper is far better for you physically, mentally and in the sense of causing you to crash and kill someone. I hate to even think about the chemicals in Drinks like that and Coke... hence the reason i live off Water, Tea and the occasinal wine just in case they were right about it being good for your heart.

In conclusion... they are not good for you, also they are far more expensive than tap water.


I got a word reserved for you too. I am not allowed to say it.

He was making a analogy:

Writing a entire operating system in assembler
Drinking nothing but beer.
Writing select parts of a operating system in assembler.
Drinking beer occasionally.

Even someone with a moderate amount of intelligence should have noticed that... :?

Quote:
..<snip>...which is on that same level as the numerous comments i hear about Marijuana being somekind of mind altering chemical beyond that of the other numerous mind altering chemicals humans intake everyday...


I would like for you to smoke a bunch of marijuana then come here in the forums and make a post so I can make fun of you for being a idiot.

Oh... wait. That might be the problem already. Huh?


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 09, 2007 2:07 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Twitch wrote:
And one thing I want AJ to ask is how much trouble is getting runtime support up on your OS?


I haven't got the full runtime support up and running yet - only the bits I find useful such as new and delete, support for global and static classes etc...

Have a read of http://www.osdev.org/wiki/C_PlusPlus which is quite helpful for that stuff.

Next on the list are exceptions, try...catch etc, but that is going to need heavier support from the kernel...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 32 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 93 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group