Re: [Boost-users] Boost binary serialization & AMD64
Leon,
I assume if I would want to make the x86 data files readable on an amd64 architecture, I would have to write my own conversion utility,
One less drastic alternative is to use explilcit types such as _int32 or _uint64. That should make sure variables are of the same size on different machines. Merrill
I don't think this would do it. There is no guarentee that these types resolve to the same underlying type on the machine. That is _uint32 guarenties that it will hold a 32 bit number but doesn't guarentee that it is in fact a 32 bit number and may well be a 64 bit number on a particular platform. These are just typedefs for native types guarenteed to be able to hold an integer of the required size. The native binary serialization will is built for speed and does no conversion. The portable binary archive is what you want here, but as I mentioned before - its up to an interested party to finish. Robert Ramey Merrill Cornish wrote:
Leon,
I assume if I would want to make the x86 data files readable on an amd64 architecture, I would have to write my own conversion utility,
One less drastic alternative is to use explilcit types such as _int32 or _uint64. That should make sure variables are of the same size on different machines.
Merrill
I don't think this would do it. There is no guarentee that these types resolve to the same underlying type on the machine. That is _uint32 guarenties that it will hold a 32 bit number but doesn't guarentee that it is in fact a 32 bit number and may well be a 64 bit number on a particular platform.
Not true, boost::int32_t is a 32-bit integer type, *exactly* 32-bits wide. The boost::int_least32_t types may be wider than 32-bits, and may be what you were thinking of. However just because two types are both 32-bits wide, doesn't mean they have the same byte order. So still back to square one, but for a different reason. Well OK a 32-bit binary int would be portable between IA32 and IA32EM64, but not to IA64. John.
participants (3)
-
John Maddock
-
Merrill Cornish
-
Robert Ramey