From: Greg Colvin (gcolvin_at_[hidden])
Date: 2000-11-16 11:59:48


From: Beman Dawes <beman_at_[hidden]>
> At 10:48 PM 11/15/2000 +0100, Jens Maurer wrote:
>
> >> 3_
> >> binary could be made a bit portable...
> >
> >This would be a portable_binary_writer then.
> >
> >Hm... I dimly remember that we had some portable integers in boost,
> >but I can't find them now. Beman?
>
> IIRC, Mark Borgerding, Darin Adler, and I all discussed portable binary
> integer classes we use in our own work. They range from minimalist to much
> more complete, big endian only to both big and little endian. Some people
> think that portable integer classes should act like full-fledged arithmetic
> objects, others (or at least me) see them as representation holders useful
> for I/O but to be converted to built-in types for any arithmetic
> operations. Beyond data portability, maximum code portability requires such
> classes be POD's and that argues for minimalist rather than maximalist
> designs, IMO. Still other people viewed the need in terms of operations on
> streams, without a need for actual objects.
>
> Although there was no consensus on those kinds of design questions, there
> did seem to be consensus by those who had used them that portable binary
> integer classes are very useful or even essential for lots of practical
> applications.
>
> It would be really nice if someone good at sifting through disparate
> requirements would put together a proposal broad enough to meet multiple
> people's needs but narrow enough not to focus on what is basically a pretty
> simple need.
>
> Moving beyond integers, http://www.ietf.org/rfc/rfc1832.txt specifies
> portable formats for other data types. Personally, I'd be happy with
> integers, at least as a start.

The last time I needed to do this I went with a big-endian encoding
of a full set of integers and reals, encoded so that they would sort
correctly with memcmp.