2 ms·
> Complex pointers (object/method pointers) can sometimes exceed that? They can't. void* / intptr_t is a fixed-size, and at least on all platforms I run on tha
by kllrnohj 7y ago
> Complex pointers (object/method pointers) can sometimes exceed that?
They can't. void* / intptr_t is a fixed-size, and at least on all platforms I run on that size is always 32-bit or 64-bit. Both of which fit perfectly fine in the always-64-bit jlong.
If you're thinking of std::mem_fn or similar note that they are defined to return an undefined object not a pointer. So of course those can be larger than the size of a pointer, since they aren't a pointer.
But sure toss in a static_assert(sizeof(jlong) >= sizeof(void*)) if you want.
- JoeAltmaier 7y agoI guess I was thinking of virtual function pointer. Its larger than a regular function pointer, which is not necessarily the same size as a data pointer. But if you're dealing with object pointers only, all good!