UHG
Search
Close this search box.

Why is C++ Not Used in AI Research?

The introduction of new and modern languages has made C++ superfluous. Its little use in AI research hasn’t helped either.

Share

Why C++ Not Used In AI Research
Table of Content
Listen to this story

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.

📣 Want to advertise in AIM? Book here

Related Posts
19th - 23rd Aug 2024
Generative AI Crash Course for Non-Techies
Upcoming Large format Conference
Sep 25-27, 2024 | 📍 Bangalore, India
Download the easiest way to
stay informed

Subscribe to The Belamy: Our Weekly Newsletter

Biggest AI stories, delivered to your inbox every week.
Flagship Events
Rising 2024 | DE&I in Tech Summit
April 4 and 5, 2024 | 📍 Hilton Convention Center, Manyata Tech Park, Bangalore
Data Engineering Summit 2024
May 30 and 31, 2024 | 📍 Bangalore, India
MachineCon USA 2024
26 July 2024 | 583 Park Avenue, New York
MachineCon GCC Summit 2024
June 28 2024 | 📍Bangalore, India
Cypher USA 2024
Nov 21-22 2024 | 📍Santa Clara Convention Center, California, USA
Cypher India 2024
September 25-27, 2024 | 📍Bangalore, India
discord icon
AI Forum for India
Our Discord Community for AI Ecosystem, In collaboration with NVIDIA.