|
Boost : |
From: mfdylan (dylan_at_[hidden])
Date: 2001-12-20 16:15:03
--- In boost_at_y..., "bill_kempf" <williamkempf_at_h...> wrote:
> I also find it vexing that there's no support
> for binary output. I think a binary_stream heirarchy would be a
> wonderful thing for Boost to address as well (however, it should be
> designed on it's own, not "hacked" in because Boost.Sockets or some
> other library needed it... this is too important to design with
such
> a narrow view).
The binary_stream class I wrote (a fairly quick&dirty conversion from
some existing code we use commercially) is not really "hacked", it's
based around the XDR protocol used for RPC, but does have some
limitations that would be hard to avoid in any binary protocol.
Basically I can't see something like this getting into the standard
simply because it would be too hard to implement efficiently on
certain platforms (eg non IEEE floating point platforms,.or those
with weird byte orders or bitcounts), and the restrictions on int
sizes etc might be considered anathema to the C/C++ 'generic int'
philosophy. Once the int<nn>_t types are standard in C++ it might be
feasible, although it would be a pain that you couldn't work directly
with longs/ints/chars etc.
Then again thinking about it, the same is true for ascii I/O - you
can't write out an int on a 32-bit platform to an ascii stream and be
guaranteed to be able to read it into an int on a 16-bit
platform...so maybe the difference is not so fundamental.
Dylan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk