3 ms·
All cases of undefined behavior in C/C++ language can be replaced either with explicit aborts of the program or explicit infinite loops. The result is a subset
by chromoblob 3y ago
All cases of undefined behavior in C/C++ language can be replaced either with explicit aborts of the program or explicit infinite loops. The result is a subset of C/C++; then anyone can write any C/C++ code, use it as the restricted variant and most exploits resulting from UB (those that cannot cope with the aborting or hangup) will be eliminated automatically. To implement or not such a safe mode is the sole decision of the compiler author. Blame the compiler for rigidity, not language for flexibility. Developing new languages from scratch and tools, libraries for them costs much time and effort and fractures the market of programmers and costs them time to learn it as well.
- Novosell 3y agoAnd yet so many of these corporate giants seem to be embracing Rust. Think they've all got it wrong? They just didn't try hard enough with C and C++?
- chromoblob 3y agoMy point is, the new language way may well be the "harder" one, for implementers or for users. It might be explained as a knee-jerk type reaction. Although new languages can still have some additional benefits of safety. Ways have tradeoffs and agents should evaluate them reasonably. I want to see a well-founded analysis of costs/benefits for the choice between Rust and safe variant of C/C++ or similar choice.