Boost logo

Boost :

Subject: Re: [boost] [endian] endian flip and endian domain
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2010-06-08 10:24:39

Vicente Botet Escriba wrote:
> Rob Stewart wrote:
> >>
> > Your "domain" idea is nothing other than "endianness" as
> > far as I can tell. Why invent a new term?
> >
> It is more a mapping from a type to the endianness of its leaves. For
> example if you have two interfaces with different endianess
> for some of the
> leaves of a given type, you will be able to convert the native type to
> either interface just supplying the domain.

I still don't get it. Aren't you just indicating the endianness you want to wind up with, regardless of how the data is ordered currently?

> > When applied to a UDT, "flip" seems even worse as it
> > suggests that things that are currently big endian will be
> > "flipped" to little and vice versa, whereas "reorder" and
> > "swap" can be interpreted easily as making everything
> > uniform.
> >
> For me swap has the same inconvenient than flip, invert, toggle.

"Swap" connotes changing places. From the standpoint of "swap-in-place," it is certainly awkward. "Flip" fits the in-place behavior better, though I still don't care for it because the bytes or bits are not themselves being flipped. "Invert" can imply things like turning something inside out, reversing, etc., so it easily connotes more than "flip," though "swap" is the long established word for the operation. "Toggle" means essentially the same as "flip," so its a non-starter for me.

"Reorder" and "transpose" allow for moving things around exactly as these operations do, without causing swap's confusion when "in-place" is introduced. I favor one of those two choices.

> > How is flip_to/flip_from clearer than the previous
> > suggestions of to/from?
> >
> to/from are not verbs.

Touché! That's my own argument! I view the action as implied in those names: "to<big_endian>" means "change from host order to big endian," for example. That justifies the names not being verbs, but weakly. Still, I find "reorder_to<big_endian>," "transpose_to<big_endian>," and similar constructions somewhat less satisfying.

> I would prefer present_to/from, as what this functions are
> doing is part of the presentation layer, for messages for
> which the single difference between the physical and the
> application view is the endianness of the leaves.

I object to your terminology since this has nothing to do with presentation. Rather, it has to do with internal representation.

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