Cross-platform primitive data types in C++

Tony the Pony picture Tony the Pony · Sep 6, 2009 · Viewed 14.5k times · Source

Unlike Java or C#, primitive data types in C++ can vary in size depending on the platform. For example, int is not guaranteed to be a 32-bit integer. Various compiler environments define data types such as uint32 or dword for this purpose, but there seems to be no standard include file for fixed-size data types.

What is the recommended method to achieve maximum portability?

Answer

Anonymous picture Anonymous · Sep 6, 2009

I found this header particularly useful: BOOST cstdint

Usually better than inventing own wheel (which incurs the maintenance and testing).