2 ms·
Very insightful, never fully understand why pointers can't be cast to integers(not even to uintptr_r, intptr), what's the guidance here to avoid the casting?
by ausjke 10y ago
Very insightful, never fully understand why pointers can't be cast to integers(not even to uintptr_r, intptr), what's the guidance here to avoid the casting?
- ArkyBeagle 10y agoYou'll need custom logic with in-depth knowledge of the mapping. In many cases the idiom mentions by "kazinator" above will often work - but not always: #define ptrToInt(x) ( ((char )x) - ( (char )0 ) ); ... and even that may require local tweaking.