Boost logo

Boost :

Subject: Re: [boost] [endian] endian flip and endian domain
From: Gottlob Frege (gottlobfrege_at_[hidden])
Date: 2010-06-08 12:55:52


On Tue, Jun 8, 2010 at 12:46 PM, Gottlob Frege <gottlobfrege_at_[hidden]> wrote:
> On Tue, Jun 8, 2010 at 11:52 AM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
>
> Technically, the output endianness would take the place of the int.
> But then you'd need a secondary cast, I suppose. ie
>
> big j = endian_cast<big, little>(k);
> int i = reinterpret_cast<int>(endian_cast<big, little>(k));
>
> which could maybe be somehow shortened?  But that is what is actually
> being done.  If I understand the use case correctly.
>

int i = endian_cast<big, little>(k).raw();

Not saying it's perfect or anything. In particular, I still cringe at
any code of the form "functionA().functionB()" (Well,
functionA()->functionB() more so). But it keeps some consistency and
makes the non-type-safe stuff more explicit.

Tony


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