Originally Posted by Sander Also, I'm not sure the compiler is allowed to optimize it away. Is it promised that the special case that p is NULL breaks? Dereferencing NULL is undefined behavior, not a mandatory failing condition. So it could optimize it.