Is pointer comparison undefined or unspecified behavior in C++?
Note that pointer subtraction and pointer comparison are different operations with different rules. C++14 5.6/6, on subtracting pointers: Unless both pointers point to elements of the same array object or one past the last element of the array object, the behavior is undefined. C++14 5.9/3-4: Comparing pointers to objects is defined as follows: If two … Read more