News for hackers. Stuff that matters.
Re:C pointers are not hardware pointers by jsnell on Sunday March 06, 2016 @04:11PM (#11235559)
Consider an extreme segmented CPU architecture where the malloc implementation allocates a new segment for every object, free deallocates the segment, and the architecture has been defined such that any use of a stale segment descriptor is an error.
Re:C pointers are not hardware pointers by asveikau on Sunday March 06, 2016 @04:36PM (#11235661)
> and the architecture has been defined such that any use of a stale segment descriptor is an error.

Even trying to imagine such an architecture, it's hard to see that comparing pointers constitutes "use" - it seems more likely that this would just wind up being an integer comparison.

Re:C pointers are not hardware pointers by jsnell on Sunday March 06, 2016 @05:50PM (#11235970)
But that's just the point, in a segmented architecture pointers are not simply integers, and they can't be compared as such either. A pointer will be the combination of a segment descriptor of some sort and an offset. It would be completely reasonable for a pointer comparison to require that both segment descriptors are valid (e.g. maybe multiple distinct segment descriptors can map to the same physical segment, so pointer comparison needs to dereference the descriptor).
Re:C pointers are not hardware pointers by asveikau on Tuesday March 08, 2016 @10:31AM (#11245795)
When thinking of segmented architectures my mind jumps to 16-bit x86. Of course those are integers. It's common to store pointers in a 32bit value where half is segment and half is offset. A comparison of linear addresses would take segment * 16 + offset. No need to use the segment for that calculation.

Obviously it could be different for something more exotic, but I had a hard time seeing how it wouldn't eventually lead to or map well to integers.