C++用于无线传感器网络
类似于:为什么 RTOS 只用 C 编码 ,但是:
除了关于 C++ 的众多神话之外,为什么它不像 C/nesC 那样被广泛使用 (TinyOS< /a>) 无线传感器网络?了解 C++ 可用于使用 OMNeT++ 模拟无线传感器网络 很难不认为它也可以用在实时嵌入式系统中,就像C语言一样完成事件处理。
我不想引发一场 C++ 比 C 更好的激烈战争,但足够的证据表明整个 C 比 C++ 更快、更通用完全是一个神话。请看一下:
C 与 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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信以下问题的答案适用于此。
有吗为什么使用C而不是C++进行嵌入式开发?
I believe the answers to the following question apply here.
Is there any reason to use C instead of C++ for embedded development?