I think the problem is not the language standard per se, it&#x27;s the education and historically sloppy compilers. It&#x27;s a bit like W3Schools for javascript teaching everybody all the worst practices, that&#x27;s not a problem with the javascript language itself.<p>I mean really, what are the most common cases of undefined behavior that cause real problems in the world? (Reading past array bounds or trying to dereference uninitialized variables are such obvious <i>errors</i> that i don&#x27;t categorize them as &#x27;unexpected undefined behavior&#x27;, the later is caught by most compilers and static analyzers today anyway. Though i agree having the length known in arrays would greatly help.)<p>Any time i see some raging blog post about how undefined behavior ruined someones day it&#x27;s 99% of the time because they one way or another were trying to cast a pointer of one type to a pointer of another type, like thinking they could read the first 16 bits of an int* by casting it to a short* first. The root cause of this is because people think that pointers are addresses to a sequential grid of NAND-gates on your DDR4-stick, when they in fact are <i>abstract</i> references to a variable that can carry a value. This comes from school, where the way teachers show you how pointers work is exactly like that. Tutorials on the internet also say that you can do smart tricks with pointers just to teach you and then people think that&#x27;s how you should do it. When compiling in debug-mode this is how the memory is usually aligned so things still work anyway.<p>Historically compilers didn&#x27;t warn about this either and things still worked so many people got used to writing things this way and today those people are the &quot;experienced C gurus&quot; in companies that pass down this misbehavior to their younger peers.<p>Overflow on signed arithmetic is another of the common pitfalls but that&#x27;s life if you code for embedded, the alternative solution that &quot;just works&quot; would be to do all arithmetic in a BigInt type as python but that clearly isn&#x27;t viable on embedded, or to do everything in floating point but that has its own pitfalls.