Safe C++: Language Extensions for Memory Safety
cppalliance.org
cppalliance.org
Many other "safe" C++ extensions just add basic bounds checking, and end at "we have smart pointers, what else do you want!?!??!?"
You won't be able to just slap `#pragma safe` on top of every file and have the problem solved. It does require use of different design patterns and structuring data in a way that works with borrowing.
auto get_x/(a, b)(const int^/a x, const int^/b y) -> const int^/a {
return x;
}
I like the new `choice` type. It looks like a c++ flavored rust enum. template<class T+, class E+>
choice expected {
[[safety::unwrap]] ok(T),
err(E);
T unwrap(self) noexcept safe {
return match(self) -> T {
.ok(t) => rel t;
.err(e) => panic("{} is err".format(expected~string));
};
}
};Perhaps LLVM supporting improved memory safety (e.g. for Swift) is helpful as well.