Boost logo

Boost :

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

Dave Handley wrote:
> Robert Stewart wrote:
> > Dave Handley wrote:
> > > Gottlob Frege wrote:
> > > > I think what I am saying is that, conceptually at least, the
> > > > endian-types come first, and the straight functions are
> > > > built on top of that (instead of the other way around as
> > > > most are suggested).
> > > >
> > > > Now, I wouldn't want that to impact performance, which
> > > > is why I say 'conceptually'. We can specialize the heck out
> > > > of everything so that performance wins, but I think the
> > > > conceptual foundation is important.
> > > I disagree. If you have an endian type then I think you are
> > > coding in from the beginning a need for a copy in order to
> > > endian swap - even if the endian swap is a no-operation.
> > This discussion isn't necessarily intended to account for
> > swap-in-place, which all have agreed is necessary. Rather,
> > I at least am thinking of this discussion as applying to the
> > object-based approach and to the copy-based conversion
> > functions.
> The problem is with the initial statement above which says
> "the endian-types come first, and the straight functions are
> built on top of that".

Agreed, but note the qualifications that followed. I took Tony's statement as wishful thinking that might be proven justified, but very likely won't. Furthermore, I noted that the discussion applied to the copy-based conversion functions. Since those involve a copy, they could just as easily be built atop the object-based approach as not. I don't think that dictates a loss of efficiency, but must be proven.

> I agree that the existence of std::swap() is an issue. In
> that context I would argue for something more like
> boost::endian_swap. I think changing the verb used is an
> obfuscation and not necessarily helpful.

I don't mind boost::endian_swap but boost::endian::endian_swap might be a bit much. However, "endian_swap" doesn't connote the copying overhead so I see that as suitable to the in-place operation, and "endian_cast" as more appropriate to convey the copying operations.

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