Boost logo

Boost :

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


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.

> Unless I'm missing something here. I also don't think this
> is bad. Remember that endian swapping happens once at the
> boundary of the code. It isn't something that is constantly
> changing type and we shouldn't be worried about the
> programmer losing track of what type the data is in imho.

This has been discussed repeatedly and there remain several in this discussion committed to the usefulness of the object-based approach, so you'll not convince them otherwise. Instead, keep the two approaches distinctly in scope as you read the discussions.

> Of course, if someone can come up with a typed interface
> which doesn't enforce a copy then I may change my mind.

+1

> Next, on naming, I think we should be very careful that we
> don't over-think the naming question. I'll ask a general
> question. What term does everyone use when talking about
> endian swapping? Certainly in my programming career I've
> never heard it called anything other than endian swapping.
> Also (and I know this shouldn't be taken as a definitive
> source) Wikipedia refers to the process of changing
> endianness as a byte swap. Shouldn't we use swap because
> that is what everyone knows the process of changing
> endianness as? That's my 2d, but I'm not wholly against
> another naming option.

While I sympathize with your position, it has been noted that "swap" is a very bad choice because of std::swap(), boost::swap(), etc. Those functions have a distinct behavior and purpose that endianness conversion does not satisfy. Considering that our work could be standardized in the future, can you imagine the committee accepting "swap" as the name? I can't. That implies the need to find another name.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk