Boost logo

Boost :

Subject: Re: [boost] [endian] endian flip and endian domain
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2010-06-08 13:54:21


On Tue, Jun 8, 2010 at 1:05 PM, Dave Handley
<Dave.Handley_at_[hidden]> wrote:
>
> 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.
>

I'll admit to having a habit of over-thinking on names. But they are
important. I agree that swap is often used, but it has 2 strikes
against it:

- doesn't always swap
- std::swap

To me that was enough to look further. Doesn't mean swap is out of
the running, but the above are solid points against it in my mind. The
first more than the second, actually.
So I tried to take the practical approach, which I think is along the
same lines as what you are thinking. To me that means:

- "cast" if the syntax matches.
- "convert" otherwise

"convert", to me, matches most closely with what you express - ie,
"What term does everyone use..." Yes, 'swap' might be the first term,
but I think, by re-reading the emails, that "convert" comes in second,
clearly ahead of the rest. That's actually why I suggested it - it
was the term everyone was using. And without the problems swap has.

Tony


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk