Let me first clarify that I am by now very familiar with definitions of size_t
and intptr_t
, and I don't want any repetitions of what they accomplish.
Instead I would like to know the following. Do you know of any platform, except x86/DOS (with its unbearable memory models) where the cast
void* a = ...;
size_t b = (size_t)a;
actually loses bits or bytes?
Thanks!
size_t
and the size of pointers are the same and no new code should be written with that assumption, I can see where a question like this might come from: legacy code. I imagine that there's a lot of code out there that makes exactly this assumption. Just like there's a lot of code that assumes an int or a long is 32 bits (no more, no less - that's why MS chose the LLP64 model for Win64). Someone (maybe even Jonas) might want to determine whether it's worthwhile to expend time & effort into proactively changing the legacy code. – Irresistible