Message118121
> I don't think arbitrary comparisons of pointers give well-defined
> results, unless those pointers both happen to point into the same
> array. (Might be wrong; I don't have a copy of the C standard to
> hand.)
Technically arbitrary relational comparisons of pointers are undefined, but in practice Antoine's assumptions here are very modest. They boil down to:
v >= &array[0] && v < &array[array_len]
It is hard for me to imagine a system designed such that the expression could evaluate to true when v is not in the array.
I suppose a system could be designed where relational comparisons of unrelated data pointers causes a segmentation fault or similar, but that also seems unlikely to me. |
|
Date |
User |
Action |
Args |
2010-10-07 16:27:20 | stutzbach | set | recipients:
+ stutzbach, rhettinger, aahz, amaury.forgeotdarc, mark.dickinson, pitrou, Aahz |
2010-10-07 16:27:20 | stutzbach | set | messageid: <1286468840.71.0.333993292413.issue10044@psf.upfronthosting.co.za> |
2010-10-07 16:27:17 | stutzbach | link | issue10044 messages |
2010-10-07 16:27:17 | stutzbach | create | |
|