Jump to content

C or C++? Which do you choose?


Adrian

Recommended Posts

  • 3 months later...
Originally posted by Syntax

Well C++ is known to be bad for kernel programming, plain C is what I've mostly seen. I think Linus Torvalds posted something about the cons of programming the kernel with C++.

Linus Torvalds is somewhat of a dweeb. I've written a small x86 kernel in C++, and I think it's a very suitable language. The only disadvantage of using C++ in a kernel as opposed to in user-level is the lack of runtime type information in the lowest parts, which makes using virtual functions and the like impossible. There's no reason why you can't add RTTI in those layers, though, and use virtual functions all you like in the layers above.

 

Note that I'm not a very big fan of C++; in fact, I dislike it very enthusiastically. I'd choose C over it any day, but then again, kernel programming is the only realm where C/C++ is viable, so it doesn't matter much.

Link to comment
Share on other sites

  • 1 month later...
Guest shocker147

I had to program in C for years before we could program in C++. I just appreciate how C++ can make many things easier for the programmer compared to C.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.