Most C and C++ programmers&#x27; mental models of the machine is different to the abstract machine in the respective specifications. [1] There&#x27;s a genuine problem here of overly clever optimizers wilfully misreading code to produce fast, wrong code. But the compiler exists to map our ideas into code; it&#x27;s a tool to help us, not catch us out in a lawyerly fashion.<p>I will say that the article isn&#x27;t a fantastic example, but at the same time it isn&#x27;t too far off a more common idiom that is also UB as it is usually expressed - type punning. And type punning almost always works, except when it doesn&#x27;t - <a href="http:&#x2F;&#x2F;blog.qt.io&#x2F;blog&#x2F;2011&#x2F;06&#x2F;10&#x2F;type-punning-and-strict-aliasing&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blog.qt.io&#x2F;blog&#x2F;2011&#x2F;06&#x2F;10&#x2F;type-punning-and-strict-al...</a><p>[1] In particular, most programmers think pointers are simply numbers that represent memory addresses and that the chief distinguishing thing about null pointers is that accesses through them usually cause a memory page error owing to how the OS has mapped memory.