Why uintptr_t and intptr_t are Optional in C/C++

c++c++11c99

With C99 (and later standards) standard requires certain types to be available in the header <stdint.h>. For exact-width, e.g., int8_t, int16_t, etc…, they are optional and motivated in the standard why that is.

But for the uintptr_t and intptr_t type, they are also optional but I don't see a reason for them being optional instead of required.

Best Answer

On some platforms pointer types have much larger size than any integral type. I believe an example of such as platform would be IBM AS/400 with virtual instruction set defining all pointers as 128-bit. A more recent example of such platform would be Elbrus. It uses 128-bit pointers which are HW descriptors rather than normal addresses.