4 ms·
Agreed. The "pointers as integers" model requires (among other things) that unrelated pointers be comparable with < and >, which IIRC is undefined behavior i
by jasonhansel 6y ago
Agreed. The "pointers as integers" model requires (among other things) that unrelated pointers be comparable with < and >, which IIRC is undefined behavior in the C spec because it has trouble with some exotic memory models.
- mhh__ 6y agoIt also doesn't really make sense in abstract consideration - is one address "bigger" than the other one?
- deleted 6y ago[deleted]
- jerome-jh 6y agoSince one can add to and subtract from a pointer, it is only natural to be able to compare them. And the standard clearly states pointers can be compared, although it requires the two pointers to point to the same array (or last element+1) or to the same structure.