Boost logo

Boost :

Subject: Re: [boost] [boost::endian] Summary of discussion #1
From: Tomas Puverle (tomas.puverle_at_[hidden])
Date: 2010-06-03 12:36:29


> > I'd go with “swap” and “swapped.”
>
> Amending that: watch out for unintended ADL effects with “swap.” It's
> one of those globally claimed names whose meaning (at least with two
> arguments) is fixed for all time w.r.t. unqualified calls.

I think the consensus was to use "endian_cast" for the function which returns a
swapped copy of the underlying data and "endian_swap" for the function which
performs the swapping in place (Rob's suggestions).

This is so that people can do

using namespace boost::endian;

int i = endian_cast<from_big>(j);

which seems pretty readable.

The only thing remaining for me to decide whether "endian_cast" and
"endian_swap" should live in the endian namespace (as I indicated above) or in
the boost namespace, as others have suggested.

Even though I dislike the endian::endian_cast<> syntax, my personal preference
would be to have endian_cast in the endian namespace for "cleanliness" issues -
I may well be ok with

using namespace boost::endian;

in my local scope to but I will not be ok with doing

using namespace boost;

Tom


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