But the compiler could just as well emit a warning &quot;useless NULL comparison&quot; instead of blithely assuming that the programmer intentionally wrote a book expression. That wouldn&#x27;t handle every case of UB, but would handle many.