What pointer values are well-defined to compute?
问题 I was under the impression that while dereferencing pointers that don't point to a valid object is UB, simply computing such pointers is fine. However, if I'm understanding expr.add[4] correctly, that's not the case. So which of these pointer computations are well-defined? int a = 42; int *p = &a; p; // valid, and obviously ok p++; // invalid, but ok, because one past the end of 'array' containing 1 element? p++; // UB ? How about this case? int *p = nullptr; p; // invalid, and obviously ok