Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2006-05-31 12:40:26

Beman Dawes wrote:
> "me22" <me22.ca_at_[hidden]> wrote in message
>> On 5/31/06, Beman Dawes <bdawes_at_[hidden]> wrote:

> That said, I guess there could be an argument to expose the templates for
> those who prefer them.

Or, if those templates are sufficiently generic, exposing them for the
case for different kinds of endianness. In those rare cases when you are
emulating some strange hardware :-)

>> I think the names for the types might be a little bit too cute. "bin"
>> makes me think binary, not signed big-endian. That being said, I'm
>> not sure I have any good name that isn't far too verbose.
>> unsigned_littleendian_aligned<4> is admittedly starting to push
>> convenience, though bigendian<5> isn't too bad.
> I'm often amazed at the clever names Boosters suggest, so I think it is
> worthwhile to speculate a bit about better names. But the everyday use
> typedefs really do need to be short and memorable. I've been using the
> "bin2", "bun3", etc. since 1984 or so, with several hundred programmers now
> using them all the time, and never had a request to change the names.

Since name suggestions are up... My main problem with the bin*, bun*
names is that you have to train yourself to know what they mean. It
might be easy after a while but they don't say anything to me initially
(even with the explanatory chart). My suggestion would be to stick close
to the existing cstdint types:



Of course that means using bit sizes instead of byte sizes. But I find
the bit sizes more natural anyway :-)

> A more typical use might be something like:
> struct header_record
> {
> bun3 version;
> bun1 rev;
> bun5 nrecs;
> ..... blah blah blah
> };

One question I have is... How common is it to need all the various
arithmetic operators in these types? All my use cases of endianness
handling are solved by a single specialized byteswap() function. And
hence see the utility of having the type do it for me, but not the
utility of the operators.

-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. -
-- rrivera/ - grafik/
-- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

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