With 2020 coming to a close, and C++20 about to enter the market, now that the C++20 standard has been finalized, the question of Should I learn C++ in 2021 sounds like common sense. After all, the C++20 upgrade is said to be as groundbreaking as was the C++11 one that modernized the language, and rescued it from certain obscolescence, and the way of Cobol.
In this article I will try to present some facts about the current standing of C++, equipping you with the type of information needed for making an informed decision. Learning a new programming language, especially one as complex as C++, is a significant investment in time, so knowing if it will be useful, will be helpful.
The C++20 Standard
The changes that C++20 brings affect the core of C++, the STD library, and concurrency. (Where to get the official C++20 Standard PDF.)
Four Major Additions:
Concepts make sure that data used within a template fulfill a specified set of criteria, and verifies this at the beginning of the compilation process. As a result, the compiler can provide a short and meaningful error message if the defined requirement of a concept isn’t met.
Coroutines are generalized functions that can be suspended and resumed while keeping their state. Because of them, asynchronous programming in C++ may become mainstream. Coroutines are the basis for cooperative tasks, event loops, infinite data streams, or pipelines.
Ranges are new iterators for ranges such as vectors or lists. They support algorithms that can operate directly on the container, be evaluated lazily, and be composed.
Modules can be used to divide large blocks of code into logical parts. They result in faster compile times, make header files redundant, and can help rid of macro workarounds.
- Three-way comparison operator
- String literals as template parameters
- constexpr virtual functions
- Redefinition of volatile
- Designated initializers
- Various lambda improvements
- New standard attributes
consteval and constinit keywords
- Calendar and time-zone
- std::span as a view on a contiguous array
- constexpr containers such as std::string and std::vector
- std::atomic and std::atomic
- Floating point atomics
- Waiting on atomics
- Semaphores, latches, and barriers
Widely Known Technologies
The Google open source community has over 2,000 projects written in C or C++. Amazon (web commerce), Facebook (social media), Amadeus (airline ticketing), and Bloomberg (financial information) have critical parts written in C++. The android operating system is based on a modified version of the Linux kernel which is written in C and C++. So is MySQL which is the world’s most popular open source database software. Microsoft Office, Internet Explorer and Visual Studio are written in Visual C++. Companies like Lockheed Martin, Boeing, Northrop Grumman, etc., continuously advertize for embedded systems engineers with C++ skills. The need for code maintenance, extension and testing is enormous.
As has been mentioned, game development has been a major application area for C++. The language provides the ability to override performance bottlenecks such as memory allocation. It has the ability to structure data areas and manage memory. On top of that, it allows procedural programming for CPU intensive operations, making it quite fast, and it provides greater control over hardware. Many game engines are written in C++.
C++ is widely found in embedded systems. There is a massive demand for embedded systems engineers skilled in C++. Areas include automobile software (for example BMW), flight control software (for example Lockheed Martin), rocket control, marine engines (for example MAN ship engines), wind turbine control (for example Vesta), computer tomography and scientific instrumentation. Many advanced medical equipments, such as MRI machines, use C++ for scripting their software. C++ is also part of engineering applications, such as high-end CAD/CAM systems.
Teaching and Research
The C++ programming language is also widely used for teaching. It is a great option for teaching basic or advanced concepts. For example, type safety, resource management and invariants can be tought with C++. The 3 principles of object-oriented programming – Encapsulation, Inheritance, and Polymorphism – can be tought using C++, and so can classes templates and class hierarchies, and design patterns. It is also great for demonstrating advanced algorithms.
The number of programmers currently using C++ are millions. The real-world applications that were developed using C++ is in the hundreds of thousands. The lines of C++ source code currently deployed run in the billions. The numbers should convince anyone that C++ is one of the most useful programming languages to learn.
C++ is an object oriented programming language that was designed to be a powerful tool for building a wide variety of software applications. But this is not the main reason for learning C++ in 2021 and beyond. There is a large number of mission critical software written in C++ that can’t be replaced with another language that gives the same level of speed and control over system resources.
Frequently Asked Questions:
C++ is used in building operating systems, libraries, and other programming languages. It is extensively used in game development where there is a shortage of developers. Most companies in the automobile, aerospace and banking industries are looking for C++ developers. These are important reasons for learning C++ in 2021.
C++ continues to grow, and now that C++20 has been released, and that C++23 is in the making, the growth will likely become more rapid. New, more beautiful languages regularly show up, but even the most successful of them usually displace C++ out of some narrow niche, like web scripting. C++ is too powerful and too pervasive.
C++ has many features and a complicated syntax, while Python aims to imitate regular English. When it comes to their usage applications, Python is the leading language for machine learning and data analysis, and C++ is the best option for game development and large systems.
According to a 2019 survey, C++ was the fourth most popular programming language among employers. In conclusion, C++ will continue to remain popular and in high demand owing to its performance, reliability, and the wide variety of contexts in which it can be used. Besides, billions of lines of source code, much of it mission-critical, have been written in C++.