2

Similar to: Why are RTOS only coded in C, but:

Besides the numerous myths about C++, why is it not used as much as C/nesC (TinyOS) for WSN? Knowing C++ can be used for Simulating Wireless Sensor Networks with OMNeT++ it is hard not to think that it can also be used in real-time embedded systems as C is to accomplish event handling.

I do NOT want to start a C++ is better than C flame war, but enough evidence suggests that the whole C is faster and more versatile than C++ is a total myth. Take a look at:

C vs. C++ paper where the following points were highlighted:

- C++ is slower than C: Wrong! Many C programs are valid C++ programs as well - and such a C program should run at identical speed when translated with either the C and with the C++ compiler.
- C++ specific features give overhead: Wrong! The so-called overhead introduced by certain C++ specific features (such as virtual function calls or exceptions), is comparable to the overhead you yourself would introduce should you choose to go thru the pain it would be to implement a similar feature in C.
- C++ is object oriented: Wrong! The C++ language contains some language extentions over C, that make object oriented programming and generic programming more convenient. C++ does not force object oriented design anywhere - it merely allows for it if the programmer deems OO feasible. C allows for object oriented programming as well, C++ only makes it simpler and less error prone.

Why are you still using C

Community
  • 1
  • 1
Israel ANY
  • 359
  • 6
  • 16
  • 5
    We've discussed this around here before, but I'm too lazy to run down the links. Partial answer: c compilers are easier to write and already exist for almost any chip you care to name; c is enough to get the job done; and there are plenty of c programmers about. – dmckee --- ex-moderator kitten Feb 16 '10 at 17:37
  • Good enough. I've run into this same reason previously, but took it lightly. – Israel ANY Feb 16 '10 at 19:27

1 Answers1

0

I believe the answers to the following question apply here.

Is there any reason to use C instead of C++ for embedded development?

Community
  • 1
  • 1
jschmier
  • 15,458
  • 6
  • 54
  • 72