I've got quite a unusual task - I want to transfer a double between a java application and a C++ application, where the compiler of the C++ application is not defined.
So the best way to do this to avoid expensive conversions is binary, by transferring the raw 8 bytes of the double.
However, can I guarantee that they are represented the same in both applications such that the conversion will never fail?
From briefly googling I found that C++ and java both use IEEE 754 representation of doubles, and this is defined in their specification. But a colleague of mine told me that he knows of a C++ compiler which represents doubles with 10 bytes instead of 8, so therefore that compiler would basically be broken since its not following the spec? Or alternatively I am wrong, and it is not guaranteed to represent doubles in a set way?
What do you think...