|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2006-02-11 20:17:31
Just a little information that might be helpful to those concerned
about what type the serialization system should use for storing the
count of items in a collection.
a) the serialization system maintains the concept of "archive version"
which gets incremented when changes are made in the the library
which could break existing archives. The version number - not to
be confused with the version number for any particular class is
currently at number 3 and will be incremented to 4 for 1.34. If
a change in the collection count type is made, the reading of this
number will will depend on the archive version under which the
archive was created and adjust accordingly.
b) for text base archives it will be hard to notice any change.
numbers are renders as - text - which is an inherently variable
length format.
c) For native binary archives - the length of the count as stored
in the archive will change. Currently its the length is the size
of unsigned int for the machine that creates the archive. If a
change is made to std::size_t then the length will change to the
size of this type on the machine which created the archive.
Native binary archives meet no requirements for portability
accross platforms. If portability is a consideration then
native binary archives are not suitable and a different archive
class must be used. There is an example of a portable binary
archive which stores integers in a variable length format and
these are portable across machines as long as the recieving
machine has the capability to represent the numbers actually
written to the archive.
d) the natural candidate for the collection count is std::size_t
as that is what the STL uses to specifiy the count of its members.
I believe the question has been raised as to whether the
serialization system should use this or some special type
for this purpose.
I don't have a strong opinion. I am surprised that apparently
people are using the serialization system with more than 4G
objects. Even 4G doubles comes to 32 GB. I would have
guessed that the intersection of people doing that and using the
serialization system is a null set.
So the only questions are
a) is the a big enough deal to even bother.
b) If it is - should the change be made to std::size_t or is
there some reason that it should be made to some other type
c)If so, what other type and why?
Robert Ramey
Kim Barrett wrote:
> At 5:33 PM -0500 2/11/06, David Abrahams wrote:
>> > The count should be some type that has a fixed (up to byte-order
>> issues)
>>> representation, i.e. something like uint64_t.
>>
>> Or a variable-length representation, which is what I *think* Matthias
>> chose.
>
> I think that would be even better.
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk