| ▲ | stevenhuang 3 hours ago | |
I agree. I meant to elaborate more on how to think of UB. For most C software on x86_64, UB is "fine" with very strong bunny ears. But it is preferable for one to, shall we say, write UB intentionally rather than accidentally and unknowingly. Having an awareness of all the minefields lends for more respect for the dangers of C code, it makes one question literally everything, and that would hopefully result in more correct code, more often. On that note, on some RISC-V cores unaligned access can turn a single load into hundreds of instructions. I think the problem is just that C is under specified for what we expect a language to provide in the modern age. It is still a great language, but the edges are sharp. | ||