Message118121
| Author |
stutzbach |
| Recipients |
Aahz, aahz, amaury.forgeotdarc, mark.dickinson, pitrou, rhettinger, stutzbach |
| Date |
2010年10月07日.16:27:17 |
| SpamBayes Score |
5.761388e-05 |
| Marked as misclassified |
No |
| Message-id |
<1286468840.71.0.333993292413.issue10044@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|