Safe C++ Extension Proposal Adds Memory Safety to C++
The C++ Alliance and engineer Sean Baxter have proposed a “Safe C++” extension, to be submitted to ISO, that introduces memory‑safety checks and a Safe Standard Library with secure data structures, responding to industry and government calls for safer code and echoing DARPA’s Rust‑translation efforts.
The C++ Alliance and engineer Sean Baxter have announced a "Safe C++" extension proposal aimed at adding memory‑safety features to the C++ language.
The proposal will be submitted to ISO for inclusion in the C++ standard and is intended to provide a Safe Standard Library with robust, memory‑safe data structures and algorithms.
Example code written with the Safe C++ extensions:
#feature on safety
#include
int main() safe {
std2::vector
vec { 11, 15, 20 };
for(int x : vec) {
// Ill‑formed. mutate of vec invalidates iterator in ranged‑for.
if(x % 2)
mut vec.push_back(x);
std2::println(x);
}
}Compiling the example produces safety‑checking diagnostics:
$ circle iterator.cxx -I ../libsafecxx/single-header/
safety: during safety checking of int main() safe
borrow checking: iterator.cxx:10:11
mut vec.push_back(x);
^
mutable borrow of vec between its shared borrow and its use
loan created at iterator.cxx:7:15
for(int x : vec) {
^Vinnie Falco, chair of the C++ Alliance, highlighted the proposal as a milestone for the ecosystem, stressing the growing need for secure code.
The initiative responds to criticism from industry leaders and government agencies (NSA, CISA, DARPA) demanding safer programming practices, and parallels efforts such as DARPA’s TRACTOR project that translates C code to Rust.
References: The Register , Safe C++ proposal , C++ Alliance blog .
Java Tech Enthusiast
Sharing computer programming language knowledge, focusing on Java fundamentals, data structures, related tools, Spring Cloud, IntelliJ IDEA... Book giveaways, red‑packet rewards and other perks await!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.