Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2007-03-16 16:48:42


Pfligersdorffer, Christian wrote:

> I read this thread with very much interest since I want to use the
> portable binary archive too. Could you please share your experience
> and especially the code of the version that actually works?

I've made some a few changes. I'll check them in to the HEAD before
tomorrow.

a) I made a small change to binary_?archvive which was losing
a "const" along the line and frustrating a template match

b) I made a change in portable_binary_?archive to fix an
error whereby the sign bit was changed on certain
negative numbers.

> Did you also add code to treat floating point types?

Nope - that's an excercise for the user.
Notes on the current implementation:

a) It presumes a two's complement computer so its not "truely" portable.
b) It doesn't include floating point. I think this would be more
effort than first meets the eye. At least one attractive proposal on
how to effectively do this was suggested.
c) Its not all that efficient on big endien machines. I think
a better version would write the data out in native mode
with flags in the header indicating how it was written. Then
the endian fix up would occur when it was moved from
one machine to another.
d) It focuses more on reducing archive size. So some
a 64 bit value of 0 is written as one byte. This is probably
a good choice for most. But it costs time in sign extending
etc.

Robert Ramey


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net