ISO C11 标准在哪里声明比较两个不指向同一数组的指针是未定义的行为?

Where does the ISO C11 standard state that comparing two pointers that do not point to the same array is undefined behavior?

ISO C11 标准在哪里规定比较两个不指向同一个数组的指针(<><=>=)是未定义的行为?

嗯,6.5.8p5 from C11 draft 很清楚了:

When two pointers are compared, the result depends on the relative locations in the address space of the objects pointed to. If two pointers to object types both point to the same object, or both point one past the last element of the same array object, they compare equal. If the objects pointed to are members of the same aggregate object, pointers to structure members declared later compare greater than pointers to members declared earlier in the structure, and pointers to array elements with larger subscript values compare greater than pointers to elements of the same array with lower subscript values. All pointers to members of the same union object compare equal. If the expression P points to an element of an array object and the expression Q points to the last element of the same array object, the pointer expression Q+1 compares greater than P. In all other cases, the behavior is undefined.

例如,"other case" 是两个指针指向不同数组的情况。

请注意,关于 pointer provenance 的工作仍在进行中,希望未来的标准能够清除边缘情况。