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?
I found this header particularly useful: BOOST cstdint
Usually better than inventing own wheel (which incurs the maintenance and testing).