Both true and false: a Zen moment with C
It's crazy to me that we as C programmers are flying blind about when we invoke undefined behavior.  There is no blinking red light that warns us that something needs to be fixed, only strange and unexplainable behavior, or in some cases things just work fine because the undefined behavior happens to follow our expectations on some combination of platform and compiler.I keep wishing that there was a Valgrind-like tool that could detect and report undefined behavior.  It would have to be a dynamic, runtime tool, since many/most cases of undefined behavior cannot robustly detected statically.  But it would need to have more information at runtime about the original C program than Valgrind has; the assembly alone does not contain enough information to know if the source C program is invoking undefined behavior.I feel certain that if this tool existed, we would find scores of undefined behavior in all but the most conscientious C programs.