3 min Devops

C++ needs to be more secure, but it need not be replaced

C++ needs to be more secure, but it need not be replaced

Bjarne Stroustrup, the creator of C++, is urging the C++ community to defend the programming language against what he describes as serious outside attacks.

This call by Stroustrup comes amid growing criticism of C++ by cybersecurity experts, according to The Register. Some have accused the language of containing serious deficiencies due to its lack of memory safety. C++ uses manual memory management, which can lead to errors such as out-of-bounds reads and writes. These vulnerabilities are often the cause of serious security problems in large codebases.

In response to this criticism, the C/C++ community proposed several initiatives to make the language more secure. Examples include TrapC, FilC, Mini-C and Safe C++. Nevertheless, C++ remains under attack. This is mainly due to the emergence of languages like Rust, which are explicitly designed with memory security in mind.

Stroustrup expressed concern about these developments in a memo to the C++ standards committee. He calls for more visible and effective action to protect the language. He emphasized that C++ has always had a strong focus on security. According to him, these principles remain essential to the future of the language.

No radical switch

Pressure on C++ is coming from several quarters. The U.S. government agency CISA also recently announced that manufacturers must have a strategy to ensure memory safety by 2026. This is done to reduce the risks of memory usage in languages such as C++.

Stroustrup sees this as a major threat to the future of C++. He points to earlier statements by Microsoft, in which the company suggested that C/C++ should be replaced by Rust for new projects. Stroustrup rejects this suggestion, however, arguing that C++ has been improving for years and that an evolutionary approach is more effective than a radical shift to new languages.

Google has also recently indicated its intention to focus more on memory security than on modernizing C/C++. This reflects growing concerns within the industry about memory security and the need to make existing languages such as C++ more secure. Stroustrup himself continues to advocate improving C++ through existing tools and guidelines, rather than rejecting the language entirely.

Divisions over future C++

However, there is division within the community over what the future of C++ should look like. Robin Rowe, leader of the TrapC project, does not believe Stroustrup’s proposed Profiles framework will be ready in time, and has his own solution in the form of the TrapC compiler, which uses Memory Safe Pointers (MSP).

Other experts, such as David Chisnall, advocate a more incremental approach, gradually making C++ more secure without completely switching to new languages such as Rust. Chisnall points out that rewriting millions of lines of code carries risks, including the introduction of new bugs and security problems.

So it remains uncertain whether C++ can retain its place in a world increasingly focused on memory-safe programming languages. At the same time, it is not yet clear whether governments and companies will keep up the pressure to improve memory security in the long run. The future of C++ likely depends on how well the community succeeds in both improving the language and defending it against increasingly stiff competition from languages such as Rust.