|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2005-11-25 11:47:21
Tom Widmer wrote:
> Peter Dimov wrote:
>> Matthias Troyer wrote:
>
>>> What if the number n is infinite (e.g. all possible structs
>>> consisting only of fundamental types), which is what Robert calls
>>> "bitwise serializable"?
>>
>>
>> Structs aren't bitwise serializable in general because of
>> padding/packing/alignment. Archives that do not have a documented
>> external format and just fwrite whatever happens to be in memory at
>> the time aren't really archives, they are a very specific subset
>> with limited uses (interprocess communication on the same machine,
>> the same compiler and the same version) that should not shape the
>> design. ("Archive" implies persistency, and relying on a specific
>> memory layout is not a way to achieve it.)
>
> However, that is a common use case of any serialization library, and
> it
> is one that benefits greatly from fast array serialization. If the
> serialization library does not support it, those doing IPC may discard
> boost serialization entirely, to avoid implementing two different
> mechanisms in their programs. Some operating systems rely extremely
> heavily on message passing between processes (QNX is an example), and
> it would be nice if boost.serialization would be useful there.
Note the current binary_?archive saves and restores all the bits of
all primitives without regard to alignment and endian issues. For this
reason it is referred to as "native binary" and considered suitable
only for creating archives to be loaded back into the same
environment.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk