On Sun, Jan 21, 2001 at 05:28:45PM -0500, Tim Peters wrote: > [Thomas Wouters] > > Why is comparing v->ob_type with w->ob_type illegal ? They're > > both pointers to the same type, aren't they ? > Non-equality comparison of pointers is defined if and only if the pointers > are both addresses in the same contiguous structure (think struct or array); > an exception is made for a pointer "one beyond the end" of an array, i.e. if > sometype a[N]; > then &a[0] < &a[N] == 1 is guaranteed despite that &a[N] is outside the > bounds of a; but &a[0] < &a[N+1] is undefined (which *means* undefined! > e.g., it's OK if they compare equal, or if the comparison causes a hardware > fault, or ...). Ok, I guess I stand corrected. I was confused by the name of Py_uintptr_t: I thought it was a pointer-to-int, not an int large enough to hold a pointer. I'm also positively appalled by the fact the standard refuses to define sane behaviour for out-of-bounds access on an array, but attaches some weird significance to what pointers are pointing *to*, when comparing the values of those pointers, regardless of what type of object they are stored in. But I guess I don't have to whine about that to you, Tim :-) -- Thomas Wouters <thomas@xs4all.net> Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4