Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-03-12 20:24:03


At 12:59 PM 3/11/00 -0700, Greg Colvin wrote:

>To add my two cents worth, in 1988 and 1989 I wrote a database
>library that stored binary data on CD-ROM in big-endian format
>and loaded it on Intel, VAX, Sun, Apollo, and Macintosh machines.
>I used the same fetch-byte-and-shift trick that Darin describes
>with happy results. Ten years later no one has found cause to
>create platform-specific macros to improve performance.

That's the technique bin_ubin.hpp uses.

Correctness and avoiding configuration problems is the issue, not
speed.

Because both byte order and alignment are issues, and given the C++
standard's stricter definitions for POD's, any such classes should be
POD's. bin_ubin.hpp needs to be updated in that respect.

Several people have suggested turning these classes into templates,
but the discussion always ended up deciding that templates were an
overspecification. For practical purposes I/O traffics in some
multiple of 8-bit bytes, and that is that.

One oddity regarding the names. The original (C then later C++)
versions had names which specified the number of resulting bytes:
bin1, bin2, bin3, bin4, etc. In putting together a prototype for
boost, I changed the names to reflect the number of bits. That has
not been a success. In doing I/O, it is much more natural to think
in terms of bytes, not bits.

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk