Memory safety in C++ has become a hot topic recently, with growing attention on initiatives like TrapC and Safe C++ that aim to tackle the language’s memory safety challenges. However, Bjarne Stroustrup, the creator of C++, continues to advocate for the use of profiles as a critical tool for ensuring safety in the language. Stroustrup believes that profiles, which impose specific restrictions on features without altering the language’s core structure, are essential to address memory safety concerns while maintaining the language’s flexibility and power.
In a memo sent to members of the ISO C++ committee on February 7, Stroustrup underscored the importance of profiles in advancing C++’s safety capabilities. He pointed out that type safety and resource safety—memory safety in particular—have always been core objectives of C++ since its inception. Stroustrup emphasized that the introduction of profiles would not disrupt existing code, and would allow the language to evolve in a way that supports various forms of safety without restricting the addition of new features.
Stroustrup’s call to action is urgent, especially in light of increasing regulatory pressure on C++ and C from both the US and European Union. In February 2024, the White House voiced concerns about the memory safety issues in C++ and C, urging a move away from these languages in critical applications. Stroustrup warns that without taking immediate steps to incorporate profiles into the language, C++ could face a “painful decline.” His vision for C++ 26 includes the introduction of profiles, which he believes will protect the language’s future without alienating its existing user base.
Beyond Stroustrup’s advocacy, other projects have emerged to address C++’s memory safety issues. TrapC, for example, is a modified version of the C language designed to fix memory safety issues in both C and C++ through an extension compiler. Safe C++, on the other hand, aims to create a rigorously safe subset of C++. While these efforts are commendable, Stroustrup remains confident that profiles offer the best framework to address memory safety challenges while preserving the language’s fundamental strengths and flexibility.