- Hands-On Embedded Programming with C++17
- Maya Posch
- 251字
- 2021-08-20 10:20:45
C++ language features
We previously took a look at the explicit nature of changes to data and system state that defines imperative programming as opposed to declarative programming, where instead of manipulating data in a loop such functionality could be declared as mapping an operator to some data, thus spelling out the functionality, not the specific order of operations. But why should programming languages necessarily be a choice between imperative and declarative paradigms?
In fact, one of the main distinguishing features of C++ is its multi-paradigm nature making use of both imperative and declarative paradigms. With the inclusion of object-oriented, generic, and functional programming into C++ in addition to C's procedural programming, it would seem natural to assume that this would all have to come at a cost, whether in terms of higher CPU usage or more RAM and/or ROM consumed.
However, as we learned earlier in this chapter, C++ language features are ultimately built upon the C language, and as such there should in turn be little or no overhead relative to implementing a similar constructs in plain C. To resolve this conundrum and to investigate the validity of the low-overhead hypothesis, we'll now take a detailed look at a number of C++ language features, and how they are ultimately implemented, with their corresponding cost in binary and memory size.
Some of the examples that focus specifically on C++ as a low-level embedded language are taken with permission from Rud Merriam's Code Craft series, as published on Hackaday: https://hackaday.io/project/8238-embedding-c.
- 深入理解Spring Cloud與實戰(zhàn)
- BeagleBone By Example
- 3ds Max Speed Modeling for 3D Artists
- Svelte 3 Up and Running
- R Deep Learning Essentials
- 計算機組裝維修與外設(shè)配置(高等職業(yè)院校教改示范教材·計算機系列)
- 筆記本電腦使用、維護與故障排除從入門到精通(第5版)
- 單片機開發(fā)與典型工程項目實例詳解
- RISC-V處理器與片上系統(tǒng)設(shè)計:基于FPGA與云平臺的實驗教程
- Spring Cloud微服務(wù)和分布式系統(tǒng)實踐
- 電腦橫機使用與維修
- 筆記本電腦芯片級維修從入門到精通(圖解版)
- Arduino項目案例:游戲開發(fā)
- Advanced Machine Learning with R
- 微型計算機原理及應用教程(第2版)