Mail Archives: djgpp/1998/01/02/06:15:31
John M. Aldrich wrote:
[...]
> Binary files are notoriously nonportable between compilers, not only
> because of type sizes. Especially when reading or writing structs,
> different compilers will use different packing/alignment schemes for
> struct members. Even worse, different machine architectures (and
> sometimes different operating systems on a given machine) use different
> byte ordering systems for integers. And don't even think about trying
> to read or write floating point numbers!
Still, it sometimes works. I do happily share binary grid and result
files between my PC and AIX RISC stations. Some care has to be taken
about the endianess, but as both compilers have the same ideas about
the size of variables, and by lucky chance the representation of floats
is the same (IEEE), this works fine (In fact, it's the same compiler,
gcc).
I haven't tried structs, though. With the HP in the CC this fails.
But admittedly, you will have to know what you are doing. Some
conditional
defines and typedefs for INT8, INT16, INT32 and alikes may save
your day.
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -