4 ms·
you do in my opinion, i don't understand why UB is so foundamental to C, in this case woudn't a compiler warnig or error be better?
by kiriakasis 9y ago
you do in my opinion, i don't understand why UB is so foundamental to C, in this case woudn't a compiler warnig or error be better?
- dom0 9y agoA lot of UB is runtime behaviour that would be difficult to statically analyse. UBSan (-fsanitize=undefined -fno-sanitize-recover) does a good job of detecting it at runtime. A bunch of UB is of course static, and often comes with compiler warnings. Some UB doesn't have compiler warnings, but is found by linters and analysers (such as clang static analyzer).
- wfunction 9y agoUB is pretty damn fundamental to C. Not many people realize it though. It's the fundamental difference between C and C++ compared to Python or C# or Java or Rust or whatever.