What is the header file for the uintptr_t type in modern C++?

WilliamKF picture WilliamKF · Sep 1, 2012 · Viewed 17k times · Source

I found that in C99 you should #include <stdint.h> and that seems to work with my C++03 gcc compiler too, but is that the right header for modern C++, is it portable?

Answer

Mike Seymour picture Mike Seymour · Sep 1, 2012

In C++11, it's in <cstdint>.

In older versions of the language, it didn't officially exist; but many compilers provided the C99 library as an extension, in which case it would be available in <stdint.h>.