At what point does dereferencing the null pointer become undefined behavior?

I think the second opus of What every C programmer should know about Undefined Behavior might help illustrate this issue. Taking the example of the blog: void contains_null_check(int *P) { int dead = *P; if (P == 0) return; *P = 4; } Might be optimized to (RNCE: Redundant Null Check Elimintation): void contains_null_check_after_RNCE(int *P) … Read more

what is return type of assignment operator?

The standard correctly defines the return type of an assignment operator. Actually, the assignment operation itself doesn’t depend on the return value – that’s why the return type isn’t straightforward to understanding. The return type is important for chaining operations. Consider the following construction: a = b = c;. This should be equal to a … Read more