What is the compatible "int" datatype in C++ that can resize itself to 4 bytes on 32bit & 8 bytes on 64bit windows?
Although INT_PTR works fine but it reduces the readability as well as its description tells us to use it for pointer arithmetic.
Thanks
If you're looking for something standard, you're out of luck. The standard does not specify the size of any of the built-in datatypes.
Note, that INT_PTR
does not imply pointer arithmetic. I means that the type will have the same size as void *
, which is exactly what you want. It won't work on all platforms though (I'm pretty sure it's Windows specific).
under Visual Studio you are also offered __int3264 which does much the same as INT_PTR ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With