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.