So I'm serializing a C data structure for cross-platform use, and I want to make sure I'm recording my floating point numbers in a cross-platform manner.
I had been planning on just doing
char * pos;
/*...*/
*((double*) pos) = dataStructureInstance->fieldWithOfTypeDouble;
pos += sizeof(double);
But I wasn't sure that the bytes would be recorded in the char *
array in the IEEE 754 interchange format. I've been bitten by cross-platform issues before (endian-ness and whatnot). Is there anything I need to do to a double
to get the bytes in interchange format?