OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 28, 2024 1:03 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: C or C++
PostPosted: Wed Nov 14, 2001 6:25 am 
is what way is C better than C++ ( in terms of OS programming ), and on the other hand how is C++ better than C??


Top
  
 
 Post subject: Re: C or C++
PostPosted: Wed Nov 14, 2001 11:04 pm 
Well, C is a very straightforward programming language, and it's possible to use it roughly as a glorified assembler if needed.

C++ has a lot of built in functionality that you might or might not want to use, but that adds a lot of complication in the context of standard library-less systems as most kernels.

I reccomend you have a look at the FAQ, it does a resonably good job of explaining how to use c++ for kernel development.
It basically boils down to having to explicitly telling the linker not to link with the c++ library and either staying away from dynamic allocation or defining your own.
Of course, you will not be able to use STL or similar libraries unless you include them.

So while using C++ might make for a cleaner design, it will also complicate matters a bit.


Top
  
 
 Post subject: Re: C or C++
PostPosted: Thu Nov 29, 2001 10:28 pm 
Hi,
IMHO, C++ is a bad choice for the kernel itself as the C code generated is much. I think you've got more control on the code that is generated when you write it in C.


Top
  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 36 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