H
Hallvard B Furuseth
Do anyone know of an architecture where this can break?
T *ptr1, *ptr2;
...
if (ptr1 == ptr2)
if (CHAR_BIT*sizeof(T*) <= (width of int)) /*otherwise undefined*/
assert((int)ptr1 == (int)ptr2);
(Feel free to replace int with another integer type if that helps to
break something.)
I know an addess can have several representations at least on some DOS
memory models, but I don't know if it normalizes pointers before
converting to integer.
T *ptr1, *ptr2;
...
if (ptr1 == ptr2)
if (CHAR_BIT*sizeof(T*) <= (width of int)) /*otherwise undefined*/
assert((int)ptr1 == (int)ptr2);
(Feel free to replace int with another integer type if that helps to
break something.)
I know an addess can have several representations at least on some DOS
memory models, but I don't know if it normalizes pointers before
converting to integer.