Rust is Killing C++? You might be right

The video discusses the challenges C++ faces due to memory safety issues, leading major tech companies like Microsoft and Google to adopt Rust for security-critical components. While C++ is not inherently unsafe, the proposal of “C++ profiles” to enforce stricter memory management practices raises concerns about performance and developer adoption, leaving the language’s future uncertain as new projects increasingly favor alternatives like Rust.

The video discusses the current challenges facing C++ as a programming language, particularly in light of its memory safety issues. Over the past few years, there has been a growing trend among developers and organizations to avoid using C++ for new projects due to its vulnerabilities related to memory management, such as buffer overflows and out-of-bounds errors. This has led to calls from C++ creator Bjarne Stroustrup for a defense of the language, as it faces criticism from cybersecurity experts and government agencies for its shortcomings in memory safety.

Major tech companies like Microsoft and Google are increasingly turning to Rust, a language designed with memory safety in mind, to replace certain components traditionally written in C++. Microsoft has reported that a significant percentage of Windows security vulnerabilities stem from memory safety issues in C and C++, prompting them to rewrite parts of Windows in Rust. Similarly, Google has adopted Rust for specific security-critical components in Android, highlighting a trend where C++ is being replaced in areas where security is a top concern.

Despite these shifts, the video emphasizes that C++ is not inherently unsafe; rather, the problems arise from improper usage. Stroustrup himself acknowledges that skilled developers can manage memory effectively in C++. To address the language’s safety issues, he has proposed the concept of “C++ profiles,” which would introduce guidelines or safety modes to enforce stricter memory management practices. However, this proposal is still in its early stages and raises concerns about potential impacts on performance and flexibility, which are key advantages of C++.

The introduction of C++ profiles could lead to restrictions on certain language features and the enforcement of safer coding practices, such as the use of smart pointers. However, there is skepticism about whether developers will adopt these new rules, especially given the vast amount of existing C++ code in production. Many developers may resist changing established practices, preferring to rely on existing tools and idioms that they are already familiar with, such as sanitizers and static analysis.

Ultimately, the video concludes that while C++ is not dying, its future may be uncertain, particularly regarding the number of new projects that will choose C++ over languages like Rust or Go. The ongoing debate about memory safety and the potential implementation of C++ profiles will shape the language’s evolution. The video invites viewers to share their thoughts on the matter, acknowledging that the situation is complex and that developers face a choice between adapting C++ to be safer or rewriting codebases in newer languages.