Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross-platform primitive data types in C++

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?

like image 805
Tony the Pony Avatar asked Sep 06 '09 13:09

Tony the Pony


1 Answers

I found this header particularly useful: BOOST cstdint

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

like image 118
Anonymous Avatar answered Oct 27 '22 21:10

Anonymous