C versus C++

Hi Community !!!

whats the advantages by using C++ against C
unless using Classes in QNX4 and in Neutrino?.

Is there a difference between quickness or is it equal.

In whitch case I should use C++ and in whitch case I should use C

Thank You !!!

C tends to be faster than C++ in most cases, but as always, it depends on what you are writing. Advantages of C++ are basically that of object-orientation, OO is generally considered a good idea in large, complex applications. C however, is generally simpler and quicker, which makes it a good choice for real time applications, device drivers, stuff like that.

I’d say use whatever you are comfortable with, however C is much more popular on QNX than C++, so you’ll likely get more help with C related problems than C++ on forums like this.

Thank you thegman !!!

Well, a couple of the things (that aren’t related to classes) are:

  • templates
  • exceptions

You could write an entire book about that question, but fundamentally all that can be said is: “it depends”.

Personally, I would always use C++, unless there was a very specific reason why I can’t.

Rennie

Under QNX4, C code compile with the C++ compiler tends to be up to 10% slower.

That being said I would go with C++ unless speed is paramount.