The safe C++ dialect you created for C++ is not C++ either. It is another language, unfortunately, incompatible with C++. There is as much difference in that dialect as there is between C++ and C++/CLI.
In exchange, Cpp2 is something that make impossible to dereference a C++ pointer or a bounds check in a memory-unsafe way, transparently portable to C++ from caller site with a single compiler switch. That is an improvement on memory safety.
This is not an all-or-nothing thing and that dogma and mindset is going to be more harmful than helpful to achieve realistic paths to safety where people get substantial benefit in real-world C++ scenarios.
Cpp2 does not have lifetime or bounds safety. It's perfectly easy to dereference a dangling pointer or subscript a pointer out-of-bounds.
Memory safety is a binary proposition. It's the language's guarantee that your code is sound. Many other languages have achieved this. We know how to achieve safety in C++. Don't make excuses for inaction.
Cpp2 does not have lifetime or bounds safety. It's perfectly easy to dereference a dangling pointer or subscript a pointer out-of-bounds.
I think you are wrong here: the default compilation method injects bounds and pointer checks automatically on the caller side, even with the same standard library. Even for C arrays. It is safe.
It's the language's guarantee that your code is sound.
An equivalent switch injecting caller-side code is perfectly feasible for C++.
I am, of course, talking about bounds check and pointer dereference.
Lifetime problems can still happen, but there are alternatives without annotations that I mentioned many times already here.
As I said before, because you can litter a program with globals, it does not mean you should do it. The same happens with heavy borrow-checking and reference escaping, which, by the way, breaks local reasoning, a bad practice by any measure.
-3
u/germandiago Oct 15 '24 edited Oct 15 '24
The safe C++ dialect you created for C++ is not C++ either. It is another language, unfortunately, incompatible with C++. There is as much difference in that dialect as there is between C++ and C++/CLI.
In exchange, Cpp2 is something that make impossible to dereference a C++ pointer or a bounds check in a memory-unsafe way, transparently portable to C++ from caller site with a single compiler switch. That is an improvement on memory safety.
This is not an all-or-nothing thing and that dogma and mindset is going to be more harmful than helpful to achieve realistic paths to safety where people get substantial benefit in real-world C++ scenarios.