> In other words, even in a conforming implementation, the same pointer might cast to two different integer values.
If you're porting to that type of system, you will be keenly aware of this. The problem can be solved.
On the Intel 8086, every address has 4096 ways of referring to it by some combination of segment:offset. A segment is 64 kilobytes wide, and the segment: part of the address is "paragraph" (16 byte block) aligned. 65536/16 = 4096. For instance address 0x1234 can be referenced as 0123:0004, or 0122:0014 and so on.
However, there is a unique underlying address.
A pointer value can be normalized (using nonportable code, of course) to use, say, the largest possible segment value and the smallest possible offset. The resulting value can then be hashed.
Another way to deal with it on 8086 might be to use a "far" pointer, and calculate its offset from a "far" null pointer:
(far char *) ptr - (far char *) 0;
This should produce the physical address as an integer.
So that is to say, the concept of hashing an address is sound; only using "pointer" to mean "address" is not maximally portable. An implementation of pointer hashing can be ported to such architectures by some nonportable code, if necessary.
If you care about such portability, wrap the "pointer to integer address" logic in a function and implement that function as necessary.
If you're porting to that type of system, you will be keenly aware of this. The problem can be solved.
On the Intel 8086, every address has 4096 ways of referring to it by some combination of segment:offset. A segment is 64 kilobytes wide, and the segment: part of the address is "paragraph" (16 byte block) aligned. 65536/16 = 4096. For instance address 0x1234 can be referenced as 0123:0004, or 0122:0014 and so on.
However, there is a unique underlying address.
A pointer value can be normalized (using nonportable code, of course) to use, say, the largest possible segment value and the smallest possible offset. The resulting value can then be hashed.
Another way to deal with it on 8086 might be to use a "far" pointer, and calculate its offset from a "far" null pointer:
This should produce the physical address as an integer.So that is to say, the concept of hashing an address is sound; only using "pointer" to mean "address" is not maximally portable. An implementation of pointer hashing can be ported to such architectures by some nonportable code, if necessary.
If you care about such portability, wrap the "pointer to integer address" logic in a function and implement that function as necessary.