views:

250

answers:

1

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

A: 

I believe the answers to the following question apply here.

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

jschmier