类似于:Why are RTOS only coded in C,但是:
除了关于C++的无数神话外,为什么WSN没有使用C / nesC(TinyOS)?知道C++可以用于Simulating Wireless Sensor Networks with OMNeT++,很难不认为它也可以在实时嵌入式系统中使用,因为C可以完成事件处理。
我不希望开始C++胜过C火焰 war ,但是有充分的证据表明,整个C比C++更快,更通用,完全是神话。看一眼:
C vs. C++突出强调以下几点的论文:
- 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
最佳答案
我相信以下问题的答案适用于此。
Is there any reason to use C instead of C++ for embedded development?