Boost logo

Boost :

Subject: Re: [boost] [boost::endian] Summary of discussion #1
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-06-04 08:59:05

Terry Golubiewski wrote:
> Robert Stewart wrote:
> > Terry Golubiewski wrote:
> >>
> >> namespace boost { namespace interface {
> >
> > boost::interface strikes me as a meaningless namespace.
> I see several classes as having to do with message passing
> and communication interfaces. endian, packed_int,
> bitfield, dispatcher, etc. Perhaps just "comm" would be
> better?

I see. "comm" is certainly better than "interface" which can apply to nearly anything. Note that the Boost way would spell out the word.

Having said that, I question tying endianness with communications. In the general sense, it does work, but one usually thinks of networking, telephony, etc. when using the word "communications." Tomas has rightly kept endianness from networking because it can be used for graphics, market data, etc. In my own code, I used "byte_order" as the namespace.

> >> template<size_t Bits, endian_t Endian=native>
> >> class PackedInteger {
> >> public:
> >> typedef typename boost::int_t<Bits>::least value_type;
> >> static const endian_t endianness = Endian;
> > [snip]
> >> PackedInteger(): { m_storage.fill('\0'); }
> >> explicit PackedInteger(value_type x) { store(x); }
> >
> > Why explicit?
> Without the explicit, operations on PackedInteger, such as
> comparison, will have ambiguity.

I haven't looked into it, so I'll take your word for it. I thought it was to prevent implicit construction from native types on general principles.

> The point of PackedInteger is to provide 3-, 5-, 6-, 7-byte
> integers. It really doesn't have anything to do with
> endianess in intention. However, when storing the values
> into memory, you have to decided which endian to use, of
> course. I hastily picked the "PackedInteger" name because
> I believe it will be used by users that want the smallest
> integer that will meet their needs because they are space
> constrained, such as in messages.

Given the context, the sudden introduction of PackedInteger surprised me. That you say it "really doesn't have anything to do with endianness" explains it.

"Packed integer" suggests a type that selects the smallest representation to hold the current value, though that would be largely impractical. Perhaps "sized_integer," "integer_field" (following "bit field"), or something of that sort would be more to the point.

Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.

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