Subject: Re: [boost] [boost::endian] Summary of discussion #1
From: David Abrahams (dave_at_[hidden])
Date: 2010-06-03 14:56:43
At Thu, 3 Jun 2010 16:36:29 +0000 (UTC),
Tomas Puverle wrote:
> > > 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.
Ouch. Normally the destination type is in the <>s of a cast. Why not
just two functions:
boost::endian::from_big( x )
boost::endian::from_little( x )
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk