Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-11-29 20:06:01

Matthias Troyer <troyer_at_[hidden]> writes:

>> So, while use of them may lead to a MORE portable C++ interface, they won't directly lead to a
>> portable binary serialization format (although you can clearly fix that problem in platform specific
>> byte reordering code).
> Agreed. It would just make the task of implementing a portable binary serialization easier, since we
> know the width of the types.

Why is that important? it's easy enough to detect the most significant
bit in an integer. We could just use a variable-length representation.

> However, we can also do the internal (private) implementation based on
> these types and dispatch from operator<<(int) to the appropriate function for serializing an integer
> with sizeof(int) bytes.
> In any case the library user should be reminded that short, int and
> long are never portable

Of course they are perfectly portable!

> but that by using int*_t and appropriate archive formats one can
> achieve portable serialization.

I think that's a terribly intrusive restriction to place on user code.

                       David Abrahams
   dave_at_[hidden] *
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at, gregod at, cpdaniel at, john at