|Hosting by Solid Eight Studios,PhotoTangler Collage Maker|
Cross Platform Compatibility
Question submitted by (28 June 1999)
|Return to The Archives|
|What are some of the thing one should know when developing cross platform applications? I never thought about it before but for example: "How many bits is a floating point in windows and in linux?" Or is a float everywhere the same?|
The things you want to consider are:
1. User-interface devices (mouse, keyboard, monitor/graphics card)
You usually want to black-box your device code so that you can easily replace these modules with OS-specific code.
2. Processor word size
In C/C++, 'int' is defined as the 'default' word size (for intel, this would be 32-bits.) A 64-bit processor would use a 64-bit integer size. Interestingly enough, the C/C++ specification defines 'long' as 32-bits. So on a 64-bit processor, the integer will have twice the precision of a long.
I've never seen this affect the size of floats. Though I'm not sure exactly how the C/C++ specifications define them, I know that IEEE defines them as specifically 32-bit (single), 64-bit (double) and 80-bit (extended.)
People rarely do bit manipulations on floating point values, so the only time you need to worry about the sizes of them would be if you read them in from an outside source (file, network, etc.) Of course, any time you read ANYTHING from an outside source you need to be sure you're reading the right number of bits and in the right order.
Speaking of order...
3. Processor endian
The rule of thumb (for me, at least) in regards to endian is that only when getting your data from an outside source, should endian have to be taken into consideration.
Response provided by Paul Nettle
This article was originally an entry in flipCode's Fountain of Knowledge, an open Question and Answer column that no longer exists.