Boost logo

Boost :

Subject: Re: [boost] [Endian] Performance
From: John Filo (filo_at_[hidden])
Date: 2011-09-09 21:55:22


On 09/09/2011 04:13 PM, Beman Dawes wrote:

> I'm not sure I do either. I'd be curious to see a reference to the
> wording in the standard that Mathias thinks comes into play.
>
> I'm also curious what you didn't just write:
>
> return reinterpret_cast<ubig32_t>(src);
>

gcc gives me:

   invalid cast from type ‘uint32_t’ to type ‘boost::endian::ubig32_t

I've only ever used reinterpret_cast on pointers, so doing the above
didn't even occur to me. I had to try it to see whether or not it would
work. Using static_cast doesn't work because it does the byteswap
operation twice, making the function a no-op.


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