In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "should C++ replace C language in embedded programming?" the content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought. Let's study and learn "do you want to use C++ instead of C language in embedded programming?"
1. Preface
For decades, embedded software engineers have been debating whether C++ should be used instead of C language for development work. According to the market research conducted by IEEE and github in 2019, most of the software provided by microcontroller manufacturers is written in C language.
In fact, 56% of embedded software is written in C language. However, C++ has become more and more popular, and about 23% of new embedded software projects are written in C++. C language has been developed for almost 50 years, and now is the best opportunity for the transition from C language to C++ language to become the mainstream language of embedded development.
For embedded programmers who are used to developing in C language, there are some misunderstandings and prejudices against C++ language.
(1) the implementation of C++ is inefficient
(2) the object code generated by C++ is large
(3) C++ programming is very troublesome.
(4) there is no concept of pointer, and the operation of the underlying register is very complicated.
I think embedded engineers should learn C++ language to develop embedded programs. C++ programming language is also widely used in ARM's Mbed OS. Refuse to accept new things, afraid to overthrow the old thinking, rest on their laurels, this is terrible.
When embedded engineers convert from C to C++, they not only need to learn a new language, but actually learn a programming mode of thinking. Just like learning embedding from bare metal code, and then slowly learning RTOS or Linux, this is not only a contact with new things, but also a change of way of thinking. Learning C++ needs to understand the object-oriented way of thinking, as well as a variety of design patterns. Thus, in the process of using embedded development, these things will be used.
The following three aspects to talk about embedded development in the use of C++ programming benefits.
two。 Introduce new design patterns
To some extent, C language provides developers with a series of encapsulated functions that can be used, as well as very basic polymorphic functions. However, C language is actually a process-oriented language, which makes composition and inheritance very difficult. All these will affect the stability of the overall design architecture. Unless you are a C language foundation and have done a lot of projects, you can have a good grasp of the design of C language architecture. General design will make the reuse and extension of software functions extremely complex.
C++ provides developers with a real object-oriented design pattern, this abstract module, making the program less coupled. Because of the pin design pattern, it is also very convenient to transplant the project project, which makes the reusability of the software better, which can speed up the product development speed, shorten the research and development cycle, and reduce the workload.
3.Craft + is a language that is constantly updated
In today's complex development environment, with the development of the times, more and more advanced hardware solutions are proposed, so better software and language solutions are needed, which means that the programming language must be constantly updated. continue to provide developers with the best and most advanced tools.
Let's take a look at the change in the version of CumberCandle +:
C language version change:
Year C standard general alias 1972Birth C--1978K&R Cmuri 1989-1990ISO/IEC 9899:1990C89C901995ISO/IEC 9899/AMD1:1995AMD1C951999ISO/IEC 9899:1999C99-2011ISO/IEC 9899:2011C11-2018ISO/IEC 989999VOF 2018C18-
C++ language version change:
Year C standard general alias 1978---1998ISO/IEC 14882:1998C++98-2003ISO/IEC 14882:2003C++03-2011ISO/IEC 14882:2011C++11C++0x2014ISO/IEC 14882:2014C++14C++1y2017ISO/IEC 14882:2017C++17C++1z2020-C++20C++2a
The update of C++ language is different from C language in that C++ not only fixes some errors, but also adds some new features and tools. And in terms of update frequency, C++ updates have recently been updated about every three years. This can easily adapt to the new system and hardware platform.
4.Craft + has richer features.
In the process of embedded programming, C++ has more features than using C language. Today's compilers are very friendly to programming language optimization.
C++ also supports C language operation, so this way is also very easy to transition from C to C++.
Support for exception handling and error catching, which is very efficient in embedded development
Support for virtual functions
Support dynamic type conversion, multiple inheritance, polymorphism and so on.
Although it will increase some resources compared to C language, but for the current embedded development, more KB is no longer a problem, embedded programming using C++ can easily achieve the function. Greatly improve the efficiency of development.
Thank you for reading, the above is the content of "should C++ replace C language in embedded programming?" after the study of this article, I believe you have a deeper understanding of the problem that embedded programming should use C++ instead of C language. the specific use also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.