3 ms·
> ... and those posts have instilled the fear of god in me. But why? Yeah, hitting UB can be a terrifying idea but rarely happens in practice. In two decades
by exDM69 10y ago
> ... and those posts have instilled the fear of god in me.
But why? Yeah, hitting UB can be a terrifying idea but rarely happens in practice.
In two decades of C programming, I have hit an UB bug exactly once when a piece of code was ran on an ARM platform for the first time. It took a little bit of staring at disassembly and reading some docs to sort out but it wasn't the end of the world.
Understanding the basic cases is a good idea but the darkest corners of undefined behavior are only important if you're a compiler writer like Chris Lattner is.
- jhomedall 10y agoA solid understanding of undefined behavior is required if you want to write software in C that is secure, that will behave properly, and that is portable. Undefined behavior has been the source of numerous security exploits in the past, and will only get worse as modern optimizing compilers become more advanced.