
12 Apr
2011
12 Apr
'11
9:46 p.m.
On 4/12/2011 10:15 AM, Nevin Liber wrote:
Only if it is implemented the way Steven described it. You cannot legally compare pointers using relationship operators (<,<=,>,>=) unless at least one is NULL, they are both pointing within the same object, or both pointing within the same array (or just past the end of the array). All other comparisons are undefined behavior. See 6.5.8 of the C99 standard for a much more precise definition.
I understand but a memory page is in general aligned and therefore the pointer difference (ptrdiff) of the beginning of the page with the location of the object can be valid. In other words the memory page can be an array of type T. -Phil