官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 昔阳县| 峨眉山市| 昌邑市| 嘉祥县| 都兰县| 天长市| 三亚市| 营山县| 宁河县| 荣昌县| 右玉县| 葫芦岛市| 嵊州市| 新干县| 马山县| 同心县| 新泰市| 天柱县| 鹤壁市| 天台县| 延川县| 通化市| 华宁县| 吉首市| 含山县| 昌都县| 绥芬河市| 河东区| 原阳县| 白玉县| 宝坻区| 邢台县| 宜良县| 怀来县| 嘉祥县| 耒阳市| 临邑县| 伊春市| 应城市| 松滋市| 义马市|