C++, a language that once shone brightly in the late twentieth century, was at the forefront of technological advancements, particularly in space exploration.
However, the emergence of newer, more visually appealing programming languages has shifted the spotlight away from C++.
At the AI+Data Summit 2024, researcher Yejin Choi said that researchers no longer use the language for AI research.
So, is C++ becoming a relic of the past?
Not Many Takers for AI
Despite its performance benefits and applications in various AI fields, such as speech recognition and computer vision, C++ is not the go-to language for AI development.
Its complexity and steep learning curve pose significant challenges. In contrast, Python’s user-friendly nature, extensive libraries, and large developer communities have propelled it to the forefront of AI programming.
Furthermore, C++ involves manual memory management, which can result in memory leaks and errors if not done correctly. This can be a considerable issue, particularly in large-scale AI programmes.
Microsoft emphasised this issue when it revealed that 70% of its updates in the previous 12 years were solutions for memory safety bugs, owing to Windows being mostly written in C and C++.
Google’s Chrome team released their own research, which revealed that memory management and safety flaws accounted for 70% of all major security bugs in the Chrome codebase. It is largely written in C++.
C++ also lacks built-in support for garbage collection, database access, and threading, which can necessitate extra effort to develop.
This can be particularly challenging in AI applications that require concurrent processing of data and tasks, such as deep learning and neural networks, real-time systems and embedded systems, data processing, and data science.
To overcome these limitations, developers often use third-party libraries and frameworks that provide threading support, such as OpenMP or Boost. However, these libraries can add complexity and overhead to the code, which may only be ideal for some applications.
C++ is Complicated
If you’ve visited a page like the C++ FAQ, you’ll understand how hard C++ can be. A comma in the wrong location might trigger hundreds of compile errors in earlier language versions.
The language has improved since C++ 11, with move semantics for transferring ownership and rvalue references, although there is still a high learning curve.
Developing a New Application
In recent years, we’ve witnessed the growth of various programming languages that potentially replace C++ for low-level system tasks, like Rust, which provides safety and security by eliminating buffer overflows and memory leaks (and is much easier to learn than C++).
When you compare the feature sets of modern languages like C++, Python, and Rust, the C language begins to look like a dinosaur! The C standard has not had new features introduced since 2011!
The 2017 standard release included technical corrections and clarifications, and the 2023 standard release did not rock the boat either.
Is C++ Losing Popularity?
Mark Russinovich, the chief technical officer of Microsoft Azure, has stated that developers should stop creating code in the programming languages C and C++ and that the industry should treat these computer languages as “deprecated”.
Ken Thompson, the Bell Labs researcher who designed the original Unix operating system, called it a “bad language” that is “way too big, way too complex” and “obviously built by a committee”.
GitHub compiled a list of the top ten most popular programming languages for machine learning. Python is the most popular language in machine learning repositories, with C++ being sixth.
According to Stack Overflow’s Developer Survey, beginners beginning to code are more likely to prefer Python over C++ than professionals.
While C++ provides advantages regarding speed and memory management, it also has disadvantages, such as a high learning curve and little community assistance.
Despite its challenges, C++ can be a powerful choice for machine learning applications that require high-performance processing and advanced memory management. The choice between C++ and Python for machine learning ultimately depends on the specific needs of the application and the developers’ skill level.