Subj : Re: Win98 error To : borland.public.cpp.borlandcpp From : maeder@glue.ch (Thomas Maeder [TeamB]) Date : Tue Mar 16 2004 08:18 pm Bob Gonder writes: >>ints in structs don't cause them to break on different platforms. Why do you >>think they do? > > They're different sizes, no? In general, yes. > Write a struct on one platform, read it on another, and not-so-good > things happen. Not-so-good things only happen if a struct's binary representation is written on one platform and is attempted to be read on a different platform. Independently of there being an int member. With floating members, chances that you get problems, are much higher. This problem is known, and so is the solution: the definition of a protocol that exactly specifies the meaning of every byte transfered. The easiest realization is some textual representation, e.g. XML or something less verbose. > If you can use fixed-size values short, long, int64, of what use is a > variable sized int in a struct? First, short and long objects aren't of fixed size. Second, size is only one of the issues to be taken into consideration. Endianness is another. .